@elsikora/nestjs-crud-automator 2.6.0 → 2.7.0-dev.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 (88) hide show
  1. package/README.md +18 -0
  2. package/dist/cjs/class/api/function/context-storage.class.d.ts +6 -1
  3. package/dist/cjs/class/api/function/context-storage.class.js +20 -2
  4. package/dist/cjs/class/api/function/context-storage.class.js.map +1 -1
  5. package/dist/cjs/class/api/function/custom-runtime.class.d.ts +0 -2
  6. package/dist/cjs/class/api/function/custom-runtime.class.js +17 -43
  7. package/dist/cjs/class/api/function/custom-runtime.class.js.map +1 -1
  8. package/dist/cjs/class/api/function/service-context.factory.class.d.ts +57 -0
  9. package/dist/cjs/class/api/function/service-context.factory.class.js +88 -0
  10. package/dist/cjs/class/api/function/service-context.factory.class.js.map +1 -0
  11. package/dist/cjs/class/api/function/step-runtime.class.d.ts +26 -0
  12. package/dist/cjs/class/api/function/step-runtime.class.js +38 -0
  13. package/dist/cjs/class/api/function/step-runtime.class.js.map +1 -0
  14. package/dist/cjs/class/api/service-base.class.d.ts +2 -1
  15. package/dist/cjs/class/api/service-base.class.js +10 -0
  16. package/dist/cjs/class/api/service-base.class.js.map +1 -1
  17. package/dist/cjs/class/api/subscriber/executor.class.js +21 -16
  18. package/dist/cjs/class/api/subscriber/executor.class.js.map +1 -1
  19. package/dist/cjs/decorator/api/function/create.decorator.js +1 -1
  20. package/dist/cjs/decorator/api/function/create.decorator.js.map +1 -1
  21. package/dist/cjs/decorator/api/function/delete.decorator.js +1 -1
  22. package/dist/cjs/decorator/api/function/delete.decorator.js.map +1 -1
  23. package/dist/cjs/decorator/api/function/get/decorator.js +1 -1
  24. package/dist/cjs/decorator/api/function/get/decorator.js.map +1 -1
  25. package/dist/cjs/decorator/api/function/get/list.decorator.js +1 -1
  26. package/dist/cjs/decorator/api/function/get/list.decorator.js.map +1 -1
  27. package/dist/cjs/decorator/api/function/get/many.decorator.js +1 -1
  28. package/dist/cjs/decorator/api/function/get/many.decorator.js.map +1 -1
  29. package/dist/cjs/decorator/api/function/index.d.ts +1 -0
  30. package/dist/cjs/decorator/api/function/step.decorator.d.ts +9 -0
  31. package/dist/cjs/decorator/api/function/step.decorator.js +46 -0
  32. package/dist/cjs/decorator/api/function/step.decorator.js.map +1 -0
  33. package/dist/cjs/decorator/api/function/update.decorator.js +1 -1
  34. package/dist/cjs/decorator/api/function/update.decorator.js.map +1 -1
  35. package/dist/cjs/index.js +2 -0
  36. package/dist/cjs/index.js.map +1 -1
  37. package/dist/cjs/interface/class/api/function/context/index.d.ts +1 -0
  38. package/dist/cjs/interface/class/api/function/context/step.interface.d.ts +7 -0
  39. package/dist/cjs/interface/decorator/api/function/index.d.ts +1 -0
  40. package/dist/cjs/interface/decorator/api/function/step-properties.interface.d.ts +8 -0
  41. package/dist/cjs/type/class/api/function/context-storage-entry.type.d.ts +15 -0
  42. package/dist/cjs/utility/api/function-transaction.utility.d.ts +4 -0
  43. package/dist/cjs/utility/api/function-transaction.utility.js +12 -4
  44. package/dist/cjs/utility/api/function-transaction.utility.js.map +1 -1
  45. package/dist/esm/class/api/function/context-storage.class.d.ts +6 -1
  46. package/dist/esm/class/api/function/context-storage.class.js +20 -2
  47. package/dist/esm/class/api/function/context-storage.class.js.map +1 -1
  48. package/dist/esm/class/api/function/custom-runtime.class.d.ts +0 -2
  49. package/dist/esm/class/api/function/custom-runtime.class.js +17 -43
  50. package/dist/esm/class/api/function/custom-runtime.class.js.map +1 -1
  51. package/dist/esm/class/api/function/service-context.factory.class.d.ts +57 -0
  52. package/dist/esm/class/api/function/service-context.factory.class.js +86 -0
  53. package/dist/esm/class/api/function/service-context.factory.class.js.map +1 -0
  54. package/dist/esm/class/api/function/step-runtime.class.d.ts +26 -0
  55. package/dist/esm/class/api/function/step-runtime.class.js +36 -0
  56. package/dist/esm/class/api/function/step-runtime.class.js.map +1 -0
  57. package/dist/esm/class/api/service-base.class.d.ts +2 -1
  58. package/dist/esm/class/api/service-base.class.js +10 -0
  59. package/dist/esm/class/api/service-base.class.js.map +1 -1
  60. package/dist/esm/class/api/subscriber/executor.class.js +21 -16
  61. package/dist/esm/class/api/subscriber/executor.class.js.map +1 -1
  62. package/dist/esm/decorator/api/function/create.decorator.js +1 -1
  63. package/dist/esm/decorator/api/function/create.decorator.js.map +1 -1
  64. package/dist/esm/decorator/api/function/delete.decorator.js +1 -1
  65. package/dist/esm/decorator/api/function/delete.decorator.js.map +1 -1
  66. package/dist/esm/decorator/api/function/get/decorator.js +1 -1
  67. package/dist/esm/decorator/api/function/get/decorator.js.map +1 -1
  68. package/dist/esm/decorator/api/function/get/list.decorator.js +1 -1
  69. package/dist/esm/decorator/api/function/get/list.decorator.js.map +1 -1
  70. package/dist/esm/decorator/api/function/get/many.decorator.js +1 -1
  71. package/dist/esm/decorator/api/function/get/many.decorator.js.map +1 -1
  72. package/dist/esm/decorator/api/function/index.d.ts +1 -0
  73. package/dist/esm/decorator/api/function/step.decorator.d.ts +9 -0
  74. package/dist/esm/decorator/api/function/step.decorator.js +44 -0
  75. package/dist/esm/decorator/api/function/step.decorator.js.map +1 -0
  76. package/dist/esm/decorator/api/function/update.decorator.js +1 -1
  77. package/dist/esm/decorator/api/function/update.decorator.js.map +1 -1
  78. package/dist/esm/index.js +1 -0
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/esm/interface/class/api/function/context/index.d.ts +1 -0
  81. package/dist/esm/interface/class/api/function/context/step.interface.d.ts +7 -0
  82. package/dist/esm/interface/decorator/api/function/index.d.ts +1 -0
  83. package/dist/esm/interface/decorator/api/function/step-properties.interface.d.ts +8 -0
  84. package/dist/esm/type/class/api/function/context-storage-entry.type.d.ts +15 -0
  85. package/dist/esm/utility/api/function-transaction.utility.d.ts +4 -0
  86. package/dist/esm/utility/api/function-transaction.utility.js +12 -4
  87. package/dist/esm/utility/api/function-transaction.utility.js.map +1 -1
  88. package/package.json +1 -1
