@loadmill/core 0.3.109 → 0.3.111

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 (196) hide show
  1. package/dist/conf/defaults.d.ts +1 -0
  2. package/dist/conf/defaults.js +11 -0
  3. package/dist/conf/defaults.js.map +1 -0
  4. package/dist/conf/extrema.d.ts +7 -0
  5. package/dist/conf/extrema.js +12 -0
  6. package/dist/conf/extrema.js.map +1 -0
  7. package/dist/conf/index.d.ts +15 -0
  8. package/dist/conf/index.js +80 -0
  9. package/dist/conf/index.js.map +1 -0
  10. package/dist/conf/notifications.d.ts +2 -0
  11. package/dist/conf/notifications.js +19 -0
  12. package/dist/conf/notifications.js.map +1 -0
  13. package/dist/conf/types.d.ts +110 -0
  14. package/dist/conf/types.js +38 -0
  15. package/dist/conf/types.js.map +1 -0
  16. package/dist/conf/validate.d.ts +69 -0
  17. package/dist/conf/validate.js +495 -0
  18. package/dist/conf/validate.js.map +1 -0
  19. package/dist/distributed-logger-reporter.d.ts +3 -0
  20. package/dist/distributed-logger-reporter.js +74 -0
  21. package/dist/distributed-logger-reporter.js.map +1 -0
  22. package/dist/echo/firehose.d.ts +7 -0
  23. package/dist/echo/firehose.js +130 -0
  24. package/dist/echo/firehose.js.map +1 -0
  25. package/dist/echo/index.d.ts +3 -0
  26. package/dist/echo/index.js +8 -0
  27. package/dist/echo/index.js.map +1 -0
  28. package/dist/echo/stats.d.ts +8 -0
  29. package/dist/echo/stats.js +152 -0
  30. package/dist/echo/stats.js.map +1 -0
  31. package/dist/har/index.d.ts +68 -0
  32. package/dist/har/index.js +14 -0
  33. package/dist/har/index.js.map +1 -0
  34. package/dist/labels/constants.d.ts +1 -0
  35. package/dist/labels/constants.js +5 -0
  36. package/dist/labels/constants.js.map +1 -0
  37. package/dist/multipart-form-data/files.d.ts +2 -0
  38. package/dist/multipart-form-data/files.js +63 -0
  39. package/dist/multipart-form-data/files.js.map +1 -0
  40. package/dist/multipart-form-data/form-data-utils.d.ts +19 -0
  41. package/dist/multipart-form-data/form-data-utils.js +117 -0
  42. package/dist/multipart-form-data/form-data-utils.js.map +1 -0
  43. package/dist/multipart-form-data/is-binary-file.d.ts +2 -0
  44. package/dist/multipart-form-data/is-binary-file.js +215 -0
  45. package/dist/multipart-form-data/is-binary-file.js.map +1 -0
  46. package/dist/multipart-form-data/multipart-text-to-post-form-data.d.ts +2 -0
  47. package/dist/multipart-form-data/multipart-text-to-post-form-data.js +86 -0
  48. package/dist/multipart-form-data/multipart-text-to-post-form-data.js.map +1 -0
  49. package/dist/parameters/extractions.d.ts +26 -0
  50. package/dist/parameters/extractions.js +49 -0
  51. package/dist/parameters/extractions.js.map +1 -0
  52. package/dist/parameters/extractors/cheerio-extractor.d.ts +11 -0
  53. package/dist/parameters/extractors/cheerio-extractor.js +84 -0
  54. package/dist/parameters/extractors/cheerio-extractor.js.map +1 -0
  55. package/dist/parameters/extractors/expression-extractor.d.ts +6 -0
  56. package/dist/parameters/extractors/expression-extractor.js +38 -0
  57. package/dist/parameters/extractors/expression-extractor.js.map +1 -0
  58. package/dist/parameters/extractors/extractor.d.ts +3 -0
  59. package/dist/parameters/extractors/extractor.js +3 -0
  60. package/dist/parameters/extractors/extractor.js.map +1 -0
  61. package/dist/parameters/extractors/header-extractor.d.ts +7 -0
  62. package/dist/parameters/extractors/header-extractor.js +51 -0
  63. package/dist/parameters/extractors/header-extractor.js.map +1 -0
  64. package/dist/parameters/extractors/index.d.ts +10 -0
  65. package/dist/parameters/extractors/index.js +20 -0
  66. package/dist/parameters/extractors/index.js.map +1 -0
  67. package/dist/parameters/extractors/json-path-extractor.d.ts +12 -0
  68. package/dist/parameters/extractors/json-path-extractor.js +167 -0
  69. package/dist/parameters/extractors/json-path-extractor.js.map +1 -0
  70. package/dist/parameters/extractors/parametrized-extractor.d.ts +10 -0
  71. package/dist/parameters/extractors/parametrized-extractor.js +34 -0
  72. package/dist/parameters/extractors/parametrized-extractor.js.map +1 -0
  73. package/dist/parameters/extractors/regex-extractor.d.ts +7 -0
  74. package/dist/parameters/extractors/regex-extractor.js +46 -0
  75. package/dist/parameters/extractors/regex-extractor.js.map +1 -0
  76. package/dist/parameters/extractors/regex-matcher.d.ts +1 -0
  77. package/dist/parameters/extractors/regex-matcher.js +21 -0
  78. package/dist/parameters/extractors/regex-matcher.js.map +1 -0
  79. package/dist/parameters/extractors/ws-extractor.d.ts +33 -0
  80. package/dist/parameters/extractors/ws-extractor.js +215 -0
  81. package/dist/parameters/extractors/ws-extractor.js.map +1 -0
  82. package/dist/parameters/extractors/x-path-extractor.d.ts +9 -0
  83. package/dist/parameters/extractors/x-path-extractor.js +71 -0
  84. package/dist/parameters/extractors/x-path-extractor.js.map +1 -0
  85. package/dist/parameters/generate-random.d.ts +13 -0
  86. package/dist/parameters/generate-random.js +108 -0
  87. package/dist/parameters/generate-random.js.map +1 -0
  88. package/dist/parameters/html-utils.d.ts +1 -0
  89. package/dist/parameters/html-utils.js +18 -0
  90. package/dist/parameters/html-utils.js.map +1 -0
  91. package/dist/parameters/index.d.ts +89 -0
  92. package/dist/parameters/index.js +619 -0
  93. package/dist/parameters/index.js.map +1 -0
  94. package/dist/parameters/json-path-utils.d.ts +1 -0
  95. package/dist/parameters/json-path-utils.js +16 -0
  96. package/dist/parameters/json-path-utils.js.map +1 -0
  97. package/dist/parameters/operators/binary-operator.d.ts +13 -0
  98. package/dist/parameters/operators/binary-operator.js +39 -0
  99. package/dist/parameters/operators/binary-operator.js.map +1 -0
  100. package/dist/parameters/operators/index.d.ts +5 -0
  101. package/dist/parameters/operators/index.js +21 -0
  102. package/dist/parameters/operators/index.js.map +1 -0
  103. package/dist/parameters/parameter-functions/boolean-parameter-functions.d.ts +12 -0
  104. package/dist/parameters/parameter-functions/boolean-parameter-functions.js +47 -0
  105. package/dist/parameters/parameter-functions/boolean-parameter-functions.js.map +1 -0
  106. package/dist/parameters/parameter-functions/crypto.d.ts +11 -0
  107. package/dist/parameters/parameter-functions/crypto.js +71 -0
  108. package/dist/parameters/parameter-functions/crypto.js.map +1 -0
  109. package/dist/parameters/parameter-functions/json-schema.d.ts +1 -0
  110. package/dist/parameters/parameter-functions/json-schema.js +33 -0
  111. package/dist/parameters/parameter-functions/json-schema.js.map +1 -0
  112. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.d.ts +11 -0
  113. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js +34 -0
  114. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js.map +1 -0
  115. package/dist/parameters/parameter-functions/numeric-parameter-functions.d.ts +15 -0
  116. package/dist/parameters/parameter-functions/numeric-parameter-functions.js +56 -0
  117. package/dist/parameters/parameter-functions/numeric-parameter-functions.js.map +1 -0
  118. package/dist/parameters/parameter-functions/parameter-function-utils.d.ts +5 -0
  119. package/dist/parameters/parameter-functions/parameter-function-utils.js +82 -0
  120. package/dist/parameters/parameter-functions/parameter-function-utils.js.map +1 -0
  121. package/dist/parameters/parameter-functions/parameter-function.d.ts +6 -0
  122. package/dist/parameters/parameter-functions/parameter-function.js +28 -0
  123. package/dist/parameters/parameter-functions/parameter-function.js.map +1 -0
  124. package/dist/parameters/parameter-functions/parameter-functions.d.ts +7 -0
  125. package/dist/parameters/parameter-functions/parameter-functions.js +53 -0
  126. package/dist/parameters/parameter-functions/parameter-functions.js.map +1 -0
  127. package/dist/parameters/parameter-functions/random-parameter-functions.d.ts +1 -0
  128. package/dist/parameters/parameter-functions/random-parameter-functions.js +43 -0
  129. package/dist/parameters/parameter-functions/random-parameter-functions.js.map +1 -0
  130. package/dist/parameters/parameter-functions/textual-parameter-functions.d.ts +67 -0
  131. package/dist/parameters/parameter-functions/textual-parameter-functions.js +403 -0
  132. package/dist/parameters/parameter-functions/textual-parameter-functions.js.map +1 -0
  133. package/dist/parameters/parameter-name-utils.d.ts +5 -0
  134. package/dist/parameters/parameter-name-utils.js +137 -0
  135. package/dist/parameters/parameter-name-utils.js.map +1 -0
  136. package/dist/parameters/parameter-regex-providers.d.ts +24 -0
  137. package/dist/parameters/parameter-regex-providers.js +70 -0
  138. package/dist/parameters/parameter-regex-providers.js.map +1 -0
  139. package/dist/parameters/resolvers/random-parameters-resolver.d.ts +1 -0
  140. package/dist/parameters/resolvers/random-parameters-resolver.js +12 -0
  141. package/dist/parameters/resolvers/random-parameters-resolver.js.map +1 -0
  142. package/dist/parameters/type.d.ts +10 -0
  143. package/dist/parameters/type.js +9 -0
  144. package/dist/parameters/type.js.map +1 -0
  145. package/dist/parameters/value-utils.d.ts +5 -0
  146. package/dist/parameters/value-utils.js +44 -0
  147. package/dist/parameters/value-utils.js.map +1 -0
  148. package/dist/request/index.d.ts +265 -0
  149. package/dist/request/index.js +541 -0
  150. package/dist/request/index.js.map +1 -0
  151. package/dist/schema/json-schema-generator.d.ts +20 -0
  152. package/dist/schema/json-schema-generator.js +135 -0
  153. package/dist/schema/json-schema-generator.js.map +1 -0
  154. package/dist/signals.d.ts +4 -0
  155. package/dist/signals.js +9 -0
  156. package/dist/signals.js.map +1 -0
  157. package/dist/subset/index.d.ts +3 -0
  158. package/dist/subset/index.js +8 -0
  159. package/dist/subset/index.js.map +1 -0
  160. package/dist/subset/is-subset.d.ts +2 -0
  161. package/dist/subset/is-subset.js +29 -0
  162. package/dist/subset/is-subset.js.map +1 -0
  163. package/dist/subset/json-contains.d.ts +1 -0
  164. package/dist/subset/json-contains.js +24 -0
  165. package/dist/subset/json-contains.js.map +1 -0
  166. package/dist/team-options/constants.d.ts +3 -0
  167. package/dist/team-options/constants.js +7 -0
  168. package/dist/team-options/constants.js.map +1 -0
  169. package/dist/xml/decode.d.ts +2 -0
  170. package/dist/xml/decode.js +87 -0
  171. package/dist/xml/decode.js.map +1 -0
  172. package/dist/xml/encode.d.ts +1 -0
  173. package/dist/xml/encode.js +14 -0
  174. package/dist/xml/encode.js.map +1 -0
  175. package/dist/xml/escape-reserved-chars.d.ts +6 -0
  176. package/dist/xml/escape-reserved-chars.js +57 -0
  177. package/dist/xml/escape-reserved-chars.js.map +1 -0
  178. package/dist/xml/is-xml.d.ts +1 -0
  179. package/dist/xml/is-xml.js +9 -0
  180. package/dist/xml/is-xml.js.map +1 -0
  181. package/dist/xml/json-to-xml.d.ts +2 -0
  182. package/dist/xml/json-to-xml.js +11 -0
  183. package/dist/xml/json-to-xml.js.map +1 -0
  184. package/dist/xml/namespaces.d.ts +7 -0
  185. package/dist/xml/namespaces.js +16 -0
  186. package/dist/xml/namespaces.js.map +1 -0
  187. package/dist/xml/remove-invisible-chars.d.ts +2 -0
  188. package/dist/xml/remove-invisible-chars.js +13 -0
  189. package/dist/xml/remove-invisible-chars.js.map +1 -0
  190. package/dist/xml/replace-s-tags.d.ts +4 -0
  191. package/dist/xml/replace-s-tags.js +21 -0
  192. package/dist/xml/replace-s-tags.js.map +1 -0
  193. package/dist/xml/xml-to-json.d.ts +7 -0
  194. package/dist/xml/xml-to-json.js +21 -0
  195. package/dist/xml/xml-to-json.js.map +1 -0
  196. package/package.json +3 -3
