@api-client/core 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser.d.ts +14 -3
- package/build/browser.js +16 -2
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +15 -4
- package/build/index.js +17 -3
- package/build/index.js.map +1 -1
- package/build/src/data/{JmesparthReader.d.ts → JmespathReader.d.ts} +1 -1
- package/build/src/data/{JmesparthReader.js → JmespathReader.js} +2 -2
- package/build/src/data/JmespathReader.js.map +1 -0
- package/build/src/data/RequestDataExtractor.d.ts +5 -5
- package/build/src/data/RequestDataExtractor.js.map +1 -1
- package/build/src/data/XmlReader.js +14 -1
- package/build/src/data/XmlReader.js.map +1 -1
- package/build/src/events/BaseEvents.d.ts +25 -0
- package/build/src/events/Events.d.ts +1 -1
- package/build/src/events/transport/TransportEvents.d.ts +1 -1
- package/build/src/events/transport/TransportEvents.js.map +1 -1
- package/build/src/models/ClientCertificate.d.ts +9 -0
- package/build/src/models/ClientCertificate.js.map +1 -1
- package/build/src/models/Environment.d.ts +3 -2
- package/build/src/models/Environment.js +11 -6
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/ErrorResponse.js.map +1 -1
- package/build/src/models/HttpRequest.d.ts +2 -7
- package/build/src/models/HttpRequest.js +1 -6
- package/build/src/models/HttpRequest.js.map +1 -1
- package/build/src/models/HttpResponse.d.ts +2 -7
- package/build/src/models/HttpResponse.js +1 -3
- package/build/src/models/HttpResponse.js.map +1 -1
- package/build/src/models/ProjectExecution.d.ts +115 -0
- package/build/src/models/ProjectExecution.js +148 -0
- package/build/src/models/ProjectExecution.js.map +1 -0
- package/build/src/models/ProjectRequest.d.ts +19 -0
- package/build/src/models/ProjectRequest.js +50 -0
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/Request.d.ts +12 -3
- package/build/src/models/Request.js +14 -1
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/RequestAuthorization.js.map +1 -1
- package/build/src/models/RequestLog.d.ts +11 -0
- package/build/src/models/RequestLog.js +15 -1
- package/build/src/models/RequestLog.js.map +1 -1
- package/build/src/models/SerializablePayload.d.ts +6 -1
- package/build/src/models/SerializablePayload.js +10 -6
- package/build/src/models/SerializablePayload.js.map +1 -1
- package/build/src/models/http-actions/AssertionError.d.ts +36 -0
- package/build/src/models/http-actions/AssertionError.js +35 -0
- package/build/src/models/http-actions/AssertionError.js.map +1 -0
- package/build/src/models/http-actions/HttpAssertion.d.ts +84 -0
- package/build/src/models/http-actions/HttpAssertion.js +52 -0
- package/build/src/models/http-actions/HttpAssertion.js.map +1 -0
- package/build/src/models/http-actions/HttpFlows.d.ts +109 -0
- package/build/src/models/http-actions/HttpFlows.js +31 -0
- package/build/src/models/http-actions/HttpFlows.js.map +1 -0
- package/build/src/models/http-actions/HttpStep.d.ts +29 -0
- package/build/src/models/http-actions/HttpStep.js +30 -0
- package/build/src/models/http-actions/HttpStep.js.map +1 -0
- package/build/src/models/http-actions/LegacyTranslator.d.ts +8 -7
- package/build/src/models/http-actions/LegacyTranslator.js +18 -13
- package/build/src/models/http-actions/LegacyTranslator.js.map +1 -1
- package/build/src/models/http-actions/steps/assertion/EqualAssertion.d.ts +76 -0
- package/build/src/models/http-actions/steps/assertion/EqualAssertion.js +79 -0
- package/build/src/models/http-actions/steps/assertion/EqualAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.d.ts +36 -0
- package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.js +59 -0
- package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/IncludesAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/IncludesAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/IncludesAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/LessThanAssertion.d.ts +36 -0
- package/build/src/models/http-actions/steps/assertion/LessThanAssertion.js +59 -0
- package/build/src/models/http-actions/steps/assertion/LessThanAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/MatchesAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/MatchesAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/MatchesAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.d.ts +36 -0
- package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.js +59 -0
- package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.d.ts +76 -0
- package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.js +79 -0
- package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.d.ts +28 -0
- package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotOkAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/NotOkAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/NotOkAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.d.ts +29 -0
- package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.js +45 -0
- package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/OkAssertion.d.ts +18 -0
- package/build/src/models/http-actions/steps/assertion/OkAssertion.js +29 -0
- package/build/src/models/http-actions/steps/assertion/OkAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/ToBeAssertion.d.ts +35 -0
- package/build/src/models/http-actions/steps/assertion/ToBeAssertion.js +53 -0
- package/build/src/models/http-actions/steps/assertion/ToBeAssertion.js.map +1 -0
- package/build/src/models/http-actions/steps/assertion/index.d.ts +15 -0
- package/build/src/models/http-actions/steps/assertion/index.js +16 -0
- package/build/src/models/http-actions/steps/assertion/index.js.map +1 -0
- package/build/src/models/http-actions/steps/data/DeleteCookieStep.d.ts +44 -0
- package/build/src/models/http-actions/steps/data/DeleteCookieStep.js +67 -0
- package/build/src/models/http-actions/steps/data/DeleteCookieStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/ReadDataSourceStep.d.ts +53 -0
- package/build/src/models/http-actions/steps/data/ReadDataSourceStep.js +60 -0
- package/build/src/models/http-actions/steps/data/ReadDataSourceStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/ReadDataStep.d.ts +67 -0
- package/build/src/models/http-actions/steps/data/ReadDataStep.js +77 -0
- package/build/src/models/http-actions/steps/data/ReadDataStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/ReadValueStep.d.ts +45 -0
- package/build/src/models/http-actions/steps/data/ReadValueStep.js +52 -0
- package/build/src/models/http-actions/steps/data/ReadValueStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/SetCookieStep.d.ts +100 -0
- package/build/src/models/http-actions/steps/data/SetCookieStep.js +138 -0
- package/build/src/models/http-actions/steps/data/SetCookieStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/SetDataStep.d.ts +77 -0
- package/build/src/models/http-actions/steps/data/SetDataStep.js +69 -0
- package/build/src/models/http-actions/steps/data/SetDataStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/SetVariableStep.d.ts +40 -0
- package/build/src/models/http-actions/steps/data/SetVariableStep.js +44 -0
- package/build/src/models/http-actions/steps/data/SetVariableStep.js.map +1 -0
- package/build/src/models/http-actions/steps/data/index.d.ts +7 -0
- package/build/src/models/http-actions/steps/data/index.js +8 -0
- package/build/src/models/http-actions/steps/data/index.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.d.ts +18 -0
- package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.js +29 -0
- package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/AsNumberStep.d.ts +18 -0
- package/build/src/models/http-actions/steps/transformation/AsNumberStep.js +29 -0
- package/build/src/models/http-actions/steps/transformation/AsNumberStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.d.ts +18 -0
- package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.js +29 -0
- package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/RoundStep.d.ts +43 -0
- package/build/src/models/http-actions/steps/transformation/RoundStep.js +52 -0
- package/build/src/models/http-actions/steps/transformation/RoundStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/SubstringStep.d.ts +38 -0
- package/build/src/models/http-actions/steps/transformation/SubstringStep.js +65 -0
- package/build/src/models/http-actions/steps/transformation/SubstringStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/TrimStep.d.ts +20 -0
- package/build/src/models/http-actions/steps/transformation/TrimStep.js +30 -0
- package/build/src/models/http-actions/steps/transformation/TrimStep.js.map +1 -0
- package/build/src/models/http-actions/steps/transformation/index.d.ts +6 -0
- package/build/src/models/http-actions/steps/transformation/index.js +7 -0
- package/build/src/models/http-actions/steps/transformation/index.js.map +1 -0
- package/build/src/proxy/HttpProjectProxy.d.ts +1 -1
- package/build/src/proxy/Proxy.d.ts +1 -1
- package/build/src/proxy/ProxyService.d.ts +1 -1
- package/build/src/proxy/RequestProxy.d.ts +7 -2
- package/build/src/proxy/RequestProxy.js +4 -1
- package/build/src/proxy/RequestProxy.js.map +1 -1
- package/build/src/runtime/http-runner/ConditionCheck.d.ts +10 -10
- package/build/src/runtime/http-runner/ConditionCheck.js.map +1 -1
- package/build/src/runtime/http-runner/HttpAssertionRunner.d.ts +75 -0
- package/build/src/runtime/http-runner/HttpAssertionRunner.js +538 -0
- package/build/src/runtime/http-runner/HttpAssertionRunner.js.map +1 -0
- package/build/src/runtime/http-runner/HttpFlowRunner.d.ts +11 -6
- package/build/src/runtime/http-runner/HttpFlowRunner.js +24 -15
- package/build/src/runtime/http-runner/HttpFlowRunner.js.map +1 -1
- package/build/src/runtime/http-runner/HttpRequestRunner.d.ts +14 -3
- package/build/src/runtime/http-runner/HttpRequestRunner.js +44 -0
- package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -1
- package/build/src/runtime/node/BaseRunner.d.ts +1 -1
- package/build/src/runtime/node/ProjectParallelRunner.d.ts +2 -2
- package/build/src/runtime/node/ProjectParallelRunner.js +2 -2
- package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.js +6 -2
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts +1 -1
- package/build/src/runtime/node/ProjectSerialRunner.d.ts +1 -1
- package/build/src/runtime/reporters/Reporter.d.ts +1 -33
- package/build/src/runtime/reporters/Reporter.js.map +1 -1
- package/build/src/runtime/store/interfaces/ApiClientStore.d.ts +2 -0
- package/build/src/runtime/store/interfaces/ProjectRuns.d.ts +56 -0
- package/build/src/runtime/store/interfaces/ProjectRuns.js +2 -0
- package/build/src/runtime/store/interfaces/ProjectRuns.js.map +1 -0
- package/package.json +3 -2
- package/src/data/{JmesparthReader.ts → JmespathReader.ts} +2 -2
- package/src/data/RequestDataExtractor.ts +5 -5
- package/src/data/XmlReader.ts +16 -2
- package/src/events/BaseEvents.ts +30 -0
- package/src/events/transport/TransportEvents.ts +1 -1
- package/src/models/ClientCertificate.ts +9 -0
- package/src/models/Environment.ts +11 -7
- package/src/models/ErrorResponse.ts +1 -1
- package/src/models/HttpRequest.ts +4 -14
- package/src/models/HttpResponse.ts +5 -11
- package/src/models/ProjectExecution.ts +227 -0
- package/src/models/ProjectRequest.ts +54 -0
- package/src/models/Request.ts +23 -4
- package/src/models/RequestAuthorization.ts +1 -1
- package/src/models/RequestLog.ts +21 -1
- package/src/models/SerializablePayload.ts +18 -1
- package/src/models/http-actions/AssertionError.ts +57 -0
- package/src/models/http-actions/HttpAssertion.ts +89 -0
- package/src/models/http-actions/HttpFlows.ts +115 -0
- package/src/models/http-actions/HttpStep.ts +50 -0
- package/src/models/http-actions/LegacyTranslator.ts +42 -30
- package/src/models/http-actions/steps/assertion/EqualAssertion.ts +130 -0
- package/src/models/http-actions/steps/assertion/GreaterThanAssertion.ts +87 -0
- package/src/models/http-actions/steps/assertion/IncludesAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/IsEmptyAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/LengthOfAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/LessThanAssertion.ts +87 -0
- package/src/models/http-actions/steps/assertion/MatchesAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.ts +85 -0
- package/src/models/http-actions/steps/assertion/NotEqualAssertion.ts +130 -0
- package/src/models/http-actions/steps/assertion/NotIncludesAssertion.ts +68 -0
- package/src/models/http-actions/steps/assertion/NotOkAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/NotToBeAssertion.ts +69 -0
- package/src/models/http-actions/steps/assertion/OkAssertion.ts +41 -0
- package/src/models/http-actions/steps/assertion/ToBeAssertion.ts +76 -0
- package/src/models/http-actions/steps/data/DeleteCookieStep.ts +102 -0
- package/src/models/http-actions/steps/data/ReadDataSourceStep.ts +103 -0
- package/src/models/http-actions/steps/data/ReadDataStep.ts +128 -0
- package/src/models/http-actions/steps/data/ReadValueStep.ts +88 -0
- package/src/models/http-actions/steps/data/SetCookieStep.ts +206 -0
- package/src/models/http-actions/steps/data/SetDataStep.ts +124 -0
- package/src/models/http-actions/steps/data/SetVariableStep.ts +82 -0
- package/src/models/http-actions/steps/transformation/AsLowerCaseStep.ts +41 -0
- package/src/models/http-actions/steps/transformation/AsNumberStep.ts +41 -0
- package/src/models/http-actions/steps/transformation/AsUpperCaseStep.ts +41 -0
- package/src/models/http-actions/steps/transformation/RoundStep.ts +86 -0
- package/src/models/http-actions/steps/transformation/SubstringStep.ts +93 -0
- package/src/models/http-actions/steps/transformation/TrimStep.ts +43 -0
- package/src/proxy/HttpProjectProxy.ts +1 -1
- package/src/proxy/Proxy.ts +1 -1
- package/src/proxy/ProxyService.ts +1 -1
- package/src/proxy/RequestProxy.ts +11 -3
- package/src/runtime/http-runner/ConditionCheck.ts +13 -14
- package/src/runtime/http-runner/HttpAssertionRunner.ts +540 -0
- package/src/runtime/http-runner/HttpFlowRunner.ts +33 -19
- package/src/runtime/http-runner/HttpRequestRunner.ts +53 -5
- package/src/runtime/node/BaseRunner.ts +1 -1
- package/src/runtime/node/ProjectParallelRunner.ts +5 -5
- package/src/runtime/node/ProjectRequestRunner.ts +6 -2
- package/src/runtime/node/ProjectRunner.ts +1 -1
- package/src/runtime/node/ProjectRunnerWorker.ts +1 -1
- package/src/runtime/node/ProjectSerialRunner.ts +1 -1
- package/src/runtime/reporters/Reporter.ts +1 -35
- package/src/runtime/store/interfaces/ApiClientStore.ts +3 -0
- package/src/runtime/store/interfaces/ProjectRuns.ts +64 -0
- package/build/src/data/JmesparthReader.js.map +0 -1
- package/build/src/models/http-actions/HttpActions.d.ts +0 -256
- package/build/src/models/http-actions/HttpActions.js +0 -46
- package/build/src/models/http-actions/HttpActions.js.map +0 -1
- package/src/models/http-actions/HttpActions.ts +0 -270
|
@@ -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
|
+
}
|
|
@@ -5,7 +5,7 @@ import { StoreSdk } from "../runtime/store/StoreSdkNode.js";
|
|
|
5
5
|
import { ProjectSerialRunner } from "../runtime/node/ProjectSerialRunner.js";
|
|
6
6
|
import { ProjectParallelRunner } from "../runtime/node/ProjectParallelRunner.js";
|
|
7
7
|
import Proxy, { IProxyResult } from "./Proxy.js";
|
|
8
|
-
import { IProjectExecutionLog } from "../
|
|
8
|
+
import { IProjectExecutionLog } from "../models/ProjectExecution.js";
|
|
9
9
|
|
|
10
10
|
interface ProxyInit {
|
|
11
11
|
kind: typeof HttpProjectKind;
|
package/src/proxy/Proxy.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRequestLog } from "../models/RequestLog.js";
|
|
2
|
-
import { IProjectExecutionLog } from "../
|
|
2
|
+
import { IProjectExecutionLog } from "../models/ProjectExecution.js";
|
|
3
3
|
|
|
4
4
|
export interface IProxyResult<T = IProjectExecutionLog | IRequestLog> {
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IProjectExecutionLog } from "../
|
|
1
|
+
import { IProjectExecutionLog } from "../models/ProjectExecution.js";
|
|
2
2
|
import { IRequestLog } from "../models/RequestLog.js";
|
|
3
3
|
import HttpProjectProxy, { IHttpProjectProxyInit, IHttpProjectStoreProxyInit } from "./HttpProjectProxy.js";
|
|
4
4
|
import { IProxyResult } from "./Proxy.js";
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { ActionOperatorEnum } from '../../models/http-actions/HttpActions.js';
|
|
1
|
+
import { AssertionEnum } from "../../models/http-actions/HttpAssertion";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Checks if values equal.
|
|
@@ -7,7 +6,7 @@ import { ActionOperatorEnum } from '../../models/http-actions/HttpActions.js';
|
|
|
7
6
|
* @param condition Comparator value
|
|
8
7
|
* @returns True if objects matches.
|
|
9
8
|
*/
|
|
10
|
-
export function isEqual(value:
|
|
9
|
+
export function isEqual(value: unknown, condition: unknown): boolean {
|
|
11
10
|
if (value === condition || String(value) === String(condition)) {
|
|
12
11
|
return true;
|
|
13
12
|
}
|
|
@@ -34,7 +33,7 @@ export function isEqual(value: any, condition: any): boolean {
|
|
|
34
33
|
* @param condition Comparator value
|
|
35
34
|
* @return False if objects matches.
|
|
36
35
|
*/
|
|
37
|
-
export function isNotEqual(value:
|
|
36
|
+
export function isNotEqual(value: unknown, condition: unknown): boolean {
|
|
38
37
|
return !isEqual(value, condition);
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -45,7 +44,7 @@ export function isNotEqual(value: any, condition: any): boolean {
|
|
|
45
44
|
* @param condition Comparator value
|
|
46
45
|
* @returns True if value is less than condition.
|
|
47
46
|
*/
|
|
48
|
-
export function isLessThan(value:
|
|
47
|
+
export function isLessThan(value: unknown, condition: unknown): boolean {
|
|
49
48
|
const valueNumber = Number(value);
|
|
50
49
|
if (Number.isNaN(valueNumber)) {
|
|
51
50
|
return false;
|
|
@@ -64,7 +63,7 @@ export function isLessThan(value: any, condition: any): boolean {
|
|
|
64
63
|
* @param condition Comparator value
|
|
65
64
|
* @returns True if value is less than or equal to `condition`.
|
|
66
65
|
*/
|
|
67
|
-
export function isLessThanEqual(value:
|
|
66
|
+
export function isLessThanEqual(value: unknown, condition: unknown): boolean {
|
|
68
67
|
const valueNumber = Number(value);
|
|
69
68
|
if (Number.isNaN(valueNumber)) {
|
|
70
69
|
return false;
|
|
@@ -83,7 +82,7 @@ export function isLessThanEqual(value: any, condition: any): boolean {
|
|
|
83
82
|
* @param condition Comparator value
|
|
84
83
|
* @returns True if value is greater than `condition`.
|
|
85
84
|
*/
|
|
86
|
-
export function isGreaterThan(value:
|
|
85
|
+
export function isGreaterThan(value: unknown, condition: unknown): boolean {
|
|
87
86
|
const valueNumber = Number(value);
|
|
88
87
|
if (Number.isNaN(valueNumber)) {
|
|
89
88
|
return false;
|
|
@@ -102,7 +101,7 @@ export function isGreaterThan(value: any, condition: any): boolean {
|
|
|
102
101
|
* @param condition Comparator value
|
|
103
102
|
* @returns True if value is greater than or equal to `condition`.
|
|
104
103
|
*/
|
|
105
|
-
export function isGreaterThanEqual(value:
|
|
104
|
+
export function isGreaterThanEqual(value: unknown, condition: unknown): boolean {
|
|
106
105
|
const valueNumber = Number(value);
|
|
107
106
|
if (Number.isNaN(valueNumber)) {
|
|
108
107
|
return false;
|
|
@@ -122,12 +121,12 @@ export function isGreaterThanEqual(value: any, condition: any): boolean {
|
|
|
122
121
|
* @param condition Comparator value
|
|
123
122
|
* @returns True if value contains the `condition`.
|
|
124
123
|
*/
|
|
125
|
-
export function contains(value:
|
|
124
|
+
export function contains(value: unknown, condition: unknown): boolean {
|
|
126
125
|
if (!value) {
|
|
127
126
|
return false;
|
|
128
127
|
}
|
|
129
128
|
if (typeof value === 'string') {
|
|
130
|
-
return value.indexOf(condition) !== -1;
|
|
129
|
+
return value.indexOf(condition as string) !== -1;
|
|
131
130
|
}
|
|
132
131
|
if (Array.isArray(value)) {
|
|
133
132
|
if (!Number.isNaN(condition) && typeof condition !== 'number') {
|
|
@@ -141,7 +140,7 @@ export function contains(value: any, condition: any): boolean {
|
|
|
141
140
|
if (typeof value !== 'object') {
|
|
142
141
|
return false;
|
|
143
142
|
}
|
|
144
|
-
return condition in value;
|
|
143
|
+
return (condition as string) in value;
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
/**
|
|
@@ -151,10 +150,10 @@ export function contains(value: any, condition: any): boolean {
|
|
|
151
150
|
* @param condition Comparator value - regex string.
|
|
152
151
|
* @returns Value of calling `test()` function on string.
|
|
153
152
|
*/
|
|
154
|
-
export function isRegex(value:
|
|
153
|
+
export function isRegex(value: unknown, condition: unknown): boolean {
|
|
155
154
|
let re;
|
|
156
155
|
try {
|
|
157
|
-
re = new RegExp(condition, 'm');
|
|
156
|
+
re = new RegExp(condition as string, 'm');
|
|
158
157
|
} catch (e) {
|
|
159
158
|
return false;
|
|
160
159
|
}
|
|
@@ -170,7 +169,7 @@ export function isRegex(value: any, condition: any): boolean {
|
|
|
170
169
|
* @param condition Value to compare.
|
|
171
170
|
* @returns True if the condition is satisfied and false otherwise.
|
|
172
171
|
*/
|
|
173
|
-
export function checkCondition(value:
|
|
172
|
+
export function checkCondition(value: unknown, operator: AssertionEnum, condition: string | undefined): boolean {
|
|
174
173
|
switch (operator) {
|
|
175
174
|
case 'equal':
|
|
176
175
|
return isEqual(value, condition);
|