package/README.md CHANGED
@@ -556,6 +556,24 @@ async bulkPromote(ids: Array<string>): Promise<Array<UserEntity>> {
556
556
  }
557
557
  ```
558
558
 
559
+ Use `@ApiFunctionStep` for internal helper methods that need ApiFunction transaction semantics and context but should not become standalone custom actions. Steps can also be called directly when the selected transaction mode permits:
560
+
561
+ ```typescript
562
+ import { ApiFunctionStep, EApiFunctionTransactionMode } from "@elsikora/nestjs-crud-automator";
563
+
564
+ @ApiFunctionStep<UserEntity>({
565
+ entity: UserEntity,
566
+ transaction: { mode: EApiFunctionTransactionMode.MANDATORY },
567
+ })
568
+ private async recordPromotionAudit(user: UserEntity): Promise<void> {
569
+ const context = this.getApiFunctionStepContext<UserEntity>();
570
+
571
+ await context.repository.save(user);
572
+ }
573
+ ```
574
+
575
+ Steps do not dispatch function subscribers, create route metadata, or define Swagger/authorization action identities. Step context intentionally exposes only `eventManager`, `repository`, and `getRepository`; use `@ApiFunctionCustom` plus `getApiFunctionContext()` when you need `operations` or lifecycle hooks.
576
+
559
577
  ```typescript
560
578
  // app.module.ts
561
579
  import type { IApiAuthorizationPrincipal, IApiHookPermissionSource, IApiPolicyAttachmentSource, IApiPolicyDocumentSource, IApiResolvedPolicyAttachments } from "@elsikora/nestjs-crud-automator";
@@ -1,7 +1,12 @@
1
1
  import { IApiBaseEntity } from '../../../interface/api-base-entity.interface';
2
- import { IApiFunctionContext } from '../../../interface/class/api/function';
2
+ import { IApiFunctionContext, IApiFunctionStepContext } from '../../../interface/class/api/function';
3
+ import { EntityManager } from 'typeorm';
3
4
  export declare class ApiFunctionContextStorage {
4
5
  private static readonly STORAGE;
5
6
  static get<E extends IApiBaseEntity>(): IApiFunctionContext<E> | undefined;
7
+ static getEventManager(): EntityManager | undefined;
8
+ static getStep<E extends IApiBaseEntity>(): IApiFunctionStepContext<E> | undefined;
6
9
  static run<E extends IApiBaseEntity, R>(context: IApiFunctionContext<E>, callback: () => Promise<R>): Promise<R>;
10
+ static runStep<E extends IApiBaseEntity, R>(context: IApiFunctionStepContext<E>, callback: () => Promise<R>): Promise<R>;
11
+ static runWithoutStepContext<R>(callback: () => Promise<R>): Promise<R>;
7
12
  }
@@ -5,10 +5,28 @@ var node_async_hooks = require('node:async_hooks');
5
5
  class ApiFunctionContextStorage {
6
6
  static STORAGE = new node_async_hooks.AsyncLocalStorage();
7
7
  static get() {
8
- return ApiFunctionContextStorage.STORAGE.getStore();
8
+ const entry = ApiFunctionContextStorage.STORAGE.getStore();
9
+ return entry?.kind === "function" ? entry.context : undefined;
10
+ }
11
+ static getEventManager() {
12
+ return ApiFunctionContextStorage.STORAGE.getStore()?.context.eventManager;
13
+ }
14
+ static getStep() {
15
+ const entry = ApiFunctionContextStorage.STORAGE.getStore();
16
+ return entry?.kind === "step" ? entry.context : undefined;
9
17
  }
10
18
  static run(context, callback) {
11
- return ApiFunctionContextStorage.STORAGE.run(context, callback);
19
+ return ApiFunctionContextStorage.STORAGE.run({ context: context, kind: "function" }, callback);
20
+ }
21
+ static runStep(context, callback) {
22
+ return ApiFunctionContextStorage.STORAGE.run({ context, kind: "step" }, callback);
23
+ }
24
+ static runWithoutStepContext(callback) {
25
+ const entry = ApiFunctionContextStorage.STORAGE.getStore();
26
+ if (entry?.kind !== "step") {
27
+ return callback();
28
+ }
29
+ return ApiFunctionContextStorage.STORAGE.run({ context: { eventManager: entry.context.eventManager }, kind: "transaction" }, callback);
12
30
  }
13
31
  }
14
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"context-storage.class.js","sources":["../../../../../../src/class/api/function/context-storage.class.ts"],"sourcesContent":[null],"names":["NodeAsyncLocalStorage"],"mappings":";;;;MAOa,yBAAyB,CAAA;AAC7B,IAAA,OAAgB,OAAO,GAA2D,IAAIA,kCAAqB,EAAuC;AAEnJ,IAAA,OAAO,GAAG,GAAA;AAChB,QAAA,OAAO,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAwC;IAC1F;AAEO,IAAA,OAAO,GAAG,CAA8B,OAA+B,EAAE,QAA0B,EAAA;QACzG,OAAO,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAyD,EAAE,QAAQ,CAAC;IAClH;;;;;"}
1
+ {"version":3,"file":"context-storage.class.js","sources":["../../../../../../src/class/api/function/context-storage.class.ts"],"sourcesContent":[null],"names":["NodeAsyncLocalStorage"],"mappings":";;;;MASa,yBAAyB,CAAA;AAC7B,IAAA,OAAgB,OAAO,GAAuE,IAAIA,kCAAqB,EAAmD;AAE3K,IAAA,OAAO,GAAG,GAAA;QAChB,MAAM,KAAK,GAAgE,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE;AAEvH,QAAA,OAAO,KAAK,EAAE,IAAI,KAAK,UAAU,GAAI,KAAK,CAAC,OAA6C,GAAG,SAAS;IACrG;AAEO,IAAA,OAAO,eAAe,GAAA;QAC5B,OAAO,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,YAAY;IAC1E;AAEO,IAAA,OAAO,OAAO,GAAA;QACpB,MAAM,KAAK,GAAgE,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE;AAEvH,QAAA,OAAO,KAAK,EAAE,IAAI,KAAK,MAAM,GAAI,KAAK,CAAC,OAAsC,GAAG,SAAS;IAC1F;AAEO,IAAA,OAAO,GAAG,CAA8B,OAA+B,EAAE,QAA0B,EAAA;AACzG,QAAA,OAAO,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,OAAyD,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,CAAC;IACjJ;AAEO,IAAA,OAAO,OAAO,CAA8B,OAAmC,EAAE,QAA0B,EAAA;AACjH,QAAA,OAAO,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,CAAC;IAClF;IAEO,OAAO,qBAAqB,CAAI,QAA0B,EAAA;QAChE,MAAM,KAAK,GAAgE,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE;AAEvH,QAAA,IAAI,KAAK,EAAE,IAAI,KAAK,MAAM,EAAE;YAC3B,OAAO,QAAQ,EAAE;QAClB;QAEA,OAAO,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,QAAQ,CAAC;IACvI;;;;;"}
@@ -12,8 +12,6 @@ export declare class ApiFunctionCustomRuntime {
12
12
  };
