@trayio/cdk-dsl 3.1.1-unstable → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connector/operation/OperationHandlerSetup.d.ts +1 -5
- package/dist/connector/operation/OperationHandlerSetup.d.ts.map +1 -1
- package/dist/connector/operation/OperationHandlerSetup.js +8 -13
- package/package.json +2 -2
- package/dist/connector/operation/GlobalHandler.d.ts +0 -15
- package/dist/connector/operation/GlobalHandler.d.ts.map +0 -1
- package/dist/connector/operation/GlobalHandler.js +0 -46
|
@@ -4,27 +4,23 @@ import { CompositeOperationHandler, CompositeOperationHandlerFunction } from './
|
|
|
4
4
|
import { HttpOperationHandler, HttpOperationHandlerSetup } from './HttpOperationHandler';
|
|
5
5
|
import { OperationHandlerValidation, OperationHandlerInputValidationSetup, OperationHandlerOutputValidationSetup } from './OperationHandlerValidation';
|
|
6
6
|
import { OperationHandlerAuth, OperationHandlerReference, TriggerOperationHttpResponse, TriggerRequestOperationInput, TriggerRequestOperationOutput, TriggerResponseOperationInput } from './OperationHandler';
|
|
7
|
-
import { HttpGlobalHandler } from './GlobalHandler';
|
|
8
7
|
export type OperationHandlerImplementation<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> = HttpOperationHandler<AUTH, IN, OUT> | CompositeOperationHandler<AUTH, IN, OUT>;
|
|
9
8
|
export declare class OperationHandler<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
10
9
|
readonly name: string;
|
|
11
10
|
readonly isPrivate: boolean;
|
|
12
11
|
readonly validation: O.Option<OperationHandlerValidation<AUTH, IN, OUT>>;
|
|
13
12
|
readonly implementation: OperationHandlerImplementation<AUTH, IN, OUT>;
|
|
14
|
-
|
|
15
|
-
constructor(name: string, isPrivate: boolean, validation: O.Option<OperationHandlerValidation<AUTH, IN, OUT>>, implementation: OperationHandlerImplementation<AUTH, IN, OUT>, globalHandler: O.Option<HttpGlobalHandler<AUTH>>);
|
|
13
|
+
constructor(name: string, isPrivate: boolean, validation: O.Option<OperationHandlerValidation<AUTH, IN, OUT>>, implementation: OperationHandlerImplementation<AUTH, IN, OUT>);
|
|
16
14
|
}
|
|
17
15
|
export declare class OperationHandlerConfiguration<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT> {
|
|
18
16
|
static withName<AUTH extends OperationHandlerAuth<unknown, unknown>, IN, OUT>(name: string): OperationHandlerConfiguration<AUTH, IN, OUT>;
|
|
19
17
|
private name;
|
|
20
18
|
private isPrivate;
|
|
21
19
|
private validation;
|
|
22
|
-
private globalHandler;
|
|
23
20
|
private constructor();
|
|
24
21
|
private(): OperationHandlerConfiguration<AUTH, IN, OUT>;
|
|
25
22
|
addInputValidation(inputValidationSetup: OperationHandlerInputValidationSetup<AUTH, IN>): OperationHandlerConfiguration<AUTH, IN, OUT>;
|
|
26
23
|
addOutputValidation(outputValidationSetup: OperationHandlerOutputValidationSetup<AUTH, IN, OUT>): OperationHandlerConfiguration<AUTH, IN, OUT>;
|
|
27
|
-
withGlobalHandler(globalHandler: HttpGlobalHandler<AUTH>): OperationHandlerConfiguration<AUTH, IN, OUT>;
|
|
28
24
|
usingHttp(httpSetup: HttpOperationHandlerSetup<AUTH, IN, OUT>): OperationHandler<AUTH, IN, OUT>;
|
|
29
25
|
usingComposite(compositeFunction: CompositeOperationHandlerFunction<AUTH, IN, OUT>): OperationHandler<AUTH, IN, OUT>;
|
|
30
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationHandlerSetup.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandlerSetup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EACN,aAAa,EAEb,MAAM,yCAAyC,CAAC;AAEjD,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,EACN,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"OperationHandlerSetup.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/OperationHandlerSetup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EACN,aAAa,EAEb,MAAM,yCAAyC,CAAC;AAEjD,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,EACN,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,8BAA8B,CACzC,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EACnD,EAAE,EACF,GAAG,IAED,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GACnC,yBAAyB,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;AAE5C,qBAAa,gBAAgB,CAC5B,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EACnD,EAAE,EACF,GAAG;IAEH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,CAAC,C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MAAM,CAAC;CACrB,CAAC;AAmBF,eAAO,MAAM,qBAAqB,EAAE,8BAwHnC,CAAC"}
|
|
@@ -33,48 +33,43 @@ const CompositeOperationHandler_1 = require("./CompositeOperationHandler");
|
|
|
33
33
|
const HttpOperationHandler_1 = require("./HttpOperationHandler");
|
|
34
34
|
const OperationHandlerValidation_1 = require("./OperationHandlerValidation");
|
|
35
35
|
class OperationHandler {
|
|
36
|
-
constructor(name, isPrivate, validation, implementation
|
|
36
|
+
constructor(name, isPrivate, validation, implementation) {
|
|
37
37
|
this.name = name;
|
|
38
38
|
this.isPrivate = isPrivate;
|
|
39
39
|
this.validation = validation;
|
|
40
|
-
this.globalHandler = globalHandler;
|
|
41
40
|
this.implementation = implementation;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
exports.OperationHandler = OperationHandler;
|
|
45
44
|
class OperationHandlerConfiguration {
|
|
46
45
|
static withName(name) {
|
|
47
|
-
return new OperationHandlerConfiguration(name, false, O.none
|
|
46
|
+
return new OperationHandlerConfiguration(name, false, O.none);
|
|
48
47
|
}
|
|
49
|
-
constructor(name, isPrivate, validation
|
|
48
|
+
constructor(name, isPrivate, validation) {
|
|
50
49
|
this.name = name;
|
|
51
50
|
this.isPrivate = isPrivate;
|
|
52
51
|
this.validation = validation;
|
|
53
|
-
this.globalHandler = globalHandler;
|
|
54
52
|
}
|
|
55
53
|
private() {
|
|
56
|
-
return new OperationHandlerConfiguration(this.name, true, this.validation
|
|
54
|
+
return new OperationHandlerConfiguration(this.name, true, this.validation);
|
|
57
55
|
}
|
|
58
56
|
addInputValidation(inputValidationSetup) {
|
|
59
57
|
const currentValidation = O.getOrElse(() => OperationHandlerValidation_1.OperationHandlerValidation.emptyValidation())(this.validation);
|
|
60
58
|
const inputValidation = inputValidationSetup(new OperationHandlerValidation_1.OperationHandlerInputValidationConditionConfiguration());
|
|
61
59
|
const newValidation = currentValidation.addInputValidation(inputValidation);
|
|
62
|
-
return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation)
|
|
60
|
+
return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation));
|
|
63
61
|
}
|
|
64
62
|
addOutputValidation(outputValidationSetup) {
|
|
65
63
|
const currentValidation = O.getOrElse(() => OperationHandlerValidation_1.OperationHandlerValidation.emptyValidation())(this.validation);
|
|
66
64
|
const outputValidation = outputValidationSetup(new OperationHandlerValidation_1.OperationHandlerOutputValidationConditionConfiguration());
|
|
67
65
|
const newValidation = currentValidation.addOutputValidation(outputValidation);
|
|
68
|
-
return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation)
|
|
69
|
-
}
|
|
70
|
-
withGlobalHandler(globalHandler) {
|
|
71
|
-
return new OperationHandlerConfiguration(this.name, this.isPrivate, this.validation, O.some(globalHandler));
|
|
66
|
+
return new OperationHandlerConfiguration(this.name, this.isPrivate, O.some(newValidation));
|
|
72
67
|
}
|
|
73
68
|
usingHttp(httpSetup) {
|
|
74
|
-
return new OperationHandler(this.name, this.isPrivate, this.validation, httpSetup(new HttpOperationHandler_1.HttpOperationHandlerConfiguration())
|
|
69
|
+
return new OperationHandler(this.name, this.isPrivate, this.validation, httpSetup(new HttpOperationHandler_1.HttpOperationHandlerConfiguration()));
|
|
75
70
|
}
|
|
76
71
|
usingComposite(compositeFunction) {
|
|
77
|
-
return new OperationHandler(this.name, this.isPrivate, this.validation, new CompositeOperationHandler_1.CompositeOperationHandler(compositeFunction)
|
|
72
|
+
return new OperationHandler(this.name, this.isPrivate, this.validation, new CompositeOperationHandler_1.CompositeOperationHandler(compositeFunction));
|
|
78
73
|
}
|
|
79
74
|
}
|
|
80
75
|
exports.OperationHandlerConfiguration = OperationHandlerConfiguration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/cdk-dsl",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A DSL for connector development",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@trayio/commons": "3.
|
|
17
|
+
"@trayio/commons": "3.2.0"
|
|
18
18
|
},
|
|
19
19
|
"typesVersions": {
|
|
20
20
|
"*": {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as O from 'fp-ts/Option';
|
|
2
|
-
import { HttpOperationRequest, HttpOperationRequestBuilder, HttpOperationRequestHandler, HttpOperationResponseHandler } from './HttpOperationHandler';
|
|
3
|
-
import { OperationHandlerAuth, OperationHandlerContext } from './OperationHandler';
|
|
4
|
-
type BeforeRequest<AUTH extends OperationHandlerAuth<unknown, unknown>> = (handler: HttpOperationRequestHandler<AUTH, any>, ctx: OperationHandlerContext<AUTH>, input: any, request: HttpOperationRequestBuilder) => HttpOperationRequest;
|
|
5
|
-
export declare class HttpGlobalHandler<AUTH extends OperationHandlerAuth<unknown, unknown>> {
|
|
6
|
-
beforeRequest: O.Option<BeforeRequest<AUTH>>;
|
|
7
|
-
private afterResponse;
|
|
8
|
-
private constructor();
|
|
9
|
-
private(): HttpGlobalHandler<AUTH>;
|
|
10
|
-
static create<AUTH extends OperationHandlerAuth<unknown, unknown>>(): HttpGlobalHandler<AUTH>;
|
|
11
|
-
withBeforeRequest(beforeRequest: BeforeRequest<AUTH>): HttpGlobalHandler<AUTH>;
|
|
12
|
-
withAfterResponse(afterResponse: HttpOperationResponseHandler<OperationHandlerAuth<unknown, unknown>, unknown, unknown>): HttpGlobalHandler<AUTH>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=GlobalHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalHandler.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/GlobalHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EACN,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,oBAAoB,EACpB,uBAAuB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,KAAK,aAAa,CAAC,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CACzE,OAAO,EAAE,2BAA2B,CAAC,IAAI,EAAE,GAAG,CAAC,EAC/C,GAAG,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAClC,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,2BAA2B,KAChC,oBAAoB,CAAC;AAE1B,qBAAa,iBAAiB,CAC7B,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC;IAEnD,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAE7C,OAAO,CAAC,aAAa,CAMnB;IAEF,OAAO;IAcP,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC;IAIlC,MAAM,CAAC,MAAM,CACZ,IAAI,SAAS,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,KAC/C,iBAAiB,CAAC,IAAI,CAAC;IAI5B,iBAAiB,CAChB,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,GAChC,iBAAiB,CAAC,IAAI,CAAC;IAI1B,iBAAiB,CAChB,aAAa,EAAE,4BAA4B,CAC1C,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EACtC,OAAO,EACP,OAAO,CACP,GACC,iBAAiB,CAAC,IAAI,CAAC;CAG1B"}
|
|
@@ -1,46 +0,0 @@
|
|
|
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.HttpGlobalHandler = void 0;
|
|
27
|
-
const O = __importStar(require("fp-ts/Option"));
|
|
28
|
-
class HttpGlobalHandler {
|
|
29
|
-
constructor(beforeRequest, afterResponse) {
|
|
30
|
-
this.beforeRequest = beforeRequest;
|
|
31
|
-
this.afterResponse = afterResponse;
|
|
32
|
-
}
|
|
33
|
-
private() {
|
|
34
|
-
return new HttpGlobalHandler(this.beforeRequest, this.afterResponse);
|
|
35
|
-
}
|
|
36
|
-
static create() {
|
|
37
|
-
return new HttpGlobalHandler(O.none, O.none);
|
|
38
|
-
}
|
|
39
|
-
withBeforeRequest(beforeRequest) {
|
|
40
|
-
return new HttpGlobalHandler(O.some(beforeRequest), O.none);
|
|
41
|
-
}
|
|
42
|
-
withAfterResponse(afterResponse) {
|
|
43
|
-
return new HttpGlobalHandler(O.none, O.some(afterResponse));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.HttpGlobalHandler = HttpGlobalHandler;
|