@flusys/nestjs-entity-builder 9.1.0-rc.1 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +52 -23
  2. package/config/entity-builder.constants.d.ts +2 -0
  3. package/config/message-keys.d.ts +102 -13
  4. package/controllers/definition-bundle.controller.d.ts +15 -0
  5. package/controllers/flow-definition.controller.d.ts +7 -1
  6. package/controllers/flow-runtime.controller.d.ts +16 -8
  7. package/controllers/index.d.ts +1 -1
  8. package/dtos/definition-bundle.dto.d.ts +57 -0
  9. package/dtos/flow.dto.d.ts +13 -20
  10. package/dtos/index.d.ts +1 -0
  11. package/entities/flow-definition.entity.d.ts +3 -9
  12. package/entities/flow-execution.entity.d.ts +3 -0
  13. package/entities/flow-version.entity.d.ts +10 -0
  14. package/entities/index.d.ts +3 -3
  15. package/fesm/21.js +105 -15
  16. package/fesm/458.js +695 -0
  17. package/fesm/{489.js → 582.js} +22 -30
  18. package/fesm/{996.js → 677.js} +1562 -1064
  19. package/fesm/794.js +135 -240
  20. package/fesm/{719.js → 870.js} +2065 -324
  21. package/fesm/{362.js → 897.js} +572 -8
  22. package/fesm/{606.js → 946.js} +621 -296
  23. package/fesm/config/index.js +15 -2
  24. package/fesm/controllers/index.js +9 -9
  25. package/fesm/docs/index.js +7 -4
  26. package/fesm/dtos/index.js +451 -256
  27. package/fesm/entities/index.js +58 -3
  28. package/fesm/guards/index.js +106 -22
  29. package/fesm/index.js +429 -937
  30. package/fesm/interfaces/index.js +19 -2
  31. package/fesm/modules/index.js +10 -627
  32. package/fesm/rule-engine/index.js +12 -3
  33. package/fesm/services/index.js +101 -29
  34. package/flow-engine/flow-api-key.d.ts +3 -7
  35. package/flow-engine/flow-graph.validator.d.ts +5 -4
  36. package/flow-engine/flow-permission-logic.d.ts +2 -0
  37. package/flow-engine/flow-run.types.d.ts +19 -9
  38. package/flow-engine/flow.types.d.ts +115 -11
  39. package/guards/designer-writable.interceptor.d.ts +12 -0
  40. package/guards/index.d.ts +1 -0
  41. package/interfaces/definition-bundle.interface.d.ts +111 -0
  42. package/interfaces/entity-builder-module.interface.d.ts +6 -0
  43. package/interfaces/flow-definition.interface.d.ts +13 -9
  44. package/interfaces/index.d.ts +1 -0
  45. package/package.json +5 -5
  46. package/rule-engine/rule-engine.service.d.ts +1 -0
  47. package/rule-engine/rule-permission.d.ts +3 -7
  48. package/services/definition-bundle.diff.d.ts +62 -0
  49. package/services/definition-bundle.file.d.ts +7 -0
  50. package/services/definition-bundle.service.d.ts +32 -0
  51. package/services/entity-builder-config.service.d.ts +2 -0
  52. package/services/entity-flow-scaffold.d.ts +4 -3
  53. package/services/flow-definition.service.d.ts +26 -12
  54. package/services/flow-execution.service.d.ts +7 -0
  55. package/services/flow-executor.service.d.ts +9 -8
  56. package/services/flow-runtime.service.d.ts +2 -1
  57. package/services/generic-entity.service.d.ts +1 -1
  58. package/services/index.d.ts +3 -1
  59. package/services/schema-evolution.service.d.ts +3 -1
  60. package/services/schema-sync.service.d.ts +6 -2
  61. package/controllers/flow-api-key.controller.d.ts +0 -14
  62. package/entities/flow-api-key.entity.d.ts +0 -10
  63. package/services/flow-api-key.service.d.ts +0 -31
@@ -1,13 +1,11 @@
1
- import * as __rspack_external__flusys_nestjs_shared_exceptions_3edf22e9 from "@flusys/nestjs-shared/exceptions";
1
+ import { RE2JS } from "re2js";
2
+ import * as __rspack_external__flusys_nestjs_shared_interfaces_413f2706 from "@flusys/nestjs-shared/interfaces";
2
3
  import * as __rspack_external__flusys_nestjs_shared_modules_24702bee from "@flusys/nestjs-shared/modules";
3
4
  import * as __rspack_external__flusys_nestjs_shared_utils_9125c1f1 from "@flusys/nestjs-shared/utils";
