@flusys/nestjs-entity-builder 9.1.1 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +24 -12
  2. package/config/message-keys.d.ts +29 -0
  3. package/controllers/entity-definition.controller.d.ts +1 -0
  4. package/controllers/field-definition.controller.d.ts +1 -0
  5. package/controllers/flow-definition.controller.d.ts +1 -0
  6. package/dtos/definition-bundle.dto.d.ts +1 -0
  7. package/dtos/entity-definition.dto.d.ts +1 -2
  8. package/fesm/21.js +31 -2
  9. package/fesm/458.js +8 -3
  10. package/fesm/677.js +890 -465
  11. package/fesm/{582.js → 857.js} +201 -265
  12. package/fesm/870.js +580 -247
  13. package/fesm/897.js +164 -22
  14. package/fesm/946.js +5 -1
  15. package/fesm/controllers/index.js +1 -1
  16. package/fesm/dtos/index.js +11 -0
  17. package/fesm/guards/index.js +2 -2
  18. package/fesm/index.js +39 -6
  19. package/fesm/interfaces/index.js +74 -3
  20. package/fesm/modules/index.js +1 -1
  21. package/fesm/rule-engine/index.js +2 -2
  22. package/fesm/services/index.js +13 -3
  23. package/flow-engine/flow-input.validator.d.ts +2 -1
  24. package/flow-engine/flow-run.types.d.ts +1 -0
  25. package/flow-engine/flow.types.d.ts +25 -4
  26. package/interfaces/definition-bundle.interface.d.ts +2 -1
  27. package/interfaces/generic-record.interface.d.ts +11 -1
  28. package/package.json +3 -4
  29. package/rule-engine/rule-engine.service.d.ts +2 -1
  30. package/rule-engine/rule-regex.d.ts +0 -2
  31. package/rule-engine/rule-values.d.ts +4 -1
  32. package/rule-engine/rule.interface.d.ts +2 -3
  33. package/services/definition-bundle.diff.d.ts +6 -0
  34. package/services/definition-bundle.service.d.ts +10 -2
  35. package/services/entity-flow-scaffold.d.ts +2 -1
  36. package/services/entity-permission.service.d.ts +1 -0
  37. package/services/flow-definition.service.d.ts +1 -1
  38. package/services/flow-runtime.service.d.ts +1 -0
  39. package/services/generic-entity.service.d.ts +5 -0
  40. package/services/schema-change-executor.service.d.ts +1 -0
  41. package/services/schema-dialect-adapter.service.d.ts +2 -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
- if ((0,generic_record_interface/* .isRecordFilterCondition */.t1)(item)) {
537
- if (item.op === 'is_null' || item.op === 'not_null') {
538
- out[key] = {
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 caller passes the AND / OR rule; `missing` lists the codes it names that the caller does not hold. */ async function runPermissionCheck(cfg, env, state) {
584
- const permissions = state.permissions ?? env.ruleEngine.createPermissionResolver(state.user);
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,
@@ -716,6 +725,128 @@ function writeOptions(state) {
716
725
  publishEvents: false
717
726
  } : {};
718
727
  }
728
+ /** A get_all request's own query: what a `fromRequest` query reads. A list body has none. */ function requestQuery(state) {
729
+ return Array.isArray(state.input) ? {} : state.input;
730
+ }
731
+ /** A request's filter the way the API controller reads it: a value matches as equal, a list as one of its items - never an operator the caller sent. */ function requestFilter(filter) {
732
+ return Object.fromEntries(Object.entries(filter ?? {}).map(([key, value])=>[
733
+ key,
734
+ {
735
+ op: Array.isArray(value) ? 'in' : 'eq',
736
+ value
737
+ }
738
+ ]));
739
+ }
740
+ /** Only the fields a request's `select` names, `id` always kept; every field when it names none. */ function selectFields(rows, select) {
741
+ if (!select?.length) return rows;
742
+ const kept = new Set([
743
+ 'id',
744
+ ...select
745
+ ]);
746
+ return rows.map((row)=>Object.fromEntries(Object.entries(row).filter(([key])=>kept.has(key))));
747
+ }
748
+ async function runQuery(node, cfg, env, state) {
749
+ const ctx = evaluationContext(state, env);
750
+ const service = await env.entityService(cfg.entityCode, state.qr);
751
+ const request = cfg.fromRequest ? requestQuery(state) : {};
752
+ const filter = {
753
+ ...requestFilter(request.filter),
754
+ ...await mapFilter(node, cfg.filter, env, state, 'skip')
755
+ };
756
+ const searched = cfg.search ? await env.ruleEngine.resolveExpression(cfg.search, ctx) : cfg.fromRequest ? state.request['query']?.['q'] : undefined;
757
+ const search = typeof searched === 'string' && searched ? searched : undefined;
758
+ const sort = cfg.sort ? {
759
+ [cfg.sort.field]: cfg.sort.direction === 'DESC' ? 'DESC' : 'ASC'
760
+ } : request.sort;
761
+ const page = request.pagination?.currentPage ?? 0;
762
+ const pageSize = Math.min(request.pagination?.pageSize ?? cfg.limit ?? 50, flow_types/* .FLOW_LIMITS.MAX_QUERY_LIMIT */.Or.MAX_QUERY_LIMIT);
763
+ const withDeleted = request.withDeleted === true ? {
764
+ withDeleted: true
765
+ } : {};
766
+ const { data, total } = await service.getAll(search, {
767
+ filter,
768
+ sort,
769
+ pagination: {
770
+ currentPage: page,
771
+ pageSize
772
+ },
773
+ ...withDeleted
774
+ }, readOptions(state));
775
+ return {
776
+ output: {
777
+ items: selectFields(data, request.select),
778
+ total,
779
+ page,
780
+ pageSize
781
+ }
782
+ };
783
+ }
784
+ /** A Respond step's body: as built (raw), or the API controller envelope around it. */ async function respondBody(node, cfg, env, state) {
785
+ const ctx = evaluationContext(state, env);
786
+ const format = cfg.format ?? 'raw';
787
+ const built = async ()=>cfg.bodyExpression ? env.ruleEngine.resolveExpression(cfg.bodyExpression, ctx) : mapValues(cfg.body, env, state);
788
+ if (format === 'raw') return built();
789
+ const variables = await mapValues(cfg.messageVariables, env, state);
790
+ const envelope = {
791
+ success: cfg.statusCode < 400,
792
+ message: cfg.message ?? '',
793
+ messageKey: cfg.messageKey ?? '',
794
+ ...Object.keys(variables).length ? {
795
+ messageVariables: variables
796
+ } : {}
797
+ };
798
+ if (format === 'message') return envelope;
799
+ if (format === 'single') return {
800
+ ...envelope,
801
+ data: await built()
802
+ };
803
+ const value = await built();
804
+ if (value !== null && value !== undefined && !Array.isArray(value)) throw new flow_errors/* .FlowKeyedError */.Hp(message_keys/* .FLOW_ERROR_MESSAGES.RESPOND_DATA_NOT_LIST */.zr.RESPOND_DATA_NOT_LIST, {
805
+ node: (0,flow_types/* .nodeLabel */.dA)(node)
806
+ });
807
+ const data = value ?? [];
808
+ const count = async (name, fallback)=>{
809
+ const expression = cfg[name];
810
+ if (expression === undefined) return fallback;
811
+ const resolved = await env.ruleEngine.resolveExpression(expression, ctx);
812
+ if (resolved === null || resolved === undefined || resolved === '') return fallback;
813
+ const n = Number(resolved);
814
+ if (!Number.isInteger(n) || n < 0) throw new flow_errors/* .FlowKeyedError */.Hp(message_keys/* .FLOW_ERROR_MESSAGES.RESPOND_META_INVALID */.zr.RESPOND_META_INVALID, {
815
+ node: (0,flow_types/* .nodeLabel */.dA)(node),
816
+ name
817
+ });
818
+ return n;
819
+ };
820
+ if (format === 'bulk') {
821
+ const total = await count('total', Array.isArray(state.input) ? state.input.length : data.length);
822
+ return {
823
+ ...envelope,
824
+ data,
825
+ meta: {
826
+ count: data.length,
827
+ total,
828
+ failed: Math.max(total - data.length, 0)
829
+ }
830
+ };
831
+ }
832
+ const pagination = requestQuery(state).pagination;
833
+ const total = await count('total', data.length);
834
+ const page = await count('page', pagination?.currentPage ?? 0);
835
+ const pageSize = await count('pageSize', pagination?.pageSize ?? data.length);
836
+ const totalPages = pageSize > 0 ? Math.ceil(total / pageSize) : 1;
837
+ return {
838
+ ...envelope,
839
+ data,
840
+ meta: {
841
+ total,
842
+ page,
843
+ pageSize,
844
+ count: data.length,
845
+ hasMore: page < totalPages - 1,
846
+ totalPages
847
+ }
848
+ };
849
+ }
719
850
  function readOptions(state) {
720
851
  return {
721
852
  queryRunner: state.qr
@@ -1398,8 +1529,11 @@ const nobody = (extra = {})=>({
1398
1529
  const id = asId(await env.ruleEngine.resolveExpression(cfg.id, ctx));
1399
1530
  const service = await env.entityService(cfg.entityCode, state.qr);
1400
1531
  try {
1532
+ const record = await service.findById(id, readOptions(state));
1401
1533
  return {
1402
- output: await service.findById(id, readOptions(state))
1534
+ output: cfg.fromRequest ? selectFields([
1535
+ record
1536
+ ], requestQuery(state).select)[0] : record
1403
1537
  };
1404
1538
  } catch (error) {
1405
1539
  if (error instanceof common_.NotFoundException && cfg.onNotFound === 'null') return {
@@ -1409,29 +1543,7 @@ const nobody = (extra = {})=>({
1409
1543
  }
1410
1544
  }
1411
1545
  case 'entity_query':
1412
- {
1413
- const cfg = c;
1414
- const service = await env.entityService(cfg.entityCode, state.qr);
1415
- const filter = await mapFilter(node, cfg.filter, env, state, 'skip');
1416
- const search = cfg.search ? await env.ruleEngine.resolveExpression(cfg.search, ctx) : undefined;
1417
- const limit = Math.min(cfg.limit ?? 50, flow_types/* .FLOW_LIMITS.MAX_QUERY_LIMIT */.Or.MAX_QUERY_LIMIT);
1418
- const { data, total } = await service.getAll(typeof search === 'string' && search ? search : undefined, {
1419
- filter,
1420
- sort: cfg.sort ? {
1421
- [cfg.sort.field]: cfg.sort.direction === 'DESC' ? 'DESC' : 'ASC'
1422
- } : undefined,
1423
- pagination: {
1424
- currentPage: 0,
1425
- pageSize: limit
1426
- }
1427
- }, readOptions(state));
1428
- return {
1429
- output: {
1430
- items: data,
1431
- total
1432
- }
1433
- };
1434
- }
1546
+ return runQuery(node, c, env, state);
1435
1547
  case 'commit':
1436
1548
  {
1437
1549
  const reasonKey = state.mode === 'dry_run' ? message_keys/* .FLOW_SKIP_MESSAGES.COMMIT_DRY_RUN */.CB.COMMIT_DRY_RUN : !state.qr ? message_keys/* .FLOW_SKIP_MESSAGES.COMMIT_NO_TRANSACTION */.CB.COMMIT_NO_TRANSACTION : !state.ownsTransaction ? message_keys/* .FLOW_SKIP_MESSAGES.COMMIT_JOINED */.CB.COMMIT_JOINED : null;
@@ -1533,7 +1645,7 @@ const nobody = (extra = {})=>({
1533
1645
  case 'respond':
1534
1646
  {
1535
1647
  const cfg = c;
1536
- const body = cfg.bodyExpression ? await env.ruleEngine.resolveExpression(cfg.bodyExpression, ctx) : await mapValues(cfg.body, env, state);
1648
+ const body = await respondBody(node, cfg, env, state);
1537
1649
  return {
1538
1650
  output: body,
1539
1651
  respond: {
@@ -1810,16 +1922,14 @@ function successResult(state, startedAt) {
1810
1922
  },
1811
1923
  3186(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1812
1924
  /* import */ var _flusys_nestjs_shared_utils__rspack_import_0 = __webpack_require__(9216);
1813
- /* import */ var _config_entity_builder_constants_js__rspack_import_9 = __webpack_require__(6576);
1814
- /* import */ var _config_message_keys_js__rspack_import_8 = __webpack_require__(5732);
1925
+ /* import */ var _config_entity_builder_constants_js__rspack_import_8 = __webpack_require__(6576);
1926
+ /* import */ var _config_message_keys_js__rspack_import_7 = __webpack_require__(5732);
1815
1927
  /* 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__(8429);
1928
+ /* import */ var _rule_engine_index_js__rspack_import_2 = __webpack_require__(8552);
1817
1929
  /* import */ var _rule_engine_rule_ip_js__rspack_import_3 = __webpack_require__(809);
1818
1930
  /* import */ var _rule_engine_rule_permission_js__rspack_import_4 = __webpack_require__(5191);
1819
- /* import */ var _rule_engine_rule_regex_js__rspack_import_5 = __webpack_require__(6308);
1820
- /* import */ var _flow_types_js__rspack_import_6 = __webpack_require__(6256);
1821
- /* import */ var _flow_api_key_js__rspack_import_7 = __webpack_require__(4816);
1822
-
1931
+ /* import */ var _flow_types_js__rspack_import_5 = __webpack_require__(6256);
1932
+ /* import */ var _flow_api_key_js__rspack_import_6 = __webpack_require__(4816);
1823
1933
 
1824
1934
 
1825
1935
 
@@ -1963,7 +2073,14 @@ const DURATION_ARG = {
1963
2073
  case 'lookup':
1964
2074
  for (const item of Object.values(expression.filter ?? {})){
1965
2075
  const value = (0,_interfaces_generic_record_interface_js__rspack_import_1/* .isRecordFilterCondition */.t1)(item) ? item.value : item;
1966
- if (isExpression(value)) collectExpressionRefs(value, out);
2076
+ for (const operand of (0,_interfaces_generic_record_interface_js__rspack_import_1/* .isFilterRange */.iA)(value) ? [
2077
+ value.from,
2078
+ value.to
2079
+ ] : [
2080
+ value
2081
+ ]){
2082
+ if (isExpression(operand)) collectExpressionRefs(operand, out);
2083
+ }
1967
2084
  }
1968
2085
  break;
1969
2086
  }
@@ -2000,37 +2117,37 @@ function isExpression(value) {
2000
2117
  return !!value && typeof value === 'object' && typeof value.type === 'string';
2001
2118
  }
2002
2119
  /** 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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.NOT_AN_EXPRESSION */.IP.NOT_AN_EXPRESSION);
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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.TOO_DEEP */.IP.TOO_DEEP);
2120
+ 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);
2121
+ 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
2122
  switch(value.type){
2006
2123
  case 'literal':
2007
2124
  return null;
2008
2125
  case 'field_ref':
2009
- 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_8/* .FLOW_SHAPE_MESSAGES.EMPTY_REFERENCE */.IP.EMPTY_REFERENCE);
2126
+ 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
2127
  case 'template':
2011
- if (typeof value.template !== 'string') return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.NO_TEMPLATE_TEXT */.IP.NO_TEMPLATE_TEXT);
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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.TEMPLATE_TOO_LONG */.IP.TEMPLATE_TOO_LONG);
2128
+ 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);
2129
+ 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
2130
  case 'arithmetic':
2014
- 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_8/* .FLOW_SHAPE_MESSAGES.NO_OPERANDS */.IP.NO_OPERANDS);
2131
+ 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
2132
  case 'concat':
2016
- 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_8/* .FLOW_SHAPE_MESSAGES.NO_PARTS */.IP.NO_PARTS);
2133
+ 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
2134
  case 'function':
2018
2135
  return functionProblem(value, depth, options);
2019
2136
  case 'lookup':
2020
2137
  return lookupProblem(value, depth, options);
2021
2138
  default:
2022
- return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.UNKNOWN_EXPRESSION_TYPE */.IP.UNKNOWN_EXPRESSION_TYPE, {
2139
+ 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
2140
  type: value.type
2024
2141
  });
2025
2142
  }
2026
2143
  }
2027
2144
  function functionProblem(value, depth, options) {
2028
- if (!Array.isArray(value.args)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.NO_ARGUMENTS */.IP.NO_ARGUMENTS);
2145
+ 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
2146
  const arity = FUNCTION_ARITY[value.name];
2030
- if (!arity) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.UNKNOWN_FUNCTION */.IP.UNKNOWN_FUNCTION, {
2147
+ 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
2148
  name: String(value.name)
2032
2149
  });
2033
- 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_8/* .FLOW_SHAPE_MESSAGES.WRONG_ARGUMENT_COUNT */.IP.WRONG_ARGUMENT_COUNT, {
2150
+ 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
2151
  name: value.name,
2035
2152
  min: arity[0],
2036
2153
  max: arity[1]
@@ -2038,7 +2155,7 @@ function functionProblem(value, depth, options) {
2038
2155
  const unitAt = DURATION_ARG[value.name];
2039
2156
  const unit = unitAt === undefined ? undefined : value.args[unitAt];
2040
2157
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.DURATION_UNIT_INVALID */.IP.DURATION_UNIT_INVALID, {
2158
+ 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
2159
  units: _rule_engine_index_js__rspack_import_2/* .RULE_DURATION_UNITS.join */.qO.join(', ')
2043
2160
  });
2044
2161
  }
@@ -2061,18 +2178,18 @@ function functionProblem(value, depth, options) {
2061
2178
  try {
2062
2179
  parsed = (0,_rule_engine_rule_permission_js__rspack_import_4/* .parsePermissionCodes */.PS)(codes.value);
2063
2180
  } catch {
2064
- return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .RULE_ENGINE_MESSAGES.TOO_MANY_PERMISSION_CODES */.x3.TOO_MANY_PERMISSION_CODES, {
2181
+ 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
2182
  max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_PERMISSION_CODES */.bw.MAX_PERMISSION_CODES
2066
2183
  });
2067
2184
  }
2068
- return parsed.length ? null : (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.PERMISSION_CODE_REQUIRED */.IP.PERMISSION_CODE_REQUIRED, {
2185
+ 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
2186
  name: value.name
2070
2187
  });
2071
2188
  }
2072
2189
  if (value.name === 'IP_IN_RANGE') {
2073
2190
  const ranges = literal(1);
2074
2191
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.IP_RANGE_INVALID */.IP.IP_RANGE_INVALID, {
2192
+ 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
2193
  range: invalid
2077
2194
  }) : null;
2078
2195
  }
@@ -2084,15 +2201,15 @@ function functionProblem(value, depth, options) {
2084
2201
  return null;
2085
2202
  }
2086
2203
  function patternProblem(pattern) {
2087
- switch((0,_rule_engine_rule_regex_js__rspack_import_5/* .rulePatternProblem */._V)(pattern)){
2204
+ switch((0,_flusys_nestjs_shared_utils__rspack_import_0.safeRegexProblem)(pattern)){
2088
2205
  case 'too_long':
2089
- return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.REGEX_TOO_LONG */.IP.REGEX_TOO_LONG, {
2206
+ 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
2207
  max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_REGEX_PATTERN_LENGTH */.bw.MAX_REGEX_PATTERN_LENGTH
2091
2208
  });
2092
2209
  case 'invalid':
2093
- return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.REGEX_INVALID */.IP.REGEX_INVALID);
2210
+ 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
2211
  case 'too_complex':
2095
- return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.REGEX_TOO_COMPLEX */.IP.REGEX_TOO_COMPLEX, {
2212
+ 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
2213
  max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_REGEX_REPEAT */.bw.MAX_REGEX_REPEAT
2097
2214
  });
2098
2215
  default:
@@ -2100,20 +2217,20 @@ function patternProblem(pattern) {
2100
2217
  }
2101
2218
  }
2102
2219
  function lookupProblem(value, depth, options) {
2103
- if (typeof value.entity !== 'string' || !_config_entity_builder_constants_js__rspack_import_9/* .ENTITY_CODE_PATTERN.test */.vs.test(value.entity)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.LOOKUP_ENTITY_INVALID */.IP.LOOKUP_ENTITY_INVALID);
2104
- if (options.knownEntityCodes && !options.knownEntityCodes.has(value.entity)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.LOOKUP_ENTITY_UNKNOWN */.IP.LOOKUP_ENTITY_UNKNOWN, {
2220
+ 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);
2221
+ 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
2222
  entity: value.entity
2106
2223
  });
2107
2224
  if (![
2108
2225
  'exists',
2109
2226
  'count',
2110
2227
  'first'
2111
- ].includes(value.mode)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.LOOKUP_MODE_INVALID */.IP.LOOKUP_MODE_INVALID);
2112
- 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_8/* .FLOW_SHAPE_MESSAGES.LOOKUP_FIELD_INVALID */.IP.LOOKUP_FIELD_INVALID);
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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.LOOKUP_FIELD_INVALID */.IP.LOOKUP_FIELD_INVALID);
2114
- 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_8/* .FLOW_SHAPE_MESSAGES.LOOKUP_FILTER_INVALID */.IP.LOOKUP_FILTER_INVALID);
2228
+ ].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);
2229
+ 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);
2230
+ 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);
2231
+ 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
2232
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.LOOKUP_FILTER_INVALID */.IP.LOOKUP_FILTER_INVALID);
2233
+ 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
2234
  const problem = filterValueProblem(item, depth, options);
