@flusys/nestjs-entity-builder 9.0.1 → 9.1.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 (40) hide show
  1. package/README.md +22 -28
  2. package/config/message-keys.d.ts +9 -62
  3. package/controllers/flow-api-key.controller.d.ts +14 -0
  4. package/controllers/flow-definition.controller.d.ts +1 -7
  5. package/controllers/index.d.ts +1 -0
  6. package/dtos/flow.dto.d.ts +20 -10
  7. package/entities/flow-api-key.entity.d.ts +10 -0
  8. package/entities/flow-definition.entity.d.ts +9 -3
  9. package/entities/flow-execution.entity.d.ts +0 -1
  10. package/entities/index.d.ts +3 -3
  11. package/fesm/21.js +11 -64
  12. package/fesm/{582.js → 489.js} +11 -20
  13. package/fesm/{913.js → 606.js} +295 -209
  14. package/fesm/719.js +186 -162
  15. package/fesm/794.js +187 -116
  16. package/fesm/{677.js → 996.js} +616 -1490
  17. package/fesm/controllers/index.js +6 -5
  18. package/fesm/docs/index.js +2 -2
  19. package/fesm/entities/index.js +2 -2
  20. package/fesm/guards/index.js +19 -12
  21. package/fesm/index.js +638 -50
  22. package/fesm/modules/index.js +625 -7
  23. package/fesm/rule-engine/index.js +2 -2
  24. package/fesm/services/index.js +25 -54
  25. package/flow-engine/flow-api-key.d.ts +7 -3
  26. package/flow-engine/flow-graph.validator.d.ts +2 -4
  27. package/flow-engine/flow-run.types.d.ts +4 -14
  28. package/flow-engine/flow.types.d.ts +9 -91
  29. package/interfaces/flow-definition.interface.d.ts +9 -13
  30. package/package.json +5 -5
  31. package/rule-engine/rule-engine.service.d.ts +0 -1
  32. package/services/entity-flow-scaffold.d.ts +1 -1
  33. package/services/flow-api-key.service.d.ts +31 -0
  34. package/services/flow-definition.service.d.ts +12 -24
  35. package/services/flow-execution.service.d.ts +0 -1
  36. package/services/flow-executor.service.d.ts +7 -7
  37. package/services/generic-entity.service.d.ts +1 -1
  38. package/services/index.d.ts +1 -0
  39. package/entities/flow-version.entity.d.ts +0 -10
  40. package/fesm/458.js +0 -649
