@axisparkjs/engine 1.0.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 (204) hide show
  1. package/PACKAGE.md +3 -0
  2. package/lib/decorators/index.d.ts +6 -0
  3. package/lib/decorators/index.js +23 -0
  4. package/lib/decorators/index.js.map +1 -0
  5. package/lib/decorators/parameter.d.ts +1 -0
  6. package/lib/decorators/parameter.js +20 -0
  7. package/lib/decorators/parameter.js.map +1 -0
  8. package/lib/decorators/pipe.d.ts +6 -0
  9. package/lib/decorators/pipe.js +42 -0
  10. package/lib/decorators/pipe.js.map +1 -0
  11. package/lib/decorators/step-method.d.ts +6 -0
  12. package/lib/decorators/step-method.js +24 -0
  13. package/lib/decorators/step-method.js.map +1 -0
  14. package/lib/decorators/step-target.d.ts +7 -0
  15. package/lib/decorators/step-target.js +31 -0
  16. package/lib/decorators/step-target.js.map +1 -0
  17. package/lib/decorators/timeout.d.ts +2 -0
  18. package/lib/decorators/timeout.js +23 -0
  19. package/lib/decorators/timeout.js.map +1 -0
  20. package/lib/decorators/use.d.ts +2 -0
  21. package/lib/decorators/use.js +20 -0
  22. package/lib/decorators/use.js.map +1 -0
  23. package/lib/execution/execution-context.d.ts +8 -0
  24. package/lib/execution/execution-context.js +3 -0
  25. package/lib/execution/execution-context.js.map +1 -0
  26. package/lib/execution/execution-engine.d.ts +14 -0
  27. package/lib/execution/execution-engine.js +101 -0
  28. package/lib/execution/execution-engine.js.map +1 -0
  29. package/lib/execution/execution-handler.d.ts +5 -0
  30. package/lib/execution/execution-handler.js +3 -0
  31. package/lib/execution/execution-handler.js.map +1 -0
  32. package/lib/execution/execution-plan.d.ts +10 -0
  33. package/lib/execution/execution-plan.js +3 -0
  34. package/lib/execution/execution-plan.js.map +1 -0
  35. package/lib/execution/execution-planner.d.ts +16 -0
  36. package/lib/execution/execution-planner.js +98 -0
  37. package/lib/execution/execution-planner.js.map +1 -0
  38. package/lib/execution/execution-transport.d.ts +5 -0
  39. package/lib/execution/execution-transport.js +10 -0
  40. package/lib/execution/execution-transport.js.map +1 -0
  41. package/lib/execution/handler-invoker.d.ts +13 -0
  42. package/lib/execution/handler-invoker.js +50 -0
  43. package/lib/execution/handler-invoker.js.map +1 -0
  44. package/lib/execution/index.d.ts +7 -0
  45. package/lib/execution/index.js +24 -0
  46. package/lib/execution/index.js.map +1 -0
  47. package/lib/implementations/index.d.ts +3 -0
  48. package/lib/implementations/index.js +20 -0
  49. package/lib/implementations/index.js.map +1 -0
  50. package/lib/implementations/parameters/context.d.ts +7 -0
  51. package/lib/implementations/parameters/context.js +16 -0
  52. package/lib/implementations/parameters/context.js.map +1 -0
  53. package/lib/implementations/parameters/filtered-error.d.ts +7 -0
  54. package/lib/implementations/parameters/filtered-error.js +16 -0
  55. package/lib/implementations/parameters/filtered-error.js.map +1 -0
  56. package/lib/implementations/parameters/index.d.ts +2 -0
  57. package/lib/implementations/parameters/index.js +19 -0
  58. package/lib/implementations/parameters/index.js.map +1 -0
  59. package/lib/implementations/pipe-steps/index.d.ts +13 -0
  60. package/lib/implementations/pipe-steps/index.js +30 -0
  61. package/lib/implementations/pipe-steps/index.js.map +1 -0
  62. package/lib/implementations/pipe-steps/lower-case.d.ts +6 -0
  63. package/lib/implementations/pipe-steps/lower-case.js +23 -0
  64. package/lib/implementations/pipe-steps/lower-case.js.map +1 -0
  65. package/lib/implementations/pipe-steps/max-length.d.ts +12 -0
  66. package/lib/implementations/pipe-steps/max-length.js +32 -0
  67. package/lib/implementations/pipe-steps/max-length.js.map +1 -0
  68. package/lib/implementations/pipe-steps/max.d.ts +12 -0
  69. package/lib/implementations/pipe-steps/max.js +32 -0
  70. package/lib/implementations/pipe-steps/max.js.map +1 -0
  71. package/lib/implementations/pipe-steps/min-length.d.ts +12 -0
  72. package/lib/implementations/pipe-steps/min-length.js +32 -0
  73. package/lib/implementations/pipe-steps/min-length.js.map +1 -0
  74. package/lib/implementations/pipe-steps/min.d.ts +12 -0
  75. package/lib/implementations/pipe-steps/min.js +32 -0
  76. package/lib/implementations/pipe-steps/min.js.map +1 -0
  77. package/lib/implementations/pipe-steps/not-empty.d.ts +6 -0
  78. package/lib/implementations/pipe-steps/not-empty.js +27 -0
  79. package/lib/implementations/pipe-steps/not-empty.js.map +1 -0
  80. package/lib/implementations/pipe-steps/parse-boolean.d.ts +6 -0
  81. package/lib/implementations/pipe-steps/parse-boolean.js +41 -0
  82. package/lib/implementations/pipe-steps/parse-boolean.js.map +1 -0
  83. package/lib/implementations/pipe-steps/parse-float.d.ts +6 -0
  84. package/lib/implementations/pipe-steps/parse-float.js +28 -0
  85. package/lib/implementations/pipe-steps/parse-float.js.map +1 -0
  86. package/lib/implementations/pipe-steps/parse-int.d.ts +12 -0
  87. package/lib/implementations/pipe-steps/parse-int.js +35 -0
  88. package/lib/implementations/pipe-steps/parse-int.js.map +1 -0
  89. package/lib/implementations/pipe-steps/range.d.ts +13 -0
  90. package/lib/implementations/pipe-steps/range.js +32 -0
  91. package/lib/implementations/pipe-steps/range.js.map +1 -0
  92. package/lib/implementations/pipe-steps/regex.d.ts +12 -0
  93. package/lib/implementations/pipe-steps/regex.js +32 -0
  94. package/lib/implementations/pipe-steps/regex.js.map +1 -0
  95. package/lib/implementations/pipe-steps/trim.d.ts +6 -0
  96. package/lib/implementations/pipe-steps/trim.js +23 -0
  97. package/lib/implementations/pipe-steps/trim.js.map +1 -0
  98. package/lib/implementations/pipe-steps/upper-case.d.ts +6 -0
  99. package/lib/implementations/pipe-steps/upper-case.js +23 -0
  100. package/lib/implementations/pipe-steps/upper-case.js.map +1 -0
  101. package/lib/implementations/result/handled-result.d.ts +5 -0
  102. package/lib/implementations/result/handled-result.js +24 -0
  103. package/lib/implementations/result/handled-result.js.map +1 -0
  104. package/lib/implementations/result/index.d.ts +1 -0
  105. package/lib/implementations/result/index.js +18 -0
  106. package/lib/implementations/result/index.js.map +1 -0
  107. package/lib/index.d.ts +7 -0
  108. package/lib/index.js +24 -0
  109. package/lib/index.js.map +1 -0
  110. package/lib/metadata/index.d.ts +6 -0
  111. package/lib/metadata/index.js +23 -0
  112. package/lib/metadata/index.js.map +1 -0
  113. package/lib/metadata/parameter-metadata.d.ts +5 -0
  114. package/lib/metadata/parameter-metadata.js +3 -0
  115. package/lib/metadata/parameter-metadata.js.map +1 -0
  116. package/lib/metadata/pipe-metadata.d.ts +10 -0
  117. package/lib/metadata/pipe-metadata.js +3 -0
  118. package/lib/metadata/pipe-metadata.js.map +1 -0
  119. package/lib/metadata/step-method-metadata.d.ts +24 -0
  120. package/lib/metadata/step-method-metadata.js +3 -0
  121. package/lib/metadata/step-method-metadata.js.map +1 -0
  122. package/lib/metadata/step-target-metadata.d.ts +9 -0
  123. package/lib/metadata/step-target-metadata.js +3 -0
  124. package/lib/metadata/step-target-metadata.js.map +1 -0
  125. package/lib/metadata/timeout-metadata.d.ts +4 -0
  126. package/lib/metadata/timeout-metadata.js +3 -0
  127. package/lib/metadata/timeout-metadata.js.map +1 -0
  128. package/lib/metadata/use-metadata.d.ts +4 -0
  129. package/lib/metadata/use-metadata.js +3 -0
  130. package/lib/metadata/use-metadata.js.map +1 -0
  131. package/lib/parameter/index.d.ts +3 -0
  132. package/lib/parameter/index.js +20 -0
  133. package/lib/parameter/index.js.map +1 -0
  134. package/lib/parameter/parameter-definition.d.ts +15 -0
  135. package/lib/parameter/parameter-definition.js +26 -0
  136. package/lib/parameter/parameter-definition.js.map +1 -0
  137. package/lib/parameter/parameter-generator.d.ts +9 -0
  138. package/lib/parameter/parameter-generator.js +41 -0
  139. package/lib/parameter/parameter-generator.js.map +1 -0
  140. package/lib/parameter/parameter-resolver.d.ts +6 -0
  141. package/lib/parameter/parameter-resolver.js +3 -0
  142. package/lib/parameter/parameter-resolver.js.map +1 -0
  143. package/lib/pipe/index.d.ts +6 -0
  144. package/lib/pipe/index.js +23 -0
  145. package/lib/pipe/index.js.map +1 -0
  146. package/lib/pipe/pipe-definition.d.ts +14 -0
  147. package/lib/pipe/pipe-definition.js +11 -0
  148. package/lib/pipe/pipe-definition.js.map +1 -0
  149. package/lib/pipe/pipe-generator.d.ts +7 -0
  150. package/lib/pipe/pipe-generator.js +53 -0
  151. package/lib/pipe/pipe-generator.js.map +1 -0
  152. package/lib/pipe/pipe-processor.d.ts +9 -0
  153. package/lib/pipe/pipe-processor.js +48 -0
  154. package/lib/pipe/pipe-processor.js.map +1 -0
  155. package/lib/pipe/pipe-scope.d.ts +5 -0
  156. package/lib/pipe/pipe-scope.js +10 -0
  157. package/lib/pipe/pipe-scope.js.map +1 -0
  158. package/lib/pipe/pipe-step-errors.d.ts +11 -0
  159. package/lib/pipe/pipe-step-errors.js +26 -0
  160. package/lib/pipe/pipe-step-errors.js.map +1 -0
  161. package/lib/pipe/pipe-step.d.ts +6 -0
  162. package/lib/pipe/pipe-step.js +3 -0
  163. package/lib/pipe/pipe-step.js.map +1 -0
  164. package/lib/result/index.d.ts +3 -0
  165. package/lib/result/index.js +20 -0
  166. package/lib/result/index.js.map +1 -0
  167. package/lib/result/result-definition.d.ts +7 -0
  168. package/lib/result/result-definition.js +11 -0
  169. package/lib/result/result-definition.js.map +1 -0
  170. package/lib/result/result-processor.d.ts +9 -0
  171. package/lib/result/result-processor.js +46 -0
  172. package/lib/result/result-processor.js.map +1 -0
  173. package/lib/result/result-resolver.d.ts +6 -0
  174. package/lib/result/result-resolver.js +7 -0
  175. package/lib/result/result-resolver.js.map +1 -0
  176. package/lib/step/index.d.ts +3 -0
  177. package/lib/step/index.js +20 -0
  178. package/lib/step/index.js.map +1 -0
  179. package/lib/step/step-definition.d.ts +44 -0
  180. package/lib/step/step-definition.js +71 -0
  181. package/lib/step/step-definition.js.map +1 -0
  182. package/lib/step/step-generator.d.ts +10 -0
  183. package/lib/step/step-generator.js +57 -0
  184. package/lib/step/step-generator.js.map +1 -0
  185. package/lib/step/step-priority.d.ts +7 -0
  186. package/lib/step/step-priority.js +12 -0
  187. package/lib/step/step-priority.js.map +1 -0
  188. package/lib/timeout/index.d.ts +4 -0
  189. package/lib/timeout/index.js +21 -0
  190. package/lib/timeout/index.js.map +1 -0
  191. package/lib/timeout/timeout-definition.d.ts +4 -0
  192. package/lib/timeout/timeout-definition.js +10 -0
  193. package/lib/timeout/timeout-definition.js.map +1 -0
  194. package/lib/timeout/timeout-generator.d.ts +9 -0
  195. package/lib/timeout/timeout-generator.js +32 -0
  196. package/lib/timeout/timeout-generator.js.map +1 -0
  197. package/lib/timeout/timeout-processor.d.ts +9 -0
  198. package/lib/timeout/timeout-processor.js +40 -0
  199. package/lib/timeout/timeout-processor.js.map +1 -0
  200. package/lib/timeout/timeout-resolver.d.ts +5 -0
  201. package/lib/timeout/timeout-resolver.js +3 -0
  202. package/lib/timeout/timeout-resolver.js.map +1 -0
  203. package/package.json +30 -0
  204. package/tsconfig.build.json +9 -0
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CatchStepDefinition = exports.AfterStepDefinition = exports.BeforeStepDefinition = exports.CheckStepDefinition = exports.HandleStepDefinition = exports.StepDefinition = exports.StepScope = exports.StepType = void 0;
4
+ var StepType;
5
+ (function (StepType) {
6
+ StepType["Guard"] = "guard";
7
+ StepType["Middleware"] = "middleware";
8
+ StepType["Interceptor"] = "interceptor";
9
+ StepType["Filter"] = "filter";
10
+ })(StepType || (exports.StepType = StepType = {}));
11
+ var StepScope;
12
+ (function (StepScope) {
13
+ StepScope["Before"] = "before";
14
+ StepScope["After"] = "after";
15
+ })(StepScope || (exports.StepScope = StepScope = {}));
16
+ class StepDefinition {
17
+ constructor(global, priority, transport, target, propertyKey, type) {
18
+ this.global = global;
19
+ this.priority = priority;
20
+ this.transport = transport;
21
+ this.target = target;
22
+ this.propertyKey = propertyKey;
23
+ this.type = type;
24
+ if (!this.global)
25
+ this.priority = 0;
26
+ }
27
+ static fromMetadata(sMM, sTM) {
28
+ switch (sMM.type) {
29
+ case StepType.Middleware:
30
+ return new HandleStepDefinition(sTM.global, sTM.priority, sTM.transport, sMM.target, sMM.propertyKey, sMM.type);
31
+ case StepType.Guard:
32
+ return new CheckStepDefinition(sTM.global, sTM.priority, sTM.transport, sMM.target, sMM.propertyKey, sMM.type);
33
+ case StepType.Interceptor:
34
+ if (sMM.scope === StepScope.Before)
35
+ return new BeforeStepDefinition(sTM.global, sTM.priority, sTM.transport, sMM.target, sMM.propertyKey, sMM.type, sMM.scope);
36
+ else
37
+ return new AfterStepDefinition(sTM.global, sTM.priority, sTM.transport, sMM.target, sMM.propertyKey, sMM.type, sMM.scope);
38
+ case StepType.Filter:
39
+ return new CatchStepDefinition(sTM.global, sTM.priority, sTM.transport, sMM.target, sMM.propertyKey, sMM.type, sMM.acceptedErrors);
40
+ }
41
+ }
42
+ }
43
+ exports.StepDefinition = StepDefinition;
44
+ class HandleStepDefinition extends StepDefinition {
45
+ }
46
+ exports.HandleStepDefinition = HandleStepDefinition;
47
+ class CheckStepDefinition extends StepDefinition {
48
+ }
49
+ exports.CheckStepDefinition = CheckStepDefinition;
50
+ class BeforeStepDefinition extends StepDefinition {
51
+ constructor(global, priority, transport, target, propertyKey, type, scope) {
52
+ super(global, priority, transport, target, propertyKey, type);
53
+ this.scope = scope;
54
+ }
55
+ }
56
+ exports.BeforeStepDefinition = BeforeStepDefinition;
57
+ class AfterStepDefinition extends StepDefinition {
58
+ constructor(global, priority, transport, target, propertyKey, type, scope) {
59
+ super(global, priority, transport, target, propertyKey, type);
60
+ this.scope = scope;
61
+ }
62
+ }
63
+ exports.AfterStepDefinition = AfterStepDefinition;
64
+ class CatchStepDefinition extends StepDefinition {
65
+ constructor(global, priority, transport, target, propertyKey, type, acceptedErrors) {
66
+ super(global, priority, transport, target, propertyKey, type);
67
+ this.acceptedErrors = acceptedErrors;
68
+ }
69
+ }
70
+ exports.CatchStepDefinition = CatchStepDefinition;
71
+ //# sourceMappingURL=step-definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-definition.js","sourceRoot":"","sources":["../../src/step/step-definition.ts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,QAAgB,EAChB,SAA6B,EAC7B,MAAiB,EACjB,WAA4B,EAC5B,IAA0B,EACV,KAAsB;QAEtC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAF9C,UAAK,GAAL,KAAK,CAAiB;IAG1C,CAAC;CACJ;AAdD,kDAcC;AAKD,MAAa,mBAAoB,SAAQ,cAAc;IAGnD,YACI,MAAe,EACf,QAAgB,EAChB,SAA6B,EAC7B,MAAiB,EACjB,WAA4B,EAC5B,IAAqB,EACL,cAAkC;QAElD,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAF9C,mBAAc,GAAd,cAAc,CAAoB;IAGtD,CAAC;CACJ;AAdD,kDAcC"}
@@ -0,0 +1,10 @@
1
+ import { Generator } from '@axisparkjs/common';
2
+ import { ExecutionContext } from '../execution';
3
+ import { StepDefinition } from './step-definition';
4
+ export declare class StepGenerator implements Generator<StepDefinition[]> {
5
+ private readonly globalSteps;
6
+ generate(context: ExecutionContext): StepDefinition[];
7
+ private buildGlobalSteps;
8
+ private getTargets;
9
+ private buildSteps;
10
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.StepGenerator = void 0;
10
+ const common_1 = require("@axisparkjs/common");
11
+ const di_1 = require("@axisparkjs/di");
12
+ const step_definition_1 = require("./step-definition");
13
+ let StepGenerator = class StepGenerator {
14
+ constructor() {
15
+ this.globalSteps = [];
16
+ }
17
+ generate(context) {
18
+ const globalSteps = this.buildGlobalSteps();
19
+ const steps = this.getTargets(context).flatMap((target) => this.buildSteps(target, false));
20
+ return [...globalSteps, ...steps];
21
+ }
22
+ buildGlobalSteps() {
23
+ if (this.globalSteps.length > 0)
24
+ return this.globalSteps;
25
+ for (const target of di_1.ClassRegistry.getWithMetadata(common_1.MetadataKeys.STEP_TARGET)) {
26
+ this.globalSteps.push(...this.buildSteps(target, true));
27
+ }
28
+ return this.globalSteps;
29
+ }
30
+ getTargets(context) {
31
+ var _a, _b;
32
+ const classMetadata = common_1.Metadata.get(common_1.MetadataKeys.USE, context.target);
33
+ const methodMetadata = common_1.Metadata.get(common_1.MetadataKeys.USE, context.target, context.propertyKey);
34
+ return [...((_a = classMetadata === null || classMetadata === void 0 ? void 0 : classMetadata.targets) !== null && _a !== void 0 ? _a : []), ...((_b = methodMetadata === null || methodMetadata === void 0 ? void 0 : methodMetadata.targets) !== null && _b !== void 0 ? _b : [])];
35
+ }
36
+ buildSteps(target, global) {
37
+ var _a, _b;
38
+ const targetMetadatas = (_a = common_1.Metadata.get(common_1.MetadataKeys.STEP_TARGET, target)) !== null && _a !== void 0 ? _a : [];
39
+ const methodMetadatas = (_b = common_1.Metadata.get(common_1.MetadataKeys.STEP_METHOD, target)) !== null && _b !== void 0 ? _b : [];
40
+ const steps = [];
41
+ for (const tagetMetadata of targetMetadatas) {
42
+ if (tagetMetadata.global !== global)
43
+ continue;
44
+ for (const methodMetadata of methodMetadatas) {
45
+ if (methodMetadata.type !== tagetMetadata.type)
46
+ continue;
47
+ steps.push(step_definition_1.StepDefinition.fromMetadata(methodMetadata, tagetMetadata));
48
+ }
49
+ }
50
+ return steps;
51
+ }
52
+ };
53
+ exports.StepGenerator = StepGenerator;
54
+ exports.StepGenerator = StepGenerator = __decorate([
55
+ (0, di_1.Injectable)()
56
+ ], StepGenerator);
57
+ //# sourceMappingURL=step-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-generator.js","sourceRoot":"","sources":["../../src/step/step-generator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAkF;AAClF,uCAA2D;AAE3D,uDAAmD;AAO5C,IAAM,aAAa,GAAnB,MAAM,aAAa;IAAnB;QACc,gBAAW,GAAqB,EAAE,CAAC;IA+CxD,CAAC;IAxCU,QAAQ,CAAC,OAAyB;QACrC,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QAE3F,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC,CAAC;IACtC,CAAC;IAEO,gBAAgB;QACpB,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC,WAAW,CAAC;QAEzD,KAAK,MAAM,MAAM,IAAI,kBAAa,CAAC,eAAe,CAAC,qBAAY,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3E,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEO,UAAU,CAAC,OAAyB;;QACxC,MAAM,aAAa,GAAG,iBAAQ,CAAC,GAAG,CAAc,qBAAY,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAClF,MAAM,cAAc,GAAG,iBAAQ,CAAC,GAAG,CAAc,qBAAY,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAExG,OAAO,CAAC,GAAG,CAAC,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,mCAAI,EAAE,CAAC,EAAE,GAAG,CAAC,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,mCAAI,EAAE,CAAC,CAAC,CAAC;IACnF,CAAC;IAEO,UAAU,CAAC,MAAiB,EAAE,MAAe;;QACjD,MAAM,eAAe,GAAG,MAAA,iBAAQ,CAAC,GAAG,CAAuB,qBAAY,CAAC,WAAW,EAAE,MAAM,CAAC,mCAAI,EAAE,CAAC;QACnG,MAAM,eAAe,GAAG,MAAA,iBAAQ,CAAC,GAAG,CAAuB,qBAAY,CAAC,WAAW,EAAE,MAAM,CAAC,mCAAI,EAAE,CAAC;QAEnG,MAAM,KAAK,GAAqB,EAAE,CAAC;QACnC,KAAK,MAAM,aAAa,IAAI,eAAe,EAAE,CAAC;YAC1C,IAAI,aAAa,CAAC,MAAM,KAAK,MAAM;gBAAE,SAAS;YAE9C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;gBAC3C,IAAI,cAAc,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI;oBAAE,SAAS;gBAEzD,KAAK,CAAC,IAAI,CAAC,gCAAc,CAAC,YAAY,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC;YAC3E,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAhDY,sCAAa;wBAAb,aAAa;IADzB,IAAA,eAAU,GAAE;GACA,aAAa,CAgDzB"}
@@ -0,0 +1,7 @@
1
+ export declare enum StepPriority {
2
+ Base = 0,
3
+ Low = 1,
4
+ Normal = 5,
5
+ High = 10,
6
+ Critical = 20
7
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StepPriority = void 0;
4
+ var StepPriority;
5
+ (function (StepPriority) {
6
+ StepPriority[StepPriority["Base"] = 0] = "Base";
7
+ StepPriority[StepPriority["Low"] = 1] = "Low";
8
+ StepPriority[StepPriority["Normal"] = 5] = "Normal";
9
+ StepPriority[StepPriority["High"] = 10] = "High";
10
+ StepPriority[StepPriority["Critical"] = 20] = "Critical";
11
+ })(StepPriority || (exports.StepPriority = StepPriority = {}));
12
+ //# sourceMappingURL=step-priority.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-priority.js","sourceRoot":"","sources":["../../src/step/step-priority.ts"],"names":[],"mappings":";;;AAGA,IAAY,YAMX;AAND,WAAY,YAAY;IACpB,+CAAQ,CAAA;IACR,6CAAO,CAAA;IACP,mDAAU,CAAA;IACV,gDAAS,CAAA;IACT,wDAAa,CAAA;AACjB,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB"}
@@ -0,0 +1,4 @@
1
+ export * from './timeout-generator';
2
+ export * from './timeout-processor';
3
+ export * from './timeout-resolver';
4
+ export * from './timeout-definition';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./timeout-generator"), exports);
18
+ __exportStar(require("./timeout-processor"), exports);
19
+ __exportStar(require("./timeout-resolver"), exports);
20
+ __exportStar(require("./timeout-definition"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/timeout/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,sDAAoC;AACpC,qDAAmC;AACnC,uDAAqC"}
@@ -0,0 +1,4 @@
1
+ export declare class TimeoutDefinition {
2
+ readonly time: number;
3
+ constructor(time: number);
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimeoutDefinition = void 0;
4
+ class TimeoutDefinition {
5
+ constructor(time) {
6
+ this.time = time;
7
+ }
8
+ }
9
+ exports.TimeoutDefinition = TimeoutDefinition;
10
+ //# sourceMappingURL=timeout-definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout-definition.js","sourceRoot":"","sources":["../../src/timeout/timeout-definition.ts"],"names":[],"mappings":";;;AAKA,MAAa,iBAAiB;IAC1B,YAA4B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;CAC/C;AAFD,8CAEC"}
@@ -0,0 +1,9 @@
1
+ import { Generator } from '@axisparkjs/common';
2
+ import { ExecutionContext, ExecutionTransport } from '../execution';
3
+ import { TimeoutDefinition } from './timeout-definition';
4
+ export declare class TimeoutGenerator implements Generator<TimeoutDefinition | undefined> {
5
+ private static readonly defaultTimeout;
6
+ private static readonly timeouts;
7
+ static registerTimeout(transport: ExecutionTransport, time?: number): void;
8
+ generate(context: ExecutionContext): TimeoutDefinition | undefined;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var TimeoutGenerator_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.TimeoutGenerator = void 0;
11
+ const common_1 = require("@axisparkjs/common");
12
+ const timeout_definition_1 = require("./timeout-definition");
13
+ const di_1 = require("@axisparkjs/di");
14
+ let TimeoutGenerator = TimeoutGenerator_1 = class TimeoutGenerator {
15
+ static registerTimeout(transport, time) {
16
+ this.timeouts.set(transport, time !== null && time !== void 0 ? time : this.defaultTimeout);
17
+ }
18
+ generate(context) {
19
+ var _a, _b;
20
+ const classMetadata = common_1.Metadata.get(common_1.MetadataKeys.TIMEOUT, context.target);
21
+ const methodMetadata = common_1.Metadata.get(common_1.MetadataKeys.TIMEOUT, context.target, context.propertyKey);
22
+ const time = (_b = (_a = methodMetadata === null || methodMetadata === void 0 ? void 0 : methodMetadata.time) !== null && _a !== void 0 ? _a : classMetadata === null || classMetadata === void 0 ? void 0 : classMetadata.time) !== null && _b !== void 0 ? _b : TimeoutGenerator_1.timeouts.get(context.transport);
23
+ return time !== undefined ? new timeout_definition_1.TimeoutDefinition(time) : undefined;
24
+ }
25
+ };
26
+ exports.TimeoutGenerator = TimeoutGenerator;
27
+ TimeoutGenerator.defaultTimeout = 10000;
28
+ TimeoutGenerator.timeouts = new Map();
29
+ exports.TimeoutGenerator = TimeoutGenerator = TimeoutGenerator_1 = __decorate([
30
+ (0, di_1.Injectable)()
31
+ ], TimeoutGenerator);
32
+ //# sourceMappingURL=timeout-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout-generator.js","sourceRoot":"","sources":["../../src/timeout/timeout-generator.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+CAAuE;AAGvE,6DAAyD;AACzD,uCAA4C;AAQrC,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAIlB,MAAM,CAAC,eAAe,CAAC,SAA6B,EAAE,IAAa;QACtE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;IAOM,QAAQ,CAAC,OAAyB;;QACrC,MAAM,aAAa,GAAG,iBAAQ,CAAC,GAAG,CAAkB,qBAAY,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1F,MAAM,cAAc,GAAG,iBAAQ,CAAC,GAAG,CAAkB,qBAAY,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAChH,MAAM,IAAI,GAAG,MAAA,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,mCAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,mCAAI,kBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE7G,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,sCAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,CAAC;;AAnBQ,4CAAgB;AACD,+BAAc,GAAG,KAAK,AAAR,CAAS;AACvB,yBAAQ,GAAG,IAAI,GAAG,EAA8B,AAAxC,CAAyC;2BAFhE,gBAAgB;IAD5B,IAAA,eAAU,GAAE;GACA,gBAAgB,CAoB5B"}
@@ -0,0 +1,9 @@
1
+ import { Processable } from '@axisparkjs/common';
2
+ import { ExecutionContext, ExecutionTransport } from '../execution';
3
+ import { TimeoutResolver } from './timeout-resolver';
4
+ import { TimeoutDefinition } from './timeout-definition';
5
+ export declare class TimeoutProcessor implements Processable {
6
+ private static readonly resolvers;
7
+ static registerTimeout(transport: ExecutionTransport, resolver: TimeoutResolver): void;
8
+ process(timeout: TimeoutDefinition, context: ExecutionContext): Promise<void>;
9
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ var TimeoutProcessor_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.TimeoutProcessor = void 0;
20
+ const di_1 = require("@axisparkjs/di");
21
+ let TimeoutProcessor = TimeoutProcessor_1 = class TimeoutProcessor {
22
+ static registerTimeout(transport, resolver) {
23
+ this.resolvers.set(transport, resolver);
24
+ }
25
+ process(timeout, context) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const resolver = TimeoutProcessor_1.resolvers.get(context.transport);
28
+ if (!resolver) {
29
+ return;
30
+ }
31
+ yield resolver.resolve(timeout);
32
+ });
33
+ }
34
+ };
35
+ exports.TimeoutProcessor = TimeoutProcessor;
36
+ TimeoutProcessor.resolvers = new Map();
37
+ exports.TimeoutProcessor = TimeoutProcessor = TimeoutProcessor_1 = __decorate([
38
+ (0, di_1.Injectable)()
39
+ ], TimeoutProcessor);
40
+ //# sourceMappingURL=timeout-processor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout-processor.js","sourceRoot":"","sources":["../../src/timeout/timeout-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AACA,uCAA4C;AAUrC,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAGzB,MAAM,CAAC,eAAe,CAAC,SAA6B,EAAE,QAAyB;QAC3E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAQK,OAAO,CAAC,OAA0B,EAAE,OAAyB;;YAC/D,MAAM,QAAQ,GAAG,kBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACZ,OAAO;YACX,CAAC;YAED,MAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;KAAA;;AApBQ,4CAAgB;AACD,0BAAS,GAAG,IAAI,GAAG,EAAuC,AAAjD,CAAkD;2BAD1E,gBAAgB;IAD5B,IAAA,eAAU,GAAE;GACA,gBAAgB,CAqB5B"}
@@ -0,0 +1,5 @@
1
+ import { Resolver } from '@axisparkjs/common';
2
+ import { TimeoutDefinition } from './timeout-definition';
3
+ export interface TimeoutResolver extends Resolver<void> {
4
+ resolve(timeout: TimeoutDefinition): Promise<void> | void;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=timeout-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout-resolver.js","sourceRoot":"","sources":["../../src/timeout/timeout-resolver.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@axisparkjs/engine",
3
+ "version": "1.0.0",
4
+ "description": "AxiSpark.js - The Ultimate Node.js Framework - @axisparkjs/engine",
5
+ "author": "Pablo Gálvez Ortuño",
6
+ "license": "Apache-2.0",
7
+ "main": "lib/index.js",
8
+ "types": "lib/index.d.ts",
9
+ "files": [
10
+ "lib",
11
+ "package.json",
12
+ "PACKAGE.md",
13
+ "tsconfig.build.json"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc -b tsconfig.build.json",
17
+ "prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore '**/*.{ts,js,mjs,json,md,html,css,scss}' --check",
18
+ "lint": "eslint --config ../../eslint.config.mjs .",
19
+ "test:unit": "export NODE_ENV=test && jest --config jest.config.ts",
20
+ "sonar": "sonar-scanner -Dsonar.projectKey=axisparkjs-engine"
21
+ },
22
+ "engines": {
23
+ "node": ">= 20"
24
+ },
25
+ "dependencies": {
26
+ "@axisparkjs/common": "1.0.0",
27
+ "@axisparkjs/di": "1.0.0",
28
+ "@axisparkjs/logger": "1.0.0"
29
+ }
30
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "lib"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["node_modules", "lib", "jest.config.ts", "**/*.spec.ts"]
9
+ }