@loadmill/core 0.3.137 → 0.3.139

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 (217) hide show
  1. package/package.json +2 -2
  2. package/dist/assertions/index.d.ts +0 -32
  3. package/dist/assertions/index.js +0 -52
  4. package/dist/assertions/index.js.map +0 -1
  5. package/dist/code-step/index.d.ts +0 -22
  6. package/dist/code-step/index.js +0 -97
  7. package/dist/code-step/index.js.map +0 -1
  8. package/dist/conf/defaults.d.ts +0 -1
  9. package/dist/conf/defaults.js +0 -11
  10. package/dist/conf/defaults.js.map +0 -1
  11. package/dist/conf/extrema.d.ts +0 -7
  12. package/dist/conf/extrema.js +0 -12
  13. package/dist/conf/extrema.js.map +0 -1
  14. package/dist/conf/index.d.ts +0 -15
  15. package/dist/conf/index.js +0 -80
  16. package/dist/conf/index.js.map +0 -1
  17. package/dist/conf/notifications.d.ts +0 -2
  18. package/dist/conf/notifications.js +0 -19
  19. package/dist/conf/notifications.js.map +0 -1
  20. package/dist/conf/types.d.ts +0 -113
  21. package/dist/conf/types.js +0 -38
  22. package/dist/conf/types.js.map +0 -1
  23. package/dist/conf/validate.d.ts +0 -69
  24. package/dist/conf/validate.js +0 -501
  25. package/dist/conf/validate.js.map +0 -1
  26. package/dist/distributed-logger-reporter.d.ts +0 -3
  27. package/dist/distributed-logger-reporter.js +0 -74
  28. package/dist/distributed-logger-reporter.js.map +0 -1
  29. package/dist/echo/firehose.d.ts +0 -7
  30. package/dist/echo/firehose.js +0 -130
  31. package/dist/echo/firehose.js.map +0 -1
  32. package/dist/echo/index.d.ts +0 -3
  33. package/dist/echo/index.js +0 -8
  34. package/dist/echo/index.js.map +0 -1
  35. package/dist/echo/stats.d.ts +0 -8
  36. package/dist/echo/stats.js +0 -152
  37. package/dist/echo/stats.js.map +0 -1
  38. package/dist/har/index.d.ts +0 -71
  39. package/dist/har/index.js +0 -61
  40. package/dist/har/index.js.map +0 -1
  41. package/dist/labels/constants.d.ts +0 -1
  42. package/dist/labels/constants.js +0 -5
  43. package/dist/labels/constants.js.map +0 -1
  44. package/dist/multipart-form-data/files.d.ts +0 -2
  45. package/dist/multipart-form-data/files.js +0 -63
  46. package/dist/multipart-form-data/files.js.map +0 -1
  47. package/dist/multipart-form-data/form-data-utils.d.ts +0 -19
  48. package/dist/multipart-form-data/form-data-utils.js +0 -117
  49. package/dist/multipart-form-data/form-data-utils.js.map +0 -1
  50. package/dist/multipart-form-data/is-binary-file.d.ts +0 -2
  51. package/dist/multipart-form-data/is-binary-file.js +0 -215
  52. package/dist/multipart-form-data/is-binary-file.js.map +0 -1
  53. package/dist/multipart-form-data/multipart-text-to-post-form-data.d.ts +0 -2
  54. package/dist/multipart-form-data/multipart-text-to-post-form-data.js +0 -86
  55. package/dist/multipart-form-data/multipart-text-to-post-form-data.js.map +0 -1
  56. package/dist/parameters/extractions.d.ts +0 -27
  57. package/dist/parameters/extractions.js +0 -51
  58. package/dist/parameters/extractions.js.map +0 -1
  59. package/dist/parameters/extractors/cheerio-extractor.d.ts +0 -11
  60. package/dist/parameters/extractors/cheerio-extractor.js +0 -84
  61. package/dist/parameters/extractors/cheerio-extractor.js.map +0 -1
  62. package/dist/parameters/extractors/expression-extractor.d.ts +0 -6
  63. package/dist/parameters/extractors/expression-extractor.js +0 -38
  64. package/dist/parameters/extractors/expression-extractor.js.map +0 -1
  65. package/dist/parameters/extractors/extractor.d.ts +0 -3
  66. package/dist/parameters/extractors/extractor.js +0 -3
  67. package/dist/parameters/extractors/extractor.js.map +0 -1
  68. package/dist/parameters/extractors/header-extractor.d.ts +0 -7
  69. package/dist/parameters/extractors/header-extractor.js +0 -51
  70. package/dist/parameters/extractors/header-extractor.js.map +0 -1
  71. package/dist/parameters/extractors/index.d.ts +0 -10
  72. package/dist/parameters/extractors/index.js +0 -20
  73. package/dist/parameters/extractors/index.js.map +0 -1
  74. package/dist/parameters/extractors/json-path-extractor.d.ts +0 -11
  75. package/dist/parameters/extractors/json-path-extractor.js +0 -127
  76. package/dist/parameters/extractors/json-path-extractor.js.map +0 -1
  77. package/dist/parameters/extractors/parametrized-extractor.d.ts +0 -10
  78. package/dist/parameters/extractors/parametrized-extractor.js +0 -34
  79. package/dist/parameters/extractors/parametrized-extractor.js.map +0 -1
  80. package/dist/parameters/extractors/regex-extractor.d.ts +0 -7
  81. package/dist/parameters/extractors/regex-extractor.js +0 -46
  82. package/dist/parameters/extractors/regex-extractor.js.map +0 -1
  83. package/dist/parameters/extractors/regex-matcher.d.ts +0 -1
  84. package/dist/parameters/extractors/regex-matcher.js +0 -22
  85. package/dist/parameters/extractors/regex-matcher.js.map +0 -1
  86. package/dist/parameters/extractors/ws-extractor.d.ts +0 -33
  87. package/dist/parameters/extractors/ws-extractor.js +0 -215
  88. package/dist/parameters/extractors/ws-extractor.js.map +0 -1
  89. package/dist/parameters/extractors/x-path-extractor.d.ts +0 -9
  90. package/dist/parameters/extractors/x-path-extractor.js +0 -77
  91. package/dist/parameters/extractors/x-path-extractor.js.map +0 -1
  92. package/dist/parameters/generate-random.d.ts +0 -13
  93. package/dist/parameters/generate-random.js +0 -108
  94. package/dist/parameters/generate-random.js.map +0 -1
  95. package/dist/parameters/html-utils.d.ts +0 -1
  96. package/dist/parameters/html-utils.js +0 -18
  97. package/dist/parameters/html-utils.js.map +0 -1
  98. package/dist/parameters/index.d.ts +0 -92
  99. package/dist/parameters/index.js +0 -619
  100. package/dist/parameters/index.js.map +0 -1
  101. package/dist/parameters/json-path-utils.d.ts +0 -1
  102. package/dist/parameters/json-path-utils.js +0 -16
  103. package/dist/parameters/json-path-utils.js.map +0 -1
  104. package/dist/parameters/operators/binary-operator.d.ts +0 -13
  105. package/dist/parameters/operators/binary-operator.js +0 -39
  106. package/dist/parameters/operators/binary-operator.js.map +0 -1
  107. package/dist/parameters/operators/index.d.ts +0 -5
  108. package/dist/parameters/operators/index.js +0 -21
  109. package/dist/parameters/operators/index.js.map +0 -1
  110. package/dist/parameters/parameter-functions/aws-cognito.d.ts +0 -3
  111. package/dist/parameters/parameter-functions/aws-cognito.js +0 -119
  112. package/dist/parameters/parameter-functions/aws-cognito.js.map +0 -1
  113. package/dist/parameters/parameter-functions/boolean-parameter-functions.d.ts +0 -12
  114. package/dist/parameters/parameter-functions/boolean-parameter-functions.js +0 -47
  115. package/dist/parameters/parameter-functions/boolean-parameter-functions.js.map +0 -1
  116. package/dist/parameters/parameter-functions/crypto.d.ts +0 -11
  117. package/dist/parameters/parameter-functions/crypto.js +0 -71
  118. package/dist/parameters/parameter-functions/crypto.js.map +0 -1
  119. package/dist/parameters/parameter-functions/json-schema.d.ts +0 -1
  120. package/dist/parameters/parameter-functions/json-schema.js +0 -33
  121. package/dist/parameters/parameter-functions/json-schema.js.map +0 -1
  122. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.d.ts +0 -11
  123. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js +0 -34
  124. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js.map +0 -1
  125. package/dist/parameters/parameter-functions/numeric-parameter-functions.d.ts +0 -15
  126. package/dist/parameters/parameter-functions/numeric-parameter-functions.js +0 -56
  127. package/dist/parameters/parameter-functions/numeric-parameter-functions.js.map +0 -1
  128. package/dist/parameters/parameter-functions/parameter-function-utils.d.ts +0 -5
  129. package/dist/parameters/parameter-functions/parameter-function-utils.js +0 -82
  130. package/dist/parameters/parameter-functions/parameter-function-utils.js.map +0 -1
  131. package/dist/parameters/parameter-functions/parameter-function.d.ts +0 -6
  132. package/dist/parameters/parameter-functions/parameter-function.js +0 -28
  133. package/dist/parameters/parameter-functions/parameter-function.js.map +0 -1
  134. package/dist/parameters/parameter-functions/parameter-functions.d.ts +0 -7
  135. package/dist/parameters/parameter-functions/parameter-functions.js +0 -53
  136. package/dist/parameters/parameter-functions/parameter-functions.js.map +0 -1
  137. package/dist/parameters/parameter-functions/random-parameter-functions.d.ts +0 -1
  138. package/dist/parameters/parameter-functions/random-parameter-functions.js +0 -43
  139. package/dist/parameters/parameter-functions/random-parameter-functions.js.map +0 -1
  140. package/dist/parameters/parameter-functions/textual-parameter-functions.d.ts +0 -72
  141. package/dist/parameters/parameter-functions/textual-parameter-functions.js +0 -389
  142. package/dist/parameters/parameter-functions/textual-parameter-functions.js.map +0 -1
  143. package/dist/parameters/parameter-name-utils.d.ts +0 -5
  144. package/dist/parameters/parameter-name-utils.js +0 -123
  145. package/dist/parameters/parameter-name-utils.js.map +0 -1
  146. package/dist/parameters/parameter-regex-providers.d.ts +0 -24
  147. package/dist/parameters/parameter-regex-providers.js +0 -70
  148. package/dist/parameters/parameter-regex-providers.js.map +0 -1
  149. package/dist/parameters/resolvers/random-parameters-resolver.d.ts +0 -1
  150. package/dist/parameters/resolvers/random-parameters-resolver.js +0 -12
  151. package/dist/parameters/resolvers/random-parameters-resolver.js.map +0 -1
  152. package/dist/parameters/type.d.ts +0 -10
  153. package/dist/parameters/type.js +0 -9
  154. package/dist/parameters/type.js.map +0 -1
  155. package/dist/parameters/value-utils.d.ts +0 -5
  156. package/dist/parameters/value-utils.js +0 -44
  157. package/dist/parameters/value-utils.js.map +0 -1
  158. package/dist/request/index.d.ts +0 -235
  159. package/dist/request/index.js +0 -399
  160. package/dist/request/index.js.map +0 -1
  161. package/dist/schema/json-schema-generator.d.ts +0 -20
  162. package/dist/schema/json-schema-generator.js +0 -135
  163. package/dist/schema/json-schema-generator.js.map +0 -1
  164. package/dist/signals.d.ts +0 -4
  165. package/dist/signals.js +0 -9
  166. package/dist/signals.js.map +0 -1
  167. package/dist/socket-events/index.d.ts +0 -13
  168. package/dist/socket-events/index.js +0 -17
  169. package/dist/socket-events/index.js.map +0 -1
  170. package/dist/step/index.d.ts +0 -71
  171. package/dist/step/index.js +0 -70
  172. package/dist/step/index.js.map +0 -1
  173. package/dist/step/step-type.d.ts +0 -3
  174. package/dist/step/step-type.js +0 -3
  175. package/dist/step/step-type.js.map +0 -1
  176. package/dist/step/type-guards.d.ts +0 -5
  177. package/dist/step/type-guards.js +0 -14
  178. package/dist/step/type-guards.js.map +0 -1
  179. package/dist/subset/index.d.ts +0 -3
  180. package/dist/subset/index.js +0 -8
  181. package/dist/subset/index.js.map +0 -1
  182. package/dist/subset/is-subset.d.ts +0 -2
  183. package/dist/subset/is-subset.js +0 -29
  184. package/dist/subset/is-subset.js.map +0 -1
  185. package/dist/subset/json-contains.d.ts +0 -1
  186. package/dist/subset/json-contains.js +0 -24
  187. package/dist/subset/json-contains.js.map +0 -1
  188. package/dist/team-options/constants.d.ts +0 -3
  189. package/dist/team-options/constants.js +0 -7
  190. package/dist/team-options/constants.js.map +0 -1
  191. package/dist/xml/decode.d.ts +0 -2
  192. package/dist/xml/decode.js +0 -91
  193. package/dist/xml/decode.js.map +0 -1
  194. package/dist/xml/encode.d.ts +0 -1
  195. package/dist/xml/encode.js +0 -14
  196. package/dist/xml/encode.js.map +0 -1
  197. package/dist/xml/escape-reserved-chars.d.ts +0 -6
  198. package/dist/xml/escape-reserved-chars.js +0 -57
  199. package/dist/xml/escape-reserved-chars.js.map +0 -1
  200. package/dist/xml/is-xml.d.ts +0 -1
  201. package/dist/xml/is-xml.js +0 -9
  202. package/dist/xml/is-xml.js.map +0 -1
  203. package/dist/xml/json-to-xml.d.ts +0 -2
  204. package/dist/xml/json-to-xml.js +0 -11
  205. package/dist/xml/json-to-xml.js.map +0 -1
  206. package/dist/xml/namespaces.d.ts +0 -7
  207. package/dist/xml/namespaces.js +0 -16
  208. package/dist/xml/namespaces.js.map +0 -1
  209. package/dist/xml/remove-invisible-chars.d.ts +0 -2
  210. package/dist/xml/remove-invisible-chars.js +0 -13
  211. package/dist/xml/remove-invisible-chars.js.map +0 -1
  212. package/dist/xml/replace-s-tags.d.ts +0 -4
  213. package/dist/xml/replace-s-tags.js +0 -21
  214. package/dist/xml/replace-s-tags.js.map +0 -1
  215. package/dist/xml/xml-to-json.d.ts +0 -7
  216. package/dist/xml/xml-to-json.js +0 -21
  217. package/dist/xml/xml-to-json.js.map +0 -1