2118
2235
  if (problem) return problem;
2119
2236
  }
@@ -2122,16 +2239,21 @@ function lookupProblem(value, depth, options) {
2122
2239
  /** A filter entry: an expression (eq) or `{ op, value? }` with an expression value. */ function filterValueProblem(item, depth, options) {
2123
2240
  if (!(0,_interfaces_generic_record_interface_js__rspack_import_1/* .isRecordFilterCondition */.t1)(item)) {
2124
2241
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.FILTER_OPERATOR_UNKNOWN */.IP.FILTER_OPERATOR_UNKNOWN, {
2242
+ 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
2243
  op
2127
2244
  });
2128
2245
  return expressionProblem(item, depth + 1, options);
2129
2246
  }
2130
- if (item.op === 'is_null' || item.op === 'not_null') return null;
2131
- if (item.value === undefined) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.FILTER_VALUE_REQUIRED */.IP.FILTER_VALUE_REQUIRED, {
2247
+ const kind = _interfaces_generic_record_interface_js__rspack_import_1/* .FILTER_OP_VALUE_KIND */.w9[item.op];
2248
+ if (kind === 'none') return null;
2249
+ 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, {
2250
+ op: item.op
2251
+ });
2252
+ if (kind !== 'range') return expressionProblem(item.value, depth + 1, options);
2253
+ 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
2254
  op: item.op
2133
2255
  });
2134
- return expressionProblem(item.value, depth + 1, options);
2256
+ return expressionProblem(item.value.from, depth + 1, options) ?? expressionProblem(item.value.to, depth + 1, options);
2135
2257
  }
2136
2258
  function firstProblem(items, depth, options) {
2137
2259
  for (const item of items){
@@ -2142,8 +2264,8 @@ function firstProblem(items, depth, options) {
2142
2264
  }
2143
2265
  function conditionProblem(node, options) {
2144
2266
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.CONDITION_INCOMPLETE */.IP.CONDITION_INCOMPLETE);
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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.UNKNOWN_COMPARISON */.IP.UNKNOWN_COMPARISON, {
2267
+ 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);
2268
+ 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
2269
  comparison: node.comparison
2148
2270
  });
2149
2271
  if (hasLeft) {
@@ -2159,15 +2281,15 @@ function conditionProblem(node, options) {
2159
2281
  return null;
2160
2282
  }
2161
2283
  /** 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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.NOT_A_RULE */.IP.NOT_A_RULE);
2284
+ 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
2285
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.TOO_DEEP */.IP.TOO_DEEP);
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)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.TOO_MANY_CONDITIONS */.IP.TOO_MANY_CONDITIONS);
2286
+ 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);
2287
+ 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
2288
  if (![
2167
2289
  'AND',
2168
2290
  'OR',
2169
2291
  'NOT'
2170
- ].includes(g.operator)) return (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SHAPE_MESSAGES.UNKNOWN_OPERATOR */.IP.UNKNOWN_OPERATOR);
2292
+ ].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
2293
  for (const node of g.conditions){
2172
2294
  const problem = node && (0,_rule_engine_index_js__rspack_import_2/* .isRuleGroup */.GD)(node) ? groupProblem(node, depth + 1, options) : conditionProblem(node, options);
2173
2295
  if (problem) return problem;
@@ -2183,33 +2305,43 @@ function conditionProblem(node, options) {
2183
2305
  const errors = [];
2184
2306
  const warnings = [];
2185
2307
  const err = (message)=>errors.push(message);
2186
- if (!_flow_types_js__rspack_import_6/* .FLOW_SLUG_PATTERN.test */.YD.test(flow.slug ?? '')) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.SLUG_INVALID */.qj.SLUG_INVALID));
2187
- const nodes = Array.isArray(flow.nodes) ? flow.nodes : [];
2188
- const edges = Array.isArray(flow.edges) ? flow.edges : [];
2189
- if (!nodes.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NO_NODES */.qj.NO_NODES));
2190
- if (nodes.length > _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TOO_MANY_NODES */.qj.TOO_MANY_NODES, {
2191
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES
2308
+ 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));
2309
+ const allNodes = Array.isArray(flow.nodes) ? flow.nodes : [];
2310
+ const allEdges = Array.isArray(flow.edges) ? flow.edges : [];
2311
+ if (!allNodes.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));
2312
+ if (allNodes.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, {
2313
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES
2192
2314
  }));
2193
- if (edges.length > _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TOO_MANY_EDGES */.qj.TOO_MANY_EDGES, {
2194
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES
2315
+ if (allEdges.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, {
2316
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES
2195
2317
  }));
2196
- if (errors.length && (!nodes.length || nodes.length > _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES || edges.length > _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES)) return {
2318
+ if (errors.length && (!allNodes.length || allNodes.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_NODES */.Or.MAX_NODES || allEdges.length > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_EDGES */.Or.MAX_EDGES)) return {
2197
2319
  errors,
2198
2320
  warnings
2199
2321
  };
2322
+ const isEntry = (item)=>!!item && typeof item === 'object';
2323
+ const nodes = allNodes.filter(isEntry);
2324
+ const edges = allEdges.filter(isEntry);
2325
+ if (nodes.length < allNodes.length) 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, {
2326
+ id: undefined
2327
+ }));
2328
+ if (edges.length < allEdges.length) 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, {
2329
+ from: undefined,
2330
+ to: undefined
2331
+ }));
2200
2332
  const byId = new Map();
2201
2333
  for (const node of nodes){
2202
- if (!_flow_types_js__rspack_import_6/* .FLOW_NODE_ID_PATTERN.test */.z6.test(node?.id ?? '')) {
2203
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_ID_INVALID */.qj.NODE_ID_INVALID, {
2334
+ if (!_flow_types_js__rspack_import_5/* .FLOW_NODE_ID_PATTERN.test */.z6.test(node?.id ?? '')) {
2335
+ 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
2336
  id: node?.id
2205
2337
  }));
2206
2338
  continue;
2207
2339
  }
2208
- if (byId.has(node.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_ID_DUPLICATE */.qj.NODE_ID_DUPLICATE, {
2340
+ 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
2341
  id: node.id
2210
2342
  }));
2211
2343
  byId.set(node.id, node);
2212
- if (!_flow_types_js__rspack_import_6/* .FLOW_NODE_TYPES.includes */.q2.includes(node.type)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_TYPE_UNKNOWN */.qj.NODE_TYPE_UNKNOWN, {
2344
+ 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
2345
  id: node.id,
2214
2346
  type: node.type
2215
2347
  }));
@@ -2222,24 +2354,24 @@ function conditionProblem(node, options) {
2222
2354
  const outgoing = new Map();
2223
2355
  const edgeIds = new Set();
2224
2356
  for (const edge of edges){
2225
- if (edgeIds.has(edge.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.EDGE_ID_DUPLICATE */.qj.EDGE_ID_DUPLICATE, {
2357
+ 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
2358
  id: edge.id
2227
2359
  }));
2228
2360
  edgeIds.add(edge.id);
2229
2361
  const from = byId.get(edge.from);
2230
2362
  const to = byId.get(edge.to);
2231
2363
  if (!from || !to) {
2232
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.EDGE_DANGLING */.qj.EDGE_DANGLING, {
2364
+ 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
2365
  from: edge.from,
2234
2366
  to: edge.to
2235
2367
  }));
2236
2368
  continue;
2237
2369
  }
2238
- if (edge.from === edge.to) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.EDGE_SELF */.qj.EDGE_SELF, {
2370
+ 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
2371
  id: edge.from
2240
2372
  }));
2241
- if (to.type === 'trigger') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.EDGE_INTO_TRIGGER */.qj.EDGE_INTO_TRIGGER));
2242
- if (!(0,_flow_types_js__rspack_import_6/* .portsOf */.a5)(from).includes(edge.port)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.EDGE_NO_PORT */.qj.EDGE_NO_PORT, {
2373
+ 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));
2374
+ 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
2375
  id: from.id,
2244
2376
  port: edge.port
2245
2377
  }));
@@ -2255,29 +2387,29 @@ function conditionProblem(node, options) {
2255
2387
  const seenPairs = new Set();
2256
2388
  for (const edge of edges){
2257
2389
  const key = `${edge.from}|${edge.port}|${edge.to}`;
2258
- if (seenPairs.has(key)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.EDGE_TWICE */.qj.EDGE_TWICE, {
2390
+ 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
2391
  from: edge.from,
2260
2392
  to: edge.to
2261
2393
  }));
2262
2394
  seenPairs.add(key);
2263
2395
  }
2264
2396
  const cyclic = hasCycle(nodes, outgoing);
2265
- if (cyclic) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.CYCLE */.qj.CYCLE));
2397
+ 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
2398
  const reachable = triggers.length ? new Set(triggers.flatMap((trigger)=>[
2267
2399
  ...reach(trigger.id, outgoing)
2268
2400
  ])) : null;
2269
2401
  for (const node of nodes){
2270
- if (reachable && !reachable.has(node.id)) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_UNREACHABLE */.qj.NODE_UNREACHABLE, {
2271
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node)
2402
+ 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, {
2403
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
2272
2404
  }));
2273
2405
  }
2274
2406
  checkNodeReferences(nodes, byId, flow, err, warnings);
2275
2407
  if (!cyclic && reachable) checkReferenceTiming(nodes, edges, byId, reachable, warnings);
2276
2408
  if (!cyclic) checkLoopDepth(nodes, outgoing, err);
2277
2409
  // Transaction and access are a Request step's own: each is checked against the steps its runs reach.
2278
- const runs = (0,_flow_types_js__rspack_import_6/* .flowEndpoints */.Xr)(flow).map((endpoint)=>({
2410
+ const runs = (0,_flow_types_js__rspack_import_5/* .flowEndpoints */.Xr)(flow).map((endpoint)=>({
2279
2411
  endpoint,
2280
- label: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(byId.get(endpoint.nodeId) ?? {
2412
+ label: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(byId.get(endpoint.nodeId) ?? {
2281
2413
  id: endpoint.nodeId,
2282
2414
  name: ''
2283
2415
  }),
@@ -2294,7 +2426,7 @@ function conditionProblem(node, options) {
2294
2426
  }
2295
2427
  /** The entities a step reads or writes: its own, its child inserts' and those its lookups read. */ function entitiesOf(node) {
2296
2428
  const codes = collectLookupEntities(node.config);
2297
- if (node.type.startsWith('entity_') && typeof node.config?.['entityCode'] === 'string') codes.add(node.config['entityCode']);
2429
+ if (String(node.type).startsWith('entity_') && typeof node.config?.['entityCode'] === 'string') codes.add(node.config['entityCode']);
2298
2430
  const children = node.type === 'entity_insert' && Array.isArray(node.config?.['children']) ? node.config['children'] : [];
2299
2431
  for (const child of children)if (typeof child?.entityCode === 'string') codes.add(child.entityCode);
2300
2432
  return [
@@ -2315,24 +2447,35 @@ function conditionProblem(node, options) {
2315
2447
  };
2316
2448
  for (const { endpoint, label, steps } of runs){
2317
2449
  if (endpoint.isTransactional) {
2318
- 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_8/* .FLOW_VALIDATION_MESSAGES.TRANSACTIONAL_HTTP */.qj.TRANSACTIONAL_HTTP, {
2450
+ 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
2451
  node: label
2320
2452
  }));
2321
2453
  // 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,_flow_types_js__rspack_import_6/* .isMessageNode */.SE)(n.type) && n.onError === 'continue') warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.MESSAGE_AFTER_COMMIT */.qj.MESSAGE_AFTER_COMMIT, {
2323
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(n)
2454
+ 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, {
2455
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(n)
2456
+ }));
2457
+ }
2458
+ 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));
2459
+ for (const n of steps){
2460
+ if (n.config?.['fromRequest'] !== true) continue;
2461
+ if (n.type === 'entity_query' && endpoint.contract !== 'get_all' && endpoint.contract !== 'get_by_ids') warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_QUERY_NOT_GET_ALL */.qj.NODE_QUERY_NOT_GET_ALL, {
2462
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(n),
2463
+ endpoint: label
2464
+ }));
2465
+ if (n.type === 'entity_get' && endpoint.contract !== 'get_by_id') warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_GET_NOT_GET_BY_ID */.qj.NODE_GET_NOT_GET_BY_ID, {
2466
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(n),
2467
+ endpoint: label
2324
2468
  }));
2325
2469
  }
2326
- if (endpoint.authMode === 'public' && steps.some((n)=>(0,_flow_types_js__rspack_import_6/* .isMessageNode */.SE)(n.type))) warnOnce((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.PUBLIC_MESSAGE */.qj.PUBLIC_MESSAGE));
2327
2470
  // 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 (!_flow_types_js__rspack_import_6/* .KEYLESS_AUTH_MODES.has */.d7.has(endpoint.authMode)) continue;
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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.PERMISSION_WITHOUT_USER */.qj.PERMISSION_WITHOUT_USER));
2471
+ if (!_flow_types_js__rspack_import_5/* .KEYLESS_AUTH_MODES.has */.d7.has(endpoint.authMode)) continue;
2472
+ 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
2473
  const entities = steps.flatMap(entitiesOf);
2331
2474
  if (!entities.length) continue;
2332
2475
  keyless.endpoints.push(endpoint.path ? `/${endpoint.path}` : '/');
2333
2476
  for (const code of entities)keyless.entities.add(code);
2334
2477
  }
2335
- if (keyless.endpoints.length) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.KEYLESS_ENTITY */.qj.KEYLESS_ENTITY, {
2478
+ 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
2479
  endpoints: keyless.endpoints.join(', '),
2337
2480
  entities: [
2338
2481
  ...keyless.entities
@@ -2340,16 +2483,16 @@ function conditionProblem(node, options) {
2340
2483
  }));
2341
2484
  }
2342
2485
  /** 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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_MISSING */.qj.TRIGGER_MISSING));
2344
- const main = triggers.filter((trigger)=>!(0,_flow_types_js__rspack_import_6/* .triggerPath */.um)(trigger));
2345
- if (main.length > 1) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_MAIN_DUPLICATE */.qj.TRIGGER_MAIN_DUPLICATE, {
2486
+ 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));
2487
+ const main = triggers.filter((trigger)=>!(0,_flow_types_js__rspack_import_5/* .triggerPath */.um)(trigger));
2488
+ 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
2489
  count: main.length
2347
2490
  }));
2348
2491
  const paths = new Set();
2349
2492
  for (const trigger of triggers){
2350
- const path = (0,_flow_types_js__rspack_import_6/* .triggerPath */.um)(trigger);
2493
+ const path = (0,_flow_types_js__rspack_import_5/* .triggerPath */.um)(trigger);
2351
2494
  if (!path) continue;
2352
- if (paths.has(path)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_PATH_DUPLICATE */.qj.TRIGGER_PATH_DUPLICATE, {
2495
+ 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
2496
  path
2354
2497
  }));
2355
2498
  paths.add(path);
