@loadmill/core 0.3.92 → 0.3.93

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 (169) 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 +108 -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 +10 -0
  68. package/dist/parameters/extractors/json-path-extractor.js +103 -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 +7 -0
  83. package/dist/parameters/extractors/x-path-extractor.js +50 -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 +88 -0
  92. package/dist/parameters/index.js +600 -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 +33 -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 +63 -0
  131. package/dist/parameters/parameter-functions/textual-parameter-functions.js +346 -0
  132. package/dist/parameters/parameter-functions/textual-parameter-functions.js.map +1 -0
  133. package/dist/parameters/parameter-name-utils.d.ts +3 -0
  134. package/dist/parameters/parameter-name-utils.js +71 -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 +255 -0
  149. package/dist/request/index.js +524 -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/package.json +2 -2
@@ -0,0 +1,524 @@
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.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, "cachePenetration", {
154
+ enumerable: true,
155
+ configurable: true,
156
+ writable: true,
157
+ value: void 0
158
+ });
159
+ Object.defineProperty(this, "method", {
160
+ enumerable: true,
161
+ configurable: true,
162
+ writable: true,
163
+ value: 'GET'
164
+ });
165
+ Object.defineProperty(this, "headers", {
166
+ enumerable: true,
167
+ configurable: true,
168
+ writable: true,
169
+ value: void 0
170
+ });
171
+ Object.defineProperty(this, "assert", {
172
+ enumerable: true,
173
+ configurable: true,
174
+ writable: true,
175
+ value: void 0
176
+ });
177
+ Object.defineProperty(this, "extract", {
178
+ enumerable: true,
179
+ configurable: true,
180
+ writable: true,
181
+ value: void 0
182
+ });
183
+ Object.defineProperty(this, "postScript", {
184
+ enumerable: true,
185
+ configurable: true,
186
+ writable: true,
187
+ value: void 0
188
+ });
189
+ Object.defineProperty(this, "disabled", {
190
+ enumerable: true,
191
+ configurable: true,
192
+ writable: true,
193
+ value: void 0
194
+ });
195
+ Object.defineProperty(this, "timeout", {
196
+ enumerable: true,
197
+ configurable: true,
198
+ writable: true,
199
+ value: void 0
200
+ });
201
+ Object.defineProperty(this, "expectedStatus", {
202
+ enumerable: true,
203
+ configurable: true,
204
+ writable: true,
205
+ value: void 0
206
+ });
207
+ Object.defineProperty(this, "noRedirects", {
208
+ enumerable: true,
209
+ configurable: true,
210
+ writable: true,
211
+ value: void 0
212
+ });
213
+ Object.defineProperty(this, "meta", {
214
+ enumerable: true,
215
+ configurable: true,
216
+ writable: true,
217
+ value: void 0
218
+ });
219
+ }
220
+ return LoadmillRequest;
221
+ }());
222
+ exports.LoadmillRequest = LoadmillRequest;
223
+ var LoadmillOrFinfRequest = /** @class */ (function (_super) {
224
+ __extends(LoadmillOrFinfRequest, _super);
225
+ function LoadmillOrFinfRequest() {
226
+ var _this = _super !== null && _super.apply(this, arguments) || this;
227
+ Object.defineProperty(_this, "isFinfRequest", {
228
+ enumerable: true,
229
+ configurable: true,
230
+ writable: true,
231
+ value: void 0
232
+ });
233
+ return _this;
234
+ }
235
+ return LoadmillOrFinfRequest;
236
+ }(LoadmillRequest));
237
+ exports.LoadmillOrFinfRequest = LoadmillOrFinfRequest;
238
+ function resolveUrl(url, parameters, onError) {
239
+ return uriUtils.withProtocol(parameters_1.parameterUtils.resolveExpression(url, parameters, onError));
240
+ }
241
+ exports.resolveUrl = resolveUrl;
242
+ /**
243
+ * This function should be able to take any object/json and either make a VALID LoadmillRequest out of it
244
+ * or fail with a meaningful error message.
245
+ */
246
+ function createRequest(from) {
247
+ 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;
248
+ var request = new LoadmillRequest(url);
249
+ if (id) {
250
+ request.id = id;
251
+ }
252
+ if (method) {
253
+ request.method = method;
254
+ }
255
+ if (description) {
256
+ request.description = description;
257
+ }
258
+ if (headers) {
259
+ request.headers = toHeaders(headers);
260
+ }
261
+ if (postData) {
262
+ request.postData = {
263
+ text: postData.text,
264
+ mimeType: postData.mimeType,
265
+ params: postData.params
266
+ };
267
+ }
268
+ if (postFormData) {
269
+ request.postFormData = postFormData;
270
+ }
271
+ if (graphqlPostData) {
272
+ request.graphqlPostData = graphqlPostData;
273
+ }
274
+ if (file) {
275
+ request.file = file;
276
+ }
277
+ if (delay !== null && delay !== undefined) {
278
+ request.delay = delay;
279
+ }
280
+ if (stopBefore !== undefined) {
281
+ request.stopBefore = stopBefore;
282
+ }
283
+ if (skipBefore != null) {
284
+ var goTo = skipBefore.goTo, negate = skipBefore.negate, condition = skipBefore.condition;
285
+ request.skipBefore = {
286
+ goTo: goTo,
287
+ condition: condition,
288
+ negate: !!negate,
289
+ };
290
+ }
291
+ if (loop != null) {
292
+ var iterations = loop.iterations, assert_1 = loop.assert, wait = loop.wait;
293
+ var converted = toAssertions([assert_1])[0];
294
+ request.loop = {
295
+ assert: converted,
296
+ iterations: iterations,
297
+ wait: wait,
298
+ };
299
+ }
300
+ if (timeout != null) {
301
+ request.timeout = timeout;
302
+ }
303
+ if (extract) {
304
+ request.extract = toExtractions(extract);
305
+ }
306
+ if (assert) {
307
+ request.assert = toAssertions(assert);
308
+ }
309
+ if (expectedStatus) {
310
+ request.expectedStatus = expectedStatus;
311
+ }
312
+ if (postScript !== undefined) {
313
+ request.postScript = postScript;
314
+ }
315
+ if (disabled !== undefined) {
316
+ request.disabled = disabled;
317
+ }
318
+ if (noRedirects !== undefined) {
319
+ request.noRedirects = noRedirects;
320
+ }
321
+ if (meta) {
322
+ request.meta = meta;
323
+ }
324
+ return request;
325
+ }
326
+ exports.createRequest = createRequest;
327
+ function toHeaders(headers) {
328
+ return flatMap(headers, function (value, key) {
329
+ var res = [];
330
+ if (typeof key === 'string') {
331
+ pushHeader(value, key, res);
332
+ }
333
+ else {
334
+ Object.keys(value).map(function (innerKey) {
335
+ var innerValue = value[innerKey];
336
+ pushHeader(innerValue, innerKey, res);
337
+ });
338
+ }
339
+ return res;
340
+ });
341
+ }
342
+ exports.toHeaders = toHeaders;
343
+ function toExtractions(extractions) {
344
+ if (!Array.isArray(extractions)) {
345
+ extractions = [extractions];
346
+ }
347
+ return extractions.map(toSingleExtractions);
348
+ }
349
+ function toSingleExtractions(extractions) {
350
+ var result = {};
351
+ // Arrgh: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12449
352
+ Object.keys(extractions).forEach(function (name) {
353
+ var extraction = extractions[name];
354
+ var newExtraction = extractions[name];
355
+ if (typeof extraction !== 'string') {
356
+ newExtraction = {};
357
+ var header = extraction.header, jQuery = extraction.jQuery, xPath = extraction.xPath, jsonPath = extraction.jsonPath, edn = extraction.edn, regex = extraction.regex, ws = extraction.ws;
358
+ if (header != null) {
359
+ newExtraction.header = header;
360
+ }
361
+ if (jQuery != null) {
362
+ newExtraction.jQuery =
363
+ typeof jQuery === 'string'
364
+ ? jQuery
365
+ : { query: jQuery.query, attr: jQuery.attr };
366
+ }
367
+ if (xPath != null) {
368
+ newExtraction.xPath = xPath;
369
+ }
370
+ if (jsonPath != null) {
371
+ newExtraction.jsonPath = jsonPath;
372
+ }
373
+ if (edn != null) {
374
+ newExtraction.edn = edn;
375
+ }
376
+ if (regex != null) {
377
+ newExtraction.regex = regex;
378
+ }
379
+ if (ws != null) {
380
+ newExtraction.ws = ws;
381
+ }
382
+ }
383
+ result[name] = newExtraction;
384
+ });
385
+ return result;
386
+ }
387
+ function toAssertions(assertions) {
388
+ var result = [];
389
+ assertions.forEach(function (assertion, key) {
390
+ 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;
391
+ var converted = {
392
+ check: check,
393
+ };
394
+ if (equals != null) {
395
+ converted.equals = equals;
396
+ }
397
+ if (notEquals != null) {
398
+ converted.notEquals = notEquals;
399
+ }
400
+ if (contains != null) {
401
+ converted.contains = contains;
402
+ }
403
+ if (notContains != null) {
404
+ converted.notContains = notContains;
405
+ }
406
+ if (matches != null) {
407
+ converted.matches = matches;
408
+ }
409
+ if (greater != null) {
410
+ converted.greater = greater;
411
+ }
412
+ if (lesser != null) {
413
+ converted.lesser = lesser;
414
+ }
415
+ if (falsy != null && (falsy === 'true' || falsy === true)) {
416
+ converted.falsy = true;
417
+ }
418
+ if (JSONSchema != null) {
419
+ converted.JSONSchema = JSONSchema;
420
+ }
421
+ if (JSONContains != null) {
422
+ converted.JSONContains = JSONContains;
423
+ }
424
+ result[key] = converted;
425
+ });
426
+ return result;
427
+ }
428
+ function findRequestIndex(requests, desc) {
429
+ return requests.findIndex(function (_a) {
430
+ var description = _a.description;
431
+ return description === desc;
432
+ });
433
+ }
434
+ exports.findRequestIndex = findRequestIndex;
435
+ function isReservedHeader(lowerName) {
436
+ return (lowerName.startsWith('proxy-') ||
437
+ (lowerName.startsWith('sec-') && !lowerName.startsWith('sec-websocket')) ||
438
+ lowerName === 'accept-charset' ||
439
+ lowerName === 'access-control-request-headers' ||
440
+ lowerName === 'access-control-request-method' ||
441
+ lowerName === 'connection' ||
442
+ lowerName === 'content-length' ||
443
+ lowerName === 'cookie2' ||
444
+ lowerName === 'date' ||
445
+ lowerName === 'dnt' ||
446
+ lowerName === 'expect' ||
447
+ lowerName === 'keep-alive' ||
448
+ lowerName === 'te' ||
449
+ lowerName === 'trailer' ||
450
+ lowerName === 'transfer-encoding' ||
451
+ lowerName === 'upgrade');
452
+ }
453
+ exports.isReservedHeader = isReservedHeader;
454
+ function pushHeader(value, name, to) {
455
+ to.push(singleton(value, name));
456
+ }
457
+ function singleton(value, name) {
458
+ var _a;
459
+ return _a = {}, _a[name] = value, _a;
460
+ }
461
+ var BodyTypes;
462
+ (function (BodyTypes) {
463
+ BodyTypes["POST_DATA"] = "postData";
464
+ BodyTypes["URLENCODED"] = "urlencoded";
465
+ BodyTypes["FORM_DATA"] = "postFormData";
466
+ BodyTypes["RAW_FILE"] = "rawFile";
467
+ BodyTypes["GRAPHQL"] = "GraphQL";
468
+ })(BodyTypes = exports.BodyTypes || (exports.BodyTypes = {}));
469
+ var CachePenetrationModes;
470
+ (function (CachePenetrationModes) {
471
+ CachePenetrationModes["none"] = "none";
472
+ CachePenetrationModes["def"] = "default";
473
+ CachePenetrationModes["alwaysQuery"] = "always-query";
474
+ CachePenetrationModes["alwaysHeader"] = "always-header";
475
+ })(CachePenetrationModes = exports.CachePenetrationModes || (exports.CachePenetrationModes = {}));
476
+ // list of fields in our object we must not change
477
+ exports.EXCLUDES = [
478
+ 'url',
479
+ 'method',
480
+ 'headers',
481
+ 'timeout',
482
+ 'postData',
483
+ 'text',
484
+ 'mimeType',
485
+ 'extract',
486
+ 'jsonPath',
487
+ 'jQuery',
488
+ 'regex',
489
+ 'header',
490
+ 'assert',
491
+ 'check',
492
+ 'equals',
493
+ 'contains',
494
+ 'matches',
495
+ 'falsy',
496
+ 'greater',
497
+ 'lesser',
498
+ ];
499
+ var isWSRequest = function (url) { return url.startsWith('ws://') || url.startsWith('wss://'); };
500
+ exports.isWSRequest = isWSRequest;
501
+ var isHTTPRequest = function (url) { return url.startsWith('http://') || url.startsWith('https://'); };
502
+ exports.isHTTPRequest = isHTTPRequest;
503
+ var getResponseText = function (content) { return content.encoding === 'base64' ?
504
+ Buffer.from(content.text || '', 'base64').toString('utf8')
505
+ : content.text; };
506
+ exports.getResponseText = getResponseText;
507
+ var ConfMimeTypes;
508
+ (function (ConfMimeTypes) {
509
+ ConfMimeTypes["TEXT_PLAIN"] = "text/plain";
510
+ ConfMimeTypes["APPLICATION_JSON"] = "application/json";
511
+ ConfMimeTypes["APPLICATION_JAVASCRIPT"] = "application/javascript";
512
+ ConfMimeTypes["APPLICATION_XML"] = "application/xml";
513
+ ConfMimeTypes["APPLICATION_EDN"] = "application/edn";
514
+ ConfMimeTypes["TEXT_XML"] = "text/xml";
515
+ ConfMimeTypes["TEXT_HTML"] = "text/html";
516
+ ConfMimeTypes["TEXT_CSS"] = "text/css";
517
+ ConfMimeTypes["APPLICATION_URLENCODED"] = "application/x-www-form-urlencoded";
518
+ })(ConfMimeTypes = exports.ConfMimeTypes || (exports.ConfMimeTypes = {}));
519
+ var WsMessageType;
520
+ (function (WsMessageType) {
521
+ WsMessageType["TEXT"] = "text";
522
+ WsMessageType["BINARY"] = "binary";
523
+ })(WsMessageType = exports.WsMessageType || (exports.WsMessageType = {}));
524
+ //# 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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Y,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 {};