@flusys/nestjs-entity-builder 9.1.1 → 9.1.2
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 +9 -3
- package/config/message-keys.d.ts +3 -0
- package/fesm/21.js +5 -2
- package/fesm/458.js +2 -2
- package/fesm/677.js +523 -363
- package/fesm/{582.js → 857.js} +199 -264
- package/fesm/controllers/index.js +1 -1
- package/fesm/guards/index.js +1 -1
- package/fesm/index.js +20 -5
- package/fesm/interfaces/index.js +74 -3
- package/fesm/modules/index.js +1 -1
- package/fesm/rule-engine/index.js +2 -2
- package/fesm/services/index.js +1 -1
- package/flow-engine/flow.types.d.ts +8 -4
- package/interfaces/generic-record.interface.d.ts +11 -1
- package/package.json +3 -4
- package/rule-engine/rule-engine.service.d.ts +2 -1
- package/rule-engine/rule-regex.d.ts +0 -2
- package/rule-engine/rule-values.d.ts +4 -1
- package/rule-engine/rule.interface.d.ts +2 -3
- package/services/generic-entity.service.d.ts +4 -0
package/fesm/677.js
CHANGED
|
@@ -104,8 +104,6 @@ var message_keys = __webpack_require__(5732);
|
|
|
104
104
|
var flow_errors = __webpack_require__(8542);
|
|
105
105
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/flow-engine/flow.types.ts
|
|
106
106
|
var flow_types = __webpack_require__(6256);
|
|
107
|
-
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/interfaces/generic-record.interface.ts
|
|
108
|
-
var generic_record_interface = __webpack_require__(3372);
|
|
109
107
|
;// CONCATENATED MODULE: external "node:os"
|
|
110
108
|
|
|
111
109
|
;// CONCATENATED MODULE: external "node:path"
|
|
@@ -471,7 +469,6 @@ var rule_values = __webpack_require__(6622);
|
|
|
471
469
|
|
|
472
470
|
|
|
473
471
|
|
|
474
|
-
|
|
475
472
|
/** With `env`, `lookup` expressions read through the flow (its transaction). */ function evaluationContext(state, env) {
|
|
476
473
|
const base = {
|
|
477
474
|
input: state.input,
|
|
@@ -533,24 +530,9 @@ async function mapValues(map, env, state) {
|
|
|
533
530
|
});
|
|
534
531
|
};
|
|
535
532
|
for (const [key, item] of Object.entries(map ?? {})){
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
op: item.op
|
|
540
|
-
};
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
const value = item.value === undefined ? undefined : await env.ruleEngine.resolveExpression(item.value, ctx);
|
|
544
|
-
if (value === undefined) absent(key);
|
|
545
|
-
else out[key] = {
|
|
546
|
-
op: item.op,
|
|
547
|
-
value
|
|
548
|
-
};
|
|
549
|
-
} else {
|
|
550
|
-
const value = await env.ruleEngine.resolveExpression(item, ctx);
|
|
551
|
-
if (value === undefined) absent(key);
|
|
552
|
-
else out[key] = (0,rule_values/* .equalsOperand */.$b)(value);
|
|
553
|
-
}
|
|
533
|
+
const entry = await (0,rule_values/* .resolveFilterEntry */.vY)(item, (expression)=>env.ruleEngine.resolveExpression(expression, ctx));
|
|
534
|
+
if ((0,rule_values/* .isFilterValueMissing */.kp)(entry)) absent(key);
|
|
535
|
+
else out[key] = entry;
|
|
554
536
|
}
|
|
555
537
|
return out;
|
|
556
538
|
}
|
|
@@ -580,9 +562,8 @@ async function runValidate(cfg, env, state) {
|
|
|
580
562
|
}
|
|
581
563
|
});
|
|
582
564
|
}
|
|
583
|
-
/** `{ allowed, missing }` - whether the
|
|
584
|
-
const
|
|
585
|
-
const granted = state.user ? await permissions.granted(undefined) : [];
|
|
565
|
+
/** `{ allowed, missing }` - whether the user passes the AND / OR rule; `missing` lists the codes it names that the user does not hold. */ async function runPermissionCheck(cfg, env, state) {
|
|
566
|
+
const granted = await permissionCodes(cfg, env, state);
|
|
586
567
|
const missing = (0,utils_.permissionLogicCodes)(cfg.permissions).filter((code)=>!(0,utils_.matchesPermission)(granted, code));
|
|
587
568
|
const allowed = (0,utils_.evaluatePermissionLogic)(cfg.permissions, granted).passed;
|
|
588
569
|
return deniedResult(cfg, {
|
|
@@ -590,6 +571,34 @@ async function runValidate(cfg, env, state) {
|
|
|
590
571
|
missing
|
|
591
572
|
}, allowed);
|
|
592
573
|
}
|
|
574
|
+
/** The codes the check's user holds in its company / branch; none without a user, for a set company that resolves to nothing, or outside the user's granted companies and branches. */ async function permissionCodes(cfg, env, state) {
|
|
575
|
+
const caller = state.user;
|
|
576
|
+
const asCaller = cfg.subject !== 'user';
|
|
577
|
+
const ctx = evaluationContext(state, env);
|
|
578
|
+
const resolveId = async (expression)=>expression === undefined ? null : oneId(await env.ruleEngine.resolveExpression(expression, ctx));
|
|
579
|
+
const userId = asCaller ? caller?.id ?? null : await resolveId(cfg.userId);
|
|
580
|
+
if (!userId) return [];
|
|
581
|
+
const currentCompanyId = caller?.companyId ?? null;
|
|
582
|
+
const companyId = cfg.companyId === undefined ? currentCompanyId : await resolveId(cfg.companyId);
|
|
583
|
+
if (cfg.companyId !== undefined && !companyId) return [];
|
|
584
|
+
const branchId = await resolveId(cfg.branchId);
|
|
585
|
+
if (asCaller && companyId === currentCompanyId) {
|
|
586
|
+
const permissions = state.permissions ?? env.ruleEngine.createPermissionResolver(caller);
|
|
587
|
+
if (cfg.branchId === undefined) return permissions.granted(undefined);
|
|
588
|
+
if (branchId === null || branchId === caller?.branchId) return permissions.granted(branchId);
|
|
589
|
+
}
|
|
590
|
+
if (companyId && !await isGrantedScope(userId, companyId, branchId, env)) return [];
|
|
591
|
+
return env.ruleEngine.permissionCodes({
|
|
592
|
+
userId,
|
|
593
|
+
companyId,
|
|
594
|
+
branchId
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
async function isGrantedScope(userId, companyId, branchId, env) {
|
|
598
|
+
const { companies, branches } = await env.companyAccess(userId);
|
|
599
|
+
if (!companies.some((company)=>company.id === companyId)) return false;
|
|
600
|
+
return branchId === null || branches.some((branch)=>branch.id === branchId && branch.companyId === companyId);
|
|
601
|
+
}
|
|
593
602
|
/** A denied check: `onDenied: branch` follows the `denied` port, otherwise the run is answered `statusCode` (403). */ function deniedResult(cfg, output, allowed) {
|
|
594
603
|
if (cfg.onDenied === 'branch') return {
|
|
595
604
|
output,
|
|
@@ -1810,16 +1819,14 @@ function successResult(state, startedAt) {
|
|
|
1810
1819
|
},
|
|
1811
1820
|
3186(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1812
1821
|
/* import */ var _flusys_nestjs_shared_utils__rspack_import_0 = __webpack_require__(9216);
|
|
1813
|
-
/* import */ var
|
|
1814
|
-
/* import */ var
|
|
1822
|
+
/* import */ var _config_entity_builder_constants_js__rspack_import_8 = __webpack_require__(6576);
|
|
1823
|
+
/* import */ var _config_message_keys_js__rspack_import_7 = __webpack_require__(5732);
|
|
1815
1824
|
/* import */ var _interfaces_generic_record_interface_js__rspack_import_1 = __webpack_require__(3372);
|
|
1816
|
-
/* import */ var _rule_engine_index_js__rspack_import_2 = __webpack_require__(
|
|
1825
|
+
/* import */ var _rule_engine_index_js__rspack_import_2 = __webpack_require__(8552);
|
|
1817
1826
|
/* import */ var _rule_engine_rule_ip_js__rspack_import_3 = __webpack_require__(809);
|
|
1818
1827
|
/* import */ var _rule_engine_rule_permission_js__rspack_import_4 = __webpack_require__(5191);
|
|
1819
|
-
/* import */ var
|
|
1820
|
-
/* import */ var
|
|
1821
|
-
/* import */ var _flow_api_key_js__rspack_import_7 = __webpack_require__(4816);
|
|
1822
|
-
|
|
1828
|
+
/* import */ var _flow_types_js__rspack_import_5 = __webpack_require__(6256);
|
|
1829
|
+
/* import */ var _flow_api_key_js__rspack_import_6 = __webpack_require__(4816);
|
|
1823
1830
|
|
|
1824
1831
|
|
|
1825
1832
|
|
|
@@ -1963,7 +1970,14 @@ const DURATION_ARG = {
|
|
|
1963
1970
|
case 'lookup':
|
|
1964
1971
|
for (const item of Object.values(expression.filter ?? {})){
|
|
1965
1972
|
const value = (0,_interfaces_generic_record_interface_js__rspack_import_1/* .isRecordFilterCondition */.t1)(item) ? item.value : item;
|
|
1966
|
-
|
|
1973
|
+
for (const operand of (0,_interfaces_generic_record_interface_js__rspack_import_1/* .isFilterRange */.iA)(value) ? [
|
|
1974
|
+
value.from,
|
|
1975
|
+
value.to
|
|
1976
|
+
] : [
|
|
1977
|
+
value
|
|
1978
|
+
]){
|
|
1979
|
+
if (isExpression(operand)) collectExpressionRefs(operand, out);
|
|
1980
|
+
}
|
|
1967
1981
|
}
|
|
1968
1982
|
break;
|
|
1969
1983
|
}
|
|
@@ -2000,37 +2014,37 @@ function isExpression(value) {
|
|
|
2000
2014
|
return !!value && typeof value === 'object' && typeof value.type === 'string';
|
|
2001
2015
|
}
|
|
2002
2016
|
/** Expression shape check with the engine's limits (no evaluation). */ function expressionProblem(value, depth = 0, options = {}) {
|
|
2003
|
-
if (!isExpression(value)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2004
|
-
if (depth > _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_GROUP_DEPTH */.bw.MAX_GROUP_DEPTH) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2017
|
+
if (!isExpression(value)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.NOT_AN_EXPRESSION */.IP.NOT_AN_EXPRESSION);
|
|
2018
|
+
if (depth > _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_GROUP_DEPTH */.bw.MAX_GROUP_DEPTH) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.TOO_DEEP */.IP.TOO_DEEP);
|
|
2005
2019
|
switch(value.type){
|
|
2006
2020
|
case 'literal':
|
|
2007
2021
|
return null;
|
|
2008
2022
|
case 'field_ref':
|
|
2009
|
-
return typeof value.ref === 'string' && value.ref.length > 0 ? null : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2023
|
+
return typeof value.ref === 'string' && value.ref.length > 0 ? null : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.EMPTY_REFERENCE */.IP.EMPTY_REFERENCE);
|
|
2010
2024
|
case 'template':
|
|
2011
|
-
if (typeof value.template !== 'string') return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2012
|
-
return value.template.length <= _rule_engine_index_js__rspack_import_2/* .RULE_TEMPLATE_MAX_LENGTH */.ym ? null : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2025
|
+
if (typeof value.template !== 'string') return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.NO_TEMPLATE_TEXT */.IP.NO_TEMPLATE_TEXT);
|
|
2026
|
+
return value.template.length <= _rule_engine_index_js__rspack_import_2/* .RULE_TEMPLATE_MAX_LENGTH */.ym ? null : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.TEMPLATE_TOO_LONG */.IP.TEMPLATE_TOO_LONG);
|
|
2013
2027
|
case 'arithmetic':
|
|
2014
|
-
return Array.isArray(value.operands) ? firstProblem(value.operands, depth, options) : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2028
|
+
return Array.isArray(value.operands) ? firstProblem(value.operands, depth, options) : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.NO_OPERANDS */.IP.NO_OPERANDS);
|
|
2015
2029
|
case 'concat':
|
|
2016
|
-
return Array.isArray(value.parts) ? firstProblem(value.parts, depth, options) : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2030
|
+
return Array.isArray(value.parts) ? firstProblem(value.parts, depth, options) : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.NO_PARTS */.IP.NO_PARTS);
|
|
2017
2031
|
case 'function':
|
|
2018
2032
|
return functionProblem(value, depth, options);
|
|
2019
2033
|
case 'lookup':
|
|
2020
2034
|
return lookupProblem(value, depth, options);
|
|
2021
2035
|
default:
|
|
2022
|
-
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2036
|
+
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.UNKNOWN_EXPRESSION_TYPE */.IP.UNKNOWN_EXPRESSION_TYPE, {
|
|
2023
2037
|
type: value.type
|
|
2024
2038
|
});
|
|
2025
2039
|
}
|
|
2026
2040
|
}
|
|
2027
2041
|
function functionProblem(value, depth, options) {
|
|
2028
|
-
if (!Array.isArray(value.args)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2042
|
+
if (!Array.isArray(value.args)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.NO_ARGUMENTS */.IP.NO_ARGUMENTS);
|
|
2029
2043
|
const arity = FUNCTION_ARITY[value.name];
|
|
2030
|
-
if (!arity) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2044
|
+
if (!arity) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.UNKNOWN_FUNCTION */.IP.UNKNOWN_FUNCTION, {
|
|
2031
2045
|
name: String(value.name)
|
|
2032
2046
|
});
|
|
2033
|
-
if (value.args.length < arity[0] || value.args.length > arity[1]) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2047
|
+
if (value.args.length < arity[0] || value.args.length > arity[1]) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.WRONG_ARGUMENT_COUNT */.IP.WRONG_ARGUMENT_COUNT, {
|
|
2034
2048
|
name: value.name,
|
|
2035
2049
|
min: arity[0],
|
|
2036
2050
|
max: arity[1]
|
|
@@ -2038,7 +2052,7 @@ function functionProblem(value, depth, options) {
|
|
|
2038
2052
|
const unitAt = DURATION_ARG[value.name];
|
|
2039
2053
|
const unit = unitAt === undefined ? undefined : value.args[unitAt];
|
|
2040
2054
|
if (unit?.type === 'literal' && !_rule_engine_index_js__rspack_import_2/* .RULE_DURATION_UNITS.includes */.qO.includes(unit.value)) {
|
|
2041
|
-
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2055
|
+
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.DURATION_UNIT_INVALID */.IP.DURATION_UNIT_INVALID, {
|
|
2042
2056
|
units: _rule_engine_index_js__rspack_import_2/* .RULE_DURATION_UNITS.join */.qO.join(', ')
|
|
2043
2057
|
});
|
|
2044
2058
|
}
|
|
@@ -2061,18 +2075,18 @@ function functionProblem(value, depth, options) {
|
|
|
2061
2075
|
try {
|
|
2062
2076
|
parsed = (0,_rule_engine_rule_permission_js__rspack_import_4/* .parsePermissionCodes */.PS)(codes.value);
|
|
2063
2077
|
} catch {
|
|
2064
|
-
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2078
|
+
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .RULE_ENGINE_MESSAGES.TOO_MANY_PERMISSION_CODES */.x3.TOO_MANY_PERMISSION_CODES, {
|
|
2065
2079
|
max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_PERMISSION_CODES */.bw.MAX_PERMISSION_CODES
|
|
2066
2080
|
});
|
|
2067
2081
|
}
|
|
2068
|
-
return parsed.length ? null : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2082
|
+
return parsed.length ? null : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.PERMISSION_CODE_REQUIRED */.IP.PERMISSION_CODE_REQUIRED, {
|
|
2069
2083
|
name: value.name
|
|
2070
2084
|
});
|
|
2071
2085
|
}
|
|
2072
2086
|
if (value.name === 'IP_IN_RANGE') {
|
|
2073
2087
|
const ranges = literal(1);
|
|
2074
2088
|
const invalid = ranges.ok ? (0,_rule_engine_rule_ip_js__rspack_import_3/* .invalidIpRange */.I8)(ranges.value) : null;
|
|
2075
|
-
return invalid ? (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2089
|
+
return invalid ? (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.IP_RANGE_INVALID */.IP.IP_RANGE_INVALID, {
|
|
2076
2090
|
range: invalid
|
|
2077
2091
|
}) : null;
|
|
2078
2092
|
}
|
|
@@ -2084,15 +2098,15 @@ function functionProblem(value, depth, options) {
|
|
|
2084
2098
|
return null;
|
|
2085
2099
|
}
|
|
2086
2100
|
function patternProblem(pattern) {
|
|
2087
|
-
switch((0,
|
|
2101
|
+
switch((0,_flusys_nestjs_shared_utils__rspack_import_0.safeRegexProblem)(pattern)){
|
|
2088
2102
|
case 'too_long':
|
|
2089
|
-
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2103
|
+
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.REGEX_TOO_LONG */.IP.REGEX_TOO_LONG, {
|
|
2090
2104
|
max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_REGEX_PATTERN_LENGTH */.bw.MAX_REGEX_PATTERN_LENGTH
|
|
2091
2105
|
});
|
|
2092
2106
|
case 'invalid':
|
|
2093
|
-
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2107
|
+
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.REGEX_INVALID */.IP.REGEX_INVALID);
|
|
2094
2108
|
case 'too_complex':
|
|
2095
|
-
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2109
|
+
return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.REGEX_TOO_COMPLEX */.IP.REGEX_TOO_COMPLEX, {
|
|
2096
2110
|
max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_REGEX_REPEAT */.bw.MAX_REGEX_REPEAT
|
|
2097
2111
|
});
|
|
2098
2112
|
default:
|
|
@@ -2100,20 +2114,20 @@ function patternProblem(pattern) {
|
|
|
2100
2114
|
}
|
|
2101
2115
|
}
|
|
2102
2116
|
function lookupProblem(value, depth, options) {
|
|
2103
|
-
if (typeof value.entity !== 'string' || !
|
|
2104
|
-
if (options.knownEntityCodes && !options.knownEntityCodes.has(value.entity)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2117
|
+
if (typeof value.entity !== 'string' || !_config_entity_builder_constants_js__rspack_import_8/* .ENTITY_CODE_PATTERN.test */.vs.test(value.entity)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.LOOKUP_ENTITY_INVALID */.IP.LOOKUP_ENTITY_INVALID);
|
|
2118
|
+
if (options.knownEntityCodes && !options.knownEntityCodes.has(value.entity)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.LOOKUP_ENTITY_UNKNOWN */.IP.LOOKUP_ENTITY_UNKNOWN, {
|
|
2105
2119
|
entity: value.entity
|
|
2106
2120
|
});
|
|
2107
2121
|
if (![
|
|
2108
2122
|
'exists',
|
|
2109
2123
|
'count',
|
|
2110
2124
|
'first'
|
|
2111
|
-
].includes(value.mode)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2112
|
-
if (value.field !== undefined && (typeof value.field !== 'string' || !COLUMN_CODE.test(value.field))) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2113
|
-
if (value.sort !== undefined && (typeof value.sort?.field !== 'string' || !COLUMN_CODE.test(value.sort.field))) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2114
|
-
if (!value.filter || typeof value.filter !== 'object' || Array.isArray(value.filter)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2125
|
+
].includes(value.mode)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.LOOKUP_MODE_INVALID */.IP.LOOKUP_MODE_INVALID);
|
|
2126
|
+
if (value.field !== undefined && (typeof value.field !== 'string' || !COLUMN_CODE.test(value.field))) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.LOOKUP_FIELD_INVALID */.IP.LOOKUP_FIELD_INVALID);
|
|
2127
|
+
if (value.sort !== undefined && (typeof value.sort?.field !== 'string' || !COLUMN_CODE.test(value.sort.field))) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.LOOKUP_FIELD_INVALID */.IP.LOOKUP_FIELD_INVALID);
|
|
2128
|
+
if (!value.filter || typeof value.filter !== 'object' || Array.isArray(value.filter)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.LOOKUP_FILTER_INVALID */.IP.LOOKUP_FILTER_INVALID);
|
|
2115
2129
|
for (const [key, item] of Object.entries(value.filter)){
|
|
2116
|
-
if (!COLUMN_CODE.test(key)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2130
|
+
if (!COLUMN_CODE.test(key)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.LOOKUP_FILTER_INVALID */.IP.LOOKUP_FILTER_INVALID);
|
|
2117
2131
|
const problem = filterValueProblem(item, depth, options);
|
|
2118
2132
|
if (problem) return problem;
|
|
2119
2133
|
}
|
|
@@ -2122,16 +2136,21 @@ function lookupProblem(value, depth, options) {
|
|
|
2122
2136
|
/** A filter entry: an expression (eq) or `{ op, value? }` with an expression value. */ function filterValueProblem(item, depth, options) {
|
|
2123
2137
|
if (!(0,_interfaces_generic_record_interface_js__rspack_import_1/* .isRecordFilterCondition */.t1)(item)) {
|
|
2124
2138
|
const op = item && typeof item === 'object' && !Array.isArray(item) && !('type' in item) ? item.op : undefined;
|
|
2125
|
-
if (typeof op === 'string' && !_interfaces_generic_record_interface_js__rspack_import_1/* .RECORD_FILTER_OPS.includes */.ox.includes(op)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2139
|
+
if (typeof op === 'string' && !_interfaces_generic_record_interface_js__rspack_import_1/* .RECORD_FILTER_OPS.includes */.ox.includes(op)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.FILTER_OPERATOR_UNKNOWN */.IP.FILTER_OPERATOR_UNKNOWN, {
|
|
2126
2140
|
op
|
|
2127
2141
|
});
|
|
2128
2142
|
return expressionProblem(item, depth + 1, options);
|
|
2129
2143
|
}
|
|
2130
|
-
|
|
2131
|
-
if (
|
|
2144
|
+
const kind = _interfaces_generic_record_interface_js__rspack_import_1/* .FILTER_OP_VALUE_KIND */.w9[item.op];
|
|
2145
|
+
if (kind === 'none') return null;
|
|
2146
|
+
if (item.value === undefined) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.FILTER_VALUE_REQUIRED */.IP.FILTER_VALUE_REQUIRED, {
|
|
2147
|
+
op: item.op
|
|
2148
|
+
});
|
|
2149
|
+
if (kind !== 'range') return expressionProblem(item.value, depth + 1, options);
|
|
2150
|
+
if (!(0,_interfaces_generic_record_interface_js__rspack_import_1/* .isFilterRange */.iA)(item.value)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.FILTER_RANGE_INVALID */.IP.FILTER_RANGE_INVALID, {
|
|
2132
2151
|
op: item.op
|
|
2133
2152
|
});
|
|
2134
|
-
return expressionProblem(item.value, depth + 1, options);
|
|
2153
|
+
return expressionProblem(item.value.from, depth + 1, options) ?? expressionProblem(item.value.to, depth + 1, options);
|
|
2135
2154
|
}
|
|
2136
2155
|
function firstProblem(items, depth, options) {
|
|
2137
2156
|
for (const item of items){
|
|
@@ -2142,8 +2161,8 @@ function firstProblem(items, depth, options) {
|
|
|
2142
2161
|
}
|
|
2143
2162
|
function conditionProblem(node, options) {
|
|
2144
2163
|
const hasLeft = node?.left !== undefined;
|
|
2145
|
-
if (!node || !hasLeft && (typeof node.field !== 'string' || !node.field) || typeof node.comparison !== 'string') return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2146
|
-
if (!_rule_engine_index_js__rspack_import_2/* .RULE_COMPARISON_OPERATORS.includes */.dJ.includes(node.comparison)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2164
|
+
if (!node || !hasLeft && (typeof node.field !== 'string' || !node.field) || typeof node.comparison !== 'string') return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.CONDITION_INCOMPLETE */.IP.CONDITION_INCOMPLETE);
|
|
2165
|
+
if (!_rule_engine_index_js__rspack_import_2/* .RULE_COMPARISON_OPERATORS.includes */.dJ.includes(node.comparison)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.UNKNOWN_COMPARISON */.IP.UNKNOWN_COMPARISON, {
|
|
2147
2166
|
comparison: node.comparison
|
|
2148
2167
|
});
|
|
2149
2168
|
if (hasLeft) {
|
|
@@ -2159,15 +2178,15 @@ function conditionProblem(node, options) {
|
|
|
2159
2178
|
return null;
|
|
2160
2179
|
}
|
|
2161
2180
|
/** Rule group shape check with the engine's limits (no evaluation). */ function groupProblem(group, depth = 0, options = {}) {
|
|
2162
|
-
if (!group || typeof group !== 'object' || !Array.isArray(group.conditions)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2181
|
+
if (!group || typeof group !== 'object' || !Array.isArray(group.conditions)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.NOT_A_RULE */.IP.NOT_A_RULE);
|
|
2163
2182
|
const g = group;
|
|
2164
|
-
if (depth > _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_GROUP_DEPTH */.bw.MAX_GROUP_DEPTH) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2165
|
-
if (g.conditions.length > _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_CONDITIONS_PER_GROUP */.bw.MAX_CONDITIONS_PER_GROUP) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2183
|
+
if (depth > _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_GROUP_DEPTH */.bw.MAX_GROUP_DEPTH) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.TOO_DEEP */.IP.TOO_DEEP);
|
|
2184
|
+
if (g.conditions.length > _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_CONDITIONS_PER_GROUP */.bw.MAX_CONDITIONS_PER_GROUP) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.TOO_MANY_CONDITIONS */.IP.TOO_MANY_CONDITIONS);
|
|
2166
2185
|
if (![
|
|
2167
2186
|
'AND',
|
|
2168
2187
|
'OR',
|
|
2169
2188
|
'NOT'
|
|
2170
|
-
].includes(g.operator)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2189
|
+
].includes(g.operator)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SHAPE_MESSAGES.UNKNOWN_OPERATOR */.IP.UNKNOWN_OPERATOR);
|
|
2171
2190
|
for (const node of g.conditions){
|
|
2172
2191
|
const problem = node && (0,_rule_engine_index_js__rspack_import_2/* .isRuleGroup */.GD)(node) ? groupProblem(node, depth + 1, options) : conditionProblem(node, options);
|
|
2173
2192
|
if (problem) return problem;
|
|
@@ -2183,33 +2202,33 @@ function conditionProblem(node, options) {
|
|
|
2183
2202
|
const errors = [];
|
|
2184
2203
|
const warnings = [];
|
|
2185
2204
|
const err = (message)=>errors.push(message);
|
|
2186
|
-
if (!
|
|
2205
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_SLUG_PATTERN.test */.YD.test(flow.slug ?? '')) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.SLUG_INVALID */.qj.SLUG_INVALID));
|
|
2187
2206
|
const nodes = Array.isArray(flow.nodes) ? flow.nodes : [];
|
|
2188
2207
|
const edges = Array.isArray(flow.edges) ? flow.edges : [];
|
|
2189
|
-
if (!nodes.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2190
|
-
if (nodes.length >
|
|
2191
|
-
max:
|
|
2208
|
+
if (!nodes.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NO_NODES */.qj.NO_NODES));
|
|
2209
|
+
if (nodes.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TOO_MANY_NODES */.qj.TOO_MANY_NODES, {
|
|
2210
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES
|
|
2192
2211
|
}));
|
|
2193
|
-
if (edges.length >
|
|
2194
|
-
max:
|
|
2212
|
+
if (edges.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TOO_MANY_EDGES */.qj.TOO_MANY_EDGES, {
|
|
2213
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES
|
|
2195
2214
|
}));
|
|
2196
|
-
if (errors.length && (!nodes.length || nodes.length >
|
|
2215
|
+
if (errors.length && (!nodes.length || nodes.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES || edges.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES)) return {
|
|
2197
2216
|
errors,
|
|
2198
2217
|
warnings
|
|
2199
2218
|
};
|
|
2200
2219
|
const byId = new Map();
|
|
2201
2220
|
for (const node of nodes){
|
|
2202
|
-
if (!
|
|
2203
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2221
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_NODE_ID_PATTERN.test */.z6.test(node?.id ?? '')) {
|
|
2222
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_ID_INVALID */.qj.NODE_ID_INVALID, {
|
|
2204
2223
|
id: node?.id
|
|
2205
2224
|
}));
|
|
2206
2225
|
continue;
|
|
2207
2226
|
}
|
|
2208
|
-
if (byId.has(node.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2227
|
+
if (byId.has(node.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_ID_DUPLICATE */.qj.NODE_ID_DUPLICATE, {
|
|
2209
2228
|
id: node.id
|
|
2210
2229
|
}));
|
|
2211
2230
|
byId.set(node.id, node);
|
|
2212
|
-
if (!
|
|
2231
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_NODE_TYPES.includes */.q2.includes(node.type)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_TYPE_UNKNOWN */.qj.NODE_TYPE_UNKNOWN, {
|
|
2213
2232
|
id: node.id,
|
|
2214
2233
|
type: node.type
|
|
2215
2234
|
}));
|
|
@@ -2222,24 +2241,24 @@ function conditionProblem(node, options) {
|
|
|
2222
2241
|
const outgoing = new Map();
|
|
2223
2242
|
const edgeIds = new Set();
|
|
2224
2243
|
for (const edge of edges){
|
|
2225
|
-
if (edgeIds.has(edge.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2244
|
+
if (edgeIds.has(edge.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.EDGE_ID_DUPLICATE */.qj.EDGE_ID_DUPLICATE, {
|
|
2226
2245
|
id: edge.id
|
|
2227
2246
|
}));
|
|
2228
2247
|
edgeIds.add(edge.id);
|
|
2229
2248
|
const from = byId.get(edge.from);
|
|
2230
2249
|
const to = byId.get(edge.to);
|
|
2231
2250
|
if (!from || !to) {
|
|
2232
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2251
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.EDGE_DANGLING */.qj.EDGE_DANGLING, {
|
|
2233
2252
|
from: edge.from,
|
|
2234
2253
|
to: edge.to
|
|
2235
2254
|
}));
|
|
2236
2255
|
continue;
|
|
2237
2256
|
}
|
|
2238
|
-
if (edge.from === edge.to) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2257
|
+
if (edge.from === edge.to) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.EDGE_SELF */.qj.EDGE_SELF, {
|
|
2239
2258
|
id: edge.from
|
|
2240
2259
|
}));
|
|
2241
|
-
if (to.type === 'trigger') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2242
|
-
if (!(0,
|
|
2260
|
+
if (to.type === 'trigger') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.EDGE_INTO_TRIGGER */.qj.EDGE_INTO_TRIGGER));
|
|
2261
|
+
if (!(0,_flow_types_js__rspack_import_5/* .portsOf */.a5)(from).includes(edge.port)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.EDGE_NO_PORT */.qj.EDGE_NO_PORT, {
|
|
2243
2262
|
id: from.id,
|
|
2244
2263
|
port: edge.port
|
|
2245
2264
|
}));
|
|
@@ -2255,29 +2274,29 @@ function conditionProblem(node, options) {
|
|
|
2255
2274
|
const seenPairs = new Set();
|
|
2256
2275
|
for (const edge of edges){
|
|
2257
2276
|
const key = `${edge.from}|${edge.port}|${edge.to}`;
|
|
2258
|
-
if (seenPairs.has(key)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2277
|
+
if (seenPairs.has(key)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.EDGE_TWICE */.qj.EDGE_TWICE, {
|
|
2259
2278
|
from: edge.from,
|
|
2260
2279
|
to: edge.to
|
|
2261
2280
|
}));
|
|
2262
2281
|
seenPairs.add(key);
|
|
2263
2282
|
}
|
|
2264
2283
|
const cyclic = hasCycle(nodes, outgoing);
|
|
2265
|
-
if (cyclic) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2284
|
+
if (cyclic) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.CYCLE */.qj.CYCLE));
|
|
2266
2285
|
const reachable = triggers.length ? new Set(triggers.flatMap((trigger)=>[
|
|
2267
2286
|
...reach(trigger.id, outgoing)
|
|
2268
2287
|
])) : null;
|
|
2269
2288
|
for (const node of nodes){
|
|
2270
|
-
if (reachable && !reachable.has(node.id)) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2271
|
-
node: (0,
|
|
2289
|
+
if (reachable && !reachable.has(node.id)) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_UNREACHABLE */.qj.NODE_UNREACHABLE, {
|
|
2290
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
|
|
2272
2291
|
}));
|
|
2273
2292
|
}
|
|
2274
2293
|
checkNodeReferences(nodes, byId, flow, err, warnings);
|
|
2275
2294
|
if (!cyclic && reachable) checkReferenceTiming(nodes, edges, byId, reachable, warnings);
|
|
2276
2295
|
if (!cyclic) checkLoopDepth(nodes, outgoing, err);
|
|
2277
2296
|
// Transaction and access are a Request step's own: each is checked against the steps its runs reach.
|
|
2278
|
-
const runs = (0,
|
|
2297
|
+
const runs = (0,_flow_types_js__rspack_import_5/* .flowEndpoints */.Xr)(flow).map((endpoint)=>({
|
|
2279
2298
|
endpoint,
|
|
2280
|
-
label: (0,
|
|
2299
|
+
label: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(byId.get(endpoint.nodeId) ?? {
|
|
2281
2300
|
id: endpoint.nodeId,
|
|
2282
2301
|
name: ''
|
|
2283
2302
|
}),
|
|
@@ -2315,24 +2334,24 @@ function conditionProblem(node, options) {
|
|
|
2315
2334
|
};
|
|
2316
2335
|
for (const { endpoint, label, steps } of runs){
|
|
2317
2336
|
if (endpoint.isTransactional) {
|
|
2318
|
-
if (steps.some((n)=>n.type === 'http_request')) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2337
|
+
if (steps.some((n)=>n.type === 'http_request')) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRANSACTIONAL_HTTP */.qj.TRANSACTIONAL_HTTP, {
|
|
2319
2338
|
node: label
|
|
2320
2339
|
}));
|
|
2321
2340
|
// Inside the run's transaction a message is only sent once it commits: a failed send is logged, it cannot take the error path.
|
|
2322
|
-
for (const n of steps)if ((0,
|
|
2323
|
-
node: (0,
|
|
2341
|
+
for (const n of steps)if ((0,_flow_types_js__rspack_import_5/* .isMessageNode */.SE)(n.type) && n.onError === 'continue') warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.MESSAGE_AFTER_COMMIT */.qj.MESSAGE_AFTER_COMMIT, {
|
|
2342
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(n)
|
|
2324
2343
|
}));
|
|
2325
2344
|
}
|
|
2326
|
-
if (endpoint.authMode === 'public' && steps.some((n)=>(0,
|
|
2345
|
+
if (endpoint.authMode === 'public' && steps.some((n)=>(0,_flow_types_js__rspack_import_5/* .isMessageNode */.SE)(n.type))) warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.PUBLIC_MESSAGE */.qj.PUBLIC_MESSAGE));
|
|
2327
2346
|
// A URL callers reach without signing in has no user: user checks deny them, and its record steps are open to anyone who can call it.
|
|
2328
|
-
if (!
|
|
2329
|
-
if (steps.some((n)=>n.type === 'permission_check' || n.type === 'company_branch_check' && n.config?.['subject'] !== 'user' || usesPermissionFunction(n.config))) warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2347
|
+
if (!_flow_types_js__rspack_import_5/* .KEYLESS_AUTH_MODES.has */.d7.has(endpoint.authMode)) continue;
|
|
2348
|
+
if (steps.some((n)=>(n.type === 'permission_check' || n.type === 'company_branch_check') && n.config?.['subject'] !== 'user' || usesPermissionFunction(n.config))) warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.PERMISSION_WITHOUT_USER */.qj.PERMISSION_WITHOUT_USER));
|
|
2330
2349
|
const entities = steps.flatMap(entitiesOf);
|
|
2331
2350
|
if (!entities.length) continue;
|
|
2332
2351
|
keyless.endpoints.push(endpoint.path ? `/${endpoint.path}` : '/');
|
|
2333
2352
|
for (const code of entities)keyless.entities.add(code);
|
|
2334
2353
|
}
|
|
2335
|
-
if (keyless.endpoints.length) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2354
|
+
if (keyless.endpoints.length) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.KEYLESS_ENTITY */.qj.KEYLESS_ENTITY, {
|
|
2336
2355
|
endpoints: keyless.endpoints.join(', '),
|
|
2337
2356
|
entities: [
|
|
2338
2357
|
...keyless.entities
|
|
@@ -2340,16 +2359,16 @@ function conditionProblem(node, options) {
|
|
|
2340
2359
|
}));
|
|
2341
2360
|
}
|
|
2342
2361
|
/** At least one Request step; at most one on the flow's own URL, the others on distinct paths. */ function checkTriggers(triggers, err) {
|
|
2343
|
-
if (!triggers.length) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2344
|
-
const main = triggers.filter((trigger)=>!(0,
|
|
2345
|
-
if (main.length > 1) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2362
|
+
if (!triggers.length) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_MISSING */.qj.TRIGGER_MISSING));
|
|
2363
|
+
const main = triggers.filter((trigger)=>!(0,_flow_types_js__rspack_import_5/* .triggerPath */.um)(trigger));
|
|
2364
|
+
if (main.length > 1) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_MAIN_DUPLICATE */.qj.TRIGGER_MAIN_DUPLICATE, {
|
|
2346
2365
|
count: main.length
|
|
2347
2366
|
}));
|
|
2348
2367
|
const paths = new Set();
|
|
2349
2368
|
for (const trigger of triggers){
|
|
2350
|
-
const path = (0,
|
|
2369
|
+
const path = (0,_flow_types_js__rspack_import_5/* .triggerPath */.um)(trigger);
|
|
2351
2370
|
if (!path) continue;
|
|
2352
|
-
if (paths.has(path)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2371
|
+
if (paths.has(path)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_PATH_DUPLICATE */.qj.TRIGGER_PATH_DUPLICATE, {
|
|
2353
2372
|
path
|
|
2354
2373
|
}));
|
|
2355
2374
|
paths.add(path);
|
|
@@ -2362,41 +2381,41 @@ function conditionProblem(node, options) {
|
|
|
2362
2381
|
*/ function checkCalledFlow(node, flow, known, err, warn) {
|
|
2363
2382
|
const { flowSlug: slug, endpoint, input, inputList } = node.config;
|
|
2364
2383
|
const at = {
|
|
2365
|
-
node: (0,
|
|
2384
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
|
|
2366
2385
|
};
|
|
2367
2386
|
const target = known.get(slug);
|
|
2368
2387
|
const vars = {
|
|
2369
2388
|
...at,
|
|
2370
2389
|
flow: slug
|
|
2371
2390
|
};
|
|
2372
|
-
if (!target.isActive) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2391
|
+
if (!target.isActive) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INACTIVE */.qj.NODE_FLOW_INACTIVE, vars));
|
|
2373
2392
|
const path = typeof endpoint === 'string' && endpoint ? endpoint : null;
|
|
2374
2393
|
const entry = target.endpoints.find((e)=>e.path === path);
|
|
2375
2394
|
// A flow has no key to send, so an API-key URL is never callable from one.
|
|
2376
|
-
if (entry?.authMode === 'api_key') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2395
|
+
if (entry?.authMode === 'api_key') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_API_KEY */.qj.NODE_FLOW_API_KEY, vars));
|
|
2377
2396
|
if (!entry) {
|
|
2378
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(path ?
|
|
2397
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(path ? _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_ENDPOINT_UNKNOWN */.qj.NODE_FLOW_ENDPOINT_UNKNOWN : _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_ENDPOINT_REQUIRED */.qj.NODE_FLOW_ENDPOINT_REQUIRED, {
|
|
2379
2398
|
...vars,
|
|
2380
2399
|
endpoint: path ?? ''
|
|
2381
2400
|
}));
|
|
2382
2401
|
} else if (entry.bodyType === 'list') {
|
|
2383
|
-
if (inputList === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2402
|
+
if (inputList === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_LIST_REQUIRED */.qj.NODE_FLOW_INPUT_LIST_REQUIRED, vars));
|
|
2384
2403
|
} else if (inputList !== undefined) {
|
|
2385
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2404
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_LIST_UNEXPECTED */.qj.NODE_FLOW_INPUT_LIST_UNEXPECTED, vars));
|
|
2386
2405
|
} else {
|
|
2387
2406
|
checkCalledInputs(input, entry.inputSchema, vars, err, warn);
|
|
2388
2407
|
}
|
|
2389
2408
|
const loop = callPathTo(slug, flow.slug, known, new Set());
|
|
2390
|
-
if (loop) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2409
|
+
if (loop) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_LOOP */.qj.NODE_FLOW_LOOP, {
|
|
2391
2410
|
...at,
|
|
2392
2411
|
chain: [
|
|
2393
2412
|
flow.slug,
|
|
2394
2413
|
...loop
|
|
2395
2414
|
].join(' > ')
|
|
2396
2415
|
}));
|
|
2397
|
-
if (1 + callDepth(slug, known, new Set()) >
|
|
2416
|
+
if (1 + callDepth(slug, known, new Set()) > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CALL_DEPTH */.Or.MAX_CALL_DEPTH) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_TOO_DEEP */.qj.NODE_FLOW_TOO_DEEP, {
|
|
2398
2417
|
...at,
|
|
2399
|
-
max:
|
|
2418
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CALL_DEPTH */.Or.MAX_CALL_DEPTH
|
|
2400
2419
|
}));
|
|
2401
2420
|
}
|
|
2402
2421
|
/**
|
|
@@ -2410,17 +2429,17 @@ function conditionProblem(node, options) {
|
|
|
2410
2429
|
if (node?.type !== 'call_flow' || typeof c.flowSlug !== 'string') continue;
|
|
2411
2430
|
if (c.flowSlug !== slug && !callPathTo(c.flowSlug, slug, known, new Set())) continue;
|
|
2412
2431
|
const at = {
|
|
2413
|
-
node: (0,
|
|
2432
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
|
|
2414
2433
|
};
|
|
2415
2434
|
const target = known.get(c.flowSlug);
|
|
2416
2435
|
if (!target) {
|
|
2417
|
-
problems.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2436
|
+
problems.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_UNKNOWN */.qj.NODE_FLOW_UNKNOWN, {
|
|
2418
2437
|
...at,
|
|
2419
2438
|
flow: c.flowSlug
|
|
2420
2439
|
}));
|
|
2421
2440
|
continue;
|
|
2422
2441
|
}
|
|
2423
|
-
if (!target.isActive) problems.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2442
|
+
if (!target.isActive) problems.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INACTIVE */.qj.NODE_FLOW_INACTIVE, {
|
|
2424
2443
|
...at,
|
|
2425
2444
|
flow: c.flowSlug
|
|
2426
2445
|
}));
|
|
@@ -2432,14 +2451,14 @@ function conditionProblem(node, options) {
|
|
|
2432
2451
|
const given = input && typeof input === 'object' && !Array.isArray(input) ? Object.keys(input) : [];
|
|
2433
2452
|
if (schema.length) {
|
|
2434
2453
|
const declared = new Set(schema.map((field)=>field.name));
|
|
2435
|
-
for (const name of given)if (!declared.has(name)) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2454
|
+
for (const name of given)if (!declared.has(name)) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_UNDECLARED */.qj.NODE_FLOW_INPUT_UNDECLARED, {
|
|
2436
2455
|
...vars,
|
|
2437
2456
|
input: name
|
|
2438
2457
|
}));
|
|
2439
2458
|
}
|
|
2440
2459
|
for (const field of schema){
|
|
2441
2460
|
if (field.required && (field.default === undefined || field.default === null) && !given.includes(field.name)) {
|
|
2442
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2461
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_MISSING */.qj.NODE_FLOW_INPUT_MISSING, {
|
|
2443
2462
|
...vars,
|
|
2444
2463
|
input: field.name
|
|
2445
2464
|
}));
|
|
@@ -2462,7 +2481,7 @@ function conditionProblem(node, options) {
|
|
|
2462
2481
|
return null;
|
|
2463
2482
|
}
|
|
2464
2483
|
/** How many calls deep the longest chain starting inside `slug` goes, counted only as far as the limit; a chain that loops is cut where it repeats. */ function callDepth(slug, known, running) {
|
|
2465
|
-
if (running.has(slug) || running.size >
|
|
2484
|
+
if (running.has(slug) || running.size > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CALL_DEPTH */.Or.MAX_CALL_DEPTH) return 0;
|
|
2466
2485
|
running.add(slug);
|
|
2467
2486
|
let deepest = 0;
|
|
2468
2487
|
for (const next of new Set(known.get(slug)?.calls ?? []))deepest = Math.max(deepest, 1 + callDepth(next, known, running));
|
|
@@ -2470,37 +2489,37 @@ function conditionProblem(node, options) {
|
|
|
2470
2489
|
return deepest;
|
|
2471
2490
|
}
|
|
2472
2491
|
/** One level of the request body: the top-level fields, or the fields of an object / list item at `prefix`. */ function validateInputFields(fields, prefix, depth, err) {
|
|
2473
|
-
if (fields.length >
|
|
2474
|
-
max:
|
|
2492
|
+
if (fields.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_INPUT_FIELDS */.Or.MAX_INPUT_FIELDS) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.INPUT_TOO_MANY */.qj.INPUT_TOO_MANY, {
|
|
2493
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_INPUT_FIELDS */.Or.MAX_INPUT_FIELDS
|
|
2475
2494
|
}));
|
|
2476
2495
|
const seen = new Set();
|
|
2477
2496
|
for (const field of fields){
|
|
2478
2497
|
const name = `${prefix}${field?.name ?? ''}`;
|
|
2479
|
-
if (!
|
|
2498
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_INPUT_NAME_PATTERN.test */.fZ.test(field?.name ?? '')) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.INPUT_NAME_INVALID */.qj.INPUT_NAME_INVALID, {
|
|
2480
2499
|
name
|
|
2481
2500
|
}));
|
|
2482
|
-
else if (seen.has(field.name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2501
|
+
else if (seen.has(field.name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.INPUT_NAME_DUPLICATE */.qj.INPUT_NAME_DUPLICATE, {
|
|
2483
2502
|
name
|
|
2484
2503
|
}));
|
|
2485
2504
|
seen.add(field?.name);
|
|
2486
|
-
if (!
|
|
2505
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_INPUT_TYPES.includes */.Q7.includes(field?.type)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.INPUT_TYPE_UNKNOWN */.qj.INPUT_TYPE_UNKNOWN, {
|
|
2487
2506
|
name,
|
|
2488
2507
|
type: field?.type
|
|
2489
2508
|
}));
|
|
2490
2509
|
const itemType = field?.type === 'array' ? field.itemType : undefined;
|
|
2491
|
-
if (itemType !== undefined && (itemType === 'array' || !
|
|
2510
|
+
if (itemType !== undefined && (itemType === 'array' || !_flow_types_js__rspack_import_5/* .FLOW_INPUT_TYPES.includes */.Q7.includes(itemType))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.INPUT_ITEM_TYPE_UNKNOWN */.qj.INPUT_ITEM_TYPE_UNKNOWN, {
|
|
2492
2511
|
name,
|
|
2493
2512
|
type: itemType
|
|
2494
2513
|
}));
|
|
2495
|
-
if ((field?.type === 'choice' || itemType === 'choice') && !field.options?.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2514
|
+
if ((field?.type === 'choice' || itemType === 'choice') && !field.options?.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.INPUT_CHOICE_NO_OPTIONS */.qj.INPUT_CHOICE_NO_OPTIONS, {
|
|
2496
2515
|
name
|
|
2497
2516
|
}));
|
|
2498
2517
|
const holdsFields = field?.type === 'object' || itemType === 'object';
|
|
2499
2518
|
if (!holdsFields || !Array.isArray(field.fields) || !field.fields.length) continue;
|
|
2500
|
-
if (depth >=
|
|
2501
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2519
|
+
if (depth >= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_INPUT_DEPTH */.Or.MAX_INPUT_DEPTH) {
|
|
2520
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.INPUT_TOO_DEEP */.qj.INPUT_TOO_DEEP, {
|
|
2502
2521
|
name,
|
|
2503
|
-
max:
|
|
2522
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_INPUT_DEPTH */.Or.MAX_INPUT_DEPTH
|
|
2504
2523
|
}));
|
|
2505
2524
|
continue;
|
|
2506
2525
|
}
|
|
@@ -2509,7 +2528,7 @@ function conditionProblem(node, options) {
|
|
|
2509
2528
|
}
|
|
2510
2529
|
function validateNodeConfig(node, flow, context, err, warn) {
|
|
2511
2530
|
const at = {
|
|
2512
|
-
node: (0,
|
|
2531
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
|
|
2513
2532
|
};
|
|
2514
2533
|
const c = node.config ?? {};
|
|
2515
2534
|
const shape = {
|
|
@@ -2517,7 +2536,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2517
2536
|
};
|
|
2518
2537
|
const expr = (value, what)=>{
|
|
2519
2538
|
const problem = expressionProblem(value, 0, shape);
|
|
2520
|
-
if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2539
|
+
if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EXPRESSION_PROBLEM */.qj.NODE_EXPRESSION_PROBLEM, {
|
|
2521
2540
|
...at,
|
|
2522
2541
|
what,
|
|
2523
2542
|
problem
|
|
@@ -2525,7 +2544,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2525
2544
|
};
|
|
2526
2545
|
const exprMap = (value, kind)=>{
|
|
2527
2546
|
if (value === undefined) return;
|
|
2528
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2547
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PAIRS_INVALID */.qj.NODE_PAIRS_INVALID, {
|
|
2529
2548
|
...at,
|
|
2530
2549
|
what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(kind.list)
|
|
2531
2550
|
}));
|
|
@@ -2535,13 +2554,13 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2535
2554
|
};
|
|
2536
2555
|
const filterMap = (value, kind)=>{
|
|
2537
2556
|
if (value === undefined) return;
|
|
2538
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2557
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PAIRS_INVALID */.qj.NODE_PAIRS_INVALID, {
|
|
2539
2558
|
...at,
|
|
2540
2559
|
what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(kind.list)
|
|
2541
2560
|
}));
|
|
2542
2561
|
for (const [key, item] of Object.entries(value)){
|
|
2543
2562
|
const problem = filterValueProblem(item, -1, shape);
|
|
2544
|
-
if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2563
|
+
if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EXPRESSION_PROBLEM */.qj.NODE_EXPRESSION_PROBLEM, {
|
|
2545
2564
|
...at,
|
|
2546
2565
|
what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(kind.item, {
|
|
2547
2566
|
name: key
|
|
@@ -2552,59 +2571,59 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2552
2571
|
};
|
|
2553
2572
|
const rule = (value, what)=>{
|
|
2554
2573
|
const problem = groupProblem(value, 0, shape);
|
|
2555
|
-
if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2574
|
+
if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_RULE_PROBLEM */.qj.NODE_RULE_PROBLEM, {
|
|
2556
2575
|
...at,
|
|
2557
2576
|
what,
|
|
2558
2577
|
problem
|
|
2559
2578
|
}));
|
|
2560
2579
|
};
|
|
2561
2580
|
const entity = (value)=>{
|
|
2562
|
-
if (typeof value !== 'string' || !
|
|
2563
|
-
if (context.knownEntityCodes && !context.knownEntityCodes.has(value)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2581
|
+
if (typeof value !== 'string' || !_config_entity_builder_constants_js__rspack_import_8/* .ENTITY_CODE_PATTERN.test */.vs.test(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHOOSE_ENTITY */.qj.NODE_CHOOSE_ENTITY, at));
|
|
2582
|
+
if (context.knownEntityCodes && !context.knownEntityCodes.has(value)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_ENTITY_UNKNOWN */.qj.NODE_ENTITY_UNKNOWN, {
|
|
2564
2583
|
...at,
|
|
2565
2584
|
entity: value
|
|
2566
2585
|
}));
|
|
2567
2586
|
};
|
|
2568
2587
|
const KIND = {
|
|
2569
2588
|
variable: {
|
|
2570
|
-
list:
|
|
2571
|
-
item:
|
|
2589
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.VARIABLES */.bc.VARIABLES,
|
|
2590
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.VARIABLE */.bc.VARIABLE
|
|
2572
2591
|
},
|
|
2573
2592
|
field: {
|
|
2574
|
-
list:
|
|
2575
|
-
item:
|
|
2593
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FIELDS */.bc.FIELDS,
|
|
2594
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FIELD */.bc.FIELD
|
|
2576
2595
|
},
|
|
2577
2596
|
filter: {
|
|
2578
|
-
list:
|
|
2579
|
-
item:
|
|
2597
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FILTERS */.bc.FILTERS,
|
|
2598
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FILTER */.bc.FILTER
|
|
2580
2599
|
},
|
|
2581
2600
|
input: {
|
|
2582
|
-
list:
|
|
2583
|
-
item:
|
|
2601
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.INPUTS */.bc.INPUTS,
|
|
2602
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.INPUT */.bc.INPUT
|
|
2584
2603
|
},
|
|
2585
2604
|
header: {
|
|
2586
|
-
list:
|
|
2587
|
-
item:
|
|
2605
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.HEADERS */.bc.HEADERS,
|
|
2606
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.HEADER */.bc.HEADER
|
|
2588
2607
|
},
|
|
2589
2608
|
body: {
|
|
2590
|
-
list:
|
|
2591
|
-
item:
|
|
2609
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.BODY_VALUES */.bc.BODY_VALUES,
|
|
2610
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.BODY_VALUE */.bc.BODY_VALUE
|
|
2592
2611
|
},
|
|
2593
2612
|
payload: {
|
|
2594
|
-
list:
|
|
2595
|
-
item:
|
|
2613
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.PAYLOAD_VALUES */.bc.PAYLOAD_VALUES,
|
|
2614
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.PAYLOAD_VALUE */.bc.PAYLOAD_VALUE
|
|
2596
2615
|
},
|
|
2597
2616
|
response: {
|
|
2598
|
-
list:
|
|
2599
|
-
item:
|
|
2617
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.RESPONSE_VALUES */.bc.RESPONSE_VALUES,
|
|
2618
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.RESPONSE_VALUE */.bc.RESPONSE_VALUE
|
|
2600
2619
|
},
|
|
2601
2620
|
data: {
|
|
2602
|
-
list:
|
|
2603
|
-
item:
|
|
2621
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.DATA_VALUES */.bc.DATA_VALUES,
|
|
2622
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.DATA_VALUE */.bc.DATA_VALUE
|
|
2604
2623
|
},
|
|
2605
2624
|
template: {
|
|
2606
|
-
list:
|
|
2607
|
-
item:
|
|
2625
|
+
list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.TEMPLATE_VALUES */.bc.TEMPLATE_VALUES,
|
|
2626
|
+
item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.TEMPLATE_VALUE */.bc.TEMPLATE_VALUE
|
|
2608
2627
|
}
|
|
2609
2628
|
};
|
|
2610
2629
|
const optionalExpr = (value, what)=>{
|
|
@@ -2612,8 +2631,8 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2612
2631
|
};
|
|
2613
2632
|
/** An AND / OR rule of permission codes: one that names none needs a permission, a malformed one is `invalid`. */ const permissionRule = (value, invalid)=>{
|
|
2614
2633
|
const problem = (0,_flusys_nestjs_shared_utils__rspack_import_0.permissionLogicProblem)(value);
|
|
2615
|
-
if (problem === 'empty') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2616
|
-
else if (problem === 'too_many') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2634
|
+
if (problem === 'empty') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_REQUIRED */.qj.NODE_PERMISSION_REQUIRED, at));
|
|
2635
|
+
else if (problem === 'too_many') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .RULE_ENGINE_MESSAGES.TOO_MANY_PERMISSION_CODES */.x3.TOO_MANY_PERMISSION_CODES, {
|
|
2617
2636
|
max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_PERMISSION_CODES */.bw.MAX_PERMISSION_CODES
|
|
2618
2637
|
}));
|
|
2619
2638
|
else if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(invalid, at));
|
|
@@ -2624,29 +2643,29 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2624
2643
|
switch(node.type){
|
|
2625
2644
|
case 'trigger':
|
|
2626
2645
|
{
|
|
2627
|
-
if (c.path !== undefined && c.path !== '' && (typeof c.path !== 'string' || !
|
|
2628
|
-
if (c.authMode !== undefined && !
|
|
2629
|
-
if (c.permissions !== undefined) permissionRule(c.permissions,
|
|
2630
|
-
if (c.isTransactional !== undefined && typeof c.isTransactional !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2631
|
-
if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >=
|
|
2632
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2646
|
+
if (c.path !== undefined && c.path !== '' && (typeof c.path !== 'string' || !_flow_types_js__rspack_import_5/* .FLOW_ENDPOINT_PATH_PATTERN.test */.YO.test(c.path))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_PATH_INVALID */.qj.TRIGGER_PATH_INVALID, at));
|
|
2647
|
+
if (c.authMode !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_AUTH_MODES.includes */.fO.includes(c.authMode)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_AUTH_INVALID */.qj.TRIGGER_AUTH_INVALID, at));
|
|
2648
|
+
if (c.permissions !== undefined) permissionRule(c.permissions, _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_AUTH_INVALID */.qj.TRIGGER_AUTH_INVALID);
|
|
2649
|
+
if (c.isTransactional !== undefined && typeof c.isTransactional !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_TRANSACTION_INVALID */.qj.TRIGGER_TRANSACTION_INVALID, at));
|
|
2650
|
+
if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MIN_TIMEOUT_MS */.Or.MIN_TIMEOUT_MS && c.timeoutMs <= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_TIMEOUT_MS */.Or.MAX_TIMEOUT_MS)) {
|
|
2651
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_TIMEOUT_RANGE */.qj.TRIGGER_TIMEOUT_RANGE, {
|
|
2633
2652
|
...at,
|
|
2634
|
-
min:
|
|
2635
|
-
max:
|
|
2653
|
+
min: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MIN_TIMEOUT_MS */.Or.MIN_TIMEOUT_MS / 1000,
|
|
2654
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_TIMEOUT_MS */.Or.MAX_TIMEOUT_MS / 1000
|
|
2636
2655
|
}));
|
|
2637
2656
|
}
|
|
2638
|
-
if (c.rateLimitPerMinute !== undefined && !(Number.isInteger(c.rateLimitPerMinute) && c.rateLimitPerMinute >= 0 && c.rateLimitPerMinute <=
|
|
2639
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2657
|
+
if (c.rateLimitPerMinute !== undefined && !(Number.isInteger(c.rateLimitPerMinute) && c.rateLimitPerMinute >= 0 && c.rateLimitPerMinute <= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_RATE_LIMIT_PER_MINUTE */.Or.MAX_RATE_LIMIT_PER_MINUTE)) {
|
|
2658
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_RATE_LIMIT_RANGE */.qj.TRIGGER_RATE_LIMIT_RANGE, {
|
|
2640
2659
|
...at,
|
|
2641
|
-
max:
|
|
2660
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_RATE_LIMIT_PER_MINUTE */.Or.MAX_RATE_LIMIT_PER_MINUTE
|
|
2642
2661
|
}));
|
|
2643
2662
|
}
|
|
2644
2663
|
// Without a key an API-key URL could never be called; any other access keeps none.
|
|
2645
|
-
if (c.authMode === 'api_key' && c.apiKey === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2646
|
-
else if (c.apiKey !== undefined && !(0,
|
|
2664
|
+
if (c.authMode === 'api_key' && c.apiKey === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_API_KEY_REQUIRED */.qj.TRIGGER_API_KEY_REQUIRED, at));
|
|
2665
|
+
else if (c.apiKey !== undefined && !(0,_flow_api_key_js__rspack_import_6/* .looksLikeApiKey */.Jb)(c.apiKey) && !(0,_flow_types_js__rspack_import_5/* .isStoredApiKey */.xA)(c.apiKey)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_API_KEY_INVALID */.qj.TRIGGER_API_KEY_INVALID, at));
|
|
2647
2666
|
// Field errors are named after the URL (`<path>: <field>`) once a flow has several.
|
|
2648
|
-
const path = (0,
|
|
2649
|
-
if (c.bodyType !== undefined && !
|
|
2667
|
+
const path = (0,_flow_types_js__rspack_import_5/* .triggerPath */.um)(node);
|
|
2668
|
+
if (c.bodyType !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_BODY_TYPES.includes */.Y3.includes(c.bodyType)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.BODY_TYPE_UNKNOWN */.qj.BODY_TYPE_UNKNOWN, {
|
|
2650
2669
|
type: String(c.bodyType)
|
|
2651
2670
|
}));
|
|
2652
2671
|
validateInputFields(Array.isArray(c.inputSchema) ? c.inputSchema : [], path ? `${path}: ` : '', 1, err);
|
|
@@ -2654,70 +2673,77 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2654
2673
|
}
|
|
2655
2674
|
case 'validate':
|
|
2656
2675
|
validateChecks(c, at, rule, err);
|
|
2657
|
-
if (c.mode !== undefined && c.mode !== 'all' && c.mode !== 'first') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2676
|
+
if (c.mode !== undefined && c.mode !== 'all' && c.mode !== 'first') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_MODE_INVALID */.qj.NODE_MODE_INVALID, at));
|
|
2658
2677
|
if (c.statusCode !== undefined && !(Number.isInteger(c.statusCode) && c.statusCode >= 400 && c.statusCode <= 499)) {
|
|
2659
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2678
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_4XX */.qj.NODE_STATUS_4XX, at));
|
|
2660
2679
|
}
|
|
2661
2680
|
break;
|
|
2662
2681
|
case 'permission_check':
|
|
2663
2682
|
{
|
|
2664
|
-
if (c.permissions === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2665
|
-
else permissionRule(c.permissions,
|
|
2666
|
-
if (c.
|
|
2667
|
-
if (c.
|
|
2683
|
+
if (c.permissions === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_REQUIRED */.qj.NODE_PERMISSION_REQUIRED, at));
|
|
2684
|
+
else permissionRule(c.permissions, _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID);
|
|
2685
|
+
if (c.subject !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_ACCESS_SUBJECTS.includes */.iM.includes(c.subject)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2686
|
+
if (c.subject === 'user') {
|
|
2687
|
+
if (c.userId === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_ACCESS_USER_REQUIRED */.qj.NODE_ACCESS_USER_REQUIRED, at));
|
|
2688
|
+
else expr(c.userId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_USER */.bc.THE_USER));
|
|
2689
|
+
}
|
|
2690
|
+
if (c.companyId !== undefined) expr(c.companyId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_COMPANY */.bc.THE_COMPANY));
|
|
2691
|
+
if (c.branchId !== undefined) expr(c.branchId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_BRANCH */.bc.THE_BRANCH));
|
|
2692
|
+
if (c.onDenied !== undefined && c.onDenied !== 'reject' && c.onDenied !== 'branch') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2693
|
+
if (c.message !== undefined && typeof c.message !== 'string') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2668
2694
|
if (c.statusCode !== undefined && !(Number.isInteger(c.statusCode) && c.statusCode >= 400 && c.statusCode <= 499)) {
|
|
2669
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2695
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_4XX */.qj.NODE_STATUS_4XX, at));
|
|
2670
2696
|
}
|
|
2671
2697
|
break;
|
|
2672
2698
|
}
|
|
2673
2699
|
case 'company_branch_check':
|
|
2674
2700
|
{
|
|
2675
|
-
if (c.subject !== undefined && !
|
|
2676
|
-
if (c.branchMatch !== undefined && !
|
|
2701
|
+
if (c.subject !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_ACCESS_SUBJECTS.includes */.iM.includes(c.subject)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2702
|
+
if (c.branchMatch !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_BRANCH_MATCHES.includes */.Et.includes(c.branchMatch)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2677
2703
|
if (c.subject === 'user') {
|
|
2678
|
-
if (c.userId === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2679
|
-
else expr(c.userId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2704
|
+
if (c.userId === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_ACCESS_USER_REQUIRED */.qj.NODE_ACCESS_USER_REQUIRED, at));
|
|
2705
|
+
else expr(c.userId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_USER */.bc.THE_USER));
|
|
2680
2706
|
}
|
|
2681
2707
|
// Another user has no current company.
|
|
2682
|
-
if (c.branchCompany !== undefined && (!
|
|
2683
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2708
|
+
if (c.branchCompany !== undefined && (!_flow_types_js__rspack_import_5/* .FLOW_BRANCH_COMPANIES.includes */.sk.includes(c.branchCompany) || c.branchCompany === 'current' && c.subject === 'user')) {
|
|
2709
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2684
2710
|
}
|
|
2685
|
-
if (c.companyIds !== undefined) expr(c.companyIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2686
|
-
if (c.branchIds !== undefined) expr(c.branchIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2687
|
-
if (c.onDenied !== undefined && c.onDenied !== 'reject' && c.onDenied !== 'branch') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2711
|
+
if (c.companyIds !== undefined) expr(c.companyIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_VALUE */.bc.THE_VALUE));
|
|
2712
|
+
if (c.branchIds !== undefined) expr(c.branchIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_VALUE */.bc.THE_VALUE));
|
|
2713
|
+
if (c.onDenied !== undefined && c.onDenied !== 'reject' && c.onDenied !== 'branch') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2688
2714
|
// Without an id to check there is nothing to allow or deny.
|
|
2689
|
-
if (c.onDenied === 'branch' && c.companyIds === undefined && c.branchIds === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2690
|
-
if (c.message !== undefined && typeof c.message !== 'string') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2715
|
+
if (c.onDenied === 'branch' && c.companyIds === undefined && c.branchIds === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_ACCESS_TARGET_REQUIRED */.qj.NODE_ACCESS_TARGET_REQUIRED, at));
|
|
2716
|
+
if (c.message !== undefined && typeof c.message !== 'string') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
|
|
2691
2717
|
if (c.statusCode !== undefined && !(Number.isInteger(c.statusCode) && c.statusCode >= 400 && c.statusCode <= 499)) {
|
|
2692
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2718
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_4XX */.qj.NODE_STATUS_4XX, at));
|
|
2693
2719
|
}
|
|
2694
2720
|
break;
|
|
2695
2721
|
}
|
|
2696
2722
|
case 'set':
|
|
2697
2723
|
exprMap(c.values, KIND.variable);
|
|
2698
|
-
if (!c.values || !Object.keys(c.values).length) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2724
|
+
if (!c.values || !Object.keys(c.values).length) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_SETS_NOTHING */.qj.NODE_SETS_NOTHING, at));
|
|
2699
2725
|
for (const key of Object.keys(c.values ?? {})){
|
|
2700
|
-
if (!
|
|
2726
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_INPUT_NAME_PATTERN.test */.fZ.test(key)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_VARIABLE_INVALID */.qj.NODE_VARIABLE_INVALID, {
|
|
2701
2727
|
...at,
|
|
2702
2728
|
name: key
|
|
2703
2729
|
}));
|
|
2704
2730
|
}
|
|
2705
2731
|
break;
|
|
2706
2732
|
case 'condition':
|
|
2707
|
-
rule(c.rule, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2733
|
+
rule(c.rule, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RULE */.bc.THE_RULE));
|
|
2708
2734
|
break;
|
|
2709
2735
|
case 'switch':
|
|
2710
2736
|
{
|
|
2711
|
-
expr(c.value, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2737
|
+
expr(c.value, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_VALUE */.bc.THE_VALUE));
|
|
2712
2738
|
const cases = Array.isArray(c.cases) ? c.cases : [];
|
|
2713
|
-
if (!cases.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2739
|
+
if (!cases.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CASE_REQUIRED */.qj.NODE_CASE_REQUIRED, at));
|
|
2714
2740
|
const ids = new Set();
|
|
2715
2741
|
for (const item of cases){
|
|
2716
|
-
if (typeof item.id !== 'string' || !/^[A-Za-z][A-Za-z0-9_]{0,29}$/.test(item.id) || item.id === 'default') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2742
|
+
if (typeof item.id !== 'string' || !/^[A-Za-z][A-Za-z0-9_]{0,29}$/.test(item.id) || item.id === 'default') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CASE_INVALID */.qj.NODE_CASE_INVALID, {
|
|
2717
2743
|
...at,
|
|
2718
2744
|
name: String(item.id)
|
|
2719
2745
|
}));
|
|
2720
|
-
else if (ids.has(item.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2746
|
+
else if (ids.has(item.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CASE_DUPLICATE */.qj.NODE_CASE_DUPLICATE, {
|
|
2721
2747
|
...at,
|
|
2722
2748
|
name: item.id
|
|
2723
2749
|
}));
|
|
@@ -2726,12 +2752,12 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2726
2752
|
break;
|
|
2727
2753
|
}
|
|
2728
2754
|
case 'foreach':
|
|
2729
|
-
expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2730
|
-
if (c.collect !== undefined) expr(c.collect, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2731
|
-
if (c.maxItems !== undefined && !(Number.isInteger(c.maxItems) && c.maxItems >= 1 && c.maxItems <=
|
|
2732
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2755
|
+
expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
|
|
2756
|
+
if (c.collect !== undefined) expr(c.collect, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_COLLECTED_VALUE */.bc.THE_COLLECTED_VALUE));
|
|
2757
|
+
if (c.maxItems !== undefined && !(Number.isInteger(c.maxItems) && c.maxItems >= 1 && c.maxItems <= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_FOREACH_ITEMS */.Or.MAX_FOREACH_ITEMS)) {
|
|
2758
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_MAX_ITEMS_RANGE */.qj.NODE_MAX_ITEMS_RANGE, {
|
|
2733
2759
|
...at,
|
|
2734
|
-
max:
|
|
2760
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_FOREACH_ITEMS */.Or.MAX_FOREACH_ITEMS
|
|
2735
2761
|
}));
|
|
2736
2762
|
}
|
|
2737
2763
|
break;
|
|
@@ -2756,7 +2782,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2756
2782
|
break;
|
|
2757
2783
|
case 'entity_update':
|
|
2758
2784
|
entity(c.entityCode);
|
|
2759
|
-
writeTargetConfig(c,
|
|
2785
|
+
writeTargetConfig(c, _flow_types_js__rspack_import_5/* .RECORD_WRITE_TARGETS */.Dn, [
|
|
2760
2786
|
'error',
|
|
2761
2787
|
'skip',
|
|
2762
2788
|
'insert'
|
|
@@ -2770,7 +2796,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2770
2796
|
break;
|
|
2771
2797
|
case 'entity_delete':
|
|
2772
2798
|
entity(c.entityCode);
|
|
2773
|
-
writeTargetConfig(c,
|
|
2799
|
+
writeTargetConfig(c, _flow_types_js__rspack_import_5/* .RECORD_WRITE_TARGETS */.Dn, [
|
|
2774
2800
|
'error',
|
|
2775
2801
|
'skip'
|
|
2776
2802
|
], {
|
|
@@ -2782,34 +2808,34 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2782
2808
|
break;
|
|
2783
2809
|
case 'entity_get':
|
|
2784
2810
|
entity(c.entityCode);
|
|
2785
|
-
expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2811
|
+
expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RECORD_ID */.bc.THE_RECORD_ID));
|
|
2786
2812
|
break;
|
|
2787
2813
|
case 'entity_query':
|
|
2788
2814
|
entity(c.entityCode);
|
|
2789
2815
|
filterMap(c.filter, KIND.filter);
|
|
2790
|
-
if (c.search !== undefined) expr(c.search, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2816
|
+
if (c.search !== undefined) expr(c.search, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_SEARCH_TEXT */.bc.THE_SEARCH_TEXT));
|
|
2791
2817
|
if (c.sort !== undefined) {
|
|
2792
2818
|
const sort = c.sort;
|
|
2793
|
-
if (typeof sort?.field !== 'string' || !COLUMN_CODE.test(sort.field) || sort.direction !== undefined && sort.direction !== 'ASC' && sort.direction !== 'DESC') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2819
|
+
if (typeof sort?.field !== 'string' || !COLUMN_CODE.test(sort.field) || sort.direction !== undefined && sort.direction !== 'ASC' && sort.direction !== 'DESC') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_SORT_INVALID */.qj.NODE_SORT_INVALID, at));
|
|
2794
2820
|
}
|
|
2795
|
-
if (c.limit !== undefined && !(Number.isInteger(c.limit) && c.limit >= 1 && c.limit <=
|
|
2796
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2821
|
+
if (c.limit !== undefined && !(Number.isInteger(c.limit) && c.limit >= 1 && c.limit <= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_QUERY_LIMIT */.Or.MAX_QUERY_LIMIT)) {
|
|
2822
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_LIMIT_RANGE */.qj.NODE_LIMIT_RANGE, {
|
|
2797
2823
|
...at,
|
|
2798
|
-
max:
|
|
2824
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_QUERY_LIMIT */.Or.MAX_QUERY_LIMIT
|
|
2799
2825
|
}));
|
|
2800
2826
|
}
|
|
2801
2827
|
break;
|
|
2802
2828
|
case 'call_flow':
|
|
2803
|
-
if (typeof c.flowSlug !== 'string' || !
|
|
2804
|
-
else if (c.flowSlug === flow.slug) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2805
|
-
else if (context.knownFlows && !context.knownFlows.has(c.flowSlug)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2829
|
+
if (typeof c.flowSlug !== 'string' || !_flow_types_js__rspack_import_5/* .FLOW_SLUG_PATTERN.test */.YD.test(c.flowSlug)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHOOSE_FLOW */.qj.NODE_CHOOSE_FLOW, at));
|
|
2830
|
+
else if (c.flowSlug === flow.slug) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CALLS_ITSELF */.qj.NODE_CALLS_ITSELF, at));
|
|
2831
|
+
else if (context.knownFlows && !context.knownFlows.has(c.flowSlug)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_UNKNOWN */.qj.NODE_FLOW_UNKNOWN, {
|
|
2806
2832
|
...at,
|
|
2807
2833
|
flow: c.flowSlug
|
|
2808
2834
|
}));
|
|
2809
2835
|
else if (context.knownFlows) checkCalledFlow(node, flow, context.knownFlows, err, warn);
|
|
2810
|
-
if (c.endpoint !== undefined && c.endpoint !== '' && (typeof c.endpoint !== 'string' || !
|
|
2836
|
+
if (c.endpoint !== undefined && c.endpoint !== '' && (typeof c.endpoint !== 'string' || !_flow_types_js__rspack_import_5/* .FLOW_ENDPOINT_PATH_PATTERN.test */.YO.test(c.endpoint))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_PATH_INVALID */.qj.TRIGGER_PATH_INVALID, at));
|
|
2811
2837
|
exprMap(c.input, KIND.input);
|
|
2812
|
-
if (c.inputList !== undefined) expr(c.inputList, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2838
|
+
if (c.inputList !== undefined) expr(c.inputList, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_INPUT_LIST */.bc.THE_INPUT_LIST));
|
|
2813
2839
|
break;
|
|
2814
2840
|
case 'http_request':
|
|
2815
2841
|
{
|
|
@@ -2819,88 +2845,88 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2819
2845
|
'PUT',
|
|
2820
2846
|
'PATCH',
|
|
2821
2847
|
'DELETE'
|
|
2822
|
-
].includes(String(c.method))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2823
|
-
expr(c.url, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2848
|
+
].includes(String(c.method))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHOOSE_METHOD */.qj.NODE_CHOOSE_METHOD, at));
|
|
2849
|
+
expr(c.url, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_URL */.bc.THE_URL));
|
|
2824
2850
|
exprMap(c.headers, KIND.header);
|
|
2825
2851
|
exprMap(c.body, KIND.body);
|
|
2826
|
-
if (c.forwardAuth === true) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2827
|
-
if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >= 100 && c.timeoutMs <=
|
|
2828
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2852
|
+
if (c.forwardAuth === true) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FORWARDS_TOKEN */.qj.NODE_FORWARDS_TOKEN, at));
|
|
2853
|
+
if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >= 100 && c.timeoutMs <= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_HTTP_TIMEOUT_MS */.Or.MAX_HTTP_TIMEOUT_MS)) {
|
|
2854
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_TIMEOUT_RANGE */.qj.NODE_TIMEOUT_RANGE, {
|
|
2829
2855
|
...at,
|
|
2830
|
-
max:
|
|
2856
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_HTTP_TIMEOUT_MS */.Or.MAX_HTTP_TIMEOUT_MS
|
|
2831
2857
|
}));
|
|
2832
2858
|
}
|
|
2833
2859
|
break;
|
|
2834
2860
|
}
|
|
2835
2861
|
case 'publish_event':
|
|
2836
|
-
if (typeof c.eventName !== 'string' || !/^[a-z][a-z0-9_.-]{1,59}$/.test(c.eventName)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2862
|
+
if (typeof c.eventName !== 'string' || !/^[a-z][a-z0-9_.-]{1,59}$/.test(c.eventName)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EVENT_NAME_INVALID */.qj.NODE_EVENT_NAME_INVALID, at));
|
|
2837
2863
|
exprMap(c.payload, KIND.payload);
|
|
2838
2864
|
break;
|
|
2839
2865
|
case 'send_notification':
|
|
2840
2866
|
{
|
|
2841
|
-
serviceRunning('notification',
|
|
2867
|
+
serviceRunning('notification', _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_UNAVAILABLE */.qj.NODE_NOTIFICATION_UNAVAILABLE);
|
|
2842
2868
|
const target = c.target ?? 'one';
|
|
2843
|
-
if (!
|
|
2844
|
-
if (target === 'many') expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2869
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_NOTIFICATION_TARGETS.includes */.as.includes(target)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_MESSAGE_TARGET_INVALID */.qj.NODE_MESSAGE_TARGET_INVALID, at));
|
|
2870
|
+
if (target === 'many') expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
|
|
2845
2871
|
if (target === 'company') {
|
|
2846
|
-
if (context.companyMembers === false) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2847
|
-
expr(c.companyIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2848
|
-
optionalExpr(c.branchIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2872
|
+
if (context.companyMembers === false) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_COMPANY_UNAVAILABLE */.qj.NODE_NOTIFICATION_COMPANY_UNAVAILABLE, at));
|
|
2873
|
+
expr(c.companyIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_COMPANIES */.bc.THE_COMPANIES));
|
|
2874
|
+
optionalExpr(c.branchIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_BRANCHES */.bc.THE_BRANCHES));
|
|
2849
2875
|
} else {
|
|
2850
|
-
expr(c.userIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2851
|
-
optionalExpr(c.companyId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2876
|
+
expr(c.userIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RECIPIENTS */.bc.THE_RECIPIENTS));
|
|
2877
|
+
optionalExpr(c.companyId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_COMPANY */.bc.THE_COMPANY));
|
|
2852
2878
|
}
|
|
2853
|
-
expr(c.title, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2854
|
-
optionalExpr(c.message, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2879
|
+
expr(c.title, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_TITLE */.bc.THE_TITLE));
|
|
2880
|
+
optionalExpr(c.message, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_MESSAGE */.bc.THE_MESSAGE));
|
|
2855
2881
|
exprMap(c.data, KIND.data);
|
|
2856
|
-
if (c.type !== undefined && !
|
|
2857
|
-
if (c.realtime !== undefined && typeof c.realtime !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2882
|
+
if (c.type !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_NOTIFICATION_TYPES.includes */.LG.includes(c.type)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_OPTION_INVALID */.qj.NODE_NOTIFICATION_OPTION_INVALID, at));
|
|
2883
|
+
if (c.realtime !== undefined && typeof c.realtime !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_OPTION_INVALID */.qj.NODE_NOTIFICATION_OPTION_INVALID, at));
|
|
2858
2884
|
break;
|
|
2859
2885
|
}
|
|
2860
2886
|
case 'send_email':
|
|
2861
2887
|
{
|
|
2862
|
-
serviceRunning('email',
|
|
2863
|
-
if (!
|
|
2864
|
-
if (c.target === 'many') expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2865
|
-
expr(c.to, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2866
|
-
optionalExpr(c.cc, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2867
|
-
optionalExpr(c.bcc, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2868
|
-
optionalExpr(c.replyTo, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2869
|
-
if (c.mode !== undefined && !
|
|
2870
|
-
if (c.format !== undefined && !
|
|
2871
|
-
if (c.emailConfigId !== undefined && c.emailConfigId !== '' && (typeof c.emailConfigId !== 'string' || !
|
|
2888
|
+
serviceRunning('email', _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_UNAVAILABLE */.qj.NODE_EMAIL_UNAVAILABLE);
|
|
2889
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_EMAIL_TARGETS.includes */.B9.includes(c.target ?? 'one')) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_MESSAGE_TARGET_INVALID */.qj.NODE_MESSAGE_TARGET_INVALID, at));
|
|
2890
|
+
if (c.target === 'many') expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
|
|
2891
|
+
expr(c.to, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RECIPIENTS */.bc.THE_RECIPIENTS));
|
|
2892
|
+
optionalExpr(c.cc, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_CC */.bc.THE_CC));
|
|
2893
|
+
optionalExpr(c.bcc, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_BCC */.bc.THE_BCC));
|
|
2894
|
+
optionalExpr(c.replyTo, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_REPLY_TO */.bc.THE_REPLY_TO));
|
|
2895
|
+
if (c.mode !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_EMAIL_MODES.includes */.v1.includes(c.mode)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_OPTION_INVALID */.qj.NODE_EMAIL_OPTION_INVALID, at));
|
|
2896
|
+
if (c.format !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_EMAIL_FORMATS.includes */.FU.includes(c.format)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_OPTION_INVALID */.qj.NODE_EMAIL_OPTION_INVALID, at));
|
|
2897
|
+
if (c.emailConfigId !== undefined && c.emailConfigId !== '' && (typeof c.emailConfigId !== 'string' || !_flow_types_js__rspack_import_5/* .FLOW_ID_PATTERN.test */.E2.test(c.emailConfigId))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_OPTION_INVALID */.qj.NODE_EMAIL_OPTION_INVALID, at));
|
|
2872
2898
|
if (c.mode === 'template') {
|
|
2873
2899
|
const slug = typeof c.templateSlug === 'string' ? c.templateSlug.trim() : '';
|
|
2874
|
-
if (!slug || slug.length >
|
|
2900
|
+
if (!slug || slug.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_EMAIL_TEMPLATE_SLUG_LENGTH */.Or.MAX_EMAIL_TEMPLATE_SLUG_LENGTH) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_TEMPLATE_REQUIRED */.qj.NODE_EMAIL_TEMPLATE_REQUIRED, at));
|
|
2875
2901
|
exprMap(c.variables, KIND.template);
|
|
2876
2902
|
} else {
|
|
2877
|
-
expr(c.subject, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2878
|
-
expr(c.body, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2903
|
+
expr(c.subject, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_SUBJECT */.bc.THE_SUBJECT));
|
|
2904
|
+
expr(c.body, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_BODY */.bc.THE_BODY));
|
|
2879
2905
|
}
|
|
2880
2906
|
break;
|
|
2881
2907
|
}
|
|
2882
2908
|
case 'respond':
|
|
2883
2909
|
{
|
|
2884
2910
|
const status = c.statusCode;
|
|
2885
|
-
if (!(Number.isInteger(status) && status >= 200 && status <= 599)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2911
|
+
if (!(Number.isInteger(status) && status >= 200 && status <= 599)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_2XX_5XX */.qj.NODE_STATUS_2XX_5XX, at));
|
|
2886
2912
|
exprMap(c.body, KIND.response);
|
|
2887
|
-
if (c.bodyExpression !== undefined) expr(c.bodyExpression, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2913
|
+
if (c.bodyExpression !== undefined) expr(c.bodyExpression, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RESPONSE */.bc.THE_RESPONSE));
|
|
2888
2914
|
break;
|
|
2889
2915
|
}
|
|
2890
2916
|
case 'commit':
|
|
2891
|
-
if (node.onError === 'continue') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2917
|
+
if (node.onError === 'continue') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_COMMIT_CONTINUE */.qj.NODE_COMMIT_CONTINUE, at));
|
|
2892
2918
|
break;
|
|
2893
2919
|
case 'code':
|
|
2894
|
-
if (typeof c.code !== 'string' || !c.code.trim()) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2895
|
-
else if (c.code.length >
|
|
2920
|
+
if (typeof c.code !== 'string' || !c.code.trim()) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CODE_REQUIRED */.qj.NODE_CODE_REQUIRED, at));
|
|
2921
|
+
else if (c.code.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CODE_LENGTH */.Or.MAX_CODE_LENGTH) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CODE_TOO_LONG */.qj.NODE_CODE_TOO_LONG, {
|
|
2896
2922
|
...at,
|
|
2897
|
-
max:
|
|
2923
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CODE_LENGTH */.Or.MAX_CODE_LENGTH
|
|
2898
2924
|
}));
|
|
2899
|
-
if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >=
|
|
2900
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2925
|
+
if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MIN_CODE_TIMEOUT_MS */.Or.MIN_CODE_TIMEOUT_MS && c.timeoutMs <= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CODE_TIMEOUT_MS */.Or.MAX_CODE_TIMEOUT_MS)) {
|
|
2926
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CODE_TIMEOUT_RANGE */.qj.NODE_CODE_TIMEOUT_RANGE, {
|
|
2901
2927
|
...at,
|
|
2902
|
-
min:
|
|
2903
|
-
max:
|
|
2928
|
+
min: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MIN_CODE_TIMEOUT_MS */.Or.MIN_CODE_TIMEOUT_MS,
|
|
2929
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CODE_TIMEOUT_MS */.Or.MAX_CODE_TIMEOUT_MS
|
|
2904
2930
|
}));
|
|
2905
2931
|
}
|
|
2906
2932
|
break;
|
|
@@ -2908,66 +2934,66 @@ function validateNodeConfig(node, flow, context, err, warn) {
|
|
|
2908
2934
|
}
|
|
2909
2935
|
/** `target` and what it needs: one - an id; many - a list (the id is optional, the item's own id by default); filter - a filter and a limit. */ function writeTargetConfig(c, targets, notFound, { at, expr, filterMap, err }) {
|
|
2910
2936
|
const target = c.target ?? 'one';
|
|
2911
|
-
if (typeof target !== 'string' || !targets.includes(target)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2912
|
-
if (c.onNotFound !== undefined && !notFound.includes(c.onNotFound)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2937
|
+
if (typeof target !== 'string' || !targets.includes(target)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_WRITE_TARGET_INVALID */.qj.NODE_WRITE_TARGET_INVALID, at));
|
|
2938
|
+
if (c.onNotFound !== undefined && !notFound.includes(c.onNotFound)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_NOT_FOUND_INVALID */.qj.NODE_NOT_FOUND_INVALID, at));
|
|
2913
2939
|
const needsId = notFound.length > 0;
|
|
2914
|
-
if (target === 'one' && needsId) expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2940
|
+
if (target === 'one' && needsId) expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RECORD_ID */.bc.THE_RECORD_ID));
|
|
2915
2941
|
if (target === 'many') {
|
|
2916
|
-
expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2917
|
-
if (needsId && c.id !== undefined) expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2942
|
+
expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
|
|
2943
|
+
if (needsId && c.id !== undefined) expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RECORD_ID */.bc.THE_RECORD_ID));
|
|
2918
2944
|
}
|
|
2919
2945
|
if (target === 'filter') {
|
|
2920
2946
|
filterMap(c.filter);
|
|
2921
|
-
if (!c.filter || typeof c.filter !== 'object' || !Object.keys(c.filter).length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2922
|
-
if (c.limit !== undefined && !(Number.isInteger(c.limit) && c.limit >= 1 && c.limit <=
|
|
2923
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2947
|
+
if (!c.filter || typeof c.filter !== 'object' || !Object.keys(c.filter).length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_FILTER_REQUIRED */.qj.NODE_FILTER_REQUIRED, at));
|
|
2948
|
+
if (c.limit !== undefined && !(Number.isInteger(c.limit) && c.limit >= 1 && c.limit <= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_WRITE_ITEMS */.Or.MAX_WRITE_ITEMS)) {
|
|
2949
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_LIMIT_RANGE */.qj.NODE_LIMIT_RANGE, {
|
|
2924
2950
|
...at,
|
|
2925
|
-
max:
|
|
2951
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_WRITE_ITEMS */.Or.MAX_WRITE_ITEMS
|
|
2926
2952
|
}));
|
|
2927
2953
|
}
|
|
2928
2954
|
}
|
|
2929
2955
|
}
|
|
2930
2956
|
function childInserts(value, { at, entity, expr, err }) {
|
|
2931
2957
|
if (value === undefined) return;
|
|
2932
|
-
if (!Array.isArray(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2933
|
-
if (value.length >
|
|
2958
|
+
if (!Array.isArray(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHILDREN_INVALID */.qj.NODE_CHILDREN_INVALID, at));
|
|
2959
|
+
if (value.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CHILD_INSERTS */.Or.MAX_CHILD_INSERTS) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHILDREN_TOO_MANY */.qj.NODE_CHILDREN_TOO_MANY, {
|
|
2934
2960
|
...at,
|
|
2935
|
-
max:
|
|
2961
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CHILD_INSERTS */.Or.MAX_CHILD_INSERTS
|
|
2936
2962
|
}));
|
|
2937
2963
|
const names = new Set();
|
|
2938
2964
|
for (const child of value){
|
|
2939
2965
|
if (!child || typeof child !== 'object') {
|
|
2940
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2966
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHILDREN_INVALID */.qj.NODE_CHILDREN_INVALID, at));
|
|
2941
2967
|
continue;
|
|
2942
2968
|
}
|
|
2943
2969
|
const name = String(child.as ?? '');
|
|
2944
|
-
if (!
|
|
2970
|
+
if (!_flow_types_js__rspack_import_5/* .FLOW_INPUT_NAME_PATTERN.test */.fZ.test(name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHILD_NAME_INVALID */.qj.NODE_CHILD_NAME_INVALID, {
|
|
2945
2971
|
...at,
|
|
2946
2972
|
name
|
|
2947
2973
|
}));
|
|
2948
|
-
else if (names.has(name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2974
|
+
else if (names.has(name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHILD_NAME_DUPLICATE */.qj.NODE_CHILD_NAME_DUPLICATE, {
|
|
2949
2975
|
...at,
|
|
2950
2976
|
name
|
|
2951
2977
|
}));
|
|
2952
2978
|
names.add(name);
|
|
2953
2979
|
entity(child.entityCode);
|
|
2954
|
-
if (typeof child.parentField !== 'string' || !COLUMN_CODE.test(child.parentField)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2980
|
+
if (typeof child.parentField !== 'string' || !COLUMN_CODE.test(child.parentField)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHILD_PARENT_FIELD_REQUIRED */.qj.NODE_CHILD_PARENT_FIELD_REQUIRED, {
|
|
2955
2981
|
...at,
|
|
2956
2982
|
name
|
|
2957
2983
|
}));
|
|
2958
|
-
expr(child.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2984
|
+
expr(child.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.CHILD_LIST */.bc.CHILD_LIST, {
|
|
2959
2985
|
name
|
|
2960
2986
|
}));
|
|
2961
2987
|
const fields = child.fields;
|
|
2962
2988
|
if (fields === undefined) continue;
|
|
2963
2989
|
if (!fields || typeof fields !== 'object' || Array.isArray(fields)) {
|
|
2964
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2990
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PAIRS_INVALID */.qj.NODE_PAIRS_INVALID, {
|
|
2965
2991
|
...at,
|
|
2966
|
-
what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2992
|
+
what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FIELDS */.bc.FIELDS)
|
|
2967
2993
|
}));
|
|
2968
2994
|
continue;
|
|
2969
2995
|
}
|
|
2970
|
-
for (const [key, item] of Object.entries(fields))expr(item, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
2996
|
+
for (const [key, item] of Object.entries(fields))expr(item, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.CHILD_FIELD */.bc.CHILD_FIELD, {
|
|
2971
2997
|
name: `${name}.${key}`
|
|
2972
2998
|
}));
|
|
2973
2999
|
}
|
|
@@ -2994,7 +3020,7 @@ function childInserts(value, { at, entity, expr, err }) {
|
|
|
2994
3020
|
}
|
|
2995
3021
|
];
|
|
2996
3022
|
}
|
|
2997
|
-
if ((0,
|
|
3023
|
+
if ((0,_flow_types_js__rspack_import_5/* .isMessageNode */.SE)(node.type) && config['target'] === 'many') {
|
|
2998
3024
|
const { items, ...perItem } = config;
|
|
2999
3025
|
return [
|
|
3000
3026
|
{
|
|
@@ -3047,39 +3073,39 @@ function childInserts(value, { at, entity, expr, err }) {
|
|
|
3047
3073
|
return scopes;
|
|
3048
3074
|
}
|
|
3049
3075
|
function validateChecks(c, at, rule, err) {
|
|
3050
|
-
if (!Array.isArray(c.checks) || !c.checks.length) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3051
|
-
if (c.checks.length >
|
|
3076
|
+
if (!Array.isArray(c.checks) || !c.checks.length) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_REQUIRED */.qj.NODE_CHECK_REQUIRED, at));
|
|
3077
|
+
if (c.checks.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_VALIDATE_CHECKS */.Or.MAX_VALIDATE_CHECKS) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_TOO_MANY_CHECKS */.qj.NODE_TOO_MANY_CHECKS, {
|
|
3052
3078
|
...at,
|
|
3053
|
-
max:
|
|
3079
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_VALIDATE_CHECKS */.Or.MAX_VALIDATE_CHECKS
|
|
3054
3080
|
}));
|
|
3055
3081
|
const ids = new Set();
|
|
3056
3082
|
for (const check of c.checks){
|
|
3057
3083
|
const id = check?.id;
|
|
3058
|
-
if (typeof id !== 'string' || !CHECK_ID.test(id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3084
|
+
if (typeof id !== 'string' || !CHECK_ID.test(id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_ID_INVALID */.qj.NODE_CHECK_ID_INVALID, {
|
|
3059
3085
|
...at,
|
|
3060
3086
|
name: String(id)
|
|
3061
3087
|
}));
|
|
3062
|
-
else if (ids.has(id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3088
|
+
else if (ids.has(id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_ID_DUPLICATE */.qj.NODE_CHECK_ID_DUPLICATE, {
|
|
3063
3089
|
...at,
|
|
3064
3090
|
name: id
|
|
3065
3091
|
}));
|
|
3066
3092
|
else ids.add(id);
|
|
3067
3093
|
const name = String(id);
|
|
3068
|
-
rule(check?.rule, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3094
|
+
rule(check?.rule, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_CHECK */.bc.THE_CHECK, {
|
|
3069
3095
|
name
|
|
3070
3096
|
}));
|
|
3071
|
-
if (typeof check?.message !== 'string' || !check.message.trim()) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3097
|
+
if (typeof check?.message !== 'string' || !check.message.trim()) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_MESSAGE_REQUIRED */.qj.NODE_CHECK_MESSAGE_REQUIRED, {
|
|
3072
3098
|
...at,
|
|
3073
3099
|
name
|
|
3074
3100
|
}));
|
|
3075
|
-
if (check?.field !== undefined && (typeof check.field !== 'string' || !check.field.trim() || check.field.length > 100)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3101
|
+
if (check?.field !== undefined && (typeof check.field !== 'string' || !check.field.trim() || check.field.length > 100)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_FIELD_INVALID */.qj.NODE_CHECK_FIELD_INVALID, {
|
|
3076
3102
|
...at,
|
|
3077
3103
|
name
|
|
3078
3104
|
}));
|
|
3079
3105
|
}
|
|
3080
3106
|
}
|
|
3081
3107
|
/** Every `context.<node>` must name a node of this flow; `input.<name>` should be an input some Request step declares. */ function checkNodeReferences(nodes, byId, flow, err, warnings) {
|
|
3082
|
-
const endpoints = (0,
|
|
3108
|
+
const endpoints = (0,_flow_types_js__rspack_import_5/* .flowEndpoints */.Xr)(flow);
|
|
3083
3109
|
const declaredInputs = new Set(endpoints.flatMap((endpoint)=>endpoint.inputSchema.map((f)=>f.name)));
|
|
3084
3110
|
// A list body is read by index, and an object body without fields takes anything: neither has names to check.
|
|
3085
3111
|
const namesKnown = endpoints.length > 0 && endpoints.every((endpoint)=>endpoint.bodyType !== 'list' && endpoint.inputSchema.length > 0);
|
|
@@ -3093,22 +3119,22 @@ function validateChecks(c, at, rule, err) {
|
|
|
3093
3119
|
for (const ref of refs){
|
|
3094
3120
|
const [scope, second] = ref.split('.');
|
|
3095
3121
|
if (!REF_SCOPES.has(scope)) {
|
|
3096
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3097
|
-
node: (0,
|
|
3122
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_BAD_SCOPE */.qj.REF_BAD_SCOPE, {
|
|
3123
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node),
|
|
3098
3124
|
ref
|
|
3099
3125
|
}));
|
|
3100
3126
|
} else if (scope === 'context' && second && !byId.has(second)) {
|
|
3101
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3102
|
-
node: (0,
|
|
3127
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_NODE_MISSING */.qj.REF_NODE_MISSING, {
|
|
3128
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node),
|
|
3103
3129
|
target: second
|
|
3104
3130
|
}));
|
|
3105
3131
|
} else if (scope === 'context' && second === node.id) {
|
|
3106
|
-
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3107
|
-
node: (0,
|
|
3132
|
+
err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_SELF */.qj.REF_SELF, {
|
|
3133
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
|
|
3108
3134
|
}));
|
|
3109
3135
|
} else if (scope === 'input' && second && namesKnown && !declaredInputs.has(second)) {
|
|
3110
|
-
warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3111
|
-
node: (0,
|
|
3136
|
+
warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_INPUT_UNDECLARED */.qj.REF_INPUT_UNDECLARED, {
|
|
3137
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node),
|
|
3112
3138
|
input: second
|
|
3113
3139
|
}));
|
|
3114
3140
|
}
|
|
@@ -3130,12 +3156,12 @@ function refsOf(value, refs = [], depth = 0) {
|
|
|
3130
3156
|
for (const { endpoint, label, steps } of runs){
|
|
3131
3157
|
if (endpoint.isTransactional) continue;
|
|
3132
3158
|
const writes = steps.filter((n)=>WRITE_NODE_TYPES.has(n.type)).length;
|
|
3133
|
-
if (writes >= 2) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3159
|
+
if (writes >= 2) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.WRITES_NOT_TRANSACTIONAL */.qj.WRITES_NOT_TRANSACTIONAL, {
|
|
3134
3160
|
count: writes,
|
|
3135
3161
|
node: label
|
|
3136
3162
|
}));
|
|
3137
|
-
for (const commit of steps)if (commit.type === 'commit') warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3138
|
-
node: (0,
|
|
3163
|
+
for (const commit of steps)if (commit.type === 'commit') warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.COMMIT_NOT_TRANSACTIONAL */.qj.COMMIT_NOT_TRANSACTIONAL, {
|
|
3164
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(commit),
|
|
3139
3165
|
endpoint: label
|
|
3140
3166
|
}));
|
|
3141
3167
|
}
|
|
@@ -3156,14 +3182,14 @@ function refsOf(value, refs = [], depth = 0) {
|
|
|
3156
3182
|
].some((f)=>f.calls.includes(flow.slug));
|
|
3157
3183
|
for (const commit of commits){
|
|
3158
3184
|
const at = {
|
|
3159
|
-
node: (0,
|
|
3185
|
+
node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(commit)
|
|
3160
3186
|
};
|
|
3161
3187
|
const loop = loops.find((l)=>l.body.has(commit.id));
|
|
3162
|
-
if (loop) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3188
|
+
if (loop) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.COMMIT_IN_LOOP */.qj.COMMIT_IN_LOOP, {
|
|
3163
3189
|
...at,
|
|
3164
|
-
loop: (0,
|
|
3190
|
+
loop: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(loop.node)
|
|
3165
3191
|
}));
|
|
3166
|
-
if (called) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(
|
|
3192
|
+
if (called) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.COMMIT_IN_CALLED_FLOW */.qj.COMMIT_IN_CALLED_FLOW, at));
|
|
3167
3193
|
}
|
|
3168
3194
|
}
|
|
3169
3195
|
/** Every node a loop's `each` branch runs, nested loops included. */ function loopBody(loopId, outgoing) {
|
|
@@ -3266,14 +3292,14 @@ function refsOf(value, refs = [], depth = 0) {
|
|
|
3266
3292
|
const [scope, target, field] = segs;
|
|
3267
3293
|
if (scope === 'loop') {
|
|
3268
3294
|
const parents = segs.slice(1).findIndex((s)=>s !== 'parent');
|
|
3269
|
-
if (!depth) warn(
|
|
3270
|
-
else if ((parents < 0 ? segs.length - 1 : parents) >= depth) warn(
|
|
3295
|
+
if (!depth) warn(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_LOOP_OUTSIDE */.qj.REF_LOOP_OUTSIDE, {});
|
|
3296
|
+
else if ((parents < 0 ? segs.length - 1 : parents) >= depth) warn(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_LOOP_PARENT_MISSING */.qj.REF_LOOP_PARENT_MISSING, {});
|
|
3271
3297
|
}
|
|
3272
3298
|
if (scope !== 'context' || !target || target === node.id || !byId.has(target)) continue;
|
|
3273
|
-
if (!available.has(target)) warn(
|
|
3299
|
+
if (!available.has(target)) warn(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_NODE_NOT_YET */.qj.REF_NODE_NOT_YET, {
|
|
3274
3300
|
target: nameOf(target)
|
|
3275
3301
|
});
|
|
3276
|
-
else if (field === 'results' && around.has(target)) warn(
|
|
3302
|
+
else if (field === 'results' && around.has(target)) warn(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_LOOP_RESULTS_EARLY */.qj.REF_LOOP_RESULTS_EARLY, {
|
|
3277
3303
|
loop: nameOf(target)
|
|
3278
3304
|
});
|
|
3279
3305
|
}
|
|
@@ -3328,8 +3354,8 @@ function reach(start, outgoing) {
|
|
|
3328
3354
|
nesting.set(id, max);
|
|
3329
3355
|
return max;
|
|
3330
3356
|
};
|
|
3331
|
-
if (nodes.some((n)=>n.type === 'trigger' && nestingFrom(n.id) >
|
|
3332
|
-
max:
|
|
3357
|
+
if (nodes.some((n)=>n.type === 'trigger' && nestingFrom(n.id) > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_LOOP_DEPTH */.Or.MAX_LOOP_DEPTH)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.LOOP_TOO_DEEP */.qj.LOOP_TOO_DEEP, {
|
|
3358
|
+
max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_LOOP_DEPTH */.Or.MAX_LOOP_DEPTH
|
|
3333
3359
|
}));
|
|
3334
3360
|
}
|
|
3335
3361
|
|
|
@@ -5299,8 +5325,8 @@ const BLOCKED_REQUEST_HEADERS = new Set([
|
|
|
5299
5325
|
});
|
|
5300
5326
|
}
|
|
5301
5327
|
|
|
5302
|
-
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/rule-engine/index.ts +
|
|
5303
|
-
var rule_engine = __webpack_require__(
|
|
5328
|
+
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/rule-engine/index.ts + 2 modules
|
|
5329
|
+
var rule_engine = __webpack_require__(8552);
|
|
5304
5330
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-builder-config.service.ts
|
|
5305
5331
|
var entity_builder_config_service = __webpack_require__(4281);
|
|
5306
5332
|
// EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-builder-datasource.provider.ts
|
|
@@ -6156,9 +6182,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
6156
6182
|
/* import */ var _flusys_nestjs_shared_utils__rspack_import_1 = __webpack_require__(9216);
|
|
6157
6183
|
/* import */ var _nestjs_common__rspack_import_2 = __webpack_require__(6157);
|
|
6158
6184
|
/* import */ var _config_event_actions_js__rspack_import_10 = __webpack_require__(982);
|
|
6159
|
-
/* import */ var
|
|
6185
|
+
/* import */ var _config_message_keys_js__rspack_import_8 = __webpack_require__(5732);
|
|
6160
6186
|
/* import */ var _enums_entity_status_enum_js__rspack_import_9 = __webpack_require__(1313);
|
|
6161
|
-
/* import */ var
|
|
6187
|
+
/* import */ var _enums_field_type_enum_js__rspack_import_7 = __webpack_require__(9614);
|
|
6162
6188
|
/* import */ var _interfaces_generic_record_interface_js__rspack_import_3 = __webpack_require__(3372);
|
|
6163
6189
|
/* import */ var _database_error_mapper_js__rspack_import_4 = __webpack_require__(8323);
|
|
6164
6190
|
/* import */ var _field_value_validator_js__rspack_import_5 = __webpack_require__(3525);
|
|
@@ -6190,6 +6216,18 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6190
6216
|
lt: '<',
|
|
6191
6217
|
lte: '<='
|
|
6192
6218
|
};
|
|
6219
|
+
/** The LIKE pattern of each text-match operator, built from the already escaped text. */ const TEXT_PATTERN = {
|
|
6220
|
+
contains: (t)=>`%${t}%`,
|
|
6221
|
+
not_contains: (t)=>`%${t}%`,
|
|
6222
|
+
starts_with: (t)=>`${t}%`,
|
|
6223
|
+
ends_with: (t)=>`%${t}`
|
|
6224
|
+
};
|
|
6225
|
+
const TEXT_FIELD_TYPES = new Set([
|
|
6226
|
+
_enums_field_type_enum_js__rspack_import_7/* .FieldType.TEXT */.P.TEXT,
|
|
6227
|
+
_enums_field_type_enum_js__rspack_import_7/* .FieldType.LONG_TEXT */.P.LONG_TEXT,
|
|
6228
|
+
_enums_field_type_enum_js__rspack_import_7/* .FieldType.EMAIL */.P.EMAIL,
|
|
6229
|
+
_enums_field_type_enum_js__rspack_import_7/* .FieldType.SINGLE_SELECT */.P.SINGLE_SELECT
|
|
6230
|
+
]);
|
|
6193
6231
|
/**
|
|
6194
6232
|
* Generic CRUD for one dynamically-defined entity, mirroring ApiService's shape
|
|
6195
6233
|
* (transactional writes, lifecycle event publishing) but
|
|
@@ -6241,7 +6279,7 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6241
6279
|
if (errors.length === 0) return;
|
|
6242
6280
|
throw new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6243
6281
|
message: 'Validation failed',
|
|
6244
|
-
messageKey:
|
|
6282
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.VALIDATION_FAILED */.j4.VALIDATION_FAILED,
|
|
6245
6283
|
errors
|
|
6246
6284
|
});
|
|
6247
6285
|
}
|
|
@@ -6250,14 +6288,14 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6250
6288
|
const errors = [];
|
|
6251
6289
|
for (const field of this.fields){
|
|
6252
6290
|
const value = values[field.code];
|
|
6253
|
-
if (field.fieldType !==
|
|
6291
|
+
if (field.fieldType !== _enums_field_type_enum_js__rspack_import_7/* .FieldType.RELATION */.P.RELATION || !field.relationTargetEntityId || typeof value !== 'string') continue;
|
|
6254
6292
|
const related = await this.resolveRelated(field.relationTargetEntityId, queryRunner);
|
|
6255
6293
|
const found = await related.exists(value, {
|
|
6256
6294
|
queryRunner
|
|
6257
6295
|
});
|
|
6258
6296
|
if (!found) errors.push({
|
|
6259
6297
|
field: field.code,
|
|
6260
|
-
...(0,_flusys_nestjs_shared_utils__rspack_import_1.messageRef)(
|
|
6298
|
+
...(0,_flusys_nestjs_shared_utils__rspack_import_1.messageRef)(_config_message_keys_js__rspack_import_8/* .FIELD_VALIDATION_MESSAGES.RELATED_NOT_FOUND */.KE.RELATED_NOT_FOUND, {
|
|
6261
6299
|
label: field.label
|
|
6262
6300
|
})
|
|
6263
6301
|
});
|
|
@@ -6267,7 +6305,7 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6267
6305
|
notFound(id) {
|
|
6268
6306
|
return new _nestjs_common__rspack_import_2.NotFoundException({
|
|
6269
6307
|
message: `Record '${id}' not found on entity '${this.entityCode}'.`,
|
|
6270
|
-
messageKey:
|
|
6308
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.NOT_FOUND */.j4.NOT_FOUND,
|
|
6271
6309
|
messageVariables: {
|
|
6272
6310
|
id,
|
|
6273
6311
|
entity: this.entityCode
|
|
@@ -6295,7 +6333,7 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6295
6333
|
if (this.definition.status === _enums_entity_status_enum_js__rspack_import_9/* .EntityStatus.DEPRECATED */.c.DEPRECATED) {
|
|
6296
6334
|
throw new _nestjs_common__rspack_import_2.ForbiddenException({
|
|
6297
6335
|
message: `Entity '${this.definition.code}' has been deprecated and no longer accepts writes.`,
|
|
6298
|
-
messageKey:
|
|
6336
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .ENTITY_DEFINITION_MESSAGES.DEPRECATED */.pL.DEPRECATED,
|
|
6299
6337
|
messageVariables: {
|
|
6300
6338
|
code: this.definition.code
|
|
6301
6339
|
}
|
|
@@ -6323,7 +6361,7 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6323
6361
|
if (SYSTEM_COLUMNS.has(key)) {
|
|
6324
6362
|
throw new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6325
6363
|
message: `'${key}' is a system column and cannot be set directly.`,
|
|
6326
|
-
messageKey:
|
|
6364
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.SYSTEM_COLUMN_READONLY */.j4.SYSTEM_COLUMN_READONLY,
|
|
6327
6365
|
messageVariables: {
|
|
6328
6366
|
key
|
|
6329
6367
|
}
|
|
@@ -6332,7 +6370,7 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6332
6370
|
if (!this.activeFieldCodes.has(key)) {
|
|
6333
6371
|
throw new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6334
6372
|
message: `'${key}' is not a field on entity '${this.entityCode}'.`,
|
|
6335
|
-
messageKey:
|
|
6373
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.UNKNOWN_FIELD */.j4.UNKNOWN_FIELD,
|
|
6336
6374
|
messageVariables: {
|
|
6337
6375
|
key,
|
|
6338
6376
|
entity: this.entityCode
|
|
@@ -6405,7 +6443,7 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6405
6443
|
if (!dto.id) {
|
|
6406
6444
|
throw new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6407
6445
|
message: 'id is required to update a record.',
|
|
6408
|
-
messageKey:
|
|
6446
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.ID_REQUIRED */.j4.ID_REQUIRED
|
|
6409
6447
|
});
|
|
6410
6448
|
}
|
|
6411
6449
|
const { id: _id, ...rest } = dto;
|
|
@@ -6494,55 +6532,177 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6494
6532
|
* getFilterQuery/getSortQuery (raw client-supplied keys concatenated into SQL) is
|
|
6495
6533
|
* structurally impossible here since an unknown key is rejected outright. Operators map
|
|
6496
6534
|
* to a fixed SQL table and every value is a bound parameter. */ applyFilter(query, filter) {
|
|
6535
|
+
const postgres = query.connection.options.type === 'postgres';
|
|
6497
6536
|
Object.entries(filter).forEach(([key, value], index)=>{
|
|
6498
6537
|
this.assertKnownColumn(key);
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
if (value !== null && typeof value === 'object') {
|
|
6503
|
-
const op = value.op;
|
|
6504
|
-
if (typeof op === 'string' && !('type' in value) && !_interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_OPS.includes */.ox.includes(op)) throw this.unknownOperator(key, op);
|
|
6505
|
-
throw this.invalidFilterValue(key, 'eq');
|
|
6506
|
-
}
|
|
6507
|
-
query.andWhere(`${column} = :${param}`, {
|
|
6508
|
-
[param]: value
|
|
6509
|
-
});
|
|
6510
|
-
return;
|
|
6538
|
+
if (!(0,_interfaces_generic_record_interface_js__rspack_import_3/* .isRecordFilterCondition */.t1)(value) && value !== null && typeof value === 'object') {
|
|
6539
|
+
const op = value.op;
|
|
6540
|
+
if (typeof op === 'string' && !('type' in value) && !_interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_OPS.includes */.ox.includes(op)) throw this.unknownOperator(key, op);
|
|
6511
6541
|
}
|
|
6512
|
-
const { op, value: operand } = value
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6542
|
+
const { op, value: operand } = (0,_interfaces_generic_record_interface_js__rspack_import_3/* .isRecordFilterCondition */.t1)(value) ? value : {
|
|
6543
|
+
op: 'eq',
|
|
6544
|
+
value
|
|
6545
|
+
};
|
|
6546
|
+
this.assertOperatorFits(key, op);
|
|
6547
|
+
const [sql, params] = this.conditionSql(`${this.entityCode}.${key}`, key, op, operand, `filter_${index}`, postgres);
|
|
6548
|
+
query.andWhere(sql, params);
|
|
6549
|
+
});
|
|
6550
|
+
return query;
|
|
6551
|
+
}
|
|
6552
|
+
/** One filter as SQL: the column is a checked field code and every value is a bound parameter. */ conditionSql(column, key, op, operand, param, postgres) {
|
|
6553
|
+
const multiSelect = this.fieldTypeOf(key) === _enums_field_type_enum_js__rspack_import_7/* .FieldType.MULTI_SELECT */.P.MULTI_SELECT;
|
|
6554
|
+
switch(_interfaces_generic_record_interface_js__rspack_import_3/* .FILTER_OP_VALUE_KIND */.w9[op]){
|
|
6555
|
+
case 'none':
|
|
6556
|
+
if (op === 'is_null') return [
|
|
6557
|
+
`${column} IS NULL`,
|
|
6558
|
+
{}
|
|
6559
|
+
];
|
|
6560
|
+
if (op === 'not_null') return [
|
|
6561
|
+
`${column} IS NOT NULL`,
|
|
6562
|
+
{}
|
|
6563
|
+
];
|
|
6564
|
+
if (!multiSelect) return [
|
|
6565
|
+
op === 'is_empty' ? `(${column} IS NULL OR ${column} = '')` : `(${column} IS NOT NULL AND ${column} <> '')`,
|
|
6566
|
+
{}
|
|
6567
|
+
];
|
|
6568
|
+
if (postgres) return [
|
|
6569
|
+
op === 'is_empty' ? `(${column} IS NULL OR ${column} = '[]'::jsonb)` : `(${column} IS NOT NULL AND ${column} <> '[]'::jsonb)`,
|
|
6570
|
+
{}
|
|
6571
|
+
];
|
|
6572
|
+
return [
|
|
6573
|
+
op === 'is_empty' ? `(${column} IS NULL OR JSON_LENGTH(${column}) = 0)` : `JSON_LENGTH(${column}) > 0`,
|
|
6574
|
+
{}
|
|
6575
|
+
];
|
|
6576
|
+
case 'list':
|
|
6577
|
+
{
|
|
6578
|
+
const values = this.listOperand(key, op, operand);
|
|
6579
|
+
if (op === 'in') return values.length ? [
|
|
6580
|
+
`${column} IN (:...${param})`,
|
|
6581
|
+
{
|
|
6582
|
+
[param]: values
|
|
6526
6583
|
}
|
|
6527
|
-
|
|
6584
|
+
] : [
|
|
6585
|
+
'1 = 0',
|
|
6586
|
+
{}
|
|
6587
|
+
];
|
|
6588
|
+
if (op === 'not_in') return values.length ? [
|
|
6589
|
+
`${column} NOT IN (:...${param})`,
|
|
6590
|
+
{
|
|
6591
|
+
[param]: values
|
|
6592
|
+
}
|
|
6593
|
+
] : [
|
|
6594
|
+
'1 = 1',
|
|
6595
|
+
{}
|
|
6596
|
+
];
|
|
6597
|
+
const holds = (list, name)=>[
|
|
6598
|
+
postgres ? `${column} @> CAST(:${name} AS jsonb)` : `JSON_CONTAINS(${column}, CAST(:${name} AS JSON))`,
|
|
6599
|
+
{
|
|
6600
|
+
[name]: JSON.stringify(list)
|
|
6601
|
+
}
|
|
6602
|
+
];
|
|
6603
|
+
if (op === 'has_all') return values.length ? holds(values, param) : [
|
|
6604
|
+
'1 = 1',
|
|
6605
|
+
{}
|
|
6606
|
+
];
|
|
6607
|
+
if (!values.length) return [
|
|
6608
|
+
op === 'has_any' ? '1 = 0' : '1 = 1',
|
|
6609
|
+
{}
|
|
6610
|
+
];
|
|
6611
|
+
const each = values.map((v, i)=>holds([
|
|
6612
|
+
v
|
|
6613
|
+
], `${param}_${i}`));
|
|
6614
|
+
const any = `(${each.map(([sql])=>sql).join(' OR ')})`;
|
|
6615
|
+
return [
|
|
6616
|
+
op === 'has_any' ? any : `NOT ${any}`,
|
|
6617
|
+
Object.assign({}, ...each.map(([, params])=>params))
|
|
6618
|
+
];
|
|
6619
|
+
}
|
|
6620
|
+
case 'range':
|
|
6621
|
+
{
|
|
6622
|
+
if (!Array.isArray(operand) || operand.length !== 2 || !operand.every(isFilterScalar)) throw this.invalidFilterValue(key, op);
|
|
6623
|
+
const [from, to] = [
|
|
6624
|
+
`${param}_from`,
|
|
6625
|
+
`${param}_to`
|
|
6626
|
+
];
|
|
6627
|
+
return [
|
|
6628
|
+
`${column} ${op === 'between' ? 'BETWEEN' : 'NOT BETWEEN'} :${from} AND :${to}`,
|
|
6629
|
+
{
|
|
6630
|
+
[from]: operand[0],
|
|
6631
|
+
[to]: operand[1]
|
|
6632
|
+
}
|
|
6633
|
+
];
|
|
6634
|
+
}
|
|
6635
|
+
case 'single':
|
|
6636
|
+
{
|
|
6637
|
+
if (operand === null && (op === 'eq' || op === 'ne')) return [
|
|
6638
|
+
`${column} IS ${op === 'eq' ? '' : 'NOT '}NULL`,
|
|
6639
|
+
{}
|
|
6640
|
+
];
|
|
6641
|
+
if (operand === null || operand === undefined || !isFilterScalar(operand)) throw this.invalidFilterValue(key, op);
|
|
6642
|
+
if (op === 'ieq') return [
|
|
6643
|
+
`LOWER(${column}) = LOWER(:${param})`,
|
|
6644
|
+
{
|
|
6645
|
+
[param]: String(operand)
|
|
6646
|
+
}
|
|
6647
|
+
];
|
|
6648
|
+
const pattern = TEXT_PATTERN[op];
|
|
6649
|
+
if (!pattern) return [
|
|
6650
|
+
`${column} ${FILTER_COMPARISON_SQL[op]} :${param}`,
|
|
6651
|
+
{
|
|
6652
|
+
[param]: operand
|
|
6653
|
+
}
|
|
6654
|
+
];
|
|
6655
|
+
const text = String(operand);
|
|
6656
|
+
if (!text.trim()) throw this.invalidFilterValue(key, op);
|
|
6657
|
+
const like = `${op === 'not_contains' ? 'NOT ' : ''}${postgres ? 'ILIKE' : 'LIKE'}`;
|
|
6658
|
+
return [
|
|
6659
|
+
`${column} ${like} :${param}`,
|
|
6660
|
+
{
|
|
6661
|
+
[param]: pattern(text.replace(/[\\%_]/g, '\\$&'))
|
|
6662
|
+
}
|
|
6663
|
+
];
|
|
6664
|
+
}
|
|
6665
|
+
}
|
|
6666
|
+
}
|
|
6667
|
+
/** A list of scalars; one scalar (e.g. a single value read from input) counts as a one-item list. */ listOperand(key, op, operand) {
|
|
6668
|
+
const list = isFilterScalar(operand) ? [
|
|
6669
|
+
operand
|
|
6670
|
+
] : operand;
|
|
6671
|
+
if (!Array.isArray(list) || !list.every(isFilterScalar)) throw this.invalidFilterValue(key, op);
|
|
6672
|
+
if (list.length > _interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_LIMITS.MAX_IN_VALUES */.M5.MAX_IN_VALUES) {
|
|
6673
|
+
throw new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6674
|
+
message: `The '${key}' filter lists more than ${_interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_LIMITS.MAX_IN_VALUES */.M5.MAX_IN_VALUES} values.`,
|
|
6675
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_TOO_MANY_VALUES */.j4.FILTER_TOO_MANY_VALUES,
|
|
6676
|
+
messageVariables: {
|
|
6677
|
+
key,
|
|
6678
|
+
max: _interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_LIMITS.MAX_IN_VALUES */.M5.MAX_IN_VALUES
|
|
6528
6679
|
}
|
|
6529
|
-
if (!operand.length) query.andWhere('1 = 0');
|
|
6530
|
-
else query.andWhere(`${column} IN (:...${param})`, {
|
|
6531
|
-
[param]: operand
|
|
6532
|
-
});
|
|
6533
|
-
return;
|
|
6534
|
-
}
|
|
6535
|
-
if (operand === null || operand === undefined || !isFilterScalar(operand)) throw this.invalidFilterValue(key, op);
|
|
6536
|
-
query.andWhere(`${column} ${FILTER_COMPARISON_SQL[op]} :${param}`, {
|
|
6537
|
-
[param]: operand
|
|
6538
6680
|
});
|
|
6539
|
-
}
|
|
6540
|
-
return
|
|
6681
|
+
}
|
|
6682
|
+
return list;
|
|
6683
|
+
}
|
|
6684
|
+
fieldTypeOf(key) {
|
|
6685
|
+
return this.fields.find((f)=>f.code === key && !f.deprecatedAt && !f.isSystemField)?.fieldType;
|
|
6686
|
+
}
|
|
6687
|
+
/** Text operators need a text field, multi-select operators a multi-select one, and nothing but null / blank checks reads a list or JSON field. */ assertOperatorFits(key, op) {
|
|
6688
|
+
const type = this.fieldTypeOf(key);
|
|
6689
|
+
const textField = type !== undefined && TEXT_FIELD_TYPES.has(type);
|
|
6690
|
+
const fits = _interfaces_generic_record_interface_js__rspack_import_3/* .TEXT_FILTER_OPS.includes */.wk.includes(op) ? textField : _interfaces_generic_record_interface_js__rspack_import_3/* .LIST_FIELD_FILTER_OPS.includes */.yV.includes(op) ? type === _enums_field_type_enum_js__rspack_import_7/* .FieldType.MULTI_SELECT */.P.MULTI_SELECT : _interfaces_generic_record_interface_js__rspack_import_3/* .EMPTY_FILTER_OPS.includes */.Oh.includes(op) ? textField || type === _enums_field_type_enum_js__rspack_import_7/* .FieldType.MULTI_SELECT */.P.MULTI_SELECT : op === 'is_null' || op === 'not_null' || type !== _enums_field_type_enum_js__rspack_import_7/* .FieldType.MULTI_SELECT */.P.MULTI_SELECT && type !== _enums_field_type_enum_js__rspack_import_7/* .FieldType.JSON */.P.JSON;
|
|
6691
|
+
if (!fits) {
|
|
6692
|
+
throw new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6693
|
+
message: `The '${op}' filter cannot be used on '${key}'.`,
|
|
6694
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_OPERATOR_NOT_FOR_FIELD */.j4.FILTER_OPERATOR_NOT_FOR_FIELD,
|
|
6695
|
+
messageVariables: {
|
|
6696
|
+
key,
|
|
6697
|
+
op
|
|
6698
|
+
}
|
|
6699
|
+
});
|
|
6700
|
+
}
|
|
6541
6701
|
}
|
|
6542
6702
|
unknownOperator(key, op) {
|
|
6543
6703
|
return new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6544
6704
|
message: `'${op}' is not a filter operator.`,
|
|
6545
|
-
messageKey:
|
|
6705
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_OPERATOR_UNKNOWN */.j4.FILTER_OPERATOR_UNKNOWN,
|
|
6546
6706
|
messageVariables: {
|
|
6547
6707
|
key,
|
|
6548
6708
|
op,
|
|
@@ -6552,8 +6712,8 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6552
6712
|
}
|
|
6553
6713
|
invalidFilterValue(key, op) {
|
|
6554
6714
|
return new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6555
|
-
message:
|
|
6556
|
-
messageKey:
|
|
6715
|
+
message: `The '${key}' filter has an invalid value for '${op}'.`,
|
|
6716
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_VALUE_INVALID */.j4.FILTER_VALUE_INVALID,
|
|
6557
6717
|
messageVariables: {
|
|
6558
6718
|
key,
|
|
6559
6719
|
op
|
|
@@ -6582,7 +6742,7 @@ const FILTER_COMPARISON_SQL = {
|
|
|
6582
6742
|
if (key !== 'id' && !this.presentSystemColumns.has(key) && !this.activeFieldCodes.has(key)) {
|
|
6583
6743
|
throw new _nestjs_common__rspack_import_2.BadRequestException({
|
|
6584
6744
|
message: `'${key}' is not a field on entity '${this.entityCode}'.`,
|
|
6585
|
-
messageKey:
|
|
6745
|
+
messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.UNKNOWN_FIELD */.j4.UNKNOWN_FIELD,
|
|
6586
6746
|
messageVariables: {
|
|
6587
6747
|
key,
|
|
6588
6748
|
entity: this.entityCode
|