package/fesm/21.js CHANGED
@@ -262,9 +262,15 @@ const FLOW_MESSAGES = {
262
262
  SLUG_TAKEN: 'entity_builder.flow.slug.taken',
263
263
  RATE_LIMITED: 'entity_builder.flow.rate.limited',
264
264
  API_KEY_INVALID: 'entity_builder.flow.api.key.invalid',
265
+ API_KEY_NOT_FOUND: 'entity_builder.flow.api.key.not.found',
266
+ API_KEY_CREATE_SUCCESS: 'entity_builder.flow.api.key.create.success',
267
+ API_KEY_LIST_SUCCESS: 'entity_builder.flow.api.key.list.success',
268
+ API_KEY_REVOKE_SUCCESS: 'entity_builder.flow.api.key.revoke.success',
269
+ API_KEY_DELETE_SUCCESS: 'entity_builder.flow.api.key.delete.success',
270
+ API_KEY_EXPIRED: 'entity_builder.flow.api.key.expired',
271
+ API_KEY_EXPIRY_IN_PAST: 'entity_builder.flow.api.key.expiry.in.past',
265
272
  CALLED_BY_OTHER_FLOWS: 'entity_builder.flow.called.by.other.flows',
266
273
  ENDPOINT_CALLED_BY_OTHER_FLOWS: 'entity_builder.flow.endpoint.called.by.other.flows',
267
- CALLERS_BROKEN: 'entity_builder.flow.callers.broken',
268
274
  EXECUTION_NOT_FOUND: 'entity_builder.flow.execution.not.found',
269
275
  EXECUTIONS_SUCCESS: 'entity_builder.flow.executions.success',
270
276
  EXECUTION_SUCCESS: 'entity_builder.flow.execution.success',
@@ -281,15 +287,7 @@ const FLOW_MESSAGES = {
281
287
  INPUT_BODY_NOT_LIST: 'entity_builder.flow.input.body.not.list',
282
288
  INPUT_BODY_ITEM_NOT_OBJECT: 'entity_builder.flow.input.body.item.not.object',
283
289
  CHECKS_FAILED: 'entity_builder.flow.checks.failed',
284
- PERMISSION_DENIED: 'entity_builder.flow.permission.denied',
285
- PUBLISH_SUCCESS: 'entity_builder.flow.publish.success',
286
- NOTHING_TO_PUBLISH: 'entity_builder.flow.nothing.to.publish',
287
- VERSIONS_SUCCESS: 'entity_builder.flow.versions.success',
288
- VERSION_SUCCESS: 'entity_builder.flow.version.success',
289
- VERSION_NOT_FOUND: 'entity_builder.flow.version.not.found',
290
- VERSION_RESTORED: 'entity_builder.flow.version.restored',
291
- DRAFT_DISCARDED: 'entity_builder.flow.draft.discarded',
292
- NO_DRAFT: 'entity_builder.flow.no.draft'
290
+ PERMISSION_DENIED: 'entity_builder.flow.permission.denied'
293
291
  };
294
292
  /** Why a run was stopped or a node failed (`trace[].error`, `body.messageKey`). */ const FLOW_ERROR_MESSAGES = {
295
293
  NO_TRIGGER: 'entity_builder.flow.error.no.trigger',
@@ -326,36 +324,20 @@ const FLOW_MESSAGES = {
326
324
  CALLED_FLOW_FAILED: 'entity_builder.flow.error.called.flow.failed',
327
325
  CALLED_FLOW_FAILED_AT_NODE: 'entity_builder.flow.error.called.flow.failed.at.node',
328
326
  RUN_AS_NOT_ALLOWED: 'entity_builder.flow.error.run.as.not.allowed',
329
- FILTER_VALUE_MISSING: 'entity_builder.flow.error.filter.value.missing',
330
- TOO_MANY_MESSAGES: 'entity_builder.flow.error.too.many.messages',
331
- TOO_MANY_RECIPIENTS: 'entity_builder.flow.error.too.many.recipients',
332
- NOTIFICATION_UNAVAILABLE: 'entity_builder.flow.error.notification.unavailable',
333
- NOTIFICATION_RECIPIENT_INVALID: 'entity_builder.flow.error.notification.recipient.invalid',
334
- NOTIFICATION_COMPANY_INVALID: 'entity_builder.flow.error.notification.company.invalid',
335
- NOTIFICATION_BRANCH_INVALID: 'entity_builder.flow.error.notification.branch.invalid',
336
- NOTIFICATION_COMPANY_UNAVAILABLE: 'entity_builder.flow.error.notification.company.unavailable',
337
- NOTIFICATION_COMPANY_DENIED: 'entity_builder.flow.error.notification.company.denied',
338
- NOTIFICATION_TITLE_EMPTY: 'entity_builder.flow.error.notification.title.empty',
339
- NOTIFICATION_FAILED: 'entity_builder.flow.error.notification.failed',
340
- EMAIL_UNAVAILABLE: 'entity_builder.flow.error.email.unavailable',
341
- EMAIL_ADDRESS_INVALID: 'entity_builder.flow.error.email.address.invalid',
342
- EMAIL_SUBJECT_EMPTY: 'entity_builder.flow.error.email.subject.empty',
343
- EMAIL_BODY_EMPTY: 'entity_builder.flow.error.email.body.empty',
344
- EMAIL_FAILED: 'entity_builder.flow.error.email.failed'
327
+ FILTER_VALUE_MISSING: 'entity_builder.flow.error.filter.value.missing'
345
328
  };
346
329
  /** Why a node was not executed in a test run (`output.reasonKey`). */ const FLOW_SKIP_MESSAGES = {
347
330
  HTTP: 'entity_builder.flow.skip.http',
348
331
  EVENTS: 'entity_builder.flow.skip.events',
349
- NOTIFICATION: 'entity_builder.flow.skip.notification',
350
- EMAIL: 'entity_builder.flow.skip.email',
351
- NO_RECIPIENTS: 'entity_builder.flow.skip.no.recipients',
352
332
  COMMIT_DRY_RUN: 'entity_builder.flow.skip.commit.dry.run',
353
333
  COMMIT_NO_TRANSACTION: 'entity_builder.flow.skip.commit.no.transaction',
354
334
  COMMIT_JOINED: 'entity_builder.flow.skip.commit.joined'
355
335
  };
356
336
  /** Save-time findings about a flow (`validateFlow`). */ const FLOW_VALIDATION_MESSAGES = {
357
337
  SLUG_INVALID: 'entity_builder.flow.validation.slug.invalid',
338
+ RUN_AS_CALLER_NEEDS_AUTH: 'entity_builder.flow.validation.run.as.caller.needs.auth',
358
339
  RUN_AS_INVALID: 'entity_builder.flow.validation.run.as.invalid',
340
+ AUTH_MODE_INVALID: 'entity_builder.flow.validation.auth.mode.invalid',
359
341
  NO_NODES: 'entity_builder.flow.validation.no.nodes',
360
342
  TOO_MANY_NODES: 'entity_builder.flow.validation.too.many.nodes',
361
343
  TOO_MANY_EDGES: 'entity_builder.flow.validation.too.many.edges',
@@ -382,15 +364,6 @@ const FLOW_MESSAGES = {
382
364
  COMMIT_IN_CALLED_FLOW: 'entity_builder.flow.validation.commit.in.called.flow',
383
365
  PUBLIC_SYSTEM_ENTITY: 'entity_builder.flow.validation.public.system.entity',
384
366
  PERMISSION_WITHOUT_USER: 'entity_builder.flow.validation.permission.without.user',
385
- KEYLESS_ENDPOINT_AS_CALLER: 'entity_builder.flow.validation.keyless.endpoint.as.caller',
386
- TRIGGER_AUTH_INVALID: 'entity_builder.flow.validation.trigger.auth.invalid',
387
- TRIGGER_TRANSACTION_INVALID: 'entity_builder.flow.validation.trigger.transaction.invalid',
388
- TRIGGER_TIMEOUT_RANGE: 'entity_builder.flow.validation.trigger.timeout.range',
389
- TRIGGER_RATE_LIMIT_RANGE: 'entity_builder.flow.validation.trigger.rate.limit.range',
390
- TRIGGER_API_KEY_REQUIRED: 'entity_builder.flow.validation.trigger.api.key.required',
391
- TRIGGER_API_KEY_INVALID: 'entity_builder.flow.validation.trigger.api.key.invalid',
392
- NODE_FORWARDS_TOKEN: 'entity_builder.flow.validation.node.forwards.token',
393
- NODE_ACCESS_TARGET_REQUIRED: 'entity_builder.flow.validation.node.access.target.required',
394
367
  INPUT_TOO_MANY: 'entity_builder.flow.validation.input.too.many',
395
368
  INPUT_NAME_INVALID: 'entity_builder.flow.validation.input.name.invalid',
396
369
  INPUT_NAME_DUPLICATE: 'entity_builder.flow.validation.input.name.duplicate',
@@ -412,7 +385,6 @@ const FLOW_MESSAGES = {
412
385
  NODE_CASE_DUPLICATE: 'entity_builder.flow.validation.node.case.duplicate',
413
386
  NODE_MAX_ITEMS_RANGE: 'entity_builder.flow.validation.node.max.items.range',
414
387
  NODE_LIMIT_RANGE: 'entity_builder.flow.validation.node.limit.range',
415
- NODE_SORT_INVALID: 'entity_builder.flow.validation.node.sort.invalid',
416
388
  NODE_WRITE_TARGET_INVALID: 'entity_builder.flow.validation.node.write.target.invalid',
417
389
  NODE_NOT_FOUND_INVALID: 'entity_builder.flow.validation.node.not.found.invalid',
418
390
  NODE_FILTER_REQUIRED: 'entity_builder.flow.validation.node.filter.required',
@@ -437,16 +409,6 @@ const FLOW_MESSAGES = {
437
409
  NODE_CHOOSE_METHOD: 'entity_builder.flow.validation.node.choose.method',
438
410
  NODE_TIMEOUT_RANGE: 'entity_builder.flow.validation.node.timeout.range',
439
411
  NODE_EVENT_NAME_INVALID: 'entity_builder.flow.validation.node.event.name.invalid',
440
- NODE_NOTIFICATION_UNAVAILABLE: 'entity_builder.flow.validation.node.notification.unavailable',
441
- NODE_NOTIFICATION_OPTION_INVALID: 'entity_builder.flow.validation.node.notification.option.invalid',
442
- NODE_NOTIFICATION_COMPANY_UNAVAILABLE: 'entity_builder.flow.validation.node.notification.company.unavailable',
443
- NODE_MESSAGE_TARGET_INVALID: 'entity_builder.flow.validation.node.message.target.invalid',
444
- COMPANY_NOTIFICATION_WITHOUT_USER: 'entity_builder.flow.validation.company.notification.without.user',
445
- NODE_EMAIL_UNAVAILABLE: 'entity_builder.flow.validation.node.email.unavailable',
446
- NODE_EMAIL_OPTION_INVALID: 'entity_builder.flow.validation.node.email.option.invalid',
447
- NODE_EMAIL_TEMPLATE_REQUIRED: 'entity_builder.flow.validation.node.email.template.required',
448
- MESSAGE_AFTER_COMMIT: 'entity_builder.flow.validation.message.after.commit',
449
- PUBLIC_MESSAGE: 'entity_builder.flow.validation.public.message',
450
412
  NODE_STATUS_2XX_5XX: 'entity_builder.flow.validation.node.status.2xx.5xx',
451
413
  REF_BAD_SCOPE: 'entity_builder.flow.validation.ref.bad.scope',
452
414
  REF_NODE_MISSING: 'entity_builder.flow.validation.ref.node.missing',
@@ -514,21 +476,6 @@ const FLOW_MESSAGES = {
514
476
  THE_URL: 'entity_builder.flow.subject.the.url',
515
477
  THE_INPUT_LIST: 'entity_builder.flow.subject.the.input.list',
516
478
  THE_RESPONSE: 'entity_builder.flow.subject.the.response',
517
- THE_RECIPIENTS: 'entity_builder.flow.subject.the.recipients',
518
- THE_TITLE: 'entity_builder.flow.subject.the.title',
519
- THE_MESSAGE: 'entity_builder.flow.subject.the.message',
520
- THE_COMPANY: 'entity_builder.flow.subject.the.company',
521
- THE_COMPANIES: 'entity_builder.flow.subject.the.companies',
522
- THE_BRANCHES: 'entity_builder.flow.subject.the.branches',
523
- THE_CC: 'entity_builder.flow.subject.the.cc',
524
- THE_BCC: 'entity_builder.flow.subject.the.bcc',
525
- THE_REPLY_TO: 'entity_builder.flow.subject.the.reply.to',
526
- THE_SUBJECT: 'entity_builder.flow.subject.the.subject',
527
- THE_BODY: 'entity_builder.flow.subject.the.body',
528
- DATA_VALUES: 'entity_builder.flow.subject.data.values',
529
- DATA_VALUE: 'entity_builder.flow.subject.data.value',
530
- TEMPLATE_VALUES: 'entity_builder.flow.subject.template.values',
531
- TEMPLATE_VALUE: 'entity_builder.flow.subject.template.value',
532
479
  VARIABLES: 'entity_builder.flow.subject.variables',
533
480
  VARIABLE: 'entity_builder.flow.subject.variable',
534
481
  FIELDS: 'entity_builder.flow.subject.fields',
@@ -1,13 +1,13 @@
1
- import { RE2JS } from "re2js";
2
1
  import * as __rspack_external__flusys_nestjs_shared_exceptions_3edf22e9 from "@flusys/nestjs-shared/exceptions";
3
- import * as __rspack_external__flusys_nestjs_shared_interfaces_413f2706 from "@flusys/nestjs-shared/interfaces";
4
2
  import * as __rspack_external__flusys_nestjs_shared_modules_24702bee from "@flusys/nestjs-shared/modules";
5
3
  import * as __rspack_external__flusys_nestjs_shared_utils_9125c1f1 from "@flusys/nestjs-shared/utils";
6
4
  import * as __rspack_external__nestjs_common_a04939da from "@nestjs/common";
7
5
  import * as __rspack_external_node_crypto_2e7c4b46 from "node:crypto";
8
6
  import * as __rspack_external_node_net_5ed819e1 from "node:net";
9
- export const __rspack_esm_id = 582;
10
- export const __rspack_esm_ids = [582];
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];
11
11
  export const __webpack_modules__ = {
12
12
  3372(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
13
13
  const RECORD_FILTER_OPS = [
@@ -47,7 +47,7 @@ __webpack_require__.d(__webpack_exports__, {
47
47
 
48
48
 
49
49
  },
50
- 8429(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
50
+ 5920(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
51
51
 
52
52
  // EXPORTS
53
53
  __webpack_require__.d(__webpack_exports__, {
@@ -64,8 +64,8 @@ __webpack_require__.d(__webpack_exports__, {
64
64
 
65
65
  // EXTERNAL MODULE: ./projects/nestjs-entity-builder/src/rule-engine/rule.interface.ts
66
66
  var rule_interface = __webpack_require__(2354);
67
- // EXTERNAL MODULE: external "@flusys/nestjs-shared/interfaces"
68
- var interfaces_ = __webpack_require__(5103);
67
+ ;// CONCATENATED MODULE: external "@flusys/nestjs-shared/interfaces"
68
+
69
69
  // EXTERNAL MODULE: external "@flusys/nestjs-shared/modules"
70
70
  var modules_ = __webpack_require__(1236);
71
71
  // EXTERNAL MODULE: external "@flusys/nestjs-shared/utils"
@@ -267,9 +267,6 @@ class RuleEngineService {
267
267
  return this.resolveLookup(expression, ctx, budget);
268
268
  }
269
269
  }
270
- /** 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) {
271
- return expression.type === 'template' ? this.resolveTemplate(expression.template, ctx, utils_.escapeHtml) : this.resolveExpression(expression, ctx);
272
- }
273
270
  async resolveLookup(expression, ctx, budget) {
274
271
  if (!ctx.lookupResolver) {
275
272
  throw new common_.BadRequestException({
@@ -324,7 +321,7 @@ class RuleEngineService {
324
321
  }
325
322
  }
326
323
  }
327
- resolveTemplate(template, ctx, format = (text)=>text) {
324
+ resolveTemplate(template, ctx) {
328
325
  if (template.length > (/* inlined export .RULE_TEMPLATE_MAX_LENGTH */4000)) {
329
326
  throw new common_.BadRequestException({
330
327
  message: `Template is longer than ${(/* inlined export .RULE_TEMPLATE_MAX_LENGTH */4000)} characters.`,
@@ -340,7 +337,7 @@ class RuleEngineService {
340
337
  for (const match of template.matchAll(pattern)){
341
338
  result += template.slice(last, match.index);
342
339
  const value = this.resolveFieldReference(match[1], ctx);
343
- result += value === null || value === undefined ? '' : format(typeof value === 'object' ? JSON.stringify(value) : String(value));
340
+ result += value === null || value === undefined ? '' : typeof value === 'object' ? JSON.stringify(value) : String(value);
344
341
  last = match.index + match[0].length;
345
342
  }
346
343
  return result + template.slice(last);
@@ -658,7 +655,7 @@ class RuleEngineService {
658
655
  RuleEngineService = _ts_decorate([
659
656
  (0,common_.Injectable)(),
660
657
  _ts_param(0, (0,common_.Optional)()),
661
- _ts_param(0, (0,common_.Inject)(interfaces_.PERMISSION_RESOLVER)),
658
+ _ts_param(0, (0,common_.Inject)(__rspack_external__flusys_nestjs_shared_interfaces_413f2706.PERMISSION_RESOLVER)),
662
659
  _ts_param(1, (0,common_.Optional)()),
663
660
  _ts_param(1, (0,common_.Inject)(modules_.SharedPermissionCacheService)),
664
661
  _ts_metadata("design:type", Function),
@@ -1054,7 +1051,7 @@ function patternError(problem, pattern) {
1054
1051
  }
1055
1052
  }
1056
1053
  function compile(pattern) {
1057
- return remember(compiled, pattern, (p)=>RE2JS.compile(p));
1054
+ return remember(compiled, pattern, (p)=>__rspack_external_re2js.RE2JS.compile(p));
1058
1055
  }
1059
1056
 
1060
1057
 
@@ -1206,12 +1203,6 @@ __webpack_require__.d(__webpack_exports__, {
1206
1203
  module.exports = __rspack_external__flusys_nestjs_shared_exceptions_3edf22e9;
1207
1204
 
1208
1205
 
1209
- },
1210
- 5103(module) {
1211
-
1212
- module.exports = __rspack_external__flusys_nestjs_shared_interfaces_413f2706;
1213
-
1214
-
1215
1206
  },
1216
1207
  1236(module) {
1217
1208