@@ -2362,41 +2505,41 @@ function conditionProblem(node, options) {
2362
2505
  */ function checkCalledFlow(node, flow, known, err, warn) {
2363
2506
  const { flowSlug: slug, endpoint, input, inputList } = node.config;
2364
2507
  const at = {
2365
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node)
2508
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
2366
2509
  };
2367
2510
  const target = known.get(slug);
2368
2511
  const vars = {
2369
2512
  ...at,
2370
2513
  flow: slug
2371
2514
  };
2372
- if (!target.isActive) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INACTIVE */.qj.NODE_FLOW_INACTIVE, vars));
2515
+ 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
2516
  const path = typeof endpoint === 'string' && endpoint ? endpoint : null;
2374
2517
  const entry = target.endpoints.find((e)=>e.path === path);
2375
2518
  // 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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_API_KEY */.qj.NODE_FLOW_API_KEY, vars));
2519
+ 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
2520
  if (!entry) {
2378
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(path ? _config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_ENDPOINT_UNKNOWN */.qj.NODE_FLOW_ENDPOINT_UNKNOWN : _config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_ENDPOINT_REQUIRED */.qj.NODE_FLOW_ENDPOINT_REQUIRED, {
2521
+ 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
2522
  ...vars,
2380
2523
  endpoint: path ?? ''
2381
2524
  }));
2382
2525
  } else if (entry.bodyType === 'list') {
2383
- if (inputList === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_LIST_REQUIRED */.qj.NODE_FLOW_INPUT_LIST_REQUIRED, vars));
2526
+ 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
2527
  } else if (inputList !== undefined) {
2385
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_LIST_UNEXPECTED */.qj.NODE_FLOW_INPUT_LIST_UNEXPECTED, vars));
2528
+ 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
2529
  } else {
2387
2530
  checkCalledInputs(input, entry.inputSchema, vars, err, warn);
2388
2531
  }
2389
2532
  const loop = callPathTo(slug, flow.slug, known, new Set());
2390
- if (loop) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_LOOP */.qj.NODE_FLOW_LOOP, {
2533
+ 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
2534
  ...at,
2392
2535
  chain: [
2393
2536
  flow.slug,
2394
2537
  ...loop
2395
2538
  ].join(' > ')
2396
2539
  }));
2397
- if (1 + callDepth(slug, known, new Set()) > _flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_TOO_DEEP */.qj.NODE_FLOW_TOO_DEEP, {
2540
+ 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
2541
  ...at,
2399
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_CALL_DEPTH */.Or.MAX_CALL_DEPTH
2542
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CALL_DEPTH */.Or.MAX_CALL_DEPTH
2400
2543
  }));
2401
2544
  }
2402
2545
  /**
@@ -2410,17 +2553,17 @@ function conditionProblem(node, options) {
2410
2553
  if (node?.type !== 'call_flow' || typeof c.flowSlug !== 'string') continue;
2411
2554
  if (c.flowSlug !== slug && !callPathTo(c.flowSlug, slug, known, new Set())) continue;
2412
2555
  const at = {
2413
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node)
2556
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
2414
2557
  };
2415
2558
  const target = known.get(c.flowSlug);
2416
2559
  if (!target) {
2417
- problems.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_UNKNOWN */.qj.NODE_FLOW_UNKNOWN, {
2560
+ 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
2561
  ...at,
2419
2562
  flow: c.flowSlug
2420
2563
  }));
2421
2564
  continue;
2422
2565
  }
2423
- if (!target.isActive) problems.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INACTIVE */.qj.NODE_FLOW_INACTIVE, {
2566
+ 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
2567
  ...at,
2425
2568
  flow: c.flowSlug
2426
2569
  }));
@@ -2432,14 +2575,14 @@ function conditionProblem(node, options) {
2432
2575
  const given = input && typeof input === 'object' && !Array.isArray(input) ? Object.keys(input) : [];
2433
2576
  if (schema.length) {
2434
2577
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_UNDECLARED */.qj.NODE_FLOW_INPUT_UNDECLARED, {
2578
+ 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
2579
  ...vars,
2437
2580
  input: name
2438
2581
  }));
2439
2582
  }
2440
2583
  for (const field of schema){
2441
2584
  if (field.required && (field.default === undefined || field.default === null) && !given.includes(field.name)) {
2442
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_INPUT_MISSING */.qj.NODE_FLOW_INPUT_MISSING, {
2585
+ 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
2586
  ...vars,
2444
2587
  input: field.name
2445
2588
  }));
@@ -2462,7 +2605,7 @@ function conditionProblem(node, options) {
2462
2605
  return null;
2463
2606
  }
2464
2607
  /** 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 > _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_CALL_DEPTH */.Or.MAX_CALL_DEPTH) return 0;
2608
+ if (running.has(slug) || running.size > _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CALL_DEPTH */.Or.MAX_CALL_DEPTH) return 0;
2466
2609
  running.add(slug);
2467
2610
  let deepest = 0;
2468
2611
  for (const next of new Set(known.get(slug)?.calls ?? []))deepest = Math.max(deepest, 1 + callDepth(next, known, running));
@@ -2470,37 +2613,37 @@ function conditionProblem(node, options) {
2470
2613
  return deepest;
2471
2614
  }
2472
2615
  /** 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 > _flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.INPUT_TOO_MANY */.qj.INPUT_TOO_MANY, {
2474
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_INPUT_FIELDS */.Or.MAX_INPUT_FIELDS
2616
+ 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, {
2617
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_INPUT_FIELDS */.Or.MAX_INPUT_FIELDS
2475
2618
  }));
2476
2619
  const seen = new Set();
2477
2620
  for (const field of fields){
2478
2621
  const name = `${prefix}${field?.name ?? ''}`;
2479
- if (!_flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.INPUT_NAME_INVALID */.qj.INPUT_NAME_INVALID, {
2622
+ 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
2623
  name
2481
2624
  }));
2482
- else if (seen.has(field.name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.INPUT_NAME_DUPLICATE */.qj.INPUT_NAME_DUPLICATE, {
2625
+ 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
2626
  name
2484
2627
  }));
2485
2628
  seen.add(field?.name);
2486
- if (!_flow_types_js__rspack_import_6/* .FLOW_INPUT_TYPES.includes */.Q7.includes(field?.type)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.INPUT_TYPE_UNKNOWN */.qj.INPUT_TYPE_UNKNOWN, {
2629
+ 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
2630
  name,
2488
2631
  type: field?.type
2489
2632
  }));
2490
2633
  const itemType = field?.type === 'array' ? field.itemType : undefined;
2491
- if (itemType !== undefined && (itemType === 'array' || !_flow_types_js__rspack_import_6/* .FLOW_INPUT_TYPES.includes */.Q7.includes(itemType))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.INPUT_ITEM_TYPE_UNKNOWN */.qj.INPUT_ITEM_TYPE_UNKNOWN, {
2634
+ 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
2635
  name,
2493
2636
  type: itemType
2494
2637
  }));
2495
- 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_8/* .FLOW_VALIDATION_MESSAGES.INPUT_CHOICE_NO_OPTIONS */.qj.INPUT_CHOICE_NO_OPTIONS, {
2638
+ 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
2639
  name
2497
2640
  }));
2498
2641
  const holdsFields = field?.type === 'object' || itemType === 'object';
2499
2642
  if (!holdsFields || !Array.isArray(field.fields) || !field.fields.length) continue;
2500
- if (depth >= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_INPUT_DEPTH */.Or.MAX_INPUT_DEPTH) {
2501
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.INPUT_TOO_DEEP */.qj.INPUT_TOO_DEEP, {
2643
+ if (depth >= _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_INPUT_DEPTH */.Or.MAX_INPUT_DEPTH) {
2644
+ 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
2645
  name,
2503
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_INPUT_DEPTH */.Or.MAX_INPUT_DEPTH
2646
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_INPUT_DEPTH */.Or.MAX_INPUT_DEPTH
2504
2647
  }));
2505
2648
  continue;
2506
2649
  }
@@ -2509,7 +2652,7 @@ function conditionProblem(node, options) {
2509
2652
  }
2510
2653
  function validateNodeConfig(node, flow, context, err, warn) {
2511
2654
  const at = {
2512
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node)
2655
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
2513
2656
  };
2514
2657
  const c = node.config ?? {};
2515
2658
  const shape = {
@@ -2517,7 +2660,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
2517
2660
  };
2518
2661
  const expr = (value, what)=>{
2519
2662
  const problem = expressionProblem(value, 0, shape);
2520
- if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_EXPRESSION_PROBLEM */.qj.NODE_EXPRESSION_PROBLEM, {
2663
+ 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
2664
  ...at,
2522
2665
  what,
2523
2666
  problem
@@ -2525,7 +2668,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
2525
2668
  };
2526
2669
  const exprMap = (value, kind)=>{
2527
2670
  if (value === undefined) return;
2528
- 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_8/* .FLOW_VALIDATION_MESSAGES.NODE_PAIRS_INVALID */.qj.NODE_PAIRS_INVALID, {
2671
+ 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
2672
  ...at,
2530
2673
  what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(kind.list)
2531
2674
  }));
@@ -2535,13 +2678,13 @@ function validateNodeConfig(node, flow, context, err, warn) {
2535
2678
  };
2536
2679
  const filterMap = (value, kind)=>{
2537
2680
  if (value === undefined) return;
2538
- 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_8/* .FLOW_VALIDATION_MESSAGES.NODE_PAIRS_INVALID */.qj.NODE_PAIRS_INVALID, {
2681
+ 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
2682
  ...at,
2540
2683
  what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(kind.list)
2541
2684
  }));
2542
2685
  for (const [key, item] of Object.entries(value)){
2543
2686
  const problem = filterValueProblem(item, -1, shape);
2544
- if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_EXPRESSION_PROBLEM */.qj.NODE_EXPRESSION_PROBLEM, {
2687
+ 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
2688
  ...at,
2546
2689
  what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(kind.item, {
2547
2690
  name: key
@@ -2552,59 +2695,63 @@ function validateNodeConfig(node, flow, context, err, warn) {
2552
2695
  };
2553
2696
  const rule = (value, what)=>{
2554
2697
  const problem = groupProblem(value, 0, shape);
2555
- if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_RULE_PROBLEM */.qj.NODE_RULE_PROBLEM, {
2698
+ 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
2699
  ...at,
2557
2700
  what,
2558
2701
  problem
2559
2702
  }));
2560
2703
  };
2561
2704
  const entity = (value)=>{
2562
- if (typeof value !== 'string' || !_config_entity_builder_constants_js__rspack_import_9/* .ENTITY_CODE_PATTERN.test */.vs.test(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHOOSE_ENTITY */.qj.NODE_CHOOSE_ENTITY, at));
2563
- if (context.knownEntityCodes && !context.knownEntityCodes.has(value)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_ENTITY_UNKNOWN */.qj.NODE_ENTITY_UNKNOWN, {
2705
+ 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));
2706
+ 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
2707
  ...at,
2565
2708
  entity: value
2566
2709
  }));
2567
2710
  };
2568
2711
  const KIND = {
2569
2712
  variable: {
2570
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.VARIABLES */.bc.VARIABLES,
2571
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.VARIABLE */.bc.VARIABLE
2713
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.VARIABLES */.bc.VARIABLES,
2714
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.VARIABLE */.bc.VARIABLE
2572
2715
  },
2573
2716
  field: {
2574
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.FIELDS */.bc.FIELDS,
2575
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.FIELD */.bc.FIELD
2717
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FIELDS */.bc.FIELDS,
2718
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FIELD */.bc.FIELD
2576
2719
  },
2577
2720
  filter: {
2578
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.FILTERS */.bc.FILTERS,
2579
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.FILTER */.bc.FILTER
2721
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FILTERS */.bc.FILTERS,
2722
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FILTER */.bc.FILTER
2580
2723
  },
2581
2724
  input: {
2582
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.INPUTS */.bc.INPUTS,
2583
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.INPUT */.bc.INPUT
2725
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.INPUTS */.bc.INPUTS,
2726
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.INPUT */.bc.INPUT
2584
2727
  },
2585
2728
  header: {
2586
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.HEADERS */.bc.HEADERS,
2587
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.HEADER */.bc.HEADER
2729
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.HEADERS */.bc.HEADERS,
2730
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.HEADER */.bc.HEADER
2588
2731
  },
2589
2732
  body: {
2590
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.BODY_VALUES */.bc.BODY_VALUES,
2591
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.BODY_VALUE */.bc.BODY_VALUE
2733
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.BODY_VALUES */.bc.BODY_VALUES,
2734
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.BODY_VALUE */.bc.BODY_VALUE
2592
2735
  },
2593
2736
  payload: {
2594
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.PAYLOAD_VALUES */.bc.PAYLOAD_VALUES,
2595
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.PAYLOAD_VALUE */.bc.PAYLOAD_VALUE
2737
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.PAYLOAD_VALUES */.bc.PAYLOAD_VALUES,
2738
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.PAYLOAD_VALUE */.bc.PAYLOAD_VALUE
2596
2739
  },
2597
2740
  response: {
2598
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.RESPONSE_VALUES */.bc.RESPONSE_VALUES,
2599
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.RESPONSE_VALUE */.bc.RESPONSE_VALUE
2741
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.RESPONSE_VALUES */.bc.RESPONSE_VALUES,
2742
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.RESPONSE_VALUE */.bc.RESPONSE_VALUE
2600
2743
  },
2601
2744
  data: {
2602
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.DATA_VALUES */.bc.DATA_VALUES,
2603
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.DATA_VALUE */.bc.DATA_VALUE
2745
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.DATA_VALUES */.bc.DATA_VALUES,
2746
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.DATA_VALUE */.bc.DATA_VALUE
2604
2747
  },
2605
2748
  template: {
2606
- list: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.TEMPLATE_VALUES */.bc.TEMPLATE_VALUES,
2607
- item: _config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.TEMPLATE_VALUE */.bc.TEMPLATE_VALUE
2749
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.TEMPLATE_VALUES */.bc.TEMPLATE_VALUES,
2750
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.TEMPLATE_VALUE */.bc.TEMPLATE_VALUE
2751
+ },
2752
+ messageVariable: {
2753
+ list: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.MESSAGE_VARIABLES */.bc.MESSAGE_VARIABLES,
2754
+ item: _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.MESSAGE_VARIABLE */.bc.MESSAGE_VARIABLE
2608
2755
  }
2609
2756
  };
2610
2757
  const optionalExpr = (value, what)=>{
@@ -2612,8 +2759,8 @@ function validateNodeConfig(node, flow, context, err, warn) {
2612
2759
  };
2613
2760
  /** An AND / OR rule of permission codes: one that names none needs a permission, a malformed one is `invalid`. */ const permissionRule = (value, invalid)=>{
2614
2761
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_REQUIRED */.qj.NODE_PERMISSION_REQUIRED, at));
2616
- else if (problem === 'too_many') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .RULE_ENGINE_MESSAGES.TOO_MANY_PERMISSION_CODES */.x3.TOO_MANY_PERMISSION_CODES, {
2762
+ 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));
2763
+ 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
2764
  max: _rule_engine_index_js__rspack_import_2/* .RULE_ENGINE_LIMITS.MAX_PERMISSION_CODES */.bw.MAX_PERMISSION_CODES
2618
2765
  }));
2619
2766
  else if (problem) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(invalid, at));
@@ -2624,100 +2771,121 @@ function validateNodeConfig(node, flow, context, err, warn) {
2624
2771
  switch(node.type){
2625
2772
  case 'trigger':
2626
2773
  {
2627
- if (c.path !== undefined && c.path !== '' && (typeof c.path !== 'string' || !_flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_PATH_INVALID */.qj.TRIGGER_PATH_INVALID, at));
2628
- if (c.authMode !== undefined && !_flow_types_js__rspack_import_6/* .FLOW_AUTH_MODES.includes */.fO.includes(c.authMode)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_AUTH_INVALID */.qj.TRIGGER_AUTH_INVALID, at));
2629
- if (c.permissions !== undefined) permissionRule(c.permissions, _config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_AUTH_INVALID */.qj.TRIGGER_AUTH_INVALID);
2630
- if (c.isTransactional !== undefined && typeof c.isTransactional !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_TRANSACTION_INVALID */.qj.TRIGGER_TRANSACTION_INVALID, at));
2631
- if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MIN_TIMEOUT_MS */.Or.MIN_TIMEOUT_MS && c.timeoutMs <= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_TIMEOUT_MS */.Or.MAX_TIMEOUT_MS)) {
2632
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_TIMEOUT_RANGE */.qj.TRIGGER_TIMEOUT_RANGE, {
2774
+ 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));
2775
+ 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));
2776
+ if (c.permissions !== undefined) permissionRule(c.permissions, _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_AUTH_INVALID */.qj.TRIGGER_AUTH_INVALID);
2777
+ 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));
2778
+ 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)) {
2779
+ 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
2780
  ...at,
2634
- min: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MIN_TIMEOUT_MS */.Or.MIN_TIMEOUT_MS / 1000,
2635
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_TIMEOUT_MS */.Or.MAX_TIMEOUT_MS / 1000
2781
+ min: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MIN_TIMEOUT_MS */.Or.MIN_TIMEOUT_MS / 1000,
2782
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_TIMEOUT_MS */.Or.MAX_TIMEOUT_MS / 1000
2636
2783
  }));
2637
2784
  }
2638
- if (c.rateLimitPerMinute !== undefined && !(Number.isInteger(c.rateLimitPerMinute) && c.rateLimitPerMinute >= 0 && c.rateLimitPerMinute <= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_RATE_LIMIT_PER_MINUTE */.Or.MAX_RATE_LIMIT_PER_MINUTE)) {
2639
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_RATE_LIMIT_RANGE */.qj.TRIGGER_RATE_LIMIT_RANGE, {
2785
+ 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)) {
2786
+ 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
2787
  ...at,
2641
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_RATE_LIMIT_PER_MINUTE */.Or.MAX_RATE_LIMIT_PER_MINUTE
2788
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_RATE_LIMIT_PER_MINUTE */.Or.MAX_RATE_LIMIT_PER_MINUTE
2642
2789
  }));
2643
2790
  }
2644
2791
  // 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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_API_KEY_REQUIRED */.qj.TRIGGER_API_KEY_REQUIRED, at));
