@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.
- package/PACKAGE.md +3 -0
- package/lib/decorators/index.d.ts +6 -0
- package/lib/decorators/index.js +23 -0
- package/lib/decorators/index.js.map +1 -0
- package/lib/decorators/parameter.d.ts +1 -0
- package/lib/decorators/parameter.js +20 -0
- package/lib/decorators/parameter.js.map +1 -0
- package/lib/decorators/pipe.d.ts +6 -0
- package/lib/decorators/pipe.js +42 -0
- package/lib/decorators/pipe.js.map +1 -0
- package/lib/decorators/step-method.d.ts +6 -0
- package/lib/decorators/step-method.js +24 -0
- package/lib/decorators/step-method.js.map +1 -0
- package/lib/decorators/step-target.d.ts +7 -0
- package/lib/decorators/step-target.js +31 -0
- package/lib/decorators/step-target.js.map +1 -0
- package/lib/decorators/timeout.d.ts +2 -0
- package/lib/decorators/timeout.js +23 -0
- package/lib/decorators/timeout.js.map +1 -0
- package/lib/decorators/use.d.ts +2 -0
- package/lib/decorators/use.js +20 -0
- package/lib/decorators/use.js.map +1 -0
- package/lib/execution/execution-context.d.ts +8 -0
- package/lib/execution/execution-context.js +3 -0
- package/lib/execution/execution-context.js.map +1 -0
- package/lib/execution/execution-engine.d.ts +14 -0
- package/lib/execution/execution-engine.js +101 -0
- package/lib/execution/execution-engine.js.map +1 -0
- package/lib/execution/execution-handler.d.ts +5 -0
- package/lib/execution/execution-handler.js +3 -0
- package/lib/execution/execution-handler.js.map +1 -0
- package/lib/execution/execution-plan.d.ts +10 -0
- package/lib/execution/execution-plan.js +3 -0
- package/lib/execution/execution-plan.js.map +1 -0
- package/lib/execution/execution-planner.d.ts +16 -0
- package/lib/execution/execution-planner.js +98 -0
- package/lib/execution/execution-planner.js.map +1 -0
- package/lib/execution/execution-transport.d.ts +5 -0
- package/lib/execution/execution-transport.js +10 -0
- package/lib/execution/execution-transport.js.map +1 -0
- package/lib/execution/handler-invoker.d.ts +13 -0
- package/lib/execution/handler-invoker.js +50 -0
- package/lib/execution/handler-invoker.js.map +1 -0
- package/lib/execution/index.d.ts +7 -0
- package/lib/execution/index.js +24 -0
- package/lib/execution/index.js.map +1 -0
- package/lib/implementations/index.d.ts +3 -0
- package/lib/implementations/index.js +20 -0
- package/lib/implementations/index.js.map +1 -0
- package/lib/implementations/parameters/context.d.ts +7 -0
- package/lib/implementations/parameters/context.js +16 -0
- package/lib/implementations/parameters/context.js.map +1 -0
- package/lib/implementations/parameters/filtered-error.d.ts +7 -0
- package/lib/implementations/parameters/filtered-error.js +16 -0
- package/lib/implementations/parameters/filtered-error.js.map +1 -0
- package/lib/implementations/parameters/index.d.ts +2 -0
- package/lib/implementations/parameters/index.js +19 -0
- package/lib/implementations/parameters/index.js.map +1 -0
- package/lib/implementations/pipe-steps/index.d.ts +13 -0
- package/lib/implementations/pipe-steps/index.js +30 -0
- package/lib/implementations/pipe-steps/index.js.map +1 -0
- package/lib/implementations/pipe-steps/lower-case.d.ts +6 -0
- package/lib/implementations/pipe-steps/lower-case.js +23 -0
- package/lib/implementations/pipe-steps/lower-case.js.map +1 -0
- package/lib/implementations/pipe-steps/max-length.d.ts +12 -0
- package/lib/implementations/pipe-steps/max-length.js +32 -0
- package/lib/implementations/pipe-steps/max-length.js.map +1 -0
- package/lib/implementations/pipe-steps/max.d.ts +12 -0
- package/lib/implementations/pipe-steps/max.js +32 -0
- package/lib/implementations/pipe-steps/max.js.map +1 -0
- package/lib/implementations/pipe-steps/min-length.d.ts +12 -0
- package/lib/implementations/pipe-steps/min-length.js +32 -0
- package/lib/implementations/pipe-steps/min-length.js.map +1 -0
- package/lib/implementations/pipe-steps/min.d.ts +12 -0
- package/lib/implementations/pipe-steps/min.js +32 -0
- package/lib/implementations/pipe-steps/min.js.map +1 -0
- package/lib/implementations/pipe-steps/not-empty.d.ts +6 -0
- package/lib/implementations/pipe-steps/not-empty.js +27 -0
- package/lib/implementations/pipe-steps/not-empty.js.map +1 -0
- package/lib/implementations/pipe-steps/parse-boolean.d.ts +6 -0
- package/lib/implementations/pipe-steps/parse-boolean.js +41 -0
- package/lib/implementations/pipe-steps/parse-boolean.js.map +1 -0
- package/lib/implementations/pipe-steps/parse-float.d.ts +6 -0
- package/lib/implementations/pipe-steps/parse-float.js +28 -0
- package/lib/implementations/pipe-steps/parse-float.js.map +1 -0
- package/lib/implementations/pipe-steps/parse-int.d.ts +12 -0
- package/lib/implementations/pipe-steps/parse-int.js +35 -0
- package/lib/implementations/pipe-steps/parse-int.js.map +1 -0
- package/lib/implementations/pipe-steps/range.d.ts +13 -0
- package/lib/implementations/pipe-steps/range.js +32 -0
- package/lib/implementations/pipe-steps/range.js.map +1 -0
- package/lib/implementations/pipe-steps/regex.d.ts +12 -0
- package/lib/implementations/pipe-steps/regex.js +32 -0
- package/lib/implementations/pipe-steps/regex.js.map +1 -0
- package/lib/implementations/pipe-steps/trim.d.ts +6 -0
- package/lib/implementations/pipe-steps/trim.js +23 -0
- package/lib/implementations/pipe-steps/trim.js.map +1 -0
- package/lib/implementations/pipe-steps/upper-case.d.ts +6 -0
- package/lib/implementations/pipe-steps/upper-case.js +23 -0
- package/lib/implementations/pipe-steps/upper-case.js.map +1 -0
- package/lib/implementations/result/handled-result.d.ts +5 -0
- package/lib/implementations/result/handled-result.js +24 -0
- package/lib/implementations/result/handled-result.js.map +1 -0
- package/lib/implementations/result/index.d.ts +1 -0
- package/lib/implementations/result/index.js +18 -0
- package/lib/implementations/result/index.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/lib/metadata/index.d.ts +6 -0
- package/lib/metadata/index.js +23 -0
- package/lib/metadata/index.js.map +1 -0
- package/lib/metadata/parameter-metadata.d.ts +5 -0
- package/lib/metadata/parameter-metadata.js +3 -0
- package/lib/metadata/parameter-metadata.js.map +1 -0
- package/lib/metadata/pipe-metadata.d.ts +10 -0
- package/lib/metadata/pipe-metadata.js +3 -0
- package/lib/metadata/pipe-metadata.js.map +1 -0
- package/lib/metadata/step-method-metadata.d.ts +24 -0
- package/lib/metadata/step-method-metadata.js +3 -0
- package/lib/metadata/step-method-metadata.js.map +1 -0
- package/lib/metadata/step-target-metadata.d.ts +9 -0
- package/lib/metadata/step-target-metadata.js +3 -0
- package/lib/metadata/step-target-metadata.js.map +1 -0
- package/lib/metadata/timeout-metadata.d.ts +4 -0
- package/lib/metadata/timeout-metadata.js +3 -0
- package/lib/metadata/timeout-metadata.js.map +1 -0
- package/lib/metadata/use-metadata.d.ts +4 -0
- package/lib/metadata/use-metadata.js +3 -0
- package/lib/metadata/use-metadata.js.map +1 -0
- package/lib/parameter/index.d.ts +3 -0
- package/lib/parameter/index.js +20 -0
- package/lib/parameter/index.js.map +1 -0
- package/lib/parameter/parameter-definition.d.ts +15 -0
- package/lib/parameter/parameter-definition.js +26 -0
- package/lib/parameter/parameter-definition.js.map +1 -0
- package/lib/parameter/parameter-generator.d.ts +9 -0
- package/lib/parameter/parameter-generator.js +41 -0
- package/lib/parameter/parameter-generator.js.map +1 -0
- package/lib/parameter/parameter-resolver.d.ts +6 -0
- package/lib/parameter/parameter-resolver.js +3 -0
- package/lib/parameter/parameter-resolver.js.map +1 -0
- package/lib/pipe/index.d.ts +6 -0
- package/lib/pipe/index.js +23 -0
- package/lib/pipe/index.js.map +1 -0
- package/lib/pipe/pipe-definition.d.ts +14 -0
- package/lib/pipe/pipe-definition.js +11 -0
- package/lib/pipe/pipe-definition.js.map +1 -0
- package/lib/pipe/pipe-generator.d.ts +7 -0
- package/lib/pipe/pipe-generator.js +53 -0
- package/lib/pipe/pipe-generator.js.map +1 -0
- package/lib/pipe/pipe-processor.d.ts +9 -0
- package/lib/pipe/pipe-processor.js +48 -0
- package/lib/pipe/pipe-processor.js.map +1 -0
- package/lib/pipe/pipe-scope.d.ts +5 -0
- package/lib/pipe/pipe-scope.js +10 -0
- package/lib/pipe/pipe-scope.js.map +1 -0
- package/lib/pipe/pipe-step-errors.d.ts +11 -0
- package/lib/pipe/pipe-step-errors.js +26 -0
- package/lib/pipe/pipe-step-errors.js.map +1 -0
- package/lib/pipe/pipe-step.d.ts +6 -0
- package/lib/pipe/pipe-step.js +3 -0
- package/lib/pipe/pipe-step.js.map +1 -0
- package/lib/result/index.d.ts +3 -0
- package/lib/result/index.js +20 -0
- package/lib/result/index.js.map +1 -0
- package/lib/result/result-definition.d.ts +7 -0
- package/lib/result/result-definition.js +11 -0
- package/lib/result/result-definition.js.map +1 -0
- package/lib/result/result-processor.d.ts +9 -0
- package/lib/result/result-processor.js +46 -0
- package/lib/result/result-processor.js.map +1 -0
- package/lib/result/result-resolver.d.ts +6 -0
- package/lib/result/result-resolver.js +7 -0
- package/lib/result/result-resolver.js.map +1 -0
- package/lib/step/index.d.ts +3 -0
- package/lib/step/index.js +20 -0
- package/lib/step/index.js.map +1 -0
- package/lib/step/step-definition.d.ts +44 -0
- package/lib/step/step-definition.js +71 -0
- package/lib/step/step-definition.js.map +1 -0
- package/lib/step/step-generator.d.ts +10 -0
- package/lib/step/step-generator.js +57 -0
- package/lib/step/step-generator.js.map +1 -0
- package/lib/step/step-priority.d.ts +7 -0
- package/lib/step/step-priority.js +12 -0
- package/lib/step/step-priority.js.map +1 -0
- package/lib/timeout/index.d.ts +4 -0
- package/lib/timeout/index.js +21 -0
- package/lib/timeout/index.js.map +1 -0
- package/lib/timeout/timeout-definition.d.ts +4 -0
- package/lib/timeout/timeout-definition.js +10 -0
- package/lib/timeout/timeout-definition.js.map +1 -0
- package/lib/timeout/timeout-generator.d.ts +9 -0
- package/lib/timeout/timeout-generator.js +32 -0
- package/lib/timeout/timeout-generator.js.map +1 -0
- package/lib/timeout/timeout-processor.d.ts +9 -0
- package/lib/timeout/timeout-processor.js +40 -0
- package/lib/timeout/timeout-processor.js.map +1 -0
- package/lib/timeout/timeout-resolver.d.ts +5 -0
- package/lib/timeout/timeout-resolver.js +3 -0
- package/lib/timeout/timeout-resolver.js.map +1 -0
- package/package.json +30 -0
- package/tsconfig.build.json +9 -0
|
@@ -0,0 +1,41 @@
|
|
|
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 ParameterGenerator_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ParameterGenerator = void 0;
|
|
11
|
+
const common_1 = require("@axisparkjs/common");
|
|
12
|
+
const parameter_definition_1 = require("./parameter-definition");
|
|
13
|
+
const di_1 = require("@axisparkjs/di");
|
|
14
|
+
let ParameterGenerator = ParameterGenerator_1 = class ParameterGenerator {
|
|
15
|
+
static registerParameter(parameter, resolver) {
|
|
16
|
+
this.resolvers.set(parameter, resolver);
|
|
17
|
+
}
|
|
18
|
+
generate(executionContext, executionHandler, resolving = true) {
|
|
19
|
+
var _a;
|
|
20
|
+
const parametersMetadata = (_a = common_1.Metadata.get(common_1.MetadataKeys.PARAMETER, executionHandler.target, executionHandler.propertyKey)) !== null && _a !== void 0 ? _a : [];
|
|
21
|
+
const args = [];
|
|
22
|
+
for (const parameterMetadata of parametersMetadata) {
|
|
23
|
+
if (!ParameterGenerator_1.resolvers.has(parameterMetadata.parameter))
|
|
24
|
+
continue;
|
|
25
|
+
const resolver = ParameterGenerator_1.resolvers.get(parameterMetadata.parameter);
|
|
26
|
+
const parameter = parameter_definition_1.ParameterDefinition.fromMetadata(parameterMetadata);
|
|
27
|
+
if (resolving && executionContext) {
|
|
28
|
+
const resolvedValue = resolver.resolve(executionContext, parameter);
|
|
29
|
+
parameter.setValue(resolvedValue);
|
|
30
|
+
}
|
|
31
|
+
args[parameterMetadata.parameterIndex] = parameter;
|
|
32
|
+
}
|
|
33
|
+
return args;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.ParameterGenerator = ParameterGenerator;
|
|
37
|
+
ParameterGenerator.resolvers = new Map();
|
|
38
|
+
exports.ParameterGenerator = ParameterGenerator = ParameterGenerator_1 = __decorate([
|
|
39
|
+
(0, di_1.Injectable)()
|
|
40
|
+
], ParameterGenerator);
|
|
41
|
+
//# sourceMappingURL=parameter-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameter-generator.js","sourceRoot":"","sources":["../../src/parameter/parameter-generator.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+CAAuE;AAIvE,iEAA6D;AAC7D,uCAA4C;AAMrC,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAQ3B,MAAM,CAAC,iBAAiB,CAAC,SAAiB,EAAE,QAAgC;QACxE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAUD,QAAQ,CAAC,gBAA8C,EAAE,gBAAkC,EAAE,SAAS,GAAG,IAAI;;QACzG,MAAM,kBAAkB,GAAG,MAAA,iBAAQ,CAAC,GAAG,CAAsB,qBAAY,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,WAAW,CAAC,mCAAI,EAAE,CAAC;QAClJ,MAAM,IAAI,GAA0B,EAAE,CAAC;QACvC,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE,CAAC;YACjD,IAAI,CAAC,oBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC;gBAAE,SAAS;YAE7E,MAAM,QAAQ,GAAG,oBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAA2B,CAAC;YACzG,MAAM,SAAS,GAAG,0CAAmB,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;YACtE,IAAI,SAAS,IAAI,gBAAgB,EAAE,CAAC;gBAChC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;gBACpE,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YACtC,CAAC;YACD,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;;AApCQ,gDAAkB;AACH,4BAAS,GAAG,IAAI,GAAG,EAAkC,AAA5C,CAA6C;6BADrE,kBAAkB;IAD9B,IAAA,eAAU,GAAE;GACA,kBAAkB,CAqC9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Resolver } from '@axisparkjs/common';
|
|
2
|
+
import { ParameterDefinition } from './parameter-definition';
|
|
3
|
+
import { ExecutionContext } from '../execution/execution-context';
|
|
4
|
+
export interface ParameterResolver<T> extends Resolver<T> {
|
|
5
|
+
resolve(executionContext: ExecutionContext, parameter: ParameterDefinition): T;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameter-resolver.js","sourceRoot":"","sources":["../../src/parameter/parameter-resolver.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./pipe-generator"), exports);
|
|
18
|
+
__exportStar(require("./pipe-processor"), exports);
|
|
19
|
+
__exportStar(require("./pipe-scope"), exports);
|
|
20
|
+
__exportStar(require("./pipe-step-errors"), exports);
|
|
21
|
+
__exportStar(require("./pipe-step"), exports);
|
|
22
|
+
__exportStar(require("./pipe-definition"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pipe/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC;AACjC,+CAA6B;AAC7B,qDAAmC;AACnC,8CAA4B;AAC5B,oDAAkC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClassType } from '@axisparkjs/common';
|
|
2
|
+
import { ParameterDefinition } from '../parameter';
|
|
3
|
+
import { PipeStep, PipeStepConfig } from './pipe-step';
|
|
4
|
+
export declare class PipeDefinition {
|
|
5
|
+
readonly parameter: ParameterDefinition;
|
|
6
|
+
readonly steps: {
|
|
7
|
+
pipeStep: ClassType<PipeStep>;
|
|
8
|
+
pipeStepConfig?: PipeStepConfig;
|
|
9
|
+
}[];
|
|
10
|
+
constructor(parameter: ParameterDefinition, steps: {
|
|
11
|
+
pipeStep: ClassType<PipeStep>;
|
|
12
|
+
pipeStepConfig?: PipeStepConfig;
|
|
13
|
+
}[]);
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipeDefinition = void 0;
|
|
4
|
+
class PipeDefinition {
|
|
5
|
+
constructor(parameter, steps) {
|
|
6
|
+
this.parameter = parameter;
|
|
7
|
+
this.steps = steps;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.PipeDefinition = PipeDefinition;
|
|
11
|
+
//# sourceMappingURL=pipe-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-definition.js","sourceRoot":"","sources":["../../src/pipe/pipe-definition.ts"],"names":[],"mappings":";;;AAQA,MAAa,cAAc;IACvB,YACoB,SAA8B,EAC9B,KAA2E;QAD3E,cAAS,GAAT,SAAS,CAAqB;QAC9B,UAAK,GAAL,KAAK,CAAsE;IAC5F,CAAC;CACP;AALD,wCAKC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Generator } from '@axisparkjs/common';
|
|
2
|
+
import { ExecutionHandler } from '../execution';
|
|
3
|
+
import { PipeDefinition } from './pipe-definition';
|
|
4
|
+
import { ParameterDefinition } from '../parameter';
|
|
5
|
+
export declare class PipeGenerator implements Generator<PipeDefinition[]> {
|
|
6
|
+
generate(parameters: ParameterDefinition[], handler: ExecutionHandler): Promise<PipeDefinition[]>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PipeGenerator = void 0;
|
|
19
|
+
const common_1 = require("@axisparkjs/common");
|
|
20
|
+
const pipe_scope_1 = require("./pipe-scope");
|
|
21
|
+
const pipe_definition_1 = require("./pipe-definition");
|
|
22
|
+
const di_1 = require("@axisparkjs/di");
|
|
23
|
+
let PipeGenerator = class PipeGenerator {
|
|
24
|
+
generate(parameters, handler) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
const classPipes = (_a = common_1.Metadata.get(common_1.MetadataKeys.PIPE, handler.target)) !== null && _a !== void 0 ? _a : [];
|
|
28
|
+
const methodPipes = ((_b = common_1.Metadata.get(common_1.MetadataKeys.PIPE, handler.target, handler.propertyKey)) !== null && _b !== void 0 ? _b : []).filter((x) => x.pipeScope === pipe_scope_1.PipeScope.Method);
|
|
29
|
+
const parameterPipes = ((_c = common_1.Metadata.get(common_1.MetadataKeys.PIPE, handler.target, handler.propertyKey)) !== null && _c !== void 0 ? _c : []).filter((x) => x.pipeScope === pipe_scope_1.PipeScope.Parameter);
|
|
30
|
+
const pipes = [];
|
|
31
|
+
for (const parameter of parameters) {
|
|
32
|
+
const finalPipes = [...classPipes, ...methodPipes, ...parameterPipes.filter((x) => x.parameterIndex === parameter.parameterIndex)];
|
|
33
|
+
const pipeSteps = [];
|
|
34
|
+
for (const pipe of finalPipes) {
|
|
35
|
+
for (const step of pipe.steps) {
|
|
36
|
+
const config = {
|
|
37
|
+
pipeStep: 'pipeStep' in step ? step.pipeStep : step,
|
|
38
|
+
PipeStepConfig: 'PipeStepConfig' in step ? step.PipeStepConfig : undefined
|
|
39
|
+
};
|
|
40
|
+
pipeSteps.push(config);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
pipes.push(new pipe_definition_1.PipeDefinition(parameter, pipeSteps));
|
|
44
|
+
}
|
|
45
|
+
return pipes;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.PipeGenerator = PipeGenerator;
|
|
50
|
+
exports.PipeGenerator = PipeGenerator = __decorate([
|
|
51
|
+
(0, di_1.Injectable)()
|
|
52
|
+
], PipeGenerator);
|
|
53
|
+
//# sourceMappingURL=pipe-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-generator.js","sourceRoot":"","sources":["../../src/pipe/pipe-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+CAAuE;AAGvE,6CAAyC;AACzC,uDAAmD;AAEnD,uCAA4C;AAMrC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAOhB,QAAQ,CAAC,UAAiC,EAAE,OAAyB;;;YACvE,MAAM,UAAU,GAAG,MAAA,iBAAQ,CAAC,GAAG,CAAiB,qBAAY,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAC;YACzF,MAAM,WAAW,GAAG,CAAC,MAAA,iBAAQ,CAAC,GAAG,CAAiB,qBAAY,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,mCAAI,EAAE,CAAC,CAAC,MAAM,CACnH,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,sBAAS,CAAC,MAAM,CAC1C,CAAC;YACF,MAAM,cAAc,GAAG,CAAC,MAAA,iBAAQ,CAAC,GAAG,CAAiB,qBAAY,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,mCAAI,EAAE,CAAC,CAAC,MAAM,CACtH,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,sBAAS,CAAC,SAAS,CAC7C,CAAC;YAEF,MAAM,KAAK,GAAqB,EAAE,CAAC;YACnC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACjC,MAAM,UAAU,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,WAAW,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;gBACnI,MAAM,SAAS,GAAG,EAAE,CAAC;gBACrB,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;oBAC5B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;wBAC5B,MAAM,MAAM,GAAG;4BACX,QAAQ,EAAE,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;4BACnD,cAAc,EAAE,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;yBAC7E,CAAC;wBACF,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC3B,CAAC;gBACL,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,IAAI,gCAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,KAAK,CAAC;QACjB,CAAC;KAAA;CACJ,CAAA;AAjCY,sCAAa;wBAAb,aAAa;IADzB,IAAA,eAAU,GAAE;GACA,aAAa,CAiCzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Processable } from '@axisparkjs/common';
|
|
2
|
+
import { ExecutionContext } from '../execution';
|
|
3
|
+
import { PipeDefinition } from './pipe-definition';
|
|
4
|
+
import { Injector } from '@axisparkjs/di';
|
|
5
|
+
export declare class PipeProcessor implements Processable {
|
|
6
|
+
private readonly injector;
|
|
7
|
+
constructor(injector: Injector);
|
|
8
|
+
process(pipes: PipeDefinition[], context: ExecutionContext): Promise<any[]>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.PipeProcessor = void 0;
|
|
22
|
+
const di_1 = require("@axisparkjs/di");
|
|
23
|
+
let PipeProcessor = class PipeProcessor {
|
|
24
|
+
constructor(injector) {
|
|
25
|
+
this.injector = injector;
|
|
26
|
+
}
|
|
27
|
+
process(pipes, context) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const results = [];
|
|
30
|
+
for (const pipe of pipes) {
|
|
31
|
+
const parameter = pipe.parameter;
|
|
32
|
+
for (const step of pipe.steps) {
|
|
33
|
+
const pipeStep = yield this.injector.get(step.pipeStep, context.scopedContainer);
|
|
34
|
+
const value = yield pipeStep.execute(parameter, step.pipeStepConfig);
|
|
35
|
+
parameter.setValue(value);
|
|
36
|
+
}
|
|
37
|
+
results.push(parameter.value);
|
|
38
|
+
}
|
|
39
|
+
return results;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.PipeProcessor = PipeProcessor;
|
|
44
|
+
exports.PipeProcessor = PipeProcessor = __decorate([
|
|
45
|
+
(0, di_1.Injectable)(),
|
|
46
|
+
__metadata("design:paramtypes", [di_1.Injector])
|
|
47
|
+
], PipeProcessor);
|
|
48
|
+
//# sourceMappingURL=pipe-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-processor.js","sourceRoot":"","sources":["../../src/pipe/pipe-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA,uCAAsD;AAM/C,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,YAA6B,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAQ7C,OAAO,CAAC,KAAuB,EAAE,OAAyB;;YAC5D,MAAM,OAAO,GAAU,EAAE,CAAC;YAE1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;gBACjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;oBACjF,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;oBACrE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAC9B,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,OAAO,CAAC;QACnB,CAAC;KAAA;CACJ,CAAA;AAvBY,sCAAa;wBAAb,aAAa;IADzB,IAAA,eAAU,GAAE;qCAE8B,aAAQ;GADtC,aAAa,CAuBzB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipeScope = void 0;
|
|
4
|
+
var PipeScope;
|
|
5
|
+
(function (PipeScope) {
|
|
6
|
+
PipeScope["Parameter"] = "parameter";
|
|
7
|
+
PipeScope["Method"] = "method";
|
|
8
|
+
PipeScope["Class"] = "class";
|
|
9
|
+
})(PipeScope || (exports.PipeScope = PipeScope = {}));
|
|
10
|
+
//# sourceMappingURL=pipe-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-scope.js","sourceRoot":"","sources":["../../src/pipe/pipe-scope.ts"],"names":[],"mappings":";;;AAIA,IAAY,SAIX;AAJD,WAAY,SAAS;IACjB,oCAAuB,CAAA;IACvB,8BAAiB,CAAA;IACjB,4BAAe,CAAA;AACnB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ParameterDefinition } from '../parameter';
|
|
2
|
+
export declare class PipeStepError extends Error {
|
|
3
|
+
readonly parameter: ParameterDefinition;
|
|
4
|
+
constructor(parameter: ParameterDefinition, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class PipeStepParsingError extends PipeStepError {
|
|
7
|
+
constructor(parameter: ParameterDefinition, message: string, type: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class PipeStepValidationError extends PipeStepError {
|
|
10
|
+
constructor(parameter: ParameterDefinition, message: string);
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipeStepValidationError = exports.PipeStepParsingError = exports.PipeStepError = void 0;
|
|
4
|
+
class PipeStepError extends Error {
|
|
5
|
+
constructor(parameter, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.parameter = parameter;
|
|
8
|
+
this.name = 'PipeStepError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.PipeStepError = PipeStepError;
|
|
12
|
+
class PipeStepParsingError extends PipeStepError {
|
|
13
|
+
constructor(parameter, message, type) {
|
|
14
|
+
super(parameter, `Parsing failed for '${parameter.parameter}' as ${type}: ${message}`);
|
|
15
|
+
this.name = 'PipeStepParsingError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.PipeStepParsingError = PipeStepParsingError;
|
|
19
|
+
class PipeStepValidationError extends PipeStepError {
|
|
20
|
+
constructor(parameter, message) {
|
|
21
|
+
super(parameter, `Validation failed for '${parameter.parameter}': ${message}`);
|
|
22
|
+
this.name = 'PipeStepValidationError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.PipeStepValidationError = PipeStepValidationError;
|
|
26
|
+
//# sourceMappingURL=pipe-step-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-step-errors.js","sourceRoot":"","sources":["../../src/pipe/pipe-step-errors.ts"],"names":[],"mappings":";;;AAKA,MAAa,aAAc,SAAQ,KAAK;IACpC,YACoB,SAA8B,EAC9C,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,cAAS,GAAT,SAAS,CAAqB;QAI9C,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAChC,CAAC;CACJ;AARD,sCAQC;AAKD,MAAa,oBAAqB,SAAQ,aAAa;IACnD,YAAY,SAA8B,EAAE,OAAe,EAAE,IAAY;QACrE,KAAK,CAAC,SAAS,EAAE,uBAAuB,SAAS,CAAC,SAAS,QAAQ,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QACvF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACvC,CAAC;CACJ;AALD,oDAKC;AAKD,MAAa,uBAAwB,SAAQ,aAAa;IACtD,YAAY,SAA8B,EAAE,OAAe;QACvD,KAAK,CAAC,SAAS,EAAE,0BAA0B,SAAS,CAAC,SAAS,MAAM,OAAO,EAAE,CAAC,CAAC;QAC/E,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IAC1C,CAAC;CACJ;AALD,0DAKC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Executable } from '@axisparkjs/common';
|
|
2
|
+
import { ParameterDefinition } from '../parameter';
|
|
3
|
+
export type PipeStepConfig = Record<string, unknown>;
|
|
4
|
+
export interface PipeStep<I = unknown, O = I> extends Executable {
|
|
5
|
+
execute(parameter: ParameterDefinition, config?: PipeStepConfig): O | Promise<O>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-step.js","sourceRoot":"","sources":["../../src/pipe/pipe-step.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./result-definition"), exports);
|
|
18
|
+
__exportStar(require("./result-processor"), exports);
|
|
19
|
+
__exportStar(require("./result-resolver"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/result/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,qDAAmC;AACnC,oDAAkC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResultDefinition = void 0;
|
|
4
|
+
class ResultDefinition {
|
|
5
|
+
constructor(value, rc) {
|
|
6
|
+
this.value = value;
|
|
7
|
+
this.rc = rc;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ResultDefinition = ResultDefinition;
|
|
11
|
+
//# sourceMappingURL=result-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-definition.js","sourceRoot":"","sources":["../../src/result/result-definition.ts"],"names":[],"mappings":";;;AAMA,MAAsB,gBAAgB;IAClC,YACoB,KAAQ,EACR,EAAU;QADV,UAAK,GAAL,KAAK,CAAG;QACR,OAAE,GAAF,EAAE,CAAQ;IAC3B,CAAC;CAQP;AAZD,4CAYC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Processable } from '@axisparkjs/common';
|
|
2
|
+
import { ExecutionContext, ExecutionTransport } from '../execution';
|
|
3
|
+
import { ResultResolver } from './result-resolver';
|
|
4
|
+
import { ResultDefinition } from './result-definition';
|
|
5
|
+
export declare class ResultProcessor implements Processable {
|
|
6
|
+
private static readonly resolvers;
|
|
7
|
+
static registerResult(transport: ExecutionTransport, resolver: ResultResolver): void;
|
|
8
|
+
process(result: unknown | ResultDefinition, context: ExecutionContext): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 ResultProcessor_1;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ResultProcessor = void 0;
|
|
20
|
+
const di_1 = require("@axisparkjs/di");
|
|
21
|
+
const result_definition_1 = require("./result-definition");
|
|
22
|
+
let ResultProcessor = ResultProcessor_1 = class ResultProcessor {
|
|
23
|
+
static registerResult(transport, resolver) {
|
|
24
|
+
this.resolvers.set(transport, resolver);
|
|
25
|
+
}
|
|
26
|
+
process(result, context) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
let resultToProcess;
|
|
29
|
+
if (result instanceof result_definition_1.ResultDefinition)
|
|
30
|
+
resultToProcess = result;
|
|
31
|
+
else {
|
|
32
|
+
const resolver = ResultProcessor_1.resolvers.get(context.transport);
|
|
33
|
+
if (!resolver)
|
|
34
|
+
return;
|
|
35
|
+
resultToProcess = yield resolver.resolve(result, context);
|
|
36
|
+
}
|
|
37
|
+
yield resultToProcess.process(context);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.ResultProcessor = ResultProcessor;
|
|
42
|
+
ResultProcessor.resolvers = new Map();
|
|
43
|
+
exports.ResultProcessor = ResultProcessor = ResultProcessor_1 = __decorate([
|
|
44
|
+
(0, di_1.Injectable)()
|
|
45
|
+
], ResultProcessor);
|
|
46
|
+
//# sourceMappingURL=result-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-processor.js","sourceRoot":"","sources":["../../src/result/result-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AACA,uCAA4C;AAG5C,2DAAuD;AAOhD,IAAM,eAAe,uBAArB,MAAM,eAAe;IAQxB,MAAM,CAAC,cAAc,CAAC,SAA6B,EAAE,QAAwB;QACzE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAUK,OAAO,CAAC,MAAkC,EAAE,OAAyB;;YACvE,IAAI,eAAiC,CAAC;YACtC,IAAI,MAAM,YAAY,oCAAgB;gBAAE,eAAe,GAAG,MAAM,CAAC;iBAC5D,CAAC;gBACF,MAAM,QAAQ,GAAG,iBAAe,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAClE,IAAI,CAAC,QAAQ;oBAAE,OAAO;gBACtB,eAAe,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC9D,CAAC;YAED,MAAM,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;KAAA;;AA9BQ,0CAAe;AACA,yBAAS,GAAG,IAAI,GAAG,EAAsC,AAAhD,CAAiD;0BADzE,eAAe;IAD3B,IAAA,eAAU,GAAE;GACA,eAAe,CA+B3B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Resolver } from '@axisparkjs/common';
|
|
2
|
+
import { ExecutionContext } from '../execution';
|
|
3
|
+
import { ResultDefinition } from './result-definition';
|
|
4
|
+
export declare abstract class ResultResolver implements Resolver<ResultDefinition> {
|
|
5
|
+
abstract resolve(result: unknown, context: ExecutionContext): Promise<ResultDefinition> | ResultDefinition;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-resolver.js","sourceRoot":"","sources":["../../src/result/result-resolver.ts"],"names":[],"mappings":";;;AAOA,MAAsB,cAAc;CAQnC;AARD,wCAQC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./step-definition"), exports);
|
|
18
|
+
__exportStar(require("./step-generator"), exports);
|
|
19
|
+
__exportStar(require("./step-priority"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/step/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ClassType } from '@axisparkjs/common';
|
|
2
|
+
import { ExecutionTransport, ExecutionHandler } from '../execution';
|
|
3
|
+
import { StepMethodMetadata, StepTargetMetadata } from '../metadata';
|
|
4
|
+
export declare enum StepType {
|
|
5
|
+
Guard = "guard",
|
|
6
|
+
Middleware = "middleware",
|
|
7
|
+
Interceptor = "interceptor",
|
|
8
|
+
Filter = "filter"
|
|
9
|
+
}
|
|
10
|
+
export declare enum StepScope {
|
|
11
|
+
Before = "before",
|
|
12
|
+
After = "after"
|
|
13
|
+
}
|
|
14
|
+
export declare abstract class StepDefinition implements ExecutionHandler {
|
|
15
|
+
readonly global: boolean;
|
|
16
|
+
readonly priority: number;
|
|
17
|
+
readonly transport: ExecutionTransport;
|
|
18
|
+
readonly target: ClassType;
|
|
19
|
+
readonly propertyKey: string | symbol;
|
|
20
|
+
readonly type: StepType;
|
|
21
|
+
constructor(global: boolean, priority: number, transport: ExecutionTransport, target: ClassType, propertyKey: string | symbol, type: StepType);
|
|
22
|
+
static fromMetadata(sMM: StepMethodMetadata, sTM: StepTargetMetadata): StepDefinition;
|
|
23
|
+
}
|
|
24
|
+
export declare class HandleStepDefinition extends StepDefinition {
|
|
25
|
+
readonly type: StepType.Middleware;
|
|
26
|
+
}
|
|
27
|
+
export declare class CheckStepDefinition extends StepDefinition {
|
|
28
|
+
readonly type: StepType.Guard;
|
|
29
|
+
}
|
|
30
|
+
export declare class BeforeStepDefinition extends StepDefinition {
|
|
31
|
+
readonly scope: StepScope.Before;
|
|
32
|
+
readonly type: StepType.Interceptor;
|
|
33
|
+
constructor(global: boolean, priority: number, transport: ExecutionTransport, target: ClassType, propertyKey: string | symbol, type: StepType.Interceptor, scope: StepScope.Before);
|
|
34
|
+
}
|
|
35
|
+
export declare class AfterStepDefinition extends StepDefinition {
|
|
36
|
+
readonly scope: StepScope.After;
|
|
37
|
+
readonly type: StepType.Interceptor;
|
|
38
|
+
constructor(global: boolean, priority: number, transport: ExecutionTransport, target: ClassType, propertyKey: string | symbol, type: StepType.Interceptor, scope: StepScope.After);
|
|
39
|
+
}
|
|
40
|
+
export declare class CatchStepDefinition extends StepDefinition {
|
|
41
|
+
readonly acceptedErrors: ClassType<Error>[];
|
|
42
|
+
readonly type: StepType.Filter;
|
|
43
|
+
constructor(global: boolean, priority: number, transport: ExecutionTransport, target: ClassType, propertyKey: string | symbol, type: StepType.Filter, acceptedErrors: ClassType<Error>[]);
|
|
44
|
+
}
|