@api-client/core 0.9.4 → 0.9.5
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 +12 -2
- package/build/browser.js +15 -2
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +13 -3
- package/build/index.js +16 -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/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/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/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/ProjectParallelRunner.d.ts +1 -1
- 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/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/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/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/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/ProjectParallelRunner.ts +4 -4
- package/src/runtime/node/ProjectRequestRunner.ts +6 -2
- 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
|
@@ -3,6 +3,7 @@ import { Server, IServer } from './Server.js';
|
|
|
3
3
|
import { IThing, Thing, Kind as ThingKind } from './Thing.js';
|
|
4
4
|
import v4 from '../lib/uuid.js';
|
|
5
5
|
import { ARCVariable } from './legacy/models/Variable.js';
|
|
6
|
+
import { IRequestAuthorization, RequestAuthorization } from './RequestAuthorization.js';
|
|
6
7
|
|
|
7
8
|
export const Kind = 'Core#Environment';
|
|
8
9
|
|
|
@@ -46,7 +47,7 @@ export interface IEnvironment {
|
|
|
46
47
|
/**
|
|
47
48
|
* The security to be applied to all requests that are going to this environment.
|
|
48
49
|
*/
|
|
49
|
-
|
|
50
|
+
authorization?: IRequestAuthorization[];
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/**
|
|
@@ -82,7 +83,7 @@ export class Environment {
|
|
|
82
83
|
/**
|
|
83
84
|
* The security to be applied to all requests that are going to this server.
|
|
84
85
|
*/
|
|
85
|
-
|
|
86
|
+
authorization?: RequestAuthorization[];
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
89
|
* Creates a new Environment object from a name.
|
|
@@ -151,11 +152,15 @@ export class Environment {
|
|
|
151
152
|
if (!Environment.isEnvironment(init)) {
|
|
152
153
|
throw new Error(`Not an environment.`);
|
|
153
154
|
}
|
|
154
|
-
const { key = v4(), variables, info, server, encapsulated = false,
|
|
155
|
+
const { key = v4(), variables, info, server, encapsulated = false, authorization } = init;
|
|
155
156
|
this.kind = Kind;
|
|
156
157
|
this.key = key;
|
|
157
158
|
this.encapsulated = encapsulated;
|
|
158
|
-
|
|
159
|
+
if (Array.isArray(authorization)) {
|
|
160
|
+
this.authorization = authorization.map(i => new RequestAuthorization(i));
|
|
161
|
+
} else {
|
|
162
|
+
this.authorization = undefined;
|
|
163
|
+
}
|
|
159
164
|
if (Array.isArray(variables)) {
|
|
160
165
|
this.variables = variables.map(i => new Property(i))
|
|
161
166
|
} else {
|
|
@@ -196,9 +201,8 @@ export class Environment {
|
|
|
196
201
|
if (server) {
|
|
197
202
|
result.server = server.toJSON();
|
|
198
203
|
}
|
|
199
|
-
if (this.
|
|
200
|
-
|
|
201
|
-
result.security = this.security;
|
|
204
|
+
if (Array.isArray(this.authorization)) {
|
|
205
|
+
result.authorization = this.authorization.map(i => i.toJSON());
|
|
202
206
|
}
|
|
203
207
|
return result;
|
|
204
208
|
}
|
|
@@ -66,7 +66,7 @@ export class ErrorResponse extends HttpResponse {
|
|
|
66
66
|
/**
|
|
67
67
|
* @param input The request definition used to restore the state.
|
|
68
68
|
*/
|
|
69
|
-
constructor(input?: string|IErrorResponse) {
|
|
69
|
+
constructor(input?: string | IErrorResponse) {
|
|
70
70
|
super(input);
|
|
71
71
|
let init: IErrorResponse;
|
|
72
72
|
if (typeof input === 'string') {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { SerializablePayload, SerializablePayloadOptions } from './SerializablePayload.js';
|
|
2
|
-
import { Payload } from '../lib/transformers/PayloadSerializer.js';
|
|
1
|
+
import { ISerializablePayload, SerializablePayload, SerializablePayloadOptions } from './SerializablePayload.js';
|
|
3
2
|
import { IProperty } from './Property.js';
|
|
4
3
|
import { HeadersArray } from './HeadersArray.js';
|
|
5
4
|
|
|
6
5
|
export const Kind = 'Core#HttpRequest';
|
|
7
6
|
|
|
8
|
-
export interface IBaseHttpRequest {
|
|
7
|
+
export interface IBaseHttpRequest extends ISerializablePayload {
|
|
9
8
|
/**
|
|
10
9
|
* The request URL
|
|
11
10
|
*/
|
|
@@ -19,10 +18,6 @@ export interface IBaseHttpRequest {
|
|
|
19
18
|
* HTTP headers string
|
|
20
19
|
*/
|
|
21
20
|
headers?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The request payload.
|
|
24
|
-
*/
|
|
25
|
-
payload?: Payload;
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
/**
|
|
@@ -136,8 +131,9 @@ export class HttpRequest extends SerializablePayload {
|
|
|
136
131
|
return true;
|
|
137
132
|
}
|
|
138
133
|
|
|
139
|
-
toJSON(): IHttpRequest {
|
|
134
|
+
override toJSON(): IHttpRequest {
|
|
140
135
|
const result: IHttpRequest = {
|
|
136
|
+
...super.toJSON(),
|
|
141
137
|
kind: this.kind,
|
|
142
138
|
url: this.url,
|
|
143
139
|
method: this.method,
|
|
@@ -145,15 +141,9 @@ export class HttpRequest extends SerializablePayload {
|
|
|
145
141
|
if (this.headers) {
|
|
146
142
|
result.headers = this.headers;
|
|
147
143
|
}
|
|
148
|
-
if (this.payload) {
|
|
149
|
-
result.payload = this.payload;
|
|
150
|
-
}
|
|
151
144
|
if (this.headersModel) {
|
|
152
145
|
result.headersModel = this.headersModel.toJSON();
|
|
153
146
|
}
|
|
154
|
-
if (this.payloadOptions) {
|
|
155
|
-
result.payloadOptions = { ...this.payloadOptions };
|
|
156
|
-
}
|
|
157
147
|
return result;
|
|
158
148
|
}
|
|
159
149
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { SerializablePayload } from './SerializablePayload.js';
|
|
2
|
-
import {
|
|
1
|
+
import { ISerializablePayload, SerializablePayload } from './SerializablePayload.js';
|
|
2
|
+
import { PayloadSerializer } from '../lib/transformers/PayloadSerializer.js';
|
|
3
3
|
import { HTTPResponse as LegacyHttpResponse } from './legacy/request/ArcResponse.js';
|
|
4
4
|
import { Normalizer } from './legacy/Normalizer.js';
|
|
5
5
|
|
|
6
6
|
export const Kind = 'Core#HttpResponse';
|
|
7
7
|
|
|
8
|
-
export interface IHttpResponse {
|
|
8
|
+
export interface IHttpResponse extends ISerializablePayload {
|
|
9
9
|
kind?: string;
|
|
10
10
|
/**
|
|
11
11
|
* The response status code
|
|
@@ -19,10 +19,6 @@ export interface IHttpResponse {
|
|
|
19
19
|
* The response headers
|
|
20
20
|
*/
|
|
21
21
|
headers?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The response message
|
|
24
|
-
*/
|
|
25
|
-
payload?: Payload;
|
|
26
22
|
}
|
|
27
23
|
|
|
28
24
|
export class HttpResponse extends SerializablePayload {
|
|
@@ -116,8 +112,9 @@ export class HttpResponse extends SerializablePayload {
|
|
|
116
112
|
return true;
|
|
117
113
|
}
|
|
118
114
|
|
|
119
|
-
toJSON(): IHttpResponse {
|
|
115
|
+
override toJSON(): IHttpResponse {
|
|
120
116
|
const result: IHttpResponse = {
|
|
117
|
+
...super.toJSON(),
|
|
121
118
|
kind: this.kind,
|
|
122
119
|
status: this.status,
|
|
123
120
|
};
|
|
@@ -127,9 +124,6 @@ export class HttpResponse extends SerializablePayload {
|
|
|
127
124
|
if (this.headers) {
|
|
128
125
|
result.headers = this.headers;
|
|
129
126
|
}
|
|
130
|
-
if (this.payload) {
|
|
131
|
-
result.payload = this.payload;
|
|
132
|
-
}
|
|
133
127
|
return result;
|
|
134
128
|
}
|
|
135
129
|
|
|
@@ -9,6 +9,7 @@ import { Environment } from './Environment.js';
|
|
|
9
9
|
import { Property } from './Property.js';
|
|
10
10
|
import { Server } from './Server.js';
|
|
11
11
|
import { UriTemplate } from '../lib/parsers/UriTemplate.js';
|
|
12
|
+
import { RequestAuthorization } from './RequestAuthorization.js';
|
|
12
13
|
|
|
13
14
|
export const Kind = 'Core#ProjectRequest';
|
|
14
15
|
|
|
@@ -485,4 +486,57 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
485
486
|
}
|
|
486
487
|
return result;
|
|
487
488
|
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Reads the authorization that should be applied to the request.
|
|
492
|
+
*
|
|
493
|
+
* 1) First it returns the locally (on the request) defined authorization.
|
|
494
|
+
* 2) Then it returns authorization defined on the selected environment.
|
|
495
|
+
* 3) If has defined environment but no authorization on it, then it returns empty array.
|
|
496
|
+
* 4) Only if the request has no selected environment then it reads first environment
|
|
497
|
+
* that has authorization (from the request up to the project's root).
|
|
498
|
+
*/
|
|
499
|
+
readAuthorization(): RequestAuthorization[] {
|
|
500
|
+
if (Array.isArray(this.authorization) && this.authorization.length) {
|
|
501
|
+
return this.authorization;
|
|
502
|
+
}
|
|
503
|
+
const envAuth = this.readEnvironmentAuthorization();
|
|
504
|
+
if (envAuth) {
|
|
505
|
+
return envAuth;
|
|
506
|
+
}
|
|
507
|
+
if (this.environment) {
|
|
508
|
+
return [];
|
|
509
|
+
}
|
|
510
|
+
const inherited = this.readEnvironmentsAuthorization();
|
|
511
|
+
if (inherited) {
|
|
512
|
+
return inherited;
|
|
513
|
+
}
|
|
514
|
+
return [];
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @returns Authorization defined on the selected environment or undefined.
|
|
519
|
+
*/
|
|
520
|
+
protected readEnvironmentAuthorization(): RequestAuthorization[] | undefined {
|
|
521
|
+
const selfEnv = this.getEnvironment();
|
|
522
|
+
if (!selfEnv) {
|
|
523
|
+
return undefined;
|
|
524
|
+
}
|
|
525
|
+
if (Array.isArray(selfEnv.authorization) && selfEnv.authorization.length) {
|
|
526
|
+
return selfEnv.authorization;
|
|
527
|
+
}
|
|
528
|
+
return undefined;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* @returns Authorization defined on any inherited environment or undefined.
|
|
533
|
+
*/
|
|
534
|
+
protected readEnvironmentsAuthorization(): RequestAuthorization[] | undefined {
|
|
535
|
+
const envs = this.readEnvironments();
|
|
536
|
+
const authEnv = envs.find(i => Array.isArray(i.authorization) && !!i.authorization.length);
|
|
537
|
+
if (authEnv) {
|
|
538
|
+
return authEnv.authorization as RequestAuthorization[];
|
|
539
|
+
}
|
|
540
|
+
return undefined;
|
|
541
|
+
}
|
|
488
542
|
}
|
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
|
+
}
|