2646
- else if (c.apiKey !== undefined && !(0,_flow_api_key_js__rspack_import_7/* .looksLikeApiKey */.Jb)(c.apiKey) && !(0,_flow_types_js__rspack_import_6/* .isStoredApiKey */.xA)(c.apiKey)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_API_KEY_INVALID */.qj.TRIGGER_API_KEY_INVALID, at));
2792
+ 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));
2793
+ 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
2794
  // Field errors are named after the URL (`<path>: <field>`) once a flow has several.
2648
- const path = (0,_flow_types_js__rspack_import_6/* .triggerPath */.um)(node);
2649
- if (c.bodyType !== undefined && !_flow_types_js__rspack_import_6/* .FLOW_BODY_TYPES.includes */.Y3.includes(c.bodyType)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.BODY_TYPE_UNKNOWN */.qj.BODY_TYPE_UNKNOWN, {
2795
+ const path = (0,_flow_types_js__rspack_import_5/* .triggerPath */.um)(node);
2796
+ const prefix = path ? `${path}: ` : '';
2797
+ 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
2798
  type: String(c.bodyType)
2651
2799
  }));
2652
- validateInputFields(Array.isArray(c.inputSchema) ? c.inputSchema : [], path ? `${path}: ` : '', 1, err);
2800
+ const declared = Array.isArray(c.inputSchema) ? c.inputSchema : [];
2801
+ if (c.contract !== undefined && !_flow_types_js__rspack_import_5/* .FLOW_REQUEST_CONTRACTS.includes */.j_.includes(c.contract)) {
2802
+ err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.TRIGGER_CONTRACT_INVALID */.qj.TRIGGER_CONTRACT_INVALID, {
2803
+ ...at,
2804
+ contract: String(c.contract)
2805
+ }));
2806
+ } else {
2807
+ // A declared field may not take the name of one the request type already brings.
2808
+ const reserved = new Set((0,_flow_types_js__rspack_import_5/* .contractFields */._h)(c.contract ?? 'custom').map((f)=>f.name));
2809
+ for (const field of declared)if (reserved.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_RESERVED */.qj.INPUT_NAME_RESERVED, {
2810
+ name: `${prefix}${field.name}`
2811
+ }));
2812
+ }
2813
+ validateInputFields(declared, prefix, 1, err);
2653
2814
  break;
2654
2815
  }
2655
2816
  case 'validate':
2656
2817
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_MODE_INVALID */.qj.NODE_MODE_INVALID, at));
2818
+ 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
2819
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_4XX */.qj.NODE_STATUS_4XX, at));
2820
+ 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
2821
  }
2661
2822
  break;
2662
2823
  case 'permission_check':
2663
2824
  {
2664
- if (c.permissions === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_REQUIRED */.qj.NODE_PERMISSION_REQUIRED, at));
2665
- else permissionRule(c.permissions, _config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID);
2666
- 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_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
2667
- if (c.message !== undefined && typeof c.message !== 'string') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
2825
+ 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));
2826
+ else permissionRule(c.permissions, _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID);
2827
+ 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));
2828
+ if (c.subject === 'user') {
2829
+ 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));
2830
+ 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));
2831
+ }
2832
+ 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));
2833
+ 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));
2834
+ 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));
2835
+ 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
2836
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_4XX */.qj.NODE_STATUS_4XX, at));
2837
+ 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
2838
  }
2671
2839
  break;
2672
2840
  }
2673
2841
  case 'company_branch_check':
2674
2842
  {
2675
- if (c.subject !== undefined && !_flow_types_js__rspack_import_6/* .FLOW_ACCESS_SUBJECTS.includes */.iM.includes(c.subject)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
2676
- if (c.branchMatch !== undefined && !_flow_types_js__rspack_import_6/* .FLOW_BRANCH_MATCHES.includes */.Et.includes(c.branchMatch)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
2843
+ 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));
2844
+ 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
2845
  if (c.subject === 'user') {
2678
- if (c.userId === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_ACCESS_USER_REQUIRED */.qj.NODE_ACCESS_USER_REQUIRED, at));
2679
- else expr(c.userId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_USER */.bc.THE_USER));
2846
+ 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));
2847
+ 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
2848
  }
2681
2849
  // Another user has no current company.
2682
- if (c.branchCompany !== undefined && (!_flow_types_js__rspack_import_6/* .FLOW_BRANCH_COMPANIES.includes */.sk.includes(c.branchCompany) || c.branchCompany === 'current' && c.subject === 'user')) {
2683
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
2850
+ if (c.branchCompany !== undefined && (!_flow_types_js__rspack_import_5/* .FLOW_BRANCH_COMPANIES.includes */.sk.includes(c.branchCompany) || c.branchCompany === 'current' && c.subject === 'user')) {
2851
+ 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
2852
  }
2685
- if (c.companyIds !== undefined) expr(c.companyIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_VALUE */.bc.THE_VALUE));
2686
- if (c.branchIds !== undefined) expr(c.branchIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_VALUE */.bc.THE_VALUE));
2687
- 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_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
2853
+ 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));
2854
+ 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));
2855
+ 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
2856
  // 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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_ACCESS_TARGET_REQUIRED */.qj.NODE_ACCESS_TARGET_REQUIRED, at));
2690
- if (c.message !== undefined && typeof c.message !== 'string') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PERMISSION_OPTION_INVALID */.qj.NODE_PERMISSION_OPTION_INVALID, at));
2857
+ 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));
2858
+ 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
2859
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_4XX */.qj.NODE_STATUS_4XX, at));
2860
+ 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
2861
  }
2694
2862
  break;
2695
2863
  }
2696
2864
  case 'set':
2697
2865
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_SETS_NOTHING */.qj.NODE_SETS_NOTHING, at));
2866
+ 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
2867
  for (const key of Object.keys(c.values ?? {})){
2700
- if (!_flow_types_js__rspack_import_6/* .FLOW_INPUT_NAME_PATTERN.test */.fZ.test(key)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_VARIABLE_INVALID */.qj.NODE_VARIABLE_INVALID, {
2868
+ 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
2869
  ...at,
2702
2870
  name: key
2703
2871
  }));
2704
2872
  }
2705
2873
  break;
2706
2874
  case 'condition':
2707
- rule(c.rule, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_RULE */.bc.THE_RULE));
2875
+ 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
2876
  break;
2709
2877
  case 'switch':
2710
2878
  {
2711
- expr(c.value, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_VALUE */.bc.THE_VALUE));
2879
+ 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
2880
  const cases = Array.isArray(c.cases) ? c.cases : [];
2713
- if (!cases.length) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CASE_REQUIRED */.qj.NODE_CASE_REQUIRED, at));
2881
+ 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
2882
  const ids = new Set();
2715
2883
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CASE_INVALID */.qj.NODE_CASE_INVALID, {
2884
+ 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
2885
  ...at,
2718
2886
  name: String(item.id)
2719
2887
  }));
2720
- else if (ids.has(item.id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CASE_DUPLICATE */.qj.NODE_CASE_DUPLICATE, {
2888
+ 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
2889
  ...at,
2722
2890
  name: item.id
2723
2891
  }));
@@ -2726,12 +2894,12 @@ function validateNodeConfig(node, flow, context, err, warn) {
2726
2894
  break;
2727
2895
  }
2728
2896
  case 'foreach':
2729
- expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
2730
- if (c.collect !== undefined) expr(c.collect, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_COLLECTED_VALUE */.bc.THE_COLLECTED_VALUE));
2731
- if (c.maxItems !== undefined && !(Number.isInteger(c.maxItems) && c.maxItems >= 1 && c.maxItems <= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_FOREACH_ITEMS */.Or.MAX_FOREACH_ITEMS)) {
2732
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_MAX_ITEMS_RANGE */.qj.NODE_MAX_ITEMS_RANGE, {
2897
+ 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));
2898
+ 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));
2899
+ 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)) {
2900
+ 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
2901
  ...at,
2734
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_FOREACH_ITEMS */.Or.MAX_FOREACH_ITEMS
2902
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_FOREACH_ITEMS */.Or.MAX_FOREACH_ITEMS
2735
2903
  }));
2736
2904
  }
2737
2905
  break;
@@ -2756,7 +2924,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
2756
2924
  break;
2757
2925
  case 'entity_update':
2758
2926
  entity(c.entityCode);
2759
- writeTargetConfig(c, _flow_types_js__rspack_import_6/* .RECORD_WRITE_TARGETS */.Dn, [
2927
+ writeTargetConfig(c, _flow_types_js__rspack_import_5/* .RECORD_WRITE_TARGETS */.Dn, [
2760
2928
  'error',
2761
2929
  'skip',
2762
2930
  'insert'
@@ -2770,7 +2938,7 @@ function validateNodeConfig(node, flow, context, err, warn) {
2770
2938
  break;
2771
2939
  case 'entity_delete':
2772
2940
  entity(c.entityCode);
2773
- writeTargetConfig(c, _flow_types_js__rspack_import_6/* .RECORD_WRITE_TARGETS */.Dn, [
2941
+ writeTargetConfig(c, _flow_types_js__rspack_import_5/* .RECORD_WRITE_TARGETS */.Dn, [
2774
2942
  'error',
2775
2943
  'skip'
2776
2944
  ], {
@@ -2782,34 +2950,36 @@ function validateNodeConfig(node, flow, context, err, warn) {
2782
2950
  break;
2783
2951
  case 'entity_get':
2784
2952
  entity(c.entityCode);
2785
- expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_RECORD_ID */.bc.THE_RECORD_ID));
2953
+ 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));
2954
+ if (c.fromRequest !== undefined && typeof c.fromRequest !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_QUERY_FROM_REQUEST_INVALID */.qj.NODE_QUERY_FROM_REQUEST_INVALID, at));
2786
2955
  break;
2787
2956
  case 'entity_query':
2788
2957
  entity(c.entityCode);
2789
2958
  filterMap(c.filter, KIND.filter);
2790
- if (c.search !== undefined) expr(c.search, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_SEARCH_TEXT */.bc.THE_SEARCH_TEXT));
2959
+ 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
2960
  if (c.sort !== undefined) {
2792
2961
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_SORT_INVALID */.qj.NODE_SORT_INVALID, at));
2962
+ 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
2963
  }
2795
- if (c.limit !== undefined && !(Number.isInteger(c.limit) && c.limit >= 1 && c.limit <= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_QUERY_LIMIT */.Or.MAX_QUERY_LIMIT)) {
2796
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_LIMIT_RANGE */.qj.NODE_LIMIT_RANGE, {
2964
+ 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)) {
2965
+ 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
2966
  ...at,
2798
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_QUERY_LIMIT */.Or.MAX_QUERY_LIMIT
2967
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_QUERY_LIMIT */.Or.MAX_QUERY_LIMIT
2799
2968
  }));
2800
2969
  }
2970
+ if (c.fromRequest !== undefined && typeof c.fromRequest !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_QUERY_FROM_REQUEST_INVALID */.qj.NODE_QUERY_FROM_REQUEST_INVALID, at));
2801
2971
  break;
2802
2972
  case 'call_flow':
2803
- if (typeof c.flowSlug !== 'string' || !_flow_types_js__rspack_import_6/* .FLOW_SLUG_PATTERN.test */.YD.test(c.flowSlug)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHOOSE_FLOW */.qj.NODE_CHOOSE_FLOW, at));
2804
- else if (c.flowSlug === flow.slug) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CALLS_ITSELF */.qj.NODE_CALLS_ITSELF, at));
2805
- 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_8/* .FLOW_VALIDATION_MESSAGES.NODE_FLOW_UNKNOWN */.qj.NODE_FLOW_UNKNOWN, {
2973
+ 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));
2974
+ 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));
2975
+ 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
2976
  ...at,
2807
2977
  flow: c.flowSlug
2808
2978
  }));
2809
2979
  else if (context.knownFlows) checkCalledFlow(node, flow, context.knownFlows, err, warn);
2810
- if (c.endpoint !== undefined && c.endpoint !== '' && (typeof c.endpoint !== 'string' || !_flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.TRIGGER_PATH_INVALID */.qj.TRIGGER_PATH_INVALID, at));
2980
+ 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
2981
  exprMap(c.input, KIND.input);
2812
- if (c.inputList !== undefined) expr(c.inputList, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_INPUT_LIST */.bc.THE_INPUT_LIST));
2982
+ 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
2983
  break;
2814
2984
  case 'http_request':
2815
2985
  {
@@ -2819,88 +2989,108 @@ function validateNodeConfig(node, flow, context, err, warn) {
2819
2989
  'PUT',
2820
2990
  'PATCH',
2821
2991
  'DELETE'
2822
- ].includes(String(c.method))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHOOSE_METHOD */.qj.NODE_CHOOSE_METHOD, at));
2823
- expr(c.url, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_URL */.bc.THE_URL));
2992
+ ].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));
2993
+ 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
2994
  exprMap(c.headers, KIND.header);
2825
2995
  exprMap(c.body, KIND.body);
2826
- if (c.forwardAuth === true) warn.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FORWARDS_TOKEN */.qj.NODE_FORWARDS_TOKEN, at));
2827
- if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >= 100 && c.timeoutMs <= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_HTTP_TIMEOUT_MS */.Or.MAX_HTTP_TIMEOUT_MS)) {
2828
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_TIMEOUT_RANGE */.qj.NODE_TIMEOUT_RANGE, {
2996
+ 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));
2997
+ 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)) {
2998
+ 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
2999
  ...at,
2830
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_HTTP_TIMEOUT_MS */.Or.MAX_HTTP_TIMEOUT_MS
3000
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_HTTP_TIMEOUT_MS */.Or.MAX_HTTP_TIMEOUT_MS
2831
3001
  }));
2832
3002
  }
2833
3003
  break;
2834
3004
  }
2835
3005
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_EVENT_NAME_INVALID */.qj.NODE_EVENT_NAME_INVALID, at));
3006
+ 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
3007
  exprMap(c.payload, KIND.payload);
2838
3008
  break;
2839
3009
  case 'send_notification':
2840
3010
  {
2841
- serviceRunning('notification', _config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_UNAVAILABLE */.qj.NODE_NOTIFICATION_UNAVAILABLE);
3011
+ serviceRunning('notification', _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_UNAVAILABLE */.qj.NODE_NOTIFICATION_UNAVAILABLE);
2842
3012
  const target = c.target ?? 'one';
2843
- if (!_flow_types_js__rspack_import_6/* .FLOW_NOTIFICATION_TARGETS.includes */.as.includes(target)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_MESSAGE_TARGET_INVALID */.qj.NODE_MESSAGE_TARGET_INVALID, at));
2844
- if (target === 'many') expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
3013
+ 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));
3014
+ 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
3015
  if (target === 'company') {
2846
- if (context.companyMembers === false) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_COMPANY_UNAVAILABLE */.qj.NODE_NOTIFICATION_COMPANY_UNAVAILABLE, at));
2847
- expr(c.companyIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_COMPANIES */.bc.THE_COMPANIES));
2848
- optionalExpr(c.branchIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_BRANCHES */.bc.THE_BRANCHES));
3016
+ 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));
3017
+ 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));
3018
+ 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
3019
  } else {
2850
- expr(c.userIds, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_RECIPIENTS */.bc.THE_RECIPIENTS));
2851
- optionalExpr(c.companyId, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_COMPANY */.bc.THE_COMPANY));
3020
+ 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));
3021
+ 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
3022
  }
2853
- expr(c.title, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_TITLE */.bc.THE_TITLE));
2854
- optionalExpr(c.message, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_MESSAGE */.bc.THE_MESSAGE));
3023
+ 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));
3024
+ 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
3025
  exprMap(c.data, KIND.data);
2856
- if (c.type !== undefined && !_flow_types_js__rspack_import_6/* .FLOW_NOTIFICATION_TYPES.includes */.LG.includes(c.type)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_OPTION_INVALID */.qj.NODE_NOTIFICATION_OPTION_INVALID, at));
2857
- if (c.realtime !== undefined && typeof c.realtime !== 'boolean') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_NOTIFICATION_OPTION_INVALID */.qj.NODE_NOTIFICATION_OPTION_INVALID, at));
3026
+ 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));
3027
+ 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
3028
  break;
2859
3029
  }
2860
3030
  case 'send_email':
2861
3031
  {
2862
- serviceRunning('email', _config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_UNAVAILABLE */.qj.NODE_EMAIL_UNAVAILABLE);
2863
- if (!_flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.NODE_MESSAGE_TARGET_INVALID */.qj.NODE_MESSAGE_TARGET_INVALID, at));
2864
- if (c.target === 'many') expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
2865
- expr(c.to, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_RECIPIENTS */.bc.THE_RECIPIENTS));
2866
- optionalExpr(c.cc, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_CC */.bc.THE_CC));
2867
- optionalExpr(c.bcc, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_BCC */.bc.THE_BCC));
2868
- optionalExpr(c.replyTo, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_REPLY_TO */.bc.THE_REPLY_TO));
2869
- if (c.mode !== undefined && !_flow_types_js__rspack_import_6/* .FLOW_EMAIL_MODES.includes */.v1.includes(c.mode)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_OPTION_INVALID */.qj.NODE_EMAIL_OPTION_INVALID, at));
2870
- if (c.format !== undefined && !_flow_types_js__rspack_import_6/* .FLOW_EMAIL_FORMATS.includes */.FU.includes(c.format)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_OPTION_INVALID */.qj.NODE_EMAIL_OPTION_INVALID, at));
2871
- if (c.emailConfigId !== undefined && c.emailConfigId !== '' && (typeof c.emailConfigId !== 'string' || !_flow_types_js__rspack_import_6/* .FLOW_ID_PATTERN.test */.E2.test(c.emailConfigId))) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_OPTION_INVALID */.qj.NODE_EMAIL_OPTION_INVALID, at));
3032
+ serviceRunning('email', _config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_UNAVAILABLE */.qj.NODE_EMAIL_UNAVAILABLE);
3033
+ 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));
3034
+ 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));
3035
+ 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));
3036
+ 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));
3037
+ 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));
3038
+ 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));
3039
+ 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));
3040
+ 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));
3041
+ 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
3042
  if (c.mode === 'template') {
2873
3043
  const slug = typeof c.templateSlug === 'string' ? c.templateSlug.trim() : '';
2874
- if (!slug || slug.length > _flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.NODE_EMAIL_TEMPLATE_REQUIRED */.qj.NODE_EMAIL_TEMPLATE_REQUIRED, at));
3044
+ 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
3045
  exprMap(c.variables, KIND.template);
