@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
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const SetDataStepKind = 'HttpAction#SetData';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sets a manually defined value that can be passed to the next step.
|
|
7
|
+
*/
|
|
8
|
+
export interface ISetDataStep extends IHttpStep {
|
|
9
|
+
kind: typeof SetDataStepKind;
|
|
10
|
+
/**
|
|
11
|
+
* The value to return to the next step.
|
|
12
|
+
* This is always a string. Use the `dataType` to determine the correct data type.
|
|
13
|
+
*/
|
|
14
|
+
value: string;
|
|
15
|
+
/**
|
|
16
|
+
* The data type of the value. This is a value prefixed with
|
|
17
|
+
* `http://www.w3.org/2001/XMLSchema#` or `http://a.ml/vocabularies/shapes#`.
|
|
18
|
+
*
|
|
19
|
+
* Examples:
|
|
20
|
+
*
|
|
21
|
+
* - `http://www.w3.org/2001/XMLSchema#boolean`
|
|
22
|
+
* - `http://www.w3.org/2001/XMLSchema#string`
|
|
23
|
+
* - `http://www.w3.org/2001/XMLSchema#number`
|
|
24
|
+
* - `http://www.w3.org/2001/XMLSchema#integer`
|
|
25
|
+
* - `http://www.w3.org/2001/XMLSchema#long`
|
|
26
|
+
* - `http://a.ml/vocabularies/shapes#number`
|
|
27
|
+
* - `http://a.ml/vocabularies/shapes#integer`
|
|
28
|
+
* - `http://a.ml/vocabularies/shapes#double`
|
|
29
|
+
* - ...
|
|
30
|
+
*
|
|
31
|
+
* @default `http://www.w3.org/2001/XMLSchema#string`
|
|
32
|
+
*/
|
|
33
|
+
dataType?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class SetDataStep extends HttpStep {
|
|
37
|
+
override kind = SetDataStepKind;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The value to return to the next step.
|
|
41
|
+
* This is always a string. Use the `dataType` to determine the correct data type.
|
|
42
|
+
*/
|
|
43
|
+
value = '';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The data type of the value. This is a value prefixed with
|
|
47
|
+
* `http://www.w3.org/2001/XMLSchema#` or `http://a.ml/vocabularies/shapes#`.
|
|
48
|
+
*
|
|
49
|
+
* Examples:
|
|
50
|
+
*
|
|
51
|
+
* - `http://www.w3.org/2001/XMLSchema#boolean`
|
|
52
|
+
* - `http://www.w3.org/2001/XMLSchema#string`
|
|
53
|
+
* - `http://www.w3.org/2001/XMLSchema#number`
|
|
54
|
+
* - `http://www.w3.org/2001/XMLSchema#integer`
|
|
55
|
+
* - `http://www.w3.org/2001/XMLSchema#long`
|
|
56
|
+
* - `http://a.ml/vocabularies/shapes#number`
|
|
57
|
+
* - `http://a.ml/vocabularies/shapes#integer`
|
|
58
|
+
* - `http://a.ml/vocabularies/shapes#double`
|
|
59
|
+
* - ...
|
|
60
|
+
*
|
|
61
|
+
* @default `http://www.w3.org/2001/XMLSchema#string`
|
|
62
|
+
*/
|
|
63
|
+
dataType?: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Creates the step from values.
|
|
67
|
+
* @param value The value this step sets.
|
|
68
|
+
* @param dataType The data type to use to read the value.
|
|
69
|
+
*/
|
|
70
|
+
constructor(value: string, dataType?: string);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Creates the step from serialized schema.
|
|
74
|
+
* @param init The serialized step values.
|
|
75
|
+
*/
|
|
76
|
+
constructor(init: ISetDataStep);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Creates an empty step.
|
|
80
|
+
*/
|
|
81
|
+
constructor();
|
|
82
|
+
|
|
83
|
+
constructor(valueOrInit?: string | ISetDataStep, dataType?: string) {
|
|
84
|
+
super();
|
|
85
|
+
if (!valueOrInit) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (typeof valueOrInit === 'object') {
|
|
89
|
+
const typed = valueOrInit as ISetDataStep;
|
|
90
|
+
this.new(typed);
|
|
91
|
+
} else if (typeof valueOrInit === 'string') {
|
|
92
|
+
this.new({
|
|
93
|
+
kind: SetDataStepKind,
|
|
94
|
+
value: valueOrInit,
|
|
95
|
+
dataType,
|
|
96
|
+
enabled: true,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
override new(init: ISetDataStep): void {
|
|
102
|
+
super.new(init);
|
|
103
|
+
this.kind = SetDataStepKind;
|
|
104
|
+
this.value = init.value;
|
|
105
|
+
this.dataType = init.dataType;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
checkValidity(): boolean {
|
|
109
|
+
const { value } = this;
|
|
110
|
+
return !!value;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
override toJSON(): ISetDataStep {
|
|
114
|
+
const result: ISetDataStep = {
|
|
115
|
+
...super.toJSON(),
|
|
116
|
+
kind: SetDataStepKind,
|
|
117
|
+
value: this.value,
|
|
118
|
+
};
|
|
119
|
+
if (this.dataType) {
|
|
120
|
+
result.dataType = this.dataType;
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const SetVariableStepKind = 'HttpAction#SetVariable';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A step that accepts an input from the previous step and sets a variable in the current environment
|
|
7
|
+
* with this value. If the value is `void`, `null`, or `undefined` then the variable is removed from the
|
|
8
|
+
* environment.
|
|
9
|
+
*
|
|
10
|
+
* All variables are strings.
|
|
11
|
+
*/
|
|
12
|
+
export interface ISetVariableStep extends IHttpStep {
|
|
13
|
+
kind: typeof SetVariableStepKind;
|
|
14
|
+
/**
|
|
15
|
+
* The name of the variable to set
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export class SetVariableStep extends HttpStep {
|
|
22
|
+
override kind = SetVariableStepKind;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The name of the variable to set
|
|
26
|
+
*/
|
|
27
|
+
name = '';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates the step from values.
|
|
31
|
+
* @param name The name of the variable to set
|
|
32
|
+
*/
|
|
33
|
+
constructor(name: string);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates the step from serialized schema.
|
|
37
|
+
* @param init The serialized step values.
|
|
38
|
+
*/
|
|
39
|
+
constructor(init: ISetVariableStep);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates an empty step.
|
|
43
|
+
*/
|
|
44
|
+
constructor();
|
|
45
|
+
|
|
46
|
+
constructor(nameOrInit?: string | ISetVariableStep) {
|
|
47
|
+
super();
|
|
48
|
+
if (!nameOrInit) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (typeof nameOrInit === 'object') {
|
|
52
|
+
const typed = nameOrInit as ISetVariableStep;
|
|
53
|
+
this.new(typed);
|
|
54
|
+
} else if (typeof nameOrInit === 'string') {
|
|
55
|
+
this.new({
|
|
56
|
+
kind: SetVariableStepKind,
|
|
57
|
+
name: nameOrInit,
|
|
58
|
+
enabled: true,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override new(init: ISetVariableStep): void {
|
|
64
|
+
super.new(init);
|
|
65
|
+
this.kind = SetVariableStepKind;
|
|
66
|
+
this.name = init.name;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
checkValidity(): boolean {
|
|
70
|
+
const { name } = this;
|
|
71
|
+
return !!name;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
override toJSON(): ISetVariableStep {
|
|
75
|
+
const result: ISetVariableStep = {
|
|
76
|
+
...super.toJSON(),
|
|
77
|
+
kind: SetVariableStepKind,
|
|
78
|
+
name: this.name,
|
|
79
|
+
};
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const AsLowerCaseStepKind = 'HttpAction#AsLowerCase';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads the input and returns a lower case value of it.
|
|
7
|
+
*/
|
|
8
|
+
export interface IAsLowerCaseStep extends IHttpStep {
|
|
9
|
+
kind: typeof AsLowerCaseStepKind;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reads the input and returns a lower case value of it.
|
|
14
|
+
*/
|
|
15
|
+
export class AsLowerCaseStep extends HttpStep {
|
|
16
|
+
override kind = AsLowerCaseStepKind;
|
|
17
|
+
|
|
18
|
+
constructor(init?: IAsLowerCaseStep) {
|
|
19
|
+
super();
|
|
20
|
+
if (typeof init === 'object') {
|
|
21
|
+
this.new(init);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override new(init: IAsLowerCaseStep): void {
|
|
26
|
+
super.new(init);
|
|
27
|
+
this.kind = AsLowerCaseStepKind;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
checkValidity(): boolean {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override toJSON(): IAsLowerCaseStep {
|
|
35
|
+
const result: IAsLowerCaseStep = {
|
|
36
|
+
...super.toJSON(),
|
|
37
|
+
kind: AsLowerCaseStepKind,
|
|
38
|
+
};
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const AsNumberStepKind = 'HttpAction#AsNumber';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads the input and returns is as a number.
|
|
7
|
+
*/
|
|
8
|
+
export interface IAsNumberStep extends IHttpStep {
|
|
9
|
+
kind: typeof AsNumberStepKind;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reads the input and returns is as a number.
|
|
14
|
+
*/
|
|
15
|
+
export class AsNumberStep extends HttpStep {
|
|
16
|
+
override kind = AsNumberStepKind;
|
|
17
|
+
|
|
18
|
+
constructor(init?: IAsNumberStep) {
|
|
19
|
+
super();
|
|
20
|
+
if (typeof init === 'object') {
|
|
21
|
+
this.new(init);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override new(init: IAsNumberStep): void {
|
|
26
|
+
super.new(init);
|
|
27
|
+
this.kind = AsNumberStepKind;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
checkValidity(): boolean {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override toJSON(): IAsNumberStep {
|
|
35
|
+
const result: IAsNumberStep = {
|
|
36
|
+
...super.toJSON(),
|
|
37
|
+
kind: AsNumberStepKind,
|
|
38
|
+
};
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const AsUpperCaseStepKind = 'HttpAction#AsUpperCase';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads the input and returns an upper case value of it.
|
|
7
|
+
*/
|
|
8
|
+
export interface IAsUpperCaseStep extends IHttpStep {
|
|
9
|
+
kind: typeof AsUpperCaseStepKind;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reads the input and returns an upper case value of it.
|
|
14
|
+
*/
|
|
15
|
+
export class AsUpperCaseStep extends HttpStep {
|
|
16
|
+
override kind = AsUpperCaseStepKind;
|
|
17
|
+
|
|
18
|
+
constructor(init?: IAsUpperCaseStep) {
|
|
19
|
+
super();
|
|
20
|
+
if (typeof init === 'object') {
|
|
21
|
+
this.new(init);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override new(init: IAsUpperCaseStep): void {
|
|
26
|
+
super.new(init);
|
|
27
|
+
this.kind = AsUpperCaseStepKind;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
checkValidity(): boolean {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override toJSON(): IAsUpperCaseStep {
|
|
35
|
+
const result: IAsUpperCaseStep = {
|
|
36
|
+
...super.toJSON(),
|
|
37
|
+
kind: AsUpperCaseStepKind,
|
|
38
|
+
};
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const RoundStepKind = 'HttpAction#Round';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Formats the input as a number using fixed-point notation.
|
|
7
|
+
*/
|
|
8
|
+
export interface IRoundStep extends IHttpStep {
|
|
9
|
+
kind: typeof RoundStepKind;
|
|
10
|
+
/**
|
|
11
|
+
* The number of digits to appear after the decimal point; should be a value between 0 and 100, inclusive.
|
|
12
|
+
* If this argument is omitted, it is treated as 0.
|
|
13
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed.
|
|
14
|
+
*/
|
|
15
|
+
precision?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Formats the input as a number using fixed-point notation.
|
|
20
|
+
*/
|
|
21
|
+
export class RoundStep extends HttpStep {
|
|
22
|
+
override kind = RoundStepKind;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The number of digits to appear after the decimal point; should be a value between 0 and 100, inclusive.
|
|
26
|
+
* If this argument is omitted, it is treated as 0.
|
|
27
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed.
|
|
28
|
+
*/
|
|
29
|
+
precision?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates the step from values.
|
|
33
|
+
* @param precision The name of the variable to set
|
|
34
|
+
*/
|
|
35
|
+
constructor(precision: number);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates the step from serialized schema.
|
|
39
|
+
* @param init The serialized step values.
|
|
40
|
+
*/
|
|
41
|
+
constructor(init: IRoundStep);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates an empty step.
|
|
45
|
+
*/
|
|
46
|
+
constructor();
|
|
47
|
+
|
|
48
|
+
constructor(precisionOrInit?: number | IRoundStep) {
|
|
49
|
+
super();
|
|
50
|
+
if (typeof precisionOrInit === 'object') {
|
|
51
|
+
const typed = precisionOrInit as IRoundStep;
|
|
52
|
+
this.new(typed);
|
|
53
|
+
} else if (typeof precisionOrInit === 'number') {
|
|
54
|
+
this.new({
|
|
55
|
+
kind: RoundStepKind,
|
|
56
|
+
precision: precisionOrInit,
|
|
57
|
+
enabled: true,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
override new(init: IRoundStep): void {
|
|
63
|
+
super.new(init);
|
|
64
|
+
this.kind = RoundStepKind;
|
|
65
|
+
if (typeof init.precision === 'number') {
|
|
66
|
+
this.precision = init.precision;
|
|
67
|
+
} else {
|
|
68
|
+
this.precision = undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
checkValidity(): boolean {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
override toJSON(): IRoundStep {
|
|
77
|
+
const result: IRoundStep = {
|
|
78
|
+
...super.toJSON(),
|
|
79
|
+
kind: RoundStepKind,
|
|
80
|
+
};
|
|
81
|
+
if (typeof this.precision === 'number') {
|
|
82
|
+
result.precision = this.precision;
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const SubstringStepKind = 'HttpAction#Substring';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns 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.
|
|
7
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
|
|
8
|
+
*/
|
|
9
|
+
export interface ISubstringStep extends IHttpStep {
|
|
10
|
+
kind: typeof SubstringStepKind;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The index of the first character to include in the returned substring.
|
|
14
|
+
*/
|
|
15
|
+
start?: number;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The index of the first character to exclude from the returned substring.
|
|
19
|
+
*/
|
|
20
|
+
end?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns 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.
|
|
25
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
|
|
26
|
+
*/
|
|
27
|
+
export class SubstringStep extends HttpStep {
|
|
28
|
+
override kind = SubstringStepKind;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The index of the first character to include in the returned substring.
|
|
32
|
+
*/
|
|
33
|
+
start?: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The index of the first character to exclude from the returned substring.
|
|
37
|
+
*/
|
|
38
|
+
end?: number;
|
|
39
|
+
|
|
40
|
+
constructor(start: number, end?: number);
|
|
41
|
+
|
|
42
|
+
constructor(init: ISubstringStep);
|
|
43
|
+
|
|
44
|
+
constructor();
|
|
45
|
+
|
|
46
|
+
constructor(startOrInit?: number | ISubstringStep, end?: number) {
|
|
47
|
+
super();
|
|
48
|
+
if (typeof startOrInit === 'object') {
|
|
49
|
+
const typed = startOrInit as ISubstringStep;
|
|
50
|
+
this.new(typed);
|
|
51
|
+
} else if (typeof startOrInit === 'number') {
|
|
52
|
+
this.new({
|
|
53
|
+
kind: SubstringStepKind,
|
|
54
|
+
start: startOrInit,
|
|
55
|
+
end,
|
|
56
|
+
enabled: true,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override new(init: ISubstringStep): void {
|
|
62
|
+
super.new(init);
|
|
63
|
+
this.kind = SubstringStepKind;
|
|
64
|
+
if (typeof init.start === 'number') {
|
|
65
|
+
this.start = init.start;
|
|
66
|
+
} else {
|
|
67
|
+
this.start = undefined;
|
|
68
|
+
}
|
|
69
|
+
if (typeof init.end === 'number') {
|
|
70
|
+
this.end = init.end;
|
|
71
|
+
} else {
|
|
72
|
+
this.end = undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
checkValidity(): boolean {
|
|
77
|
+
return typeof this.start === 'number';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
override toJSON(): ISubstringStep {
|
|
81
|
+
const result: ISubstringStep = {
|
|
82
|
+
...super.toJSON(),
|
|
83
|
+
kind: SubstringStepKind,
|
|
84
|
+
};
|
|
85
|
+
if (typeof this.start === 'number') {
|
|
86
|
+
result.start = this.start;
|
|
87
|
+
}
|
|
88
|
+
if (typeof this.end === 'number') {
|
|
89
|
+
result.end = this.end;
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const TrimStepKind = 'HttpAction#Trim';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads the input and trims it.
|
|
7
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim.
|
|
8
|
+
*/
|
|
9
|
+
export interface ITrimStep extends IHttpStep {
|
|
10
|
+
kind: typeof TrimStepKind;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Reads the input and trims it.
|
|
15
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim.
|
|
16
|
+
*/
|
|
17
|
+
export class TrimStep extends HttpStep {
|
|
18
|
+
override kind = TrimStepKind;
|
|
19
|
+
|
|
20
|
+
constructor(init?: ITrimStep) {
|
|
21
|
+
super();
|
|
22
|
+
if (typeof init === 'object') {
|
|
23
|
+
this.new(init);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override new(init: ITrimStep): void {
|
|
28
|
+
super.new(init);
|
|
29
|
+
this.kind = TrimStepKind;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
checkValidity(): boolean {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override toJSON(): ITrimStep {
|
|
37
|
+
const result: ITrimStep = {
|
|
38
|
+
...super.toJSON(),
|
|
39
|
+
kind: TrimStepKind,
|
|
40
|
+
};
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -3,11 +3,12 @@ import { IRequestAuthorization } from '../models/RequestAuthorization.js';
|
|
|
3
3
|
import { IRequestConfig } from '../models/RequestConfig.js';
|
|
4
4
|
import Proxy, { IProxyResult } from "./Proxy.js";
|
|
5
5
|
import { HttpCertificate } from '../models/ClientCertificate.js';
|
|
6
|
-
import {
|
|
6
|
+
import { IHttpFlow } from '../models/http-actions/HttpFlows.js';
|
|
7
7
|
import { ApiError } from '../runtime/store/Errors.js';
|
|
8
8
|
import { DummyLogger } from '../lib/logging/DummyLogger.js';
|
|
9
9
|
import { HttpRequestRunner } from '../runtime/http-runner/HttpRequestRunner.js';
|
|
10
10
|
import { IRequestLog } from "../models/RequestLog.js";
|
|
11
|
+
import { IHttpAssertion } from '../models/http-actions/HttpAssertion.js';
|
|
11
12
|
|
|
12
13
|
export interface IRequestProxyInit {
|
|
13
14
|
kind: typeof HttpRequestKind;
|
|
@@ -34,7 +35,11 @@ export interface IRequestProxyInit {
|
|
|
34
35
|
/**
|
|
35
36
|
* The request flows to execute with the request.
|
|
36
37
|
*/
|
|
37
|
-
flows?:
|
|
38
|
+
flows?: IHttpFlow[];
|
|
39
|
+
/**
|
|
40
|
+
* Assertions to execute with the request.
|
|
41
|
+
*/
|
|
42
|
+
assertions?: IHttpAssertion[];
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
/**
|
|
@@ -66,7 +71,7 @@ export default class RequestProxy extends Proxy {
|
|
|
66
71
|
|
|
67
72
|
async execute(): Promise<IProxyResult<IRequestLog>> {
|
|
68
73
|
const data = this.init as IRequestProxyInit;
|
|
69
|
-
const { request, authorization, certificate, config={}, variables={}, flows } = data;
|
|
74
|
+
const { request, authorization, certificate, config={}, variables={}, flows, assertions } = data;
|
|
70
75
|
const factory = new HttpRequestRunner();
|
|
71
76
|
factory.variables = variables;
|
|
72
77
|
factory.logger = new DummyLogger();
|
|
@@ -77,6 +82,9 @@ export default class RequestProxy extends Proxy {
|
|
|
77
82
|
if (Array.isArray(flows) && flows.length) {
|
|
78
83
|
factory.flows = flows;
|
|
79
84
|
}
|
|
85
|
+
if (Array.isArray(assertions) && assertions.length) {
|
|
86
|
+
factory.assertions = assertions;
|
|
87
|
+
}
|
|
80
88
|
if (certificate) {
|
|
81
89
|
factory.certificates = [certificate];
|
|
82
90
|
}
|