@@ -0,0 +1,541 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.WsMessageType = exports.ConfMimeTypes = exports.getResponseText = exports.isGRPCRequest = exports.isHTTPRequest = exports.isWSRequest = exports.EXCLUDES = exports.CachePenetrationModes = exports.BodyTypes = exports.isReservedHeader = exports.findRequestIndex = exports.toHeaders = exports.createRequest = exports.resolveUrl = exports.LoadmillOrFinfRequest = exports.LoadmillRequest = exports.RequestType = exports.ALLOWED_RESPONSE_STATUSES = exports.supportedMethods = exports.DEFAULT_REQUEST_TIMEOUT = void 0;
38
+ var flatMap = require("lodash/flatMap");
39
+ var uriUtils = __importStar(require("@loadmill/universal/dist/uri-utils"));
40
+ var parameters_1 = require("../parameters");
41
+ exports.DEFAULT_REQUEST_TIMEOUT = 25000;
42
+ exports.supportedMethods = {
43
+ GET: 'GET',
44
+ POST: 'POST',
45
+ PUT: 'PUT',
46
+ DELETE: 'DELETE',
47
+ PATCH: 'PATCH',
48
+ };
49
+ exports.ALLOWED_RESPONSE_STATUSES = { SUCCESS: 'SUCCESS', ERROR: 'ERROR', ANY: 'ANY' };
50
+ /**
51
+ * This class represents an HTTP request to be performed in the course of a load test.
52
+ *
53
+ * @property url The URL of the request (parameterizable).
54
+ * @property method The HTTP method.
55
+ * @property headers An array of headers to add to the request (values parameterizable).
56
+ * @property postData The content of the request (text parameterizable).
57
+ * @property delay The delay between this request and the previous one in milliseconds. This property is ignored for the first request.
58
+ * @property timeout The time to wait for the request to finish in milliseconds.
59
+ * @property extract A dictionary of parameter extractions.
60
+ * @property assert An array or dictionary of assertions.
61
+ * @property expectedStatus The expected status of the http response SUCCESS for 2XX-3XX, ERROR for 4XX-5XX.
62
+ */
63
+ var RequestType;
64
+ (function (RequestType) {
65
+ RequestType["LOGIN"] = "login";
66
+ RequestType["BEFORE_EACH"] = "beforeEach";
67
+ RequestType["FLOW"] = "flow";
68
+ RequestType["AFTER_EACH"] = "afterEach";
69
+ RequestType["FINF"] = "flowInFlow";
70
+ RequestType["BEFORE_ALL"] = "beforeAll";
71
+ RequestType["AFTER_ALL"] = "afterAll";
72
+ })(RequestType = exports.RequestType || (exports.RequestType = {}));
73
+ var LoadmillRequest = /** @class */ (function () {
74
+ function LoadmillRequest(url) {
75
+ Object.defineProperty(this, "url", {
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true,
79
+ value: url
80
+ });
81
+ Object.defineProperty(this, "id", {
82
+ enumerable: true,
83
+ configurable: true,
84
+ writable: true,
85
+ value: void 0
86
+ });
87
+ Object.defineProperty(this, "auth", {
88
+ enumerable: true,
89
+ configurable: true,
90
+ writable: true,
91
+ value: void 0
92
+ });
93
+ Object.defineProperty(this, "stopBefore", {
94
+ enumerable: true,
95
+ configurable: true,
96
+ writable: true,
97
+ value: void 0
98
+ });
99
+ Object.defineProperty(this, "skipBefore", {
100
+ enumerable: true,
101
+ configurable: true,
102
+ writable: true,
103
+ value: void 0
104
+ });
105
+ Object.defineProperty(this, "loop", {
106
+ enumerable: true,
107
+ configurable: true,
108
+ writable: true,
109
+ value: void 0
110
+ });
111
+ Object.defineProperty(this, "useCookies", {
112
+ enumerable: true,
113
+ configurable: true,
114
+ writable: true,
115
+ value: void 0
116
+ });
117
+ Object.defineProperty(this, "description", {
118
+ enumerable: true,
119
+ configurable: true,
120
+ writable: true,
121
+ value: void 0
122
+ });
123
+ Object.defineProperty(this, "delay", {
124
+ enumerable: true,
125
+ configurable: true,
126
+ writable: true,
127
+ value: void 0
128
+ });
129
+ Object.defineProperty(this, "postData", {
130
+ enumerable: true,
131
+ configurable: true,
132
+ writable: true,
133
+ value: void 0
134
+ });
135
+ Object.defineProperty(this, "postFormData", {
136
+ enumerable: true,
137
+ configurable: true,
138
+ writable: true,
139
+ value: void 0
140
+ });
141
+ Object.defineProperty(this, "graphqlPostData", {
142
+ enumerable: true,
143
+ configurable: true,
144
+ writable: true,
145
+ value: void 0
146
+ });
147
+ Object.defineProperty(this, "file", {
148
+ enumerable: true,
149
+ configurable: true,
150
+ writable: true,
151
+ value: void 0
152
+ });
153
+ Object.defineProperty(this, "grpc", {
154
+ enumerable: true,
155
+ configurable: true,
156
+ writable: true,
157
+ value: void 0
158
+ });
159
+ Object.defineProperty(this, "cachePenetration", {
160
+ enumerable: true,
161
+ configurable: true,
162
+ writable: true,
163
+ value: void 0
164
+ });
165
+ Object.defineProperty(this, "method", {
166
+ enumerable: true,
167
+ configurable: true,
168
+ writable: true,
169
+ value: 'GET'
170
+ });
171
+ Object.defineProperty(this, "headers", {
172
+ enumerable: true,
173
+ configurable: true,
174
+ writable: true,
175
+ value: void 0
176
+ });
177
+ Object.defineProperty(this, "assert", {
178
+ enumerable: true,
179
+ configurable: true,
180
+ writable: true,
181
+ value: void 0
182
+ });
183
+ Object.defineProperty(this, "extract", {
184
+ enumerable: true,
185
+ configurable: true,
186
+ writable: true,
187
+ value: void 0
188
+ });
189
+ Object.defineProperty(this, "postScript", {
190
+ enumerable: true,
191
+ configurable: true,
192
+ writable: true,
193
+ value: void 0
194
+ });
195
+ Object.defineProperty(this, "disabled", {
196
+ enumerable: true,
197
+ configurable: true,
198
+ writable: true,
199
+ value: void 0
200
+ });
201
+ Object.defineProperty(this, "timeout", {
202
+ enumerable: true,
203
+ configurable: true,
204
+ writable: true,
205
+ value: void 0
206
+ });
207
+ Object.defineProperty(this, "expectedStatus", {
208
+ enumerable: true,
209
+ configurable: true,
210
+ writable: true,
211
+ value: void 0
212
+ });
213
+ Object.defineProperty(this, "noRedirects", {
214
+ enumerable: true,
215
+ configurable: true,
216
+ writable: true,
217
+ value: void 0
218
+ });
219
+ Object.defineProperty(this, "meta", {
220
+ enumerable: true,
221
+ configurable: true,
222
+ writable: true,
223
+ value: void 0
224
+ });
225
+ }
226
+ return LoadmillRequest;
227
+ }());
228
+ exports.LoadmillRequest = LoadmillRequest;
229
+ var LoadmillOrFinfRequest = /** @class */ (function (_super) {
230
+ __extends(LoadmillOrFinfRequest, _super);
231
+ function LoadmillOrFinfRequest() {
232
+ var _this = _super !== null && _super.apply(this, arguments) || this;
233
+ Object.defineProperty(_this, "isFinfRequest", {
234
+ enumerable: true,
235
+ configurable: true,
236
+ writable: true,
237
+ value: void 0
238
+ });
239
+ return _this;
240
+ }
241
+ return LoadmillOrFinfRequest;
242
+ }(LoadmillRequest));
243
+ exports.LoadmillOrFinfRequest = LoadmillOrFinfRequest;
244
+ function resolveUrl(url, parameters, onError) {
245
+ return uriUtils.withProtocol(parameters_1.parameterUtils.resolveExpression(url, parameters, onError));
246
+ }
247
+ exports.resolveUrl = resolveUrl;
248
+ /**
249
+ * This function should be able to take any object/json and either make a VALID LoadmillRequest out of it
250
+ * or fail with a meaningful error message.
251
+ */
252
+ function createRequest(from) {
253
+ var id = from.id, url = from.url, delay = from.delay, assert = from.assert, method = from.method, timeout = from.timeout, extract = from.extract, headers = from.headers, postData = from.postData, postFormData = from.postFormData, graphqlPostData = from.graphqlPostData, file = from.file, stopBefore = from.stopBefore, skipBefore = from.skipBefore, loop = from.loop, description = from.description, expectedStatus = from.expectedStatus, postScript = from.postScript, disabled = from.disabled, noRedirects = from.noRedirects, meta = from.meta, grpc = from.grpc;
254
+ var request = new LoadmillRequest(url);
255
+ if (id) {
256
+ request.id = id;
257
+ }
258
+ if (method) {
259
+ request.method = method;
260
+ }
261
+ if (description) {
262
+ request.description = description;
263
+ }
264
+ if (headers) {
265
+ request.headers = toHeaders(headers);
266
+ }
267
+ if (postData) {
268
+ request.postData = {
269
+ text: postData.text,
270
+ mimeType: postData.mimeType,
271
+ params: postData.params
272
+ };
273
+ }
274
+ if (postFormData) {
275
+ request.postFormData = postFormData;
276
+ }
277
+ if (graphqlPostData) {
278
+ request.graphqlPostData = graphqlPostData;
279
+ }
280
+ if (file) {
281
+ request.file = file;
282
+ }
283
+ if (delay !== null && delay !== undefined) {
284
+ request.delay = delay;
285
+ }
286
+ if (stopBefore !== undefined) {
287
+ request.stopBefore = stopBefore;
288
+ }
289
+ if (skipBefore != null) {
290
+ var goTo = skipBefore.goTo, negate = skipBefore.negate, condition = skipBefore.condition;
291
+ request.skipBefore = {
292
+ goTo: goTo,
293
+ condition: condition,
294
+ negate: !!negate,
295
+ };
296
+ }
297
+ if (loop != null) {
298
+ var iterations = loop.iterations, assert_1 = loop.assert, wait = loop.wait;
299
+ var converted = toAssertions([assert_1])[0];
300
+ request.loop = {
301
+ assert: converted,
302
+ iterations: iterations,
303
+ wait: wait,
304
+ };
305
+ }
306
+ if (timeout != null) {
307
+ request.timeout = timeout;
308
+ }
309
+ if (extract) {
310
+ request.extract = toExtractions(extract);
311
+ }
312
+ if (assert) {
313
+ request.assert = toAssertions(assert);
314
+ }
315
+ if (expectedStatus) {
316
+ request.expectedStatus = expectedStatus;
317
+ }
318
+ if (postScript !== undefined) {
319
+ request.postScript = postScript;
320
+ }
321
+ if (disabled !== undefined) {
322
+ request.disabled = disabled;
323
+ }
324
+ if (noRedirects !== undefined) {
325
+ request.noRedirects = noRedirects;
326
+ }
327
+ if (meta) {
328
+ request.meta = meta;
329
+ }
330
+ if (grpc) {
331
+ request.grpc = grpc;
332
+ }
333
+ return request;
334
+ }
335
+ exports.createRequest = createRequest;
336
+ function toHeaders(headers) {
337
+ return flatMap(headers, function (value, key) {
338
+ var res = [];
339
+ if (typeof key === 'string') {
340
+ pushHeader(value, key, res);
341
+ }
342
+ else {
343
+ Object.keys(value).map(function (innerKey) {
344
+ var innerValue = value[innerKey];
345
+ pushHeader(innerValue, innerKey, res);
346
+ });
347
+ }
348
+ return res;
349
+ });
350
+ }
351
+ exports.toHeaders = toHeaders;
352
+ function toExtractions(extractions) {
353
+ if (!Array.isArray(extractions)) {
354
+ extractions = [extractions];
355
+ }
356
+ return extractions.map(toSingleExtractions);
357
+ }
358
+ function toSingleExtractions(extractions) {
359
+ var result = {};
360
+ // Arrgh: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12449
361
+ Object.keys(extractions).forEach(function (name) {
362
+ var extraction = extractions[name];
363
+ var newExtraction = extractions[name];
364
+ if (typeof extraction !== 'string') {
365
+ newExtraction = {};
366
+ var header = extraction.header, jQuery = extraction.jQuery, xPath = extraction.xPath, jsonPath = extraction.jsonPath, edn = extraction.edn, regex = extraction.regex, ws = extraction.ws;
367
+ if (header != null) {
368
+ newExtraction.header = header;
369
+ }
370
+ if (jQuery != null) {
371
+ newExtraction.jQuery =
372
+ typeof jQuery === 'string'
373
+ ? jQuery
374
+ : { query: jQuery.query, attr: jQuery.attr };
375
+ }
376
+ if (xPath != null) {
377
+ newExtraction.xPath = xPath;
378
+ }
379
+ if (jsonPath != null) {
380
+ newExtraction.jsonPath = jsonPath;
381
+ }
382
+ if (edn != null) {
383
+ newExtraction.edn = edn;
384
+ }
385
+ if (regex != null) {
386
+ newExtraction.regex = regex;
387
+ }
388
+ if (ws != null) {
389
+ newExtraction.ws = ws;
390
+ }
391
+ }
392
+ result[name] = newExtraction;
393
+ });
394
+ return result;
395
+ }
396
+ function toAssertions(assertions) {
397
+ var result = [];
398
+ assertions.forEach(function (assertion, key) {
399
+ var check = assertion.check, equals = assertion.equals, notEquals = assertion.notEquals, contains = assertion.contains, notContains = assertion.notContains, matches = assertion.matches, falsy = assertion.falsy, greater = assertion.greater, lesser = assertion.lesser, JSONSchema = assertion.JSONSchema, JSONContains = assertion.JSONContains, XMLContains = assertion.XMLContains, disabled = assertion.disabled;
400
+ var converted = {
401
+ check: check,
402
+ };
403
+ if (equals != null) {
404
+ converted.equals = equals;
405
+ }
406
+ if (notEquals != null) {
407
+ converted.notEquals = notEquals;
408
+ }
409
+ if (contains != null) {
410
+ converted.contains = contains;
411
+ }
412
+ if (notContains != null) {
413
+ converted.notContains = notContains;
414
+ }
415
+ if (matches != null) {
416
+ converted.matches = matches;
417
+ }
418
+ if (greater != null) {
419
+ converted.greater = greater;
420
+ }
421
+ if (lesser != null) {
422
+ converted.lesser = lesser;
423
+ }
424
+ if (falsy != null && (falsy === 'true' || falsy === true)) {
425
+ converted.falsy = true;
426
+ }
427
+ if (JSONSchema != null) {
428
+ converted.JSONSchema = JSONSchema;
429
+ }
430
+ if (JSONContains != null) {
431
+ converted.JSONContains = JSONContains;
432
+ }
433
+ if (XMLContains != null) {
434
+ converted.XMLContains = XMLContains;
435
+ }
436
+ if (disabled === true) {
437
+ converted.disabled = true;
438
+ }
439
+ result[key] = converted;
440
+ });
441
+ return result;
442
+ }
443
+ function findRequestIndex(requests, desc) {
444
+ return requests.findIndex(function (_a) {
445
+ var description = _a.description;
446
+ return description === desc;
447
+ });
448
+ }
449
+ exports.findRequestIndex = findRequestIndex;
450
+ function isReservedHeader(lowerName) {
451
+ return (lowerName.startsWith('proxy-') ||
452
+ (lowerName.startsWith('sec-') && !lowerName.startsWith('sec-websocket')) ||
453
+ lowerName === 'accept-charset' ||
454
+ lowerName === 'access-control-request-headers' ||
455
+ lowerName === 'access-control-request-method' ||
456
+ lowerName === 'connection' ||
457
+ lowerName === 'content-length' ||
458
+ lowerName === 'cookie2' ||
459
+ lowerName === 'date' ||
460
+ lowerName === 'dnt' ||
461
+ lowerName === 'expect' ||
462
+ lowerName === 'keep-alive' ||
463
+ lowerName === 'te' ||
464
+ lowerName === 'trailer' ||
465
+ lowerName === 'transfer-encoding' ||
466
+ lowerName === 'upgrade');
467
+ }
468
+ exports.isReservedHeader = isReservedHeader;
469
+ function pushHeader(value, name, to) {
470
+ to.push(singleton(value, name));
471
+ }
472
+ function singleton(value, name) {
473
+ var _a;
474
+ return _a = {}, _a[name] = value, _a;
475
+ }
476
+ var BodyTypes;
477
+ (function (BodyTypes) {
478
+ BodyTypes["POST_DATA"] = "postData";
479
+ BodyTypes["URLENCODED"] = "urlencoded";
480
+ BodyTypes["FORM_DATA"] = "postFormData";
481
+ BodyTypes["RAW_FILE"] = "rawFile";
482
+ BodyTypes["GRAPHQL"] = "GraphQL";
483
+ })(BodyTypes = exports.BodyTypes || (exports.BodyTypes = {}));
484
+ var CachePenetrationModes;
485
+ (function (CachePenetrationModes) {
486
+ CachePenetrationModes["none"] = "none";
487
+ CachePenetrationModes["def"] = "default";
488
+ CachePenetrationModes["alwaysQuery"] = "always-query";
489
+ CachePenetrationModes["alwaysHeader"] = "always-header";
490
+ })(CachePenetrationModes = exports.CachePenetrationModes || (exports.CachePenetrationModes = {}));
491
+ // list of fields in our object we must not change
492
+ exports.EXCLUDES = [
493
+ 'url',
494
+ 'method',
495
+ 'headers',
496
+ 'timeout',
497
+ 'postData',
498
+ 'text',
499
+ 'mimeType',
500
+ 'extract',
501
+ 'jsonPath',
502
+ 'jQuery',
503
+ 'regex',
504
+ 'header',
505
+ 'assert',
506
+ 'check',
507
+ 'equals',
508
+ 'contains',
509
+ 'matches',
510
+ 'falsy',
511
+ 'greater',
512
+ 'lesser',
513
+ ];
514
+ var isWSRequest = function (url) { return url.startsWith('ws://') || url.startsWith('wss://'); };
515
+ exports.isWSRequest = isWSRequest;
516
+ var isHTTPRequest = function (url) { return url.startsWith('http://') || url.startsWith('https://'); };
517
+ exports.isHTTPRequest = isHTTPRequest;
518
+ var isGRPCRequest = function (url) { return url.startsWith('grpc://'); };
519
+ exports.isGRPCRequest = isGRPCRequest;
520
+ var getResponseText = function (content) { return content.encoding === 'base64' ?
521
+ Buffer.from(content.text || '', 'base64').toString('utf8')
522
+ : content.text; };
523
+ exports.getResponseText = getResponseText;
524
+ var ConfMimeTypes;
525
+ (function (ConfMimeTypes) {
526
+ ConfMimeTypes["TEXT_PLAIN"] = "text/plain";
527
+ ConfMimeTypes["APPLICATION_JSON"] = "application/json";
528
+ ConfMimeTypes["APPLICATION_JAVASCRIPT"] = "application/javascript";
529
+ ConfMimeTypes["APPLICATION_XML"] = "application/xml";
530
+ ConfMimeTypes["APPLICATION_EDN"] = "application/edn";
531
+ ConfMimeTypes["TEXT_XML"] = "text/xml";
532
+ ConfMimeTypes["TEXT_HTML"] = "text/html";
533
+ ConfMimeTypes["TEXT_CSS"] = "text/css";
534
+ ConfMimeTypes["APPLICATION_URLENCODED"] = "application/x-www-form-urlencoded";
535
+ })(ConfMimeTypes = exports.ConfMimeTypes || (exports.ConfMimeTypes = {}));
536
+ var WsMessageType;
537
+ (function (WsMessageType) {
538
+ WsMessageType["TEXT"] = "text";
539
+ WsMessageType["BINARY"] = "binary";
540
+ })(WsMessageType = exports.WsMessageType || (exports.WsMessageType = {}));
541
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA2C;AAC3C,2EAA+D;AAC/D,4CAA2D;AAE9C,QAAA,uBAAuB,GAAG,KAAK,CAAC;AAChC,QAAA,gBAAgB,GAAG;IAC9B,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACf,CAAC;AACW,QAAA,yBAAyB,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAK5F;;;;;;;;;;;;GAYG;AAEH,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,yCAA0B,CAAA;IAC1B,4BAAa,CAAA;IACb,uCAAwB,CAAA;IACxB,kCAAmB,CAAA;IACnB,uCAAwB,CAAA;IACxB,qCAAsB,CAAA;AACxB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,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aAAa,iBAA4E;AAC/F,IAAM,aAAa,GAAG,UAAC,GAAW,IAAK,OAAA,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAzB,CAAyB,CAAC;AAA3D,QAAA,aAAa,iBAA8C;AAEjE,IAAM,eAAe,GAAG,UAAC,OAA6C,IAAK,OAAA,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IAC/G,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC1D,CAAC,CAAC,OAAO,CAAC,IAAI,EAFkE,CAElE,CAAC;AAFJ,QAAA,eAAe,mBAEX;AAEjB,IAAY,aAUT;AAVH,WAAY,aAAa;IACrB,0CAAyB,CAAA;IACzB,sDAAqC,CAAA;IACrC,kEAAiD,CAAA;IACjD,oDAAmC,CAAA;IACnC,oDAAmC,CAAA;IACnC,sCAAqB,CAAA;IACrB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;IACrB,6EAA4D,CAAA;AAC9D,CAAC,EAVS,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAUtB;AAEH,IAAY,aAGT;AAHH,WAAY,aAAa;IACrB,8BAAa,CAAA;IACb,kCAAiB,CAAA;AACnB,CAAC,EAHS,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGtB"}
@@ -0,0 +1,20 @@
1
+ export declare const generateJSONSchema: (jsObj: any, ignoreKeys?: string[], shouldAddNullable?: boolean, withExactValue?: boolean, withKeys?: boolean) => PrimitiveSchema | Schema;
2
+ export declare const isPrimitive: (obj: any) => obj is Primitive;
3
+ export declare const humanizeJsonSchemaErrors: (errors: any) => any;
4
+ export declare const getField: (property: any, message?: string | undefined) => any;
5
+ export declare const getJsonValidatorWithoutIgnoreKeys: (jsonValidator: any, ignoreKeys?: string[], shouldValidateArrays?: boolean) => string;
6
+ export declare type Schema = BaseSchema & {
7
+ properties?: {
8
+ [name: string]: Schema | PrimitiveSchema;
9
+ };
10
+ items?: Schema[] | PrimitiveSchema[];
11
+ };
12
+ export declare type PrimitiveSchema = BaseSchema & {
13
+ const?: Primitive;
14
+ };
15
+ declare type BaseSchema = {
16
+ type?: string | string[];
17
+ };
18
+ declare type Primitive = string | number | boolean;
19
+ export declare const ANY_VALUE = "*";
20
+ export {};