2876
3046
  } else {
2877
- expr(c.subject, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_SUBJECT */.bc.THE_SUBJECT));
2878
- expr(c.body, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_BODY */.bc.THE_BODY));
3047
+ 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));
3048
+ 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
3049
  }
2880
3050
  break;
2881
3051
  }
2882
3052
  case 'respond':
2883
3053
  {
2884
3054
  const status = c.statusCode;
2885
- if (!(Number.isInteger(status) && status >= 200 && status <= 599)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_STATUS_2XX_5XX */.qj.NODE_STATUS_2XX_5XX, at));
2886
- exprMap(c.body, KIND.response);
2887
- if (c.bodyExpression !== undefined) expr(c.bodyExpression, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_RESPONSE */.bc.THE_RESPONSE));
3055
+ 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));
3056
+ const format = c.format ?? 'raw';
3057
+ if (!_flow_types_js__rspack_import_5/* .FLOW_RESPONSE_FORMATS.includes */.A4.includes(format)) {
3058
+ err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_RESPOND_FORMAT_INVALID */.qj.NODE_RESPOND_FORMAT_INVALID, {
3059
+ ...at,
3060
+ format: String(format)
3061
+ }));
3062
+ break;
3063
+ }
3064
+ const what = (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(format === 'raw' ? _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_RESPONSE */.bc.THE_RESPONSE : _config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_DATA */.bc.THE_DATA);
3065
+ if (format !== 'message') {
3066
+ exprMap(c.body, KIND.response);
3067
+ if (c.bodyExpression !== undefined) expr(c.bodyExpression, what);
3068
+ }
3069
+ if (format === 'raw') break;
3070
+ if (typeof c.message !== 'string' || !c.message.trim() || typeof c.messageKey !== 'string' || !c.messageKey.trim()) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_RESPOND_MESSAGE_REQUIRED */.qj.NODE_RESPOND_MESSAGE_REQUIRED, at));
3071
+ exprMap(c.messageVariables, KIND.messageVariable);
3072
+ if ((format === 'list' || format === 'bulk') && c.bodyExpression === undefined) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.NODE_RESPOND_LIST_VALUE_REQUIRED */.qj.NODE_RESPOND_LIST_VALUE_REQUIRED, at));
3073
+ if (format === 'list' || format === 'bulk') optionalExpr(c.total, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_TOTAL */.bc.THE_TOTAL));
3074
+ if (format === 'list') {
3075
+ optionalExpr(c.page, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_PAGE */.bc.THE_PAGE));
3076
+ optionalExpr(c.pageSize, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.THE_PAGE_SIZE */.bc.THE_PAGE_SIZE));
3077
+ }
2888
3078
  break;
2889
3079
  }
2890
3080
  case 'commit':
2891
- if (node.onError === 'continue') err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_COMMIT_CONTINUE */.qj.NODE_COMMIT_CONTINUE, at));
3081
+ 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
3082
  break;
2893
3083
  case 'code':
2894
- if (typeof c.code !== 'string' || !c.code.trim()) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CODE_REQUIRED */.qj.NODE_CODE_REQUIRED, at));
2895
- else if (c.code.length > _flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.NODE_CODE_TOO_LONG */.qj.NODE_CODE_TOO_LONG, {
3084
+ 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));
3085
+ 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
3086
  ...at,
2897
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_CODE_LENGTH */.Or.MAX_CODE_LENGTH
3087
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CODE_LENGTH */.Or.MAX_CODE_LENGTH
2898
3088
  }));
2899
- if (c.timeoutMs !== undefined && !(Number.isInteger(c.timeoutMs) && c.timeoutMs >= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MIN_CODE_TIMEOUT_MS */.Or.MIN_CODE_TIMEOUT_MS && c.timeoutMs <= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_CODE_TIMEOUT_MS */.Or.MAX_CODE_TIMEOUT_MS)) {
2900
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CODE_TIMEOUT_RANGE */.qj.NODE_CODE_TIMEOUT_RANGE, {
3089
+ 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)) {
3090
+ 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
3091
  ...at,
2902
- min: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MIN_CODE_TIMEOUT_MS */.Or.MIN_CODE_TIMEOUT_MS,
2903
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_CODE_TIMEOUT_MS */.Or.MAX_CODE_TIMEOUT_MS
3092
+ min: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MIN_CODE_TIMEOUT_MS */.Or.MIN_CODE_TIMEOUT_MS,
3093
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CODE_TIMEOUT_MS */.Or.MAX_CODE_TIMEOUT_MS
2904
3094
  }));
2905
3095
  }
2906
3096
  break;
@@ -2908,66 +3098,66 @@ function validateNodeConfig(node, flow, context, err, warn) {
2908
3098
  }
2909
3099
  /** `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
3100
  const target = c.target ?? 'one';
2911
- if (typeof target !== 'string' || !targets.includes(target)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_WRITE_TARGET_INVALID */.qj.NODE_WRITE_TARGET_INVALID, at));
2912
- if (c.onNotFound !== undefined && !notFound.includes(c.onNotFound)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_NOT_FOUND_INVALID */.qj.NODE_NOT_FOUND_INVALID, at));
3101
+ 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));
3102
+ 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
3103
  const needsId = notFound.length > 0;
2914
- if (target === 'one' && needsId) expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_RECORD_ID */.bc.THE_RECORD_ID));
3104
+ 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
3105
  if (target === 'many') {
2916
- expr(c.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_LIST */.bc.THE_LIST));
2917
- if (needsId && c.id !== undefined) expr(c.id, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_RECORD_ID */.bc.THE_RECORD_ID));
3106
+ 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));
3107
+ 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
3108
  }
2919
3109
  if (target === 'filter') {
2920
3110
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_FILTER_REQUIRED */.qj.NODE_FILTER_REQUIRED, at));
2922
- if (c.limit !== undefined && !(Number.isInteger(c.limit) && c.limit >= 1 && c.limit <= _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_WRITE_ITEMS */.Or.MAX_WRITE_ITEMS)) {
2923
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_LIMIT_RANGE */.qj.NODE_LIMIT_RANGE, {
3111
+ 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));
3112
+ 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)) {
3113
+ 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
3114
  ...at,
2925
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_WRITE_ITEMS */.Or.MAX_WRITE_ITEMS
3115
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_WRITE_ITEMS */.Or.MAX_WRITE_ITEMS
2926
3116
  }));
2927
3117
  }
2928
3118
  }
2929
3119
  }
2930
3120
  function childInserts(value, { at, entity, expr, err }) {
2931
3121
  if (value === undefined) return;
2932
- if (!Array.isArray(value)) return err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHILDREN_INVALID */.qj.NODE_CHILDREN_INVALID, at));
2933
- if (value.length > _flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHILDREN_TOO_MANY */.qj.NODE_CHILDREN_TOO_MANY, {
3122
+ 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));
3123
+ 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
3124
  ...at,
2935
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_CHILD_INSERTS */.Or.MAX_CHILD_INSERTS
3125
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_CHILD_INSERTS */.Or.MAX_CHILD_INSERTS
2936
3126
  }));
2937
3127
  const names = new Set();
2938
3128
  for (const child of value){
2939
3129
  if (!child || typeof child !== 'object') {
2940
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHILDREN_INVALID */.qj.NODE_CHILDREN_INVALID, at));
3130
+ 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
3131
  continue;
2942
3132
  }
2943
3133
  const name = String(child.as ?? '');
2944
- if (!_flow_types_js__rspack_import_6/* .FLOW_INPUT_NAME_PATTERN.test */.fZ.test(name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHILD_NAME_INVALID */.qj.NODE_CHILD_NAME_INVALID, {
3134
+ 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
3135
  ...at,
2946
3136
  name
2947
3137
  }));
2948
- else if (names.has(name)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHILD_NAME_DUPLICATE */.qj.NODE_CHILD_NAME_DUPLICATE, {
3138
+ 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
3139
  ...at,
2950
3140
  name
2951
3141
  }));
2952
3142
  names.add(name);
2953
3143
  entity(child.entityCode);
2954
- 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_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHILD_PARENT_FIELD_REQUIRED */.qj.NODE_CHILD_PARENT_FIELD_REQUIRED, {
3144
+ 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
3145
  ...at,
2956
3146
  name
2957
3147
  }));
2958
- expr(child.items, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.CHILD_LIST */.bc.CHILD_LIST, {
3148
+ 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
3149
  name
2960
3150
  }));
2961
3151
  const fields = child.fields;
2962
3152
  if (fields === undefined) continue;
2963
3153
  if (!fields || typeof fields !== 'object' || Array.isArray(fields)) {
2964
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_PAIRS_INVALID */.qj.NODE_PAIRS_INVALID, {
3154
+ 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
3155
  ...at,
2966
- what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.FIELDS */.bc.FIELDS)
3156
+ what: (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_7/* .FLOW_SUBJECT_MESSAGES.FIELDS */.bc.FIELDS)
2967
3157
  }));
2968
3158
  continue;
2969
3159
  }
2970
- 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_8/* .FLOW_SUBJECT_MESSAGES.CHILD_FIELD */.bc.CHILD_FIELD, {
3160
+ 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
3161
  name: `${name}.${key}`
2972
3162
  }));
2973
3163
  }
@@ -2994,7 +3184,7 @@ function childInserts(value, { at, entity, expr, err }) {
2994
3184
  }
2995
3185
  ];
2996
3186
  }
2997
- if ((0,_flow_types_js__rspack_import_6/* .isMessageNode */.SE)(node.type) && config['target'] === 'many') {
3187
+ if ((0,_flow_types_js__rspack_import_5/* .isMessageNode */.SE)(node.type) && config['target'] === 'many') {
2998
3188
  const { items, ...perItem } = config;
2999
3189
  return [
3000
3190
  {
@@ -3047,39 +3237,39 @@ function childInserts(value, { at, entity, expr, err }) {
3047
3237
  return scopes;
3048
3238
  }
3049
3239
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_REQUIRED */.qj.NODE_CHECK_REQUIRED, at));
3051
- if (c.checks.length > _flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.NODE_TOO_MANY_CHECKS */.qj.NODE_TOO_MANY_CHECKS, {
3240
+ 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));
3241
+ 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
3242
  ...at,
3053
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_VALIDATE_CHECKS */.Or.MAX_VALIDATE_CHECKS
3243
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_VALIDATE_CHECKS */.Or.MAX_VALIDATE_CHECKS
3054
3244
  }));
3055
3245
  const ids = new Set();
3056
3246
  for (const check of c.checks){
3057
3247
  const id = check?.id;
3058
- if (typeof id !== 'string' || !CHECK_ID.test(id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_ID_INVALID */.qj.NODE_CHECK_ID_INVALID, {
3248
+ 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
3249
  ...at,
3060
3250
  name: String(id)
3061
3251
  }));
3062
- else if (ids.has(id)) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_ID_DUPLICATE */.qj.NODE_CHECK_ID_DUPLICATE, {
3252
+ 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
3253
  ...at,
3064
3254
  name: id
3065
3255
  }));
3066
3256
  else ids.add(id);
3067
3257
  const name = String(id);
3068
- rule(check?.rule, (0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_SUBJECT_MESSAGES.THE_CHECK */.bc.THE_CHECK, {
3258
+ 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
3259
  name
3070
3260
  }));
3071
- if (typeof check?.message !== 'string' || !check.message.trim()) err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_MESSAGE_REQUIRED */.qj.NODE_CHECK_MESSAGE_REQUIRED, {
3261
+ 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
3262
  ...at,
3073
3263
  name
3074
3264
  }));
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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.NODE_CHECK_FIELD_INVALID */.qj.NODE_CHECK_FIELD_INVALID, {
3265
+ 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
3266
  ...at,
3077
3267
  name
3078
3268
  }));
3079
3269
  }
3080
3270
  }
3081
3271
  /** 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,_flow_types_js__rspack_import_6/* .flowEndpoints */.Xr)(flow);
3272
+ const endpoints = (0,_flow_types_js__rspack_import_5/* .flowEndpoints */.Xr)(flow);
3083
3273
  const declaredInputs = new Set(endpoints.flatMap((endpoint)=>endpoint.inputSchema.map((f)=>f.name)));
3084
3274
  // A list body is read by index, and an object body without fields takes anything: neither has names to check.
3085
3275
  const namesKnown = endpoints.length > 0 && endpoints.every((endpoint)=>endpoint.bodyType !== 'list' && endpoint.inputSchema.length > 0);
@@ -3093,22 +3283,22 @@ function validateChecks(c, at, rule, err) {
3093
3283
  for (const ref of refs){
3094
3284
  const [scope, second] = ref.split('.');
3095
3285
  if (!REF_SCOPES.has(scope)) {
3096
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_BAD_SCOPE */.qj.REF_BAD_SCOPE, {
3097
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node),
3286
+ 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, {
3287
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node),
3098
3288
  ref
3099
3289
  }));
3100
3290
  } else if (scope === 'context' && second && !byId.has(second)) {
3101
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_NODE_MISSING */.qj.REF_NODE_MISSING, {
3102
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node),
3291
+ 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, {
3292
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node),
3103
3293
  target: second
3104
3294
  }));
3105
3295
  } else if (scope === 'context' && second === node.id) {
3106
- err((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_SELF */.qj.REF_SELF, {
3107
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node)
3296
+ 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, {
3297
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node)
3108
3298
  }));
3109
3299
  } else if (scope === 'input' && second && namesKnown && !declaredInputs.has(second)) {
3110
- warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_INPUT_UNDECLARED */.qj.REF_INPUT_UNDECLARED, {
3111
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(node),
3300
+ 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, {
3301
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(node),
3112
3302
  input: second
3113
3303
  }));
3114
3304
  }
@@ -3130,12 +3320,12 @@ function refsOf(value, refs = [], depth = 0) {
3130
3320
  for (const { endpoint, label, steps } of runs){
3131
3321
  if (endpoint.isTransactional) continue;
3132
3322
  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)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.WRITES_NOT_TRANSACTIONAL */.qj.WRITES_NOT_TRANSACTIONAL, {
3323
+ 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
3324
  count: writes,
3135
3325
  node: label
3136
3326
  }));
3137
- 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_8/* .FLOW_VALIDATION_MESSAGES.COMMIT_NOT_TRANSACTIONAL */.qj.COMMIT_NOT_TRANSACTIONAL, {
3138
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(commit),
3327
+ 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, {
3328
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(commit),
3139
3329
  endpoint: label
3140
3330
  }));
3141
3331
  }
@@ -3156,14 +3346,14 @@ function refsOf(value, refs = [], depth = 0) {
3156
3346
  ].some((f)=>f.calls.includes(flow.slug));
3157
3347
  for (const commit of commits){
3158
3348
  const at = {
3159
- node: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(commit)
3349
+ node: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(commit)
3160
3350
  };
3161
3351
  const loop = loops.find((l)=>l.body.has(commit.id));
3162
- if (loop) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.COMMIT_IN_LOOP */.qj.COMMIT_IN_LOOP, {
3352
+ 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
3353
  ...at,
3164
- loop: (0,_flow_types_js__rspack_import_6/* .nodeLabel */.dA)(loop.node)
3354
+ loop: (0,_flow_types_js__rspack_import_5/* .nodeLabel */.dA)(loop.node)
3165
3355
  }));
3166
- if (called) warnings.push((0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.COMMIT_IN_CALLED_FLOW */.qj.COMMIT_IN_CALLED_FLOW, at));
3356
+ 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
3357
  }
3168
3358
  }
