@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.
Files changed (224) hide show
  1. package/build/browser.d.ts +12 -2
  2. package/build/browser.js +15 -2
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +13 -3
  5. package/build/index.js +16 -3
  6. package/build/index.js.map +1 -1
  7. package/build/src/data/{JmesparthReader.d.ts → JmespathReader.d.ts} +1 -1
  8. package/build/src/data/{JmesparthReader.js → JmespathReader.js} +2 -2
  9. package/build/src/data/JmespathReader.js.map +1 -0
  10. package/build/src/data/RequestDataExtractor.d.ts +5 -5
  11. package/build/src/data/RequestDataExtractor.js.map +1 -1
  12. package/build/src/data/XmlReader.js +14 -1
  13. package/build/src/data/XmlReader.js.map +1 -1
  14. package/build/src/models/ClientCertificate.d.ts +9 -0
  15. package/build/src/models/ClientCertificate.js.map +1 -1
  16. package/build/src/models/Environment.d.ts +3 -2
  17. package/build/src/models/Environment.js +11 -6
  18. package/build/src/models/Environment.js.map +1 -1
  19. package/build/src/models/ErrorResponse.js.map +1 -1
  20. package/build/src/models/HttpRequest.d.ts +2 -7
  21. package/build/src/models/HttpRequest.js +1 -6
  22. package/build/src/models/HttpRequest.js.map +1 -1
  23. package/build/src/models/HttpResponse.d.ts +2 -7
  24. package/build/src/models/HttpResponse.js +1 -3
  25. package/build/src/models/HttpResponse.js.map +1 -1
  26. package/build/src/models/ProjectRequest.d.ts +19 -0
  27. package/build/src/models/ProjectRequest.js +50 -0
  28. package/build/src/models/ProjectRequest.js.map +1 -1
  29. package/build/src/models/Request.d.ts +12 -3
  30. package/build/src/models/Request.js +14 -1
  31. package/build/src/models/Request.js.map +1 -1
  32. package/build/src/models/RequestAuthorization.js.map +1 -1
  33. package/build/src/models/RequestLog.d.ts +11 -0
  34. package/build/src/models/RequestLog.js +15 -1
  35. package/build/src/models/RequestLog.js.map +1 -1
  36. package/build/src/models/SerializablePayload.d.ts +6 -1
  37. package/build/src/models/SerializablePayload.js +10 -6
  38. package/build/src/models/SerializablePayload.js.map +1 -1
  39. package/build/src/models/http-actions/AssertionError.d.ts +36 -0
  40. package/build/src/models/http-actions/AssertionError.js +35 -0
  41. package/build/src/models/http-actions/AssertionError.js.map +1 -0
  42. package/build/src/models/http-actions/HttpAssertion.d.ts +84 -0
  43. package/build/src/models/http-actions/HttpAssertion.js +52 -0
  44. package/build/src/models/http-actions/HttpAssertion.js.map +1 -0
  45. package/build/src/models/http-actions/HttpFlows.d.ts +109 -0
  46. package/build/src/models/http-actions/HttpFlows.js +31 -0
  47. package/build/src/models/http-actions/HttpFlows.js.map +1 -0
  48. package/build/src/models/http-actions/HttpStep.d.ts +29 -0
  49. package/build/src/models/http-actions/HttpStep.js +30 -0
  50. package/build/src/models/http-actions/HttpStep.js.map +1 -0
  51. package/build/src/models/http-actions/LegacyTranslator.d.ts +8 -7
  52. package/build/src/models/http-actions/LegacyTranslator.js +18 -13
  53. package/build/src/models/http-actions/LegacyTranslator.js.map +1 -1
  54. package/build/src/models/http-actions/steps/assertion/EqualAssertion.d.ts +76 -0
  55. package/build/src/models/http-actions/steps/assertion/EqualAssertion.js +79 -0
  56. package/build/src/models/http-actions/steps/assertion/EqualAssertion.js.map +1 -0
  57. package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.d.ts +36 -0
  58. package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.js +59 -0
  59. package/build/src/models/http-actions/steps/assertion/GreaterThanAssertion.js.map +1 -0
  60. package/build/src/models/http-actions/steps/assertion/IncludesAssertion.d.ts +28 -0
  61. package/build/src/models/http-actions/steps/assertion/IncludesAssertion.js +45 -0
  62. package/build/src/models/http-actions/steps/assertion/IncludesAssertion.js.map +1 -0
  63. package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.d.ts +18 -0
  64. package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.js +29 -0
  65. package/build/src/models/http-actions/steps/assertion/IsEmptyAssertion.js.map +1 -0
  66. package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.d.ts +18 -0
  67. package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.js +29 -0
  68. package/build/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.js.map +1 -0
  69. package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.d.ts +28 -0
  70. package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.js +45 -0
  71. package/build/src/models/http-actions/steps/assertion/LengthOfAssertion.js.map +1 -0
  72. package/build/src/models/http-actions/steps/assertion/LessThanAssertion.d.ts +36 -0
  73. package/build/src/models/http-actions/steps/assertion/LessThanAssertion.js +59 -0
  74. package/build/src/models/http-actions/steps/assertion/LessThanAssertion.js.map +1 -0
  75. package/build/src/models/http-actions/steps/assertion/MatchesAssertion.d.ts +28 -0
  76. package/build/src/models/http-actions/steps/assertion/MatchesAssertion.js +45 -0
  77. package/build/src/models/http-actions/steps/assertion/MatchesAssertion.js.map +1 -0
  78. package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.d.ts +36 -0
  79. package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.js +59 -0
  80. package/build/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.js.map +1 -0
  81. package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.d.ts +76 -0
  82. package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.js +79 -0
  83. package/build/src/models/http-actions/steps/assertion/NotEqualAssertion.js.map +1 -0
  84. package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.d.ts +28 -0
  85. package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.js +45 -0
  86. package/build/src/models/http-actions/steps/assertion/NotIncludesAssertion.js.map +1 -0
  87. package/build/src/models/http-actions/steps/assertion/NotOkAssertion.d.ts +18 -0
  88. package/build/src/models/http-actions/steps/assertion/NotOkAssertion.js +29 -0
  89. package/build/src/models/http-actions/steps/assertion/NotOkAssertion.js.map +1 -0
  90. package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.d.ts +29 -0
  91. package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.js +45 -0
  92. package/build/src/models/http-actions/steps/assertion/NotToBeAssertion.js.map +1 -0
  93. package/build/src/models/http-actions/steps/assertion/OkAssertion.d.ts +18 -0
  94. package/build/src/models/http-actions/steps/assertion/OkAssertion.js +29 -0
  95. package/build/src/models/http-actions/steps/assertion/OkAssertion.js.map +1 -0
  96. package/build/src/models/http-actions/steps/assertion/ToBeAssertion.d.ts +35 -0
  97. package/build/src/models/http-actions/steps/assertion/ToBeAssertion.js +53 -0
  98. package/build/src/models/http-actions/steps/assertion/ToBeAssertion.js.map +1 -0
  99. package/build/src/models/http-actions/steps/assertion/index.d.ts +15 -0
  100. package/build/src/models/http-actions/steps/assertion/index.js +16 -0
  101. package/build/src/models/http-actions/steps/assertion/index.js.map +1 -0
  102. package/build/src/models/http-actions/steps/data/DeleteCookieStep.d.ts +44 -0
  103. package/build/src/models/http-actions/steps/data/DeleteCookieStep.js +67 -0
  104. package/build/src/models/http-actions/steps/data/DeleteCookieStep.js.map +1 -0
  105. package/build/src/models/http-actions/steps/data/ReadDataSourceStep.d.ts +53 -0
  106. package/build/src/models/http-actions/steps/data/ReadDataSourceStep.js +60 -0
  107. package/build/src/models/http-actions/steps/data/ReadDataSourceStep.js.map +1 -0
  108. package/build/src/models/http-actions/steps/data/ReadDataStep.d.ts +67 -0
  109. package/build/src/models/http-actions/steps/data/ReadDataStep.js +77 -0
  110. package/build/src/models/http-actions/steps/data/ReadDataStep.js.map +1 -0
  111. package/build/src/models/http-actions/steps/data/ReadValueStep.d.ts +45 -0
  112. package/build/src/models/http-actions/steps/data/ReadValueStep.js +52 -0
  113. package/build/src/models/http-actions/steps/data/ReadValueStep.js.map +1 -0
  114. package/build/src/models/http-actions/steps/data/SetCookieStep.d.ts +100 -0
  115. package/build/src/models/http-actions/steps/data/SetCookieStep.js +138 -0
  116. package/build/src/models/http-actions/steps/data/SetCookieStep.js.map +1 -0
  117. package/build/src/models/http-actions/steps/data/SetDataStep.d.ts +77 -0
  118. package/build/src/models/http-actions/steps/data/SetDataStep.js +69 -0
  119. package/build/src/models/http-actions/steps/data/SetDataStep.js.map +1 -0
  120. package/build/src/models/http-actions/steps/data/SetVariableStep.d.ts +40 -0
  121. package/build/src/models/http-actions/steps/data/SetVariableStep.js +44 -0
  122. package/build/src/models/http-actions/steps/data/SetVariableStep.js.map +1 -0
  123. package/build/src/models/http-actions/steps/data/index.d.ts +7 -0
  124. package/build/src/models/http-actions/steps/data/index.js +8 -0
  125. package/build/src/models/http-actions/steps/data/index.js.map +1 -0
  126. package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.d.ts +18 -0
  127. package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.js +29 -0
  128. package/build/src/models/http-actions/steps/transformation/AsLowerCaseStep.js.map +1 -0
  129. package/build/src/models/http-actions/steps/transformation/AsNumberStep.d.ts +18 -0
  130. package/build/src/models/http-actions/steps/transformation/AsNumberStep.js +29 -0
  131. package/build/src/models/http-actions/steps/transformation/AsNumberStep.js.map +1 -0
  132. package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.d.ts +18 -0
  133. package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.js +29 -0
  134. package/build/src/models/http-actions/steps/transformation/AsUpperCaseStep.js.map +1 -0
  135. package/build/src/models/http-actions/steps/transformation/RoundStep.d.ts +43 -0
  136. package/build/src/models/http-actions/steps/transformation/RoundStep.js +52 -0
  137. package/build/src/models/http-actions/steps/transformation/RoundStep.js.map +1 -0
  138. package/build/src/models/http-actions/steps/transformation/SubstringStep.d.ts +38 -0
  139. package/build/src/models/http-actions/steps/transformation/SubstringStep.js +65 -0
  140. package/build/src/models/http-actions/steps/transformation/SubstringStep.js.map +1 -0
  141. package/build/src/models/http-actions/steps/transformation/TrimStep.d.ts +20 -0
  142. package/build/src/models/http-actions/steps/transformation/TrimStep.js +30 -0
  143. package/build/src/models/http-actions/steps/transformation/TrimStep.js.map +1 -0
  144. package/build/src/models/http-actions/steps/transformation/index.d.ts +6 -0
  145. package/build/src/models/http-actions/steps/transformation/index.js +7 -0
  146. package/build/src/models/http-actions/steps/transformation/index.js.map +1 -0
  147. package/build/src/proxy/RequestProxy.d.ts +7 -2
  148. package/build/src/proxy/RequestProxy.js +4 -1
  149. package/build/src/proxy/RequestProxy.js.map +1 -1
  150. package/build/src/runtime/http-runner/ConditionCheck.d.ts +10 -10
  151. package/build/src/runtime/http-runner/ConditionCheck.js.map +1 -1
  152. package/build/src/runtime/http-runner/HttpAssertionRunner.d.ts +75 -0
  153. package/build/src/runtime/http-runner/HttpAssertionRunner.js +538 -0
  154. package/build/src/runtime/http-runner/HttpAssertionRunner.js.map +1 -0
  155. package/build/src/runtime/http-runner/HttpFlowRunner.d.ts +11 -6
  156. package/build/src/runtime/http-runner/HttpFlowRunner.js +24 -15
  157. package/build/src/runtime/http-runner/HttpFlowRunner.js.map +1 -1
  158. package/build/src/runtime/http-runner/HttpRequestRunner.d.ts +14 -3
  159. package/build/src/runtime/http-runner/HttpRequestRunner.js +44 -0
  160. package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -1
  161. package/build/src/runtime/node/ProjectParallelRunner.d.ts +1 -1
  162. package/build/src/runtime/node/ProjectParallelRunner.js +2 -2
  163. package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
  164. package/build/src/runtime/node/ProjectRequestRunner.js +6 -2
  165. package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
  166. package/package.json +3 -2
  167. package/src/data/{JmesparthReader.ts → JmespathReader.ts} +2 -2
  168. package/src/data/RequestDataExtractor.ts +5 -5
  169. package/src/data/XmlReader.ts +16 -2
  170. package/src/models/ClientCertificate.ts +9 -0
  171. package/src/models/Environment.ts +11 -7
  172. package/src/models/ErrorResponse.ts +1 -1
  173. package/src/models/HttpRequest.ts +4 -14
  174. package/src/models/HttpResponse.ts +5 -11
  175. package/src/models/ProjectRequest.ts +54 -0
  176. package/src/models/Request.ts +23 -4
  177. package/src/models/RequestAuthorization.ts +1 -1
  178. package/src/models/RequestLog.ts +21 -1
  179. package/src/models/SerializablePayload.ts +18 -1
  180. package/src/models/http-actions/AssertionError.ts +57 -0
  181. package/src/models/http-actions/HttpAssertion.ts +89 -0
  182. package/src/models/http-actions/HttpFlows.ts +115 -0
  183. package/src/models/http-actions/HttpStep.ts +50 -0
  184. package/src/models/http-actions/LegacyTranslator.ts +42 -30
  185. package/src/models/http-actions/steps/assertion/EqualAssertion.ts +130 -0
  186. package/src/models/http-actions/steps/assertion/GreaterThanAssertion.ts +87 -0
  187. package/src/models/http-actions/steps/assertion/IncludesAssertion.ts +68 -0
  188. package/src/models/http-actions/steps/assertion/IsEmptyAssertion.ts +41 -0
  189. package/src/models/http-actions/steps/assertion/IsNotEmptyAssertion.ts +41 -0
  190. package/src/models/http-actions/steps/assertion/LengthOfAssertion.ts +68 -0
  191. package/src/models/http-actions/steps/assertion/LessThanAssertion.ts +87 -0
  192. package/src/models/http-actions/steps/assertion/MatchesAssertion.ts +68 -0
  193. package/src/models/http-actions/steps/assertion/MatchesSchemaAssertion.ts +85 -0
  194. package/src/models/http-actions/steps/assertion/NotEqualAssertion.ts +130 -0
  195. package/src/models/http-actions/steps/assertion/NotIncludesAssertion.ts +68 -0
  196. package/src/models/http-actions/steps/assertion/NotOkAssertion.ts +41 -0
  197. package/src/models/http-actions/steps/assertion/NotToBeAssertion.ts +69 -0
  198. package/src/models/http-actions/steps/assertion/OkAssertion.ts +41 -0
  199. package/src/models/http-actions/steps/assertion/ToBeAssertion.ts +76 -0
  200. package/src/models/http-actions/steps/data/DeleteCookieStep.ts +102 -0
  201. package/src/models/http-actions/steps/data/ReadDataSourceStep.ts +103 -0
  202. package/src/models/http-actions/steps/data/ReadDataStep.ts +128 -0
  203. package/src/models/http-actions/steps/data/ReadValueStep.ts +88 -0
  204. package/src/models/http-actions/steps/data/SetCookieStep.ts +206 -0
  205. package/src/models/http-actions/steps/data/SetDataStep.ts +124 -0
  206. package/src/models/http-actions/steps/data/SetVariableStep.ts +82 -0
  207. package/src/models/http-actions/steps/transformation/AsLowerCaseStep.ts +41 -0
  208. package/src/models/http-actions/steps/transformation/AsNumberStep.ts +41 -0
  209. package/src/models/http-actions/steps/transformation/AsUpperCaseStep.ts +41 -0
  210. package/src/models/http-actions/steps/transformation/RoundStep.ts +86 -0
  211. package/src/models/http-actions/steps/transformation/SubstringStep.ts +93 -0
  212. package/src/models/http-actions/steps/transformation/TrimStep.ts +43 -0
  213. package/src/proxy/RequestProxy.ts +11 -3
  214. package/src/runtime/http-runner/ConditionCheck.ts +13 -14
  215. package/src/runtime/http-runner/HttpAssertionRunner.ts +540 -0
  216. package/src/runtime/http-runner/HttpFlowRunner.ts +33 -19
  217. package/src/runtime/http-runner/HttpRequestRunner.ts +53 -5
  218. package/src/runtime/node/ProjectParallelRunner.ts +4 -4
  219. package/src/runtime/node/ProjectRequestRunner.ts +6 -2
  220. package/build/src/data/JmesparthReader.js.map +0 -1
  221. package/build/src/models/http-actions/HttpActions.d.ts +0 -256
  222. package/build/src/models/http-actions/HttpActions.js +0 -46
  223. package/build/src/models/http-actions/HttpActions.js.map +0 -1
  224. package/src/models/http-actions/HttpActions.ts +0 -270