13
13
  transactionMode: EApiFunctionTransactionMode;
14
14
  }): Promise<unknown>;
15
- private static createContext;
16
15
  private static executeErrorSubscribers;
17
16
  private static executeWithEventManager;
18
- private static resolveEventManager;
19
17
  }
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var contextStorage_class = require('./context-storage.class.js');
4
+ var serviceContext_factory_class = require('./service-context.factory.class.js');
4
5
  var executor_class = require('../subscriber/executor.class.js');
5
6
  require('../../../enum/decorator/api/action.enum.js');
6
7
  require('../../../enum/decorator/api/authentication-type.enum.js');
@@ -9,7 +10,7 @@ require('../../../enum/decorator/api/controller/request/target.enum.js');
9
10
  require('../../../enum/decorator/api/controller/request/transformer-type.enum.js');
10
11
  require('../../../enum/decorator/api/controller/response-target.enum.js');
11
12
  require('../../../enum/decorator/api/dto-type.enum.js');
12
- var functionTransactionMode_enum = require('../../../enum/decorator/api/function-transaction-mode.enum.js');
13
+ require('../../../enum/decorator/api/function-transaction-mode.enum.js');
13
14
  var functionType_enum = require('../../../enum/decorator/api/function-type.enum.js');
14
15
  var onType_enum = require('../../../enum/decorator/api/on-type.enum.js');
15
16
  require('../../../enum/decorator/api/property/data-type.enum.js');
@@ -19,43 +20,21 @@ require('../../../enum/decorator/api/property/desribe-type.enum.js');
19
20
  require('../../../enum/decorator/api/property/number-type.enum.js');
20
21
  require('../../../enum/decorator/api/property/string-type.enum.js');
21
22
  require('../../../enum/decorator/api/route-type.enum.js');
22
- var exception_utility = require('../../../utility/error/exception.utility.js');
23
+ var functionTransaction_utility = require('../../../utility/api/function-transaction.utility.js');
23
24
 