3169
3359
  /** Every node a loop's `each` branch runs, nested loops included. */ function loopBody(loopId, outgoing) {
@@ -3266,14 +3456,14 @@ function refsOf(value, refs = [], depth = 0) {
3266
3456
  const [scope, target, field] = segs;
3267
3457
  if (scope === 'loop') {
3268
3458
  const parents = segs.slice(1).findIndex((s)=>s !== 'parent');
3269
- if (!depth) warn(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_LOOP_OUTSIDE */.qj.REF_LOOP_OUTSIDE, {});
3270
- else if ((parents < 0 ? segs.length - 1 : parents) >= depth) warn(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_LOOP_PARENT_MISSING */.qj.REF_LOOP_PARENT_MISSING, {});
3459
+ if (!depth) warn(_config_message_keys_js__rspack_import_7/* .FLOW_VALIDATION_MESSAGES.REF_LOOP_OUTSIDE */.qj.REF_LOOP_OUTSIDE, {});
3460
+ 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
3461
  }
3272
3462
  if (scope !== 'context' || !target || target === node.id || !byId.has(target)) continue;
3273
- if (!available.has(target)) warn(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_NODE_NOT_YET */.qj.REF_NODE_NOT_YET, {
3463
+ 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
3464
  target: nameOf(target)
3275
3465
  });
3276
- else if (field === 'results' && around.has(target)) warn(_config_message_keys_js__rspack_import_8/* .FLOW_VALIDATION_MESSAGES.REF_LOOP_RESULTS_EARLY */.qj.REF_LOOP_RESULTS_EARLY, {
3466
+ 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
3467
  loop: nameOf(target)
3278
3468
  });
3279
3469
  }
@@ -3328,8 +3518,8 @@ function reach(start, outgoing) {
3328
3518
  nesting.set(id, max);
3329
3519
  return max;
3330
3520
  };
3331
- if (nodes.some((n)=>n.type === 'trigger' && nestingFrom(n.id) > _flow_types_js__rspack_import_6/* .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_8/* .FLOW_VALIDATION_MESSAGES.LOOP_TOO_DEEP */.qj.LOOP_TOO_DEEP, {
3332
- max: _flow_types_js__rspack_import_6/* .FLOW_LIMITS.MAX_LOOP_DEPTH */.Or.MAX_LOOP_DEPTH
3521
+ 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, {
3522
+ max: _flow_types_js__rspack_import_5/* .FLOW_LIMITS.MAX_LOOP_DEPTH */.Or.MAX_LOOP_DEPTH
3333
3523
  }));
3334
3524
  }
3335
3525
 
@@ -3343,26 +3533,28 @@ __webpack_require__.d(__webpack_exports__, {
3343
3533
  },
3344
3534
  6390(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
3345
3535
  /* import */ var _flusys_nestjs_shared_utils__rspack_import_0 = __webpack_require__(9216);
3346
- /* import */ var _config_message_keys_js__rspack_import_3 = __webpack_require__(5732);
3347
- /* import */ var _enums_field_type_enum_js__rspack_import_2 = __webpack_require__(9614);
3536
+ /* import */ var _config_message_keys_js__rspack_import_4 = __webpack_require__(5732);
3537
+ /* import */ var _enums_field_type_enum_js__rspack_import_3 = __webpack_require__(9614);
3348
3538
  /* import */ var _services_field_value_validator_js__rspack_import_1 = __webpack_require__(3525);
3539
+ /* import */ var _flow_types_js__rspack_import_2 = __webpack_require__(6256);
3540
+
3349
3541
 
3350
3542
 
3351
3543
 
3352
3544
 
3353
3545
  const TYPE_MAP = {
3354
- string: _enums_field_type_enum_js__rspack_import_2/* .FieldType.TEXT */.P.TEXT,
3355
- text: _enums_field_type_enum_js__rspack_import_2/* .FieldType.LONG_TEXT */.P.LONG_TEXT,
3356
- number: _enums_field_type_enum_js__rspack_import_2/* .FieldType.DECIMAL */.P.DECIMAL,
3357
- integer: _enums_field_type_enum_js__rspack_import_2/* .FieldType.INTEGER */.P.INTEGER,
3358
- boolean: _enums_field_type_enum_js__rspack_import_2/* .FieldType.BOOLEAN */.P.BOOLEAN,
3359
- date: _enums_field_type_enum_js__rspack_import_2/* .FieldType.DATE */.P.DATE,
3360
- datetime: _enums_field_type_enum_js__rspack_import_2/* .FieldType.DATETIME */.P.DATETIME,
3361
- email: _enums_field_type_enum_js__rspack_import_2/* .FieldType.EMAIL */.P.EMAIL,
3362
- uuid: _enums_field_type_enum_js__rspack_import_2/* .FieldType.RELATION */.P.RELATION,
3363
- object: _enums_field_type_enum_js__rspack_import_2/* .FieldType.JSON */.P.JSON,
3364
- array: _enums_field_type_enum_js__rspack_import_2/* .FieldType.JSON */.P.JSON,
3365
- choice: _enums_field_type_enum_js__rspack_import_2/* .FieldType.SINGLE_SELECT */.P.SINGLE_SELECT
3546
+ string: _enums_field_type_enum_js__rspack_import_3/* .FieldType.TEXT */.P.TEXT,
3547
+ text: _enums_field_type_enum_js__rspack_import_3/* .FieldType.LONG_TEXT */.P.LONG_TEXT,
3548
+ number: _enums_field_type_enum_js__rspack_import_3/* .FieldType.DECIMAL */.P.DECIMAL,
3549
+ integer: _enums_field_type_enum_js__rspack_import_3/* .FieldType.INTEGER */.P.INTEGER,
3550
+ boolean: _enums_field_type_enum_js__rspack_import_3/* .FieldType.BOOLEAN */.P.BOOLEAN,
3551
+ date: _enums_field_type_enum_js__rspack_import_3/* .FieldType.DATE */.P.DATE,
3552
+ datetime: _enums_field_type_enum_js__rspack_import_3/* .FieldType.DATETIME */.P.DATETIME,
3553
+ email: _enums_field_type_enum_js__rspack_import_3/* .FieldType.EMAIL */.P.EMAIL,
3554
+ uuid: _enums_field_type_enum_js__rspack_import_3/* .FieldType.RELATION */.P.RELATION,
3555
+ object: _enums_field_type_enum_js__rspack_import_3/* .FieldType.JSON */.P.JSON,
3556
+ array: _enums_field_type_enum_js__rspack_import_3/* .FieldType.JSON */.P.JSON,
3557
+ choice: _enums_field_type_enum_js__rspack_import_3/* .FieldType.SINGLE_SELECT */.P.SINGLE_SELECT
3366
3558
  };
3367
3559
  const isPlainObject = (v)=>typeof v === 'object' && v !== null && !Array.isArray(v);
3368
3560
  /**
@@ -3381,13 +3573,89 @@ const isPlainObject = (v)=>typeof v === 'object' && v !== null && !Array.isArray
3381
3573
  };
3382
3574
  return checkFields(schema, source, '');
3383
3575
  }
3576
+ const FIELD_NAME = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
3577
+ const OPEN_CONTRACTS = new Set([
3578
+ 'update',
3579
+ 'update_many'
3580
+ ]);
3581
+ const QUERY_CONTRACTS = new Set([
3582
+ 'get_all',
3583
+ 'get_by_id',
3584
+ 'get_by_ids'
3585
+ ]);
3586
+ /**
3587
+ * Checks a request body against a Request step, the way its API controller endpoint's DTO would: a
3588
+ * delete `id` sent as one id is read as a list and a get_by_ids `select` may be comma-separated; `sort`
3589
+ * values must be ASC / DESC and `select` names plain field names. An update / update_many with no
3590
+ * declared fields keeps the rest of the body, with only its `id` checked.
3591
+ */ function validateEndpointInput(endpoint, body) {
3592
+ const { contract } = endpoint;
3593
+ const source = normalizeBody(contract, body);
3594
+ const result = validateFlowInput(endpoint.inputSchema, source, endpoint.bodyType);
3595
+ if (OPEN_CONTRACTS.has(contract) && endpoint.inputSchema.length === (0,_flow_types_js__rspack_import_2/* .contractFields */._h)(contract).length) result.values = keepRest(source, result.values);
3596
+ if (QUERY_CONTRACTS.has(contract) && !Array.isArray(result.values)) result.errors.push(...contractErrors(result.values));
3597
+ return result;
3598
+ }
3599
+ function normalizeBody(contract, body) {
3600
+ if (!isPlainObject(body)) return body;
3601
+ const source = body;
3602
+ if (contract === 'delete' && typeof source['id'] === 'string') return {
3603
+ ...source,
3604
+ id: [
3605
+ source['id']
3606
+ ]
3607
+ };
3608
+ if (contract === 'get_by_ids' && typeof source['select'] === 'string') {
3609
+ return {
3610
+ ...source,
3611
+ select: source['select'].split(',').map((name)=>name.trim()).filter(Boolean)
3612
+ };
3613
+ }
3614
+ return body;
3615
+ }
3616
+ function keepRest(source, values) {
3617
+ if (Array.isArray(values)) return values.map((item, i)=>isPlainObject(item) && Array.isArray(source) && isPlainObject(source[i]) ? {
3618
+ ...source[i],
3619
+ ...item
3620
+ } : item);
3621
+ return isPlainObject(source) ? {
3622
+ ...source,
3623
+ ...values
3624
+ } : values;
3625
+ }
3626
+ function contractErrors(values) {
3627
+ const errors = [];
3628
+ const sort = values['sort'];
3629
+ if (isPlainObject(sort)) {
3630
+ for (const [field, direction] of Object.entries(sort)){
3631
+ if (!FIELD_NAME.test(field) || direction !== 'ASC' && direction !== 'DESC') errors.push({
3632
+ field: `sort.${field}`,
3633
+ ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_4/* .FLOW_MESSAGES.INPUT_SORT_INVALID */.wu.INPUT_SORT_INVALID, {
3634
+ field
3635
+ })
3636
+ });
3637
+ }
3638
+ }
3639
+ const select = values['select'];
3640
+ if (Array.isArray(select)) {
3641
+ select.forEach((field, i)=>{
3642
+ if (typeof field !== 'string' || !FIELD_NAME.test(field)) errors.push({
3643
+ field: `select[${i}]`,
3644
+ ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_4/* .FLOW_MESSAGES.INPUT_SELECT_INVALID */.wu.INPUT_SELECT_INVALID, {
3645
+ field: String(field)
3646
+ })
3647
+ });
3648
+ });
3649
+ }
3650
+ return errors;
3651
+ }
3384
3652
  function checkList(schema, body) {
3385
3653
  if (!Array.isArray(body)) return {
3386
3654
  values: [],
3387
3655
  errors: [
3388
3656
  {
3389
3657
  field: 'body',
3390
- ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_3/* .FLOW_MESSAGES.INPUT_BODY_NOT_LIST */.wu.INPUT_BODY_NOT_LIST)
3658
+ ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_4/* .FLOW_MESSAGES.INPUT_BODY_NOT_LIST */.wu.INPUT_BODY_NOT_LIST)
3391
3659
  }
3392
3660
  ]
3393
3661
  };
