@loadmill/core 0.3.109 → 0.3.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/conf/defaults.d.ts +1 -0
  2. package/dist/conf/defaults.js +11 -0
  3. package/dist/conf/defaults.js.map +1 -0
  4. package/dist/conf/extrema.d.ts +7 -0
  5. package/dist/conf/extrema.js +12 -0
  6. package/dist/conf/extrema.js.map +1 -0
  7. package/dist/conf/index.d.ts +15 -0
  8. package/dist/conf/index.js +80 -0
  9. package/dist/conf/index.js.map +1 -0
  10. package/dist/conf/notifications.d.ts +2 -0
  11. package/dist/conf/notifications.js +19 -0
  12. package/dist/conf/notifications.js.map +1 -0
  13. package/dist/conf/types.d.ts +110 -0
  14. package/dist/conf/types.js +38 -0
  15. package/dist/conf/types.js.map +1 -0
  16. package/dist/conf/validate.d.ts +69 -0
  17. package/dist/conf/validate.js +495 -0
  18. package/dist/conf/validate.js.map +1 -0
  19. package/dist/distributed-logger-reporter.d.ts +3 -0
  20. package/dist/distributed-logger-reporter.js +74 -0
  21. package/dist/distributed-logger-reporter.js.map +1 -0
  22. package/dist/echo/firehose.d.ts +7 -0
  23. package/dist/echo/firehose.js +130 -0
  24. package/dist/echo/firehose.js.map +1 -0
  25. package/dist/echo/index.d.ts +3 -0
  26. package/dist/echo/index.js +8 -0
  27. package/dist/echo/index.js.map +1 -0
  28. package/dist/echo/stats.d.ts +8 -0
  29. package/dist/echo/stats.js +152 -0
  30. package/dist/echo/stats.js.map +1 -0
  31. package/dist/har/index.d.ts +68 -0
  32. package/dist/har/index.js +14 -0
  33. package/dist/har/index.js.map +1 -0
  34. package/dist/labels/constants.d.ts +1 -0
  35. package/dist/labels/constants.js +5 -0
  36. package/dist/labels/constants.js.map +1 -0
  37. package/dist/multipart-form-data/files.d.ts +2 -0
  38. package/dist/multipart-form-data/files.js +63 -0
  39. package/dist/multipart-form-data/files.js.map +1 -0
  40. package/dist/multipart-form-data/form-data-utils.d.ts +19 -0
  41. package/dist/multipart-form-data/form-data-utils.js +117 -0
  42. package/dist/multipart-form-data/form-data-utils.js.map +1 -0
  43. package/dist/multipart-form-data/is-binary-file.d.ts +2 -0
  44. package/dist/multipart-form-data/is-binary-file.js +215 -0
  45. package/dist/multipart-form-data/is-binary-file.js.map +1 -0
  46. package/dist/multipart-form-data/multipart-text-to-post-form-data.d.ts +2 -0
  47. package/dist/multipart-form-data/multipart-text-to-post-form-data.js +86 -0
  48. package/dist/multipart-form-data/multipart-text-to-post-form-data.js.map +1 -0
  49. package/dist/parameters/extractions.d.ts +26 -0
  50. package/dist/parameters/extractions.js +49 -0
  51. package/dist/parameters/extractions.js.map +1 -0
  52. package/dist/parameters/extractors/cheerio-extractor.d.ts +11 -0
  53. package/dist/parameters/extractors/cheerio-extractor.js +84 -0
  54. package/dist/parameters/extractors/cheerio-extractor.js.map +1 -0
  55. package/dist/parameters/extractors/expression-extractor.d.ts +6 -0
  56. package/dist/parameters/extractors/expression-extractor.js +38 -0
  57. package/dist/parameters/extractors/expression-extractor.js.map +1 -0
  58. package/dist/parameters/extractors/extractor.d.ts +3 -0
  59. package/dist/parameters/extractors/extractor.js +3 -0
  60. package/dist/parameters/extractors/extractor.js.map +1 -0
  61. package/dist/parameters/extractors/header-extractor.d.ts +7 -0
  62. package/dist/parameters/extractors/header-extractor.js +51 -0
  63. package/dist/parameters/extractors/header-extractor.js.map +1 -0
  64. package/dist/parameters/extractors/index.d.ts +10 -0
  65. package/dist/parameters/extractors/index.js +20 -0
  66. package/dist/parameters/extractors/index.js.map +1 -0
  67. package/dist/parameters/extractors/json-path-extractor.d.ts +12 -0
  68. package/dist/parameters/extractors/json-path-extractor.js +167 -0
  69. package/dist/parameters/extractors/json-path-extractor.js.map +1 -0
  70. package/dist/parameters/extractors/parametrized-extractor.d.ts +10 -0
  71. package/dist/parameters/extractors/parametrized-extractor.js +34 -0
  72. package/dist/parameters/extractors/parametrized-extractor.js.map +1 -0
  73. package/dist/parameters/extractors/regex-extractor.d.ts +7 -0
  74. package/dist/parameters/extractors/regex-extractor.js +46 -0
  75. package/dist/parameters/extractors/regex-extractor.js.map +1 -0
  76. package/dist/parameters/extractors/regex-matcher.d.ts +1 -0
  77. package/dist/parameters/extractors/regex-matcher.js +21 -0
  78. package/dist/parameters/extractors/regex-matcher.js.map +1 -0
  79. package/dist/parameters/extractors/ws-extractor.d.ts +33 -0
  80. package/dist/parameters/extractors/ws-extractor.js +215 -0
  81. package/dist/parameters/extractors/ws-extractor.js.map +1 -0
  82. package/dist/parameters/extractors/x-path-extractor.d.ts +9 -0
  83. package/dist/parameters/extractors/x-path-extractor.js +71 -0
  84. package/dist/parameters/extractors/x-path-extractor.js.map +1 -0
  85. package/dist/parameters/generate-random.d.ts +13 -0
  86. package/dist/parameters/generate-random.js +108 -0
  87. package/dist/parameters/generate-random.js.map +1 -0
  88. package/dist/parameters/html-utils.d.ts +1 -0
  89. package/dist/parameters/html-utils.js +18 -0
  90. package/dist/parameters/html-utils.js.map +1 -0
  91. package/dist/parameters/index.d.ts +89 -0
  92. package/dist/parameters/index.js +619 -0
  93. package/dist/parameters/index.js.map +1 -0
  94. package/dist/parameters/json-path-utils.d.ts +1 -0
  95. package/dist/parameters/json-path-utils.js +16 -0
  96. package/dist/parameters/json-path-utils.js.map +1 -0
  97. package/dist/parameters/operators/binary-operator.d.ts +13 -0
  98. package/dist/parameters/operators/binary-operator.js +39 -0
  99. package/dist/parameters/operators/binary-operator.js.map +1 -0
  100. package/dist/parameters/operators/index.d.ts +5 -0
  101. package/dist/parameters/operators/index.js +21 -0
  102. package/dist/parameters/operators/index.js.map +1 -0
  103. package/dist/parameters/parameter-functions/boolean-parameter-functions.d.ts +12 -0
  104. package/dist/parameters/parameter-functions/boolean-parameter-functions.js +47 -0
  105. package/dist/parameters/parameter-functions/boolean-parameter-functions.js.map +1 -0
  106. package/dist/parameters/parameter-functions/crypto.d.ts +11 -0
  107. package/dist/parameters/parameter-functions/crypto.js +71 -0
  108. package/dist/parameters/parameter-functions/crypto.js.map +1 -0
  109. package/dist/parameters/parameter-functions/json-schema.d.ts +1 -0
  110. package/dist/parameters/parameter-functions/json-schema.js +33 -0
  111. package/dist/parameters/parameter-functions/json-schema.js.map +1 -0
  112. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.d.ts +11 -0
  113. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js +34 -0
  114. package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js.map +1 -0
  115. package/dist/parameters/parameter-functions/numeric-parameter-functions.d.ts +15 -0
  116. package/dist/parameters/parameter-functions/numeric-parameter-functions.js +56 -0
  117. package/dist/parameters/parameter-functions/numeric-parameter-functions.js.map +1 -0
  118. package/dist/parameters/parameter-functions/parameter-function-utils.d.ts +5 -0
  119. package/dist/parameters/parameter-functions/parameter-function-utils.js +82 -0
  120. package/dist/parameters/parameter-functions/parameter-function-utils.js.map +1 -0
  121. package/dist/parameters/parameter-functions/parameter-function.d.ts +6 -0
  122. package/dist/parameters/parameter-functions/parameter-function.js +28 -0
  123. package/dist/parameters/parameter-functions/parameter-function.js.map +1 -0
  124. package/dist/parameters/parameter-functions/parameter-functions.d.ts +7 -0
  125. package/dist/parameters/parameter-functions/parameter-functions.js +53 -0
  126. package/dist/parameters/parameter-functions/parameter-functions.js.map +1 -0
  127. package/dist/parameters/parameter-functions/random-parameter-functions.d.ts +1 -0
  128. package/dist/parameters/parameter-functions/random-parameter-functions.js +43 -0
  129. package/dist/parameters/parameter-functions/random-parameter-functions.js.map +1 -0
  130. package/dist/parameters/parameter-functions/textual-parameter-functions.d.ts +67 -0
  131. package/dist/parameters/parameter-functions/textual-parameter-functions.js +403 -0
  132. package/dist/parameters/parameter-functions/textual-parameter-functions.js.map +1 -0
  133. package/dist/parameters/parameter-name-utils.d.ts +5 -0
  134. package/dist/parameters/parameter-name-utils.js +137 -0
  135. package/dist/parameters/parameter-name-utils.js.map +1 -0
  136. package/dist/parameters/parameter-regex-providers.d.ts +24 -0
  137. package/dist/parameters/parameter-regex-providers.js +70 -0
  138. package/dist/parameters/parameter-regex-providers.js.map +1 -0
  139. package/dist/parameters/resolvers/random-parameters-resolver.d.ts +1 -0
  140. package/dist/parameters/resolvers/random-parameters-resolver.js +12 -0
  141. package/dist/parameters/resolvers/random-parameters-resolver.js.map +1 -0
  142. package/dist/parameters/type.d.ts +10 -0
  143. package/dist/parameters/type.js +9 -0
  144. package/dist/parameters/type.js.map +1 -0
  145. package/dist/parameters/value-utils.d.ts +5 -0
  146. package/dist/parameters/value-utils.js +44 -0
  147. package/dist/parameters/value-utils.js.map +1 -0
  148. package/dist/request/index.d.ts +265 -0
  149. package/dist/request/index.js +541 -0
  150. package/dist/request/index.js.map +1 -0
  151. package/dist/schema/json-schema-generator.d.ts +20 -0
  152. package/dist/schema/json-schema-generator.js +135 -0
  153. package/dist/schema/json-schema-generator.js.map +1 -0
  154. package/dist/signals.d.ts +4 -0
  155. package/dist/signals.js +9 -0
  156. package/dist/signals.js.map +1 -0
  157. package/dist/subset/index.d.ts +3 -0
  158. package/dist/subset/index.js +8 -0
  159. package/dist/subset/index.js.map +1 -0
  160. package/dist/subset/is-subset.d.ts +2 -0
  161. package/dist/subset/is-subset.js +29 -0
  162. package/dist/subset/is-subset.js.map +1 -0
  163. package/dist/subset/json-contains.d.ts +1 -0
  164. package/dist/subset/json-contains.js +24 -0
  165. package/dist/subset/json-contains.js.map +1 -0
  166. package/dist/team-options/constants.d.ts +3 -0
  167. package/dist/team-options/constants.js +7 -0
  168. package/dist/team-options/constants.js.map +1 -0
  169. package/dist/xml/decode.d.ts +2 -0
  170. package/dist/xml/decode.js +87 -0
  171. package/dist/xml/decode.js.map +1 -0
  172. package/dist/xml/encode.d.ts +1 -0
  173. package/dist/xml/encode.js +14 -0
  174. package/dist/xml/encode.js.map +1 -0
  175. package/dist/xml/escape-reserved-chars.d.ts +6 -0
  176. package/dist/xml/escape-reserved-chars.js +57 -0
  177. package/dist/xml/escape-reserved-chars.js.map +1 -0
  178. package/dist/xml/is-xml.d.ts +1 -0
  179. package/dist/xml/is-xml.js +9 -0
  180. package/dist/xml/is-xml.js.map +1 -0
  181. package/dist/xml/json-to-xml.d.ts +2 -0
  182. package/dist/xml/json-to-xml.js +11 -0
  183. package/dist/xml/json-to-xml.js.map +1 -0
  184. package/dist/xml/namespaces.d.ts +7 -0
  185. package/dist/xml/namespaces.js +16 -0
  186. package/dist/xml/namespaces.js.map +1 -0
  187. package/dist/xml/remove-invisible-chars.d.ts +2 -0
  188. package/dist/xml/remove-invisible-chars.js +13 -0
  189. package/dist/xml/remove-invisible-chars.js.map +1 -0
  190. package/dist/xml/replace-s-tags.d.ts +4 -0
  191. package/dist/xml/replace-s-tags.js +21 -0
  192. package/dist/xml/replace-s-tags.js.map +1 -0
  193. package/dist/xml/xml-to-json.d.ts +7 -0
  194. package/dist/xml/xml-to-json.js +21 -0
  195. package/dist/xml/xml-to-json.js.map +1 -0
  196. package/package.json +3 -3
