@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,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The action that can be taken on the data.
|
|
3
|
+
*/
|
|
4
|
+
export interface IHttpStep {
|
|
5
|
+
/**
|
|
6
|
+
* The kind of the action to perform.
|
|
7
|
+
*/
|
|
8
|
+
kind: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the step is disabled in the flow.
|
|
11
|
+
*/
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export abstract class HttpStep {
|
|
16
|
+
/**
|
|
17
|
+
* The kind of the action to perform.
|
|
18
|
+
*/
|
|
19
|
+
kind = '';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether the step is disabled in the flow.
|
|
23
|
+
*/
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
|
|
26
|
+
new(init: IHttpStep): void {
|
|
27
|
+
const { kind, enabled } = init;
|
|
28
|
+
this.kind = kind;
|
|
29
|
+
if (typeof enabled === 'boolean') {
|
|
30
|
+
this.enabled = enabled
|
|
31
|
+
} else {
|
|
32
|
+
this.enabled = undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
toJSON(): IHttpStep {
|
|
37
|
+
const result: IHttpStep = {
|
|
38
|
+
kind: this.kind,
|
|
39
|
+
}
|
|
40
|
+
if (typeof this.enabled === 'boolean') {
|
|
41
|
+
result.enabled = this.enabled;
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A function that returns true when the step is valid and can be executed.
|
|
48
|
+
*/
|
|
49
|
+
abstract checkValidity(): boolean;
|
|
50
|
+
}
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { RequestActions as LegacyRequestActions } from '../../models/legacy/request/ArcRequest.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
RunnableAction as LegacyRunnable, Condition as LegacyCondition, Action as LegacyAction,
|
|
4
|
+
SetCookieConfig, SetVariableConfig, DeleteCookieConfig, DataSourceConfiguration
|
|
5
|
+
} from '../../models/legacy/actions/Actions.js';
|
|
6
|
+
import {
|
|
7
|
+
IHttpFlow, IHttpAction, IHttpCondition, FlowSourceEnum, FlowRequestDataEnum,
|
|
8
|
+
FlowResponseDataEnum,
|
|
9
|
+
} from './HttpFlows.js';
|
|
4
10
|
import { AmfNamespace } from '../../amf/definitions/Namespace.js';
|
|
11
|
+
import { AssertionEnum } from './HttpAssertion.js';
|
|
12
|
+
import { IHttpStep } from './HttpStep.js';
|
|
13
|
+
import { IReadDataStep, ReadDataStepKind } from './steps/data/ReadDataStep.js';
|
|
14
|
+
import { ISetDataStep, SetDataStepKind } from './steps/data/SetDataStep.js';
|
|
15
|
+
import { ISetCookieStep, SetCookieStepKind } from './steps/data/SetCookieStep.js';
|
|
16
|
+
import { DeleteCookieStepKind, IDeleteCookieStep } from './steps/data/DeleteCookieStep.js';
|
|
5
17
|
|
|
6
18
|
/**
|
|
7
19
|
* Allows to translate the old ARC actions into Action flows.
|
|
8
20
|
*/
|
|
9
21
|
export class LegacyTranslator {
|
|
10
|
-
static translate(action: LegacyRequestActions):
|
|
22
|
+
static translate(action: LegacyRequestActions): IHttpFlow[] {
|
|
11
23
|
const { request, response } = action;
|
|
12
|
-
const result:
|
|
24
|
+
const result: IHttpFlow[] = [];
|
|
13
25
|
|
|
14
26
|
if (Array.isArray(request) && request.length) {
|
|
15
|
-
const flow:
|
|
27
|
+
const flow: IHttpFlow = {
|
|
16
28
|
trigger: 'request',
|
|
17
29
|
actions: this._translateRunnables(request),
|
|
18
30
|
};
|
|
@@ -20,7 +32,7 @@ export class LegacyTranslator {
|
|
|
20
32
|
}
|
|
21
33
|
|
|
22
34
|
if (Array.isArray(response) && response.length) {
|
|
23
|
-
const flow:
|
|
35
|
+
const flow: IHttpFlow = {
|
|
24
36
|
trigger: 'response',
|
|
25
37
|
actions: this._translateRunnables(response),
|
|
26
38
|
};
|
|
@@ -66,16 +78,16 @@ export class LegacyTranslator {
|
|
|
66
78
|
}
|
|
67
79
|
if (type) {
|
|
68
80
|
switch (type) {
|
|
69
|
-
case 'request': result.source =
|
|
70
|
-
case 'response': result.source =
|
|
81
|
+
case 'request': result.source = FlowSourceEnum.request; break;
|
|
82
|
+
case 'response': result.source = FlowSourceEnum.response; break;
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
if (type && source) {
|
|
74
86
|
if (type === 'request') {
|
|
75
|
-
result.data = source as
|
|
87
|
+
result.data = source as FlowRequestDataEnum;
|
|
76
88
|
}
|
|
77
89
|
if (type === 'response') {
|
|
78
|
-
result.data = source as
|
|
90
|
+
result.data = source as FlowResponseDataEnum;
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
if (predictedValue) {
|
|
@@ -83,20 +95,20 @@ export class LegacyTranslator {
|
|
|
83
95
|
}
|
|
84
96
|
if (operator) {
|
|
85
97
|
switch (operator) {
|
|
86
|
-
case 'contains': result.operator =
|
|
87
|
-
case 'equal': result.operator =
|
|
88
|
-
case 'greater-than': result.operator =
|
|
89
|
-
case 'greater-than-equal': result.operator =
|
|
90
|
-
case 'less-than': result.operator =
|
|
91
|
-
case 'less-than-equal': result.operator =
|
|
92
|
-
case 'not-equal': result.operator =
|
|
93
|
-
case 'regex': result.operator =
|
|
98
|
+
case 'contains': result.operator = AssertionEnum.contains; break;
|
|
99
|
+
case 'equal': result.operator = AssertionEnum.equal; break;
|
|
100
|
+
case 'greater-than': result.operator = AssertionEnum.greaterThan; break;
|
|
101
|
+
case 'greater-than-equal': result.operator = AssertionEnum.greaterThanEqual; break;
|
|
102
|
+
case 'less-than': result.operator = AssertionEnum.lessThan; break;
|
|
103
|
+
case 'less-than-equal': result.operator = AssertionEnum.lessThanEqual; break;
|
|
104
|
+
case 'not-equal': result.operator = AssertionEnum.notEqual; break;
|
|
105
|
+
case 'regex': result.operator = AssertionEnum.regex; break;
|
|
94
106
|
}
|
|
95
107
|
}
|
|
96
108
|
return result;
|
|
97
109
|
}
|
|
98
110
|
|
|
99
|
-
protected static _translateAction(item: LegacyAction):
|
|
111
|
+
protected static _translateAction(item: LegacyAction): IHttpStep[] {
|
|
100
112
|
switch (item.name) {
|
|
101
113
|
case 'set-cookie': return this._translateSetCookieAction(item);
|
|
102
114
|
case 'set-variable': return this._translateSetVariableAction(item);
|
|
@@ -105,10 +117,10 @@ export class LegacyTranslator {
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
|
|
108
|
-
protected static _translateSetCookieAction(item: LegacyAction):
|
|
120
|
+
protected static _translateSetCookieAction(item: LegacyAction): IHttpStep[] {
|
|
109
121
|
const legacy = item.config as SetCookieConfig;
|
|
110
122
|
|
|
111
|
-
const steps:
|
|
123
|
+
const steps: IHttpStep[] = [];
|
|
112
124
|
const ds = this._translateDataSource(legacy.source);
|
|
113
125
|
steps.push(ds);
|
|
114
126
|
|
|
@@ -142,10 +154,10 @@ export class LegacyTranslator {
|
|
|
142
154
|
return steps;
|
|
143
155
|
}
|
|
144
156
|
|
|
145
|
-
protected static _translateSetVariableAction(item: LegacyAction):
|
|
157
|
+
protected static _translateSetVariableAction(item: LegacyAction): IHttpStep[] {
|
|
146
158
|
const legacy = item.config as SetVariableConfig;
|
|
147
159
|
|
|
148
|
-
const steps:
|
|
160
|
+
const steps: IHttpStep[] = [];
|
|
149
161
|
const ds = this._translateDataSource(legacy.source);
|
|
150
162
|
steps.push(ds);
|
|
151
163
|
|
|
@@ -161,10 +173,10 @@ export class LegacyTranslator {
|
|
|
161
173
|
return steps;
|
|
162
174
|
}
|
|
163
175
|
|
|
164
|
-
protected static _translateDeleteCookieAction(item: LegacyAction):
|
|
176
|
+
protected static _translateDeleteCookieAction(item: LegacyAction): IHttpStep[] {
|
|
165
177
|
const legacy = item.config as DeleteCookieConfig;
|
|
166
178
|
|
|
167
|
-
const steps:
|
|
179
|
+
const steps: IHttpStep[] = [];
|
|
168
180
|
|
|
169
181
|
const action: IDeleteCookieStep = {
|
|
170
182
|
kind: DeleteCookieStepKind,
|
|
@@ -183,7 +195,7 @@ export class LegacyTranslator {
|
|
|
183
195
|
return steps;
|
|
184
196
|
}
|
|
185
197
|
|
|
186
|
-
protected static _translateDataSource(source: DataSourceConfiguration):
|
|
198
|
+
protected static _translateDataSource(source: DataSourceConfiguration): IHttpStep {
|
|
187
199
|
if (source.value) {
|
|
188
200
|
const dataSet: ISetDataStep = {
|
|
189
201
|
kind: SetDataStepKind,
|
|
@@ -206,16 +218,16 @@ export class LegacyTranslator {
|
|
|
206
218
|
}
|
|
207
219
|
if (type) {
|
|
208
220
|
switch (type) {
|
|
209
|
-
case 'request': result.source =
|
|
210
|
-
case 'response': result.source =
|
|
221
|
+
case 'request': result.source = FlowSourceEnum.request; break;
|
|
222
|
+
case 'response': result.source = FlowSourceEnum.response; break;
|
|
211
223
|
}
|
|
212
224
|
}
|
|
213
225
|
if (type && legacySource) {
|
|
214
226
|
if (type === 'request') {
|
|
215
|
-
result.data = legacySource as
|
|
227
|
+
result.data = legacySource as FlowRequestDataEnum;
|
|
216
228
|
}
|
|
217
229
|
if (type === 'response') {
|
|
218
|
-
result.data = legacySource as
|
|
230
|
+
result.data = legacySource as FlowResponseDataEnum;
|
|
219
231
|
}
|
|
220
232
|
}
|
|
221
233
|
return result;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const EqualAssertionKind = 'HttpAction#EqualAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input value is [strict] equal to the set value.
|
|
7
|
+
*/
|
|
8
|
+
export interface IEqualAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof EqualAssertionKind;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The value to compare to.
|
|
13
|
+
* This is always a string. Use the `dataType` to determine the correct data type.
|
|
14
|
+
*/
|
|
15
|
+
value?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The data type of the value. This is a value prefixed with
|
|
19
|
+
* `http://www.w3.org/2001/XMLSchema#` or `http://a.ml/vocabularies/shapes#`.
|
|
20
|
+
*
|
|
21
|
+
* Examples:
|
|
22
|
+
*
|
|
23
|
+
* - `http://www.w3.org/2001/XMLSchema#boolean`
|
|
24
|
+
* - `http://www.w3.org/2001/XMLSchema#string`
|
|
25
|
+
* - `http://www.w3.org/2001/XMLSchema#number`
|
|
26
|
+
* - `http://www.w3.org/2001/XMLSchema#integer`
|
|
27
|
+
* - `http://www.w3.org/2001/XMLSchema#long`
|
|
28
|
+
* - `http://a.ml/vocabularies/shapes#number`
|
|
29
|
+
* - `http://a.ml/vocabularies/shapes#integer`
|
|
30
|
+
* - `http://a.ml/vocabularies/shapes#double`
|
|
31
|
+
* - ...
|
|
32
|
+
*
|
|
33
|
+
* @default `http://www.w3.org/2001/XMLSchema#string`
|
|
34
|
+
*/
|
|
35
|
+
dataType?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether it should check for a value and the data type.
|
|
39
|
+
*/
|
|
40
|
+
strict?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* An assertion that makes sure the input value is [strict] equal to the set value.
|
|
45
|
+
*/
|
|
46
|
+
export class EqualAssertion extends HttpStep {
|
|
47
|
+
override kind = EqualAssertionKind;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The value to compare to.
|
|
51
|
+
* This is always a string. Use the `dataType` to determine the correct data type.
|
|
52
|
+
*/
|
|
53
|
+
value?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The data type of the value. This is a value prefixed with
|
|
57
|
+
* `http://www.w3.org/2001/XMLSchema#` or `http://a.ml/vocabularies/shapes#`.
|
|
58
|
+
*
|
|
59
|
+
* Examples:
|
|
60
|
+
*
|
|
61
|
+
* - `http://www.w3.org/2001/XMLSchema#boolean`
|
|
62
|
+
* - `http://www.w3.org/2001/XMLSchema#string`
|
|
63
|
+
* - `http://www.w3.org/2001/XMLSchema#number`
|
|
64
|
+
* - `http://www.w3.org/2001/XMLSchema#integer`
|
|
65
|
+
* - `http://www.w3.org/2001/XMLSchema#long`
|
|
66
|
+
* - `http://a.ml/vocabularies/shapes#number`
|
|
67
|
+
* - `http://a.ml/vocabularies/shapes#integer`
|
|
68
|
+
* - `http://a.ml/vocabularies/shapes#double`
|
|
69
|
+
* - ...
|
|
70
|
+
*
|
|
71
|
+
* @default `http://www.w3.org/2001/XMLSchema#string`
|
|
72
|
+
*/
|
|
73
|
+
dataType?: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Whether it should check for a value and the data type.
|
|
77
|
+
*/
|
|
78
|
+
strict?: boolean;
|
|
79
|
+
|
|
80
|
+
constructor(value: string, strict?: boolean, dataType?: string);
|
|
81
|
+
|
|
82
|
+
constructor(init: IEqualAssertion);
|
|
83
|
+
|
|
84
|
+
constructor();
|
|
85
|
+
|
|
86
|
+
constructor(valueOrInit?: IEqualAssertion | string, strict?: boolean, dataType?: string) {
|
|
87
|
+
super();
|
|
88
|
+
if (typeof valueOrInit === 'object') {
|
|
89
|
+
const typed = valueOrInit as IEqualAssertion;
|
|
90
|
+
this.new(typed);
|
|
91
|
+
} else if (typeof valueOrInit === 'string') {
|
|
92
|
+
this.new({
|
|
93
|
+
kind: EqualAssertionKind,
|
|
94
|
+
value: valueOrInit,
|
|
95
|
+
dataType,
|
|
96
|
+
strict,
|
|
97
|
+
enabled: true,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
override new(init: IEqualAssertion): void {
|
|
103
|
+
super.new(init);
|
|
104
|
+
this.kind = EqualAssertionKind;
|
|
105
|
+
this.value = init.value;
|
|
106
|
+
this.dataType = init.dataType;
|
|
107
|
+
this.strict = init.strict;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
checkValidity(): boolean {
|
|
111
|
+
return !!this.value;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
override toJSON(): IEqualAssertion {
|
|
115
|
+
const result: IEqualAssertion = {
|
|
116
|
+
...super.toJSON(),
|
|
117
|
+
kind: EqualAssertionKind,
|
|
118
|
+
};
|
|
119
|
+
if (this.value) {
|
|
120
|
+
result.value = this.value;
|
|
121
|
+
}
|
|
122
|
+
if (this.dataType) {
|
|
123
|
+
result.dataType = this.dataType;
|
|
124
|
+
}
|
|
125
|
+
if (typeof this.strict === 'boolean') {
|
|
126
|
+
result.strict = this.strict;
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const GreaterThanAssertionKind = 'HttpAction#GreaterThanAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input value is greater [or equal] to the set value.
|
|
7
|
+
*/
|
|
8
|
+
export interface IGreaterThanAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof GreaterThanAssertionKind;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The value to compare to.
|
|
13
|
+
*/
|
|
14
|
+
value?: number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* When set it treats the assertion as "greater than or equal"
|
|
18
|
+
*/
|
|
19
|
+
equal?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* An assertion that makes sure the input value is greater [or equal] to the set value.
|
|
24
|
+
*/
|
|
25
|
+
export class GreaterThanAssertion extends HttpStep {
|
|
26
|
+
override kind = GreaterThanAssertionKind;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The value to compare to.
|
|
30
|
+
*/
|
|
31
|
+
value?: number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* When set it treats the assertion as "greater than or equal"
|
|
35
|
+
*/
|
|
36
|
+
equal?: boolean;
|
|
37
|
+
|
|
38
|
+
constructor(value: number, equal?: boolean);
|
|
39
|
+
|
|
40
|
+
constructor(init: IGreaterThanAssertion);
|
|
41
|
+
|
|
42
|
+
constructor();
|
|
43
|
+
|
|
44
|
+
constructor(valueOrInit?: IGreaterThanAssertion | number, equal?: boolean) {
|
|
45
|
+
super();
|
|
46
|
+
if (typeof valueOrInit === 'object') {
|
|
47
|
+
const typed = valueOrInit as IGreaterThanAssertion;
|
|
48
|
+
this.new(typed);
|
|
49
|
+
} else if (typeof valueOrInit === 'number') {
|
|
50
|
+
this.new({
|
|
51
|
+
kind: GreaterThanAssertionKind,
|
|
52
|
+
value: valueOrInit,
|
|
53
|
+
equal,
|
|
54
|
+
enabled: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
override new(init: IGreaterThanAssertion): void {
|
|
60
|
+
super.new(init);
|
|
61
|
+
this.kind = GreaterThanAssertionKind;
|
|
62
|
+
this.value = init.value;
|
|
63
|
+
if (typeof init.equal === 'boolean') {
|
|
64
|
+
this.equal = init.equal;
|
|
65
|
+
} else {
|
|
66
|
+
this.equal = undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
checkValidity(): boolean {
|
|
71
|
+
return typeof this.value === 'number';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
override toJSON(): IGreaterThanAssertion {
|
|
75
|
+
const result: IGreaterThanAssertion = {
|
|
76
|
+
...super.toJSON(),
|
|
77
|
+
kind: GreaterThanAssertionKind,
|
|
78
|
+
};
|
|
79
|
+
if (typeof this.value === 'number') {
|
|
80
|
+
result.value = this.value;
|
|
81
|
+
}
|
|
82
|
+
if (typeof this.equal === 'boolean') {
|
|
83
|
+
result.equal = this.equal;
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const IncludesAssertionKind = 'HttpAction#IncludesAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input includes the set value.
|
|
7
|
+
*/
|
|
8
|
+
export interface IIncludesAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof IncludesAssertionKind;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The value to search for.
|
|
13
|
+
*/
|
|
14
|
+
value?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An assertion that makes sure the input includes the set value.
|
|
19
|
+
*/
|
|
20
|
+
export class IncludesAssertion extends HttpStep {
|
|
21
|
+
override kind = IncludesAssertionKind;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The value to search for.
|
|
25
|
+
*/
|
|
26
|
+
value?: string;
|
|
27
|
+
|
|
28
|
+
constructor(value: string);
|
|
29
|
+
|
|
30
|
+
constructor(init: IIncludesAssertion);
|
|
31
|
+
|
|
32
|
+
constructor();
|
|
33
|
+
|
|
34
|
+
constructor(valueOrInit?: IIncludesAssertion | string) {
|
|
35
|
+
super();
|
|
36
|
+
if (typeof valueOrInit === 'object') {
|
|
37
|
+
const typed = valueOrInit as IIncludesAssertion;
|
|
38
|
+
this.new(typed);
|
|
39
|
+
} else if (typeof valueOrInit === 'string') {
|
|
40
|
+
this.new({
|
|
41
|
+
kind: IncludesAssertionKind,
|
|
42
|
+
value: valueOrInit,
|
|
43
|
+
enabled: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override new(init: IIncludesAssertion): void {
|
|
49
|
+
super.new(init);
|
|
50
|
+
this.kind = IncludesAssertionKind;
|
|
51
|
+
this.value = init.value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
checkValidity(): boolean {
|
|
55
|
+
return !!this.value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override toJSON(): IIncludesAssertion {
|
|
59
|
+
const result: IIncludesAssertion = {
|
|
60
|
+
...super.toJSON(),
|
|
61
|
+
kind: IncludesAssertionKind,
|
|
62
|
+
};
|
|
63
|
+
if (this.value) {
|
|
64
|
+
result.value = this.value;
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const IsEmptyAssertionKind = 'HttpAction#IsEmptyAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input is empty (empty array, empty string, empty object - no properties)
|
|
7
|
+
*/
|
|
8
|
+
export interface IIsEmptyAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof IsEmptyAssertionKind;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An assertion that makes sure the input is empty (empty array, empty string, empty object - no properties)
|
|
14
|
+
*/
|
|
15
|
+
export class IsEmptyAssertion extends HttpStep {
|
|
16
|
+
override kind = IsEmptyAssertionKind;
|
|
17
|
+
|
|
18
|
+
constructor(init?: IIsEmptyAssertion) {
|
|
19
|
+
super();
|
|
20
|
+
if (typeof init === 'object') {
|
|
21
|
+
this.new(init);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override new(init: IIsEmptyAssertion): void {
|
|
26
|
+
super.new(init);
|
|
27
|
+
this.kind = IsEmptyAssertionKind;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
checkValidity(): boolean {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override toJSON(): IIsEmptyAssertion {
|
|
35
|
+
const result: IIsEmptyAssertion = {
|
|
36
|
+
...super.toJSON(),
|
|
37
|
+
kind: IsEmptyAssertionKind,
|
|
38
|
+
};
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const IsNotEmptyAssertionKind = 'HttpAction#IsNotEmptyAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input is empty (empty array, empty string, empty object - no properties)
|
|
7
|
+
*/
|
|
8
|
+
export interface IIsNotEmptyAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof IsNotEmptyAssertionKind;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An assertion that makes sure the input is empty (empty array, empty string, empty object - no properties)
|
|
14
|
+
*/
|
|
15
|
+
export class IsNotEmptyAssertion extends HttpStep {
|
|
16
|
+
override kind = IsNotEmptyAssertionKind;
|
|
17
|
+
|
|
18
|
+
constructor(init?: IIsNotEmptyAssertion) {
|
|
19
|
+
super();
|
|
20
|
+
if (typeof init === 'object') {
|
|
21
|
+
this.new(init);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override new(init: IIsNotEmptyAssertion): void {
|
|
26
|
+
super.new(init);
|
|
27
|
+
this.kind = IsNotEmptyAssertionKind;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
checkValidity(): boolean {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override toJSON(): IIsNotEmptyAssertion {
|
|
35
|
+
const result: IIsNotEmptyAssertion = {
|
|
36
|
+
...super.toJSON(),
|
|
37
|
+
kind: IsNotEmptyAssertionKind,
|
|
38
|
+
};
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const LengthOfAssertionKind = 'HttpAction#LengthOfAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input has a length of the specified value.
|
|
7
|
+
*/
|
|
8
|
+
export interface ILengthOfAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof LengthOfAssertionKind;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The expected size of the array.
|
|
13
|
+
*/
|
|
14
|
+
value?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An assertion that makes sure the input has a length of the specified value.
|
|
19
|
+
*/
|
|
20
|
+
export class LengthOfAssertion extends HttpStep {
|
|
21
|
+
override kind = LengthOfAssertionKind;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The expected size of the array.
|
|
25
|
+
*/
|
|
26
|
+
value?: number;
|
|
27
|
+
|
|
28
|
+
constructor(value: number);
|
|
29
|
+
|
|
30
|
+
constructor(init: ILengthOfAssertion);
|
|
31
|
+
|
|
32
|
+
constructor();
|
|
33
|
+
|
|
34
|
+
constructor(valueOrInit?: ILengthOfAssertion | number) {
|
|
35
|
+
super();
|
|
36
|
+
if (typeof valueOrInit === 'object') {
|
|
37
|
+
const typed = valueOrInit as ILengthOfAssertion;
|
|
38
|
+
this.new(typed);
|
|
39
|
+
} else if (typeof valueOrInit === 'number') {
|
|
40
|
+
this.new({
|
|
41
|
+
kind: LengthOfAssertionKind,
|
|
42
|
+
value: valueOrInit,
|
|
43
|
+
enabled: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override new(init: ILengthOfAssertion): void {
|
|
49
|
+
super.new(init);
|
|
50
|
+
this.kind = LengthOfAssertionKind;
|
|
51
|
+
this.value = init.value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
checkValidity(): boolean {
|
|
55
|
+
return typeof this.value === 'number';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override toJSON(): ILengthOfAssertion {
|
|
59
|
+
const result: ILengthOfAssertion = {
|
|
60
|
+
...super.toJSON(),
|
|
61
|
+
kind: LengthOfAssertionKind,
|
|
62
|
+
};
|
|
63
|
+
if (typeof this.value === 'number') {
|
|
64
|
+
result.value = this.value;
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
}
|