@@ -3402,7 +3670,7 @@ function checkList(schema, body) {
3402
3670
  values.push(item);
3403
3671
  errors.push({
3404
3672
  field: `[${i}]`,
3405
- ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_3/* .FLOW_MESSAGES.INPUT_BODY_ITEM_NOT_OBJECT */.wu.INPUT_BODY_ITEM_NOT_OBJECT, {
3673
+ ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_4/* .FLOW_MESSAGES.INPUT_BODY_ITEM_NOT_OBJECT */.wu.INPUT_BODY_ITEM_NOT_OBJECT, {
3406
3674
  index: i + 1
3407
3675
  })
3408
3676
  });
@@ -3422,7 +3690,7 @@ function toValidatable(field, code, label) {
3422
3690
  return {
3423
3691
  code,
3424
3692
  label,
3425
- fieldType: TYPE_MAP[field.type] ?? _enums_field_type_enum_js__rspack_import_2/* .FieldType.TEXT */.P.TEXT,
3693
+ fieldType: TYPE_MAP[field.type] ?? _enums_field_type_enum_js__rspack_import_3/* .FieldType.TEXT */.P.TEXT,
3426
3694
  nullable: !field.required,
3427
3695
  defaultValue: field.default ?? null,
3428
3696
  selectOptions: field.type === 'choice' ? field.options ?? [] : null,
@@ -3477,7 +3745,7 @@ function checkValue(field, supplied, raw, path, label) {
3477
3745
  errors: [
3478
3746
  {
3479
3747
  field: path,
3480
- ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_3/* .FIELD_VALIDATION_MESSAGES.MUST_BE_OBJECT */.KE.MUST_BE_OBJECT, {
3748
+ ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_4/* .FIELD_VALIDATION_MESSAGES.MUST_BE_OBJECT */.KE.MUST_BE_OBJECT, {
3481
3749
  label
3482
3750
  })
3483
3751
  }
@@ -3502,7 +3770,7 @@ function checkValue(field, supplied, raw, path, label) {
3502
3770
  errors: [
3503
3771
  {
3504
3772
  field: path,
3505
- ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_3/* .FIELD_VALIDATION_MESSAGES.MUST_BE_LIST */.KE.MUST_BE_LIST, {
3773
+ ...(0,_flusys_nestjs_shared_utils__rspack_import_0.messageRef)(_config_message_keys_js__rspack_import_4/* .FIELD_VALIDATION_MESSAGES.MUST_BE_LIST */.KE.MUST_BE_LIST, {
3506
3774
  label
3507
3775
  })
3508
3776
  }
@@ -3535,7 +3803,7 @@ function checkValue(field, supplied, raw, path, label) {
3535
3803
  }
3536
3804
 
3537
3805
  __webpack_require__.d(__webpack_exports__, {
3538
- v: () => (validateFlowInput)
3806
+ G: () => (validateEndpointInput)
3539
3807
  });
3540
3808
 
3541
3809
 
@@ -4044,7 +4312,12 @@ class EntityBuilderDataSourceProvider extends _flusys_nestjs_shared_modules__rsp
4044
4312
  // buildMetadatas() is `protected` in TypeORM's public .d.ts (a compile-time-only
4045
4313
  // restriction, not enforced by the JS runtime) but is the only way to rebuild
4046
4314
  // entityMetadatas from options.entities after DataSource.initialize() has run.
4047
- await dataSource.buildMetadatas();
4315
+ try {
4316
+ await dataSource.buildMetadatas();
4317
+ } catch (error) {
4318
+ if (perDsMap.get(schema.options.name) === schema) perDsMap.delete(schema.options.name);
4319
+ throw error;
4320
+ }
4048
4321
  });
4049
4322
  this.statics.rebuildLocks.set(dataSource, next.catch(()=>undefined));
4050
4323
  await next;
@@ -4388,6 +4661,7 @@ function _ts_param(paramIndex, decorator) {
4388
4661
 
4389
4662
  const defaultFlowPermissionCode = (slug)=>`entity_builder.flow.${slug}.execute`;
4390
4663
  /** The rule a `permission` URL asks callers to pass: its own, or the flow's execute permission. */ const flowPermissions = (endpoint, slug)=>endpoint.permissions ?? (0,_flow_engine_flow_permission_logic_js__rspack_import_13/* .permissionAction */.s)(defaultFlowPermissionCode(slug));
4664
+ /** A `permission` URL without a rule of its own: it asks for the flow's execute permission, which publishing registers. */ const asksExecutePermission = (endpoint)=>endpoint.authMode === 'permission' && !endpoint.permissions;
4391
4665
  const flowNotFound = ()=>new _nestjs_common__rspack_import_4.NotFoundException({
4392
4666
  message: 'Flow not found.',
4393
4667
  messageKey: _config_message_keys_js__rspack_import_14/* .FLOW_MESSAGES.NOT_FOUND */.wu.NOT_FOUND
@@ -4696,7 +4970,7 @@ class FlowDefinitionService extends _flusys_nestjs_shared_classes__rspack_import
4696
4970
  } finally{
4697
4971
  await qr.release().catch(()=>undefined);
4698
4972
  }
4699
- await this.clearCaches(existing);
4973
+ await this.invalidateCache();
4700
4974
  await this.provisionPermissions([
4701
4975
  existing
4702
4976
  ]);
@@ -4762,18 +5036,9 @@ class FlowDefinitionService extends _flusys_nestjs_shared_classes__rspack_import
4762
5036
  draft: flow.draft,
4763
5037
  updatedById: user?.id ?? null
4764
5038
  });
4765
- await this.clearCaches(flow);
5039
+ await this.invalidateCache();
4766
5040
  return flow;
4767
5041
  }
4768
- async clearCaches(flow) {
4769
- if (!this.isCacheable) return;
4770
- await Promise.all([
4771
- this.clearCacheForAll(),
4772
- this.clearCacheForId([
4773
- flow
4774
- ])
4775
- ]);
4776
- }
4777
5042
  async beforeDeleteOperation(dto, user, _qr) {
4778
5043
  const ids = Array.isArray(dto.id) ? dto.id : [
4779
5044
  dto.id
@@ -4793,7 +5058,7 @@ class FlowDefinitionService extends _flusys_nestjs_shared_classes__rspack_import
4793
5058
  const actions = new Map();
4794
5059
  for (const flow of flows){
4795
5060
  for (const endpoint of (0,_flow_engine_flow_types_js__rspack_import_11/* .flowEndpoints */.Xr)(flow)){
4796
- if (endpoint.authMode !== 'permission' || endpoint.permissions) continue;
5061
+ if (!asksExecutePermission(endpoint)) continue;
4797
5062
  const code = defaultFlowPermissionCode(flow.slug);
4798
5063
  if (!actions.has(code)) actions.set(code, endpoint.path ? `Run ${flow.name} (${endpoint.path})` : `Run ${flow.name}`);
4799
5064
  }
@@ -4865,6 +5130,7 @@ __webpack_require__.d(__webpack_exports__, {
4865
5130
  Er: defaultFlowPermissionCode,
4866
5131
  HF: isPublished,
4867
5132
  YW: flowNotFound,
5133
+ b$: asksExecutePermission,
4868
5134
  j4: flowPermissions,
4869
5135
  lw: workingCopy
4870
5136
  });
@@ -5161,7 +5427,7 @@ class FlowUrlError extends flow_errors/* .FlowKeyedError */.Hp {
5161
5427
  }
5162
5428
  if (url.protocol !== 'http:' && url.protocol !== 'https:') throw new FlowUrlError(message_keys/* .FLOW_ERROR_MESSAGES.URL_PROTOCOL */.zr.URL_PROTOCOL);
5163
5429
  if (url.username || url.password) throw new FlowUrlError(message_keys/* .FLOW_ERROR_MESSAGES.URL_CREDENTIALS */.zr.URL_CREDENTIALS);
5164
- const host = url.hostname.replace(/^\[|\]$/g, '');
5430
+ const host = url.hostname.replace(/^\[|\]$/g, '').replace(/\.+$/, '');
5165
5431
  if (!allowPrivate) {
5166
5432
  if (host === 'localhost' || host.endsWith('.localhost') || host.endsWith('.internal') || host.endsWith('.local')) {
5167
5433
  throw new FlowUrlError(message_keys/* .FLOW_ERROR_MESSAGES.URL_PRIVATE */.zr.URL_PRIVATE);
@@ -5299,8 +5565,8 @@ const BLOCKED_REQUEST_HEADERS = new Set([
5299
5565
  });
5300
5566
  }
5301
5567
 
5302
- // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/rule-engine/index.ts + 1 modules
5303
- var rule_engine = __webpack_require__(8429);
5568
+ // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/rule-engine/index.ts + 2 modules
5569
+ var rule_engine = __webpack_require__(8552);
5304
5570
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-builder-config.service.ts
5305
5571
  var entity_builder_config_service = __webpack_require__(4281);
5306
5572
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/services/entity-builder-datasource.provider.ts
@@ -5534,7 +5800,7 @@ class FlowExecutorService {
5534
5800
  }, `Flow '${slug}' has no URL '${endpoint ?? ''}'.`);
5535
5801
  }
5536
5802
  await this.assertMayCall(flow, start, parent, env);
5537
- const checked = (0,flow_input_validator/* .validateFlowInput */.v)(start.inputSchema, input, start.bodyType);
5803
+ const checked = (0,flow_input_validator/* .validateEndpointInput */.G)(start, input);
5538
5804
  if (checked.errors.length) {
5539
5805
  throw new flow_errors/* .FlowHttpError */.hk(400, 'Validation failed', checked.errors, {
5540
5806
  messageKey: message_keys/* .FLOW_MESSAGES.INPUT_INVALID */.wu.INPUT_INVALID,
@@ -5776,16 +6042,17 @@ FlowExecutorService = _ts_decorate([
5776
6042
 
5777
6043
  },
5778
6044
  2300(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
5779
- /* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(6157);
5780
- /* import */ var typeorm__rspack_import_1 = __webpack_require__(7158);
5781
- /* import */ var _config_message_keys_js__rspack_import_9 = __webpack_require__(5732);
5782
- /* import */ var _entities_flow_definition_entity_js__rspack_import_2 = __webpack_require__(3770);
5783
- /* import */ var _flow_engine_flow_input_validator_js__rspack_import_3 = __webpack_require__(6390);
5784
- /* import */ var _flow_engine_flow_types_js__rspack_import_4 = __webpack_require__(6256);
5785
- /* import */ var _entity_builder_datasource_provider_js__rspack_import_5 = __webpack_require__(424);
5786
- /* import */ var _flow_definition_service_js__rspack_import_6 = __webpack_require__(5229);
5787
- /* import */ var _flow_execution_service_js__rspack_import_7 = __webpack_require__(7810);
5788
- /* import */ var _flow_executor_service_js__rspack_import_8 = __webpack_require__(3908);
6045
+ /* import */ var _flusys_nestjs_shared_utils__rspack_import_0 = __webpack_require__(9216);
6046
+ /* import */ var _nestjs_common__rspack_import_1 = __webpack_require__(6157);
6047
+ /* import */ var typeorm__rspack_import_2 = __webpack_require__(7158);
6048
+ /* import */ var _config_message_keys_js__rspack_import_10 = __webpack_require__(5732);
6049
+ /* import */ var _entities_flow_definition_entity_js__rspack_import_3 = __webpack_require__(3770);
6050
+ /* import */ var _flow_engine_flow_input_validator_js__rspack_import_4 = __webpack_require__(6390);
6051
+ /* import */ var _flow_engine_flow_types_js__rspack_import_5 = __webpack_require__(6256);
6052
+ /* import */ var _entity_builder_datasource_provider_js__rspack_import_6 = __webpack_require__(424);
6053
+ /* import */ var _flow_definition_service_js__rspack_import_7 = __webpack_require__(5229);
6054
+ /* import */ var _flow_execution_service_js__rspack_import_8 = __webpack_require__(7810);
6055
+ /* import */ var _flow_executor_service_js__rspack_import_9 = __webpack_require__(3908);
5789
6056
  function _ts_decorate(decorators, target, key, desc) {
5790
6057
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5791
6058
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -5819,6 +6086,7 @@ function _ts_param(paramIndex, decorator) {
5819
6086
 
5820
6087
 
5821
6088
 
6089
+
5822
6090
  const HIDDEN_HEADERS = new Set([
5823
6091
  'authorization',
5824
6092
  'cookie',
@@ -5882,7 +6150,7 @@ const inputRejected = (errors)=>({
5882
6150
  body: {
5883
6151
  success: false,
5884
6152
  message: 'Validation failed',
5885
- messageKey: _config_message_keys_js__rspack_import_9/* .FLOW_MESSAGES.INPUT_INVALID */.wu.INPUT_INVALID,
6153
+ messageKey: _config_message_keys_js__rspack_import_10/* .FLOW_MESSAGES.INPUT_INVALID */.wu.INPUT_INVALID,
5886
6154
  errors
5887
6155
  },
5888
6156
  trace: [],
@@ -5900,24 +6168,27 @@ class FlowRuntimeService {
5900
6168
  this.definitions = definitions;
5901
6169
  }
5902
6170
  /** A flow never published is not live yet: it looks the same as an unknown one. */ async findActive(slug) {
5903
- return (await this.provider.getRepository(_entities_flow_definition_entity_js__rspack_import_2/* .FlowDefinition */.G)).findOne({
6171
+ return (await this.provider.getRepository(_entities_flow_definition_entity_js__rspack_import_3/* .FlowDefinition */.G)).findOne({
5904
6172
  where: {
5905
6173
  slug,
5906
6174
  isActive: true,
5907
- deletedAt: (0,typeorm__rspack_import_1.IsNull)(),
5908
- version: (0,typeorm__rspack_import_1.MoreThan)(0)
6175
+ deletedAt: (0,typeorm__rspack_import_2.IsNull)(),
6176
+ version: (0,typeorm__rspack_import_2.MoreThan)(0)
5909
6177
  }
5910
6178
  });
5911
6179
  }
6180
+ /** The tenant of this request ('' for a single database): tenant databases cloned from one template share flow ids. */ tenantScope() {
6181
+ return (0,_flusys_nestjs_shared_utils__rspack_import_0.cacheTenantId)(this.provider) ?? '';
6182
+ }
5912
6183
  /** The public entry: a caller hit `POST api-flows/:slug` or `POST api-flows/:slug/:endpoint`. */ async handle(flow, endpoint, body, caller, user) {
5913
6184
  const startedAt = new Date();
5914
- const checked = (0,_flow_engine_flow_input_validator_js__rspack_import_3/* .validateFlowInput */.v)(endpoint.inputSchema, body, endpoint.bodyType);
6185
+ const checked = (0,_flow_engine_flow_input_validator_js__rspack_import_4/* .validateEndpointInput */.G)(endpoint, body);
5915
6186
  if (checked.errors.length) {
5916
6187
  const result = inputRejected(checked.errors);
5917
6188
  await this.logWebhook(flow, endpoint, body, result, startedAt, user, caller);
5918
6189
  return result;
5919
6190
  }
5920
- const result = await this.executor.run((0,_flow_definition_service_js__rspack_import_6/* .toFlowSettings */.RK)(flow), {
6191
+ const result = await this.executor.run((0,_flow_definition_service_js__rspack_import_7/* .toFlowSettings */.RK)(flow), {
5921
6192
  mode: 'live',
5922
6193
  user,
5923
6194
  input: checked.values,
@@ -5937,17 +6208,17 @@ class FlowRuntimeService {
5937
6208
  }
5938
6209
  if (dto.definition) {
5939
6210
  // The designer's current draft, even for a saved flow: `flow` above is kept only to attribute the run.
5940
- settings = (0,_flow_definition_service_js__rspack_import_6/* .toFlowSettings */.RK)(dto.definition);
6211
+ settings = (0,_flow_definition_service_js__rspack_import_7/* .toFlowSettings */.RK)(dto.definition);
5941
6212
  } else if (flow) {
5942
- settings = (0,_flow_definition_service_js__rspack_import_6/* .toFlowSettings */.RK)(flow);
6213
+ settings = (0,_flow_definition_service_js__rspack_import_7/* .toFlowSettings */.RK)(flow);
5943
6214
  } else {
5944
- throw new _nestjs_common__rspack_import_0.BadRequestException({
6215
+ throw new _nestjs_common__rspack_import_1.BadRequestException({
5945
6216
  message: 'Send a flowId or a definition to test.',
5946
- messageKey: _config_message_keys_js__rspack_import_9/* .FLOW_MESSAGES.NOTHING_TO_TEST */.wu.NOTHING_TO_TEST
6217
+ messageKey: _config_message_keys_js__rspack_import_10/* .FLOW_MESSAGES.NOTHING_TO_TEST */.wu.NOTHING_TO_TEST
5947
6218
  });
5948
6219
  }
5949
6220
  const mode = dto.mode ?? 'dry_run';
5950
- const endpoint = (0,_flow_engine_flow_types_js__rspack_import_4/* .findEndpoint */.vS)(settings, dto.endpoint);
6221
+ const endpoint = (0,_flow_engine_flow_types_js__rspack_import_5/* .findEndpoint */.vS)(settings, dto.endpoint);
5951
6222
  // Checked before anything runs.
5952
6223
  await this.definitions.assertMayTest(settings, endpoint, user, {
5953
6224
  mode,
@@ -5955,9 +6226,9 @@ class FlowRuntimeService {
5955
6226
  saved: !!flow
5956
6227
  });
5957
6228
  if (!endpoint) {
5958
- throw new _nestjs_common__rspack_import_0.BadRequestException({
6229
+ throw new _nestjs_common__rspack_import_1.BadRequestException({
5959
6230
  message: `This flow has no URL '${dto.endpoint ?? ''}'.`,
5960
- messageKey: _config_message_keys_js__rspack_import_9/* .FLOW_MESSAGES.ENDPOINT_NOT_FOUND */.wu.ENDPOINT_NOT_FOUND,
6231
+ messageKey: _config_message_keys_js__rspack_import_10/* .FLOW_MESSAGES.ENDPOINT_NOT_FOUND */.wu.ENDPOINT_NOT_FOUND,
5961
6232
  messageVariables: {
5962
6233
  endpoint: dto.endpoint ?? ''
5963
6234
  }
@@ -5965,9 +6236,9 @@ class FlowRuntimeService {
5965
6236
  }
5966
6237
  const validation = await this.definitions.validate(settings);
5967
6238
  if (validation.errors.length) {
5968
- throw new _nestjs_common__rspack_import_0.BadRequestException({
6239
+ throw new _nestjs_common__rspack_import_1.BadRequestException({
5969
6240
  message: 'The flow has problems.',
5970
- messageKey: _config_message_keys_js__rspack_import_9/* .FLOW_MESSAGES.INVALID */.wu.INVALID,
6241
+ messageKey: _config_message_keys_js__rspack_import_10/* .FLOW_MESSAGES.INVALID */.wu.INVALID,
5971
6242
  errors: validation.errors.map((error)=>({
5972
6243
  field: 'flow',
5973
6244
  ...error
@@ -5977,7 +6248,7 @@ class FlowRuntimeService {
5977
6248
  const startedAt = new Date();
5978
6249
  const simulated = simulatedCaller(caller, dto.request);
5979
6250
  const body = dto.input ?? (endpoint.bodyType === 'list' ? [] : {});
5980
- const checked = (0,_flow_engine_flow_input_validator_js__rspack_import_3/* .validateFlowInput */.v)(endpoint.inputSchema, body, endpoint.bodyType);
6251
+ const checked = (0,_flow_engine_flow_input_validator_js__rspack_import_4/* .validateEndpointInput */.G)(endpoint, body);
5981
6252
  const result = checked.errors.length ? inputRejected(checked.errors) : await this.executor.run(settings, {
5982
6253
  mode,
5983
6254
  user,
@@ -6024,19 +6295,19 @@ class FlowRuntimeService {
6024
6295
  }
6025
6296
  }
6026
6297
  FlowRuntimeService = _ts_decorate([
6027
- (0,_nestjs_common__rspack_import_0.Injectable)({
6028
- scope: _nestjs_common__rspack_import_0.Scope.REQUEST
6298
+ (0,_nestjs_common__rspack_import_1.Injectable)({
6299
+ scope: _nestjs_common__rspack_import_1.Scope.REQUEST
6029
6300
  }),
6030
- _ts_param(0, (0,_nestjs_common__rspack_import_0.Inject)(_entity_builder_datasource_provider_js__rspack_import_5/* .EntityBuilderDataSourceProvider */.D)),
6031
- _ts_param(1, (0,_nestjs_common__rspack_import_0.Inject)(_flow_executor_service_js__rspack_import_8/* .FlowExecutorService */.F)),
6032
- _ts_param(2, (0,_nestjs_common__rspack_import_0.Inject)(_flow_execution_service_js__rspack_import_7/* .FlowExecutionService */.A)),
6033
- _ts_param(3, (0,_nestjs_common__rspack_import_0.Inject)(_flow_definition_service_js__rspack_import_6/* .FlowDefinitionService */.Tk)),
6301
+ _ts_param(0, (0,_nestjs_common__rspack_import_1.Inject)(_entity_builder_datasource_provider_js__rspack_import_6/* .EntityBuilderDataSourceProvider */.D)),
6302
+ _ts_param(1, (0,_nestjs_common__rspack_import_1.Inject)(_flow_executor_service_js__rspack_import_9/* .FlowExecutorService */.F)),
6303
+ _ts_param(2, (0,_nestjs_common__rspack_import_1.Inject)(_flow_execution_service_js__rspack_import_8/* .FlowExecutionService */.A)),
6304
+ _ts_param(3, (0,_nestjs_common__rspack_import_1.Inject)(_flow_definition_service_js__rspack_import_7/* .FlowDefinitionService */.Tk)),
6034
6305
  _ts_metadata("design:type", Function),
6035
6306
  _ts_metadata("design:paramtypes", [
6036
- typeof _entity_builder_datasource_provider_js__rspack_import_5/* .EntityBuilderDataSourceProvider */.D === "undefined" ? Object : _entity_builder_datasource_provider_js__rspack_import_5/* .EntityBuilderDataSourceProvider */.D,
6037
- typeof _flow_executor_service_js__rspack_import_8/* .FlowExecutorService */.F === "undefined" ? Object : _flow_executor_service_js__rspack_import_8/* .FlowExecutorService */.F,
6038
- typeof _flow_execution_service_js__rspack_import_7/* .FlowExecutionService */.A === "undefined" ? Object : _flow_execution_service_js__rspack_import_7/* .FlowExecutionService */.A,
6039
- typeof _flow_definition_service_js__rspack_import_6/* .FlowDefinitionService */.Tk === "undefined" ? Object : _flow_definition_service_js__rspack_import_6/* .FlowDefinitionService */.Tk
6307
+ typeof _entity_builder_datasource_provider_js__rspack_import_6/* .EntityBuilderDataSourceProvider */.D === "undefined" ? Object : _entity_builder_datasource_provider_js__rspack_import_6/* .EntityBuilderDataSourceProvider */.D,
6308
+ typeof _flow_executor_service_js__rspack_import_9/* .FlowExecutorService */.F === "undefined" ? Object : _flow_executor_service_js__rspack_import_9/* .FlowExecutorService */.F,
6309
+ typeof _flow_execution_service_js__rspack_import_8/* .FlowExecutionService */.A === "undefined" ? Object : _flow_execution_service_js__rspack_import_8/* .FlowExecutionService */.A,
6310
+ typeof _flow_definition_service_js__rspack_import_7/* .FlowDefinitionService */.Tk === "undefined" ? Object : _flow_definition_service_js__rspack_import_7/* .FlowDefinitionService */.Tk
6040
6311
  ])
6041
6312
  ], FlowRuntimeService);
6042
6313
 
@@ -6156,9 +6427,9 @@ __webpack_require__.d(__webpack_exports__, {
6156
6427
  /* import */ var _flusys_nestjs_shared_utils__rspack_import_1 = __webpack_require__(9216);
6157
6428
  /* import */ var _nestjs_common__rspack_import_2 = __webpack_require__(6157);
6158
6429
  /* import */ var _config_event_actions_js__rspack_import_10 = __webpack_require__(982);
6159
- /* import */ var _config_message_keys_js__rspack_import_7 = __webpack_require__(5732);
6430
+ /* import */ var _config_message_keys_js__rspack_import_8 = __webpack_require__(5732);
6160
6431
  /* import */ var _enums_entity_status_enum_js__rspack_import_9 = __webpack_require__(1313);
6161
- /* import */ var _enums_field_type_enum_js__rspack_import_8 = __webpack_require__(9614);
6432
+ /* import */ var _enums_field_type_enum_js__rspack_import_7 = __webpack_require__(9614);
6162
6433
  /* import */ var _interfaces_generic_record_interface_js__rspack_import_3 = __webpack_require__(3372);
6163
6434
  /* import */ var _database_error_mapper_js__rspack_import_4 = __webpack_require__(8323);
6164
6435
  /* import */ var _field_value_validator_js__rspack_import_5 = __webpack_require__(3525);
@@ -6190,6 +6461,18 @@ const FILTER_COMPARISON_SQL = {
6190
6461
  lt: '<',
6191
6462
  lte: '<='
6192
6463
  };
6464
+ /** The LIKE pattern of each text-match operator, built from the already escaped text. */ const TEXT_PATTERN = {
6465
+ contains: (t)=>`%${t}%`,
6466
+ not_contains: (t)=>`%${t}%`,
6467
+ starts_with: (t)=>`${t}%`,
6468
+ ends_with: (t)=>`%${t}`
6469
+ };
6470
+ const TEXT_FIELD_TYPES = new Set([
6471
+ _enums_field_type_enum_js__rspack_import_7/* .FieldType.TEXT */.P.TEXT,
6472
+ _enums_field_type_enum_js__rspack_import_7/* .FieldType.LONG_TEXT */.P.LONG_TEXT,
6473
+ _enums_field_type_enum_js__rspack_import_7/* .FieldType.EMAIL */.P.EMAIL,
6474
+ _enums_field_type_enum_js__rspack_import_7/* .FieldType.SINGLE_SELECT */.P.SINGLE_SELECT
6475
+ ]);
6193
6476
  /**
6194
6477
  * Generic CRUD for one dynamically-defined entity, mirroring ApiService's shape
6195
6478
  * (transactional writes, lifecycle event publishing) but
@@ -6241,7 +6524,7 @@ const FILTER_COMPARISON_SQL = {
6241
6524
  if (errors.length === 0) return;
6242
6525
  throw new _nestjs_common__rspack_import_2.BadRequestException({
6243
6526
  message: 'Validation failed',
6244
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.VALIDATION_FAILED */.j4.VALIDATION_FAILED,
6527
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.VALIDATION_FAILED */.j4.VALIDATION_FAILED,
6245
6528
  errors
6246
6529
  });
6247
6530
  }
@@ -6250,14 +6533,14 @@ const FILTER_COMPARISON_SQL = {
6250
6533
  const errors = [];
6251
6534
  for (const field of this.fields){
6252
6535
  const value = values[field.code];
6253
- if (field.fieldType !== _enums_field_type_enum_js__rspack_import_8/* .FieldType.RELATION */.P.RELATION || !field.relationTargetEntityId || typeof value !== 'string') continue;
6536
+ if (field.fieldType !== _enums_field_type_enum_js__rspack_import_7/* .FieldType.RELATION */.P.RELATION || !field.relationTargetEntityId || typeof value !== 'string') continue;
6254
6537
  const related = await this.resolveRelated(field.relationTargetEntityId, queryRunner);
6255
6538
  const found = await related.exists(value, {
6256
6539
  queryRunner
6257
6540
  });
6258
6541
  if (!found) errors.push({
6259
6542
  field: field.code,
6260
- ...(0,_flusys_nestjs_shared_utils__rspack_import_1.messageRef)(_config_message_keys_js__rspack_import_7/* .FIELD_VALIDATION_MESSAGES.RELATED_NOT_FOUND */.KE.RELATED_NOT_FOUND, {
6543
+ ...(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
6544
  label: field.label
6262
6545
  })
6263
6546
  });
@@ -6267,7 +6550,7 @@ const FILTER_COMPARISON_SQL = {
6267
6550
  notFound(id) {
6268
6551
  return new _nestjs_common__rspack_import_2.NotFoundException({
6269
6552
  message: `Record '${id}' not found on entity '${this.entityCode}'.`,
6270
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.NOT_FOUND */.j4.NOT_FOUND,
6553
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.NOT_FOUND */.j4.NOT_FOUND,
6271
6554
  messageVariables: {
6272
6555
  id,
6273
6556
  entity: this.entityCode
@@ -6295,7 +6578,7 @@ const FILTER_COMPARISON_SQL = {
6295
6578
  if (this.definition.status === _enums_entity_status_enum_js__rspack_import_9/* .EntityStatus.DEPRECATED */.c.DEPRECATED) {
6296
6579
  throw new _nestjs_common__rspack_import_2.ForbiddenException({
6297
6580
  message: `Entity '${this.definition.code}' has been deprecated and no longer accepts writes.`,
6298
- messageKey: _config_message_keys_js__rspack_import_7/* .ENTITY_DEFINITION_MESSAGES.DEPRECATED */.pL.DEPRECATED,
6581
+ messageKey: _config_message_keys_js__rspack_import_8/* .ENTITY_DEFINITION_MESSAGES.DEPRECATED */.pL.DEPRECATED,
6299
6582
  messageVariables: {
6300
6583
  code: this.definition.code
6301
6584
  }
@@ -6323,7 +6606,7 @@ const FILTER_COMPARISON_SQL = {
6323
6606
  if (SYSTEM_COLUMNS.has(key)) {
6324
6607
  throw new _nestjs_common__rspack_import_2.BadRequestException({
6325
6608
  message: `'${key}' is a system column and cannot be set directly.`,
6326
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.SYSTEM_COLUMN_READONLY */.j4.SYSTEM_COLUMN_READONLY,
6609
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.SYSTEM_COLUMN_READONLY */.j4.SYSTEM_COLUMN_READONLY,
6327
6610
  messageVariables: {
6328
6611
  key
6329
6612
  }
@@ -6332,7 +6615,7 @@ const FILTER_COMPARISON_SQL = {
6332
6615
  if (!this.activeFieldCodes.has(key)) {
6333
6616
  throw new _nestjs_common__rspack_import_2.BadRequestException({
6334
6617
  message: `'${key}' is not a field on entity '${this.entityCode}'.`,
6335
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.UNKNOWN_FIELD */.j4.UNKNOWN_FIELD,
6618
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.UNKNOWN_FIELD */.j4.UNKNOWN_FIELD,
6336
6619
  messageVariables: {
6337
6620
  key,
6338
6621
  entity: this.entityCode
@@ -6405,7 +6688,7 @@ const FILTER_COMPARISON_SQL = {
6405
6688
  if (!dto.id) {
6406
6689
  throw new _nestjs_common__rspack_import_2.BadRequestException({
6407
6690
  message: 'id is required to update a record.',
6408
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.ID_REQUIRED */.j4.ID_REQUIRED
6691
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.ID_REQUIRED */.j4.ID_REQUIRED
6409
6692
  });
6410
6693
  }
6411
6694
  const { id: _id, ...rest } = dto;
@@ -6470,6 +6753,7 @@ const FILTER_COMPARISON_SQL = {
6470
6753
  async getAll(search, query, options = {}) {
6471
6754
  const repository = await this.repositoryFor(options.queryRunner);
6472
6755
  let builder = repository.createQueryBuilder(this.entityCode);
6756
+ if (query.withDeleted) builder.withDeleted();
6473
6757
  if (query.filter) {
6474
6758
  builder = this.applyFilter(builder, query.filter);
6475
6759
  }
@@ -6494,55 +6778,177 @@ const FILTER_COMPARISON_SQL = {
6494
6778
  * getFilterQuery/getSortQuery (raw client-supplied keys concatenated into SQL) is
6495
6779
  * structurally impossible here since an unknown key is rejected outright. Operators map
6496
6780
  * to a fixed SQL table and every value is a bound parameter. */ applyFilter(query, filter) {
6781
+ const postgres = query.connection.options.type === 'postgres';
6497
6782
  Object.entries(filter).forEach(([key, value], index)=>{
6498
6783
  this.assertKnownColumn(key);
6499
- const column = `${this.entityCode}.${key}`;
6500
- const param = `filter_${index}`;
6501
- if (!(0,_interfaces_generic_record_interface_js__rspack_import_3/* .isRecordFilterCondition */.t1)(value)) {
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;
6511
- }
6512
- const { op, value: operand } = value;
6513
- if (op === 'is_null' || op === 'not_null') {
6514
- query.andWhere(`${column} ${op === 'is_null' ? 'IS NULL' : 'IS NOT NULL'}`);
6515
- return;
6784
+ if (!(0,_interfaces_generic_record_interface_js__rspack_import_3/* .isRecordFilterCondition */.t1)(value) && value !== null && typeof value === 'object') {
6785
+ const op = value.op;
6786
+ 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);
6516
6787
  }
6517
- if (op === 'in') {
6518
- if (!Array.isArray(operand) || !operand.every(isFilterScalar)) throw this.invalidFilterValue(key, op);
6519
- if (operand.length > _interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_LIMITS.MAX_IN_VALUES */.M5.MAX_IN_VALUES) {
6520
- throw new _nestjs_common__rspack_import_2.BadRequestException({
6521
- 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.`,
6522
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.FILTER_TOO_MANY_VALUES */.j4.FILTER_TOO_MANY_VALUES,
6523
- messageVariables: {
6524
- key,
6525
- max: _interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_LIMITS.MAX_IN_VALUES */.M5.MAX_IN_VALUES
6788
+ const { op, value: operand } = (0,_interfaces_generic_record_interface_js__rspack_import_3/* .isRecordFilterCondition */.t1)(value) ? value : {
6789
+ op: 'eq',
6790
+ value
6791
+ };
6792
+ this.assertOperatorFits(key, op);
6793
+ const [sql, params] = this.conditionSql(`${this.entityCode}.${key}`, key, op, operand, `filter_${index}`, postgres);
6794
+ query.andWhere(sql, params);
6795
+ });
6796
+ return query;
6797
+ }
6798
+ /** 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) {
6799
+ const multiSelect = this.fieldTypeOf(key) === _enums_field_type_enum_js__rspack_import_7/* .FieldType.MULTI_SELECT */.P.MULTI_SELECT;
6800
+ switch(_interfaces_generic_record_interface_js__rspack_import_3/* .FILTER_OP_VALUE_KIND */.w9[op]){
6801
+ case 'none':
6802
+ if (op === 'is_null') return [
6803
+ `${column} IS NULL`,
6804
+ {}
6805
+ ];
6806
+ if (op === 'not_null') return [
6807
+ `${column} IS NOT NULL`,
6808
+ {}
6809
+ ];
6810
+ if (!multiSelect) return [
6811
+ op === 'is_empty' ? `(${column} IS NULL OR ${column} = '')` : `(${column} IS NOT NULL AND ${column} <> '')`,
6812
+ {}
6813
+ ];
6814
+ if (postgres) return [
6815
+ op === 'is_empty' ? `(${column} IS NULL OR ${column} = '[]'::jsonb)` : `(${column} IS NOT NULL AND ${column} <> '[]'::jsonb)`,
6816
+ {}
6817
+ ];
6818
+ return [
6819
+ op === 'is_empty' ? `(${column} IS NULL OR JSON_LENGTH(${column}) = 0)` : `JSON_LENGTH(${column}) > 0`,
6820
+ {}
6821
+ ];
6822
+ case 'list':
6823
+ {
6824
+ const values = this.listOperand(key, op, operand);
6825
+ if (op === 'in') return values.length ? [
6826
+ `${column} IN (:...${param})`,
6827
+ {
6828
+ [param]: values
6526
6829
  }
6527
- });
6830
+ ] : [
6831
+ '1 = 0',
6832
+ {}
6833
+ ];
6834
+ if (op === 'not_in') return values.length ? [
6835
+ `${column} NOT IN (:...${param})`,
6836
+ {
6837
+ [param]: values
6838
+ }
6839
+ ] : [
6840
+ '1 = 1',
6841
+ {}
6842
+ ];
6843
+ const holds = (list, name)=>[
6844
+ postgres ? `${column} @> CAST(:${name} AS jsonb)` : `JSON_CONTAINS(${column}, CAST(:${name} AS JSON))`,
6845
+ {
6846
+ [name]: JSON.stringify(list)
6847
+ }
6848
+ ];
6849
+ if (op === 'has_all') return values.length ? holds(values, param) : [
6850
+ '1 = 1',
6851
+ {}
6852
+ ];
6853
+ if (!values.length) return [
6854
+ op === 'has_any' ? '1 = 0' : '1 = 1',
6855
+ {}
6856
+ ];
6857
+ const each = values.map((v, i)=>holds([
6858
+ v
6859
+ ], `${param}_${i}`));
6860
+ const any = `(${each.map(([sql])=>sql).join(' OR ')})`;
6861
+ return [
6862
+ op === 'has_any' ? any : `NOT ${any}`,
6863
+ Object.assign({}, ...each.map(([, params])=>params))
6864
+ ];
6865
+ }
6866
+ case 'range':
6867
+ {
6868
+ if (!Array.isArray(operand) || operand.length !== 2 || !operand.every(isFilterScalar)) throw this.invalidFilterValue(key, op);
6869
+ const [from, to] = [
6870
+ `${param}_from`,
6871
+ `${param}_to`
6872
+ ];
6873
+ return [
6874
+ `${column} ${op === 'between' ? 'BETWEEN' : 'NOT BETWEEN'} :${from} AND :${to}`,
6875
+ {
6876
+ [from]: operand[0],
6877
+ [to]: operand[1]
6878
+ }
6879
+ ];
6880
+ }
6881
+ case 'single':
6882
+ {
6883
+ if (operand === null && (op === 'eq' || op === 'ne')) return [
6884
+ `${column} IS ${op === 'eq' ? '' : 'NOT '}NULL`,
6885
+ {}
6886
+ ];
6887
+ if (operand === null || operand === undefined || !isFilterScalar(operand)) throw this.invalidFilterValue(key, op);
6888
+ if (op === 'ieq') return [
6889
+ `LOWER(${column}) = LOWER(:${param})`,
6890
+ {
6891
+ [param]: String(operand)
6892
+ }
6893
+ ];
6894
+ const pattern = TEXT_PATTERN[op];
6895
+ if (!pattern) return [
6896
+ `${column} ${FILTER_COMPARISON_SQL[op]} :${param}`,
6897
+ {
6898
+ [param]: operand
6899
+ }
6900
+ ];
6901
+ const text = String(operand);
6902
+ if (!text.trim()) throw this.invalidFilterValue(key, op);
6903
+ const like = `${op === 'not_contains' ? 'NOT ' : ''}${postgres ? 'ILIKE' : 'LIKE'}`;
6904
+ return [
6905
+ `${column} ${like} :${param}`,
6906
+ {
6907
+ [param]: pattern(text.replace(/[\\%_]/g, '\\$&'))
6908
+ }
6909
+ ];
6910
+ }
6911
+ }
6912
+ }
6913
+ /** A list of scalars; one scalar (e.g. a single value read from input) counts as a one-item list. */ listOperand(key, op, operand) {
6914
+ const list = isFilterScalar(operand) ? [
6915
+ operand
6916
+ ] : operand;
6917
+ if (!Array.isArray(list) || !list.every(isFilterScalar)) throw this.invalidFilterValue(key, op);
6918
+ if (list.length > _interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_LIMITS.MAX_IN_VALUES */.M5.MAX_IN_VALUES) {
6919
+ throw new _nestjs_common__rspack_import_2.BadRequestException({
6920
+ 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.`,
6921
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_TOO_MANY_VALUES */.j4.FILTER_TOO_MANY_VALUES,
6922
+ messageVariables: {
6923
+ key,
6924
+ max: _interfaces_generic_record_interface_js__rspack_import_3/* .RECORD_FILTER_LIMITS.MAX_IN_VALUES */.M5.MAX_IN_VALUES
6528
6925
  }
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
6926
  });
6539
- });
6540
- return query;
6927
+ }
6928
+ return list;
6929
+ }
6930
+ fieldTypeOf(key) {
6931
+ return this.fields.find((f)=>f.code === key && !f.deprecatedAt && !f.isSystemField)?.fieldType;
6932
+ }
6933
+ /** 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) {
6934
+ const type = this.fieldTypeOf(key);
6935
+ const textField = type !== undefined && TEXT_FIELD_TYPES.has(type);
6936
+ 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;
6937
+ if (!fits) {
6938
+ throw new _nestjs_common__rspack_import_2.BadRequestException({
6939
+ message: `The '${op}' filter cannot be used on '${key}'.`,
6940
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_OPERATOR_NOT_FOR_FIELD */.j4.FILTER_OPERATOR_NOT_FOR_FIELD,
6941
+ messageVariables: {
6942
+ key,
6943
+ op
6944
+ }
6945
+ });
6946
+ }
6541
6947
  }
6542
6948
  unknownOperator(key, op) {
6543
6949
  return new _nestjs_common__rspack_import_2.BadRequestException({
6544
6950
  message: `'${op}' is not a filter operator.`,
6545
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.FILTER_OPERATOR_UNKNOWN */.j4.FILTER_OPERATOR_UNKNOWN,
6951
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_OPERATOR_UNKNOWN */.j4.FILTER_OPERATOR_UNKNOWN,
6546
6952
  messageVariables: {
6547
6953
  key,
6548
6954
  op,
@@ -6552,8 +6958,8 @@ const FILTER_COMPARISON_SQL = {
6552
6958
  }
6553
6959
  invalidFilterValue(key, op) {
6554
6960
  return new _nestjs_common__rspack_import_2.BadRequestException({
6555
- message: op === 'in' ? `The '${key}' filter needs a list of values.` : `The '${key}' filter needs a single value.`,
6556
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.FILTER_VALUE_INVALID */.j4.FILTER_VALUE_INVALID,
6961
+ message: `The '${key}' filter has an invalid value for '${op}'.`,
6962
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.FILTER_VALUE_INVALID */.j4.FILTER_VALUE_INVALID,
6557
6963
  messageVariables: {
6558
6964
  key,
6559
6965
  op
@@ -6582,7 +6988,7 @@ const FILTER_COMPARISON_SQL = {
6582
6988
  if (key !== 'id' && !this.presentSystemColumns.has(key) && !this.activeFieldCodes.has(key)) {
6583
6989
  throw new _nestjs_common__rspack_import_2.BadRequestException({
6584
6990
  message: `'${key}' is not a field on entity '${this.entityCode}'.`,
6585
- messageKey: _config_message_keys_js__rspack_import_7/* .GENERIC_RECORD_MESSAGES.UNKNOWN_FIELD */.j4.UNKNOWN_FIELD,
6991
+ messageKey: _config_message_keys_js__rspack_import_8/* .GENERIC_RECORD_MESSAGES.UNKNOWN_FIELD */.j4.UNKNOWN_FIELD,
6586
6992
  messageVariables: {
6587
6993
  key,
6588
6994
  entity: this.entityCode
@@ -6790,6 +7196,23 @@ class SchemaDialectAdapterService {
6790
7196
  });
6791
7197
  }
6792
7198
  }
7199
+ /** Takes `lockKey` for the connection's session (it outlives any transaction) without waiting: false when another session holds it. */ async tryAcquireSessionLock(queryRunner, lockKey, driver) {
7200
+ const rows = driver === 'postgres' ? await queryRunner.query('SELECT pg_try_advisory_lock(hashtext($1)) AS acquired', [
7201
+ lockKey
7202
+ ]) : await queryRunner.query('SELECT GET_LOCK(?, 0) AS acquired', [
7203
+ this.lockName(lockKey)
7204
+ ]);
7205
+ const acquired = rows?.[0]?.acquired;
7206
+ return acquired === true || Number(acquired) === 1;
7207
+ }
7208
+ /** Must run before the connection goes back to the pool, or the lock stays with it. */ async releaseSessionLock(queryRunner, lockKey, driver) {
7209
+ if (driver === 'postgres') await queryRunner.query('SELECT pg_advisory_unlock(hashtext($1))', [
7210
+ lockKey
7211
+ ]);
7212
+ else await queryRunner.query('SELECT RELEASE_LOCK(?)', [
7213
+ this.lockName(lockKey)
7214
+ ]);
7215
+ }
6793
7216
  async releaseEntityLock(queryRunner, lockKey, driver) {
6794
7217
  if (driver === 'postgres') {
6795
7218
  // pg_advisory_xact_lock is transaction-scoped - released automatically on commit/rollback.
@@ -6870,7 +7293,10 @@ class SchemaRegistryService {
6870
7293
  id: entityDefinitionId
6871
7294
  }
6872
7295
  });
7296
+ const cacheKey = this.cacheKey(entityDefinitionId);
6873
7297
  if (!definition) {
7298
+ // Dropped, possibly on another instance: its schema is never asked for again.
7299
+ SchemaRegistryService.cache.delete(cacheKey);
6874
7300
  throw new _nestjs_common__rspack_import_1.NotFoundException({
6875
7301
  message: `Entity definition '${entityDefinitionId}' not found.`,
6876
7302
  messageKey: _config_message_keys_js__rspack_import_8/* .ENTITY_DEFINITION_MESSAGES.NOT_FOUND */.pL.NOT_FOUND,
@@ -6879,7 +7305,6 @@ class SchemaRegistryService {
6879
7305
  }
6880
7306
  });
6881
7307
  }
6882
- const cacheKey = this.cacheKey(entityDefinitionId);
6883
7308
  const cached = SchemaRegistryService.cache.get(cacheKey);
6884
7309
  if (cached && cached.version === definition.schemaVersion) {
6885
7310
  return cached.schema;