@trayio/cdk-dsl 0.0.5 → 0.0.6

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 (25) hide show
  1. package/dist/connector/operation/CompositeOperationHandler.d.ts +9 -0
  2. package/dist/connector/operation/CompositeOperationHandler.d.ts.map +1 -0
  3. package/dist/connector/operation/CompositeOperationHandler.js +10 -0
  4. package/dist/connector/operation/HttpOperationHandler.d.ts +50 -0
  5. package/dist/connector/operation/HttpOperationHandler.d.ts.map +1 -0
  6. package/dist/connector/operation/HttpOperationHandler.js +101 -0
  7. package/dist/connector/operation/OperationHandler.d.ts +40 -0
  8. package/dist/connector/operation/OperationHandler.d.ts.map +1 -0
  9. package/dist/connector/operation/OperationHandler.js +101 -0
  10. package/dist/connector/operation/OperationHandlerInvocation.d.ts +4 -0
  11. package/dist/connector/operation/OperationHandlerInvocation.d.ts.map +1 -0
  12. package/dist/connector/operation/OperationHandlerInvocation.js +2 -0
  13. package/dist/connector/operation/OperationHandlerReference.d.ts +4 -0
  14. package/dist/connector/operation/OperationHandlerReference.d.ts.map +1 -0
  15. package/dist/connector/operation/OperationHandlerReference.js +2 -0
  16. package/dist/connector/operation/OperationHandlerResult.d.ts +25 -0
  17. package/dist/connector/operation/OperationHandlerResult.d.ts.map +1 -0
  18. package/dist/connector/operation/OperationHandlerResult.js +45 -0
  19. package/dist/connector/operation/OperationHandlerTest.d.ts +132 -0
  20. package/dist/connector/operation/OperationHandlerTest.d.ts.map +1 -0
  21. package/dist/connector/operation/OperationHandlerTest.js +216 -0
  22. package/dist/connector/operation/OperationHandlerValidation.d.ts +41 -0
  23. package/dist/connector/operation/OperationHandlerValidation.d.ts.map +1 -0
  24. package/dist/connector/operation/OperationHandlerValidation.js +63 -0
  25. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { OperationHandlerResult } from './OperationHandlerResult';