@@ -1,399 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.RequestType = exports.WsMessageType = exports.ConfMimeTypes = exports.getResponseText = exports.isGRPCRequest = exports.isHTTPRequest = exports.isWSRequest = exports.EXCLUDES = exports.CachePenetrationModes = exports.BodyTypes = exports.isReservedHeader = exports.toHeaders = exports.createRequest = exports.resolveUrl = exports.LoadmillRequest = exports.ALLOWED_RESPONSE_STATUSES = exports.supportedMethods = exports.DEFAULT_REQUEST_TIMEOUT = void 0;
23
- var flatMap = require("lodash/flatMap");
24
- var uriUtils = __importStar(require("@loadmill/universal/dist/uri-utils"));
25
- var parameters_1 = require("../parameters");
26
- var har_1 = require("../har");
27
- var step_1 = require("../step");
28
- Object.defineProperty(exports, "RequestType", { enumerable: true, get: function () { return step_1.StepFlowType; } });
29
- var assertions_1 = require("../assertions");
30
- exports.DEFAULT_REQUEST_TIMEOUT = 25000;
31
- exports.supportedMethods = {
32
- GET: 'GET',
33
- POST: 'POST',
34
- PUT: 'PUT',
35
- DELETE: 'DELETE',
36
- PATCH: 'PATCH',
37
- };
38
- exports.ALLOWED_RESPONSE_STATUSES = { SUCCESS: 'SUCCESS', ERROR: 'ERROR', ANY: 'ANY' };
39
- /**
40
- * This class represents an HTTP request to be performed in the course of a load test.
41
- *
42
- * @property url The URL of the request (parameterizable).
43
- * @property method The HTTP method.
44
- * @property headers An array of headers to add to the request (values parameterizable).
45
- * @property postData The content of the request (text parameterizable).
46
- * @property delay The delay between this request and the previous one in milliseconds. This property is ignored for the first request.
47
- * @property timeout The time to wait for the request to finish in milliseconds.
48
- * @property extract A dictionary of parameter extractions.
49
- * @property assert An array or dictionary of assertions.
50
- * @property expectedStatus The expected status of the http response SUCCESS for 2XX-3XX, ERROR for 4XX-5XX.
51
- */
52
- var LoadmillRequest = /** @class */ (function () {
53
- function LoadmillRequest(url) {
54
- Object.defineProperty(this, "url", {
55
- enumerable: true,
56
- configurable: true,
57
- writable: true,
58
- value: url
59
- });
60
- Object.defineProperty(this, "type", {
61
- enumerable: true,
62
- configurable: true,
63
- writable: true,
64
- value: void 0
65
- });
66
- Object.defineProperty(this, "id", {
67
- enumerable: true,
68
- configurable: true,
69
- writable: true,
70
- value: void 0
71
- });
72
- Object.defineProperty(this, "auth", {
73
- enumerable: true,
74
- configurable: true,
75
- writable: true,
76
- value: void 0
77
- });
78
- Object.defineProperty(this, "stopBefore", {
79
- enumerable: true,
80
- configurable: true,
81
- writable: true,
82
- value: void 0
83
- });
84
- Object.defineProperty(this, "skipBefore", {
85
- enumerable: true,
86
- configurable: true,
87
- writable: true,
88
- value: void 0
89
- });
90
- Object.defineProperty(this, "loop", {
91
- enumerable: true,
92
- configurable: true,
93
- writable: true,
94
- value: void 0
95
- });
96
- Object.defineProperty(this, "useCookies", {
97
- enumerable: true,
98
- configurable: true,
99
- writable: true,
100
- value: void 0
101
- });
102
- Object.defineProperty(this, "description", {
103
- enumerable: true,
104
- configurable: true,
105
- writable: true,
106
- value: void 0
107
- });
108
- Object.defineProperty(this, "delay", {
109
- enumerable: true,
110
- configurable: true,
111
- writable: true,
112
- value: void 0
113
- });
114
- Object.defineProperty(this, "postData", {
115
- enumerable: true,
116
- configurable: true,
117
- writable: true,
118
- value: void 0
119
- });
120
- Object.defineProperty(this, "postFormData", {
121
- enumerable: true,
122
- configurable: true,
123
- writable: true,
124
- value: void 0
125
- });
126
- Object.defineProperty(this, "graphqlPostData", {
127
- enumerable: true,
128
- configurable: true,
129
- writable: true,
130
- value: void 0
131
- });
132
- Object.defineProperty(this, "file", {
133
- enumerable: true,
134
- configurable: true,
135
- writable: true,
136
- value: void 0
137
- });
138
- Object.defineProperty(this, "grpc", {
139
- enumerable: true,
140
- configurable: true,
141
- writable: true,
142
- value: void 0
143
- });
144
- Object.defineProperty(this, "cachePenetration", {
145
- enumerable: true,
146
- configurable: true,
147
- writable: true,
148
- value: void 0
149
- });
150
- Object.defineProperty(this, "method", {
151
- enumerable: true,
152
- configurable: true,
153
- writable: true,
154
- value: 'GET'
155
- });
156
- Object.defineProperty(this, "headers", {
157
- enumerable: true,
158
- configurable: true,
159
- writable: true,
160
- value: void 0
161
- });
162
- Object.defineProperty(this, "assert", {
163
- enumerable: true,
164
- configurable: true,
165
- writable: true,
166
- value: void 0
167
- });
168
- Object.defineProperty(this, "extract", {
169
- enumerable: true,
170
- configurable: true,
171
- writable: true,
172
- value: void 0
173
- });
174
- Object.defineProperty(this, "postScript", {
175
- enumerable: true,
176
- configurable: true,
177
- writable: true,
178
- value: void 0
179
- });
180
- Object.defineProperty(this, "disabled", {
181
- enumerable: true,
182
- configurable: true,
183
- writable: true,
184
- value: void 0
185
- });
186
- Object.defineProperty(this, "timeout", {
187
- enumerable: true,
188
- configurable: true,
189
- writable: true,
190
- value: void 0
191
- });
192
- Object.defineProperty(this, "expectedStatus", {
193
- enumerable: true,
194
- configurable: true,
195
- writable: true,
196
- value: void 0
197
- });
198
- Object.defineProperty(this, "noRedirects", {
199
- enumerable: true,
200
- configurable: true,
201
- writable: true,
202
- value: void 0
203
- });
204
- Object.defineProperty(this, "meta", {
205
- enumerable: true,
206
- configurable: true,
207
- writable: true,
208
- value: void 0
209
- });
210
- this.type = step_1.StepTypes.REQUEST;
211
- }
212
- return LoadmillRequest;
213
- }());
214
- exports.LoadmillRequest = LoadmillRequest;
215
- function resolveUrl(url, parameters, onError) {
216
- return uriUtils.withProtocol(parameters_1.parameterUtils.resolveExpression(url, parameters, onError));
217
- }
218
- exports.resolveUrl = resolveUrl;
219
- /**
220
- * This function should be able to take any object/json and either make a VALID LoadmillRequest out of it
221
- * or fail with a meaningful error message.
222
- */
223
- function createRequest(from) {
224
- var url = from.url, assert = from.assert, method = from.method, extract = from.extract, headers = from.headers, postData = from.postData, postFormData = from.postFormData, graphqlPostData = from.graphqlPostData, file = from.file, postScript = from.postScript, noRedirects = from.noRedirects, grpc = from.grpc;
225
- var request = step_1.createStep(from, new LoadmillRequest(url));
226
- if (method) {
227
- request.method = method;
228
- }
229
- if (headers) {
230
- request.headers = toHeaders(headers);
231
- }
232
- if (postData) {
233
- request.postData = {
234
- text: postData.text,
235
- mimeType: postData.mimeType,
236
- params: postData.params
237
- };
238
- }
239
- if (postFormData) {
240
- request.postFormData = postFormData;
241
- }
242
- if (graphqlPostData) {
243
- request.graphqlPostData = graphqlPostData;
244
- }
245
- if (file) {
246
- request.file = file;
247
- }
248
- if (extract) {
249
- request.extract = toExtractions(extract);
250
- }
251
- if (assert) {
252
- request.assert = assertions_1.toAssertions(assert);
253
- }
254
- if (postScript !== undefined) {
255
- request.postScript = postScript;
256
- }
257
- if (noRedirects !== undefined) {
258
- request.noRedirects = noRedirects;
259
- }
260
- if (grpc) {
261
- request.grpc = grpc;
262
- }
263
- return request;
264
- }
265
- exports.createRequest = createRequest;
266
- function toHeaders(headers) {
267
- return flatMap(headers, function (value, key) {
268
- var res = [];
269
- if (typeof key === 'string') {
270
- pushHeader(value, key, res);
271
- }
272
- else {
273
- Object.keys(value).map(function (innerKey) {
274
- var innerValue = value[innerKey];
275
- pushHeader(innerValue, innerKey, res);
276
- });
277
- }
278
- return res;
279
- });
280
- }
281
- exports.toHeaders = toHeaders;
282
- function toExtractions(extractions) {
283
- if (!Array.isArray(extractions)) {
284
- extractions = [extractions];
285
- }
286
- return extractions.map(toSingleExtractions);
287
- }
288
- function toSingleExtractions(extractions) {
289
- var result = {};
290
- // Arrgh: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12449
291
- Object.keys(extractions).forEach(function (name) {
292
- var extraction = extractions[name];
293
- var newExtraction = extractions[name];
294
- if (typeof extraction !== 'string') {
295
- newExtraction = {};
296
- var header = extraction.header, jQuery = extraction.jQuery, xPath = extraction.xPath, jsonPath = extraction.jsonPath, edn = extraction.edn, regex = extraction.regex, ws = extraction.ws;
297
- if (header != null) {
298
- newExtraction.header = header;
299
- }
300
- if (jQuery != null) {
301
- newExtraction.jQuery =
302
- typeof jQuery === 'string'
303
- ? jQuery
304
- : { query: jQuery.query, attr: jQuery.attr };
305
- }
306
- if (xPath != null) {
307
- newExtraction.xPath = xPath;
308
- }
309
- if (jsonPath != null) {
310
- newExtraction.jsonPath = jsonPath;
311
- }
312
- if (edn != null) {
313
- newExtraction.edn = edn;
314
- }
315
- if (regex != null) {
316
- newExtraction.regex = regex;
317
- }
318
- if (ws != null) {
319
- newExtraction.ws = ws;
320
- }
321
- }
322
- result[name] = newExtraction;
323
- });
324
- return result;
325
- }
326
- exports.isReservedHeader = har_1.isReservedHeader;
327
- function pushHeader(value, name, to) {
328
- to.push(singleton(value, name));
329
- }
330
- function singleton(value, name) {
331
- var _a;
332
- return _a = {}, _a[name] = value, _a;
333
- }
334
- var BodyTypes;
335
- (function (BodyTypes) {
336
- BodyTypes["POST_DATA"] = "postData";
337
- BodyTypes["URLENCODED"] = "urlencoded";
338
- BodyTypes["FORM_DATA"] = "postFormData";
339
- BodyTypes["RAW_FILE"] = "rawFile";
340
- BodyTypes["GRAPHQL"] = "GraphQL";
341
- })(BodyTypes = exports.BodyTypes || (exports.BodyTypes = {}));
342
- var CachePenetrationModes;
343
- (function (CachePenetrationModes) {
344
- CachePenetrationModes["none"] = "none";
345
- CachePenetrationModes["def"] = "default";
346
- CachePenetrationModes["alwaysQuery"] = "always-query";
347
- CachePenetrationModes["alwaysHeader"] = "always-header";
348
- })(CachePenetrationModes = exports.CachePenetrationModes || (exports.CachePenetrationModes = {}));
349
- // list of fields in our object we must not change
350
- exports.EXCLUDES = [
351
- 'url',
352
- 'method',
353
- 'headers',
354
- 'timeout',
355
- 'postData',
356
- 'text',
357
- 'mimeType',
358
- 'extract',
359
- 'jsonPath',
360
- 'jQuery',
361
- 'regex',
362
- 'header',
363
- 'assert',
364
- 'check',
365
- 'equals',
366
- 'contains',
367
- 'matches',
368
- 'falsy',
369
- 'greater',
370
- 'lesser',
371
- ];
372
- var isWSRequest = function (url) { return !!((url === null || url === void 0 ? void 0 : url.startsWith('ws://')) || (url === null || url === void 0 ? void 0 : url.startsWith('wss://'))); };
373
- exports.isWSRequest = isWSRequest;
374
- var isHTTPRequest = function (url) { return !!((url === null || url === void 0 ? void 0 : url.startsWith('http://')) || (url === null || url === void 0 ? void 0 : url.startsWith('https://'))); };
375
- exports.isHTTPRequest = isHTTPRequest;
376
- var isGRPCRequest = function (url) { return !!(url === null || url === void 0 ? void 0 : url.startsWith('grpc://')); };
377
- exports.isGRPCRequest = isGRPCRequest;
378
- var getResponseText = function (content) { return content.encoding === 'base64' ?
379
- Buffer.from(content.text || '', 'base64').toString('utf8')
380
- : content.text; };
381
- exports.getResponseText = getResponseText;
382
- var ConfMimeTypes;
383
- (function (ConfMimeTypes) {
384
- ConfMimeTypes["TEXT_PLAIN"] = "text/plain";
385
- ConfMimeTypes["APPLICATION_JSON"] = "application/json";
386
- ConfMimeTypes["APPLICATION_JAVASCRIPT"] = "application/javascript";
387
- ConfMimeTypes["APPLICATION_XML"] = "application/xml";
388
- ConfMimeTypes["APPLICATION_EDN"] = "application/edn";
389
- ConfMimeTypes["TEXT_XML"] = "text/xml";
390
- ConfMimeTypes["TEXT_HTML"] = "text/html";
391
- ConfMimeTypes["TEXT_CSS"] = "text/css";
392
- ConfMimeTypes["APPLICATION_URLENCODED"] = "application/x-www-form-urlencoded";
393
- })(ConfMimeTypes = exports.ConfMimeTypes || (exports.ConfMimeTypes = {}));
394
- var WsMessageType;
395
- (function (WsMessageType) {
396
- WsMessageType["TEXT"] = "text";
397
- WsMessageType["BINARY"] = "binary";
398
- })(WsMessageType = exports.WsMessageType || (exports.WsMessageType = {}));
399
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA2C;AAC3C,2EAA+D;AAC/D,4CAA2D;AAC3D,8BAAsE;AACtE,gCAQiB;AA+bR,4FAncS,mBAAW,OAmcT;AA9bpB,4CAA6C;AAGhC,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;AACH;IA8BE,yBAAmB,GAAW;;;;;mBAAX;;QA7BnB;;;;;WAA0B;QAC1B;;;;;WAAY;QACZ;;;;;WAAgB;QAChB;;;;;WAAoB;QACpB;;;;;WAAsB;QACtB;;;;;WAAgB;QAEhB;;;;;WAAqB;QACrB;;;;;WAAqB;QACrB;;;;;WAAwB;QACxB;;;;;WAA2B;QAC3B;;;;;WAA4B;QAC5B;;;;;WAAkC;QAClC;;;;;WAA0B;QAC1B;;;;;WAAY;QACZ;;;;;WAAoC;QAEpC;;;;mBAAqB,KAAK;WAAC;QAC3B;;;;;WAA4B;QAE5B;;;;;WAAoB;QACpB;;;;;WAAwB;QACxB;;;;;WAAoB;QACpB;;;;;WAAmB;Q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AAqB,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"}
@@ -1,20 +0,0 @@
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 {};
@@ -1,135 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ANY_VALUE = exports.getJsonValidatorWithoutIgnoreKeys = exports.getField = exports.humanizeJsonSchemaErrors = exports.isPrimitive = exports.generateJSONSchema = void 0;
7
- var find = require("lodash/find");
8
- var log_1 = __importDefault(require("@loadmill/universal/dist/log"));
9
- var isEmpty = require("lodash/isEmpty");
10
- var generateJSONSchema = function (jsObj, ignoreKeys, shouldAddNullable, withExactValue, withKeys) {
11
- if (ignoreKeys === void 0) { ignoreKeys = []; }
12
- if (shouldAddNullable === void 0) { shouldAddNullable = false; }
13
- if (withExactValue === void 0) { withExactValue = false; }
14
- if (withKeys === void 0) { withKeys = false; }
15
- try {
16
- var schema = _getSchema(jsObj, ignoreKeys, shouldAddNullable, withExactValue, withKeys);
17
- return schema;
18
- }
19
- catch (err) {
20
- _handleError('Error generating JSON Schema', err, jsObj);
21
- }
22
- return {};
23
- };
24
- exports.generateJSONSchema = generateJSONSchema;
25
- var _getSchema = function (obj, ignoreKeys, shouldAddNullable, withExactValue, withKeys) {
26
- if (ignoreKeys === void 0) { ignoreKeys = []; }
27
- if (obj == null) {
28
- return shouldAddNullable ? { type: 'object', nullable: true } : { type: 'null' };
29
- }
30
- else if (exports.isPrimitive(obj)) {
31
- var res = { type: evaluateObjectType(obj) };
32
- if (shouldValidateExactValue(obj, withExactValue)) {
33
- res['const'] = obj;
34
- }
35
- return res;
36
- }
37
- else if (Array.isArray(obj)) {
38
- var items = [];
39
- for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) {
40
- var _b = _a[_i], value = _b[1];
41
- var elementSchema = _getSchema(value, ignoreKeys, shouldAddNullable, withExactValue, withKeys);
42
- if (withExactValue || !find(items, elementSchema)) {
43
- items.push(elementSchema);
44
- }
45
- }
46
- // The use of 'oneOf' creates a schema that validates the existence of the items but not their order in the array
47
- var res = {
48
- type: 'array',
49
- items: isEmpty(items) ? {} : withExactValue ? items : { 'anyOf': items }
50
- };
51
- withExactValue && (res['minItems'] = items.length);
52
- return res;
53
- }
54
- else {
55
- var properties = {};
56
- for (var _c = 0, _d = Object.entries(obj); _c < _d.length; _c++) {
57
- var _e = _d[_c], key = _e[0], value = _e[1];
58
- if (!ignoreKeys.includes(key)) {
59
- properties[key] = _getSchema(value, ignoreKeys, shouldAddNullable, withExactValue, withKeys);
60
- }
61
- }
62
- var res = {
63
- type: 'object',
64
- properties: properties
65
- };
66
- withKeys && (res['required'] = Object.keys(obj));
67
- return res;
68
- }
69
- };
70
- var isPrimitive = function (obj) { return Object(obj) !== obj; };
71
- exports.isPrimitive = isPrimitive;
72
- var shouldValidateExactValue = function (val, exactValue) { return exactValue && val !== exports.ANY_VALUE; };
73
- var evaluateObjectType = function (val) { return val !== exports.ANY_VALUE ? typeof val : ['string', 'number', 'integer', 'object', 'array', 'boolean']; };
74
- var _handleError = function (err, msg, json) {
75
- log_1.default.error(msg, err, json);
76
- throw new Error(msg);
77
- };
78
- var humanizeJsonSchemaErrors = function (errors) {
79
- return errors.map(function (err) {
80
- if (err.instance === null && err.stack.includes('is not of a type')) {
81
- err.stack = "JSON contains null on property " + exports.getField(err.property, err.message);
82
- }
83
- if (err.stack.includes('is not of a type')) {
84
- var type = err.argument[0];
85
- err.stack = "JSON doesn't contain " + (type === 'null' ? type : "a type of " + type) + " on property " + exports.getField(err.property, err.message) + " " + addIndex(err);
86
- }
87
- else if (err.stack.includes('does not exactly match')) {
88
- err.stack = "JSON doesn't contain " + err.schema.const + " on property " + exports.getField(err.property, err.message) + " " + addIndex(err);
89
- }
90
- else if (err.stack.includes('requires property')) {
91
- err.stack = "JSON doesn't contain property " + exports.getField(err.property, err.message);
92
- }
93
- else if (err.stack.includes('does not meet minimum length')) {
94
- var missingItems = err.argument - err.instance.length;
95
- err.stack = "JSON doesn't contain the last " + (missingItems > 1 ? missingItems + " items" : 'item') + " on " + exports.getField(err.property, err.message) + " array";
96
- }
97
- return err;
98
- });
99
- };
100
- exports.humanizeJsonSchemaErrors = humanizeJsonSchemaErrors;
101
- var getField = function (property, message) {
102
- if (message === null || message === void 0 ? void 0 : message.includes('requires property ')) {
103
- return message.split('requires property ')[1].replace(/"/g, '');
104
- }
105
- return property.split('.').pop().split('[')[0];
106
- };
107
- exports.getField = getField;
108
- var addIndex = function (error) {
109
- var path = error.property.split('[');
110
- if (path.length > 1) {
111
- var index = Number(path[path.length - 1].replace(']', ''));
112
- return !isNaN(index) && index > -1 ? 'in index ' + index : '';
113
- }
114
- return '';
115
- };
116
- var getJsonValidatorWithoutIgnoreKeys = function (jsonValidator, ignoreKeys, shouldValidateArrays) {
117
- if (ignoreKeys === void 0) { ignoreKeys = []; }
118
- if (shouldValidateArrays === void 0) { shouldValidateArrays = true; }
119
- for (var _i = 0, _a = Object.entries(jsonValidator); _i < _a.length; _i++) {
120
- var _b = _a[_i], key = _b[0], value = _b[1];
121
- if (ignoreKeys.includes(key)) {
122
- delete jsonValidator[key];
123
- }
124
- if (!shouldValidateArrays && Array.isArray(value)) {
125
- delete jsonValidator[key];
126
- }
127
- else if (value !== null && typeof value === 'object') {
128
- exports.getJsonValidatorWithoutIgnoreKeys(value, ignoreKeys, shouldValidateArrays);
129
- }
130
- }
131
- return JSON.stringify(jsonValidator, null, 2);
132
- };
133
- exports.getJsonValidatorWithoutIgnoreKeys = getJsonValidatorWithoutIgnoreKeys;
134
- exports.ANY_VALUE = '*';
135
- //# sourceMappingURL=json-schema-generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-schema-generator.js","sourceRoot":"","sources":["../../src/schema/json-schema-generator.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAqC;AACrC,qEAA+C;AAC/C,wCAA2C;AAEpC,IAAM,kBAAkB,GAAG,UAChC,KAAU,EACV,UAAyB,EACzB,iBAAkC,EAClC,cAA+B,EAC/B,QAAyB;IAHzB,2BAAA,EAAA,eAAyB;IACzB,kCAAA,EAAA,yBAAkC;IAClC,+BAAA,EAAA,sBAA+B;IAC/B,yBAAA,EAAA,gBAAyB;IAEzB,IAAI;QACF,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;QAC1F,OAAO,MAAM,CAAC;KACf;IAAC,OAAO,GAAG,EAAE;QACZ,YAAY,CAAC,8BAA8B,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;KAC1D;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAfW,QAAA,kBAAk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,OAAO,CAAC,GAAG,EAAC,EAAE,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/D;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEK,IAAM,iCAAiC,GAAG,UAAC,aAAa,EAAE,UAAyB,EAAE,oBAA2B;IAAtD,2BAAA,EAAA,eAAyB;IAAE,qCAAA,EAAA,2BAA2B;IACrH,KAA2B,UAA6B,EAA7B,KAAA,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAA7B,cAA6B,EAA7B,IAA6B,EAAE;QAA/C,IAAA,WAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QACpB,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC5B,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;SAC3B;QACD,IAAI,CAAC,oBAAoB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACjD,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;SAC3B;aACI,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACpD,yCAAiC,CAAC,KAAK,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC;SAC5E;KACF;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAbW,QAAA,iCAAiC,qCAa5C;AAmBW,QAAA,SAAS,GAAG,GAAG,CAAC"}
package/dist/signals.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare enum SIGNAL {
2
- SIGTERM = "SIGTERM",
3
- SIGINT = "SIGINT"
4
- }
package/dist/signals.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SIGNAL = void 0;
4
- var SIGNAL;
5
- (function (SIGNAL) {
6
- SIGNAL["SIGTERM"] = "SIGTERM";
7
- SIGNAL["SIGINT"] = "SIGINT";
8
- })(SIGNAL = exports.SIGNAL || (exports.SIGNAL = {}));
9
- //# sourceMappingURL=signals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signals.js","sourceRoot":"","sources":["../src/signals.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;AACnB,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB"}
@@ -1,13 +0,0 @@
1
- export declare const socketEvents: {
2
- runFail: (token: string) => string;
3
- runSuccess: (token: string) => string;
4
- postScriptStarted: (token: string) => string;
5
- postScriptFinished: (token: string) => string;
6
- millUpdate: (handleId: string) => string;
7
- runConf: string;
8
- runLoad: string;
9
- stopLoad: string;
10
- askLoadResults: string;
11
- gracefulShutdown: string;
12
- disconnectAgent: string;
13
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.socketEvents = void 0;
4
- exports.socketEvents = {
5
- runFail: function (token) { return "run-fail:" + token; },
6
- runSuccess: function (token) { return "run-success:" + token; },
7
- postScriptStarted: function (token) { return "postscript-started:" + token; },
8
- postScriptFinished: function (token) { return "postscript-finished:" + token; },
9
- millUpdate: function (handleId) { return "mill-update:" + handleId; },
10
- runConf: 'run-conf',
11
- runLoad: 'run-load',
12
- stopLoad: 'stop-load',
13
- askLoadResults: 'ask-load-results',
14
- gracefulShutdown: 'graceful-shutdown',
15
- disconnectAgent: 'disconnect-agent',
16
- };
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/socket-events/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,UAAC,KAAa,IAAK,OAAA,cAAY,KAAO,EAAnB,CAAmB;IAC/C,UAAU,EAAE,UAAC,KAAa,IAAK,OAAA,iBAAe,KAAO,EAAtB,CAAsB;IACrD,iBAAiB,EAAE,UAAC,KAAa,IAAK,OAAA,wBAAsB,KAAO,EAA7B,CAA6B;IACnE,kBAAkB,EAAE,UAAC,KAAa,IAAK,OAAA,yBAAuB,KAAO,EAA9B,CAA8B;IACrE,UAAU,EAAE,UAAC,QAAgB,IAAK,OAAA,iBAAe,QAAU,EAAzB,CAAyB;IAC3D,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,WAAW;IACrB,cAAc,EAAE,kBAAkB;IAClC,gBAAgB,EAAE,mBAAmB;IACrC,eAAe,EAAE,kBAAkB;CACpC,CAAC"}