@@ -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
+ }
@@ -0,0 +1,130 @@
1
+ import { HttpStep, IHttpStep } from "../../HttpStep.js";
2
+
3
+ export const NotEqualAssertionKind = 'HttpAction#NotEqualAssertion';
4
+
5
+ /**
6
+ * An assertion that makes sure the input value is not [strict] equal to the set value.
7
+ */
8
+ export interface INotEqualAssertion extends IHttpStep {
9
+ kind: typeof NotEqualAssertionKind;
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 not [strict] equal to the set value.
45
+ */
46
+ export class NotEqualAssertion extends HttpStep {
47
+ override kind = NotEqualAssertionKind;
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: INotEqualAssertion);
83
+
84
+ constructor();
85
+
86
+ constructor(valueOrInit?: INotEqualAssertion | string, strict?: boolean, dataType?: string) {
87
+ super();
88
+ if (typeof valueOrInit === 'object') {
89
+ const typed = valueOrInit as INotEqualAssertion;
90
+ this.new(typed);
91
+ } else if (typeof valueOrInit === 'string') {
92
+ this.new({
93
+ kind: NotEqualAssertionKind,
94
+ value: valueOrInit,
95
+ dataType,
96
+ strict,
97
+ enabled: true,
98
+ });
99
+ }
100
+ }
101
+
102
+ override new(init: INotEqualAssertion): void {
103
+ super.new(init);
104
+ this.kind = NotEqualAssertionKind;
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(): INotEqualAssertion {
115
+ const result: INotEqualAssertion = {
116
+ ...super.toJSON(),
117
+ kind: NotEqualAssertionKind,
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,68 @@
1
+ import { HttpStep, IHttpStep } from "../../HttpStep.js";
2
+
3
+ export const NotIncludesAssertionKind = 'HttpAction#NotIncludesAssertion';
4
+
5
+ /**
6
+ * An assertion that makes sure the input does not include the set value.
7
+ */
8
+ export interface INotIncludesAssertion extends IHttpStep {
9
+ kind: typeof NotIncludesAssertionKind;
10
+
11
+ /**
12
+ * The value to search for.
13
+ */
14
+ value?: string;
15
+ }
16
+
17
+ /**
18
+ * An assertion that makes sure the input does not include the set value.
19
+ */
20
+ export class NotIncludesAssertion extends HttpStep {
21
+ override kind = NotIncludesAssertionKind;
22
+
23
+ /**
24
+ * The value to search for.
25
+ */
26
+ value?: string;
27
+
28
+ constructor(value: string);
29
+
30
+ constructor(init: INotIncludesAssertion);
31
+
32
+ constructor();
33
+
34
+ constructor(valueOrInit?: INotIncludesAssertion | string) {
35
+ super();
36
+ if (typeof valueOrInit === 'object') {
37
+ const typed = valueOrInit as INotIncludesAssertion;
38
+ this.new(typed);
39
+ } else if (typeof valueOrInit === 'string') {
40
+ this.new({
41
+ kind: NotIncludesAssertionKind,
42
+ value: valueOrInit,
43
+ enabled: true,
44
+ });
45
+ }
46
+ }
47
+
48
+ override new(init: INotIncludesAssertion): void {
49
+ super.new(init);
50
+ this.kind = NotIncludesAssertionKind;
51
+ this.value = init.value;
52
+ }
53
+
54
+ checkValidity(): boolean {
55
+ return !!this.value;
56
+ }
57
+
58
+ override toJSON(): INotIncludesAssertion {
59
+ const result: INotIncludesAssertion = {
60
+ ...super.toJSON(),
61
+ kind: NotIncludesAssertionKind,
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 NotOkAssertionKind = 'HttpAction#NotOkAssertion';
4
+
5
+ /**
6
+ * An assertion that makes sure the input has a truly value.
7
+ */
8
+ export interface INotOkAssertion extends IHttpStep {
9
+ kind: typeof NotOkAssertionKind;
10
+ }
11
+
12
+ /**
13
+ * An assertion that makes sure the input has a truly value.
14
+ */
15
+ export class NotOkAssertion extends HttpStep {
16
+ override kind = NotOkAssertionKind;
17
+
18
+ constructor(init?: INotOkAssertion) {
19
+ super();
20
+ if (typeof init === 'object') {
21
+ this.new(init);
22
+ }
23
+ }
24
+
25
+ override new(init: INotOkAssertion): void {
26
+ super.new(init);
27
+ this.kind = NotOkAssertionKind;
28
+ }
29
+
30
+ checkValidity(): boolean {
31
+ return true;
32
+ }
33
+
34
+ override toJSON(): INotOkAssertion {
35
+ const result: INotOkAssertion = {
36
+ ...super.toJSON(),
37
+ kind: NotOkAssertionKind,
38
+ };
39
+ return result;
40
+ }
41
+ }
@@ -0,0 +1,69 @@
1
+ import { HttpStep, IHttpStep } from "../../HttpStep.js";
2
+ import { ToBeTypes } from "./ToBeAssertion.js";
3
+
4
+ export const NotToBeAssertionKind = 'HttpAction#NotToBeAssertion';
5
+
6
+ /**
7
+ * An assertion that makes sure the input is not of a specific type (string, number, boolean, object, array).
8
+ */
9
+ export interface INotToBeAssertion extends IHttpStep {
10
+ kind: typeof NotToBeAssertionKind;
11
+
12
+ /**
13
+ * The type to expect.
14
+ */
15
+ value?: ToBeTypes;
16
+ }
17
+
18
+ /**
19
+ * An assertion that makes sure the input is not of a specific type (string, number, boolean, object, array).
20
+ */
21
+ export class NotToBeAssertion extends HttpStep {
22
+ override kind = NotToBeAssertionKind;
23
+
24
+ /**
25
+ * The type to expect.
26
+ */
27
+ value?: ToBeTypes;
28
+
29
+ constructor(value: ToBeTypes);
30
+
31
+ constructor(init: INotToBeAssertion);
32
+
33
+ constructor();
34
+
35
+ constructor(valueOrInit?: INotToBeAssertion | ToBeTypes) {
36
+ super();
37
+ if (typeof valueOrInit === 'object') {
38
+ const typed = valueOrInit as INotToBeAssertion;
39
+ this.new(typed);
40
+ } else if (typeof valueOrInit === 'string') {
41
+ this.new({
42
+ kind: NotToBeAssertionKind,
43
+ value: valueOrInit,
44
+ enabled: true,
45
+ });
46
+ }
47
+ }
48
+
49
+ override new(init: INotToBeAssertion): void {
50
+ super.new(init);
51
+ this.kind = NotToBeAssertionKind;
52
+ this.value = init.value;
53
+ }
54
+
55
+ checkValidity(): boolean {
56
+ return !!this.value;
57
+ }
58
+
59
+ override toJSON(): INotToBeAssertion {
60
+ const result: INotToBeAssertion = {
61
+ ...super.toJSON(),
62
+ kind: NotToBeAssertionKind,
63
+ };
64
+ if (this.value) {
65
+ result.value = this.value;
66
+ }
67
+ return result;
68
+ }
69
+ }
@@ -0,0 +1,41 @@
1
+ import { HttpStep, IHttpStep } from "../../HttpStep.js";
2
+
3
+ export const OkAssertionKind = 'HttpAction#OkAssertion';
4
+
5
+ /**
6
+ * An assertion that makes sure the input has a truly value.
7
+ */
8
+ export interface IOkAssertion extends IHttpStep {
9
+ kind: typeof OkAssertionKind;
10
+ }
11
+
12
+ /**
13
+ * An assertion that makes sure the input has a truly value.
14
+ */
15
+ export class OkAssertion extends HttpStep {
16
+ override kind = OkAssertionKind;
17
+
18
+ constructor(init?: IOkAssertion) {
19
+ super();
20
+ if (typeof init === 'object') {
21
+ this.new(init);
22
+ }
23
+ }
24
+
25
+ override new(init: IOkAssertion): void {
26
+ super.new(init);
27
+ this.kind = OkAssertionKind;
28
+ }
29
+
30
+ checkValidity(): boolean {
31
+ return true;
32
+ }
33
+
34
+ override toJSON(): IOkAssertion {
35
+ const result: IOkAssertion = {
36
+ ...super.toJSON(),
37
+ kind: OkAssertionKind,
38
+ };
39
+ return result;
40
+ }
41
+ }
@@ -0,0 +1,76 @@
1
+ import { HttpStep, IHttpStep } from "../../HttpStep.js";
2
+
3
+ export const ToBeAssertionKind = 'HttpAction#ToBeAssertion';
4
+
5
+ export enum ToBeTypes {
6
+ string = 'string',
7
+ number = 'number',
8
+ boolean = 'boolean',
9
+ object = 'object',
10
+ array = 'array',
11
+ }
12
+
13
+ /**
14
+ * An assertion that makes sure the input is of a specific type (string, number, boolean, object, array).
15
+ */
16
+ export interface IToBeAssertion extends IHttpStep {
17
+ kind: typeof ToBeAssertionKind;
18
+
19
+ /**
20
+ * The type to expect.
21
+ */
22
+ value?: ToBeTypes;
23
+ }
24
+
25
+ /**
26
+ * An assertion that makes sure the input is of a specific type (string, number, boolean, object, array).
27
+ */
28
+ export class ToBeAssertion extends HttpStep {
29
+ override kind = ToBeAssertionKind;
30
+
31
+ /**
32
+ * The type to expect.
33
+ */
34
+ value?: ToBeTypes;
35
+
36
+ constructor(value: ToBeTypes);
37
+
38
+ constructor(init: IToBeAssertion);
39
+
40
+ constructor();
41
+
42
+ constructor(valueOrInit?: IToBeAssertion | ToBeTypes) {
43
+ super();
44
+ if (typeof valueOrInit === 'object') {
45
+ const typed = valueOrInit as IToBeAssertion;
46
+ this.new(typed);
47
+ } else if (typeof valueOrInit === 'string') {
48
+ this.new({
49
+ kind: ToBeAssertionKind,
50
+ value: valueOrInit,
51
+ enabled: true,
52
+ });
53
+ }
54
+ }
55
+
56
+ override new(init: IToBeAssertion): void {
57
+ super.new(init);
58
+ this.kind = ToBeAssertionKind;
59
+ this.value = init.value;
60
+ }
61
+
62
+ checkValidity(): boolean {
63
+ return !!this.value;
64
+ }
65
+
66
+ override toJSON(): IToBeAssertion {
67
+ const result: IToBeAssertion = {
68
+ ...super.toJSON(),
69
+ kind: ToBeAssertionKind,
70
+ };
71
+ if (this.value) {
72
+ result.value = this.value;
73
+ }
74
+ return result;
75
+ }
76
+ }