@loadmill/core 0.3.139 → 0.3.141

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 (232) hide show
  1. package/dist/assertions/index.d.ts +32 -0
  2. package/dist/assertions/index.js +52 -0
  3. package/dist/assertions/index.js.map +1 -0
  4. package/dist/code-step/index.d.ts +23 -0
  5. package/dist/code-step/index.js +97 -0
  6. package/dist/code-step/index.js.map +1 -0
  7. package/dist/conf/defaults.d.ts +1 -0
  8. package/dist/conf/defaults.js +11 -0
  9. package/dist/conf/defaults.js.map +1 -0
  10. package/dist/conf/extrema.d.ts +7 -0
  11. package/dist/conf/extrema.js +12 -0
  12. package/dist/conf/extrema.js.map +1 -0
  13. package/dist/conf/index.d.ts +15 -0
  14. package/dist/conf/index.js +80 -0
  15. package/dist/conf/index.js.map +1 -0
  16. package/dist/conf/notifications.d.ts +2 -0
  17. package/dist/conf/notifications.js +19 -0
  18. package/dist/conf/notifications.js.map +1 -0
  19. package/dist/conf/types.d.ts +122 -0
  20. package/dist/conf/types.js +38 -0
  21. package/dist/conf/types.js.map +1 -0
  22. package/dist/conf/validate.d.ts +69 -0
  23. package/dist/conf/validate.js +509 -0
  24. package/dist/conf/validate.js.map +1 -0
  25. package/dist/distributed-logger-reporter.d.ts +3 -0
  26. package/dist/distributed-logger-reporter.js +74 -0
  27. package/dist/distributed-logger-reporter.js.map +1 -0
  28. package/dist/echo/firehose.d.ts +7 -0
  29. package/dist/echo/firehose.js +130 -0
  30. package/dist/echo/firehose.js.map +1 -0
  31. package/dist/echo/index.d.ts +3 -0
  32. package/dist/echo/index.js +8 -0
  33. package/dist/echo/index.js.map +1 -0
  34. package/dist/echo/stats.d.ts +8 -0
  35. package/dist/echo/stats.js +152 -0
  36. package/dist/echo/stats.js.map +1 -0
  37. package/dist/extract-and-assert-step/index.d.ts +29 -0
  38. package/dist/extract-and-assert-step/index.js +108 -0
  39. package/dist/extract-and-assert-step/index.js.map +1 -0
  40. package/dist/extractions/index.d.ts +36 -0
  41. package/dist/extractions/index.js +49 -0
  42. package/dist/extractions/index.js.map +1 -0
  43. package/dist/har/index.d.ts +71 -0
  44. package/dist/har/index.js +61 -0
  45. package/dist/har/index.js.map +1 -0
  46. package/dist/labels/constants.d.ts +1 -0
  47. package/dist/labels/constants.js +5 -0
  48. package/dist/labels/constants.js.map +1 -0
  49. package/dist/multipart-form-data/files.d.ts +2 -0
  50. package/dist/multipart-form-data/files.js +63 -0
  51. package/dist/multipart-form-data/files.js.map +1 -0
  52. package/dist/multipart-form-data/form-data-utils.d.ts +19 -0
  53. package/dist/multipart-form-data/form-data-utils.js +118 -0
  54. package/dist/multipart-form-data/form-data-utils.js.map +1 -0
  55. package/dist/multipart-form-data/is-binary-file.d.ts +2 -0
  56. package/dist/multipart-form-data/is-binary-file.js +215 -0
  57. package/dist/multipart-form-data/is-binary-file.js.map +1 -0
  58. package/dist/multipart-form-data/multipart-text-to-post-form-data.d.ts +3 -0
  59. package/dist/multipart-form-data/multipart-text-to-post-form-data.js +93 -0
  60. package/dist/multipart-form-data/multipart-text-to-post-form-data.js.map +1 -0
  61. package/dist/parameters/extractions.d.ts +27 -0
  62. package/dist/parameters/extractions.js +51 -0
  63. package/dist/parameters/extractions.js.map +1 -0
  64. package/dist/parameters/extractors/cheerio-extractor.d.ts +11 -0
  65. package/dist/parameters/extractors/cheerio-extractor.js +84 -0
  66. package/dist/parameters/extractors/cheerio-extractor.js.map +1 -0
  67. package/dist/parameters/extractors/expression-extractor.d.ts +6 -0
  68. package/dist/parameters/extractors/expression-extractor.js +38 -0
  69. package/dist/parameters/extractors/expression-extractor.js.map +1 -0
  70. package/dist/parameters/extractors/extractor.d.ts +3 -0
  71. package/dist/parameters/extractors/extractor.js +3 -0
  72. package/dist/parameters/extractors/extractor.js.map +1 -0
  73. package/dist/parameters/extractors/header-extractor.d.ts +7 -0
  74. package/dist/parameters/extractors/header-extractor.js +51 -0
  75. package/dist/parameters/extractors/header-extractor.js.map +1 -0
  76. package/dist/parameters/extractors/index.d.ts +10 -0
  77. package/dist/parameters/extractors/index.js +20 -0
  78. package/dist/parameters/extractors/index.js.map +1 -0
  79. package/dist/parameters/extractors/json-path-extractor.d.ts +11 -0
  80. package/dist/parameters/extractors/json-path-extractor.js +127 -0
  81. package/dist/parameters/extractors/json-path-extractor.js.map +1 -0
  82. package/dist/parameters/extractors/parametrized-extractor.d.ts +10 -0
  83. package/dist/parameters/extractors/parametrized-extractor.js +34 -0
  84. package/dist/parameters/extractors/parametrized-extractor.js.map +1 -0
  85. package/dist/parameters/extractors/regex-extractor.d.ts +7 -0
  86. package/dist/parameters/extractors/regex-extractor.js +46 -0
  87. package/dist/parameters/extractors/regex-extractor.js.map +1 -0
  88. package/dist/parameters/extractors/regex-matcher.d.ts +1 -0
  89. package/dist/parameters/extractors/regex-matcher.js +22 -0
  90. package/dist/parameters/extractors/regex-matcher.js.map +1 -0
  91. package/dist/parameters/extractors/ws-extractor.d.ts +33 -0
  92. package/dist/parameters/extractors/ws-extractor.js +215 -0
  93. package/dist/parameters/extractors/ws-extractor.js.map +1 -0
  94. package/dist/parameters/extractors/x-path-extractor.d.ts +9 -0
  95. package/dist/parameters/extractors/x-path-extractor.js +77 -0
  96. package/dist/parameters/extractors/x-path-extractor.js.map +1 -0
  97. package/dist/parameters/generate-random.d.ts +13 -0
  98. package/dist/parameters/generate-random.js +108 -0
  99. package/dist/parameters/generate-random.js.map +1 -0
  100. package/dist/parameters/html-utils.d.ts +1 -0
  101. package/dist/parameters/html-utils.js +18 -0
  102. package/dist/parameters/html-utils.js.map +1 -0
  103. package/dist/parameters/index.d.ts +94 -0
  104. package/dist/parameters/index.js +619 -0
  105. package/dist/parameters/index.js.map +1 -0
  106. package/dist/parameters/json-path-utils.d.ts +1 -0
  107. package/dist/parameters/json-path-utils.js +16 -0
  108. package/dist/parameters/json-path-utils.js.map +1 -0
  109. package/dist/parameters/operators/binary-operator.d.ts +13 -0
  110. package/dist/parameters/operators/binary-operator.js +39 -0
  111. package/dist/parameters/operators/binary-operator.js.map +1 -0
  112. package/dist/parameters/operators/index.d.ts +5 -0
  113. package/dist/parameters/operators/index.js +21 -0
  114. package/dist/parameters/operators/index.js.map +1 -0
  115. package/dist/parameters/parameter-functions/aws-cognito.d.ts +3 -0
  116. package/dist/parameters/parameter-functions/aws-cognito.js +119 -0
  117. package/dist/parameters/parameter-functions/aws-cognito.js.map +1 -0
  118. package/dist/parameters/parameter-functions/boolean-parameter-functions.d.ts +12 -0
  119. package/dist/parameters/parameter-functions/boolean-parameter-functions.js +47 -0
  120. package/dist/parameters/parameter-functions/boolean-parameter-functions.js.map +1 -0
  121. package/dist/parameters/parameter-functions/crypto.d.ts +11 -0
  122. package/dist/parameters/parameter-functions/crypto.js +71 -0
  123. package/dist/parameters/parameter-functions/crypto.js.map +1 -0
  124. package/dist/parameters/parameter-functions/json-schema.d.ts +1 -0
  125. package/dist/parameters/parameter-functions/json-schema.js +33 -0
  126. package/dist/parameters/parameter-functions/json-schema.js.map +1 -0
  127. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.d.ts +11 -0
  128. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js +34 -0
  129. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js.map +1 -0
  130. package/dist/parameters/parameter-functions/numeric-parameter-functions.d.ts +15 -0
  131. package/dist/parameters/parameter-functions/numeric-parameter-functions.js +56 -0
  132. package/dist/parameters/parameter-functions/numeric-parameter-functions.js.map +1 -0
  133. package/dist/parameters/parameter-functions/parameter-function-utils.d.ts +5 -0
  134. package/dist/parameters/parameter-functions/parameter-function-utils.js +82 -0
  135. package/dist/parameters/parameter-functions/parameter-function-utils.js.map +1 -0
  136. package/dist/parameters/parameter-functions/parameter-function.d.ts +6 -0
  137. package/dist/parameters/parameter-functions/parameter-function.js +28 -0
  138. package/dist/parameters/parameter-functions/parameter-function.js.map +1 -0
  139. package/dist/parameters/parameter-functions/parameter-functions.d.ts +7 -0
  140. package/dist/parameters/parameter-functions/parameter-functions.js +53 -0
  141. package/dist/parameters/parameter-functions/parameter-functions.js.map +1 -0
  142. package/dist/parameters/parameter-functions/random-parameter-functions.d.ts +1 -0
  143. package/dist/parameters/parameter-functions/random-parameter-functions.js +43 -0
  144. package/dist/parameters/parameter-functions/random-parameter-functions.js.map +1 -0
  145. package/dist/parameters/parameter-functions/textual-parameter-functions.d.ts +72 -0
  146. package/dist/parameters/parameter-functions/textual-parameter-functions.js +389 -0
  147. package/dist/parameters/parameter-functions/textual-parameter-functions.js.map +1 -0
  148. package/dist/parameters/parameter-name-utils.d.ts +6 -0
  149. package/dist/parameters/parameter-name-utils.js +124 -0
  150. package/dist/parameters/parameter-name-utils.js.map +1 -0
  151. package/dist/parameters/parameter-regex-providers.d.ts +24 -0
  152. package/dist/parameters/parameter-regex-providers.js +70 -0
  153. package/dist/parameters/parameter-regex-providers.js.map +1 -0
  154. package/dist/parameters/resolvers/random-parameters-resolver.d.ts +1 -0
  155. package/dist/parameters/resolvers/random-parameters-resolver.js +12 -0
  156. package/dist/parameters/resolvers/random-parameters-resolver.js.map +1 -0
  157. package/dist/parameters/type.d.ts +10 -0
  158. package/dist/parameters/type.js +9 -0
  159. package/dist/parameters/type.js.map +1 -0
  160. package/dist/parameters/value-utils.d.ts +5 -0
  161. package/dist/parameters/value-utils.js +44 -0
  162. package/dist/parameters/value-utils.js.map +1 -0
  163. package/dist/request/index.d.ts +174 -0
  164. package/dist/request/index.js +356 -0
  165. package/dist/request/index.js.map +1 -0
  166. package/dist/schema/json-schema-generator.d.ts +20 -0
  167. package/dist/schema/json-schema-generator.js +135 -0
  168. package/dist/schema/json-schema-generator.js.map +1 -0
  169. package/dist/signals.d.ts +4 -0
  170. package/dist/signals.js +9 -0
  171. package/dist/signals.js.map +1 -0
  172. package/dist/socket-events/index.d.ts +13 -0
  173. package/dist/socket-events/index.js +17 -0
  174. package/dist/socket-events/index.js.map +1 -0
  175. package/dist/step/assertable.d.ts +4 -0
  176. package/dist/step/assertable.js +3 -0
  177. package/dist/step/assertable.js.map +1 -0
  178. package/dist/step/codeable.d.ts +3 -0
  179. package/dist/step/codeable.js +3 -0
  180. package/dist/step/codeable.js.map +1 -0
  181. package/dist/step/extractable.d.ts +4 -0
  182. package/dist/step/extractable.js +3 -0
  183. package/dist/step/extractable.js.map +1 -0
  184. package/dist/step/index.d.ts +72 -0
  185. package/dist/step/index.js +71 -0
  186. package/dist/step/index.js.map +1 -0
  187. package/dist/step/step-type.d.ts +4 -0
  188. package/dist/step/step-type.js +3 -0
  189. package/dist/step/step-type.js.map +1 -0
  190. package/dist/step/type-guards.d.ts +7 -0
  191. package/dist/step/type-guards.js +18 -0
  192. package/dist/step/type-guards.js.map +1 -0
  193. package/dist/subset/index.d.ts +3 -0
  194. package/dist/subset/index.js +8 -0
  195. package/dist/subset/index.js.map +1 -0
  196. package/dist/subset/is-subset.d.ts +2 -0
  197. package/dist/subset/is-subset.js +29 -0
  198. package/dist/subset/is-subset.js.map +1 -0
  199. package/dist/subset/json-contains.d.ts +1 -0
  200. package/dist/subset/json-contains.js +24 -0
  201. package/dist/subset/json-contains.js.map +1 -0
  202. package/dist/team-options/constants.d.ts +3 -0
  203. package/dist/team-options/constants.js +7 -0
  204. package/dist/team-options/constants.js.map +1 -0
  205. package/dist/xml/decode.d.ts +2 -0
  206. package/dist/xml/decode.js +91 -0
  207. package/dist/xml/decode.js.map +1 -0
  208. package/dist/xml/encode.d.ts +1 -0
  209. package/dist/xml/encode.js +14 -0
  210. package/dist/xml/encode.js.map +1 -0
  211. package/dist/xml/escape-reserved-chars.d.ts +6 -0
  212. package/dist/xml/escape-reserved-chars.js +57 -0
  213. package/dist/xml/escape-reserved-chars.js.map +1 -0
  214. package/dist/xml/is-xml.d.ts +1 -0
  215. package/dist/xml/is-xml.js +9 -0
  216. package/dist/xml/is-xml.js.map +1 -0
  217. package/dist/xml/json-to-xml.d.ts +2 -0
  218. package/dist/xml/json-to-xml.js +11 -0
  219. package/dist/xml/json-to-xml.js.map +1 -0
  220. package/dist/xml/namespaces.d.ts +7 -0
  221. package/dist/xml/namespaces.js +16 -0
  222. package/dist/xml/namespaces.js.map +1 -0
  223. package/dist/xml/remove-invisible-chars.d.ts +2 -0
  224. package/dist/xml/remove-invisible-chars.js +13 -0
  225. package/dist/xml/remove-invisible-chars.js.map +1 -0
  226. package/dist/xml/replace-s-tags.d.ts +4 -0
  227. package/dist/xml/replace-s-tags.js +21 -0
  228. package/dist/xml/replace-s-tags.js.map +1 -0
  229. package/dist/xml/xml-to-json.d.ts +7 -0
  230. package/dist/xml/xml-to-json.js +21 -0
  231. package/dist/xml/xml-to-json.js.map +1 -0
  232. package/package.json +3 -2
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.FirehoseRecords = void 0;
40
+ var client_firehose_1 = require("@aws-sdk/client-firehose");
41
+ var client_cognito_identity_1 = require("@aws-sdk/client-cognito-identity");
42
+ var FIREHOSE_API_VERSION = '2015-08-04';
43
+ var REGION = 'us-east-1';
44
+ var STREAM_NAME = 'fhs-test1';
45
+ var firehose;
46
+ var cognito = new client_cognito_identity_1.CognitoIdentity({ region: REGION });
47
+ var FirehoseRecords = /** @class */ (function () {
48
+ function FirehoseRecords() {
49
+ Object.defineProperty(this, "records", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: void 0
54
+ });
55
+ this.clearRecords();
56
+ }
57
+ Object.defineProperty(FirehoseRecords.prototype, "addRecord", {
58
+ enumerable: false,
59
+ configurable: true,
60
+ writable: true,
61
+ value: function (record) {
62
+ var enc = new TextEncoder(); // always utf-8
63
+ var encodedRecord = enc.encode(JSON.stringify(record) + "\n");
64
+ this.records.push({ Data: encodedRecord });
65
+ }
66
+ });
67
+ Object.defineProperty(FirehoseRecords.prototype, "pushRecords", {
68
+ enumerable: false,
69
+ configurable: true,
70
+ writable: true,
71
+ value: function () {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var identity, credentialResponse, command, err_1;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0:
77
+ _a.trys.push([0, 4, 5, 6]);
78
+ if (!this.records.length) {
79
+ return [2 /*return*/];
80
+ }
81
+ return [4 /*yield*/, cognito.getId({ IdentityPoolId: 'us-east-1:79372411-2664-431b-aa0b-aad9f938f6e9' })];
82
+ case 1:
83
+ identity = _a.sent();
84
+ return [4 /*yield*/, cognito.getCredentialsForIdentity({ IdentityId: identity.IdentityId })];
85
+ case 2:
86
+ credentialResponse = _a.sent();
87
+ firehose = new client_firehose_1.FirehoseClient({
88
+ region: REGION,
89
+ apiVersion: FIREHOSE_API_VERSION,
90
+ credentials: {
91
+ accessKeyId: credentialResponse.Credentials.AccessKeyId,
92
+ secretAccessKey: credentialResponse.Credentials.SecretKey,
93
+ sessionToken: credentialResponse.Credentials.SessionToken,
94
+ expiration: credentialResponse.Credentials.Expiration
95
+ }
96
+ });
97
+ command = new client_firehose_1.PutRecordBatchCommand({
98
+ Records: this.records,
99
+ DeliveryStreamName: STREAM_NAME
100
+ });
101
+ return [4 /*yield*/, firehose.send(command)];
102
+ case 3:
103
+ _a.sent();
104
+ return [3 /*break*/, 6];
105
+ case 4:
106
+ err_1 = _a.sent();
107
+ // eslint-disable-next-line no-console
108
+ console.error(err_1);
109
+ return [3 /*break*/, 6];
110
+ case 5:
111
+ this.clearRecords();
112
+ return [7 /*endfinally*/];
113
+ case 6: return [2 /*return*/];
114
+ }
115
+ });
116
+ });
117
+ }
118
+ });
119
+ Object.defineProperty(FirehoseRecords.prototype, "clearRecords", {
120
+ enumerable: false,
121
+ configurable: true,
122
+ writable: true,
123
+ value: function () {
124
+ this.records = [];
125
+ }
126
+ });
127
+ return FirehoseRecords;
128
+ }());
129
+ exports.Firehose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AW,EAAE;oCACX,WAAW,EAAE,kBAAkB,CAAC,WAAY,CAAC,WAAY;oCACzD,eAAe,EAAC,kBAAkB,CAAC,WAAY,CAAC,SAAU;oCAC1D,YAAY,EAAC,kBAAkB,CAAC,WAAY,CAAC,YAAa;oCAC1D,UAAU,EAAC,kBAAkB,CAAC,WAAY,CAAC,UAAW;iCACvD;6BACF,CAAC,CAAC;4BAEG,OAAO,GAAG,IAAI,uCAAqB,CAAC;gCACxC,OAAO,EAAE,IAAI,CAAC,OAAO;gCACrB,kBAAkB,EAAE,WAAW;6BAChC,CAAC,CAAC;4BAEH,qBAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;4BAA5B,SAA4B,CAAC;;;;4BAG7B,sCAAsC;4BACtC,OAAO,CAAC,KAAK,CAAC,KAAG,CAAC,CAAC;;;4BAGnB,IAAI,CAAC,YAAY,EAAE,CAAC;;;;;;SAEvB;;;;;;eAED;YACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACpB,CAAC;;IAEH,sBAAC;AAAD,CAAC,AArDD,IAqDC;AArDY,0CAAe"}
@@ -0,0 +1,3 @@
1
+ import { Stats } from './stats';
2
+ import { FirehoseRecords } from './firehose';
3
+ export { Stats, FirehoseRecords };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FirehoseRecords = exports.Stats = void 0;
4
+ var stats_1 = require("./stats");
5
+ Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return stats_1.Stats; } });
6
+ var firehose_1 = require("./firehose");
7
+ Object.defineProperty(exports, "FirehoseRecords", { enumerable: true, get: function () { return firehose_1.FirehoseRecords; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/echo/index.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAGvB,sFAHA,aAAK,OAGA;AAFd,uCAA6C;AAE7B,gGAFP,0BAAe,OAEO"}
@@ -0,0 +1,8 @@
1
+ export declare class Stats {
2
+ stats: any;
3
+ constructor();
4
+ updateStats(key: any, shouldIncr: any, value?: any, subKey?: string): void;
5
+ addRequest(request: any, responseTime: any): void;
6
+ clearStats(): void;
7
+ push(url: any): Promise<boolean>;
8
+ }
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.Stats = void 0;
43
+ var isUUID_1 = __importDefault(require("validator/lib/isUUID"));
44
+ var isNumber = function (s) { return /^[0-9]+$/.test(s); };
45
+ var standardizePath = function (path) {
46
+ var parts = path.slice(1).split('/');
47
+ var newPath = '';
48
+ parts.forEach(function (part) {
49
+ newPath += (isUUID_1.default(part) || isNumber(part)) ? '/{param}' : "/" + part;
50
+ });
51
+ return newPath;
52
+ };
53
+ var updateKey = function (obj, key, shouldIncr, value) {
54
+ obj[key] = shouldIncr ? (obj[key] || 0) + value : value;
55
+ };
56
+ var Stats = /** @class */ (function () {
57
+ function Stats() {
58
+ Object.defineProperty(this, "stats", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: void 0
63
+ });
64
+ this.stats = {
65
+ lmCode: -1,
66
+ totalRequests: 0,
67
+ totalResponseTime: 0,
68
+ requestsCounter: {},
69
+ requestsResponseTime: {},
70
+ isNewSession: false,
71
+ totalNewSessions: 0
72
+ };
73
+ }
74
+ Object.defineProperty(Stats.prototype, "updateStats", {
75
+ enumerable: false,
76
+ configurable: true,
77
+ writable: true,
78
+ value: function (key, shouldIncr, value, subKey) {
79
+ if (value === void 0) { value = 0; }
80
+ if (subKey === void 0) { subKey = ''; }
81
+ if (key && value) {
82
+ if (subKey) {
83
+ updateKey(this.stats[key], subKey, shouldIncr, value);
84
+ }
85
+ else {
86
+ updateKey(this.stats, key, shouldIncr, value);
87
+ }
88
+ }
89
+ }
90
+ });
91
+ Object.defineProperty(Stats.prototype, "addRequest", {
92
+ enumerable: false,
93
+ configurable: true,
94
+ writable: true,
95
+ value: function (request, responseTime) {
96
+ var convertedPath = standardizePath(new URL(request.url).pathname);
97
+ this.updateStats('totalRequests', true, 1);
98
+ this.updateStats('totalResponseTime', true, parseInt(responseTime, 10));
99
+ this.updateStats('requestsCounter', true, 1, request.method + ":" + convertedPath);
100
+ this.updateStats('requestsResponseTime', true, parseInt(responseTime, 10), request.method + ":" + convertedPath);
101
+ }
102
+ });
103
+ Object.defineProperty(Stats.prototype, "clearStats", {
104
+ enumerable: false,
105
+ configurable: true,
106
+ writable: true,
107
+ value: function () {
108
+ this.stats.totalRequests = 0;
109
+ this.stats.totalResponseTime = 0;
110
+ this.stats.requestsCounter = {};
111
+ this.stats.requestsResponseTime = {};
112
+ this.stats.isNewSession = false;
113
+ this.stats.totalNewSessions = 0;
114
+ }
115
+ });
116
+ Object.defineProperty(Stats.prototype, "push", {
117
+ enumerable: false,
118
+ configurable: true,
119
+ writable: true,
120
+ value: function (url) {
121
+ return __awaiter(this, void 0, void 0, function () {
122
+ var isPushed, res;
123
+ return __generator(this, function (_a) {
124
+ switch (_a.label) {
125
+ case 0:
126
+ isPushed = false;
127
+ if (!(this.stats.totalRequests > 0)) return [3 /*break*/, 2];
128
+ return [4 /*yield*/, fetch(url + "/stats", {
129
+ method: 'POST',
130
+ body: JSON.stringify(this.stats),
131
+ headers: {
132
+ 'Content-Type': 'application/json',
133
+ Accept: 'application/json'
134
+ }
135
+ })];
136
+ case 1:
137
+ res = _a.sent();
138
+ if (res.ok) {
139
+ this.clearStats();
140
+ isPushed = true;
141
+ }
142
+ _a.label = 2;
143
+ case 2: return [2 /*return*/, isPushed];
144
+ }
145
+ });
146
+ });
147
+ }
148
+ });
149
+ return Stats;
150
+ }());
151
+ exports.Stats = Stats;
152
+ //# sourceMappingURL=stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/echo/stats.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA0C;AAE1C,IAAM,QAAQ,GAAG,UAAA,CAAC,IAAI,OAAA,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAlB,CAAkB,CAAC;AAEzC,IAAM,eAAe,GAAG,UAAA,IAAI;IAC1B,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;QAChB,OAAO,IAAI,CAAC,gBAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAI,IAAM,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,IAAM,SAAS,GAAG,UAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK;IAC5C,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC,CAAC;AAEF;IAIE;QAFA;;;;;WAAM;QAGJ,IAAI,CAAC,KAAK,GAAG;YACX,MAAM,EAAE,CAAC,CAAC;YACV,aAAa,EAAE,CAAC;YAChB,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,EAAE;YACnB,oBAAoB,EAAE,EAAE;YACxB,YAAY,EAAE,KAAK;YACnB,g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AoB,GAAG,EAAE,CAAC;YACrC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;YAChC,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAClC,CAAC;;;;;;eAED,UAAW,GAAG;;;;;;4BACR,QAAQ,GAAG,KAAK,CAAC;iCACjB,CAAA,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,CAAA,EAA5B,wBAA4B;4BAElB,qBAAM,KAAK,CAAI,GAAG,WAAQ,EAAE;oCACtC,MAAM,EAAE,MAAM;oCACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;oCAChC,OAAO,EAAE;wCACP,cAAc,EAAE,kBAAkB;wCAClC,MAAM,EAAE,kBAAkB;qCAC3B;iCACF,CAAC,EAAA;;4BAPI,GAAG,GAAG,SAOV;4BACF,IAAI,GAAG,CAAC,EAAE,EAAE;gCACV,IAAI,CAAC,UAAU,EAAE,CAAC;gCAClB,QAAQ,GAAG,IAAI,CAAC;6BACjB;;gCAGH,sBAAO,QAAQ,EAAC;;;;SACjB;;IACH,YAAC;AAAD,CAAC,AAhED,IAgEC;AAhEY,sBAAK"}
@@ -0,0 +1,29 @@
1
+ import { LoopConf, ResolvedStep, SkipConf, StepLike, StepMeta, StepStatus, StepTypes } from '../step';
2
+ import { Extractions } from '../extractions';
3
+ import { Extractable } from '../step/extractable';
4
+ import { Assertable } from '../step/assertable';
5
+ import { Assertions } from '../assertions';
6
+ export declare class ExtractAndAssertStep implements StepLike, Extractable, Assertable {
7
+ type?: StepTypes;
8
+ id?: string;
9
+ description?: string;
10
+ disabled?: boolean;
11
+ stopBefore?: string;
12
+ skipBefore?: SkipConf;
13
+ loop?: LoopConf;
14
+ timeout?: number;
15
+ delay?: number | string;
16
+ expectedStatus?: StepStatus;
17
+ meta?: StepMeta;
18
+ extract?: Extractions[];
19
+ assert?: Assertions;
20
+ constructor();
21
+ }
22
+ export declare type ResolvedExtractStep = ResolvedStep & {
23
+ text?: string;
24
+ };
25
+ /**
26
+ * This function should be able to take any object/json and either make a VALID ExtractAndAssertStep out of it
27
+ * or fail with a meaningful error message.
28
+ */
29
+ export declare function createExtractAndAssertStep(from: ExtractAndAssertStep): ExtractAndAssertStep;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createExtractAndAssertStep = exports.ExtractAndAssertStep = void 0;
4
+ var step_1 = require("../step");
5
+ var extractions_1 = require("../extractions");
6
+ var assertions_1 = require("../assertions");
7
+ var ExtractAndAssertStep = /** @class */ (function () {
8
+ function ExtractAndAssertStep() {
9
+ Object.defineProperty(this, "type", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: void 0
14
+ });
15
+ Object.defineProperty(this, "id", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: void 0
20
+ });
21
+ Object.defineProperty(this, "description", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
27
+ Object.defineProperty(this, "disabled", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: void 0
32
+ });
33
+ Object.defineProperty(this, "stopBefore", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: void 0
38
+ });
39
+ Object.defineProperty(this, "skipBefore", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ Object.defineProperty(this, "loop", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: void 0
50
+ });
51
+ Object.defineProperty(this, "timeout", {
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true,
55
+ value: void 0
56
+ });
57
+ Object.defineProperty(this, "delay", {
58
+ enumerable: true,
59
+ configurable: true,
60
+ writable: true,
61
+ value: void 0
62
+ });
63
+ Object.defineProperty(this, "expectedStatus", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: void 0
68
+ });
69
+ Object.defineProperty(this, "meta", {
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true,
73
+ value: void 0
74
+ });
75
+ Object.defineProperty(this, "extract", {
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true,
79
+ value: void 0
80
+ });
81
+ Object.defineProperty(this, "assert", {
82
+ enumerable: true,
83
+ configurable: true,
84
+ writable: true,
85
+ value: void 0
86
+ });
87
+ this.type = step_1.StepTypes.EXTRACT_AND_ASSERT;
88
+ }
89
+ return ExtractAndAssertStep;
90
+ }());
91
+ exports.ExtractAndAssertStep = ExtractAndAssertStep;
92
+ /**
93
+ * This function should be able to take any object/json and either make a VALID ExtractAndAssertStep out of it
94
+ * or fail with a meaningful error message.
95
+ */
96
+ function createExtractAndAssertStep(from) {
97
+ var extract = from.extract, assert = from.assert;
98
+ var extractStep = step_1.createStep(from, new ExtractAndAssertStep());
99
+ if (extract) {
100
+ extractStep.extract = extractions_1.toExtractions(extract);
101
+ }
102
+ if (assert) {
103
+ extractStep.assert = assertions_1.toAssertions(assert);
104
+ }
105
+ return extractStep;
106
+ }
107
+ exports.createExtractAndAssertStep = createExtractAndAssertStep;
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extract-and-assert-step/index.ts"],"names":[],"mappings":";;;AAAA,gCASiB;AACjB,8CAGwB;AAGxB,4CAGuB;AAEvB;IAgBE;QAfA;;;;;WAAiB;QACjB;;;;;WAAY;QACZ;;;;;WAAqB;QACrB;;;;;WAAmB;QACnB;;;;;WAAoB;QACpB;;;;;WAAsB;QACtB;;;;;WAAgB;QAChB;;;;;WAAiB;QACjB;;;;;WAAwB;QACxB;;;;;WAA4B;QAC5B;;;;;WAAgB;QAEhB;;;;;WAAwB;QACxB;;;;;WAAoB;QAGlB,IAAI,CAAC,IAAI,GAAG,gBAAS,CAAC,kBAAkB,CAAC;IAC3C,CAAC;IACH,2BAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,oDAAoB;AAyBjC;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,IAA0B;IAEjE,IAAA,OAAO,GAEL,IAAI,QAFC,EACP,MAAM,GACJ,IAAI,OADA,CACC;IAET,IAAM,WAAW,GAAG,iBAAU,CAC5B,IAAI,EACJ,IAAI,oBAAoB,EAAE,CAC3B,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,WAAW,CAAC,OAAO,GAAG,2BAAa,CAAC,OAAO,CAAC,CAAC;KAC9C;IAED,IAAI,MAAM,EAAE;QACV,WAAW,CAAC,MAAM,GAAG,yBAAY,CAAC,MAAM,CAAC,CAAC;KAC3C;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AApBD,gEAoBC"}
@@ -0,0 +1,36 @@
1
+ export declare type Extractions = {
2
+ [parameter: string]: Extraction;
3
+ };
4
+ /**
5
+ * This object represents a parameter extraction.
6
+ *
7
+ * The jQuary expression is evaluated against the response body text using Cheerio.
8
+ * The jsonPath expression is evaluated against a superagent-like response object.
9
+ * The edn expression is evaluated against a superagent-like response object converted to JSON and then treated like jsonPath.
10
+ * If a regular expression is specified as well as a header, jQuery or jsonPath then the expression will be matched against the
11
+ * query result, otherwise it is evaluated against the response body text.
12
+ *
13
+ * It is invalid to submit an empty extraction or one with more than one non-regex query. If the extraction yields a
14
+ * `null` result, then the original parameter value will be retained, defaulting to an empty string.
15
+ *
16
+ * @property header A name of a header whose value will be extracted.
17
+ * @property jQuery A jQuery expression to be matched against the response body text.
18
+ * @property xPath An Xpath expression to be matched against the xml response body.
19
+ * @property jsonPath A jsonPath expression to be matched against the response object.
20
+ * @property edn A jsonPath expression (yes - jsonPath) to be matched against the EDN response object converted to JSON.
21
+ * @property regex A JavaScript regular expression with a capture term, to be matched against the response body text.
22
+ */
23
+ export declare type Extraction = string | ExtractionObj;
24
+ export declare type ExtractionObj = {
25
+ regex?: string;
26
+ header?: string;
27
+ jsonPath?: string;
28
+ edn?: string;
29
+ xPath?: string;
30
+ jQuery?: string | {
31
+ query: string;
32
+ attr?: string;
33
+ };
34
+ ws?: string;
35
+ };
36
+ export declare function toExtractions(extractions: Extractions | Extractions[]): Extractions[];
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toExtractions = void 0;
4
+ function toExtractions(extractions) {
5
+ if (!Array.isArray(extractions)) {
6
+ extractions = [extractions];
7
+ }
8
+ return extractions.map(toSingleExtractions);
9
+ }
10
+ exports.toExtractions = toExtractions;
11
+ function toSingleExtractions(extractions) {
12
+ var result = {};
13
+ // Arrgh: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12449
14
+ Object.keys(extractions).forEach(function (name) {
15
+ var extraction = extractions[name];
16
+ var newExtraction = extractions[name];
17
+ if (typeof extraction !== 'string') {
18
+ newExtraction = {};
19
+ var header = extraction.header, jQuery = extraction.jQuery, xPath = extraction.xPath, jsonPath = extraction.jsonPath, edn = extraction.edn, regex = extraction.regex, ws = extraction.ws;
20
+ if (header != null) {
21
+ newExtraction.header = header;
22
+ }
23
+ if (jQuery != null) {
24
+ newExtraction.jQuery =
25
+ typeof jQuery === 'string'
26
+ ? jQuery
27
+ : { query: jQuery.query, attr: jQuery.attr };
28
+ }
29
+ if (xPath != null) {
30
+ newExtraction.xPath = xPath;
31
+ }
32
+ if (jsonPath != null) {
33
+ newExtraction.jsonPath = jsonPath;
34
+ }
35
+ if (edn != null) {
36
+ newExtraction.edn = edn;
37
+ }
38
+ if (regex != null) {
39
+ newExtraction.regex = regex;
40
+ }
41
+ if (ws != null) {
42
+ newExtraction.ws = ws;
43
+ }
44
+ }
45
+ result[name] = newExtraction;
46
+ });
47
+ return result;
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extractions/index.ts"],"names":[],"mappings":";;;AAwCA,SAAgB,aAAa,CAAC,WAAwC;IAC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QAAQ,CAAC;aACnC;YAED,IAAI,GAAG,IAAI,IAAI,EAAE;gBACf,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;aACzB;YAED,IAAI,KAAK,IAAI,IAAI,EAAE;gBACjB,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;aAC7B;YAED,IAAI,EAAE,IAAI,IAAI,EAAE;gBACd,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC;aACvB;SACF;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,71 @@
1
+ export interface Har {
2
+ log: HarLog;
3
+ }
4
+ export interface HarLog {
5
+ version: string;
6
+ entries: HarEntry[];
7
+ }
8
+ export interface HarEntry {
9
+ time: number;
10
+ request: HarRequest;
11
+ response: HarResponse;
12
+ startedDateTime: string;
13
+ _resourceType?: ResourceType;
14
+ _webSocketMessages?: WebSocketMessage[];
15
+ }
16
+ declare type ResourceType = 'main_frame' | 'sub_frame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xmlhttprequest' | 'ping' | 'csp_report' | 'media' | 'websocket' | 'other';
17
+ export declare type WebSocketMessage = {
18
+ type: WebSocketMessageType;
19
+ time: number;
20
+ opcode: number;
21
+ data: string;
22
+ };
23
+ export declare type WebSocketMessageType = 'send' | 'receive';
24
+ export interface HarRequest {
25
+ url: string;
26
+ method: string;
27
+ headers: HarHeaders;
28
+ bodySize: number;
29
+ postData?: HarPostData;
30
+ cookies: Cookie[];
31
+ queryString: {
32
+ name: string;
33
+ value: string;
34
+ }[];
35
+ }
36
+ export declare type HarHeaders = HarHeader[];
37
+ export declare type HarHeader = {
38
+ name: string;
39
+ value: string;
40
+ };
41
+ export interface HarResponse {
42
+ status: number;
43
+ headers: HarHeaders;
44
+ statusText: string;
45
+ content: {
46
+ mimeType: string;
47
+ text?: string;
48
+ encoding?: string;
49
+ };
50
+ }
51
+ export declare type Cookie = {
52
+ name: string;
53
+ value: string;
54
+ };
55
+ export declare type HarPostData = {
56
+ mimeType: string;
57
+ text?: string;
58
+ params?: HarParam[];
59
+ };
60
+ export declare type HarParam = {
61
+ name: string;
62
+ value?: string;
63
+ fileName?: string;
64
+ contentType?: string;
65
+ };
66
+ export declare const isHar: (obj: any) => any;
67
+ export declare const isWSEntry: (entry: HarEntry) => number | true | undefined;
68
+ export declare function isCacheHeader(lowerName: string): boolean;
69
+ export declare function filterRecordedHeader(name: string): any;
70
+ export declare function isReservedHeader(lowerName: string): boolean;
71
+ export {};