24
25
  class ApiFunctionCustomRuntime {
25
26
  static async execute(options) {
26
- const activeContext = contextStorage_class.ApiFunctionContextStorage.get();
27
- let eventManager;
28
- try {
29
- eventManager = ApiFunctionCustomRuntime.resolveEventManager(options.transactionMode, activeContext);
30
- }
31
- catch (error) {
32
- await ApiFunctionCustomRuntime.executeErrorSubscribers(options, undefined, onType_enum.EApiSubscriberOnType.BEFORE_ERROR, error);
33
- throw error;
34
- }
35
- if (options.transactionMode === functionTransactionMode_enum.EApiFunctionTransactionMode.REQUIRED && !eventManager) {
36
- return await options.target.repository.manager.transaction(async (transactionManager) => await ApiFunctionCustomRuntime.executeWithEventManager({ ...options, eventManager: transactionManager }));
37
- }
38
- return await ApiFunctionCustomRuntime.executeWithEventManager({ ...options, eventManager });
39
- }
40
- static createContext(options) {
41
- const repository = options.eventManager?.getRepository(options.properties.entity) ?? options.target.repository;
42
- return {
27
+ return await functionTransaction_utility.ApiFunctionExecuteWithTransaction({
28
+ callback: async (eventManager) => await ApiFunctionCustomRuntime.executeWithEventManager({ ...options, eventManager }),
43
29
  entity: options.properties.entity,
44
- eventManager: options.eventManager,
45
- getRepository: (repositoryEntity) => options.eventManager?.getRepository(repositoryEntity) ?? options.target.repository.manager.getRepository(repositoryEntity),
46
- operations: {
47
- create: async (properties) => await options.target.create(properties),
48
- delete: async (criteria) => {
49
- await options.target.delete(criteria);
50
- },
51
- get: async (properties) => await options.target.get(properties),
52
- getList: async (properties) => await options.target.getList(properties),
53
- getMany: async (properties) => await options.target.getMany(properties),
54
- getRepository: (repositoryEntity) => options.eventManager?.getRepository(repositoryEntity) ?? options.target.repository.manager.getRepository(repositoryEntity),
55
- update: async (criteria, properties) => await options.target.update(criteria, properties),
30
+ label: "ApiFunctionCustom",
31
+ mode: options.transactionMode,
32
+ onPreflightError: async (eventManager, error) => {
33
+ await ApiFunctionCustomRuntime.executeErrorSubscribers(options, eventManager, onType_enum.EApiSubscriberOnType.BEFORE_ERROR, error);
56
34
  },
57
- repository,
58
- };
35
+ repository: options.target.repository,
36
+ shouldBindTransactionScope: false,
37
+ });
59
38
  }
60
39
  static async executeErrorSubscribers(options, eventManager, onType, error) {
61
40
  const entityInstance = new options.properties.entity();
@@ -69,7 +48,11 @@ class ApiFunctionCustomRuntime {
69
48
  }
70
49
  static async executeWithEventManager(options) {
71
50
  const entityInstance = new options.properties.entity();
72
- const context = ApiFunctionCustomRuntime.createContext(options);
51
+ const context = serviceContext_factory_class.ApiFunctionServiceContextFactory.create({
52
+ entity: options.properties.entity,
53
+ eventManager: options.eventManager,
54
+ target: options.target,
55
+ });
73
56
  const executionContext = {
74
57
  action: options.properties.action,
75
58
  DATA: { eventManager: options.eventManager, repository: options.target.repository },
@@ -102,15 +85,6 @@ class ApiFunctionCustomRuntime {
102
85
  throw error;
103
86
  }
104
87
  }
105
- static resolveEventManager(transactionMode, activeContext) {
106
- if (transactionMode === functionTransactionMode_enum.EApiFunctionTransactionMode.NONE && activeContext?.eventManager) {
107
- throw exception_utility.ErrorException("ApiFunctionCustom transaction mode NONE cannot run inside an active transaction");
108
- }
109
- if (transactionMode === functionTransactionMode_enum.EApiFunctionTransactionMode.MANDATORY && !activeContext?.eventManager) {
110
- throw exception_utility.ErrorException("ApiFunctionCustom transaction mode MANDATORY requires an active transaction");
111
- }
112
- return transactionMode === functionTransactionMode_enum.EApiFunctionTransactionMode.NONE ? undefined : activeContext?.eventManager;
113
- }
114
88
  }
115
89
 
116
90
  exports.ApiFunctionCustomRuntime = ApiFunctionCustomRuntime;
@@ -1 +1 @@
1
- {"version":3,"file":"custom-runtime.class.js","sources":["../../../../../../src/class/api/function/custom-runtime.class.ts"],"sourcesContent":[null],"names":["ApiFunctionContextStorage","EApiSubscriberOnType","EApiFunctionTransactionMode","EApiFunctionType","ApiSubscriberExecutor","ErrorException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAaa,wBAAwB,CAAA;AAC7B,IA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CAAC;QACpG;AAEA,QAAA,OAAO,eAAe,KAAKH,wDAA2B,CAAC,IAAI,GAAG,SAAS,GAAG,aAAa,EAAE,YAAY;IACtG;AACA;;;;"}
1
+ {"version":3,"file":"custom-runtime.class.js","sources":["../../../../../../src/class/api/function/custom-runtime.class.ts"],"sourcesContent":[null],"names":["ApiFunctionExecuteWithTransaction","EApiSubscriberOnType","EApiFunctionType","ApiSubscriberExecutor","ApiFunctionServiceContextFactory","ApiFunctionContextStorage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MAYa,wBAAwB,CAAA;AAC7B,IAAA,aAAa,OAAO,CAA2B,OAAqP,EAAA;QAC1S,OAAO,MAAMA,6DAAiC,CAAC;AAC9C,YAAA,QAAQ,EAAE,OAAO,YAAuC,KAAuB,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC;AACnK,YAAA,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;AACjC,YAAA,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE,OAAO,CAAC,eAAe;AAC7B,YAAA,gBAAgB,EAAE,OAAO,YAAuC,EAAE,KAAY,KAAmB;AAChG,gBAAA,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,OAAO,EAAE,YAAY,EAAEC,gCAAoB,CAAC,YAAY,EAAE,KAAK,CAAC;YACxH,CAAC;AACD,YAAA,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU;AACrC,YAAA,0BAA0B,EAAE,KAAK;AACjC,SAAA,CAAC;IACH;IAEQ,aAAa,uBAAuB,CAA2B,OAA6H,EAAE,YAAuC,EAAE,MAA4B,EAAE,KAAc,EAAA;QAC1R,MAAM,cAAc,GAAM,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;AAEzD,QAAA,MAAM,qBAAqB,GAAkG;AAC5H,YAAA,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;YACjC,IAAI,EAA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Context, IApiFunctionStepContext } from '../../../interface/class/api/function';
3
+ import { EntityManager, Repository } from 'typeorm';
4
+ export declare class ApiFunctionServiceContextFactory {
5
+ /**
6
+ * Creates a service-bound ApiFunction context for custom functions and internal steps.
7
+ * @template E - Entity type associated with the decorated function or step.
8
+ * @param {object} options - Context creation options.
9
+ * @param {new (...arguments_: Array<unknown>) => E} options.entity - Entity constructor associated with the service context.
10
+ * @param {EntityManager} [options.eventManager] - Active transaction manager, when available.
11
+ * @param {{ repository?: Repository<E> }} options.target - Service instance that owns the decorated method.
12
+ * @param {Repository<E>} [options.target.repository] - Service repository used to resolve non-transactional repositories.
13
+ * @returns {IApiFunctionContext<E>} Service-bound function context.
14
+ */
15
+ static create<E extends IApiBaseEntity>(options: {
16
+ entity: new (...arguments_: Array<unknown>) => E;
17
+ eventManager?: EntityManager;
18
+ target: {
19
+ repository?: Repository<E>;
20
+ };
21
+ }): IApiFunctionContext<E>;
22
+ /**
23
+ * Creates a narrow service-bound ApiFunctionStep context.
24
+ * @template E - Entity type associated with the decorated step.
25
+ * @param {object} options - Context creation options.
26
+ * @param {new (...arguments_: Array<unknown>) => E} options.entity - Entity constructor associated with the step context.
27
+ * @param {EntityManager} [options.eventManager] - Active transaction manager, when available.
28
+ * @param {{ repository?: Repository<E> }} options.target - Service instance that owns the decorated step.
29
+ * @param {Repository<E>} [options.target.repository] - Service repository used to resolve non-transactional repositories.
30
+ * @returns {IApiFunctionStepContext<E>} Service-bound step context.
31
+ */
32
+ static createStep<E extends IApiBaseEntity>(options: {
33
+ entity: new (...arguments_: Array<unknown>) => E;
34
+ eventManager?: EntityManager;
35
+ target: {
36
+ repository?: Repository<E>;
37
+ };
38
+ }): IApiFunctionStepContext<E>;
39
+ /**
40
+ * Resolves repositories from the service repository manager when no transaction manager is active.
41
+ * @template T - Repository entity type.
42
+ * @param {{ repository?: Repository<IApiBaseEntity> }} target - Service instance with an optional repository.
43
+ * @param {Repository<IApiBaseEntity>} [target.repository] - Service repository used to resolve repositories.
44
+ * @param {new () => T} entity - Entity constructor to resolve.
45
+ * @returns {Repository<T>} Repository from the service manager.
46
+ */
47
+ private static getManagerRepository;
48
+ /**
49
+ * Resolves a repository from the service repository manager if a service repository exists.
50
+ * @template T - Repository entity type.
51
+ * @param {{ repository?: Repository<IApiBaseEntity> }} target - Service instance with an optional repository.
52
+ * @param {Repository<IApiBaseEntity>} [target.repository] - Service repository used to resolve repositories.
53
+ * @param {new () => T} entity - Entity constructor to resolve.
54
+ * @returns {Repository<T> | undefined} Repository from the service manager, when available.
55
+ */
56
+ private static resolveManagerRepository;
57
+ }
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ var exception_utility = require('../../../utility/error/exception.utility.js');
4
+
5
+ class ApiFunctionServiceContextFactory {
6
+ /**
7
+ * Creates a service-bound ApiFunction context for custom functions and internal steps.
8
+ * @template E - Entity type associated with the decorated function or step.
9
+ * @param {object} options - Context creation options.
10
+ * @param {new (...arguments_: Array<unknown>) => E} options.entity - Entity constructor associated with the service context.
11
+ * @param {EntityManager} [options.eventManager] - Active transaction manager, when available.
12
+ * @param {{ repository?: Repository<E> }} options.target - Service instance that owns the decorated method.
13
+ * @param {Repository<E>} [options.target.repository] - Service repository used to resolve non-transactional repositories.
14
+ * @returns {IApiFunctionContext<E>} Service-bound function context.
15
+ */
16
+ static create(options) {
17
+ const repository = options.eventManager?.getRepository(options.entity) ?? ApiFunctionServiceContextFactory.resolveManagerRepository(options.target, options.entity);
18
+ if (!repository) {
19
+ throw exception_utility.ErrorException("Repository is not available in this context");
20
+ }
21
+ return {
22
+ entity: options.entity,
23
+ eventManager: options.eventManager,
24
+ getRepository: (repositoryEntity) => options.eventManager?.getRepository(repositoryEntity) ?? ApiFunctionServiceContextFactory.getManagerRepository(options.target, repositoryEntity),
25
+ operations: {
26
+ create: async (properties) => await options.target.create(properties),
27
+ delete: async (criteria) => {
28
+ await options.target.delete(criteria);
29
+ },
30
+ get: async (properties) => await options.target.get(properties),
31
+ getList: async (properties) => await options.target.getList(properties),
32
+ getMany: async (properties) => await options.target.getMany(properties),
33
+ getRepository: (repositoryEntity) => options.eventManager?.getRepository(repositoryEntity) ?? ApiFunctionServiceContextFactory.getManagerRepository(options.target, repositoryEntity),
34
+ update: async (criteria, properties) => await options.target.update(criteria, properties),
35
+ },
36
+ repository,
37
+ };
38
+ }
39
+ /**
40
+ * Creates a narrow service-bound ApiFunctionStep context.
41
+ * @template E - Entity type associated with the decorated step.
42
+ * @param {object} options - Context creation options.
43
+ * @param {new (...arguments_: Array<unknown>) => E} options.entity - Entity constructor associated with the step context.
44
+ * @param {EntityManager} [options.eventManager] - Active transaction manager, when available.
45
+ * @param {{ repository?: Repository<E> }} options.target - Service instance that owns the decorated step.
46
+ * @param {Repository<E>} [options.target.repository] - Service repository used to resolve non-transactional repositories.
47
+ * @returns {IApiFunctionStepContext<E>} Service-bound step context.
48
+ */
49
+ static createStep(options) {
50
+ const repository = options.eventManager?.getRepository(options.entity) ?? ApiFunctionServiceContextFactory.resolveManagerRepository(options.target, options.entity);
51
+ if (!repository) {
52
+ throw exception_utility.ErrorException("Repository is not available in this context");
53
+ }
54
+ return {
55
+ eventManager: options.eventManager,
56
+ getRepository: (repositoryEntity) => options.eventManager?.getRepository(repositoryEntity) ?? ApiFunctionServiceContextFactory.getManagerRepository(options.target, repositoryEntity),
57
+ repository,
58
+ };
59
+ }
60
+ /**
61
+ * Resolves repositories from the service repository manager when no transaction manager is active.
62
+ * @template T - Repository entity type.
63
+ * @param {{ repository?: Repository<IApiBaseEntity> }} target - Service instance with an optional repository.
64
+ * @param {Repository<IApiBaseEntity>} [target.repository] - Service repository used to resolve repositories.
65
+ * @param {new () => T} entity - Entity constructor to resolve.
66
+ * @returns {Repository<T>} Repository from the service manager.
67
+ */
68
+ static getManagerRepository(target, entity) {
69
+ if (!target.repository) {
70
+ throw exception_utility.ErrorException("Repository is not available in this context");
71
+ }
72
+ return target.repository.manager.getRepository(entity);
73
+ }
74
+ /**
75
+ * Resolves a repository from the service repository manager if a service repository exists.
76
+ * @template T - Repository entity type.
77
+ * @param {{ repository?: Repository<IApiBaseEntity> }} target - Service instance with an optional repository.
78
+ * @param {Repository<IApiBaseEntity>} [target.repository] - Service repository used to resolve repositories.
79
+ * @param {new () => T} entity - Entity constructor to resolve.
80
+ * @returns {Repository<T> | undefined} Repository from the service manager, when available.
81
+ */
82
+ static resolveManagerRepository(target, entity) {
83
+ return target.repository?.manager.getRepository(entity);
84
+ }
85
+ }
86
+
87
+ exports.ApiFunctionServiceContextFactory = ApiFunctionServiceContextFactory;
88
+ //# sourceMappingURL=service-context.factory.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-context.factory.class.js","sources":["../../../../../../src/class/api/function/service-context.factory.class.ts"],"sourcesContent":[null],"names":["ErrorException"],"mappings":";;;;MAQa,gCAAgC,CAAA;AAC5C;;;;;;;;;AASG;IACI,OAAO,MAAM,CAA2B,OAAmI,EAAA;QACjL,MAAM,UAAU,GAA8B,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,gCAAgC,CAAC,wBAAwB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;QAE9L,IAAI,CAAC,UAAU,EAAE;AAChB,YAAA,MAAMA,gCAAc,CAAC,6CAA6C,CAAC;QACpE;QAEA,OAAO;YACN,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,aAAa,EAAE,CAA2B,gBAA6B,KAAoB,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,gBAAgB,CAAC,IAAI,gCAAgC,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC;AAC3O,YAAA,UAAU,EAAE;AACX,gBAAA,MAAM,EAAE,OAAO,UAA2C,KAAiB,MAAO,OAAO,CAAC,MAAiE,CAAC,MAAM,CAAC,UAAU,CAAC;AAC9K,gBAAA,MAAM,E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AM,EAAE,gBAAgB,CAAC;YAC3O,UAAU;SACV;IACF;AAEA;;;;;;;AAOG;AACK,IAAA,OAAO,oBAAoB,CAA2B,MAAmD,EAAE,MAAmB,EAAA;AACrI,QAAA,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;AACvB,YAAA,MAAMA,gCAAc,CAAC,6CAA6C,CAAC;QACpE;QAEA,OAAO,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC;IACvD;AAEA;;;;;;;AAOG;AACK,IAAA,OAAO,wBAAwB,CAA2B,MAAmD,EAAE,MAAmB,EAAA;QACzI,OAAO,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC;IACxD;AACA;;;;"}
@@ -0,0 +1,26 @@
1
+ import { EApiFunctionTransactionMode } from '../../../enum/decorator/api';
2
+ import { IApiBaseEntity } from '../../../interface/api-base-entity.interface';
3
+ import { IApiFunctionStepProperties } from '../../../interface/decorator/api/function/step-properties.interface';
4
+ import { Repository } from 'typeorm';
5
+ export declare class ApiFunctionStepRuntime {
6
+ /**
7
+ * Executes an internal function step with Automator transaction semantics.
8
+ * @template E - Entity type associated with the decorated step.
9
+ * @param {object} options - Step execution options.
10
+ * @param {Array<unknown>} options.functionArguments - Original method arguments.
11
+ * @param {(...arguments_: Array<unknown>) => Promise<unknown>} options.originalMethod - Original step method.
12
+ * @param {IApiFunctionStepProperties<E>} options.properties - Step configuration.
13
+ * @param {{ repository?: Repository<E> }} options.target - Service instance that owns the step.
14
+ * @param {EApiFunctionTransactionMode} options.transactionMode - Resolved transaction mode.
15
+ * @returns {Promise<unknown>} Original step result.
16
+ */
17
+ static execute<E extends IApiBaseEntity>(options: {
18
+ functionArguments: Array<unknown>;
19
+ originalMethod: (...arguments_: Array<unknown>) => Promise<unknown>;
20
+ properties: IApiFunctionStepProperties<E>;
21
+ target: {
22
+ repository?: Repository<E>;
23
+ };
24
+ transactionMode: EApiFunctionTransactionMode;
25
+ }): Promise<unknown>;
26
+ }
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var contextStorage_class = require('./context-storage.class.js');
4
+ var serviceContext_factory_class = require('./service-context.factory.class.js');
5
+ var functionTransaction_utility = require('../../../utility/api/function-transaction.utility.js');
6
+
7
+ class ApiFunctionStepRuntime {
8
+ /**
9
+ * Executes an internal function step with Automator transaction semantics.
10
+ * @template E - Entity type associated with the decorated step.
11
+ * @param {object} options - Step execution options.
12
+ * @param {Array<unknown>} options.functionArguments - Original method arguments.
13
+ * @param {(...arguments_: Array<unknown>) => Promise<unknown>} options.originalMethod - Original step method.
14
+ * @param {IApiFunctionStepProperties<E>} options.properties - Step configuration.
15
+ * @param {{ repository?: Repository<E> }} options.target - Service instance that owns the step.
16
+ * @param {EApiFunctionTransactionMode} options.transactionMode - Resolved transaction mode.
17
+ * @returns {Promise<unknown>} Original step result.
18
+ */
19
+ static async execute(options) {
20
+ return await functionTransaction_utility.ApiFunctionExecuteWithTransaction({
21
+ callback: async (eventManager) => {
22
+ const context = serviceContext_factory_class.ApiFunctionServiceContextFactory.createStep({
23
+ entity: options.properties.entity,
24
+ eventManager,
25
+ target: options.target,
26
+ });
27
+ return await contextStorage_class.ApiFunctionContextStorage.runStep(context, async () => await options.originalMethod.apply(options.target, options.functionArguments));
28
+ },
29
+ entity: options.properties.entity,
30
+ label: "ApiFunctionStep",
31
+ mode: options.transactionMode,
32
+ repository: options.target.repository,
33
+ });
34
+ }
35
+ }
36
+
37
+ exports.ApiFunctionStepRuntime = ApiFunctionStepRuntime;
38
+ //# sourceMappingURL=step-runtime.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-runtime.class.js","sources":["../../../../../../src/class/api/function/step-runtime.class.ts"],"sourcesContent":[null],"names":["ApiFunctionExecuteWithTransaction","ApiFunctionServiceContextFactory","ApiFunctionContextStorage"],"mappings":";;;;;;MAUa,sBAAsB,CAAA;AAClC;;;;;;;;;;AAUG;AACI,IAAA,aAAa,OAAO,CAA2B,OAAoP,EAAA;QACzS,OAAO,MAAMA,6DAAiC,CAAC;AAC9C,YAAA,QAAQ,EAAE,OAAO,YAAuC,KAAsB;AAC7E,gBAAA,MAAM,OAAO,GAA+BC,6DAAgC,CAAC,UAAU,CAAC;AACvF,oBAAA,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;oBACjC,YAAY;oBACZ,MAAM,EAAE,OAAO,CAAC,MAAM;AACtB,iBAAA,CAAC;gBAEF,OAAO,MAAMC,8CAAyB,CAAC,OAAO,CAAC,OAAO,EAAE,YAA8B,MAAM,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;YACrK,CAAC;AACD,YAAA,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;AACjC,YAAA,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,OAAO,CAAC,eAAe;AAC7B,YAAA,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU;AACrC,SAAA,CAAC;IACH;AACA;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { IApiBaseEntity } from '../../interface/api-base-entity.interface';
2
- import { IApiFunctionContext } from '../../interface/class/api/function';
2
+ import { IApiFunctionContext, IApiFunctionStepContext } from '../../interface/class/api/function';
3
3
  import { IApiGetListResponseResult } from '../../interface/decorator/api';
4
4
  import { TApiFunctionCreateProperties, TApiFunctionDeleteCriteria, TApiFunctionGetListProperties, TApiFunctionGetManyProperties, TApiFunctionGetProperties, TApiFunctionUpdateCriteria, TApiFunctionUpdateProperties } from '../../type/decorator/api/function';
5
5
  /**
@@ -15,4 +15,5 @@ export declare class ApiServiceBase<E> {
15
15
  getMany(properties: TApiFunctionGetManyProperties<E>): Promise<Array<E>>;
16
16
  update(criteria: Array<TApiFunctionUpdateCriteria<E>> | TApiFunctionUpdateCriteria<E>, properties: TApiFunctionUpdateProperties<E>): Promise<E>;
17
17
  protected getApiFunctionContext<T extends IApiBaseEntity>(): IApiFunctionContext<T>;
18
+ protected getApiFunctionStepContext<T extends IApiBaseEntity>(): IApiFunctionStepContext<T>;
18
19
  }
@@ -30,11 +30,21 @@ class ApiServiceBase {
30
30
  }
31
31
  getApiFunctionContext() {
32
32
  const context = contextStorage_class.ApiFunctionContextStorage.get();
33
+ if (!context && contextStorage_class.ApiFunctionContextStorage.getStep()) {
34
+ throw exception_utility.ErrorException("Api function context is not available inside a decorated ApiFunctionStep execution");
35
+ }
33
36
  if (!context) {
34
37
  throw exception_utility.ErrorException("Api function context is not available outside a decorated ApiFunction execution");
35
38
  }
36
39
  return context;
37
40
  }
41
+ getApiFunctionStepContext() {
42
+ const context = contextStorage_class.ApiFunctionContextStorage.getStep();
43
+ if (!context) {
44
+ throw exception_utility.ErrorException("Api function step context is not available outside a decorated ApiFunctionStep execution");
45
+ }
46
+ return context;
47
+ }
38
48
  }
39
49
 
40
50
  exports.ApiServiceBase = ApiServiceBase;
@@ -1 +1 @@
1
- {"version":3,"file":"service-base.class.js","sources":["../../../../../src/class/api/service-base.class.ts"],"sourcesContent":[null],"names":["ApiFunctionContextStorage","ErrorException"],"mappings":";;;;;AASA;;;;AAIG;MACU,cAAc,CAAA;AAC1B,IAAA,MAAM,CAAC,UAA2C,EAAA;AAGjD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC;IAChC;AAEA,IAAA,MAAM,CAAC,QAA8E,EAAA;AAGpF,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE;IACzB;;AAGA,IAAA,GAAG,CAAC,UAAwC,EAAA;AAG3C,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC;IAChC;AAEA,IAAA,OAAO,CAAC,UAA4C,EAAA;AAGnD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAA6C,CAAC;IAC3F;AAEA,IAAA,OAAO,CAAC,UAA4C,EAAA;AAGnD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3B;IAEA,MAAM,CAAC,QAA8E,EAAE,UAA2C,EAAA;AAIjI,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC;IAChC;IAEU,qBAAqB,GAAA;AAC9B,QAAA,MAAM,OAAO,GAAuCA,8CAAyB,CAAC,GAAG,EAAK;QAEtF,IAAI,CAAC,OAAO,EAAE;AACb,YAAA,MAAMC,gCAAc,CAAC,iFAAiF,CAAC;QACxG;AAEA,QAAA,OAAO,OAAO;IACf;AACA;;;;"}
1
+ {"version":3,"file":"service-base.class.js","sources":["../../../../../src/class/api/service-base.class.ts"],"sourcesContent":[null],"names":["ApiFunctionContextStorage","ErrorException"],"mappings":";;;;;AASA;;;;AAIG;MACU,cAAc,CAAA;AAC1B,IAAA,MAAM,CAAC,UAA2C,EAAA;AAGjD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC;IAChC;AAEA,IAAA,MAAM,CAAC,QAA8E,EAAA;AAGpF,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE;IACzB;;AAGA,IAAA,GAAG,CAAC,UAAwC,EAAA;AAG3C,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC;IAChC;AAEA,IAAA,OAAO,CAAC,UAA4C,EAAA;AAGnD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAA6C,CAAC;IAC3F;AAEA,IAAA,OAAO,CAAC,UAA4C,EAAA;AAGnD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3B;IAEA,MAAM,CAAC,QAA8E,EAAE,UAA2C,EAAA;AAIjI,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC;IAChC;IAEU,qBAAqB,GAAA;AAC9B,QAAA,MAAM,OAAO,GAAuCA,8CAAyB,CAAC,GAAG,EAAK;QAEtF,IAAI,CAAC,OAAO,IAAIA,8CAAyB,CAAC,OAAO,EAAK,EAAE;AACvD,YAAA,MAAMC,gCAAc,CAAC,oFAAoF,CAAC;QAC3G;QAEA,IAAI,CAAC,OAAO,EAAE;AACb,YAAA,MAAMA,gCAAc,CAAC,iFAAiF,CAAC;QACxG;AAEA,QAAA,OAAO,OAAO;IACf;IAEU,yBAAyB,GAAA;AAClC,QAAA,MAAM,OAAO,GAA2CD,8CAAyB,CAAC,OAAO,EAAK;QAE9F,IAAI,CAAC,OAAO,EAAE;AACb,YAAA,MAAMC,gCAAc,CAAC,0FAA0F,CAAC;QACjH;AAEA,QAAA,OAAO,OAAO;IACf;AACA;;;;"}
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var contextStorage_class = require('../function/context-storage.class.js');
3
4
  var controller_constant = require('../../../constant/decorator/api/controller.constant.js');
4
5
  var service_constant = require('../../../constant/decorator/api/service.constant.js');
5
6
  var functionType_enum = require('../../../enum/decorator/api/function-type.enum.js');
@@ -15,14 +16,16 @@ class ApiSubscriberExecutor {
15
16
  }
16
17
  const entityName = ApiSubscriberExecutor.resolveEntityName(entity, context);
17
18
  const subscribers = registry_class.apiSubscriberRegistry.getFunctionSubscribers(entityName, functionType, action ?? context.action);
18
- for (const subscriber of subscribers) {
19
- const hookName = ApiSubscriberExecutor.resolveHookName(onType, functionType);
20
- const hook = subscriber[hookName];
21
- if (typeof hook === "function") {
22
- subscriberLogger.verbose(`Executing function error hook ${hookName} from ${subscriber.constructor.name} for entity ${entityName}`);
23
- await hook.call(subscriber, context, error);
19
+ await contextStorage_class.ApiFunctionContextStorage.runWithoutStepContext(async () => {
20
+ for (const subscriber of subscribers) {
21
+ const hookName = ApiSubscriberExecutor.resolveHookName(onType, functionType);
22
+ const hook = subscriber[hookName];
23
+ if (typeof hook === "function") {
24
+ subscriberLogger.verbose(`Executing function error hook ${hookName} from ${subscriber.constructor.name} for entity ${entityName}`);
25
+ await hook.call(subscriber, context, error);
26
+ }
24
27
  }
25
- }
28
+ });
26
29
  }
27
30
  static async executeFunctionSubscribers(constructor, entity, functionType, onType, context, action) {
28
31
  if (!Reflect.hasMetadata(service_constant.SERVICE_API_DECORATOR_CONSTANT.OBSERVABLE_METADATA_KEY, constructor)) {
@@ -31,17 +34,19 @@ class ApiSubscriberExecutor {
31
34
  const entityName = ApiSubscriberExecutor.resolveEntityName(entity, context);
32
35
  const subscribers = registry_class.apiSubscriberRegistry.getFunctionSubscribers(entityName, functionType, action ?? context.action);
33
36
  let result = context.result;
34
- for (const subscriber of subscribers) {
35
- const hookName = ApiSubscriberExecutor.resolveHookName(onType, functionType);
36
- const hook = subscriber[hookName];
37
- if (typeof hook === "function") {
38
- subscriberLogger.verbose(`Executing function hook ${hookName} from ${subscriber.constructor.name} for entity ${entityName}`);
39
- const hookResult = (await hook.call(subscriber, { ...context, result }));
40
- if (hookResult !== undefined) {
41
- result = hookResult;
37
+ await contextStorage_class.ApiFunctionContextStorage.runWithoutStepContext(async () => {
38
+ for (const subscriber of subscribers) {
39
+ const hookName = ApiSubscriberExecutor.resolveHookName(onType, functionType);
40
+ const hook = subscriber[hookName];
41
+ if (typeof hook === "function") {
42
+ subscriberLogger.verbose(`Executing function hook ${hookName} from ${subscriber.constructor.name} for entity ${entityName}`);
43
+ const hookResult = (await hook.call(subscriber, { ...context, result }));
44
+ if (hookResult !== undefined) {
45
+ result = hookResult;
46
+ }
42
47
  }
43
48
  }
44
- }
49
+ });
45
50
  return result;
46
51
  }
47
52
  static async executeRouteErrorSubscribers(constructor, entity, routeType, onType, context, error, action) {
@@ -1 +1 @@
1
- {"version":3,"file":"executor.class.js","sources":["../../../../../../src/class/api/subscriber/executor.class.ts"],"sourcesContent":[null],"names":["LoggerUtility","SERVICE_API_DECORATOR_CONSTANT","apiSubscriberRegistry","CONTROLLER_API_DECORATOR_CONSTANT","EApiFunctionType","CamelCaseString"],"mappings":";;;;;;;;;AAiBA,MAAM,gBAAgB,GAAkBA,4B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D,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,IAAI,SAAS;QAEpT,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;AACpE,YAAA,OAAO,cAAc;QACtB;AAEA,QAAA,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI;IAC/B;AAEQ,IAAA,OAAO,eAAe,CAAC,MAA4B,EAAE,aAA2D,EAAA;QACvH,OAAO,aAAa,KAAK,SAAS,IAAI,aAAa,KAAKE,kCAAgB,CAAC,MAAM,GAAG,CAAA,EAAA,EAAK,MAAM,CAAA,MAAA,CAAQ,GAAG,CAAA,EAAA,EAAK,MAAM,CAAA,EAAGC,uCAAe,CAAC,aAAa,CAAC,CAAA,CAAE;IACvJ;AACA;;;;"}
1
+ {"version":3,"file":"executor.class.js","sources":["../../../../../../src/class/api/subscriber/executor.class.ts"],"sourcesContent":[null],"names":["LoggerUtility","SERVICE_API_DECORATOR_CONSTANT","apiSubscriberRegistry","ApiFunctionContextStorage","CONTROLLER_API_DECORATOR_CONSTANT","EApiFunctionType","CamelCaseString"],"mappings":";;;;;;;;;;AAkBA,MAAM,gBAAgB,GAAkBA,4BAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC;MAE3E,qBAAqB,CAAA;AAC1B,IAAA,aAAa,+BAA+B,CAAmC,WAA2D,EAAE,MAAS,EAAE,YAA8B,EAAE,MAA4B,EAAE,OAA+D,EAAE,KAAY,EAAE,MAAe,EAAA;AACzT,QAAA,IAAI,CAAC,OAAO,CAAC,WAAW,CAACC,+CAA8B,CAAC,uBAAuB,EAAE,WAAW,CAAC,EAAE;YAC9F;QACD;QAEA,MAAM,UAAU,GAAW,qBAAqB,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC;AACnF,QAAA,MAAM,WAAW,GAAkDC,oCAAqB,CAAC,sBAAsB,CAAC,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;AAE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kCAAgB,CAAC,MAAM,GAAG,CAAA,EAAA,EAAK,MAAM,CAAA,MAAA,CAAQ,GAAG,CAAA,EAAA,EAAK,MAAM,CAAA,EAAGC,uCAAe,CAAC,aAAa,CAAC,CAAA,CAAE;IACvJ;AACA;;;;"}
@@ -98,7 +98,7 @@ function ApiFunctionCreate(properties) {
98
98
  */
99
99
  async function executor(options) {
100
100
  const { constructor, entity, properties, repository } = options;
101
- const eventManager = contextStorage_class.ApiFunctionContextStorage.get()?.eventManager;
101
+ const eventManager = contextStorage_class.ApiFunctionContextStorage.getEventManager();
102
102
  try {
103
103
  let result;
104
104
  if (eventManager) {
@@ -1 +1 @@
1
- {"version":3,"file":"create.decorator.js","sources":["../../../../../../src/decorator/api/function/create.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionTransactionMode","ApiFunctionExecuteWithTransaction","EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","ApiFunctionContextStorage","DatabaseTypeOrmIsEntityNotFound","NotFoundException","ErrorString","EErrorStringAction","DatabaseTypeOrmIsEntityMetadataNotFound","InternalServerErrorException","DatabaseTypeOrmIsForeignKeyViolation","DatabaseTypeOrmGetForeignKeyViolationDetails","EApiExceptionDetailsType","BadRequestException","HttpStatus","DatabaseTypeOrmIsUniqueViolation","DatabaseTypeOrmGetUniqueViolationDetails","ConflictException","HttpException","LoggerUtility"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA;;;;;;AAMG;AACG,SAAU,iBAAiB,CAA2B,UAAqC,EAAA;AAChG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;IACxD,MAAM,eAAe,GAAgC,UAAU,CAAC,WAAW,EAAE,IAAI,IAAIA,wDAA2B,CAAC,QAAQ;AAEzH,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AACtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,gBAAiD,EAAA;YACxH,OAAO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CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,IAAI,CAAA,CAAA,CAAG,EAAE,KAAK,CAAC;QACpG,MAAMnB,oCAAqB,CAAC,+BAA+B,CAAC,WAAW,EAAE,cAAc,EAAED,kCAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,WAAW,EAAE,qBAAqB,EAAE,KAAc,CAAC;AAE1L,QAAA,MAAM,IAAIQ,mCAA4B,CACrCH,0BAAW,CAAC;AACX,YAAA,MAAM,EAAE,MAAM;YACd,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,EACF,EAAE,KAAK,EAAE,WAAW,EAAE,CACtB;IACF;AACD;;;;"}
1
+ {"version":3,"file":"create.decorator.js","sources":["../../../../../../src/decorator/api/function/create.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionTransactionMode","ApiFunctionExecuteWithTransaction","EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","ApiFunctionContextStorage","DatabaseTypeOrmIsEntityNotFound","NotFoundException","ErrorString","EErrorStringAction","DatabaseTypeOrmIsEntityMetadataNotFound","InternalServerErrorException","DatabaseTypeOrmIsForeignKeyViolation","DatabaseTypeOrmGetForeignKeyViolationDetails","EApiExceptionDetailsType","BadRequestException","HttpStatus","DatabaseTypeOrmIsUniqueViolation","DatabaseTypeOrmGetUniqueViolationDetails","ConflictException","HttpException","LoggerUtility"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA;;;;;;AAMG;AACG,SAAU,iBAAiB,CAA2B,UAAqC,EAAA;AAChG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;IACxD,MAAM,eAAe,GAAgC,UAAU,CAAC,WAAW,EAAE,IAAI,IAAIA,wDAA2B,CAAC,QAAQ;AAEzH,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AACtF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