@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,102 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const DeleteCookieStepKind = 'HttpAction#DeleteCookie';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A step allowing to delete a cookie for the given configuration.
|
|
7
|
+
* This step does not require an input.
|
|
8
|
+
*/
|
|
9
|
+
export interface IDeleteCookieStep extends IHttpStep {
|
|
10
|
+
kind: typeof DeleteCookieStepKind;
|
|
11
|
+
/**
|
|
12
|
+
* The URL associated with the cookie. When not set it uses the request URL or the request URL of the last redirect.
|
|
13
|
+
*/
|
|
14
|
+
url?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Name of the cookie to remove.
|
|
17
|
+
* When not set it removes all cookies for the URL.
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class DeleteCookieStep extends HttpStep {
|
|
23
|
+
override kind = DeleteCookieStepKind;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The URL associated with the cookie. When not set it uses the request URL or the request URL of the last redirect.
|
|
27
|
+
*/
|
|
28
|
+
url?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Name of the cookie to remove.
|
|
32
|
+
* When not set it removes all cookies for the URL.
|
|
33
|
+
*/
|
|
34
|
+
name?: string;
|
|
35
|
+
|
|
36
|
+
static byName(name: string): DeleteCookieStep {
|
|
37
|
+
return new DeleteCookieStep({
|
|
38
|
+
kind: DeleteCookieStepKind,
|
|
39
|
+
enabled: true,
|
|
40
|
+
name,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static byUrl(url: string): DeleteCookieStep {
|
|
45
|
+
return new DeleteCookieStep({
|
|
46
|
+
kind: DeleteCookieStepKind,
|
|
47
|
+
enabled: true,
|
|
48
|
+
url,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Creates the step from serialized schema.
|
|
54
|
+
* @param init The serialized step values.
|
|
55
|
+
*/
|
|
56
|
+
constructor(init: IDeleteCookieStep);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Creates an empty step.
|
|
60
|
+
*/
|
|
61
|
+
constructor();
|
|
62
|
+
|
|
63
|
+
constructor(init?: IDeleteCookieStep) {
|
|
64
|
+
super();
|
|
65
|
+
if (init) {
|
|
66
|
+
this.new(init);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override new(init: IDeleteCookieStep): void {
|
|
71
|
+
super.new(init);
|
|
72
|
+
this.kind = DeleteCookieStepKind;
|
|
73
|
+
if (init.url) {
|
|
74
|
+
this.url = init.url;
|
|
75
|
+
} else {
|
|
76
|
+
this.url = undefined;
|
|
77
|
+
}
|
|
78
|
+
if (init.name) {
|
|
79
|
+
this.name = init.name;
|
|
80
|
+
} else {
|
|
81
|
+
this.name = undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
checkValidity(): boolean {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
override toJSON(): IDeleteCookieStep {
|
|
90
|
+
const result: IDeleteCookieStep = {
|
|
91
|
+
...super.toJSON(),
|
|
92
|
+
kind: DeleteCookieStepKind,
|
|
93
|
+
};
|
|
94
|
+
if (this.url) {
|
|
95
|
+
result.url = this.url;
|
|
96
|
+
}
|
|
97
|
+
if (this.name) {
|
|
98
|
+
result.name = this.name;
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { FlowRequestDataEnum, FlowResponseDataEnum, FlowSourceEnum } from "../../HttpFlows";
|
|
2
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
3
|
+
|
|
4
|
+
export const ReadDataSourceStepKind = 'HttpAction#ReadDataSource';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A step similar to `ReadDataStep` but it does not search for a value by the path
|
|
8
|
+
* but returns the whole part of the request / response data (like status code,
|
|
9
|
+
* status message, response headers, response body, request body, etc)
|
|
10
|
+
*/
|
|
11
|
+
export interface IReadDataSourceStep extends IHttpStep {
|
|
12
|
+
/**
|
|
13
|
+
* The source of the data.
|
|
14
|
+
*/
|
|
15
|
+
source?: FlowSourceEnum;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The data to read.
|
|
19
|
+
*/
|
|
20
|
+
data?: FlowRequestDataEnum | FlowResponseDataEnum;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A step similar to `ReadDataStep` but it does not search for a value by the path
|
|
25
|
+
* but returns the whole part of the request / response data (like status code,
|
|
26
|
+
* status message, response headers, response body, request body, etc)
|
|
27
|
+
*/
|
|
28
|
+
export class ReadDataSourceStep extends HttpStep {
|
|
29
|
+
override kind = ReadDataSourceStepKind;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The source of the data.
|
|
33
|
+
*/
|
|
34
|
+
source?: FlowSourceEnum;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The data to read.
|
|
38
|
+
*/
|
|
39
|
+
data?: FlowRequestDataEnum | FlowResponseDataEnum;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates the step from values.
|
|
43
|
+
* @param source The main data source.
|
|
44
|
+
* @param path The path to the data.
|
|
45
|
+
* @param data Source of the data in the `source`. This is optional for non-http-request source.
|
|
46
|
+
*/
|
|
47
|
+
constructor(source: FlowSourceEnum, data: FlowRequestDataEnum | FlowResponseDataEnum);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Creates the step from serialized schema.
|
|
51
|
+
* @param init The serialized step values.
|
|
52
|
+
*/
|
|
53
|
+
constructor(init: IReadDataSourceStep);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Creates an empty step.
|
|
57
|
+
*/
|
|
58
|
+
constructor();
|
|
59
|
+
|
|
60
|
+
constructor(sourceOrInit?: FlowSourceEnum | IReadDataSourceStep, data?: FlowRequestDataEnum | FlowResponseDataEnum) {
|
|
61
|
+
super();
|
|
62
|
+
if (!sourceOrInit) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (typeof sourceOrInit === 'object') {
|
|
66
|
+
const typed = sourceOrInit as IReadDataSourceStep;
|
|
67
|
+
this.new(typed);
|
|
68
|
+
} else if (typeof sourceOrInit === 'string') {
|
|
69
|
+
this.new({
|
|
70
|
+
kind: ReadDataSourceStepKind,
|
|
71
|
+
source: sourceOrInit,
|
|
72
|
+
data,
|
|
73
|
+
enabled: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
override new(init: IReadDataSourceStep): void {
|
|
79
|
+
super.new(init);
|
|
80
|
+
this.kind = ReadDataSourceStepKind;
|
|
81
|
+
this.source = init.source;
|
|
82
|
+
this.data = init.data;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
checkValidity(): boolean {
|
|
86
|
+
const { source, data } = this;
|
|
87
|
+
return !!source && !!data;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
override toJSON(): IReadDataSourceStep {
|
|
91
|
+
const result: IReadDataSourceStep = {
|
|
92
|
+
...super.toJSON(),
|
|
93
|
+
kind: ReadDataSourceStepKind,
|
|
94
|
+
};
|
|
95
|
+
if (this.source) {
|
|
96
|
+
result.source = this.source;
|
|
97
|
+
}
|
|
98
|
+
if (this.data) {
|
|
99
|
+
result.data = this.data;
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { FlowRequestDataEnum, FlowResponseDataEnum, FlowSourceEnum } from "../../HttpFlows.js";
|
|
2
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
3
|
+
|
|
4
|
+
export const ReadDataStepKind = 'HttpAction#ReadData';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reads the data from various sources.
|
|
8
|
+
*/
|
|
9
|
+
export interface IReadDataStep extends IHttpStep {
|
|
10
|
+
kind: typeof ReadDataStepKind;
|
|
11
|
+
/**
|
|
12
|
+
* The main data source.
|
|
13
|
+
* In the legacy actions this was `type`.
|
|
14
|
+
*/
|
|
15
|
+
source?: FlowSourceEnum;
|
|
16
|
+
/**
|
|
17
|
+
* Source of the data.
|
|
18
|
+
* In the legacy actions this was `source`.
|
|
19
|
+
* This is not required when the source is not `request` or `response`.
|
|
20
|
+
*/
|
|
21
|
+
data?: FlowRequestDataEnum | FlowResponseDataEnum;
|
|
22
|
+
/**
|
|
23
|
+
* The path to the data.
|
|
24
|
+
* For JSON value use https://jmespath.org/ syntax.
|
|
25
|
+
* For XML use xpath.
|
|
26
|
+
* For any other use a simple path to the data separated by dot (e.g. headers.content-type)
|
|
27
|
+
*/
|
|
28
|
+
path?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class ReadDataStep extends HttpStep {
|
|
32
|
+
override kind = ReadDataStepKind;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The main data source.
|
|
36
|
+
* In the legacy actions this was `type`.
|
|
37
|
+
*/
|
|
38
|
+
source?: FlowSourceEnum;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Source of the data.
|
|
42
|
+
* In the legacy actions this was `source`.
|
|
43
|
+
* This is not required when the source is not `request` or `response`.
|
|
44
|
+
*/
|
|
45
|
+
data?: FlowRequestDataEnum | FlowResponseDataEnum;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The path to the data.
|
|
49
|
+
* For JSON value use https://jmespath.org/ syntax.
|
|
50
|
+
* For XML use xpath.
|
|
51
|
+
* For any other use a simple path to the data separated by dot (e.g. headers.content-type)
|
|
52
|
+
*/
|
|
53
|
+
path?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Creates the step from values.
|
|
57
|
+
* @param source The main data source.
|
|
58
|
+
* @param path The path to the data.
|
|
59
|
+
* @param data Source of the data in the `source`. This is optional for non-http-request source.
|
|
60
|
+
*/
|
|
61
|
+
constructor(source: FlowSourceEnum, path?: string, data?: FlowRequestDataEnum | FlowResponseDataEnum);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates the step from serialized schema.
|
|
65
|
+
* @param init The serialized step values.
|
|
66
|
+
*/
|
|
67
|
+
constructor(init: IReadDataStep);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Creates an empty step.
|
|
71
|
+
*/
|
|
72
|
+
constructor();
|
|
73
|
+
|
|
74
|
+
constructor(sourceOrInit?: FlowSourceEnum | IReadDataStep, path?: string, data?: FlowRequestDataEnum | FlowResponseDataEnum) {
|
|
75
|
+
super();
|
|
76
|
+
if (!sourceOrInit) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (typeof sourceOrInit === 'object') {
|
|
80
|
+
const typed = sourceOrInit as IReadDataStep;
|
|
81
|
+
this.new(typed);
|
|
82
|
+
} else if (typeof sourceOrInit === 'string') {
|
|
83
|
+
this.new({
|
|
84
|
+
kind: ReadDataStepKind,
|
|
85
|
+
source: sourceOrInit,
|
|
86
|
+
data,
|
|
87
|
+
path,
|
|
88
|
+
enabled: true,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
override new(init: IReadDataStep): void {
|
|
94
|
+
super.new(init);
|
|
95
|
+
this.kind = ReadDataStepKind;
|
|
96
|
+
this.source = init.source;
|
|
97
|
+
this.data = init.data;
|
|
98
|
+
this.path = init.path;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
checkValidity(): boolean {
|
|
102
|
+
const { source, path, data } = this;
|
|
103
|
+
if (!source && !path) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (source === FlowSourceEnum.variable) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return !!data;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
override toJSON(): IReadDataStep {
|
|
113
|
+
const result: IReadDataStep = {
|
|
114
|
+
...super.toJSON(),
|
|
115
|
+
kind: ReadDataStepKind,
|
|
116
|
+
};
|
|
117
|
+
if (this.source) {
|
|
118
|
+
result.source = this.source;
|
|
119
|
+
}
|
|
120
|
+
if (this.data) {
|
|
121
|
+
result.data = this.data;
|
|
122
|
+
}
|
|
123
|
+
if (this.path) {
|
|
124
|
+
result.path = this.path;
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const ReadValueStepKind = 'HttpAction#ReadValue';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads the value for a given path from the input data. This works with the `ReadDataSourceStep`.
|
|
7
|
+
*/
|
|
8
|
+
export interface IReadValueStep extends IHttpStep {
|
|
9
|
+
kind: typeof ReadValueStepKind;
|
|
10
|
+
/**
|
|
11
|
+
* The path to the data.
|
|
12
|
+
* For JSON value use https://jmespath.org/ syntax.
|
|
13
|
+
* For XML use xpath.
|
|
14
|
+
* For any other use a simple path to the data separated by dot (e.g. headers.content-type)
|
|
15
|
+
*/
|
|
16
|
+
path?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Reads the value for a given path from the input data. This works with the `ReadDataSourceStep`.
|
|
21
|
+
*/
|
|
22
|
+
export class ReadValueStep extends HttpStep {
|
|
23
|
+
override kind = ReadValueStepKind;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The path to the data.
|
|
27
|
+
* For JSON value use https://jmespath.org/ syntax.
|
|
28
|
+
* For XML use xpath.
|
|
29
|
+
* For any other use a simple path to the data separated by dot (e.g. headers.content-type)
|
|
30
|
+
*/
|
|
31
|
+
path?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates the step from values.
|
|
35
|
+
* @param path The path to the data.
|
|
36
|
+
*/
|
|
37
|
+
constructor(path: string);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates the step from serialized schema.
|
|
41
|
+
* @param init The serialized step values.
|
|
42
|
+
*/
|
|
43
|
+
constructor(init: IReadValueStep);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates an empty step.
|
|
47
|
+
*/
|
|
48
|
+
constructor();
|
|
49
|
+
|
|
50
|
+
constructor(pathOrInit?: string | IReadValueStep) {
|
|
51
|
+
super();
|
|
52
|
+
if (!pathOrInit) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (typeof pathOrInit === 'object') {
|
|
56
|
+
const typed = pathOrInit as IReadValueStep;
|
|
57
|
+
this.new(typed);
|
|
58
|
+
} else if (typeof pathOrInit === 'string') {
|
|
59
|
+
this.new({
|
|
60
|
+
kind: ReadValueStepKind,
|
|
61
|
+
path: pathOrInit,
|
|
62
|
+
enabled: true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override new(init: IReadValueStep): void {
|
|
68
|
+
super.new(init);
|
|
69
|
+
this.kind = ReadValueStepKind;
|
|
70
|
+
this.path = init.path;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
checkValidity(): boolean {
|
|
74
|
+
const { path } = this;
|
|
75
|
+
return !!path;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
override toJSON(): IReadValueStep {
|
|
79
|
+
const result: IReadValueStep = {
|
|
80
|
+
...super.toJSON(),
|
|
81
|
+
kind: ReadValueStepKind,
|
|
82
|
+
};
|
|
83
|
+
if (this.path) {
|
|
84
|
+
result.path = this.path;
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { SameSiteValue } from "../../../../cookies/CookieParser.js";
|
|
2
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
3
|
+
|
|
4
|
+
export const SetCookieStepKind = 'HttpAction#SetCookie';
|
|
5
|
+
|
|
6
|
+
export interface ISetCookieStepInit {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the cookie
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The URL associated with the cookie. When not set it uses the request URL or the request URL of the last redirect.
|
|
13
|
+
*/
|
|
14
|
+
url?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The cookie expiration time. It can be a valid cookie date or a string representing a relative time to "now"
|
|
17
|
+
* like `4d`, `600s`, etc.
|
|
18
|
+
*/
|
|
19
|
+
expires?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the cookie is host only
|
|
22
|
+
*/
|
|
23
|
+
hostOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the cookie is HTTP only
|
|
26
|
+
*/
|
|
27
|
+
httpOnly?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the cookie is HTTPS only
|
|
30
|
+
*/
|
|
31
|
+
secure?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the cookie is a session cookie
|
|
34
|
+
*/
|
|
35
|
+
session?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The SameSite parameter of the cookie.
|
|
38
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#creating_cookies
|
|
39
|
+
*/
|
|
40
|
+
sameSite?: SameSiteValue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A step that allows to set a cookie with the value returned by a previous step.
|
|
45
|
+
*/
|
|
46
|
+
export interface ISetCookieStep extends IHttpStep, ISetCookieStepInit {
|
|
47
|
+
kind: typeof SetCookieStepKind;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export class SetCookieStep extends HttpStep {
|
|
52
|
+
override kind = SetCookieStepKind;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The name of the cookie
|
|
56
|
+
*/
|
|
57
|
+
name = '';
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The URL associated with the cookie.
|
|
61
|
+
* When not set it uses the request URL or the request URL of the last redirect.
|
|
62
|
+
*/
|
|
63
|
+
url?: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The cookie expiration time. It can be a valid cookie date or a string representing a relative time to "now"
|
|
67
|
+
* like `4d`, `600s`, etc.
|
|
68
|
+
*/
|
|
69
|
+
expires?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Whether the cookie is host only
|
|
73
|
+
*/
|
|
74
|
+
hostOnly?: boolean;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether the cookie is HTTP only
|
|
78
|
+
*/
|
|
79
|
+
httpOnly?: boolean;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Whether the cookie is HTTPS only
|
|
83
|
+
*/
|
|
84
|
+
secure?: boolean;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Whether the cookie is a session cookie
|
|
88
|
+
*/
|
|
89
|
+
session?: boolean;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The SameSite parameter of the cookie.
|
|
93
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#creating_cookies
|
|
94
|
+
*/
|
|
95
|
+
sameSite?: SameSiteValue;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Creates the step from values.
|
|
99
|
+
* @param name The name of the variable to set
|
|
100
|
+
*/
|
|
101
|
+
constructor(name: string);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Creates the step from serialized schema.
|
|
105
|
+
* @param init The serialized step values.
|
|
106
|
+
*/
|
|
107
|
+
constructor(init: ISetCookieStepInit);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Creates an empty step.
|
|
111
|
+
*/
|
|
112
|
+
constructor();
|
|
113
|
+
|
|
114
|
+
constructor(nameOrInit?: string | ISetCookieStepInit) {
|
|
115
|
+
super();
|
|
116
|
+
if (!nameOrInit) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (typeof nameOrInit === 'object') {
|
|
120
|
+
const typed = nameOrInit as ISetCookieStepInit;
|
|
121
|
+
this.new({ ...typed, kind: SetCookieStepKind });
|
|
122
|
+
} else if (typeof nameOrInit === 'string') {
|
|
123
|
+
this.new({
|
|
124
|
+
kind: SetCookieStepKind,
|
|
125
|
+
name: nameOrInit,
|
|
126
|
+
enabled: true,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
override new(init: ISetCookieStep): void {
|
|
132
|
+
super.new(init);
|
|
133
|
+
this.kind = SetCookieStepKind;
|
|
134
|
+
this.name = init.name;
|
|
135
|
+
if (init.url) {
|
|
136
|
+
this.url = init.url;
|
|
137
|
+
} else {
|
|
138
|
+
this.url = undefined;
|
|
139
|
+
}
|
|
140
|
+
if (init.expires) {
|
|
141
|
+
this.expires = init.expires;
|
|
142
|
+
} else {
|
|
143
|
+
this.expires = undefined;
|
|
144
|
+
}
|
|
145
|
+
if (typeof init.hostOnly === 'boolean') {
|
|
146
|
+
this.hostOnly = init.hostOnly;
|
|
147
|
+
} else {
|
|
148
|
+
this.hostOnly = undefined;
|
|
149
|
+
}
|
|
150
|
+
if (typeof init.httpOnly === 'boolean') {
|
|
151
|
+
this.httpOnly = init.httpOnly;
|
|
152
|
+
} else {
|
|
153
|
+
this.httpOnly = undefined;
|
|
154
|
+
}
|
|
155
|
+
if (typeof init.secure === 'boolean') {
|
|
156
|
+
this.secure = init.secure;
|
|
157
|
+
} else {
|
|
158
|
+
this.secure = undefined;
|
|
159
|
+
}
|
|
160
|
+
if (typeof init.session === 'boolean') {
|
|
161
|
+
this.session = init.session;
|
|
162
|
+
} else {
|
|
163
|
+
this.session = undefined;
|
|
164
|
+
}
|
|
165
|
+
if (typeof init.sameSite === 'boolean') {
|
|
166
|
+
this.sameSite = init.sameSite;
|
|
167
|
+
} else {
|
|
168
|
+
this.sameSite = undefined;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
checkValidity(): boolean {
|
|
173
|
+
const { name } = this;
|
|
174
|
+
return !!name;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
override toJSON(): ISetCookieStep {
|
|
178
|
+
const result: ISetCookieStep = {
|
|
179
|
+
...super.toJSON(),
|
|
180
|
+
kind: SetCookieStepKind,
|
|
181
|
+
name: this.name,
|
|
182
|
+
};
|
|
183
|
+
if (this.url) {
|
|
184
|
+
result.url = this.url;
|
|
185
|
+
}
|
|
186
|
+
if (this.expires) {
|
|
187
|
+
result.expires = this.expires;
|
|
188
|
+
}
|
|
189
|
+
if (typeof this.hostOnly === 'boolean') {
|
|
190
|
+
result.hostOnly = this.hostOnly;
|
|
191
|
+
}
|
|
192
|
+
if (typeof this.httpOnly === 'boolean') {
|
|
193
|
+
result.httpOnly = this.httpOnly;
|
|
194
|
+
}
|
|
195
|
+
if (typeof this.secure === 'boolean') {
|
|
196
|
+
result.secure = this.secure;
|
|
197
|
+
}
|
|
198
|
+
if (typeof this.session === 'boolean') {
|
|
199
|
+
result.session = this.session;
|
|
200
|
+
}
|
|
201
|
+
if (typeof this.sameSite === 'boolean') {
|
|
202
|
+
result.sameSite = this.sameSite;
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
}
|