4
5
  import * as __rspack_external__nestjs_common_a04939da from "@nestjs/common";
5
- import * as __rspack_external_node_crypto_2e7c4b46 from "node:crypto";
6
6
  import * as __rspack_external_node_net_5ed819e1 from "node:net";
7
- import * as __rspack_external__flusys_nestjs_shared_interfaces_413f2706 from "@flusys/nestjs-shared/interfaces";
8
- import * as __rspack_external_re2js from "re2js";
9
- export const __rspack_esm_id = 489;
10
- export const __rspack_esm_ids = [489];
7
+ export const __rspack_esm_id = 582;
8
+ export const __rspack_esm_ids = [582];
11
9
  export const __webpack_modules__ = {
12
10
  3372(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
13
11
  const RECORD_FILTER_OPS = [
@@ -47,7 +45,7 @@ __webpack_require__.d(__webpack_exports__, {
47
45
 
48
46
 
49
47
  },
50
- 5920(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
48
+ 8429(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
51
49
 
52
50
  // EXPORTS
53
51
  __webpack_require__.d(__webpack_exports__, {
@@ -64,8 +62,8 @@ __webpack_require__.d(__webpack_exports__, {
64
62
 
65
63
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/rule-engine/rule.interface.ts
66
64
  var rule_interface = __webpack_require__(2354);
67
- ;// CONCATENATED MODULE: external "@flusys/nestjs-shared/interfaces"
68
-
65
+ // EXTERNAL MODULE: external "@flusys/nestjs-shared/interfaces"
66
+ var interfaces_ = __webpack_require__(5103);
69
67
  // EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
70
68
  var modules_ = __webpack_require__(1236);
71
69
  // EXTERNAL MODULE: external "@flusys/nestjs-shared/utils"
@@ -267,6 +265,9 @@ class RuleEngineService {
267
265
  return this.resolveLookup(expression, ctx, budget);
268
266
  }
269
267
  }
268
+ /** For HTML the author writes: the values a template fills in are escaped; any other expression is taken as the HTML it resolves to. */ async resolveHtml(expression, ctx) {
269
+ return expression.type === 'template' ? this.resolveTemplate(expression.template, ctx, utils_.escapeHtml) : this.resolveExpression(expression, ctx);
270
+ }
270
271
  async resolveLookup(expression, ctx, budget) {
271
272
  if (!ctx.lookupResolver) {
272
273
  throw new common_.BadRequestException({
@@ -321,7 +322,7 @@ class RuleEngineService {
321
322
  }
322
323
  }
323
324
  }
324
- resolveTemplate(template, ctx) {
325
+ resolveTemplate(template, ctx, format = (text)=>text) {
325
326
  if (template.length > (/* inlined export .RULE_TEMPLATE_MAX_LENGTH */4000)) {
326
327
  throw new common_.BadRequestException({
327
328
  message: `Template is longer than ${(/* inlined export .RULE_TEMPLATE_MAX_LENGTH */4000)} characters.`,
@@ -337,7 +338,7 @@ class RuleEngineService {
337
338
  for (const match of template.matchAll(pattern)){
338
339
  result += template.slice(last, match.index);
339
340
  const value = this.resolveFieldReference(match[1], ctx);
340
- result += value === null || value === undefined ? '' : typeof value === 'object' ? JSON.stringify(value) : String(value);
341
+ result += value === null || value === undefined ? '' : format(typeof value === 'object' ? JSON.stringify(value) : String(value));
341
342
  last = match.index + match[0].length;
342
343
  }
343
344
  return result + template.slice(last);
@@ -655,7 +656,7 @@ class RuleEngineService {
655
656
  RuleEngineService = _ts_decorate([
656
657
  (0,common_.Injectable)(),
657
658
  _ts_param(0, (0,common_.Optional)()),
658
- _ts_param(0, (0,common_.Inject)(__rspack_external__flusys_nestjs_shared_interfaces_413f2706.PERMISSION_RESOLVER)),
659
+ _ts_param(0, (0,common_.Inject)(interfaces_.PERMISSION_RESOLVER)),
659
660
  _ts_param(1, (0,common_.Optional)()),
660
661
  _ts_param(1, (0,common_.Inject)(modules_.SharedPermissionCacheService)),
661
662
  _ts_metadata("design:type", Function),
@@ -761,7 +762,7 @@ __webpack_require__.d(__webpack_exports__, {
761
762
 
762
763
  },
763
764
  5191(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
764
- /* import */ var _flusys_nestjs_shared_exceptions__rspack_import_0 = __webpack_require__(2417);
765
+ /* import */ var _flusys_nestjs_shared_utils__rspack_import_0 = __webpack_require__(9216);
765
766
  /* import */ var _nestjs_common__rspack_import_1 = __webpack_require__(6157);
766
767
  /* import */ var _config_message_keys_js__rspack_import_3 = __webpack_require__(5732);
767
768
  /* import */ var _rule_interface_js__rspack_import_2 = __webpack_require__(2354);
@@ -782,7 +783,7 @@ __webpack_require__.d(__webpack_exports__, {
782
783
  const key = branch ?? '';
783
784
  let codes = memo.get(key);
784
785
  if (!codes) {
785
- codes = loadCodes({
786
+ codes = (0,_flusys_nestjs_shared_utils__rspack_import_0.loadPermissionCodes)({
786
787
  userId: user.id,
787
788
  companyId: user.companyId ?? null,
788
789
  branchId: branch
@@ -793,11 +794,6 @@ __webpack_require__.d(__webpack_exports__, {
793
794
  }
794
795
  };
795
796
  }
796
- async function loadCodes(scope, sources) {
797
- if (sources.resolver) return sources.resolver.getPermissionCodes(scope);
798
- if (sources.cache?.isCacheConfigured()) return sources.cache.getPermissions(scope);
799
- throw new _flusys_nestjs_shared_exceptions__rspack_import_0.PermissionSystemUnavailableException();
800
- }
801
797
  /** A list, or text separated by commas / whitespace, as distinct codes. */ function parsePermissionCodes(value) {
802
798
  const raw = Array.isArray(value) ? value : typeof value === 'string' ? value.split(/[\s,]+/) : [];
803
799
  const codes = [
@@ -1051,7 +1047,7 @@ function patternError(problem, pattern) {
1051
1047
  }
1052
1048
  }
1053
1049
  function compile(pattern) {
1054
- return remember(compiled, pattern, (p)=>__rspack_external_re2js.RE2JS.compile(p));
1050
+ return remember(compiled, pattern, (p)=>RE2JS.compile(p));
1055
1051
  }
1056
1052
 
1057
1053
 
@@ -1127,7 +1123,9 @@ __webpack_require__.d(__webpack_exports__, {
1127
1123
 
1128
1124
  },
1129
1125
  2354(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
1130
- /** Declarative JSON rule/expression grammar - evaluated by a closed switch, never as code. */ const RULE_COMPARISON_OPERATORS = [
1126
+ /* import */ var _flusys_nestjs_shared_utils__rspack_import_0 = __webpack_require__(9216);
1127
+ /** Declarative JSON rule/expression grammar - evaluated by a closed switch, never as code. */
1128
+ const RULE_COMPARISON_OPERATORS = [
1131
1129
  'equals',
1132
1130
  'not_equals',
1133
1131
  'greater_than',
@@ -1181,7 +1179,7 @@ const RULE_ENGINE_LIMITS = {
1181
1179
  /** Largest `{n,m}` count, also for the product of nested counts. */ MAX_REGEX_REPEAT: 100,
1182
1180
  /** How much larger counted repeats may make the unrolled pattern than the pattern itself. */ MAX_REGEX_REPEAT_EXPANSION: 300,
1183
1181
  /** Largest `offsetMinutes` accepted by START_OF_DAY / END_OF_DAY (UTC+14 / UTC-12). */ MAX_UTC_OFFSET_MINUTES: 840,
1184
- MAX_PERMISSION_CODES: 50,
1182
+ MAX_PERMISSION_CODES: _flusys_nestjs_shared_utils__rspack_import_0.MAX_PERMISSION_LOGIC_CODES,
1185
1183
  MAX_IP_RANGES: 100
1186
1184
  };
1187
1185
 
@@ -1198,9 +1196,9 @@ __webpack_require__.d(__webpack_exports__, {
1198
1196
 
1199
1197
 
1200
1198
  },
1201
- 2417(module) {
1199
+ 5103(module) {
1202
1200
 
1203
- module.exports = __rspack_external__flusys_nestjs_shared_exceptions_3edf22e9;
1201
+ module.exports = __rspack_external__flusys_nestjs_shared_interfaces_413f2706;
1204
1202
 
1205
1203
 
1206
1204
  },
@@ -1221,12 +1219,6 @@ module.exports = __rspack_external__flusys_nestjs_shared_utils_9125c1f1;
1221
1219
  module.exports = __rspack_external__nestjs_common_a04939da;
1222
1220
 
1223
1221
 
1224
- },
1225
- 2561(module) {
1226
-
1227
- module.exports = __rspack_external_node_crypto_2e7c4b46;
1228
-
1229
-
1230
1222
  },
1231
1223
  8299(module) {
1232
1224