@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,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
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const LessThanAssertionKind = 'HttpAction#LessThanAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input value is less [or equal] to the set value.
|
|
7
|
+
*/
|
|
8
|
+
export interface ILessThanAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof LessThanAssertionKind;
|
|
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 less [or equal] to the set value.
|
|
24
|
+
*/
|
|
25
|
+
export class LessThanAssertion extends HttpStep {
|
|
26
|
+
override kind = LessThanAssertionKind;
|
|
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: ILessThanAssertion);
|
|
41
|
+
|
|
42
|
+
constructor();
|
|
43
|
+
|
|
44
|
+
constructor(valueOrInit?: ILessThanAssertion | number, equal?: boolean) {
|
|
45
|
+
super();
|
|
46
|
+
if (typeof valueOrInit === 'object') {
|
|
47
|
+
const typed = valueOrInit as ILessThanAssertion;
|
|
48
|
+
this.new(typed);
|
|
49
|
+
} else if (typeof valueOrInit === 'number') {
|
|
50
|
+
this.new({
|
|
51
|
+
kind: LessThanAssertionKind,
|
|
52
|
+
value: valueOrInit,
|
|
53
|
+
equal,
|
|
54
|
+
enabled: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
override new(init: ILessThanAssertion): void {
|
|
60
|
+
super.new(init);
|
|
61
|
+
this.kind = LessThanAssertionKind;
|
|
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(): ILessThanAssertion {
|
|
75
|
+
const result: ILessThanAssertion = {
|
|
76
|
+
...super.toJSON(),
|
|
77
|
+
kind: LessThanAssertionKind,
|
|
78
|
+
};
|
|
79
|
+
if (this.value) {
|
|
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 MatchesAssertionKind = 'HttpAction#MatchesAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input value matches a regexp.
|
|
7
|
+
*/
|
|
8
|
+
export interface IMatchesAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof MatchesAssertionKind;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The regexp to match the value against.
|
|
13
|
+
*/
|
|
14
|
+
value?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An assertion that makes sure the input value matches a regexp.
|
|
19
|
+
*/
|
|
20
|
+
export class MatchesAssertion extends HttpStep {
|
|
21
|
+
override kind = MatchesAssertionKind;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The regexp to match the value against.
|
|
25
|
+
*/
|
|
26
|
+
value?: string;
|
|
27
|
+
|
|
28
|
+
constructor(value: string);
|
|
29
|
+
|
|
30
|
+
constructor(init: IMatchesAssertion);
|
|
31
|
+
|
|
32
|
+
constructor();
|
|
33
|
+
|
|
34
|
+
constructor(valueOrInit?: IMatchesAssertion | string) {
|
|
35
|
+
super();
|
|
36
|
+
if (typeof valueOrInit === 'object') {
|
|
37
|
+
const typed = valueOrInit as IMatchesAssertion;
|
|
38
|
+
this.new(typed);
|
|
39
|
+
} else if (typeof valueOrInit === 'string') {
|
|
40
|
+
this.new({
|
|
41
|
+
kind: MatchesAssertionKind,
|
|
42
|
+
value: valueOrInit,
|
|
43
|
+
enabled: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override new(init: IMatchesAssertion): void {
|
|
49
|
+
super.new(init);
|
|
50
|
+
this.kind = MatchesAssertionKind;
|
|
51
|
+
this.value = init.value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
checkValidity(): boolean {
|
|
55
|
+
return !!this.value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override toJSON(): IMatchesAssertion {
|
|
59
|
+
const result: IMatchesAssertion = {
|
|
60
|
+
...super.toJSON(),
|
|
61
|
+
kind: MatchesAssertionKind,
|
|
62
|
+
};
|
|
63
|
+
if (this.value) {
|
|
64
|
+
result.value = this.value;
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { HttpStep, IHttpStep } from "../../HttpStep.js";
|
|
2
|
+
|
|
3
|
+
export const MatchesSchemaAssertionKind = 'HttpAction#MatchesSchemaAssertion';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An assertion that makes sure the input matches a JSON schema. The input has to be a valid JSON string, object, or an array.
|
|
7
|
+
*/
|
|
8
|
+
export interface IMatchesSchemaAssertion extends IHttpStep {
|
|
9
|
+
kind: typeof MatchesSchemaAssertionKind;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The application internal reference to the schema stored in a store.
|
|
13
|
+
*/
|
|
14
|
+
ref?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* When set it ignores the `ref` and uses this JSON schema to validate the input against.
|
|
18
|
+
*/
|
|
19
|
+
schema?: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* An assertion that makes sure the input matches a JSON schema. The input has to be a valid JSON string, object, or an array.
|
|
24
|
+
*/
|
|
25
|
+
export class MatchesSchemaAssertion extends HttpStep {
|
|
26
|
+
override kind = MatchesSchemaAssertionKind;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The application internal reference to the schema stored in a store.
|
|
30
|
+
*/
|
|
31
|
+
ref?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* When set it ignores the `ref` and uses this JSON schema to validate the input against.
|
|
35
|
+
*/
|
|
36
|
+
schema?: unknown;
|
|
37
|
+
|
|
38
|
+
static fromRef(ref: string): MatchesSchemaAssertion {
|
|
39
|
+
return new MatchesSchemaAssertion({
|
|
40
|
+
kind: MatchesSchemaAssertionKind,
|
|
41
|
+
enabled: true,
|
|
42
|
+
ref,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static fromSchema(schema: unknown): MatchesSchemaAssertion {
|
|
47
|
+
return new MatchesSchemaAssertion({
|
|
48
|
+
kind: MatchesSchemaAssertionKind,
|
|
49
|
+
enabled: true,
|
|
50
|
+
schema,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
constructor(init?: IMatchesSchemaAssertion) {
|
|
55
|
+
super();
|
|
56
|
+
if (typeof init === 'object') {
|
|
57
|
+
this.new(init);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override new(init: IMatchesSchemaAssertion): void {
|
|
62
|
+
super.new(init);
|
|
63
|
+
this.kind = MatchesSchemaAssertionKind;
|
|
64
|
+
this.ref = init.ref;
|
|
65
|
+
this.schema = init.schema;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
checkValidity(): boolean {
|
|
69
|
+
return !!this.schema || !!this.ref;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
override toJSON(): IMatchesSchemaAssertion {
|
|
73
|
+
const result: IMatchesSchemaAssertion = {
|
|
74
|
+
...super.toJSON(),
|
|
75
|
+
kind: MatchesSchemaAssertionKind,
|
|
76
|
+
};
|
|
77
|
+
if (this.ref) {
|
|
78
|
+
result.ref = this.ref;
|
|
79
|
+
}
|
|
80
|
+
if (this.schema) {
|
|
81
|
+
result.schema = this.schema;
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
}
|