@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,130 +0,0 @@
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.FirehoseRecords = FirehoseRecords;
130
- //# sourceMappingURL=firehose.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firehose.js","sourceRoot":"","sources":["../../src/echo/firehose.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAiF;AACjF,4EAAmE;AAEnE,IAAM,oBAAoB,GAAG,YAAY,CAAC;AAC1C,IAAM,MAAM,GAAG,WAAW,CAAC;AAC3B,IAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,IAAI,QAAwB,CAAC;AAC7B,IAAM,OAAO,GAAG,IAAI,yCAAe,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAExD;IAGE;QAFA;;;;;WAAQ;QAGN,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;;;;;eAED,UAAU,MAAM;YACd,IAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC,CAAC,e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AAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACpB,CAAC;;IAEH,sBAAC;AAAD,CAAC,AArDD,IAqDC;AArDY,0CAAe"}
@@ -1,3 +0,0 @@
1
- import { Stats } from './stats';
2
- import { FirehoseRecords } from './firehose';
3
- export { Stats, FirehoseRecords };
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,8 +0,0 @@
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
- }
@@ -1,152 +0,0 @@
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
@@ -1 +0,0 @@
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,UAA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
- }
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 {};
package/dist/har/index.js DELETED
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isReservedHeader = exports.filterRecordedHeader = exports.isCacheHeader = exports.isWSEntry = exports.isHar = void 0;
4
- var http_headers_validation_1 = require("http-headers-validation");
5
- var isHar = function (obj) {
6
- var _a, _b, _c;
7
- return Boolean(obj.log) &&
8
- typeof ((_a = obj.log) === null || _a === void 0 ? void 0 : _a.version) === 'string' &&
9
- ((_b = obj.log) === null || _b === void 0 ? void 0 : _b.version.startsWith('1.')) &&
10
- Array.isArray((_c = obj.log) === null || _c === void 0 ? void 0 : _c.entries);
11
- };
12
- exports.isHar = isHar;
13
- var isWSEntry = function (entry) { var _a; return entry._resourceType === 'websocket' || ((_a = entry._webSocketMessages) === null || _a === void 0 ? void 0 : _a.length); };
14
- exports.isWSEntry = isWSEntry;
15
- function isCacheHeader(lowerName) {
16
- return (lowerName === 'if-match' ||
17
- lowerName === 'if-modified-since' ||
18
- lowerName === 'if-none-match' ||
19
- lowerName === 'cache-control' ||
20
- lowerName === 'pragma' ||
21
- lowerName === 'expires' ||
22
- lowerName === 'if-unmodifed-since');
23
- }
24
- exports.isCacheHeader = isCacheHeader;
25
- function filterRecordedHeader(name) {
26
- var lowerName = name.toLowerCase();
27
- // Remove invalid headers from HAR file (Chrome adds some weird one starting with ':')
28
- return (http_headers_validation_1.validateHeaderName(name) &&
29
- // Don't take cache related stuff from HAR file:
30
- !isCacheHeader(lowerName) &&
31
- // Browser reserved headers are not allowed:
32
- !isReservedHeader(lowerName) &&
33
- // cookie, origin and user-agent headers are special since they are not reserved (user can set in conf) but we want to filter them:
34
- lowerName !== 'cookie' &&
35
- lowerName !== 'origin' &&
36
- lowerName !== 'user-agent' &&
37
- // host is sort of reserved but we want to filter it from imports
38
- lowerName !== 'host' &&
39
- // This is browser specific:
40
- lowerName !== 'upgrade-insecure-requests');
41
- }
42
- exports.filterRecordedHeader = filterRecordedHeader;
43
- function isReservedHeader(lowerName) {
44
- return (lowerName.startsWith('proxy-') ||
45
- (lowerName.startsWith('sec-') && !lowerName.startsWith('sec-websocket')) ||
46
- lowerName === 'accept-charset' ||
47
- lowerName === 'access-control-request-headers' ||
48
- lowerName === 'access-control-request-method' ||
49
- lowerName === 'connection' ||
50
- lowerName === 'content-length' ||
51
- lowerName === 'cookie2' ||
52
- lowerName === 'date' ||
53
- lowerName === 'dnt' ||
54
- lowerName === 'expect' ||
55
- lowerName === 'keep-alive' ||
56
- lowerName === 'trailer' ||
57
- lowerName === 'transfer-encoding' ||
58
- lowerName === 'upgrade');
59
- }
60
- exports.isReservedHeader = isReservedHeader;
61
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/har/index.ts"],"names":[],"mappings":";;;AAAA,mEAA6D;AA+EtD,IAAM,KAAK,GAAG,UAAC,GAAQ;;IAAK,OAAA,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;QACjD,OAAO,CAAA,MAAA,GAAG,CAAC,GAAG,0CAAE,OAAO,CAAA,KAAK,QAAQ;SACpC,MAAA,GAAG,CAAC,GAAG,0CAAE,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACjC,KAAK,CAAC,OAAO,CAAC,MAAA,GAAG,CAAC,GAAG,0CAAE,OAAO,CAAC,CAAA;CAAA,CAAC;AAHrB,QAAA,KAAK,SAGgB;AAE3B,IAAM,SAAS,GAAG,UAAC,KAAe,YAAK,OAAA,KAAK,CAAC,aAAa,KAAK,WAAW,KAAI,MAAA,KAAK,CAAC,kBAAkB,0CAAE,MAAM,CAAA,CAAA,EAAA,CAAC;AAAzG,QAAA,SAAS,aAAgG;AAEtH,SAAgB,aAAa,CAAC,SAAiB;IAC7C,OAAO,CACL,SAAS,KAAK,UAAU;QACxB,SAAS,KAAK,mBAAmB;QACjC,SAAS,KAAK,eAAe;QAC7B,SAAS,KAAK,eAAe;QAC7B,SAAS,KAAK,QAAQ;QACtB,SAAS,KAAK,SAAS;QACvB,SAAS,KAAK,oBAAoB,CACnC,CAAC;AACJ,CAAC;AAVD,sCAUC;AAED,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,IAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAErC,sFAAsF;IACtF,OAAO,CACL,4CAAkB,CAAC,IAAI,CAAC;QACxB,gDAAgD;QAChD,CAAC,aAAa,CAAC,SAAS,CAAC;QACzB,4CAA4C;QAC5C,CAAC,gBAAgB,CAAC,SAAS,CAAC;QAC5B,mIAAmI;QACnI,SAAS,KAAK,QAAQ;QACtB,SAAS,KAAK,QAAQ;QACtB,SAAS,KAAK,YAAY;QAC1B,iEAAiE;QACjE,SAAS,KAAK,MAAM;QACpB,4BAA4B;QAC5B,SAAS,KAAK,2BAA2B,CAC1C,CAAC;AACJ,CAAC;AAnBD,oDAmBC;AAED,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,OAAO,CACL,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC9B,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QACxE,SAAS,KAAK,gBAAgB;QAC9B,SAAS,KAAK,gCAAgC;QAC9C,SAAS,KAAK,+BAA+B;QAC7C,SAAS,KAAK,YAAY;QAC1B,SAAS,KAAK,gBAAgB;QAC9B,SAAS,KAAK,SAAS;QACvB,SAAS,KAAK,MAAM;QACpB,SAAS,KAAK,KAAK;QACnB,SAAS,KAAK,QAAQ;QACtB,SAAS,KAAK,YAAY;QAC1B,SAAS,KAAK,SAAS;QACvB,SAAS,KAAK,mBAAmB;QACjC,SAAS,KAAK,SAAS,CACxB,CAAC;AACJ,CAAC;AAlBD,4CAkBC"}
@@ -1 +0,0 @@
1
- export declare const AND_OR_NOT_BRACKET_REGEXP: RegExp;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AND_OR_NOT_BRACKET_REGEXP = void 0;
4
- exports.AND_OR_NOT_BRACKET_REGEXP = /[!|&)(]/gm;
5
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/labels/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,WAAW,CAAC"}
@@ -1,2 +0,0 @@
1
- import { HarParam } from '../har';
2
- export declare const getBinaryOrTextValue: (fields: Omit<HarParam, 'name'>) => string;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBinaryOrTextValue = void 0;
4
- var mime_types_1 = require("mime-types");
5
- var validator_1 = require("validator");
6
- var is_binary_file_1 = require("./is-binary-file");
7
- var getBinaryOrTextValue = function (fields) {
8
- var _a = fields.value, value = _a === void 0 ? '' : _a, fileName = fields.fileName;
9
- if (fileName) {
10
- return myAtob(fields);
11
- }
12
- return value;
13
- };
14
- exports.getBinaryOrTextValue = getBinaryOrTextValue;
15
- var myAtob = function (fields) {
16
- var _a = fields.value, value = _a === void 0 ? '' : _a;
17
- return Buffer.from(value, getEncodingFrom(value))
18
- .toString(getEncodingTo(fields));
19
- };
20
- var getEncodingFrom = function (value) {
21
- if (value === void 0) { value = ''; }
22
- if (validator_1.isBase64(value)) {
23
- return 'base64';
24
- }
25
- };
26
- var getEncodingTo = function (fields) {
27
- if (isToBinary(fields)) {
28
- return 'binary';
29
- }
30
- };
31
- var isToBinary = function (fields) {
32
- var _a = fields.value, value = _a === void 0 ? '' : _a, fileName = fields.fileName, contentType = fields.contentType;
33
- if (isAlreadyBinary(value)) {
34
- return false;
35
- }
36
- if (fileName) {
37
- var ext = getExtension(fileName);
38
- if (ext) {
39
- return isBinaryFileExtension(ext);
40
- }
41
- }
42
- if (contentType) {
43
- return isBinaryContentType(contentType);
44
- }
45
- return false;
46
- };
47
- var isAlreadyBinary = function (target) {
48
- if (target === void 0) { target = ''; }
49
- var bytes = Buffer.from(target);
50
- var size = target.length;
51
- return is_binary_file_1.isBinaryFile(bytes, size);
52
- };
53
- var getExtension = function (fileName) {
54
- return fileName.split('.').pop();
55
- };
56
- var isBinaryFileExtension = function (ext) {
57
- return ['docx', 'pdf', 'doc', 'jpg', 'jpeg', 'png', 'xlsx', 'sdata'].includes(ext);
58
- };
59
- var isBinaryContentType = function (contentType) {
60
- return contentType.includes('octet-stream') ||
61
- ['docx', 'pdf', 'bin'].includes(mime_types_1.extension(contentType) || '');
62
- };
63
- //# sourceMappingURL=files.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/multipart-form-data/files.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AACvC,uCAAqC;AAGrC,mDAAgD;AAGzC,IAAM,oBAAoB,GAAG,UAAC,MAA8B;IACzD,IAAA,KAAyB,MAAM,MAArB,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,QAAQ,GAAK,MAAM,SAAX,CAAY;IACxC,IAAI,QAAQ,EAAE;QACZ,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;KACvB;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B;AAEF,IAAM,MAAM,GAAG,UAAC,MAA8B;IACpC,IAAA,KAAe,MAAM,MAAX,EAAV,KAAK,mBAAG,EAAE,KAAA,CAAY;IAC9B,OAAO,MAAM,CAAC,IAAI,CAChB,KAAK,EACL,eAAe,CAAC,KAAK,CAAC,CACvB;SACE,QAAQ,CACP,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,IAAM,eAAe,GAAG,UAAC,KAAkB;IAAlB,sBAAA,EAAA,UAAkB;IACzC,IAAI,oBAAQ,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC,CAAC;AAEF,IAAM,aAAa,GAAG,UAAC,MAA8B;IACnD,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QACtB,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC,CAAC;AAEF,IAAM,UAAU,GAAG,UAAC,MAA8B;IACxC,IAAA,KAAsC,MAAM,MAA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D7D,CAC6D,CAAC"}
@@ -1,19 +0,0 @@
1
- import { HarParam } from '../har';
2
- import { multipartFormDataTextToPostFormData } from './multipart-text-to-post-form-data';
3
- export declare class Form {
4
- entries: HarParam[];
5
- boundary: string;
6
- constructor(entries?: HarParam[], boundary?: string);
7
- generateBoundary: () => string;
8
- append: (name: string, value: string, fileName?: string | undefined) => void;
9
- toString: () => string;
10
- private addFileName;
11
- private addContentType;
12
- }
13
- export declare type FormEntry = {
14
- name: string;
15
- value: string;
16
- [other: string]: string;
17
- };
18
- export declare function mapToMultipartFormData(request: any): void;
19
- export { multipartFormDataTextToPostFormData };