2
+ import { OperationHandlerInvocation } from './OperationHandlerInvocation';
3
+ export type CompositeOperationHandlerFunction<AUTH, IN, OUT> = (auth: AUTH, input: IN, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<OUT>>;
4
+ export declare class CompositeOperationHandler<AUTH, IN, OUT> {
5
+ readonly _tag: 'CompositeOperationHandler';
6
+ readonly handlerFunction: CompositeOperationHandlerFunction<AUTH, IN, OUT>;
7
+ constructor(handlerFunction: CompositeOperationHandlerFunction<AUTH, IN, OUT>);
8
+ }
9
+ //# sourceMappingURL=CompositeOperationHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompositeOperationHandler.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/CompositeOperationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,MAAM,iCAAiC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CAC9D,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,0BAA0B,CAAC,IAAI,CAAC,KACpC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1C,qBAAa,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG;IACnD,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAA+B;IACzE,QAAQ,CAAC,eAAe,EAAE,iCAAiC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;gBAG1E,eAAe,EAAE,iCAAiC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC;CAIlE"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompositeOperationHandler = void 0;
4
+ class CompositeOperationHandler {
5
+ constructor(handlerFunction) {
6
+ this._tag = 'CompositeOperationHandler';
7
+ this.handlerFunction = handlerFunction;
8
+ }
9
+ }
10
+ exports.CompositeOperationHandler = CompositeOperationHandler;
@@ -0,0 +1,50 @@
1
+ import { HttpMethod, HttpRequest, HttpHeaderValue, HttpResponse } from '@trayio/tray-commons/http/Http';
2
+ import { OperationHandlerResult } from './OperationHandlerResult';
3
+ export declare class HttpOperationRequest {
4
+ private jsonSerialization;
5
+ readonly path: string;
6
+ readonly method: HttpMethod;
7
+ readonly request: HttpRequest;
8
+ constructor(method: HttpMethod, path: string, request: HttpRequest);
9
+ withBodyAsJson<T>(body: T): HttpOperationRequest;
10
+ addPathParameter(name: string, value: string): HttpOperationRequest;
11
+ addQueryString(name: string, value: string): HttpOperationRequest;
12
+ withBearerToken(token: string): HttpOperationRequest;
13
+ addHeader(name: string, value: HttpHeaderValue): HttpOperationRequest;
14
+ }
15
+ export type HttpOperationRequestHandler<AUTH, IN> = (auth: AUTH, input: IN, request: HttpOperationRequest) => HttpOperationRequest;
16
+ export declare class HttpOperationResponse {
17
+ private jsonSerialization;
18
+ private response;
19
+ constructor(response: HttpResponse);
20
+ withBodyAsJson<T>(): OperationHandlerResult<T>;
21
+ }
22
+ export type HttpOperationResponseHandler<OUT> = (response: HttpOperationResponse) => OperationHandlerResult<OUT>;
23
+ export declare class HttpOperationHandler<AUTH, IN, OUT> {
24
+ readonly _tag: 'HttpOperationHandler';
25
+ readonly request: HttpOperationRequest;
26
+ readonly requestHandler: HttpOperationRequestHandler<AUTH, IN>;
27
+ readonly responseHandler: HttpOperationResponseHandler<OUT>;
28
+ constructor(request: HttpOperationRequest, requestHandler: HttpOperationRequestHandler<AUTH, IN>, responseHandler: HttpOperationResponseHandler<OUT>);
29
+ }
30
+ export declare class HttpOperationHandlerResponseConfiguration<AUTH, IN, OUT> {
31
+ private request;
32
+ private requestHandler;
33
+ constructor(request: HttpOperationRequest, requestHandler: HttpOperationRequestHandler<AUTH, IN>);
34
+ handleResponse(responseHandler: HttpOperationResponseHandler<OUT>): HttpOperationHandler<AUTH, IN, OUT>;
35
+ }
36
+ export declare class HttpOperationHandlerRequestConfiguration<AUTH, IN, OUT> {
37
+ private request;
38
+ constructor(request: HttpOperationRequest);
39
+ handleRequest(requestHandler: HttpOperationRequestHandler<AUTH, IN>): HttpOperationHandlerResponseConfiguration<AUTH, IN, OUT>;
40
+ }
41
+ export declare class HttpOperationHandlerConfiguration<AUTH, IN, OUT> {
42
+ get(path: string): HttpOperationHandlerRequestConfiguration<AUTH, IN, OUT>;
43
+ post(path: string): HttpOperationHandlerRequestConfiguration<AUTH, IN, OUT>;
44
+ put(path: string): HttpOperationHandlerRequestConfiguration<AUTH, IN, OUT>;
45
+ patch(path: string): HttpOperationHandlerRequestConfiguration<AUTH, IN, OUT>;
46
+ delete(path: string): HttpOperationHandlerRequestConfiguration<AUTH, IN, OUT>;
47
+ private initialRequest;
48
+ }
49
+ export type HttpOperationHandlerSetup<AUTH, IN, OUT> = (http: HttpOperationHandlerConfiguration<AUTH, IN, OUT>) => HttpOperationHandler<AUTH, IN, OUT>;
50
+ //# sourceMappingURL=HttpOperationHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpOperationHandler.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/HttpOperationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACN,sBAAsB,EAEtB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,oBAAoB;IAChC,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;gBAElB,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;IAOlE,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,oBAAoB;IAQhD,gBAAgB,CAAC,IAAI,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"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpOperationHandlerConfiguration = exports.HttpOperationHandlerRequestConfiguration = exports.HttpOperationHandlerResponseConfiguration = exports.HttpOperationHandler = exports.HttpOperationResponse = exports.HttpOperationRequest = void 0;
4
+ const Http_1 = require("@trayio/tray-commons/http/Http");
5
+ const JsonSerialization_1 = require("@trayio/tray-commons/serialization/JsonSerialization");
6
+ const OperationHandlerResult_1 = require("./OperationHandlerResult");
7
+ class HttpOperationRequest {
8
+ constructor(method, path, request) {
9
+ this.jsonSerialization = new JsonSerialization_1.JsonSerialization();
10
+ this.method = method;
11
+ this.path = path;
12
+ this.request = request;
13
+ }
14
+ withBodyAsJson(body) {
15
+ const serializedBody = this.jsonSerialization.serialize(body);
16
+ return new HttpOperationRequest(this.method, this.path, Object.assign(Object.assign({}, this.request), { body: serializedBody })).addHeader(Http_1.HttpHeaders.ContentType, Http_1.HttpContentType.Json);
17
+ }
18
+ addPathParameter(name, value) {
19
+ return new HttpOperationRequest(this.method, this.path, Object.assign(Object.assign({}, this.request), { pathParams: Object.assign(Object.assign({}, this.request.pathParams), { [name]: value }) }));
20
+ }
21
+ addQueryString(name, value) {
22
+ return new HttpOperationRequest(this.method, this.path, Object.assign(Object.assign({}, this.request), { queryString: Object.assign(Object.assign({}, this.request.queryString), { [name]: value }) }));
23
+ }
24
+ withBearerToken(token) {
25
+ return this.addHeader(Http_1.HttpHeaders.Authorization, `Bearer ${token}`);
26
+ }
27
+ addHeader(name, value) {
28
+ return new HttpOperationRequest(this.method, this.path, Object.assign(Object.assign({}, this.request), { headers: Object.assign(Object.assign({}, this.request.headers), { [name]: value }) }));
29
+ }
30
+ }
31
+ exports.HttpOperationRequest = HttpOperationRequest;
32
+ class HttpOperationResponse {
33
+ constructor(response) {
34
+ this.jsonSerialization = new JsonSerialization_1.JsonSerialization();
35
+ this.response = response;
36
+ }
37
+ // TODO Add methods for "recovery", custom error responses, "onError" or something like that (don't call it handle error because you are in a handler already)
38
+ withBodyAsJson() {
39
+ if (this.response.statusCode > 300) {
40
+ return OperationHandlerResult_1.OperationHandlerResult.failure(`Error ${this.response.statusCode}`); // TODO add detailed errors and custom error responses
41
+ }
42
+ const deserializedBodyE = this.jsonSerialization.deserialize(this.response.body);
43
+ const deserializedBody = OperationHandlerResult_1.OperationHandlerResultInternal.fromEitherWithSimpleErrorAndUnknown(deserializedBodyE);
44
+ return deserializedBody;
45
+ }
46
+ }
47
+ exports.HttpOperationResponse = HttpOperationResponse;
48
+ class HttpOperationHandler {
49
+ constructor(request, requestHandler, responseHandler) {
50
+ this._tag = 'HttpOperationHandler';
51
+ this.request = request;
52
+ this.requestHandler = requestHandler;
53
+ this.responseHandler = responseHandler;
54
+ }
55
+ }
56
+ exports.HttpOperationHandler = HttpOperationHandler;
57
+ class HttpOperationHandlerResponseConfiguration {
58
+ constructor(request, requestHandler) {
59
+ this.request = request;
60
+ this.requestHandler = requestHandler;
61
+ }
62
+ handleResponse(responseHandler) {
63
+ return new HttpOperationHandler(this.request, this.requestHandler, responseHandler);
64
+ }
65
+ }
66
+ exports.HttpOperationHandlerResponseConfiguration = HttpOperationHandlerResponseConfiguration;
67
+ class HttpOperationHandlerRequestConfiguration {
68
+ constructor(request) {
69
+ this.request = request;
70
+ }
71
+ handleRequest(requestHandler) {
72
+ return new HttpOperationHandlerResponseConfiguration(this.request, requestHandler);
73
+ }
74
+ }
75
+ exports.HttpOperationHandlerRequestConfiguration = HttpOperationHandlerRequestConfiguration;
76
+ class HttpOperationHandlerConfiguration {
77
+ get(path) {
78
+ return new HttpOperationHandlerRequestConfiguration(this.initialRequest(Http_1.HttpMethod.Get, path));
79
+ }
80
+ post(path) {
81
+ return new HttpOperationHandlerRequestConfiguration(this.initialRequest(Http_1.HttpMethod.Post, path));
82
+ }
83
+ put(path) {
84
+ return new HttpOperationHandlerRequestConfiguration(this.initialRequest(Http_1.HttpMethod.Put, path));
85
+ }
86
+ patch(path) {
87
+ return new HttpOperationHandlerRequestConfiguration(this.initialRequest(Http_1.HttpMethod.Patch, path));
88
+ }
89
+ delete(path) {
90
+ return new HttpOperationHandlerRequestConfiguration(this.initialRequest(Http_1.HttpMethod.Delete, path));
91
+ }
92
+ initialRequest(method, path) {
93
+ return new HttpOperationRequest(method, path, {
94
+ headers: {},
95
+ pathParams: {},
96
+ queryString: {},
97
+ body: new ArrayBuffer(0),
98
+ });
99
+ }
100
+ }
101
+ exports.HttpOperationHandlerConfiguration = HttpOperationHandlerConfiguration;
@@ -0,0 +1,40 @@
1
+ import * as O from 'fp-ts/Option';
2
+ import { CompositeOperationHandler, CompositeOperationHandlerFunction } from './CompositeOperationHandler';
3
+ import { HttpOperationHandler, HttpOperationHandlerSetup } from './HttpOperationHandler';
4
+ import { OperationHandlerValidation, OperationHandlerInputValidationSetup, OperationHandlerOutputValidationSetup } from './OperationHandlerValidation';
5
+ import { OperationHandlerReference } from './OperationHandlerReference';
6
+ export type OperationHandlerImplementation<AUTH, IN, OUT> = HttpOperationHandler<AUTH, IN, OUT> | CompositeOperationHandler<AUTH, IN, OUT>;
7
+ export declare class OperationHandler<AUTH, IN, OUT> {
8
+ readonly name: string;
9
+ readonly isPrivate: boolean;
10
+ readonly validation: O.Option<OperationHandlerValidation<AUTH, IN, OUT>>;
11
+ readonly implementation: OperationHandlerImplementation<AUTH, IN, OUT>;
12
+ constructor(name: string, isPrivate: boolean, implementation: OperationHandlerImplementation<AUTH, IN, OUT>);
13
+ }
14
+ export declare class OperationHandlerConfiguration<AUTH, IN, OUT> {
15
+ static withName<AUTH, IN, OUT>(name: string): OperationHandlerConfiguration<AUTH, IN, OUT>;
16
+ private name;
17
+ private isPrivate;
18
+ private validation;
19
+ private constructor();
20
+ private(): OperationHandlerConfiguration<AUTH, IN, OUT>;
21
+ addInputValidation(inputValidationSetup: OperationHandlerInputValidationSetup<AUTH, IN>): OperationHandlerConfiguration<AUTH, IN, OUT>;
22
+ addOutputValidation(outputValidationSetup: OperationHandlerOutputValidationSetup<AUTH, IN, OUT>): OperationHandlerConfiguration<AUTH, IN, OUT>;
23
+ usingHttp(httpSetup: HttpOperationHandlerSetup<AUTH, IN, OUT>): OperationHandler<AUTH, IN, OUT>;
24
+ usingComposite(compositeFunction: CompositeOperationHandlerFunction<AUTH, IN, OUT>): OperationHandler<AUTH, IN, OUT>;
25
+ }
26
+ export declare class OperationHandlerRegistry {
27
+ private static instance;
28
+ static register<AUTH, IN, OUT>(handler: OperationHandler<AUTH, IN, OUT>): void;
29
+ static resolve<AUTH, IN, OUT>(reference: OperationHandlerReference<AUTH, IN, OUT>): O.Option<OperationHandler<AUTH, IN, OUT>>;
30
+ private registry;
31
+ private constructor();
32
+ private register;
33
+ private resolve;
34
+ }
35
+ export type OperationHandlerSetup<AUTH, IN, OUT> = (handler: OperationHandlerConfiguration<AUTH, IN, OUT>) => OperationHandler<AUTH, IN, OUT>;
36
+ export interface OperationHandlerSetupInterface {
37
+ configureHandler: <AUTH, IN, OUT>(name: string, handlerSetup: OperationHandlerSetup<AUTH, IN, OUT>) => OperationHandlerReference<AUTH, IN, OUT>;
38
+ }
39
+ export declare const OperationHandlerSetup: OperationHandlerSetupInterface;
40
+ //# sourceMappingURL=OperationHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationHandler.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EACN,yBAAyB,EACzB,iCAAiC,EACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,oBAAoB,EAEpB,yBAAyB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,0BAA0B,EAE1B,oCAAoC,EAEpC,qCAAqC,EACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,MAAM,8BAA8B,CAAC,IAAI,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AAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,qBAAqB,EAAE,8BAWnC,CAAC"}
@@ -0,0 +1,101 @@
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 CompositeOperationHandler_1 = require("./CompositeOperationHandler");
29
+ const HttpOperationHandler_1 = require("./HttpOperationHandler");
30
+ const OperationHandlerValidation_1 = require("./OperationHandlerValidation");
31
+ class OperationHandler {
32
+ constructor(name, isPrivate, implementation) {
33
+ this.name = name;
34
+ this.isPrivate = isPrivate;
35
+ this.implementation = implementation;
36
+ this.validation = O.none;
37
+ }
38
+ }
39
+ exports.OperationHandler = OperationHandler;
40
+ class OperationHandlerConfiguration {
41
+ static withName(name) {
42
+ return new OperationHandlerConfiguration(name, false, O.none);
43
+ }
44
+ constructor(name, isPrivate, validation) {
45
+ this.name = name;
46
+ this.isPrivate = isPrivate;
47
+ this.validation = validation;
48
+ }
49
+ private() {
50
+ return new OperationHandlerConfiguration(this.name, true, this.validation);
51
+ }
52
+ addInputValidation(inputValidationSetup) {
53
+ const currentValidation = O.getOrElse(() => OperationHandlerValidation_1.OperationHandlerValidation.emptyValidation())(this.validation);
54
+ const inputValidation = inputValidationSetup(new OperationHandlerValidation_1.OperationHandlerInputValidationConditionConfiguration());
55
+ const newValidation = currentValidation.addInputValidation(inputValidation);
56
+ return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation));
57
+ }
58
+ addOutputValidation(outputValidationSetup) {
59
+ const currentValidation = O.getOrElse(() => OperationHandlerValidation_1.OperationHandlerValidation.emptyValidation())(this.validation);
60
+ const outputValidation = outputValidationSetup(new OperationHandlerValidation_1.OperationHandlerOutputValidationConditionConfiguration());
61
+ const newValidation = currentValidation.addOutputValidation(outputValidation);
62
+ return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation));
63
+ }
64
+ usingHttp(httpSetup) {
65
+ return new OperationHandler(this.name, this.isPrivate, httpSetup(new HttpOperationHandler_1.HttpOperationHandlerConfiguration()));
66
+ }
67
+ usingComposite(compositeFunction) {
68
+ return new OperationHandler(this.name, this.isPrivate, new CompositeOperationHandler_1.CompositeOperationHandler(compositeFunction));
69
+ }
70
+ }
71
+ exports.OperationHandlerConfiguration = OperationHandlerConfiguration;
72
+ class OperationHandlerRegistry {
73
+ static register(handler) {
74
+ return OperationHandlerRegistry.instance.register(handler);
75
+ }
76
+ static resolve(reference) {
77
+ return OperationHandlerRegistry.instance.resolve(reference);
78
+ }
79
+ constructor() {
80
+ this.registry = new Map();
81
+ }
82
+ register(handler) {
83
+ this.registry.set(handler.name, handler);
84
+ }
85
+ resolve(reference) {
86
+ const handler = this.registry.get(reference.name);
87
+ if (!handler) {
88
+ return O.none;
89
+ }
90
+ return O.some(handler);
91
+ }
92
+ }
93
+ exports.OperationHandlerRegistry = OperationHandlerRegistry;
94
+ OperationHandlerRegistry.instance = new OperationHandlerRegistry();
95
+ exports.OperationHandlerSetup = {
96
+ configureHandler: (name, handlerSetup) => {
97
+ const handler = handlerSetup(OperationHandlerConfiguration.withName(name));
98
+ OperationHandlerRegistry.register(handler);
99
+ return { name: handler.name };
100
+ },
101
+ };
@@ -0,0 +1,4 @@
1
+ import { OperationHandlerReference } from './OperationHandlerReference';
2
+ import { OperationHandlerResult } from './OperationHandlerResult';
3
+ export type OperationHandlerInvocation<AUTH> = <IN, OUT>(handlerReference: OperationHandlerReference<AUTH, IN, OUT>) => (input: IN) => Promise<OperationHandlerResult<OUT>>;
4
+ //# sourceMappingURL=OperationHandlerInvocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationHandlerInvocation.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandlerInvocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,MAAM,0BAA0B,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,GAAG,EACtD,gBAAgB,EAAE,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,KACtD,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type OperationHandlerReference<AUTH, IN, OUT> = {
2
+ name: string;
3
+ };
4
+ //# sourceMappingURL=OperationHandlerReference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationHandlerReference.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandlerReference.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI;IACtD,IAAI,EAAE,MAAM,CAAC;CACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ import * as E from 'fp-ts/Either';
2
+ export type OperationHandlerFailure = {
3
+ readonly _tag: 'OperationHandlerFailure';
4
+ readonly isSuccess: false;
5
+ readonly isFailure: true;
6
+ readonly error: string;
7
+ };
8
+ export type OperationHandlerSuccess<T> = {
9
+ readonly _tag: 'OperationHandlerSuccess';
10
+ readonly isSuccess: true;
11
+ readonly isFailure: false;
12
+ readonly value: T;
13
+ };
14
+ export type OperationHandlerResult<T> = OperationHandlerFailure | OperationHandlerSuccess<T>;
15
+ export interface OperationHandlerResultInterface {
16
+ success: <T>(value: T) => OperationHandlerResult<T>;
17
+ failure: <T>(error: string) => OperationHandlerResult<T>;
18
+ }
19
+ export declare const OperationHandlerResult: OperationHandlerResultInterface;
20
+ export interface OperationHandlerResultInternalInterface {
21
+ fromEitherWithSimpleError: <T>(either: E.Either<Error, T>) => OperationHandlerResult<T>;
22
+ fromEitherWithSimpleErrorAndUnknown: <T>(either: E.Either<Error, unknown>) => OperationHandlerResult<T>;
23
+ }
24
+ export declare const OperationHandlerResultInternal: OperationHandlerResultInternalInterface;
25
+ //# sourceMappingURL=OperationHandlerResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationHandlerResult.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandlerResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI;IACxC,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,CAAC,IACjC,uBAAuB,GACvB,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAE9B,MAAM,WAAW,+BAA+B;IAC/C,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,sBAAsB,CAAC,CAAC,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,sBAAsB,EAAE,+BAapC,CAAC;AAEF,MAAM,WAAW,uCAAuC;IACvD,yBAAyB,EAAE,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,KACtB,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAC/B,mCAAmC,EAAE,CAAC,CAAC,EACtC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,KAC5B,sBAAsB,CAAC,CAAC,CAAC,CAAC;CAC/B;AAED,eAAO,MAAM,8BAA8B,EAAE,uCAiB3C,CAAC"}
@@ -0,0 +1,45 @@
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.OperationHandlerResultInternal = exports.OperationHandlerResult = void 0;
27
+ const E = __importStar(require("fp-ts/Either"));
28
+ exports.OperationHandlerResult = {
29
+ success: (value) => ({
30
+ _tag: 'OperationHandlerSuccess',
31
+ isSuccess: true,
32
+ isFailure: false,
33
+ value,
34
+ }),
35
+ failure: (error) => ({
36
+ _tag: 'OperationHandlerFailure',
37
+ isSuccess: false,
38
+ isFailure: true,
39
+ error,
40
+ }),
41
+ };
42
+ exports.OperationHandlerResultInternal = {
43
+ fromEitherWithSimpleError: (either) => E.match((error) => exports.OperationHandlerResult.failure(error.message), (value) => exports.OperationHandlerResult.success(value))(either),
44
+ fromEitherWithSimpleErrorAndUnknown: (either) => E.match((error) => exports.OperationHandlerResult.failure(error.message), (value) => exports.OperationHandlerResult.success(value))(either),
45
+ };
@@ -0,0 +1,132 @@
1
+ import * as O from 'fp-ts/Option';
2
+ import { OperationHandlerReference } from './OperationHandlerReference';
3
+ import { OperationHandlerResult } from './OperationHandlerResult';
4
+ import { OperationHandlerInvocation } from './OperationHandlerInvocation';
5
+ export type OperationHandlerTestCaseResult<AUTH, IN, OUT, TCTX, TCCTX> = {
6
+ auth: AUTH;
7
+ testContext: TCTX;
8
+ testCaseContext: TCCTX;
9
+ input: IN;
10
+ output: OperationHandlerResult<OUT>;
11
+ };
12
+ export type OperationHandlerTestCaseFinallyFunction<AUTH, IN, OUT, TCTX, TCCTX> = (testCaseResult: OperationHandlerTestCaseResult<AUTH, IN, OUT, TCTX, TCCTX>, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<undefined>>;
13
+ export type OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX> = (testCaseResult: OperationHandlerTestCaseResult<AUTH, IN, OUT, TCTX, TCCTX>) => void;
14
+ export type OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX> = (auth: AUTH, testContext: TCTX, testCaseContext: TCCTX) => IN;
15
+ export type OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX> = (auth: AUTH, testContext: TCTX, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<TCCTX>>;
16
+ export declare class OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX> {
17
+ description: string;
18
+ auth: AUTH;
19
+ testContext: TCTX;
20
+ givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>;
21
+ whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>;
22
+ thenFunction: OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX>;
23
+ finallyFunction: OperationHandlerTestCaseFinallyFunction<AUTH, IN, OUT, TCTX, TCCTX>;
24
+ constructor(description: string, auth: 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>);
25
+ }
26
+ export declare class OperationHandlerTestCaseFinallyConfiguration<AUTH, IN, OUT, TCTX, TCCTX> {
27
+ private description;
28
+ private auth;
29
+ private testContext;
30
+ private givenFunction;
31
+ private whenFunction;
32
+ private thenFunction;
33
+ constructor(description: string, auth: AUTH, testContext: TCTX, givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>, whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>, thenFunction: OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX>);
34
+ finally(finallyFunction: OperationHandlerTestCaseFinallyFunction<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
35
+ finallyDoNothing(): OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
36
+ }
37
+ export declare class OperationHandlerTestCaseThenConfiguration<AUTH, IN, OUT, TCTX, TCCTX> {
38
+ private description;
39
+ private auth;
40
+ private testContext;
41
+ private givenFunction;
42
+ private whenFunction;
43
+ constructor(description: string, auth: AUTH, testContext: TCTX, givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>, whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>);
44
+ then(thenFunction: OperationHandlerTestCaseThenFunction<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestCaseFinallyConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
45
+ }
46
+ export declare class OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, TCCTX> {
47
+ private description;
48
+ private auth;
49
+ private testContext;
50
+ private givenFunction;
51
+ constructor(description: string, auth: AUTH, testContext: TCTX, givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>);
52
+ when(whenFunction: OperationHandlerTestCaseWhenFunction<AUTH, IN, TCTX, TCCTX>): OperationHandlerTestCaseThenConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
53
+ }
54
+ export declare class OperationHandlerTestCaseGivenConfiguration<AUTH, IN, OUT, TCTX> {
55
+ private description;
56
+ private auth;
57
+ private testContext;
58
+ constructor(description: string, auth: AUTH, testContext: TCTX);
59
+ given<TCCTX>(givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
60
+ givenNoContext(): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, {}>;
61
+ }
62
+ export declare class OperationHandlerTestCaseAuthConfiguration<AUTH, IN, OUT, TCTX> {
63
+ private description;
64
+ private defaultAuth;
65
+ private testContext;
66
+ constructor(description: string, defaultAuth: AUTH, testContext: TCTX);
67
+ usingAuth(auth: AUTH): OperationHandlerTestCaseGivenConfiguration<AUTH, IN, OUT, TCTX>;
68
+ given<TCCTX>(givenFunction: OperationHandlerTestCaseGivenFunction<AUTH, TCTX, TCCTX>): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, TCCTX>;
69
+ givenNoContext(): OperationHandlerTestCaseWhenConfiguration<AUTH, IN, OUT, TCTX, {}>;
70
+ }
71
+ export type OperationHandlerTestCaseSetup<AUTH, IN, OUT, TCTX, TCCTX> = (testCase: OperationHandlerTestCaseAuthConfiguration<AUTH, IN, OUT, TCTX>) => OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
72
+ export type OperationHandlerTestAfterAllFunction<AUTH, TCTX> = (auth: AUTH, testContext: TCTX, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<undefined>>;
73
+ export type OperationHandlerTestBeforeAllFunction<AUTH, TCTX> = (auth: AUTH, invoke: OperationHandlerInvocation<AUTH>) => Promise<OperationHandlerResult<TCTX>>;
74
+ export declare class OperationHandlerTestCaseFactory<AUTH, IN, OUT, TCTX, TCCTX> {
75
+ description: string;
76
+ private auth;
77
+ private testCaseSetup;
78
+ constructor(description: string, auth: AUTH, testCaseSetup: OperationHandlerTestCaseSetup<AUTH, IN, OUT, TCTX, TCCTX>);
79
+ testCase(testContext: TCTX): OperationHandlerTestCase<AUTH, IN, OUT, TCTX, TCCTX>;
80
+ }
81
+ export declare class OperationHandlerTest<AUTH, IN, OUT, TCTX> {
82
+ handlerReference: OperationHandlerReference<AUTH, IN, OUT>;
83
+ auth: AUTH;
84
+ beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>;
85
+ testCaseFactories: Array<OperationHandlerTestCaseFactory<AUTH, IN, OUT, TCTX, unknown>>;
86
+ afterAllFunction: OperationHandlerTestAfterAllFunction<AUTH, TCTX>;
87
+ constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, auth: AUTH, beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>, testCaseFactories: Array<OperationHandlerTestCaseFactory<AUTH, IN, OUT, TCTX, unknown>>, afterAllFunction: OperationHandlerTestAfterAllFunction<AUTH, TCTX>);
88
+ }
89
+ export declare class OperationHandlerTestAfterAllConfiguration<AUTH, IN, OUT, TCTX> {
90
+ private handlerReference;
91
+ private auth;
92
+ private beforeAllFunction;
93
+ private testCaseFactories;
94
+ constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, auth: AUTH, beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>, testCaseFactories: Array<OperationHandlerTestCaseFactory<AUTH, IN, OUT, TCTX, unknown>>);
95
+ testCase<TCCTX>(description: string, testCaseSetup: OperationHandlerTestCaseSetup<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestAfterAllConfiguration<AUTH, IN, OUT, TCTX>;
96
+ afterAll(afterAllFunction: OperationHandlerTestAfterAllFunction<AUTH, TCTX>): OperationHandlerTest<AUTH, IN, OUT, TCTX>;
97
+ nothingAfterAll(): OperationHandlerTest<AUTH, IN, OUT, TCTX>;
98
+ }
99
+ export declare class OperationHandlerTestMandatoryTestCaseConfiguration<AUTH, IN, OUT, TCTX> {
100
+ private handlerReference;
101
+ private auth;
102
+ private beforeAllFunction;
103
+ constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, auth: AUTH, beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>);
104
+ testCase<TCCTX>(description: string, testCaseSetup: OperationHandlerTestCaseSetup<AUTH, IN, OUT, TCTX, TCCTX>): OperationHandlerTestAfterAllConfiguration<AUTH, IN, OUT, TCTX>;
105
+ }
106
+ export declare class OperationHandlerTestBeforeAllConfiguration<AUTH, IN, OUT> {
107
+ private handlerReference;
108
+ private auth;
109
+ constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, auth: AUTH);
110
+ beforeAll<TCTX>(beforeAllFunction: OperationHandlerTestBeforeAllFunction<AUTH, TCTX>): OperationHandlerTestMandatoryTestCaseConfiguration<AUTH, IN, OUT, TCTX>;
111
+ nothingBeforeAll(): OperationHandlerTestMandatoryTestCaseConfiguration<AUTH, IN, OUT, {}>;
112
+ }
113
+ export declare class OperationHandlerTestAuthConfiguration<AUTH, IN, OUT> {
114
+ private handlerReference;
115
+ constructor(handlerReference: OperationHandlerReference<AUTH, IN, OUT>);
116
+ usingAuth(auth: AUTH): OperationHandlerTestBeforeAllConfiguration<AUTH, IN, OUT>;
117
+ }
118
+ export declare class OperationHandlerTestRegistry {
119
+ private static instance;
120
+ static register<AUTH, IN, OUT, TCTX>(handlerTest: OperationHandlerTest<AUTH, IN, OUT, TCTX>): void;
121
+ static resolve<AUTH, IN, OUT>(reference: OperationHandlerReference<AUTH, IN, OUT>): O.Option<OperationHandlerTest<AUTH, IN, OUT, unknown>>;
122
+ private registry;
123
+ private constructor();
124
+ private register;
125
+ private resolve;
126
+ }
127
+ export type OperationHandlerTestSetup<AUTH, IN, OUT, TCTX> = (handlerTest: OperationHandlerTestAuthConfiguration<AUTH, IN, OUT>) => OperationHandlerTest<AUTH, IN, OUT, TCTX>;
128
+ export interface OperationHandlerTestSetupInterface {
129
+ configureHandlerTest: <AUTH, IN, OUT, TCTX>(handlerReference: OperationHandlerReference<AUTH, IN, OUT>, handlerTestSetup: OperationHandlerTestSetup<AUTH, IN, OUT, TCTX>) => void;
130
+ }
131
+ export declare const OperationHandlerTestSetup: OperationHandlerTestSetupInterface;
132
+ //# 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,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,MAAM,8BAA8B,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,IAAI;IACxE,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,IAAI,CAAC;IAClB,eAAe,EAAE,KAAK,CAAC;IACvB,KAAK,EAAE,EAAE,CAAC;IACV,MAAM,EAAE,sBAAsB,CAAC,GAAG,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,uCAAuC,CAClD,IAAI,EACJ,EAAE,EACF,GAAG,EACH,IAAI,EACJ,KAAK,IACF,CACH,cAAc,EAAE,8BAA8B,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,EAC1E,MAAM,EAAE,0BAA0B,CAAC,IAAI,CAAC,KACpC,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC;AAEhD,MAAM,MAAM,oCAAoC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,IAAI,CAC9E,cAAc,EAAE,8BAA8B,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,KACtE,IAAI,CAAC;AAEV,MAAM,MAAM,oCAAoC,CA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,EAAE,GAAG,EAAE,IAAI,CAAC;IAKvD,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAC3B,SAAS,EAAE,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GACjD,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAIzD,OAAO,CAAC,QAAQ,CAAwD;IAExE,OAAO;IAIP,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,OAAO;CASf;AAED,MAAM,MAAM,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,IAAI,CAC5D,WAAW,EAAE,qCAAqC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,KAC7D,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AAE/C,MAAM,WAAW,kCAAkC;IAClD,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EACzC,gBAAgB,EAAE,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,EAC1D,gBAAgB,EAAE,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,KAC5D,IAAI,CAAC;CACV;AAED,eAAO,MAAM,yBAAyB,EAAE,kCAUvC,CAAC"}
@@ -0,0 +1,216 @@
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 OperationHandlerResult_1 = require("./OperationHandlerResult");
29
+ class OperationHandlerTestCase {
30
+ constructor(description, auth, testContext, givenFunction, whenFunction, thenFunction, finallyFunction) {
31
+ this.description = description;
32
+ this.auth = auth;
33
+ this.testContext = testContext;
34
+ this.givenFunction = givenFunction;
35
+ this.whenFunction = whenFunction;
36
+ this.thenFunction = thenFunction;
37
+ this.finallyFunction = finallyFunction;
38
+ }
39
+ }
40
+ exports.OperationHandlerTestCase = OperationHandlerTestCase;
41
+ class OperationHandlerTestCaseFinallyConfiguration {
42
+ constructor(description, auth, testContext, givenFunction, whenFunction, thenFunction) {
43
+ this.description = description;
44
+ this.auth = auth;
45
+ this.testContext = testContext;
46
+ this.givenFunction = givenFunction;
47
+ this.whenFunction = whenFunction;
48
+ this.thenFunction = thenFunction;
49
+ }
50
+ finally(finallyFunction) {
51
+ return new OperationHandlerTestCase(this.description, this.auth, this.testContext, this.givenFunction, this.whenFunction, this.thenFunction, finallyFunction);
52
+ }
53
+ finallyDoNothing() {
54
+ return this.finally(() => Promise.resolve(OperationHandlerResult_1.OperationHandlerResult.success(undefined)));
55
+ }
56
+ }
57
+ exports.OperationHandlerTestCaseFinallyConfiguration = OperationHandlerTestCaseFinallyConfiguration;
58
+ class OperationHandlerTestCaseThenConfiguration {
59
+ constructor(description, auth, testContext, givenFunction, whenFunction) {
60
+ this.description = description;
61
+ this.auth = auth;
62
+ this.testContext = testContext;
63
+ this.givenFunction = givenFunction;
64
+ this.whenFunction = whenFunction;
65
+ }
66
+ then(thenFunction) {
67
+ return new OperationHandlerTestCaseFinallyConfiguration(this.description, this.auth, this.testContext, this.givenFunction, this.whenFunction, thenFunction);
68
+ }
69
+ }
70
+ exports.OperationHandlerTestCaseThenConfiguration = OperationHandlerTestCaseThenConfiguration;
71
+ class OperationHandlerTestCaseWhenConfiguration {
72
+ constructor(description, auth, testContext, givenFunction) {
73
+ this.description = description;
74
+ this.auth = auth;
75
+ this.testContext = testContext;
76
+ this.givenFunction = givenFunction;
77
+ }
78
+ when(whenFunction) {
79
+ return new OperationHandlerTestCaseThenConfiguration(this.description, this.auth, this.testContext, this.givenFunction, whenFunction);
80
+ }
81
+ }
82
+ exports.OperationHandlerTestCaseWhenConfiguration = OperationHandlerTestCaseWhenConfiguration;
83
+ class OperationHandlerTestCaseGivenConfiguration {
84
+ constructor(description, auth, testContext) {
85
+ this.description = description;
86
+ this.auth = auth;
87
+ this.testContext = testContext;
88
+ }
89
+ given(givenFunction) {
90
+ return new OperationHandlerTestCaseWhenConfiguration(this.description, this.auth, this.testContext, givenFunction);
91
+ }
92
+ givenNoContext() {
93
+ return this.given(() => Promise.resolve(OperationHandlerResult_1.OperationHandlerResult.success({})));
94
+ }
95
+ }
96
+ exports.OperationHandlerTestCaseGivenConfiguration = OperationHandlerTestCaseGivenConfiguration;
97
+ class OperationHandlerTestCaseAuthConfiguration {
98
+ constructor(description, defaultAuth, testContext) {
99
+ this.description = description;
100
+ this.defaultAuth = defaultAuth;
101
+ this.testContext = testContext;
102
+ }
103
+ usingAuth(auth) {
104
+ return new OperationHandlerTestCaseGivenConfiguration(this.description, auth, this.testContext);
105
+ }
106
+ given(givenFunction) {
107
+ return new OperationHandlerTestCaseWhenConfiguration(this.description, this.defaultAuth, this.testContext, givenFunction);
108
+ }
109
+ givenNoContext() {
110
+ return this.given(() => Promise.resolve(OperationHandlerResult_1.OperationHandlerResult.success({})));
111
+ }
112
+ }
113
+ exports.OperationHandlerTestCaseAuthConfiguration = OperationHandlerTestCaseAuthConfiguration;
114
+ class OperationHandlerTestCaseFactory {
115
+ constructor(description, auth, testCaseSetup) {
116
+ this.description = description;
117
+ this.auth = auth;
118
+ this.testCaseSetup = testCaseSetup;
119
+ }
120
+ testCase(testContext) {
121
+ return this.testCaseSetup(new OperationHandlerTestCaseAuthConfiguration(this.description, this.auth, testContext));
122
+ }
123
+ }
124
+ exports.OperationHandlerTestCaseFactory = OperationHandlerTestCaseFactory;
125
+ class OperationHandlerTest {
126
+ constructor(handlerReference, auth, beforeAllFunction, testCaseFactories, afterAllFunction) {
127
+ this.handlerReference = handlerReference;
128
+ this.auth = auth;
129
+ this.beforeAllFunction = beforeAllFunction;
130
+ this.testCaseFactories = testCaseFactories;
131
+ this.afterAllFunction = afterAllFunction;
132
+ }
133
+ }
134
+ exports.OperationHandlerTest = OperationHandlerTest;
135
+ class OperationHandlerTestAfterAllConfiguration {
136
+ constructor(handlerReference, auth, beforeAllFunction, testCaseFactories) {
137
+ this.handlerReference = handlerReference;
138
+ this.auth = auth;
139
+ this.beforeAllFunction = beforeAllFunction;
140
+ this.testCaseFactories = testCaseFactories;
141
+ }
142
+ testCase(description, testCaseSetup) {
143
+ const testCaseFactory = new OperationHandlerTestCaseFactory(description, this.auth, testCaseSetup);
144
+ return new OperationHandlerTestAfterAllConfiguration(this.handlerReference, this.auth, this.beforeAllFunction, this.testCaseFactories.concat([testCaseFactory]));
145
+ }
146
+ afterAll(afterAllFunction) {
147
+ return new OperationHandlerTest(this.handlerReference, this.auth, this.beforeAllFunction, this.testCaseFactories, afterAllFunction);
148
+ }
149
+ nothingAfterAll() {
150
+ return this.afterAll(() => Promise.resolve(OperationHandlerResult_1.OperationHandlerResult.success(undefined)));
151
+ }
152
+ }
153
+ exports.OperationHandlerTestAfterAllConfiguration = OperationHandlerTestAfterAllConfiguration;
154
+ class OperationHandlerTestMandatoryTestCaseConfiguration {
155
+ constructor(handlerReference, auth, beforeAllFunction) {
156
+ this.handlerReference = handlerReference;
157
+ this.auth = auth;
158
+ this.beforeAllFunction = beforeAllFunction;
159
+ }
160
+ testCase(description, testCaseSetup) {
161
+ const testCaseFactory = new OperationHandlerTestCaseFactory(description, this.auth, testCaseSetup);
162
+ return new OperationHandlerTestAfterAllConfiguration(this.handlerReference, this.auth, this.beforeAllFunction, [testCaseFactory]);
163
+ }
164
+ }
165
+ exports.OperationHandlerTestMandatoryTestCaseConfiguration = OperationHandlerTestMandatoryTestCaseConfiguration;
166
+ class OperationHandlerTestBeforeAllConfiguration {
167
+ constructor(handlerReference, auth) {
168
+ this.handlerReference = handlerReference;
169
+ this.auth = auth;
170
+ }
171
+ beforeAll(beforeAllFunction) {
172
+ return new OperationHandlerTestMandatoryTestCaseConfiguration(this.handlerReference, this.auth, beforeAllFunction);
173
+ }
174
+ nothingBeforeAll() {
175
+ return this.beforeAll(() => Promise.resolve(OperationHandlerResult_1.OperationHandlerResult.success({})));
176
+ }
177
+ }
178
+ exports.OperationHandlerTestBeforeAllConfiguration = OperationHandlerTestBeforeAllConfiguration;
179
+ class OperationHandlerTestAuthConfiguration {
180
+ constructor(handlerReference) {
181
+ this.handlerReference = handlerReference;
182
+ }
183
+ usingAuth(auth) {
184
+ return new OperationHandlerTestBeforeAllConfiguration(this.handlerReference, auth);
185
+ }
186
+ }
187
+ exports.OperationHandlerTestAuthConfiguration = OperationHandlerTestAuthConfiguration;
188
+ class OperationHandlerTestRegistry {
189
+ static register(handlerTest) {
190
+ return OperationHandlerTestRegistry.instance.register(handlerTest);
191
+ }
192
+ static resolve(reference) {
193
+ return OperationHandlerTestRegistry.instance.resolve(reference);
194
+ }
195
+ constructor() {
196
+ this.registry = new Map();
197
+ }
198
+ register(handlerTest) {
199
+ this.registry.set(handlerTest.handlerReference.name, handlerTest);
200
+ }
201
+ resolve(reference) {
202
+ const handlerTest = this.registry.get(reference.name);
203
+ if (!handlerTest) {
204
+ return O.none;
205
+ }
206
+ return O.some(handlerTest);
207
+ }
208
+ }
209
+ exports.OperationHandlerTestRegistry = OperationHandlerTestRegistry;
210
+ OperationHandlerTestRegistry.instance = new OperationHandlerTestRegistry();
211
+ exports.OperationHandlerTestSetup = {
212
+ configureHandlerTest: (handlerReference, handlerTestSetup) => {
213
+ const handlerTest = handlerTestSetup(new OperationHandlerTestAuthConfiguration(handlerReference));
214
+ OperationHandlerTestRegistry.register(handlerTest);
215
+ },
216
+ };
@@ -0,0 +1,41 @@
1
+ export type OperationHandlerInputValidationCondition<AUTH, IN> = (auth: AUTH, input: IN) => boolean;
2
+ export type OperationHandlerInputValidationErrorMessage<AUTH, IN> = (auth: AUTH, input: IN) => string;
3
+ export type OperationHandlerOutputValidationCondition<AUTH, IN, OUT> = (auth: AUTH, input: IN, output: OUT) => boolean;
4
+ export type OperationHandlerOutputValidationErrorMessage<AUTH, IN, OUT> = (auth: AUTH, input: IN, output: OUT) => string;
5
+ export declare class OperationHandlerValidation<AUTH, IN, OUT> {
6
+ static emptyValidation<AUTH, IN, OUT>(): OperationHandlerValidation<AUTH, IN, OUT>;
7
+ readonly inputValidation: Array<OperationHandlerInputValidation<AUTH, IN>>;
8
+ readonly outputValidation: Array<OperationHandlerOutputValidation<AUTH, IN, OUT>>;
9
+ private constructor();
10
+ addInputValidation(inputValidation: OperationHandlerInputValidation<AUTH, IN>): OperationHandlerValidation<AUTH, IN, OUT>;
11
+ addOutputValidation(outputValidation: OperationHandlerOutputValidation<AUTH, IN, OUT>): OperationHandlerValidation<AUTH, IN, OUT>;
12
+ }
13
+ export declare class OperationHandlerInputValidation<AUTH, IN> {
14
+ readonly condition: OperationHandlerInputValidationCondition<AUTH, IN>;
15
+ readonly errorMessage: OperationHandlerInputValidationErrorMessage<AUTH, IN>;
16
+ constructor(condition: OperationHandlerInputValidationCondition<AUTH, IN>, errorMessage: OperationHandlerInputValidationErrorMessage<AUTH, IN>);
17
+ }
18
+ export declare class OperationHandlerInputValidationErrorMessageConfiguration<AUTH, IN> {
19
+ private condition;
20
+ constructor(condition: OperationHandlerInputValidationCondition<AUTH, IN>);
21
+ errorMessage(errorMessage: OperationHandlerInputValidationErrorMessage<AUTH, IN>): OperationHandlerInputValidation<AUTH, IN>;
22
+ }
23
+ export declare class OperationHandlerInputValidationConditionConfiguration<AUTH, IN> {
24
+ condition(condition: OperationHandlerInputValidationCondition<AUTH, IN>): OperationHandlerInputValidationErrorMessageConfiguration<AUTH, IN>;
25
+ }
26
+ export type OperationHandlerInputValidationSetup<AUTH, IN> = (http: OperationHandlerInputValidationConditionConfiguration<AUTH, IN>) => OperationHandlerInputValidation<AUTH, IN>;
27
+ export declare class OperationHandlerOutputValidation<AUTH, IN, OUT> {
28
+ readonly condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>;
29
+ readonly errorMessage: OperationHandlerOutputValidationErrorMessage<AUTH, IN, OUT>;
30
+ constructor(condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>, errorMessage: OperationHandlerOutputValidationErrorMessage<AUTH, IN, OUT>);
31
+ }
32
+ export declare class OperationHandlerOutputValidationErrorMessageConfiguration<AUTH, IN, OUT> {
33
+ private condition;
34
+ constructor(condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>);
35
+ errorMessage(errorMessage: OperationHandlerOutputValidationErrorMessage<AUTH, IN, OUT>): OperationHandlerOutputValidation<AUTH, IN, OUT>;
36
+ }
37
+ export declare class OperationHandlerOutputValidationConditionConfiguration<AUTH, IN, OUT> {
38
+ condition(condition: OperationHandlerOutputValidationCondition<AUTH, IN, OUT>): OperationHandlerOutputValidationErrorMessageConfiguration<AUTH, IN, OUT>;
39
+ }
40
+ export type OperationHandlerOutputValidationSetup<AUTH, IN, OUT> = (http: OperationHandlerOutputValidationConditionConfiguration<AUTH, IN, OUT>) => OperationHandlerOutputValidation<AUTH, IN, OUT>;
41
+ //# 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,MAAM,MAAM,wCAAwC,CAAC,IAAI,EAAE,EAAE,IAAI,CAChE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,EAAE,KACL,OAAO,CAAC;AACb,MAAM,MAAM,2CAA2C,CAAC,IAAI,EAAE,EAAE,IAAI,CACnE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,EAAE,KACL,MAAM,CAAC;AACZ,MAAM,MAAM,yCAAyC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CACtE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,GAAG,KACP,OAAO,CAAC;AACb,MAAM,MAAM,4CAA4C,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CACzE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,GAAG,KACP,MAAM,CAAC;AAEZ,qBAAa,0BAA0B,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG;IACpD,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,KAAK,0BAA0B,CAClE,IAAI,EACJ,EAAE,EACF,GAAG,CACH;IAID,QAAQ,CAAC,eAAe,EAAE,KAAK,CAA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AE,CAAC,CAAC;AAE/C,qBAAa,gCAAgC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG;IAC1D,QAAQ,CAAC,SAAS,EAAE,yCAAyC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAC7E,QAAQ,CAAC,YAAY,EAAE,4CAA4C,CAClE,IAAI,EACJ,EAAE,EACF,GAAG,CACH,CAAC;gBAGD,SAAS,EAAE,yCAAyC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,EACnE,YAAY,EAAE,4CAA4C,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC;CAK1E;AAED,qBAAa,yDAAyD,CACrE,IAAI,EACJ,EAAE,EACF,GAAG;IAEH,OAAO,CAAC,SAAS,CAA2D;gBAG3E,SAAS,EAAE,yCAAyC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC;IAKpE,YAAY,CACX,YAAY,EAAE,4CAA4C,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GACvE,gCAAgC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC;CAMlD;AAED,qBAAa,sDAAsD,CAClE,IAAI,EACJ,EAAE,EACF,GAAG;IAEH,SAAS,CACR,SAAS,EAAE,yCAAyC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GACjE,yDAAyD,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC;CAO3E;AAED,MAAM,MAAM,qCAAqC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CAClE,IAAI,EAAE,sDAAsD,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,KACvE,gCAAgC,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OperationHandlerOutputValidationConditionConfiguration = exports.OperationHandlerOutputValidationErrorMessageConfiguration = exports.OperationHandlerOutputValidation = exports.OperationHandlerInputValidationConditionConfiguration = exports.OperationHandlerInputValidationErrorMessageConfiguration = exports.OperationHandlerInputValidation = exports.OperationHandlerValidation = void 0;
4
+ class OperationHandlerValidation {
5
+ static emptyValidation() {
6
+ return new OperationHandlerValidation([], []);
7
+ }
8
+ constructor(inputValidation, outputValidation) {
9
+ this.inputValidation = inputValidation;
10
+ this.outputValidation = outputValidation;
11
+ }
12
+ addInputValidation(inputValidation) {
13
+ return new OperationHandlerValidation(this.inputValidation.concat([inputValidation]), this.outputValidation);
14
+ }
15
+ addOutputValidation(outputValidation) {
16
+ return new OperationHandlerValidation(this.inputValidation, this.outputValidation.concat([outputValidation]));
17
+ }
18
+ }
19
+ exports.OperationHandlerValidation = OperationHandlerValidation;
20
+ class OperationHandlerInputValidation {
21
+ constructor(condition, errorMessage) {
22
+ this.condition = condition;
23
+ this.errorMessage = errorMessage;
24
+ }
25
+ }
26
+ exports.OperationHandlerInputValidation = OperationHandlerInputValidation;
27
+ class OperationHandlerInputValidationErrorMessageConfiguration {
28
+ constructor(condition) {
29
+ this.condition = condition;
30
+ }
31
+ errorMessage(errorMessage) {
32
+ return new OperationHandlerInputValidation(this.condition, errorMessage);
33
+ }
34
+ }
35
+ exports.OperationHandlerInputValidationErrorMessageConfiguration = OperationHandlerInputValidationErrorMessageConfiguration;
36
+ class OperationHandlerInputValidationConditionConfiguration {
37
+ condition(condition) {
38
+ return new OperationHandlerInputValidationErrorMessageConfiguration(condition);
39
+ }
40
+ }
41
+ exports.OperationHandlerInputValidationConditionConfiguration = OperationHandlerInputValidationConditionConfiguration;
42
+ class OperationHandlerOutputValidation {
43
+ constructor(condition, errorMessage) {
44
+ this.condition = condition;
45
+ this.errorMessage = errorMessage;
46
+ }
47
+ }
48
+ exports.OperationHandlerOutputValidation = OperationHandlerOutputValidation;
49
+ class OperationHandlerOutputValidationErrorMessageConfiguration {
50
+ constructor(condition) {
51
+ this.condition = condition;
52
+ }
53
+ errorMessage(errorMessage) {
54
+ return new OperationHandlerOutputValidation(this.condition, errorMessage);
55
+ }
56
+ }
57
+ exports.OperationHandlerOutputValidationErrorMessageConfiguration = OperationHandlerOutputValidationErrorMessageConfiguration;
58
+ class OperationHandlerOutputValidationConditionConfiguration {
59
+ condition(condition) {
60
+ return new OperationHandlerOutputValidationErrorMessageConfiguration(condition);
61
+ }
62
+ }
63
+ exports.OperationHandlerOutputValidationConditionConfiguration = OperationHandlerOutputValidationConditionConfiguration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/cdk-dsl",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "CDK DSL Interface for building connectors",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"