@api-client/core 0.9.4 → 0.9.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.
- package/build/browser.d.ts +14 -3
- package/build/browser.js +16 -2
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +15 -4
- package/build/index.js +17 -3
- package/build/index.js.map +1 -1
- package/build/src/data/{JmesparthReader.d.ts → JmespathReader.d.ts} +1 -1
- package/build/src/data/{JmesparthReader.js → JmespathReader.js} +2 -2
- package/build/src/data/JmespathReader.js.map +1 -0
- package/build/src/data/RequestDataExtractor.d.ts +5 -5
- package/build/src/data/RequestDataExtractor.js.map +1 -1
- package/build/src/data/XmlReader.js +14 -1
- package/build/src/data/XmlReader.js.map +1 -1
- package/build/src/events/BaseEvents.d.ts +25 -0
- package/build/src/events/Events.d.ts +1 -1
- package/build/src/events/transport/TransportEvents.d.ts +1 -1
- package/build/src/events/transport/TransportEvents.js.map +1 -1
- package/build/src/models/ClientCertificate.d.ts +9 -0
- package/build/src/models/ClientCertificate.js.map +1 -1
- package/build/src/models/Environment.d.ts +3 -2
- package/build/src/models/Environment.js +11 -6
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/ErrorResponse.js.map +1 -1
- package/build/src/models/HttpRequest.d.ts +2 -7
- package/build/src/models/HttpRequest.js +1 -6
- package/build/src/models/HttpRequest.js.map +1 -1
- package/build/src/models/HttpResponse.d.ts +2 -7
- package/build/src/models/HttpResponse.js +1 -3
- package/build/src/models/HttpResponse.js.map +1 -1
- package/build/src/models/ProjectExecution.d.ts +115 -0
- package/build/src/models/ProjectExecution.js +148 -0
- package/build/src/models/ProjectExecution.js.map +1 -0
- package/build/src/models/ProjectRequest.d.ts +19 -0
- package/build/src/models/ProjectRequest.js +50 -0
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/Request.d.ts +12 -3
- package/build/src/models/Request.js +14 -1
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/RequestAuthorization.js.map +1 -1
- package/build/src/models/RequestLog.d.ts +11 -0
- package/build/src/models/RequestLog.js +15 -1
- package/build/src/models/RequestLog.js.map +1 -1
- package/build/src/models/SerializablePayload.d.ts +6 -1
- package/build/src/models/SerializablePayload.js +10 -6
- package/build/src/models/SerializablePayload.js.map +1 -1
- package/build/src/models/http-actions/AssertionError.d.ts +36 -0
- package/build/src/models/http-actions/AssertionError.js +35 -0
- package/build/src/models/http-actions/AssertionError.js.map +1 -0
- package/build/src/models/http-actions/HttpAssertion.d.ts +84 -0
- package/build/src/models/http-actions/HttpAssertion.js +52 -0
- package/build/src/models/http-actions/HttpAssertion.js.map +1 -0
- package/build/src/models/http-actions/HttpFlows.d.ts +109 -0
- package/build/src/models/http-actions/HttpFlows.js +31 -0
- package/build/src/models/http-actions/HttpFlows.js.map +1 -0
- package/build/src/models/http-actions/HttpStep.d.ts +29 -0
- package/build/src/models/http-actions/HttpStep.js +30 -0
- package/build/src/models/http-actions/HttpStep.js.map +1 -0
- package/build/src/models/http-actions/LegacyTranslator.d.ts +8 -7
- package/build/src/models/http-actions/LegacyTranslator.js +18 -13
- package/build/src/models/http-actions/LegacyTranslator.js.map +1 -1
- package/build/src/models/http-actions/steps/assertion/EqualAssertion.d.ts +76 -0
- package/build/src/models/http-actions/steps/assertion/EqualAssertion.js +79 -0
- package/build/src/models/http-actions/steps/assertion/EqualAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.d.ts +36 -0
- package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.js +59 -0
- package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/IncludesAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/IncludesAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/IncludesAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/LessThanAssertion.d.ts +36 -0
- package/build/src/models/http-actions/steps/assertion/LessThanAssertion.js +59 -0
- package/build/src/models/http-actions/steps/assertion/LessThanAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/MatchesAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/MatchesAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/MatchesAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.d.ts +36 -0
- package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.js +59 -0
- package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.d.ts +76 -0
- package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.js +79 -0
- package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotOkAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/NotOkAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/NotOkAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.d.ts +29 -0
- package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/OkAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/OkAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/OkAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/ToBeAssertion.d.ts +35 -0
- package/build/src/models/http-actions/steps/assertion/ToBeAssertion.js +53 -0
- package/build/src/models/http-actions/steps/assertion/ToBeAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/index.d.ts +15 -0
- package/build/src/models/http-actions/steps/assertion/index.js +16 -0
- package/build/src/models/http-actions/steps/assertion/index.js.map +1 -0
- package/build/src/models/http-actions/steps/data/DeleteCookieStep.d.ts +44 -0
- package/build/src/models/http-actions/steps/data/DeleteCookieStep.js +67 -0
- package/build/src/models/http-actions/steps/data/DeleteCookieStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/ReadDataSourceStep.d.ts +53 -0
- package/build/src/models/http-actions/steps/data/ReadDataSourceStep.js +60 -0
- package/build/src/models/http-actions/steps/data/ReadDataSourceStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/ReadDataStep.d.ts +67 -0
- package/build/src/models/http-actions/steps/data/ReadDataStep.js +77 -0
- package/build/src/models/http-actions/steps/data/ReadDataStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/ReadValueStep.d.ts +45 -0
- package/build/src/models/http-actions/steps/data/ReadValueStep.js +52 -0
- package/build/src/models/http-actions/steps/data/ReadValueStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/SetCookieStep.d.ts +100 -0
- package/build/src/models/http-actions/steps/data/SetCookieStep.js +138 -0
- package/build/src/models/http-actions/steps/data/SetCookieStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/SetDataStep.d.ts +77 -0
- package/build/src/models/http-actions/steps/data/SetDataStep.js +69 -0
- package/build/src/models/http-actions/steps/data/SetDataStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/SetVariableStep.d.ts +40 -0
- package/build/src/models/http-actions/steps/data/SetVariableStep.js +44 -0
- package/build/src/models/http-actions/steps/data/SetVariableStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/index.d.ts +7 -0
- package/build/src/models/http-actions/steps/data/index.js +8 -0
- package/build/src/models/http-actions/steps/data/index.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.d.ts +18 -0
- package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.js +29 -0
- package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/AsNumberStep.d.ts +18 -0
- package/build/src/models/http-actions/steps/transformation/AsNumberStep.js +29 -0
- package/build/src/models/http-actions/steps/transformation/AsNumberStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.d.ts +18 -0
- package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.js +29 -0
- package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/RoundStep.d.ts +43 -0
- package/build/src/models/http-actions/steps/transformation/RoundStep.js +52 -0
- package/build/src/models/http-actions/steps/transformation/RoundStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/SubstringStep.d.ts +38 -0
- package/build/src/models/http-actions/steps/transformation/SubstringStep.js +65 -0
- package/build/src/models/http-actions/steps/transformation/SubstringStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/TrimStep.d.ts +20 -0
- package/build/src/models/http-actions/steps/transformation/TrimStep.js +30 -0
- package/build/src/models/http-actions/steps/transformation/TrimStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/index.d.ts +6 -0
- package/build/src/models/http-actions/steps/transformation/index.js +7 -0
- package/build/src/models/http-actions/steps/transformation/index.js.map +1 -0
- package/build/src/proxy/HttpProjectProxy.d.ts +1 -1
- package/build/src/proxy/Proxy.d.ts +1 -1
- package/build/src/proxy/ProxyService.d.ts +1 -1
- package/build/src/proxy/RequestProxy.d.ts +7 -2
- package/build/src/proxy/RequestProxy.js +4 -1
- package/build/src/proxy/RequestProxy.js.map +1 -1
- package/build/src/runtime/http-runner/ConditionCheck.d.ts +10 -10
- package/build/src/runtime/http-runner/ConditionCheck.js.map +1 -1
- package/build/src/runtime/http-runner/HttpAssertionRunner.d.ts +75 -0
- package/build/src/runtime/http-runner/HttpAssertionRunner.js +538 -0
- package/build/src/runtime/http-runner/HttpAssertionRunner.js.map +1 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.d.ts +11 -6
- package/build/src/runtime/http-runner/HttpFlowRunner.js +24 -15
- package/build/src/runtime/http-runner/HttpFlowRunner.js.map +1 -1
- package/build/src/runtime/http-runner/HttpRequestRunner.d.ts +14 -3
- package/build/src/runtime/http-runner/HttpRequestRunner.js +44 -0
- package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -1
- package/build/src/runtime/node/BaseRunner.d.ts +1 -1
- package/build/src/runtime/node/ProjectParallelRunner.d.ts +2 -2
- package/build/src/runtime/node/ProjectParallelRunner.js +2 -2
- package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.js +6 -2
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts +1 -1
- package/build/src/runtime/node/ProjectSerialRunner.d.ts +1 -1
- package/build/src/runtime/reporters/Reporter.d.ts +1 -33
- package/build/src/runtime/reporters/Reporter.js.map +1 -1
- package/build/src/runtime/store/interfaces/ApiClientStore.d.ts +2 -0
- package/build/src/runtime/store/interfaces/ProjectRuns.d.ts +56 -0
- package/build/src/runtime/store/interfaces/ProjectRuns.js +2 -0
- package/build/src/runtime/store/interfaces/ProjectRuns.js.map +1 -0
- package/package.json +3 -2
- package/src/data/{JmesparthReader.ts → JmespathReader.ts} +2 -2
- package/src/data/RequestDataExtractor.ts +5 -5
- package/src/data/XmlReader.ts +16 -2
- package/src/events/BaseEvents.ts +30 -0
- package/src/events/transport/TransportEvents.ts +1 -1
- package/src/models/ClientCertificate.ts +9 -0
- package/src/models/Environment.ts +11 -7
- package/src/models/ErrorResponse.ts +1 -1
- package/src/models/HttpRequest.ts +4 -14
- package/src/models/HttpResponse.ts +5 -11
- package/src/models/ProjectExecution.ts +227 -0
- package/src/models/ProjectRequest.ts +54 -0
- package/src/models/Request.ts +23 -4
- package/src/models/RequestAuthorization.ts +1 -1
- package/src/models/RequestLog.ts +21 -1
- package/src/models/SerializablePayload.ts +18 -1
- package/src/models/http-actions/AssertionError.ts +57 -0
- package/src/models/http-actions/HttpAssertion.ts +89 -0
- package/src/models/http-actions/HttpFlows.ts +115 -0
- package/src/models/http-actions/HttpStep.ts +50 -0
- package/src/models/http-actions/LegacyTranslator.ts +42 -30
- package/src/models/http-actions/steps/assertion/EqualAssertion.ts +130 -0
- package/src/models/http-actions/steps/assertion/GreaterThanAssertion.ts +87 -0
- package/src/models/http-actions/steps/assertion/IncludesAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/IsEmptyAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/LengthOfAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/LessThanAssertion.ts +87 -0
- package/src/models/http-actions/steps/assertion/MatchesAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.ts +85 -0
- package/src/models/http-actions/steps/assertion/NotEqualAssertion.ts +130 -0
- package/src/models/http-actions/steps/assertion/NotIncludesAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/NotOkAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/NotToBeAssertion.ts +69 -0
- package/src/models/http-actions/steps/assertion/OkAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/ToBeAssertion.ts +76 -0
- package/src/models/http-actions/steps/data/DeleteCookieStep.ts +102 -0
- package/src/models/http-actions/steps/data/ReadDataSourceStep.ts +103 -0
- package/src/models/http-actions/steps/data/ReadDataStep.ts +128 -0
- package/src/models/http-actions/steps/data/ReadValueStep.ts +88 -0
- package/src/models/http-actions/steps/data/SetCookieStep.ts +206 -0
- package/src/models/http-actions/steps/data/SetDataStep.ts +124 -0
- package/src/models/http-actions/steps/data/SetVariableStep.ts +82 -0
- package/src/models/http-actions/steps/transformation/AsLowerCaseStep.ts +41 -0
- package/src/models/http-actions/steps/transformation/AsNumberStep.ts +41 -0
- package/src/models/http-actions/steps/transformation/AsUpperCaseStep.ts +41 -0
- package/src/models/http-actions/steps/transformation/RoundStep.ts +86 -0
- package/src/models/http-actions/steps/transformation/SubstringStep.ts +93 -0
- package/src/models/http-actions/steps/transformation/TrimStep.ts +43 -0
- package/src/proxy/HttpProjectProxy.ts +1 -1
- package/src/proxy/Proxy.ts +1 -1
- package/src/proxy/ProxyService.ts +1 -1
- package/src/proxy/RequestProxy.ts +11 -3
- package/src/runtime/http-runner/ConditionCheck.ts +13 -14
- package/src/runtime/http-runner/HttpAssertionRunner.ts +540 -0
- package/src/runtime/http-runner/HttpFlowRunner.ts +33 -19
- package/src/runtime/http-runner/HttpRequestRunner.ts +53 -5
- package/src/runtime/node/BaseRunner.ts +1 -1
- package/src/runtime/node/ProjectParallelRunner.ts +5 -5
- package/src/runtime/node/ProjectRequestRunner.ts +6 -2
- package/src/runtime/node/ProjectRunner.ts +1 -1
- package/src/runtime/node/ProjectRunnerWorker.ts +1 -1
- package/src/runtime/node/ProjectSerialRunner.ts +1 -1
- package/src/runtime/reporters/Reporter.ts +1 -35
- package/src/runtime/store/interfaces/ApiClientStore.ts +3 -0
- package/src/runtime/store/interfaces/ProjectRuns.ts +64 -0
- package/build/src/data/JmesparthReader.js.map +0 -1
- package/build/src/models/http-actions/HttpActions.d.ts +0 -256
- package/build/src/models/http-actions/HttpActions.js +0 -46
- package/build/src/models/http-actions/HttpActions.js.map +0 -1
- package/src/models/http-actions/HttpActions.ts +0 -270
package/src/models/Request.ts
CHANGED
|
@@ -13,7 +13,8 @@ import { ARCSavedRequest, ARCHistoryRequest } from './legacy/request/ArcRequest.
|
|
|
13
13
|
import { ErrorResponse as LegacyErrorResponse, Response as LegacyResponse } from './legacy/request/ArcResponse.js';
|
|
14
14
|
import { PayloadSerializer } from '../lib/transformers/PayloadSerializer.js';
|
|
15
15
|
import { Normalizer } from './legacy/Normalizer.js';
|
|
16
|
-
import {
|
|
16
|
+
import { IHttpFlow } from './http-actions/HttpFlows.js';
|
|
17
|
+
import { IHttpAssertion } from './http-actions/HttpAssertion.js';
|
|
17
18
|
import { LegacyTranslator } from './http-actions/LegacyTranslator.js';
|
|
18
19
|
|
|
19
20
|
export const Kind = 'Core#Request';
|
|
@@ -63,7 +64,7 @@ export interface IRequest {
|
|
|
63
64
|
* Http action flows.
|
|
64
65
|
* In ARC this was "actions",
|
|
65
66
|
*/
|
|
66
|
-
flows?:
|
|
67
|
+
flows?: IHttpFlow[];
|
|
67
68
|
/**
|
|
68
69
|
* The certificate to use with the request.
|
|
69
70
|
* Note, the certificate defined on the certificate authorization
|
|
@@ -71,6 +72,11 @@ export interface IRequest {
|
|
|
71
72
|
* this certificate and update the configuration.
|
|
72
73
|
*/
|
|
73
74
|
clientCertificate?: HttpCertificate;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The list of assertions (tests) to perform after the response is ready.
|
|
78
|
+
*/
|
|
79
|
+
assertions?: IHttpAssertion[];
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
export class Request {
|
|
@@ -102,7 +108,7 @@ export class Request {
|
|
|
102
108
|
* Http action flows.
|
|
103
109
|
* In ARC this was "actions",
|
|
104
110
|
*/
|
|
105
|
-
flows?:
|
|
111
|
+
flows?: IHttpFlow[];
|
|
106
112
|
/**
|
|
107
113
|
* The certificate to use with the request.
|
|
108
114
|
* Note, the certificate defined on the certificate authorization
|
|
@@ -111,6 +117,11 @@ export class Request {
|
|
|
111
117
|
*/
|
|
112
118
|
clientCertificate?: Certificate;
|
|
113
119
|
|
|
120
|
+
/**
|
|
121
|
+
* The list of assertions (tests) to perform after the response is ready.
|
|
122
|
+
*/
|
|
123
|
+
assertions?: IHttpAssertion[];
|
|
124
|
+
|
|
114
125
|
/**
|
|
115
126
|
* Creates a request from an URL.
|
|
116
127
|
*
|
|
@@ -340,7 +351,7 @@ export class Request {
|
|
|
340
351
|
}
|
|
341
352
|
|
|
342
353
|
new(init: IRequest): void {
|
|
343
|
-
const { expects, log, updated, created = Date.now(), midnight, config, authorization, flows, clientCertificate, info } = init;
|
|
354
|
+
const { expects, log, updated, created = Date.now(), midnight, config, authorization, flows, clientCertificate, info, assertions } = init;
|
|
344
355
|
if (expects) {
|
|
345
356
|
this.expects = new HttpRequest(expects);
|
|
346
357
|
} else {
|
|
@@ -383,6 +394,11 @@ export class Request {
|
|
|
383
394
|
} else {
|
|
384
395
|
this.flows = undefined;
|
|
385
396
|
}
|
|
397
|
+
if (Array.isArray(assertions)) {
|
|
398
|
+
this.assertions = assertions.map(i => JsonCore.clone(i));
|
|
399
|
+
} else {
|
|
400
|
+
this.assertions = undefined;
|
|
401
|
+
}
|
|
386
402
|
if (clientCertificate) {
|
|
387
403
|
this.clientCertificate = new Certificate(clientCertificate);
|
|
388
404
|
} else {
|
|
@@ -411,6 +427,9 @@ export class Request {
|
|
|
411
427
|
if (Array.isArray(this.flows)) {
|
|
412
428
|
result.flows = this.flows.map(i => JsonCore.clone(i))
|
|
413
429
|
}
|
|
430
|
+
if (Array.isArray(this.assertions)) {
|
|
431
|
+
result.assertions = this.assertions.map(i => JsonCore.clone(i))
|
|
432
|
+
}
|
|
414
433
|
if (this.clientCertificate) {
|
|
415
434
|
result.clientCertificate = this.clientCertificate.toJSON();
|
|
416
435
|
}
|
|
@@ -64,7 +64,7 @@ export class RequestAuthorization {
|
|
|
64
64
|
}
|
|
65
65
|
return new RequestAuthorization({
|
|
66
66
|
kind: Kind,
|
|
67
|
-
config:
|
|
67
|
+
config: info.config as IAuthorizationSettingsUnion,
|
|
68
68
|
enabled: true,
|
|
69
69
|
type: info.type as AuthorizationType,
|
|
70
70
|
valid: info.valid,
|
package/src/models/RequestLog.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { IErrorResponse, ErrorResponse } from './ErrorResponse.js';
|
|
|
4
4
|
import { IResponse, Response } from './Response.js';
|
|
5
5
|
import { IRequestsSize, RequestsSize } from './RequestsSize.js';
|
|
6
6
|
import { ResponseRedirect as LegacyRedirect } from './legacy/request/ArcResponse.js';
|
|
7
|
+
import { AssertionResult } from './http-actions/HttpAssertion.js';
|
|
7
8
|
|
|
8
9
|
export const Kind = 'Core#ResponseLog';
|
|
9
10
|
|
|
@@ -32,6 +33,11 @@ export interface IRequestLog {
|
|
|
32
33
|
* Optional request ID defined on an HTTP project that triggered this log.
|
|
33
34
|
*/
|
|
34
35
|
requestId?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The assertions result performed on the response.
|
|
38
|
+
* Note, Error response can also be passed through tests.
|
|
39
|
+
*/
|
|
40
|
+
assertions?: AssertionResult[];
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
/**
|
|
@@ -60,6 +66,12 @@ export class RequestLog {
|
|
|
60
66
|
*/
|
|
61
67
|
requestId?: string;
|
|
62
68
|
|
|
69
|
+
/**
|
|
70
|
+
* The assertions result performed on the response.
|
|
71
|
+
* Note, Error response can also be passed through tests.
|
|
72
|
+
*/
|
|
73
|
+
assertions?: AssertionResult[];
|
|
74
|
+
|
|
63
75
|
static fromRequest(request: ISentRequest): RequestLog {
|
|
64
76
|
return new RequestLog({
|
|
65
77
|
kind: Kind,
|
|
@@ -96,7 +108,7 @@ export class RequestLog {
|
|
|
96
108
|
* Creates a new response clearing anything that is so far defined.
|
|
97
109
|
*/
|
|
98
110
|
new(init: IRequestLog): void {
|
|
99
|
-
const { request, response, redirects, size, requestId } = init;
|
|
111
|
+
const { request, response, redirects, size, requestId, assertions } = init;
|
|
100
112
|
this.kind = Kind;
|
|
101
113
|
if (request) {
|
|
102
114
|
this.request = new SentRequest(request);
|
|
@@ -125,6 +137,11 @@ export class RequestLog {
|
|
|
125
137
|
} else {
|
|
126
138
|
this.requestId = undefined;
|
|
127
139
|
}
|
|
140
|
+
if (Array.isArray(assertions) && assertions.length) {
|
|
141
|
+
this.assertions = assertions.map(i => ({ ...i }));
|
|
142
|
+
} else {
|
|
143
|
+
this.assertions = undefined;
|
|
144
|
+
}
|
|
128
145
|
}
|
|
129
146
|
|
|
130
147
|
toJSON(): IRequestLog {
|
|
@@ -146,6 +163,9 @@ export class RequestLog {
|
|
|
146
163
|
if (this.requestId) {
|
|
147
164
|
result.requestId = this.requestId;
|
|
148
165
|
}
|
|
166
|
+
if (Array.isArray(this.assertions) && this.assertions.length) {
|
|
167
|
+
result.assertions = this.assertions.map(i => ({ ...i }));
|
|
168
|
+
}
|
|
149
169
|
return result;
|
|
150
170
|
}
|
|
151
171
|
|
|
@@ -14,7 +14,7 @@ export interface SerializablePayloadOptions {
|
|
|
14
14
|
mime?: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
17
|
+
export interface ISerializablePayload {
|
|
18
18
|
/**
|
|
19
19
|
* The serialized payload message.
|
|
20
20
|
*/
|
|
@@ -24,6 +24,12 @@ export class SerializablePayload {
|
|
|
24
24
|
* Optional meta of the payload
|
|
25
25
|
*/
|
|
26
26
|
payloadOptions?: SerializablePayloadOptions;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class SerializablePayload implements ISerializablePayload {
|
|
30
|
+
payload?: Payload;
|
|
31
|
+
|
|
32
|
+
payloadOptions?: SerializablePayloadOptions;
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
35
|
* The payload in its original format.
|
|
@@ -90,4 +96,15 @@ export class SerializablePayload {
|
|
|
90
96
|
const decoder = new TextDecoder();
|
|
91
97
|
return decoder.decode(dataView);
|
|
92
98
|
}
|
|
99
|
+
|
|
100
|
+
toJSON(): ISerializablePayload {
|
|
101
|
+
const result: ISerializablePayload = {};
|
|
102
|
+
if (this.payload) {
|
|
103
|
+
result.payload = this.payload;
|
|
104
|
+
}
|
|
105
|
+
if (this.payloadOptions) {
|
|
106
|
+
result.payloadOptions = { ...this.payloadOptions };
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
93
110
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface IAssertionError {
|
|
2
|
+
/**
|
|
3
|
+
* Set with assertions to show the actual value at the time of testing.
|
|
4
|
+
*/
|
|
5
|
+
actual?: unknown;
|
|
6
|
+
/**
|
|
7
|
+
* Set with assertions to show the expected value at the time of testing.
|
|
8
|
+
*/
|
|
9
|
+
expected?: unknown;
|
|
10
|
+
/**
|
|
11
|
+
* The operator used to make the assertion.
|
|
12
|
+
*/
|
|
13
|
+
operator?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The error message, if any.
|
|
16
|
+
* Assertions usually don't set error messages. Instead they set other fields.
|
|
17
|
+
*/
|
|
18
|
+
message?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class AssertionError extends Error {
|
|
22
|
+
/**
|
|
23
|
+
* Set with assertions to show the actual value at the time of testing.
|
|
24
|
+
*/
|
|
25
|
+
actual: unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Set with assertions to show the expected value at the time of testing.
|
|
28
|
+
*/
|
|
29
|
+
expected: unknown;
|
|
30
|
+
/**
|
|
31
|
+
* The operator used to make the assertion.
|
|
32
|
+
*/
|
|
33
|
+
operator: string;
|
|
34
|
+
|
|
35
|
+
code = 'ERR_ASSERTION';
|
|
36
|
+
|
|
37
|
+
constructor(options: IAssertionError = {}) {
|
|
38
|
+
super(options.message || 'Unspecified AssertionError');
|
|
39
|
+
this.name = 'AssertionError';
|
|
40
|
+
this.actual = options.actual;
|
|
41
|
+
this.expected = options.expected;
|
|
42
|
+
this.operator = options.operator || '[unknown]';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
toJSON(): IAssertionError {
|
|
46
|
+
const result: IAssertionError = {};
|
|
47
|
+
if (this.message) {
|
|
48
|
+
result.message = this.message;
|
|
49
|
+
}
|
|
50
|
+
result.actual = this.actual;
|
|
51
|
+
result.expected = this.expected;
|
|
52
|
+
if (this.operator) {
|
|
53
|
+
result.operator = this.operator;
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { IAssertionError } from "./AssertionError.js";
|
|
2
|
+
import { IHttpStep } from "./HttpStep.js";
|
|
3
|
+
|
|
4
|
+
export enum AssertionEnum {
|
|
5
|
+
equal = "equal",
|
|
6
|
+
notEqual = "not-equal",
|
|
7
|
+
greaterThan = "greater-than",
|
|
8
|
+
greaterThanEqual = "greater-than-equal",
|
|
9
|
+
lessThan = "less-than",
|
|
10
|
+
lessThanEqual = "less-than-equal",
|
|
11
|
+
contains = "contains",
|
|
12
|
+
regex = "regex",
|
|
13
|
+
ok = 'ok',
|
|
14
|
+
notOk = 'notOk',
|
|
15
|
+
toBe = 'toBe',
|
|
16
|
+
notToBe = 'notToBe',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum TransformationEnum {
|
|
20
|
+
/**
|
|
21
|
+
* Transformation of the data that reads a value from the given path.
|
|
22
|
+
* For example, for a body it can be xpath for XML or JSON path for JSON data.
|
|
23
|
+
*/
|
|
24
|
+
readValue = 'readValue',
|
|
25
|
+
/**
|
|
26
|
+
* Transforms the value from the previous step to a number.
|
|
27
|
+
*/
|
|
28
|
+
asNumber = 'asNumber',
|
|
29
|
+
/**
|
|
30
|
+
* Rounds the input value to a nearest numeric value.
|
|
31
|
+
* If the value is not a number it tries to convert it to a number. When it
|
|
32
|
+
* can't ba casted to a number then the transformation throws an error.
|
|
33
|
+
*/
|
|
34
|
+
round = 'round',
|
|
35
|
+
/**
|
|
36
|
+
* Transforms the value to a lowercase value.
|
|
37
|
+
*/
|
|
38
|
+
toLowerCase = 'toLowerCase',
|
|
39
|
+
/**
|
|
40
|
+
* Transforms the value to a uppercase value.
|
|
41
|
+
*/
|
|
42
|
+
toUpperCase = 'toUpperCase',
|
|
43
|
+
/**
|
|
44
|
+
* Trims the string value.
|
|
45
|
+
*/
|
|
46
|
+
trim = 'trim',
|
|
47
|
+
/**
|
|
48
|
+
* Transforms the part of the string from the start index up to and excluding the end index, or to the end of the string if no end index is supplied.
|
|
49
|
+
*
|
|
50
|
+
* `substring(indexStart, indexEnd)`
|
|
51
|
+
*/
|
|
52
|
+
substring = 'substring',
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface IHttpAssertion {
|
|
56
|
+
/**
|
|
57
|
+
* The description of the assertion reported to the UI.
|
|
58
|
+
*/
|
|
59
|
+
description?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The list of steps to perform. This is an ordered list of action tasks.
|
|
63
|
+
* Each step is described by the `kind` property which tells the runner what action to perform.
|
|
64
|
+
*/
|
|
65
|
+
steps: IHttpStep[];
|
|
66
|
+
/**
|
|
67
|
+
* Whether the assertions is enabled. By default it is enabled. It is only not enabled when this is set to false.
|
|
68
|
+
*/
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* An object representing a result of running a single assertion.
|
|
74
|
+
*/
|
|
75
|
+
export interface AssertionResult {
|
|
76
|
+
/**
|
|
77
|
+
* Indicates whether assertion result is positive (not failed) or negative (failed).
|
|
78
|
+
*/
|
|
79
|
+
ok: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The description of the association.
|
|
82
|
+
*/
|
|
83
|
+
description: string;
|
|
84
|
+
/**
|
|
85
|
+
* This is always set when `ok` is false.
|
|
86
|
+
* This is also never set when `ok` is true.
|
|
87
|
+
*/
|
|
88
|
+
error?: IAssertionError;
|
|
89
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AssertionEnum } from './HttpAssertion.js';
|
|
2
|
+
import { IHttpStep } from './HttpStep.js';
|
|
3
|
+
|
|
4
|
+
export enum FlowSourceEnum {
|
|
5
|
+
/**
|
|
6
|
+
* The request object.
|
|
7
|
+
*/
|
|
8
|
+
request = 'request',
|
|
9
|
+
/**
|
|
10
|
+
* The response object.
|
|
11
|
+
*/
|
|
12
|
+
response = 'response',
|
|
13
|
+
/**
|
|
14
|
+
* A variable from the current environment.
|
|
15
|
+
*/
|
|
16
|
+
variable = 'variable',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum FlowRequestDataEnum {
|
|
20
|
+
url = "url",
|
|
21
|
+
method = "method",
|
|
22
|
+
headers = "headers",
|
|
23
|
+
body = "body"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export enum FlowResponseDataEnum {
|
|
27
|
+
url = "url",
|
|
28
|
+
status = "status",
|
|
29
|
+
statusText = "statusText",
|
|
30
|
+
headers = "headers",
|
|
31
|
+
body = "body"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A flow represents a series of actions to be performed one-by-one after the HTTP request is sent or when the response
|
|
36
|
+
* is ready.
|
|
37
|
+
*/
|
|
38
|
+
export interface IHttpFlow {
|
|
39
|
+
/**
|
|
40
|
+
* The description of the flow
|
|
41
|
+
*/
|
|
42
|
+
description?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Describes when the flow is executed.
|
|
45
|
+
* The `request` means the flow is executed before the request is sent to the HTTP engine.
|
|
46
|
+
* The `response` means the flow is executed after the response has been received in full, but before reporting
|
|
47
|
+
* the response to the UI.
|
|
48
|
+
*/
|
|
49
|
+
trigger: 'request' | 'response';
|
|
50
|
+
/**
|
|
51
|
+
* The ordered list of actions to execute.
|
|
52
|
+
*/
|
|
53
|
+
actions: IHttpAction[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Describes a single action in a flow.
|
|
58
|
+
* An action can have a condition that is checked against the current context.
|
|
59
|
+
* Action is not executed when the condition is not meet.
|
|
60
|
+
*
|
|
61
|
+
* Each action has one or more steps (when 0 items then the action is ignored). Each step performs a task.
|
|
62
|
+
* The result of a task is passed to the next step as an input. The result of a task may be `void`, `null`, or `undefined` which is treated as `void`.
|
|
63
|
+
*/
|
|
64
|
+
export interface IHttpAction {
|
|
65
|
+
/**
|
|
66
|
+
* The description of the action
|
|
67
|
+
*/
|
|
68
|
+
description?: string;
|
|
69
|
+
/**
|
|
70
|
+
* A condition to check before performing the action.
|
|
71
|
+
*/
|
|
72
|
+
condition?: IHttpCondition;
|
|
73
|
+
/**
|
|
74
|
+
* The list of steps to perform. This is an ordered list of action tasks.
|
|
75
|
+
* Each step is described by the `kind` property which tells the runner what action to perform.
|
|
76
|
+
*/
|
|
77
|
+
steps: IHttpStep[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A condition to execute for an action.
|
|
82
|
+
*/
|
|
83
|
+
export interface IHttpCondition {
|
|
84
|
+
/**
|
|
85
|
+
* The main data source.
|
|
86
|
+
* In the legacy actions this was `type`.
|
|
87
|
+
*/
|
|
88
|
+
source?: FlowSourceEnum;
|
|
89
|
+
/**
|
|
90
|
+
* Source of the data.
|
|
91
|
+
* In the legacy actions this was `source`.
|
|
92
|
+
* This is not required when the source is not `request` or `response`.
|
|
93
|
+
*/
|
|
94
|
+
data?: FlowRequestDataEnum | FlowResponseDataEnum;
|
|
95
|
+
/**
|
|
96
|
+
* The path to the data.
|
|
97
|
+
* For JSON value use https://jmespath.org/ syntax.
|
|
98
|
+
* For XML use xpath.
|
|
99
|
+
* For any other use a simple path to the data separated by dot (e.g. headers.content-type)
|
|
100
|
+
*/
|
|
101
|
+
path?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The comparison operator.
|
|
104
|
+
*/
|
|
105
|
+
operator?: AssertionEnum;
|
|
106
|
+
/**
|
|
107
|
+
* The value to compare the read result.
|
|
108
|
+
* In runtime, the type is casted to the same type as read value.
|
|
109
|
+
*
|
|
110
|
+
* When this is not set it compares to an empty string value or `0`.
|
|
111
|
+
*
|
|
112
|
+
* In ARC actions this was the `predictedValue`.
|
|
113
|
+
*/
|
|
114
|
+
value?: string;
|
|
115
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The action that can be taken on the data.
|
|
3
|
+
*/
|
|
4
|
+
export interface IHttpStep {
|
|
5
|
+
/**
|
|
6
|
+
* The kind of the action to perform.
|
|
7
|
+
*/
|
|
8
|
+
kind: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the step is disabled in the flow.
|
|
11
|
+
*/
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export abstract class HttpStep {
|
|
16
|
+
/**
|
|
17
|
+
* The kind of the action to perform.
|
|
18
|
+
*/
|
|
19
|
+
kind = '';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether the step is disabled in the flow.
|
|
23
|
+
*/
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
|
|
26
|
+
new(init: IHttpStep): void {
|
|
27
|
+
const { kind, enabled } = init;
|
|
28
|
+
this.kind = kind;
|
|
29
|
+
if (typeof enabled === 'boolean') {
|
|
30
|
+
this.enabled = enabled
|
|
31
|
+
} else {
|
|
32
|
+
this.enabled = undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
toJSON(): IHttpStep {
|
|
37
|
+
const result: IHttpStep = {
|
|
38
|
+
kind: this.kind,
|
|
39
|
+
}
|
|
40
|
+
if (typeof this.enabled === 'boolean') {
|
|
41
|
+
result.enabled = this.enabled;
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A function that returns true when the step is valid and can be executed.
|
|
48
|
+
*/
|
|
49
|
+
abstract checkValidity(): boolean;
|
|
50
|
+
}
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { RequestActions as LegacyRequestActions } from '../../models/legacy/request/ArcRequest.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
RunnableAction as LegacyRunnable, Condition as LegacyCondition, Action as LegacyAction,
|
|
4
|
+
SetCookieConfig, SetVariableConfig, DeleteCookieConfig, DataSourceConfiguration
|
|
5
|
+
} from '../../models/legacy/actions/Actions.js';
|
|
6
|
+
import {
|
|
7
|
+
IHttpFlow, IHttpAction, IHttpCondition, FlowSourceEnum, FlowRequestDataEnum,
|
|
8
|
+
FlowResponseDataEnum,
|
|
9
|
+
} from './HttpFlows.js';
|
|
4
10
|
import { AmfNamespace } from '../../amf/definitions/Namespace.js';
|
|
11
|
+
import { AssertionEnum } from './HttpAssertion.js';
|
|
12
|
+
import { IHttpStep } from './HttpStep.js';
|
|
13
|
+
import { IReadDataStep, ReadDataStepKind } from './steps/data/ReadDataStep.js';
|
|
14
|
+
import { ISetDataStep, SetDataStepKind } from './steps/data/SetDataStep.js';
|
|
15
|
+
import { ISetCookieStep, SetCookieStepKind } from './steps/data/SetCookieStep.js';
|
|
16
|
+
import { DeleteCookieStepKind, IDeleteCookieStep } from './steps/data/DeleteCookieStep.js';
|
|
5
17
|
|
|
6
18
|
/**
|
|
7
19
|
* Allows to translate the old ARC actions into Action flows.
|
|
8
20
|
*/
|
|
9
21
|
export class LegacyTranslator {
|
|
10
|
-
static translate(action: LegacyRequestActions):
|
|
22
|
+
static translate(action: LegacyRequestActions): IHttpFlow[] {
|
|
11
23
|
const { request, response } = action;
|
|
12
|
-
const result:
|
|
24
|
+
const result: IHttpFlow[] = [];
|
|
13
25
|
|
|
14
26
|
if (Array.isArray(request) && request.length) {
|
|
15
|
-
const flow:
|
|
27
|
+
const flow: IHttpFlow = {
|
|
16
28
|
trigger: 'request',
|
|
17
29
|
actions: this._translateRunnables(request),
|
|
18
30
|
};
|
|
@@ -20,7 +32,7 @@ export class LegacyTranslator {
|
|
|
20
32
|
}
|
|
21
33
|
|
|
22
34
|
if (Array.isArray(response) && response.length) {
|
|
23
|
-
const flow:
|
|
35
|
+
const flow: IHttpFlow = {
|
|
24
36
|
trigger: 'response',
|
|
25
37
|
actions: this._translateRunnables(response),
|
|
26
38
|
};
|
|
@@ -66,16 +78,16 @@ export class LegacyTranslator {
|
|
|
66
78
|
}
|
|
67
79
|
if (type) {
|
|
68
80
|
switch (type) {
|
|
69
|
-
case 'request': result.source =
|
|
70
|
-
case 'response': result.source =
|
|
81
|
+
case 'request': result.source = FlowSourceEnum.request; break;
|
|
82
|
+
case 'response': result.source = FlowSourceEnum.response; break;
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
if (type && source) {
|
|
74
86
|
if (type === 'request') {
|
|
75
|
-
result.data = source as
|
|
87
|
+
result.data = source as FlowRequestDataEnum;
|
|
76
88
|
}
|
|
77
89
|
if (type === 'response') {
|
|
78
|
-
result.data = source as
|
|
90
|
+
result.data = source as FlowResponseDataEnum;
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
if (predictedValue) {
|
|
@@ -83,20 +95,20 @@ export class LegacyTranslator {
|
|
|
83
95
|
}
|
|
84
96
|
if (operator) {
|
|
85
97
|
switch (operator) {
|
|
86
|
-
case 'contains': result.operator =
|
|
87
|
-
case 'equal': result.operator =
|
|
88
|
-
case 'greater-than': result.operator =
|
|
89
|
-
case 'greater-than-equal': result.operator =
|
|
90
|
-
case 'less-than': result.operator =
|
|
91
|
-
case 'less-than-equal': result.operator =
|
|
92
|
-
case 'not-equal': result.operator =
|
|
93
|
-
case 'regex': result.operator =
|
|
98
|
+
case 'contains': result.operator = AssertionEnum.contains; break;
|
|
99
|
+
case 'equal': result.operator = AssertionEnum.equal; break;
|
|
100
|
+
case 'greater-than': result.operator = AssertionEnum.greaterThan; break;
|
|
101
|
+
case 'greater-than-equal': result.operator = AssertionEnum.greaterThanEqual; break;
|
|
102
|
+
case 'less-than': result.operator = AssertionEnum.lessThan; break;
|
|
103
|
+
case 'less-than-equal': result.operator = AssertionEnum.lessThanEqual; break;
|
|
104
|
+
case 'not-equal': result.operator = AssertionEnum.notEqual; break;
|
|
105
|
+
case 'regex': result.operator = AssertionEnum.regex; break;
|
|
94
106
|
}
|
|
95
107
|
}
|
|
96
108
|
return result;
|
|
97
109
|
}
|
|
98
110
|
|
|
99
|
-
protected static _translateAction(item: LegacyAction):
|
|
111
|
+
protected static _translateAction(item: LegacyAction): IHttpStep[] {
|
|
100
112
|
switch (item.name) {
|
|
101
113
|
case 'set-cookie': return this._translateSetCookieAction(item);
|
|
102
114
|
case 'set-variable': return this._translateSetVariableAction(item);
|
|
@@ -105,10 +117,10 @@ export class LegacyTranslator {
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
|
|
108
|
-
protected static _translateSetCookieAction(item: LegacyAction):
|
|
120
|
+
protected static _translateSetCookieAction(item: LegacyAction): IHttpStep[] {
|
|
109
121
|
const legacy = item.config as SetCookieConfig;
|
|
110
122
|
|
|
111
|
-
const steps:
|
|
123
|
+
const steps: IHttpStep[] = [];
|
|
112
124
|
const ds = this._translateDataSource(legacy.source);
|
|
113
125
|
steps.push(ds);
|
|
114
126
|
|
|
@@ -142,10 +154,10 @@ export class LegacyTranslator {
|
|
|
142
154
|
return steps;
|
|
143
155
|
}
|
|
144
156
|
|
|
145
|
-
protected static _translateSetVariableAction(item: LegacyAction):
|
|
157
|
+
protected static _translateSetVariableAction(item: LegacyAction): IHttpStep[] {
|
|
146
158
|
const legacy = item.config as SetVariableConfig;
|
|
147
159
|
|
|
148
|
-
const steps:
|
|
160
|
+
const steps: IHttpStep[] = [];
|
|
149
161
|
const ds = this._translateDataSource(legacy.source);
|
|
150
162
|
steps.push(ds);
|
|
151
163
|
|
|
@@ -161,10 +173,10 @@ export class LegacyTranslator {
|
|
|
161
173
|
return steps;
|
|
162
174
|
}
|
|
163
175
|
|
|
164
|
-
protected static _translateDeleteCookieAction(item: LegacyAction):
|
|
176
|
+
protected static _translateDeleteCookieAction(item: LegacyAction): IHttpStep[] {
|
|
165
177
|
const legacy = item.config as DeleteCookieConfig;
|
|
166
178
|
|
|
167
|
-
const steps:
|
|
179
|
+
const steps: IHttpStep[] = [];
|
|
168
180
|
|
|
169
181
|
const action: IDeleteCookieStep = {
|
|
170
182
|
kind: DeleteCookieStepKind,
|
|
@@ -183,7 +195,7 @@ export class LegacyTranslator {
|
|
|
183
195
|
return steps;
|
|
184
196
|
}
|
|
185
197
|
|
|
186
|
-
protected static _translateDataSource(source: DataSourceConfiguration):
|
|
198
|
+
protected static _translateDataSource(source: DataSourceConfiguration): IHttpStep {
|
|
187
199
|
if (source.value) {
|
|
188
200
|
const dataSet: ISetDataStep = {
|
|
189
201
|
kind: SetDataStepKind,
|
|
@@ -206,16 +218,16 @@ export class LegacyTranslator {
|
|
|
206
218
|
}
|
|
207
219
|
if (type) {
|
|
208
220
|
switch (type) {
|
|
209
|
-
case 'request': result.source =
|
|
210
|
-
case 'response': result.source =
|
|
221
|
+
case 'request': result.source = FlowSourceEnum.request; break;
|
|
222
|
+
case 'response': result.source = FlowSourceEnum.response; break;
|
|
211
223
|
}
|
|
212
224
|
}
|
|
213
225
|
if (type && legacySource) {
|
|
214
226
|
if (type === 'request') {
|
|
215
|
-
result.data = legacySource as
|
|
227
|
+
result.data = legacySource as FlowRequestDataEnum;
|
|
216
228
|
}
|
|
217
229
|
if (type === 'response') {
|
|
218
|
-
result.data = legacySource as
|
|
230
|
+
result.data = legacySource as FlowResponseDataEnum;
|
|
219
231
|
}
|
|
220
232
|
}
|
|
221
233
|
return result;
|