@trayio/cdk-dsl 0.0.1-beta
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/LICENSE.txt +22 -0
- package/README.md +858 -0
- package/dist/connector/operation/CompositeOperationHandler.d.ts +9 -0
- package/dist/connector/operation/CompositeOperationHandler.d.ts.map +1 -0
- package/dist/connector/operation/CompositeOperationHandler.js +10 -0
- package/dist/connector/operation/HttpOperationHandler.d.ts +83 -0
- package/dist/connector/operation/HttpOperationHandler.d.ts.map +1 -0
- package/dist/connector/operation/HttpOperationHandler.js +187 -0
- package/dist/connector/operation/OperationHandler.d.ts +134 -0
- package/dist/connector/operation/OperationHandler.d.ts.map +1 -0
- package/dist/connector/operation/OperationHandler.js +52 -0
- package/dist/connector/operation/OperationHandlerInvocation.d.ts +3 -0
- package/dist/connector/operation/OperationHandlerInvocation.d.ts.map +1 -0
- package/dist/connector/operation/OperationHandlerInvocation.js +2 -0
- package/dist/connector/operation/OperationHandlerSetup.d.ts +50 -0
- package/dist/connector/operation/OperationHandlerSetup.d.ts.map +1 -0
- package/dist/connector/operation/OperationHandlerSetup.js +148 -0
- package/dist/connector/operation/OperationHandlerTest.d.ts +135 -0
- package/dist/connector/operation/OperationHandlerTest.d.ts.map +1 -0
- package/dist/connector/operation/OperationHandlerTest.js +238 -0
- package/dist/connector/operation/OperationHandlerValidation.d.ts +42 -0
- package/dist/connector/operation/OperationHandlerValidation.d.ts.map +1 -0
- package/dist/connector/operation/OperationHandlerValidation.js +63 -0
- package/package.json +30 -0
|
@@ -0,0 +1,148 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.OperationHandlerSetup = exports.OperationHandlerRegistry = exports.OperationHandlerConfiguration = exports.OperationHandler = void 0;
|
|
27
|
+
const O = __importStar(require("fp-ts/Option"));
|
|
28
|
+
const function_1 = require("fp-ts/function");
|
|
29
|
+
const pathLib = __importStar(require("path"));
|
|
30
|
+
const DynamicType_1 = require("@trayio/commons/dynamictype/DynamicType");
|
|
31
|
+
const CallSite_1 = require("@trayio/commons/callsite/CallSite");
|
|
32
|
+
const CompositeOperationHandler_1 = require("./CompositeOperationHandler");
|
|
33
|
+
const HttpOperationHandler_1 = require("./HttpOperationHandler");
|
|
34
|
+
const OperationHandlerValidation_1 = require("./OperationHandlerValidation");
|
|
35
|
+
class OperationHandler {
|
|
36
|
+
constructor(name, isPrivate, validation, implementation) {
|
|
37
|
+
this.name = name;
|
|
38
|
+
this.isPrivate = isPrivate;
|
|
39
|
+
this.validation = validation;
|
|
40
|
+
this.implementation = implementation;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.OperationHandler = OperationHandler;
|
|
44
|
+
class OperationHandlerConfiguration {
|
|
45
|
+
static withName(name) {
|
|
46
|
+
return new OperationHandlerConfiguration(name, false, O.none);
|
|
47
|
+
}
|
|
48
|
+
constructor(name, isPrivate, validation) {
|
|
49
|
+
this.name = name;
|
|
50
|
+
this.isPrivate = isPrivate;
|
|
51
|
+
this.validation = validation;
|
|
52
|
+
}
|
|
53
|
+
private() {
|
|
54
|
+
return new OperationHandlerConfiguration(this.name, true, this.validation);
|
|
55
|
+
}
|
|
56
|
+
addInputValidation(inputValidationSetup) {
|
|
57
|
+
const currentValidation = O.getOrElse(() => OperationHandlerValidation_1.OperationHandlerValidation.emptyValidation())(this.validation);
|
|
58
|
+
const inputValidation = inputValidationSetup(new OperationHandlerValidation_1.OperationHandlerInputValidationConditionConfiguration());
|
|
59
|
+
const newValidation = currentValidation.addInputValidation(inputValidation);
|
|
60
|
+
return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation));
|
|
61
|
+
}
|
|
62
|
+
addOutputValidation(outputValidationSetup) {
|
|
63
|
+
const currentValidation = O.getOrElse(() => OperationHandlerValidation_1.OperationHandlerValidation.emptyValidation())(this.validation);
|
|
64
|
+
const outputValidation = outputValidationSetup(new OperationHandlerValidation_1.OperationHandlerOutputValidationConditionConfiguration());
|
|
65
|
+
const newValidation = currentValidation.addOutputValidation(outputValidation);
|
|
66
|
+
return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation));
|
|
67
|
+
}
|
|
68
|
+
usingHttp(httpSetup) {
|
|
69
|
+
return new OperationHandler(this.name, this.isPrivate, this.validation, httpSetup(new HttpOperationHandler_1.HttpOperationHandlerConfiguration()));
|
|
70
|
+
}
|
|
71
|
+
usingComposite(compositeFunction) {
|
|
72
|
+
return new OperationHandler(this.name, this.isPrivate, this.validation, new CompositeOperationHandler_1.CompositeOperationHandler(compositeFunction));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.OperationHandlerConfiguration = OperationHandlerConfiguration;
|
|
76
|
+
class OperationHandlerRegistry {
|
|
77
|
+
static register(handler) {
|
|
78
|
+
return OperationHandlerRegistry.instance.register(handler);
|
|
79
|
+
}
|
|
80
|
+
static resolve(reference) {
|
|
81
|
+
return OperationHandlerRegistry.instance.resolve(reference);
|
|
82
|
+
}
|
|
83
|
+
constructor() {
|
|
84
|
+
this.registry = new Map();
|
|
85
|
+
}
|
|
86
|
+
register(handler) {
|
|
87
|
+
this.registry.set(handler.name, handler);
|
|
88
|
+
}
|
|
89
|
+
resolve(reference) {
|
|
90
|
+
const handler = this.registry.get(reference.name);
|
|
91
|
+
if (!handler) {
|
|
92
|
+
return O.none;
|
|
93
|
+
}
|
|
94
|
+
return O.some(handler);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.OperationHandlerRegistry = OperationHandlerRegistry;
|
|
98
|
+
OperationHandlerRegistry.instance = new OperationHandlerRegistry();
|
|
99
|
+
const readOperationDescriptorFile = () => {
|
|
100
|
+
const operationDescriptorOpt = (0, function_1.pipe)(O.fromNullable(CallSite_1.CallSite.getCurrentCallSites()[1]), // skip the last caller because it is a function within this file
|
|
101
|
+
O.map((caller) => pathLib.join(caller.folderPath, 'operation.json')), O.chain((operationDescriptorPath) => O.fromEither(DynamicType_1.DynamicType.readFromFile(operationDescriptorPath))));
|
|
102
|
+
// If this error is thrown, there is a problem with the file or there is a problem with the runtime not supporting callsites
|
|
103
|
+
const operationDescriptor = O.getOrElse(() => {
|
|
104
|
+
throw new Error('Runtime error: Cannot read operation.json file');
|
|
105
|
+
})(operationDescriptorOpt);
|
|
106
|
+
return operationDescriptor;
|
|
107
|
+
};
|
|
108
|
+
exports.OperationHandlerSetup = {
|
|
109
|
+
configureHandler: (handlerSetup) => {
|
|
110
|
+
const descriptor = readOperationDescriptorFile();
|
|
111
|
+
const { name } = descriptor;
|
|
112
|
+
const handler = handlerSetup(OperationHandlerConfiguration.withName(name));
|
|
113
|
+
OperationHandlerRegistry.register(handler);
|
|
114
|
+
return { name: handler.name };
|
|
115
|
+
},
|
|
116
|
+
configureTriggerCreateHandler: (handlerSetup) => {
|
|
117
|
+
const descriptor = readOperationDescriptorFile();
|
|
118
|
+
const { name } = descriptor;
|
|
119
|
+
const handler = handlerSetup(OperationHandlerConfiguration.withName(name));
|
|
120
|
+
OperationHandlerRegistry.register(handler);
|
|
121
|
+
return {
|
|
122
|
+
name: handler.name,
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
configureTriggerDestroyHandler: (handlerSetup) => {
|
|
126
|
+
const descriptor = readOperationDescriptorFile();
|
|
127
|
+
const { name } = descriptor;
|
|
128
|
+
const handler = handlerSetup(OperationHandlerConfiguration.withName(`${name}_destroy`));
|
|
129
|
+
OperationHandlerRegistry.register(handler);
|
|
130
|
+
return {
|
|
131
|
+
name: handler.name,
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
configureTriggerRequestHandler: (handlerSetup) => {
|
|
135
|
+
const descriptor = readOperationDescriptorFile();
|
|
136
|
+
const { name } = descriptor;
|
|
137
|
+
const handler = handlerSetup(OperationHandlerConfiguration.withName(`${name}_request`));
|
|
138
|
+
OperationHandlerRegistry.register(handler);
|
|
139
|
+
return { name: handler.name };
|
|
140
|
+
},
|
|
141
|
+
configureTriggerResponseHandler: (handlerSetup) => {
|
|
142
|
+
const descriptor = readOperationDescriptorFile();
|
|
143
|
+
const { name } = descriptor;
|
|
144
|
+
const handler = handlerSetup(OperationHandlerConfiguration.withName(`${name}_response`));
|
|
145
|
+
OperationHandlerRegistry.register(handler);
|
|
146
|
+
return { name: handler.name };
|
|
147
|
+
},
|
|
148
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as O from 'fp-ts/Option';
|
|
2
|
+
import { OperationHandlerAuth, OperationHandlerContext, OperationHandlerReference, OperationHandlerResult } from './OperationHandler';
|
|
3
|
+
import { OperationHandlerInvocation } from './OperationHandlerInvocation';
|
|
4
|
+
export type OperationHandlerTestCaseResult<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> = {
|
|
5
|
+
ctx: OperationHandlerContext<AUTH>;
|
|
6
|
+
testContext: TCTX;
|
|
7
|
+
testCaseContext: TCCTX;
|
|
8
|
+
input: IN;
|
|
9
|
+
output: OperationHandlerResult<OUT>;
|
|
10
|
+
};
|
|
11
|
+
export type OperationHandlerTestCaseFinallyFunction<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> = (testCaseResult: OperationHandlerTestCaseResult<AUTH, IN, OUT, TCTX, TCCTX>, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<undefined>>;
|
|
12
|
+
export type OperationHandlerTestCaseThenFunction<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> = (testCaseResult: OperationHandlerTestCaseResult<AUTH, IN, OUT, TCTX, TCCTX>) => void;
|
|
13
|
+
export type OperationHandlerTestCaseWhenFunction<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, TCTX, TCCTX> = (ctx: OperationHandlerContext<AUTH>, testContext: TCTX, testCaseContext: TCCTX) => IN;
|
|
14
|
+
export type OperationHandlerTestCaseGivenFunction<AUTH extends OperationHandlerAuth<unknown, unknown>, TCTX, TCCTX> = (ctx: OperationHandlerContext<AUTH>, testContext: TCTX, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<TCCTX>>;
|
|
15
|
+
export declare class OperationHandlerTestCase<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> {
|
|
16
|
+
description: string;
|
|
17
|
+
ctx: OperationHandlerContext<AUTH>;
|
|
18
|
+
testContext: TCTX;
|
|
19
|
+
givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>;
|
|
20
|
+
whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>;
|
|
21
|
+
thenFunction: OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
22
|
+
finallyFunction: OperationHandlerTestCaseFinallyFunction<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
23
|
+
constructor(description: string, ctx: OperationHandlerContext<AUTH>, testContext: TCTX, givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>, whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>, thenFunction: OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX>, finallyFunction: OperationHandlerTestCaseFinallyFunction<AUTH, IN, OUT, TCTX, TCCTX>);
|
|
24
|
+
}
|
|
25
|
+
export declare class OperationHandlerTestCaseFinallyConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> {
|
|
26
|
+
private description;
|
|
27
|
+
private ctx;
|
|
28
|
+
private testContext;
|
|
29
|
+
private givenFunction;
|
|
30
|
+
private whenFunction;
|
|
31
|
+
private thenFunction;
|
|
32
|
+
constructor(description: string, ctx: OperationHandlerContext<AUTH>, testContext: TCTX, givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>, whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>, thenFunction: OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX>);
|
|
33
|
+
finally(finallyFunction: OperationHandlerTestCaseFinallyFunction<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
34
|
+
finallyDoNothing(): OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
35
|
+
}
|
|
36
|
+
export declare class OperationHandlerTestCaseThenConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> {
|
|
37
|
+
private description;
|
|
38
|
+
private ctx;
|
|
39
|
+
private testContext;
|
|
40
|
+
private givenFunction;
|
|
41
|
+
private whenFunction;
|
|
42
|
+
constructor(description: string, ctx: OperationHandlerContext<AUTH>, testContext: TCTX, givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>, whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>);
|
|
43
|
+
then(thenFunction: OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestCaseFinallyConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
44
|
+
}
|
|
45
|
+
export declare class OperationHandlerTestCaseWhenConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> {
|
|
46
|
+
private description;
|
|
47
|
+
private ctx;
|
|
48
|
+
private testContext;
|
|
49
|
+
private givenFunction;
|
|
50
|
+
constructor(description: string, ctx: OperationHandlerContext<AUTH>, testContext: TCTX, givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>);
|
|
51
|
+
when(whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>): OperationHandlerTestCaseThenConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
52
|
+
}
|
|
53
|
+
export declare class OperationHandlerTestCaseGivenConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX> {
|
|
54
|
+
private description;
|
|
55
|
+
private ctx;
|
|
56
|
+
private testContext;
|
|
57
|
+
constructor(description: string, ctx: OperationHandlerContext<AUTH>, testContext: TCTX);
|
|
58
|
+
given<TCCTX>(givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
59
|
+
givenNothing(): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, {}>;
|
|
60
|
+
}
|
|
61
|
+
export declare class OperationHandlerTestCaseAuthConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX> {
|
|
62
|
+
private description;
|
|
63
|
+
private defaultCtx;
|
|
64
|
+
private testContext;
|
|
65
|
+
constructor(description: string, defaultCtx: OperationHandlerContext<AUTH>, testContext: TCTX);
|
|
66
|
+
usingHandlerContext(ctxName: string): OperationHandlerTestCaseGivenConfiguration<AUTH, IN, OUT, TCTX>;
|
|
67
|
+
given<TCCTX>(givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
68
|
+
givenNothing(): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, {}>;
|
|
69
|
+
}
|
|
70
|
+
export type OperationHandlerTestCaseSetup<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> = (testCase: OperationHandlerTestCaseAuthConfiguration<AUTH, IN, OUT, TCTX>) => OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
71
|
+
export type OperationHandlerTestAfterAllFunction<AUTH extends OperationHandlerAuth<unknown, unknown>, TCTX> = (ctx: OperationHandlerContext<AUTH>, testContext: TCTX, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<undefined>>;
|
|
72
|
+
export type OperationHandlerTestBeforeAllFunction<AUTH extends OperationHandlerAuth<unknown, unknown>, TCTX> = (ctx: OperationHandlerContext<AUTH>, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<TCTX>>;
|
|
73
|
+
export declare class OperationHandlerTestCaseFactory<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX, TCCTX> {
|
|
74
|
+
description: string;
|
|
75
|
+
private ctx;
|
|
76
|
+
private testCaseSetup;
|
|
77
|
+
constructor(description: string, ctx: OperationHandlerContext<AUTH>, testCaseSetup: OperationHandlerTestCaseSetup<AUTH, IN, OUT, TCTX, TCCTX>);
|
|
78
|
+
testCase(testContext: TCTX): OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
|
|
79
|
+
}
|
|
80
|
+
export declare class OperationHandlerTest<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX> {
|
|
81
|
+
handlerReference: OperationHandlerReference<AUTH, IN, OUT>;
|
|
82
|
+
ctx: OperationHandlerContext<AUTH>;
|
|
83
|
+
beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>;
|
|
84
|
+
testCaseFactories: Array<OperationHandlerTestCaseFactory<AUTH, IN, OUT, TCTX, unknown>>;
|
|
85
|
+
afterAllFunction: OperationHandlerTestAfterAllFunction<AUTH, TCTX>;
|
|
86
|
+
constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, ctx: OperationHandlerContext<AUTH>, beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>, testCaseFactories: Array<OperationHandlerTestCaseFactory<AUTH, IN, OUT, TCTX, unknown>>, afterAllFunction: OperationHandlerTestAfterAllFunction<AUTH, TCTX>);
|
|
87
|
+
}
|
|
88
|
+
export declare class OperationHandlerTestAfterAllConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX> {
|
|
89
|
+
private handlerReference;
|
|
90
|
+
private ctx;
|
|
91
|
+
private beforeAllFunction;
|
|
92
|
+
private testCaseFactories;
|
|
93
|
+
constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, ctx: OperationHandlerContext<AUTH>, beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>, testCaseFactories: Array<OperationHandlerTestCaseFactory<AUTH, IN, OUT, TCTX, unknown>>);
|
|
94
|
+
testCase<TCCTX>(description: string, testCaseSetup: OperationHandlerTestCaseSetup<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestAfterAllConfiguration<AUTH, IN, OUT, TCTX>;
|
|
95
|
+
afterAll(afterAllFunction: OperationHandlerTestAfterAllFunction<AUTH, TCTX>): OperationHandlerTest<AUTH, IN, OUT, TCTX>;
|
|
96
|
+
nothingAfterAll(): OperationHandlerTest<AUTH, IN, OUT, TCTX>;
|
|
97
|
+
}
|
|
98
|
+
export declare class OperationHandlerTestMandatoryTestCaseConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX> {
|
|
99
|
+
private handlerReference;
|
|
100
|
+
private ctx;
|
|
101
|
+
private beforeAllFunction;
|
|
102
|
+
constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, ctx: OperationHandlerContext<AUTH>, beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>);
|
|
103
|
+
testCase<TCCTX>(description: string, testCaseSetup: OperationHandlerTestCaseSetup<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestAfterAllConfiguration<AUTH, IN, OUT, TCTX>;
|
|
104
|
+
}
|
|
105
|
+
export declare class OperationHandlerTestBeforeAllConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
106
|
+
private handlerReference;
|
|
107
|
+
private ctx;
|
|
108
|
+
constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, ctx: OperationHandlerContext<AUTH>);
|
|
109
|
+
beforeAll<TCTX>(beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>): OperationHandlerTestMandatoryTestCaseConfiguration<AUTH, IN, OUT, TCTX>;
|
|
110
|
+
nothingBeforeAll(): OperationHandlerTestMandatoryTestCaseConfiguration<AUTH, IN, OUT, {}>;
|
|
111
|
+
}
|
|
112
|
+
export declare class OperationHandlerTestAuthConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
113
|
+
private handlerReference;
|
|
114
|
+
constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>);
|
|
115
|
+
usingHandlerContext(ctxName: string): OperationHandlerTestBeforeAllConfiguration<AUTH, IN, OUT>;
|
|
116
|
+
}
|
|
117
|
+
export type OperationHandlerTestRegistryOnRegistrationFunction<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> = (reference: OperationHandlerReference<AUTH, IN, OUT>) => void;
|
|
118
|
+
export declare class OperationHandlerTestRegistry {
|
|
119
|
+
private static instance;
|
|
120
|
+
static register<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX>(handlerTest: OperationHandlerTest<AUTH, IN, OUT, TCTX>): void;
|
|
121
|
+
static resolve<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT>(reference: OperationHandlerReference<AUTH, IN, OUT>): O.Option<OperationHandlerTest<AUTH, IN, OUT, unknown>>;
|
|
122
|
+
static onRegistration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT>(onRegistrationFunction: OperationHandlerTestRegistryOnRegistrationFunction<AUTH, IN, OUT>): void;
|
|
123
|
+
private registry;
|
|
124
|
+
private observers;
|
|
125
|
+
private constructor();
|
|
126
|
+
private register;
|
|
127
|
+
private resolve;
|
|
128
|
+
private onRegistration;
|
|
129
|
+
}
|
|
130
|
+
export type OperationHandlerTestSetup<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX> = (handlerTest: OperationHandlerTestAuthConfiguration<AUTH, IN, OUT>) => OperationHandlerTest<AUTH, IN, OUT, TCTX>;
|
|
131
|
+
export interface OperationHandlerTestSetupInterface {
|
|
132
|
+
configureHandlerTest: <AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT, TCTX>(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, handlerTestSetup: OperationHandlerTestSetup<AUTH, IN, OUT, TCTX>) => void;
|
|
133
|
+
}
|
|
134
|
+
export declare const OperationHandlerTestSetup: OperationHandlerTestSetupInterface;
|
|
135
|
+
//# sourceMappingURL=OperationHandlerTest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationHandlerTest.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandlerTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,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;CACV;AAED,eAAO,MAAM,yBAAyB,EAAE,kCAevC,CAAC"}
|
|
@@ -0,0 +1,238 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.OperationHandlerTestSetup = exports.OperationHandlerTestRegistry = exports.OperationHandlerTestAuthConfiguration = exports.OperationHandlerTestBeforeAllConfiguration = exports.OperationHandlerTestMandatoryTestCaseConfiguration = exports.OperationHandlerTestAfterAllConfiguration = exports.OperationHandlerTest = exports.OperationHandlerTestCaseFactory = exports.OperationHandlerTestCaseAuthConfiguration = exports.OperationHandlerTestCaseGivenConfiguration = exports.OperationHandlerTestCaseWhenConfiguration = exports.OperationHandlerTestCaseThenConfiguration = exports.OperationHandlerTestCaseFinallyConfiguration = exports.OperationHandlerTestCase = void 0;
|
|
27
|
+
const O = __importStar(require("fp-ts/Option"));
|
|
28
|
+
const function_1 = require("fp-ts/function");
|
|
29
|
+
const DynamicType_1 = require("@trayio/commons/dynamictype/DynamicType");
|
|
30
|
+
const CallSite_1 = require("@trayio/commons/callsite/CallSite");
|
|
31
|
+
const pathLib = __importStar(require("path"));
|
|
32
|
+
const OperationHandler_1 = require("./OperationHandler");
|
|
33
|
+
const readContextJsonFile = (ctxName) => {
|
|
34
|
+
const operationDescriptorOpt = (0, function_1.pipe)(O.fromNullable(CallSite_1.CallSite.getCurrentCallSites()[1]), // skip the last caller because it is a function within this file
|
|
35
|
+
O.map((caller) => pathLib.normalize(pathLib.join(caller.folderPath, '..', `${ctxName}.ctx.json`))), O.chain((operationDescriptorPath) => O.fromEither(DynamicType_1.DynamicType.readFromFile(operationDescriptorPath))));
|
|
36
|
+
// If this error is thrown, there is a problem with the file or there is a problem with the runtime not supporting callsites
|
|
37
|
+
const operationDescriptor = O.getOrElse(() => {
|
|
38
|
+
throw new Error(`Runtime error: Cannot read ${ctxName}.ctx.json file`);
|
|
39
|
+
})(operationDescriptorOpt);
|
|
40
|
+
return operationDescriptor;
|
|
41
|
+
};
|
|
42
|
+
class OperationHandlerTestCase {
|
|
43
|
+
constructor(description, ctx, testContext, givenFunction, whenFunction, thenFunction, finallyFunction) {
|
|
44
|
+
this.description = description;
|
|
45
|
+
this.ctx = ctx;
|
|
46
|
+
this.testContext = testContext;
|
|
47
|
+
this.givenFunction = givenFunction;
|
|
48
|
+
this.whenFunction = whenFunction;
|
|
49
|
+
this.thenFunction = thenFunction;
|
|
50
|
+
this.finallyFunction = finallyFunction;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.OperationHandlerTestCase = OperationHandlerTestCase;
|
|
54
|
+
class OperationHandlerTestCaseFinallyConfiguration {
|
|
55
|
+
constructor(description, ctx, testContext, givenFunction, whenFunction, thenFunction) {
|
|
56
|
+
this.description = description;
|
|
57
|
+
this.ctx = ctx;
|
|
58
|
+
this.testContext = testContext;
|
|
59
|
+
this.givenFunction = givenFunction;
|
|
60
|
+
this.whenFunction = whenFunction;
|
|
61
|
+
this.thenFunction = thenFunction;
|
|
62
|
+
}
|
|
63
|
+
finally(finallyFunction) {
|
|
64
|
+
return new OperationHandlerTestCase(this.description, this.ctx, this.testContext, this.givenFunction, this.whenFunction, this.thenFunction, finallyFunction);
|
|
65
|
+
}
|
|
66
|
+
finallyDoNothing() {
|
|
67
|
+
return this.finally(() => Promise.resolve(OperationHandler_1.OperationHandlerResult.success(undefined)));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.OperationHandlerTestCaseFinallyConfiguration = OperationHandlerTestCaseFinallyConfiguration;
|
|
71
|
+
class OperationHandlerTestCaseThenConfiguration {
|
|
72
|
+
constructor(description, ctx, testContext, givenFunction, whenFunction) {
|
|
73
|
+
this.description = description;
|
|
74
|
+
this.ctx = ctx;
|
|
75
|
+
this.testContext = testContext;
|
|
76
|
+
this.givenFunction = givenFunction;
|
|
77
|
+
this.whenFunction = whenFunction;
|
|
78
|
+
}
|
|
79
|
+
then(thenFunction) {
|
|
80
|
+
return new OperationHandlerTestCaseFinallyConfiguration(this.description, this.ctx, this.testContext, this.givenFunction, this.whenFunction, thenFunction);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.OperationHandlerTestCaseThenConfiguration = OperationHandlerTestCaseThenConfiguration;
|
|
84
|
+
class OperationHandlerTestCaseWhenConfiguration {
|
|
85
|
+
constructor(description, ctx, testContext, givenFunction) {
|
|
86
|
+
this.description = description;
|
|
87
|
+
this.ctx = ctx;
|
|
88
|
+
this.testContext = testContext;
|
|
89
|
+
this.givenFunction = givenFunction;
|
|
90
|
+
}
|
|
91
|
+
when(whenFunction) {
|
|
92
|
+
return new OperationHandlerTestCaseThenConfiguration(this.description, this.ctx, this.testContext, this.givenFunction, whenFunction);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.OperationHandlerTestCaseWhenConfiguration = OperationHandlerTestCaseWhenConfiguration;
|
|
96
|
+
class OperationHandlerTestCaseGivenConfiguration {
|
|
97
|
+
constructor(description, ctx, testContext) {
|
|
98
|
+
this.description = description;
|
|
99
|
+
this.ctx = ctx;
|
|
100
|
+
this.testContext = testContext;
|
|
101
|
+
}
|
|
102
|
+
given(givenFunction) {
|
|
103
|
+
return new OperationHandlerTestCaseWhenConfiguration(this.description, this.ctx, this.testContext, givenFunction);
|
|
104
|
+
}
|
|
105
|
+
givenNothing() {
|
|
106
|
+
return this.given(() => Promise.resolve(OperationHandler_1.OperationHandlerResult.success({})));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.OperationHandlerTestCaseGivenConfiguration = OperationHandlerTestCaseGivenConfiguration;
|
|
110
|
+
class OperationHandlerTestCaseAuthConfiguration {
|
|
111
|
+
constructor(description, defaultCtx, testContext) {
|
|
112
|
+
this.description = description;
|
|
113
|
+
this.defaultCtx = defaultCtx;
|
|
114
|
+
this.testContext = testContext;
|
|
115
|
+
}
|
|
116
|
+
usingHandlerContext(ctxName) {
|
|
117
|
+
return new OperationHandlerTestCaseGivenConfiguration(this.description, readContextJsonFile(ctxName), this.testContext);
|
|
118
|
+
}
|
|
119
|
+
given(givenFunction) {
|
|
120
|
+
return new OperationHandlerTestCaseWhenConfiguration(this.description, this.defaultCtx, this.testContext, givenFunction);
|
|
121
|
+
}
|
|
122
|
+
givenNothing() {
|
|
123
|
+
return this.given(() => Promise.resolve(OperationHandler_1.OperationHandlerResult.success({})));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.OperationHandlerTestCaseAuthConfiguration = OperationHandlerTestCaseAuthConfiguration;
|
|
127
|
+
class OperationHandlerTestCaseFactory {
|
|
128
|
+
constructor(description, ctx, testCaseSetup) {
|
|
129
|
+
this.description = description;
|
|
130
|
+
this.ctx = ctx;
|
|
131
|
+
this.testCaseSetup = testCaseSetup;
|
|
132
|
+
}
|
|
133
|
+
testCase(testContext) {
|
|
134
|
+
return this.testCaseSetup(new OperationHandlerTestCaseAuthConfiguration(this.description, this.ctx, testContext));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.OperationHandlerTestCaseFactory = OperationHandlerTestCaseFactory;
|
|
138
|
+
class OperationHandlerTest {
|
|
139
|
+
constructor(handlerReference, ctx, beforeAllFunction, testCaseFactories, afterAllFunction) {
|
|
140
|
+
this.handlerReference = handlerReference;
|
|
141
|
+
this.ctx = ctx;
|
|
142
|
+
this.beforeAllFunction = beforeAllFunction;
|
|
143
|
+
this.testCaseFactories = testCaseFactories;
|
|
144
|
+
this.afterAllFunction = afterAllFunction;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.OperationHandlerTest = OperationHandlerTest;
|
|
148
|
+
class OperationHandlerTestAfterAllConfiguration {
|
|
149
|
+
constructor(handlerReference, ctx, beforeAllFunction, testCaseFactories) {
|
|
150
|
+
this.handlerReference = handlerReference;
|
|
151
|
+
this.ctx = ctx;
|
|
152
|
+
this.beforeAllFunction = beforeAllFunction;
|
|
153
|
+
this.testCaseFactories = testCaseFactories;
|
|
154
|
+
}
|
|
155
|
+
testCase(description, testCaseSetup) {
|
|
156
|
+
const testCaseFactory = new OperationHandlerTestCaseFactory(description, this.ctx, testCaseSetup);
|
|
157
|
+
return new OperationHandlerTestAfterAllConfiguration(this.handlerReference, this.ctx, this.beforeAllFunction, this.testCaseFactories.concat([testCaseFactory]));
|
|
158
|
+
}
|
|
159
|
+
afterAll(afterAllFunction) {
|
|
160
|
+
return new OperationHandlerTest(this.handlerReference, this.ctx, this.beforeAllFunction, this.testCaseFactories, afterAllFunction);
|
|
161
|
+
}
|
|
162
|
+
nothingAfterAll() {
|
|
163
|
+
return this.afterAll(() => Promise.resolve(OperationHandler_1.OperationHandlerResult.success(undefined)));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.OperationHandlerTestAfterAllConfiguration = OperationHandlerTestAfterAllConfiguration;
|
|
167
|
+
class OperationHandlerTestMandatoryTestCaseConfiguration {
|
|
168
|
+
constructor(handlerReference, ctx, beforeAllFunction) {
|
|
169
|
+
this.handlerReference = handlerReference;
|
|
170
|
+
this.ctx = ctx;
|
|
171
|
+
this.beforeAllFunction = beforeAllFunction;
|
|
172
|
+
}
|
|
173
|
+
testCase(description, testCaseSetup) {
|
|
174
|
+
const testCaseFactory = new OperationHandlerTestCaseFactory(description, this.ctx, testCaseSetup);
|
|
175
|
+
return new OperationHandlerTestAfterAllConfiguration(this.handlerReference, this.ctx, this.beforeAllFunction, [testCaseFactory]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.OperationHandlerTestMandatoryTestCaseConfiguration = OperationHandlerTestMandatoryTestCaseConfiguration;
|
|
179
|
+
class OperationHandlerTestBeforeAllConfiguration {
|
|
180
|
+
constructor(handlerReference, ctx) {
|
|
181
|
+
this.handlerReference = handlerReference;
|
|
182
|
+
this.ctx = ctx;
|
|
183
|
+
}
|
|
184
|
+
beforeAll(beforeAllFunction) {
|
|
185
|
+
return new OperationHandlerTestMandatoryTestCaseConfiguration(this.handlerReference, this.ctx, beforeAllFunction);
|
|
186
|
+
}
|
|
187
|
+
nothingBeforeAll() {
|
|
188
|
+
return this.beforeAll(() => Promise.resolve(OperationHandler_1.OperationHandlerResult.success({})));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
exports.OperationHandlerTestBeforeAllConfiguration = OperationHandlerTestBeforeAllConfiguration;
|
|
192
|
+
class OperationHandlerTestAuthConfiguration {
|
|
193
|
+
constructor(handlerReference) {
|
|
194
|
+
this.handlerReference = handlerReference;
|
|
195
|
+
}
|
|
196
|
+
usingHandlerContext(ctxName) {
|
|
197
|
+
return new OperationHandlerTestBeforeAllConfiguration(this.handlerReference, readContextJsonFile(ctxName));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.OperationHandlerTestAuthConfiguration = OperationHandlerTestAuthConfiguration;
|
|
201
|
+
class OperationHandlerTestRegistry {
|
|
202
|
+
static register(handlerTest) {
|
|
203
|
+
OperationHandlerTestRegistry.instance.register(handlerTest);
|
|
204
|
+
}
|
|
205
|
+
static resolve(reference) {
|
|
206
|
+
return OperationHandlerTestRegistry.instance.resolve(reference);
|
|
207
|
+
}
|
|
208
|
+
static onRegistration(onRegistrationFunction) {
|
|
209
|
+
OperationHandlerTestRegistry.instance.onRegistration(onRegistrationFunction);
|
|
210
|
+
}
|
|
211
|
+
constructor() {
|
|
212
|
+
this.registry = new Map();
|
|
213
|
+
this.observers = [];
|
|
214
|
+
}
|
|
215
|
+
register(handlerTest) {
|
|
216
|
+
const { handlerReference } = handlerTest;
|
|
217
|
+
this.registry.set(handlerReference.name, handlerTest);
|
|
218
|
+
this.observers.forEach((observer) => observer(handlerReference));
|
|
219
|
+
}
|
|
220
|
+
resolve(reference) {
|
|
221
|
+
const handlerTest = this.registry.get(reference.name);
|
|
222
|
+
if (!handlerTest) {
|
|
223
|
+
return O.none;
|
|
224
|
+
}
|
|
225
|
+
return O.some(handlerTest);
|
|
226
|
+
}
|
|
227
|
+
onRegistration(onRegistrationFunction) {
|
|
228
|
+
this.observers.push(onRegistrationFunction);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.OperationHandlerTestRegistry = OperationHandlerTestRegistry;
|
|
232
|
+
OperationHandlerTestRegistry.instance = new OperationHandlerTestRegistry();
|
|
233
|
+
exports.OperationHandlerTestSetup = {
|
|
234
|
+
configureHandlerTest: (handlerReference, handlerTestSetup) => {
|
|
235
|
+
const handlerTest = handlerTestSetup(new OperationHandlerTestAuthConfiguration(handlerReference));
|
|
236
|
+
OperationHandlerTestRegistry.register(handlerTest);
|
|
237
|
+
},
|
|
238
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { OperationHandlerAuth, OperationHandlerContext } from './OperationHandler';
|
|
2
|
+
export type OperationHandlerInputValidationCondition<AUTH extends OperationHandlerAuth<unknown, unknown>, IN> = (ctx: OperationHandlerContext<AUTH>, input: IN) => boolean;
|
|
3
|
+
export type OperationHandlerInputValidationErrorMessage<AUTH extends OperationHandlerAuth<unknown, unknown>, IN> = (ctx: OperationHandlerContext<AUTH>, input: IN) => string;
|
|
4
|
+
export type OperationHandlerOutputValidationCondition<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> = (ctx: OperationHandlerContext<AUTH>, input: IN, output: OUT) => boolean;
|
|
5
|
+
export type OperationHandlerOutputValidationErrorMessage<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> = (ctx: OperationHandlerContext<AUTH>, input: IN, output: OUT) => string;
|
|
6
|
+
export declare class OperationHandlerValidation<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
7
|
+
static emptyValidation<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT>(): OperationHandlerValidation<AUTH, IN, OUT>;
|
|
8
|
+
readonly inputValidation: Array<OperationHandlerInputValidation<AUTH, IN>>;
|
|
9
|
+
readonly outputValidation: Array<OperationHandlerOutputValidation<AUTH, IN, OUT>>;
|
|
10
|
+
private constructor();
|
|
11
|
+
addInputValidation(inputValidation: OperationHandlerInputValidation<AUTH, IN>): OperationHandlerValidation<AUTH, IN, OUT>;
|
|
12
|
+
addOutputValidation(outputValidation: OperationHandlerOutputValidation<AUTH, IN, OUT>): OperationHandlerValidation<AUTH, IN, OUT>;
|
|
13
|
+
}
|
|
14
|
+
export declare class OperationHandlerInputValidation<AUTH extends OperationHandlerAuth<unknown, unknown>, IN> {
|
|
15
|
+
readonly condition: OperationHandlerInputValidationCondition<AUTH, IN>;
|
|
16
|
+
readonly errorMessage: OperationHandlerInputValidationErrorMessage<AUTH, IN>;
|
|
17
|
+
constructor(condition: OperationHandlerInputValidationCondition<AUTH, IN>, errorMessage: OperationHandlerInputValidationErrorMessage<AUTH, IN>);
|
|
18
|
+
}
|
|
19
|
+
export declare class OperationHandlerInputValidationErrorMessageConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN> {
|
|
20
|
+
private condition;
|
|
21
|
+
constructor(condition: OperationHandlerInputValidationCondition<AUTH, IN>);
|
|
22
|
+
errorMessage(errorMessage: OperationHandlerInputValidationErrorMessage<AUTH, IN>): OperationHandlerInputValidation<AUTH, IN>;
|
|
23
|
+
}
|
|
24
|
+
export declare class OperationHandlerInputValidationConditionConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN> {
|
|
25
|
+
condition(condition: OperationHandlerInputValidationCondition<AUTH, IN>): OperationHandlerInputValidationErrorMessageConfiguration<AUTH, IN>;
|
|
26
|
+
}
|
|
27
|
+
export type OperationHandlerInputValidationSetup<AUTH extends OperationHandlerAuth<unknown, unknown>, IN> = (inputValidation: OperationHandlerInputValidationConditionConfiguration<AUTH, IN>) => OperationHandlerInputValidation<AUTH, IN>;
|
|
28
|
+
export declare class OperationHandlerOutputValidation<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
29
|
+
readonly condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>;
|
|
30
|
+
readonly errorMessage: OperationHandlerOutputValidationErrorMessage<AUTH, IN, OUT>;
|
|
31
|
+
constructor(condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>, errorMessage: OperationHandlerOutputValidationErrorMessage<AUTH, IN, OUT>);
|
|
32
|
+
}
|
|
33
|
+
export declare class OperationHandlerOutputValidationErrorMessageConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
34
|
+
private condition;
|
|
35
|
+
constructor(condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>);
|
|
36
|
+
errorMessage(errorMessage: OperationHandlerOutputValidationErrorMessage<AUTH, IN, OUT>): OperationHandlerOutputValidation<AUTH, IN, OUT>;
|
|
37
|
+
}
|
|
38
|
+
export declare class OperationHandlerOutputValidationConditionConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
39
|
+
condition(condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>): OperationHandlerOutputValidationErrorMessageConfiguration<AUTH, IN, OUT>;
|
|
40
|
+
}
|
|
41
|
+
export type OperationHandlerOutputValidationSetup<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> = (outputValidation: OperationHandlerOutputValidationConditionConfiguration<AUTH, IN, OUT>) => OperationHandlerOutputValidation<AUTH, IN, OUT>;
|
|
42
|
+
//# sourceMappingURL=OperationHandlerValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationHandlerValidation.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandlerValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,uBAAuB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,wCAAwC,CACnD,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EACnD,EAAE,IACC,CAAC,GAAG,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC;AAC/D,MAAM,MAAM,2CAA2C,CACtD,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EACnD,EAAE,IACC,CAAC,GAAG,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,MAAM,CAAC;AAC9D,MAAM,MAAM,yCAAyC,CACpD,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EACnD,EAAE,EACF,GAAG,IACA,CAAC,GAAG,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC;AAC5E,MAAM,MAAM,4CAA4C,CACvD,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CA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