@@ -0,0 +1,137 @@
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.humanizeXMLParameterName = exports.humanizeJSONPath = exports.ordinal = exports.pathToArray = exports.replaceInvalidCharactersParamName = void 0;
7
+ var pluralize_1 = __importDefault(require("pluralize"));
8
+ var jsonpath_1 = __importDefault(require("jsonpath"));
9
+ var log_1 = __importDefault(require("@loadmill/universal/dist/log"));
10
+ var camelCase_1 = __importDefault(require("lodash/camelCase"));
11
+ var replaceInvalidCharactersParamName = function (paramName) { return paramName
12
+ .replace(/\$\["/gi, '')
13
+ .replace(/\["/gi, '_')
14
+ .replace(/\[/gi, '_')
15
+ .replace(/"\]/gi, '')
16
+ .replace(/\]/gi, '')
17
+ .replace(/\./gi, '_')
18
+ .replace(/\$/gi, '')
19
+ .replace(/-/gi, '_')
20
+ .replace(/>/gi, '_')
21
+ .replace(/ /gi, '_')
22
+ .replace(/:/gi, '_')
23
+ .replace(/=/gi, '_')
24
+ .replace(/@/gi, '_')
25
+ .replace(/"/gi, '')
26
+ .replace(/\//gi, '')
27
+ .replace(/\{/gi, '')
28
+ .replace(/\}/gi, '')
29
+ .replace(/;/gi, '')
30
+ .replace(/\(/gi, '')
31
+ .replace(/\)/gi, '')
32
+ .replace(/__/, '_')
33
+ .replace(/^_/, '')
34
+ .replace(/_$/, '')
35
+ .replace(/,/g, '_')
36
+ .replace(/&/g, '_')
37
+ .replace(/\*/g, '_')
38
+ .replace(/#/g, 'hash')
39
+ .replace(/\|/g, '_')
40
+ .replace(/\+/g, '_')
41
+ .replace(/^[0-9]/, function (match) { return '_' + match; }); };
42
+ exports.replaceInvalidCharactersParamName = replaceInvalidCharactersParamName;
43
+ // ?(@.price<30 && @.category=="fiction") --> price<30 && category=="fiction"
44
+ var removeSpecialJsonpathChars = function (path) { return typeof path === 'string' ?
45
+ path.replace(/(\?\(@\.)([^)]+)(\))/g, '$2').replace(/@./g, '') :
46
+ path; };
47
+ // $["posts"][0]["created_at"] -> [ 'posts', 0, 'created_at' ]
48
+ var pathToArray = function (path) {
49
+ try {
50
+ var pathInArray = jsonpath_1.default.parse(path).map(function (obj) { return obj.expression.value; });
51
+ pathInArray.shift(); // remove $ from the beginning
52
+ return pathInArray.map(removeSpecialJsonpathChars);
53
+ }
54
+ catch (e) {
55
+ log_1.default.warn('Failed to convert jsonpath to array, jsonpath:', path, e);
56
+ return [path];
57
+ }
58
+ };
59
+ exports.pathToArray = pathToArray;
60
+ // magic - https://leancrew.com/all-this/2020/06/ordinal-numerals-and-javascript/
61
+ var ordinal = function (number) {
62
+ var suffix = ['th', 'st', 'nd', 'rd'];
63
+ var value = number % 100;
64
+ return number + (suffix[(value - 20) % 10] || suffix[value] || suffix[0]);
65
+ };
66
+ exports.ordinal = ordinal;
67
+ var humanizeJSONPath = function (path) {
68
+ var pathInArray = exports.pathToArray(path);
69
+ var arr = pathInArray.reverse();
70
+ return arr.map(function (part, i) {
71
+ return Number.isInteger(Number(part)) ? "" + (getOrdinalPrefix(i) + exports.ordinal(Number(part) + 1)) : pluralize_1.default.singular(part);
72
+ }).join('_');
73
+ };
74
+ exports.humanizeJSONPath = humanizeJSONPath;
75
+ var getOrdinalPrefix = function (index) { return index === 0 ? 'the_' : 'of_'; };
76
+ var humanizeXMLParameterName = function (paramName) {
77
+ var parts = paramName.split('_');
78
+ parts = removeOfPrefix(parts);
79
+ parts = removeThe1stPrefix(parts);
80
+ parts = remove1st(parts);
81
+ parts = removeFluff(parts);
82
+ parts = parts.map(camelCase_1.default);
83
+ return parts.join('_');
84
+ };
85
+ exports.humanizeXMLParameterName = humanizeXMLParameterName;
86
+ var removeOfPrefix = function (parts) {
87
+ if (parts[0] === 'of' && isOrdinal(parts[1]) && parts[1] !== '1st') {
88
+ return parts.slice(1);
89
+ }
90
+ return parts;
91
+ };
92
+ var isOrdinal = function (part) {
93
+ return (part.endsWith('st') ||
94
+ part.endsWith('nd') ||
95
+ part.endsWith('rd') ||
96
+ part.endsWith('th')) &&
97
+ !isNaN(Number(part.slice(0, -2)));
98
+ };
99
+ var removeThe1stPrefix = function (parts) {
100
+ if (['the', 'of'].includes(parts[0]) && parts[1] === '1st') {
101
+ return parts.slice(2);
102
+ }
103
+ return parts;
104
+ };
105
+ var remove1st = function (parts) {
106
+ return parts.filter(function (part) { return part !== '1st'; });
107
+ };
108
+ /**
109
+ * Removes the 3rd 'of' and everything after it until the 'in' keyword.
110
+ * @example removeFluff(['a','of','b','of','c','of','d','in','e','f']) => ['a','of','b','of','c','in','e','f']
111
+ */
112
+ var removeFluff = function (parts) {
113
+ var indexOfThirdOf = indexOfNthOccurrenceInArray(parts, 'of', 3);
114
+ if (indexOfThirdOf !== -1) { // if there's fluff, remove it
115
+ var inIndex = parts.indexOf('in');
116
+ return parts.slice(0, indexOfThirdOf).concat(parts.slice(inIndex));
117
+ }
118
+ return parts;
119
+ };
120
+ /**
121
+ * Returns the index of the nth occurrence of x in arr.
122
+ * Returns -1 if x does not occur n times in arr.
123
+ * @example getNthOccurrenceInArray(['a','b','a','c','a','d'], 'a', 3) => 4 (because the third 'a' in the array is at index 4)
124
+ */
125
+ var indexOfNthOccurrenceInArray = function (arr, x, n) {
126
+ var occurrences = 0;
127
+ for (var i = 0; i < arr.length; i++) {
128
+ if (arr[i] === x) {
129
+ occurrences++;
130
+ if (occurrences === n) {
131
+ return i;
132
+ }
133
+ }
134
+ }
135
+ return -1;
136
+ };
137
+ //# sourceMappingURL=parameter-name-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameter-name-utils.js","sourceRoot":"","sources":["../../src/parameters/parameter-name-utils.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAkC;AAClC,sDAAgC;AAChC,qEAA+C;AAC/C,+DAAyC;AAElC,IAAM,iCAAiC,GAAG,UAAC,SAAiB,IAAK,OAAA,SAAS;KAC9E,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;KACtB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;KACrB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;KACpB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;KACpB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;KACnB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;KACpB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;KACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;KACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;KACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;KACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;KACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;KACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;KACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;KAClB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;KACnB,OAAO,CAAC,MAAM,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0,0 +1,24 @@
1
+ declare class OneOffRegExpProvider {
2
+ private regExp;
3
+ constructor(regExp: RegExp);
4
+ use: (callback: any) => any;
5
+ }
6
+ export declare const LEGAL_PARAM_CHARS = "_a-zA-Z0-9";
7
+ export declare const SPACED_OPERATOR: string;
8
+ export declare const PARAMETER_USAGE_PATTERN_INSIDE: string;
9
+ export declare const PARAMETER_USAGE_PATTERN: string;
10
+ export declare const spacesRegExpProvider: OneOffRegExpProvider;
11
+ export declare const usageRegExpProvider: OneOffRegExpProvider;
12
+ export declare const globalUsageRegExpProvider: OneOffRegExpProvider;
13
+ export declare const getParameterUsageRegexp: (parameterName: any) => RegExp;
14
+ export declare const getParameterfunctionGroupingRegexp: (parameterName: any) => RegExp;
15
+ export declare const getParameterOperatorsGroupingRegexp: (parameterName: any) => RegExp;
16
+ export declare const CAPTURE_REGEX: RegExp;
17
+ export declare const PARAM_USAGE_REGEXP: RegExp;
18
+ export declare const SIGNLE_PARAM_USAGE_REGEXP: RegExp;
19
+ export declare const CAPTURE_ALL_REGEX: RegExp;
20
+ export declare function isCaptureAllRegExp(regexp: RegExp): boolean;
21
+ export declare const CSRF_REGEXP_SUFFIX = " *\\\\?[\"']?(?:=|:) *\\\\?[\"']([^'\"]+?)\\\\?[\"']";
22
+ export declare const CSRF_REGEXP: string;
23
+ export declare const CONTAINS_APP_JSON_REGEXP: RegExp;
24
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONTAINS_APP_JSON_REGEXP = exports.CSRF_REGEXP = exports.CSRF_REGEXP_SUFFIX = exports.isCaptureAllRegExp = exports.CAPTURE_ALL_REGEX = exports.SIGNLE_PARAM_USAGE_REGEXP = exports.PARAM_USAGE_REGEXP = exports.CAPTURE_REGEX = exports.getParameterOperatorsGroupingRegexp = exports.getParameterfunctionGroupingRegexp = exports.getParameterUsageRegexp = exports.globalUsageRegExpProvider = exports.usageRegExpProvider = exports.spacesRegExpProvider = exports.PARAMETER_USAGE_PATTERN = exports.PARAMETER_USAGE_PATTERN_INSIDE = exports.SPACED_OPERATOR = exports.LEGAL_PARAM_CHARS = void 0;
4
+ var operators_1 = require("./operators");
5
+ var OneOffRegExpProvider = /** @class */ (function () {
6
+ function OneOffRegExpProvider(regExp) {
7
+ var _this = this;
8
+ Object.defineProperty(this, "regExp", {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value: regExp
13
+ });
14
+ Object.defineProperty(this, "use", {
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true,
18
+ value: function (callback) {
19
+ _this.regExp.lastIndex = 0;
20
+ return callback(_this.regExp);
21
+ }
22
+ });
23
+ }
24
+ return OneOffRegExpProvider;
25
+ }());
26
+ var SPACES = '(?: +)';
27
+ var LITERAL = '(?:\'[^,\'\\s]*\')';
28
+ exports.LEGAL_PARAM_CHARS = '_a-zA-Z0-9';
29
+ var PARAMETER = '(?:[_a-zA-Z][' + exports.LEGAL_PARAM_CHARS + ']*)';
30
+ var PARAMETER_OR_LITERAL = "(?:" + PARAMETER + "|" + LITERAL + ")";
31
+ var EXPRESSION = "(?:" + LITERAL + "|(?:(?:" + PARAMETER + "(?:\\((?:" + PARAMETER_OR_LITERAL + "(?:," + PARAMETER_OR_LITERAL + ")*)?\\))?)))";
32
+ var OPERATOR = '(?:' + Object.values(operators_1.operators).map(function (op) { return op.regexSymbol; }).join('|') + ')';
33
+ exports.SPACED_OPERATOR = "" + SPACES + OPERATOR + SPACES;
34
+ // Capture groups designed to work with code mirror parser - be minded!
35
+ exports.PARAMETER_USAGE_PATTERN_INSIDE = "^((?: *)(?:" + EXPRESSION + "(?:" + exports.SPACED_OPERATOR + EXPRESSION + ")*)(?: *))";
36
+ exports.PARAMETER_USAGE_PATTERN = "(\\${)((?: *)(?:" + EXPRESSION + "(?:" + exports.SPACED_OPERATOR + EXPRESSION + ")*)(?: *))(})";
37
+ exports.spacesRegExpProvider = new OneOffRegExpProvider(new RegExp(SPACES));
38
+ exports.usageRegExpProvider = new OneOffRegExpProvider(new RegExp(exports.PARAMETER_USAGE_PATTERN));
39
+ exports.globalUsageRegExpProvider = new OneOffRegExpProvider(new RegExp(exports.PARAMETER_USAGE_PATTERN, 'g'));
40
+ var PARAM_USAGE_REGEXP_PREFIX = '\\${(.[^}]*)?';
41
+ var PARAM_USAGE_REGEXP_SUFFIX = '([\\),\\s].*?)?}';
42
+ var PARAM_GROUPING_REGEXP_PREFIX = '(?<pre>\\${.*?[\\(,])(?<param>';
43
+ var PARAM_GROUPING_REGEXP_SUFFIX = ')(?<suff>[\\),].*?})';
44
+ var PARAM_OPERATORS_GROUPING_REGEXP_PREFIX = "\\${(?<pre>.*?" + exports.SPACED_OPERATOR + ".*)?(?<param>.*";
45
+ var PARAM_OPERATORS_GROUPING_REGEXP_SUFFIX = ")(?<suff>" + exports.SPACED_OPERATOR + ".*)?}";
46
+ var getParameterUsageRegexp = function (parameterName) {
47
+ return new RegExp("" + PARAM_USAGE_REGEXP_PREFIX + parameterName + PARAM_USAGE_REGEXP_SUFFIX, 'g');
48
+ };
49
+ exports.getParameterUsageRegexp = getParameterUsageRegexp;
50
+ var getParameterfunctionGroupingRegexp = function (parameterName) {
51
+ return new RegExp("" + PARAM_GROUPING_REGEXP_PREFIX + parameterName + PARAM_GROUPING_REGEXP_SUFFIX);
52
+ };
53
+ exports.getParameterfunctionGroupingRegexp = getParameterfunctionGroupingRegexp;
54
+ var getParameterOperatorsGroupingRegexp = function (parameterName) {
55
+ return new RegExp("" + PARAM_OPERATORS_GROUPING_REGEXP_PREFIX + parameterName + PARAM_OPERATORS_GROUPING_REGEXP_SUFFIX);
56
+ };
57
+ exports.getParameterOperatorsGroupingRegexp = getParameterOperatorsGroupingRegexp;
58
+ exports.CAPTURE_REGEX = /(([^\\]\(|^\().*[^\\]\))/;
59
+ exports.PARAM_USAGE_REGEXP = /\$\{(.+)\}/;
60
+ exports.SIGNLE_PARAM_USAGE_REGEXP = /^\${\w+}$/;
61
+ exports.CAPTURE_ALL_REGEX = /(.*)/;
62
+ function isCaptureAllRegExp(regexp) {
63
+ return String(exports.CAPTURE_ALL_REGEX) === String(regexp);
64
+ }
65
+ exports.isCaptureAllRegExp = isCaptureAllRegExp;
66
+ var CSRF_REGEXP_PREFIX = '[^"\',;=:{\\s]*?[cCxX](?:srf|SRF)[^\'" =:]*?';
67
+ exports.CSRF_REGEXP_SUFFIX = ' *\\\\?["\']?(?:=|:) *\\\\?["\']([^\'"]+?)\\\\?["\']';
68
+ exports.CSRF_REGEXP = CSRF_REGEXP_PREFIX + exports.CSRF_REGEXP_SUFFIX;
69
+ exports.CONTAINS_APP_JSON_REGEXP = /application\/(.*)json/;
70
+ //# sourceMappingURL=parameter-regex-providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameter-regex-providers.js","sourceRoot":"","sources":["../../src/parameters/parameter-regex-providers.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAExC;IACE,8BAAoB,MAAc;QAAlC,iBAAsC;;;;;mBAAlB;;QAEpB;;;;mBAAM,UAAC,QAAQ;gBACb,KAAI,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;gBAC1B,OAAO,QAAQ,CAAC,KAAI,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;WAAC;IALmC,CAAC;IAMxC,2BAAC;AAAD,CAAC,AAPD,IAOC;AAED,IAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,IAAM,OAAO,GAAG,oBAAoB,CAAC;AAExB,QAAA,iBAAiB,GAAG,YAAY,CAAC;AAC9C,IAAM,SAAS,GAAG,eAAe,GAAG,yBAAiB,GAAG,KAAK,CAAC;AAC9D,IAAM,oBAAoB,GAAG,QAAM,SAAS,SAAI,OAAO,MAAG,CAAC;AAE3D,IAAM,UAAU,GAAG,QAAM,OAAO,eAAU,SAAS,iBAAY,oBAAoB,YAAO,oBAAoB,iBAAc,CAAC;AAE7H,IAAM,QAAQ,GACZ,KAAK,GAAG,MAAM,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4BAA8B,CACjF;AAFD,CAEC,CAAC;AAHS,QAAA,kCAAkC,sCAG3C;AAEG,IAAM,mCAAmC,GAAG,UAAC,aAAa;IAC/D,OAAA,IAAI,MAAM,CACR,KAAG,sCAAsC,GAAG,aAAa,GAAG,sCAAwC,CACrG;AAFD,CAEC,CAAC;AAHS,QAAA,mCAAmC,uCAG5C;AAES,QAAA,aAAa,GAAG,0BAA0B,CAAC;AAE3C,QAAA,kBAAkB,GAAG,YAAY,CAAC;AAElC,QAAA,yBAAyB,GAAG,WAAW,CAAC;AAExC,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAExC,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,yBAAiB,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC;AAFD,gDAEC;AAED,IAAM,kBAAkB,GAAG,8CAA8C,CAAC;AAC7D,QAAA,kBAAkB,GAAG,sDAAsD,CAAC;AAC5E,QAAA,WAAW,GAAG,kBAAkB,GAAG,0BAAkB,CAAC;AAEtD,QAAA,wBAAwB,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function resolveRandomParameter(parameterName: string): any;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveRandomParameter = void 0;
4
+ var generate_random_1 = require("../generate-random");
5
+ function resolveRandomParameter(parameterName) {
6
+ if (parameterName.startsWith('__random_')) {
7
+ var _a = parameterName.split('_'), kind = _a[3], arg1 = _a[4], arg2 = _a[5];
8
+ return generate_random_1.generateRandom(kind, arg1, arg2);
9
+ }
10
+ }
11
+ exports.resolveRandomParameter = resolveRandomParameter;
12
+ //# sourceMappingURL=random-parameters-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-parameters-resolver.js","sourceRoot":"","sources":["../../../src/parameters/resolvers/random-parameters-resolver.ts"],"names":[],"mappings":";;;AAAA,sDAAoD;AAEpD,SAAgB,sBAAsB,CAAC,aAAqB;IAC1D,IAAI,aAAa,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QACnC,IAAA,KAA2B,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,EAA5C,IAAI,QAAA,EAAE,IAAI,QAAA,EAAE,IAAI,QAA4B,CAAC;QAC1D,OAAO,gCAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KACzC;AACH,CAAC;AALD,wDAKC"}
@@ -0,0 +1,10 @@
1
+ export declare type Parameters = {
2
+ [name: string]: string | string[];
3
+ };
4
+ export declare type SequenceExecutorParameters = {
5
+ [name: string]: any;
6
+ };
7
+ export declare enum ParametersScope {
8
+ SUITE = "SUITE",
9
+ FLOW = "FLOW"
10
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParametersScope = void 0;
4
+ var ParametersScope;
5
+ (function (ParametersScope) {
6
+ ParametersScope["SUITE"] = "SUITE";
7
+ ParametersScope["FLOW"] = "FLOW";
8
+ })(ParametersScope = exports.ParametersScope || (exports.ParametersScope = {}));
9
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/parameters/type.ts"],"names":[],"mappings":";;;AAGA,IAAY,eAGT;AAHH,WAAY,eAAe;IACvB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EAHS,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAGxB"}
@@ -0,0 +1,5 @@
1
+ export declare const RANDOM_SELECT_OPT = "random";
2
+ export declare function isTruthyParameterValue(value: any): boolean;
3
+ export declare function isFalsyParameterValue(value?: string | boolean): boolean;
4
+ export declare function pickRandom(array: any[]): any;
5
+ export declare function parameterValueToNumber(value?: string | null, options?: any): number | null;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parameterValueToNumber = exports.pickRandom = exports.isFalsyParameterValue = exports.isTruthyParameterValue = exports.RANDOM_SELECT_OPT = void 0;
4
+ var random = require("lodash/random");
5
+ exports.RANDOM_SELECT_OPT = 'random';
6
+ var FALSY_AS_LOWERCASE_STRINGS = ['undefined', 'null', 'false', 'nan'];
7
+ function isTruthyParameterValue(value) {
8
+ if (value && typeof value === 'string') {
9
+ var str = value.toLowerCase();
10
+ return !FALSY_AS_LOWERCASE_STRINGS.includes(str);
11
+ }
12
+ return !!value;
13
+ }
14
+ exports.isTruthyParameterValue = isTruthyParameterValue;
15
+ function isFalsyParameterValue(value) {
16
+ return (value == null ||
17
+ value === false ||
18
+ (typeof value === 'string' && value.toLowerCase() === 'false') ||
19
+ value === '');
20
+ }
21
+ exports.isFalsyParameterValue = isFalsyParameterValue;
22
+ function pickRandom(array) {
23
+ return array[random(0, array.length - 1)];
24
+ }
25
+ exports.pickRandom = pickRandom;
26
+ function parameterValueToNumber(value, options) {
27
+ if (value == null || value === '') {
28
+ return null;
29
+ }
30
+ var numeric = Number(value);
31
+ if (Number.isFinite(numeric)) {
32
+ if (options &&
33
+ ((options.integer && !Number.isSafeInteger(numeric)) ||
34
+ (options.nonNegative && numeric < 0))) {
35
+ return null;
36
+ }
37
+ return numeric;
38
+ }
39
+ else {
40
+ return null;
41
+ }
42
+ }
43
+ exports.parameterValueToNumber = parameterValueToNumber;
44
+ //# sourceMappingURL=value-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-utils.js","sourceRoot":"","sources":["../../src/parameters/value-utils.ts"],"names":[],"mappings":";;;AAAA,sCAAyC;AAE5B,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,IAAM,0BAA0B,GAAG,CAAC,WAAW,EAAC,MAAM,EAAC,OAAO,EAAC,KAAK,CAAC,CAAC;AAEtE,SAAgB,sBAAsB,CAAC,KAAU;IAC/C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,IAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAChC,OAAO,CAAC,0BAA0B,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;KAClD;IACD,OAAO,CAAC,CAAC,KAAK,CAAC;AACjB,CAAC;AAND,wDAMC;AAED,SAAgB,qBAAqB,CAAC,KAAwB;IAC5D,OAAO,CACL,KAAK,IAAI,IAAI;QACb,KAAK,KAAK,KAAK;QACf,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;QAC9D,KAAK,KAAK,EAAE,CACb,CAAC;AACJ,CAAC;AAPD,sDAOC;AAED,SAAgB,UAAU,CAAC,KAAY;IACrC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAFD,gCAEC;AAED,SAAgB,sBAAsB,CAAC,KAAqB,EAAE,OAAQ;IACpE,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE;QACjC,OAAO,IAAI,CAAC;KACb;IAED,IAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9B,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC5B,IACE,OAAO;YACP,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAClD,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,EACvC;YACA,OAAO,IAAI,CAAC;SACb;QACD,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAnBD,wDAmBC"}
@@ -0,0 +1,265 @@
1
+ import { Parameters } from '../parameters';
2
+ export declare const DEFAULT_REQUEST_TIMEOUT = 25000;
3
+ export declare const supportedMethods: {
4
+ GET: string;
5
+ POST: string;
6
+ PUT: string;
7
+ DELETE: string;
8
+ PATCH: string;
9
+ };
10
+ export declare const ALLOWED_RESPONSE_STATUSES: {
11
+ SUCCESS: string;
12
+ ERROR: string;
13
+ ANY: string;
14
+ };
15
+ export declare type HttpMethod = keyof typeof supportedMethods;
16
+ export declare type HttpResponseStatus = keyof typeof ALLOWED_RESPONSE_STATUSES;
17
+ /**
18
+ * This class represents an HTTP request to be performed in the course of a load test.
19
+ *
20
+ * @property url The URL of the request (parameterizable).
21
+ * @property method The HTTP method.
22
+ * @property headers An array of headers to add to the request (values parameterizable).
23
+ * @property postData The content of the request (text parameterizable).
24
+ * @property delay The delay between this request and the previous one in milliseconds. This property is ignored for the first request.
25
+ * @property timeout The time to wait for the request to finish in milliseconds.
26
+ * @property extract A dictionary of parameter extractions.
27
+ * @property assert An array or dictionary of assertions.
28
+ * @property expectedStatus The expected status of the http response SUCCESS for 2XX-3XX, ERROR for 4XX-5XX.
29
+ */
30
+ export declare enum RequestType {
31
+ LOGIN = "login",
32
+ BEFORE_EACH = "beforeEach",
33
+ FLOW = "flow",
34
+ AFTER_EACH = "afterEach",
35
+ FINF = "flowInFlow",
36
+ BEFORE_ALL = "beforeAll",
37
+ AFTER_ALL = "afterAll"
38
+ }
39
+ export declare class LoadmillRequest implements RequestLike {
40
+ url: string;
41
+ id?: string;
42
+ auth?: AuthConf;
43
+ stopBefore?: string;
44
+ skipBefore?: SkipConf;
45
+ loop?: LoopConf;
46
+ useCookies?: boolean;
47
+ description?: string;
48
+ delay?: number | string;
49
+ postData?: RequestPostData;
50
+ postFormData?: PostFormData;
51
+ graphqlPostData?: GraphqlPostData;
52
+ file?: RequestRawFileData;
53
+ grpc?: GRPC;
54
+ cachePenetration?: CachePenetration;
55
+ method: HttpMethod;
56
+ headers?: LoadmillHeaders[];
57
+ assert?: Assertions;
58
+ extract?: Extractions[];
59
+ postScript?: string;
60
+ disabled?: boolean;
61
+ timeout?: number;
62
+ expectedStatus?: HttpResponseStatus;
63
+ noRedirects?: boolean;
64
+ meta?: RequestMeta;
65
+ constructor(url: string);
66
+ }
67
+ export declare class LoadmillOrFinfRequest extends LoadmillRequest {
68
+ isFinfRequest?: boolean;
69
+ }
70
+ export declare function resolveUrl(url: string, parameters: Parameters | Parameters[], onError?: any): string;
71
+ /**
72
+ * This function should be able to take any object/json and either make a VALID LoadmillRequest out of it
73
+ * or fail with a meaningful error message.
74
+ */
75
+ export declare function createRequest(from: RequestLike): LoadmillRequest;
76
+ export declare function toHeaders(headers: LoadmillHeaders | LoadmillHeaders[]): LoadmillHeaders[];
77
+ export declare function findRequestIndex(requests: RequestLike[], desc: string): number;
78
+ export declare function isReservedHeader(lowerName: string): boolean;
79
+ export interface RequestLike {
80
+ id?: string;
81
+ url: string;
82
+ auth?: AuthConf;
83
+ stopBefore?: string;
84
+ skipBefore?: SkipConf;
85
+ loop?: LoopConf;
86
+ timeout?: number;
87
+ assert?: Assertions;
88
+ method?: HttpMethod;
89
+ description?: string;
90
+ delay?: number | string;
91
+ postData?: RequestPostData;
92
+ postFormData?: PostFormData;
93
+ graphqlPostData?: GraphqlPostData;
94
+ file?: RequestRawFileData;
95
+ grpc?: GRPC;
96
+ extract?: Extractions | Extractions[];
97
+ headers?: LoadmillHeaders | LoadmillHeaders[];
98
+ expectedStatus?: HttpResponseStatus;
99
+ parameters?: any;
100
+ postScript?: string;
101
+ disabled?: boolean;
102
+ noRedirects?: boolean;
103
+ meta?: RequestMeta;
104
+ }
105
+ export declare type SkipConf = {
106
+ condition: string;
107
+ negate?: boolean;
108
+ goTo?: string;
109
+ };
110
+ export declare type LoopConf = {
111
+ assert: Assertion;
112
+ iterations: number;
113
+ wait?: number;
114
+ };
115
+ export declare type RequestMeta = {
116
+ type: RequestType;
117
+ location?: {
118
+ index: number;
119
+ order: number;
120
+ };
121
+ };
122
+ export declare type RequestPostData = {
123
+ mimeType?: string;
124
+ text: string;
125
+ params?: ParamsEntry[];
126
+ };
127
+ export declare type ParamsEntry = {
128
+ name: string;
129
+ value: string;
130
+ };
131
+ export declare type PostFormData = PostFormDataEntry[];
132
+ export declare type PostFormDataEntry = {
133
+ name: string;
134
+ value: string;
135
+ fileName?: string;
136
+ contentType?: string;
137
+ };
138
+ export declare type GraphqlPostData = {
139
+ query?: string;
140
+ operationName?: string;
141
+ variables?: string;
142
+ };
143
+ export declare type RequestRawFileData = {
144
+ name: string;
145
+ key: string;
146
+ signedUrl?: string;
147
+ };
148
+ export declare enum BodyTypes {
149
+ POST_DATA = "postData",
150
+ URLENCODED = "urlencoded",
151
+ FORM_DATA = "postFormData",
152
+ RAW_FILE = "rawFile",
153
+ GRAPHQL = "GraphQL"
154
+ }
155
+ export declare type GRPC = {
156
+ service: string;
157
+ method: string;
158
+ message: string;
159
+ };
160
+ export declare type LoadmillHeaders = {
161
+ [headerName: string]: string;
162
+ };
163
+ export declare type Extractions = {
164
+ [parameter: string]: Extraction;
165
+ };
166
+ /**
167
+ * This object represents a parameter extraction.
168
+ *
169
+ * The jQuary expression is evaluated against the response body text using Cheerio.
170
+ * The jsonPath expression is evaluated against a superagent-like response object.
171
+ * The edn expression is evaluated against a superagent-like response object converted to JSON and then treated like jsonPath.
172
+ * If a regular expression is specified as well as a header, jQuery or jsonPath then the expression will be matched against the
173
+ * query result, otherwise it is evaluated against the response body text.
174
+ *
175
+ * It is invalid to submit an empty extraction or one with more than one non-regex query. If the extraction yields a
176
+ * `null` result, then the original parameter value will be retained, defaulting to an empty string.
177
+ *
178
+ * @property header A name of a header whose value will be extracted.
179
+ * @property jQuery A jQuery expression to be matched against the response body text.
180
+ * @property xPath An Xpath expression to be matched against the xml response body.
181
+ * @property jsonPath A jsonPath expression to be matched against the response object.
182
+ * @property edn A jsonPath expression (yes - jsonPath) to be matched against the EDN response object converted to JSON.
183
+ * @property regex A JavaScript regular expression with a capture term, to be matched against the response body text.
184
+ */
185
+ export declare type Extraction = string | ExtractionObj;
186
+ export declare type ExtractionObj = {
187
+ regex?: string;
188
+ header?: string;
189
+ jsonPath?: string;
190
+ edn?: string;
191
+ xPath?: string;
192
+ jQuery?: string | {
193
+ query: string;
194
+ attr?: string;
195
+ };
196
+ ws?: string;
197
+ };
198
+ export declare type Assertions = Assertion[];
199
+ /**
200
+ * This object represents an assertion.
201
+ *
202
+ * Assertions are made once the request has been fulfilled and all parameters have been extracted.
203
+ * All assertions are evaluated, even if some fail.
204
+ * If an assertion contains more then one conditions then the conditions are or-ed.
205
+ *
206
+ * @property check A parameter name to assert the given conditions on.
207
+ * @property equals A parametrized expression that asserts to true if its value is equal to `check`.
208
+ * @property contains A parametrized expression that asserts to true if its value is contained in `check`.
209
+ * @property matches A JavaScript regular expression that asserts to true if `check` matches it.
210
+ * @property falsy if true then A parametrized expression that asserts to true if the value of `check` equales false.
211
+ * @property greater A parametrized expression that asserts to true if its value is less to `check`.
212
+ * @property lesser A parametrized expression that asserts to true if its value is greater to `check`.
213
+ */
214
+ export interface Assertion {
215
+ check: string;
216
+ equals?: string;
217
+ notEquals?: string;
218
+ contains?: string;
219
+ notContains?: string;
220
+ matches?: string;
221
+ falsy?: string | boolean;
222
+ greater?: string;
223
+ lesser?: string;
224
+ JSONSchema?: string;
225
+ JSONContains?: string;
226
+ XMLContains?: string;
227
+ disabled?: true;
228
+ }
229
+ export interface AuthConf {
230
+ user?: string;
231
+ password?: string;
232
+ }
233
+ export interface CachePenetration {
234
+ cacheControl?: string;
235
+ mode?: CachePenetrationModes;
236
+ }
237
+ export declare enum CachePenetrationModes {
238
+ none = "none",
239
+ def = "default",
240
+ alwaysQuery = "always-query",
241
+ alwaysHeader = "always-header"
242
+ }
243
+ export declare const EXCLUDES: string[];
244
+ export declare const isWSRequest: (url: string) => boolean;
245
+ export declare const isHTTPRequest: (url: string) => boolean;
246
+ export declare const isGRPCRequest: (url: string) => boolean;
247
+ export declare const getResponseText: (content: {
248
+ text?: string;
249
+ encoding?: string;
250
+ }) => string | undefined;
251
+ export declare enum ConfMimeTypes {
252
+ TEXT_PLAIN = "text/plain",
253
+ APPLICATION_JSON = "application/json",
254
+ APPLICATION_JAVASCRIPT = "application/javascript",
255
+ APPLICATION_XML = "application/xml",
256
+ APPLICATION_EDN = "application/edn",
257
+ TEXT_XML = "text/xml",
258
+ TEXT_HTML = "text/html",
259
+ TEXT_CSS = "text/css",
260
+ APPLICATION_URLENCODED = "application/x-www-form-urlencoded"
261
+ }
262
+ export declare enum WsMessageType {
263
+ TEXT = "text",
264
+ BINARY = "binary"
265
+ }