@loadmill/core 0.3.138 → 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.
- package/package.json +2 -2
- package/dist/assertions/index.d.ts +0 -32
- package/dist/assertions/index.js +0 -52
- package/dist/assertions/index.js.map +0 -1
- package/dist/code-step/index.d.ts +0 -23
- package/dist/code-step/index.js +0 -97
- package/dist/code-step/index.js.map +0 -1
- package/dist/conf/defaults.d.ts +0 -1
- package/dist/conf/defaults.js +0 -11
- package/dist/conf/defaults.js.map +0 -1
- package/dist/conf/extrema.d.ts +0 -7
- package/dist/conf/extrema.js +0 -12
- package/dist/conf/extrema.js.map +0 -1
- package/dist/conf/index.d.ts +0 -15
- package/dist/conf/index.js +0 -80
- package/dist/conf/index.js.map +0 -1
- package/dist/conf/notifications.d.ts +0 -2
- package/dist/conf/notifications.js +0 -19
- package/dist/conf/notifications.js.map +0 -1
- package/dist/conf/types.d.ts +0 -122
- package/dist/conf/types.js +0 -38
- package/dist/conf/types.js.map +0 -1
- package/dist/conf/validate.d.ts +0 -69
- package/dist/conf/validate.js +0 -509
- package/dist/conf/validate.js.map +0 -1
- package/dist/distributed-logger-reporter.d.ts +0 -3
- package/dist/distributed-logger-reporter.js +0 -74
- package/dist/distributed-logger-reporter.js.map +0 -1
- package/dist/echo/firehose.d.ts +0 -7
- package/dist/echo/firehose.js +0 -130
- package/dist/echo/firehose.js.map +0 -1
- package/dist/echo/index.d.ts +0 -3
- package/dist/echo/index.js +0 -8
- package/dist/echo/index.js.map +0 -1
- package/dist/echo/stats.d.ts +0 -8
- package/dist/echo/stats.js +0 -152
- package/dist/echo/stats.js.map +0 -1
- package/dist/extract-and-assert-step/index.d.ts +0 -29
- package/dist/extract-and-assert-step/index.js +0 -108
- package/dist/extract-and-assert-step/index.js.map +0 -1
- package/dist/extractions/index.d.ts +0 -36
- package/dist/extractions/index.js +0 -49
- package/dist/extractions/index.js.map +0 -1
- package/dist/har/index.d.ts +0 -71
- package/dist/har/index.js +0 -61
- package/dist/har/index.js.map +0 -1
- package/dist/labels/constants.d.ts +0 -1
- package/dist/labels/constants.js +0 -5
- package/dist/labels/constants.js.map +0 -1
- package/dist/multipart-form-data/files.d.ts +0 -2
- package/dist/multipart-form-data/files.js +0 -63
- package/dist/multipart-form-data/files.js.map +0 -1
- package/dist/multipart-form-data/form-data-utils.d.ts +0 -19
- package/dist/multipart-form-data/form-data-utils.js +0 -117
- package/dist/multipart-form-data/form-data-utils.js.map +0 -1
- package/dist/multipart-form-data/is-binary-file.d.ts +0 -2
- package/dist/multipart-form-data/is-binary-file.js +0 -215
- package/dist/multipart-form-data/is-binary-file.js.map +0 -1
- package/dist/multipart-form-data/multipart-text-to-post-form-data.d.ts +0 -2
- package/dist/multipart-form-data/multipart-text-to-post-form-data.js +0 -86
- package/dist/multipart-form-data/multipart-text-to-post-form-data.js.map +0 -1
- package/dist/parameters/extractions.d.ts +0 -27
- package/dist/parameters/extractions.js +0 -51
- package/dist/parameters/extractions.js.map +0 -1
- package/dist/parameters/extractors/cheerio-extractor.d.ts +0 -11
- package/dist/parameters/extractors/cheerio-extractor.js +0 -84
- package/dist/parameters/extractors/cheerio-extractor.js.map +0 -1
- package/dist/parameters/extractors/expression-extractor.d.ts +0 -6
- package/dist/parameters/extractors/expression-extractor.js +0 -38
- package/dist/parameters/extractors/expression-extractor.js.map +0 -1
- package/dist/parameters/extractors/extractor.d.ts +0 -3
- package/dist/parameters/extractors/extractor.js +0 -3
- package/dist/parameters/extractors/extractor.js.map +0 -1
- package/dist/parameters/extractors/header-extractor.d.ts +0 -7
- package/dist/parameters/extractors/header-extractor.js +0 -51
- package/dist/parameters/extractors/header-extractor.js.map +0 -1
- package/dist/parameters/extractors/index.d.ts +0 -10
- package/dist/parameters/extractors/index.js +0 -20
- package/dist/parameters/extractors/index.js.map +0 -1
- package/dist/parameters/extractors/json-path-extractor.d.ts +0 -11
- package/dist/parameters/extractors/json-path-extractor.js +0 -127
- package/dist/parameters/extractors/json-path-extractor.js.map +0 -1
- package/dist/parameters/extractors/parametrized-extractor.d.ts +0 -10
- package/dist/parameters/extractors/parametrized-extractor.js +0 -34
- package/dist/parameters/extractors/parametrized-extractor.js.map +0 -1
- package/dist/parameters/extractors/regex-extractor.d.ts +0 -7
- package/dist/parameters/extractors/regex-extractor.js +0 -46
- package/dist/parameters/extractors/regex-extractor.js.map +0 -1
- package/dist/parameters/extractors/regex-matcher.d.ts +0 -1
- package/dist/parameters/extractors/regex-matcher.js +0 -22
- package/dist/parameters/extractors/regex-matcher.js.map +0 -1
- package/dist/parameters/extractors/ws-extractor.d.ts +0 -33
- package/dist/parameters/extractors/ws-extractor.js +0 -215
- package/dist/parameters/extractors/ws-extractor.js.map +0 -1
- package/dist/parameters/extractors/x-path-extractor.d.ts +0 -9
- package/dist/parameters/extractors/x-path-extractor.js +0 -77
- package/dist/parameters/extractors/x-path-extractor.js.map +0 -1
- package/dist/parameters/generate-random.d.ts +0 -13
- package/dist/parameters/generate-random.js +0 -108
- package/dist/parameters/generate-random.js.map +0 -1
- package/dist/parameters/html-utils.d.ts +0 -1
- package/dist/parameters/html-utils.js +0 -18
- package/dist/parameters/html-utils.js.map +0 -1
- package/dist/parameters/index.d.ts +0 -93
- package/dist/parameters/index.js +0 -619
- package/dist/parameters/index.js.map +0 -1
- package/dist/parameters/json-path-utils.d.ts +0 -1
- package/dist/parameters/json-path-utils.js +0 -16
- package/dist/parameters/json-path-utils.js.map +0 -1
- package/dist/parameters/operators/binary-operator.d.ts +0 -13
- package/dist/parameters/operators/binary-operator.js +0 -39
- package/dist/parameters/operators/binary-operator.js.map +0 -1
- package/dist/parameters/operators/index.d.ts +0 -5
- package/dist/parameters/operators/index.js +0 -21
- package/dist/parameters/operators/index.js.map +0 -1
- package/dist/parameters/parameter-functions/aws-cognito.d.ts +0 -3
- package/dist/parameters/parameter-functions/aws-cognito.js +0 -119
- package/dist/parameters/parameter-functions/aws-cognito.js.map +0 -1
- package/dist/parameters/parameter-functions/boolean-parameter-functions.d.ts +0 -12
- package/dist/parameters/parameter-functions/boolean-parameter-functions.js +0 -47
- package/dist/parameters/parameter-functions/boolean-parameter-functions.js.map +0 -1
- package/dist/parameters/parameter-functions/crypto.d.ts +0 -11
- package/dist/parameters/parameter-functions/crypto.js +0 -71
- package/dist/parameters/parameter-functions/crypto.js.map +0 -1
- package/dist/parameters/parameter-functions/json-schema.d.ts +0 -1
- package/dist/parameters/parameter-functions/json-schema.js +0 -33
- package/dist/parameters/parameter-functions/json-schema.js.map +0 -1
- package/dist/parameters/parameter-functions/numeric-input-parameter-functions.d.ts +0 -11
- package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js +0 -34
- package/dist/parameters/parameter-functions/numeric-input-parameter-functions.js.map +0 -1
- package/dist/parameters/parameter-functions/numeric-parameter-functions.d.ts +0 -15
- package/dist/parameters/parameter-functions/numeric-parameter-functions.js +0 -56
- package/dist/parameters/parameter-functions/numeric-parameter-functions.js.map +0 -1
- package/dist/parameters/parameter-functions/parameter-function-utils.d.ts +0 -5
- package/dist/parameters/parameter-functions/parameter-function-utils.js +0 -82
- package/dist/parameters/parameter-functions/parameter-function-utils.js.map +0 -1
- package/dist/parameters/parameter-functions/parameter-function.d.ts +0 -6
- package/dist/parameters/parameter-functions/parameter-function.js +0 -28
- package/dist/parameters/parameter-functions/parameter-function.js.map +0 -1
- package/dist/parameters/parameter-functions/parameter-functions.d.ts +0 -7
- package/dist/parameters/parameter-functions/parameter-functions.js +0 -53
- package/dist/parameters/parameter-functions/parameter-functions.js.map +0 -1
- package/dist/parameters/parameter-functions/random-parameter-functions.d.ts +0 -1
- package/dist/parameters/parameter-functions/random-parameter-functions.js +0 -43
- package/dist/parameters/parameter-functions/random-parameter-functions.js.map +0 -1
- package/dist/parameters/parameter-functions/textual-parameter-functions.d.ts +0 -72
- package/dist/parameters/parameter-functions/textual-parameter-functions.js +0 -389
- package/dist/parameters/parameter-functions/textual-parameter-functions.js.map +0 -1
- package/dist/parameters/parameter-name-utils.d.ts +0 -5
- package/dist/parameters/parameter-name-utils.js +0 -123
- package/dist/parameters/parameter-name-utils.js.map +0 -1
- package/dist/parameters/parameter-regex-providers.d.ts +0 -24
- package/dist/parameters/parameter-regex-providers.js +0 -70
- package/dist/parameters/parameter-regex-providers.js.map +0 -1
- package/dist/parameters/resolvers/random-parameters-resolver.d.ts +0 -1
- package/dist/parameters/resolvers/random-parameters-resolver.js +0 -12
- package/dist/parameters/resolvers/random-parameters-resolver.js.map +0 -1
- package/dist/parameters/type.d.ts +0 -10
- package/dist/parameters/type.js +0 -9
- package/dist/parameters/type.js.map +0 -1
- package/dist/parameters/value-utils.d.ts +0 -5
- package/dist/parameters/value-utils.js +0 -44
- package/dist/parameters/value-utils.js.map +0 -1
- package/dist/request/index.d.ts +0 -174
- package/dist/request/index.js +0 -356
- package/dist/request/index.js.map +0 -1
- package/dist/schema/json-schema-generator.d.ts +0 -20
- package/dist/schema/json-schema-generator.js +0 -135
- package/dist/schema/json-schema-generator.js.map +0 -1
- package/dist/signals.d.ts +0 -4
- package/dist/signals.js +0 -9
- package/dist/signals.js.map +0 -1
- package/dist/socket-events/index.d.ts +0 -13
- package/dist/socket-events/index.js +0 -17
- package/dist/socket-events/index.js.map +0 -1
- package/dist/step/assertable.d.ts +0 -4
- package/dist/step/assertable.js +0 -3
- package/dist/step/assertable.js.map +0 -1
- package/dist/step/codeable.d.ts +0 -3
- package/dist/step/codeable.js +0 -3
- package/dist/step/codeable.js.map +0 -1
- package/dist/step/extractable.d.ts +0 -4
- package/dist/step/extractable.js +0 -3
- package/dist/step/extractable.js.map +0 -1
- package/dist/step/index.d.ts +0 -72
- package/dist/step/index.js +0 -71
- package/dist/step/index.js.map +0 -1
- package/dist/step/step-type.d.ts +0 -4
- package/dist/step/step-type.js +0 -3
- package/dist/step/step-type.js.map +0 -1
- package/dist/step/type-guards.d.ts +0 -7
- package/dist/step/type-guards.js +0 -18
- package/dist/step/type-guards.js.map +0 -1
- package/dist/subset/index.d.ts +0 -3
- package/dist/subset/index.js +0 -8
- package/dist/subset/index.js.map +0 -1
- package/dist/subset/is-subset.d.ts +0 -2
- package/dist/subset/is-subset.js +0 -29
- package/dist/subset/is-subset.js.map +0 -1
- package/dist/subset/json-contains.d.ts +0 -1
- package/dist/subset/json-contains.js +0 -24
- package/dist/subset/json-contains.js.map +0 -1
- package/dist/team-options/constants.d.ts +0 -3
- package/dist/team-options/constants.js +0 -7
- package/dist/team-options/constants.js.map +0 -1
- package/dist/xml/decode.d.ts +0 -2
- package/dist/xml/decode.js +0 -91
- package/dist/xml/decode.js.map +0 -1
- package/dist/xml/encode.d.ts +0 -1
- package/dist/xml/encode.js +0 -14
- package/dist/xml/encode.js.map +0 -1
- package/dist/xml/escape-reserved-chars.d.ts +0 -6
- package/dist/xml/escape-reserved-chars.js +0 -57
- package/dist/xml/escape-reserved-chars.js.map +0 -1
- package/dist/xml/is-xml.d.ts +0 -1
- package/dist/xml/is-xml.js +0 -9
- package/dist/xml/is-xml.js.map +0 -1
- package/dist/xml/json-to-xml.d.ts +0 -2
- package/dist/xml/json-to-xml.js +0 -11
- package/dist/xml/json-to-xml.js.map +0 -1
- package/dist/xml/namespaces.d.ts +0 -7
- package/dist/xml/namespaces.js +0 -16
- package/dist/xml/namespaces.js.map +0 -1
- package/dist/xml/remove-invisible-chars.d.ts +0 -2
- package/dist/xml/remove-invisible-chars.js +0 -13
- package/dist/xml/remove-invisible-chars.js.map +0 -1
- package/dist/xml/replace-s-tags.d.ts +0 -4
- package/dist/xml/replace-s-tags.js +0 -21
- package/dist/xml/replace-s-tags.js.map +0 -1
- package/dist/xml/xml-to-json.d.ts +0 -7
- package/dist/xml/xml-to-json.js +0 -21
- package/dist/xml/xml-to-json.js.map +0 -1
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requestsExtractionsArr = exports.getExtractionParts = void 0;
|
|
4
|
-
var _1 = require(".");
|
|
5
|
-
var getParameterName = _1.parameterUtils.getParameterName;
|
|
6
|
-
/**
|
|
7
|
-
* Gets an extractions instance which looks like this: { [paramName]: string }.
|
|
8
|
-
*
|
|
9
|
-
* If it's an assign extraction, i.e { [paramName]: string }
|
|
10
|
-
* OR { [paramName]: { jsonPath/jQuery/...: string } }
|
|
11
|
-
* OR { [paramName]: { jQuery: { query: string, attr?: string } } }}}
|
|
12
|
-
* And spreads this object into its parts.
|
|
13
|
-
*
|
|
14
|
-
* Example:
|
|
15
|
-
* input ext = { my_ext: { jsonPath: '$["users"][0]["id"]' } }
|
|
16
|
-
* output = { name: 'my_ext', value: '$["users"][0]["name"]', type: 'jsonPath' }
|
|
17
|
-
*
|
|
18
|
-
* @param ext The extraction object to take a part
|
|
19
|
-
* @returns The spreaded parts of the given extraction object
|
|
20
|
-
*/
|
|
21
|
-
function getExtractionParts(ext) {
|
|
22
|
-
var name = getParameterName(ext);
|
|
23
|
-
var extContent = ext[name];
|
|
24
|
-
if (typeof extContent === 'string') {
|
|
25
|
-
return { name: name, value: extContent };
|
|
26
|
-
}
|
|
27
|
-
var type = Object.keys(extContent)[0];
|
|
28
|
-
var value = ext[name][type];
|
|
29
|
-
return { name: name, value: value, type: type };
|
|
30
|
-
}
|
|
31
|
-
exports.getExtractionParts = getExtractionParts;
|
|
32
|
-
function requestsExtractionsArr(steps, toIndex) {
|
|
33
|
-
var _a;
|
|
34
|
-
var extractionParamNames = [];
|
|
35
|
-
for (var i = 0; i <= toIndex; i++) {
|
|
36
|
-
var step = steps[i];
|
|
37
|
-
if ((_a = step) === null || _a === void 0 ? void 0 : _a.extract) {
|
|
38
|
-
var extractions = step.extract || [];
|
|
39
|
-
for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) {
|
|
40
|
-
var param = extractions_1[_i];
|
|
41
|
-
var paramName = Object.keys(param)[0];
|
|
42
|
-
if (paramName && extractionParamNames.indexOf(paramName) < 0) {
|
|
43
|
-
extractionParamNames.push(paramName);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return extractionParamNames;
|
|
49
|
-
}
|
|
50
|
-
exports.requestsExtractionsArr = requestsExtractionsArr;
|
|
51
|
-
//# sourceMappingURL=extractions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractions.js","sourceRoot":"","sources":["../../src/parameters/extractions.ts"],"names":[],"mappings":";;;AAIA,sBAAmC;AAC3B,IAAA,gBAAgB,GAAK,iBAAc,iBAAnB,CAAoB;AAE5C;;;;;;;;;;;;;;GAcG;AACH,SAAgB,kBAAkB,CAAC,GAAgB;IACjD,IAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACnC,IAAM,UAAU,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,OAAO,EAAE,IAAI,MAAA,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;KACpC;IACM,IAAA,IAAI,GAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAA3B,CAA4B;IACvC,IAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,IAAI,MAAA,EAAE,CAAC;AAC/B,CAAC;AATD,gDASC;AAWD,SAAgB,sBAAsB,CAAC,KAAa,EAAE,OAAe;;IACnE,IAAM,oBAAoB,GAAG,EAAc,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE;QACjC,IAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,MAAC,IAAoB,0CAAE,OAAO,EAAE;YAClC,IAAM,WAAW,GAAI,IAAoB,CAAC,OAAO,IAAI,EAAE,CAAC;YACxD,KAAoB,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,EAAE;gBAA5B,IAAM,KAAK,oBAAA;gBACd,IAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxC,IAAI,SAAS,IAAI,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;oBAC5D,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBACtC;aACF;SACF;KACF;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAfD,wDAeC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Parameters } from '../type';
|
|
2
|
-
import { ParametrizedExtractor } from './parametrized-extractor';
|
|
3
|
-
export declare class CheerioExtractor extends ParametrizedExtractor {
|
|
4
|
-
private $;
|
|
5
|
-
constructor(target: any, parameters: Parameters, options?: CheerioOptions);
|
|
6
|
-
extractResolved: (resolvedJQuery: string, selection?: string, resolvedAttrName?: string | undefined) => any;
|
|
7
|
-
}
|
|
8
|
-
declare type CheerioOptions = {
|
|
9
|
-
xmlMode?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CheerioExtractor = void 0;
|
|
22
|
-
var cheerio_1 = __importDefault(require("cheerio"));
|
|
23
|
-
var random = require("lodash/random");
|
|
24
|
-
var value_utils_1 = require("../value-utils");
|
|
25
|
-
var parametrized_extractor_1 = require("./parametrized-extractor");
|
|
26
|
-
var errors_1 = require("@loadmill/universal/dist/errors");
|
|
27
|
-
var CheerioExtractor = /** @class */ (function (_super) {
|
|
28
|
-
__extends(CheerioExtractor, _super);
|
|
29
|
-
function CheerioExtractor(target, parameters, options) {
|
|
30
|
-
if (options === void 0) { options = {}; }
|
|
31
|
-
var _this = _super.call(this, parameters) || this;
|
|
32
|
-
Object.defineProperty(_this, "$", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: void 0
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(_this, "extractResolved", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: function (resolvedJQuery, selection, resolvedAttrName) {
|
|
43
|
-
if (selection === void 0) { selection = '0'; }
|
|
44
|
-
var jQueryResult;
|
|
45
|
-
var matched = _this.$(resolvedJQuery);
|
|
46
|
-
var numMatched = matched.length;
|
|
47
|
-
if (numMatched === 0) {
|
|
48
|
-
jQueryResult = null;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
var index = getIndex(selection, numMatched);
|
|
52
|
-
var element = matched.eq(index);
|
|
53
|
-
if (resolvedAttrName) {
|
|
54
|
-
var attr = element.attr(resolvedAttrName);
|
|
55
|
-
jQueryResult = attr != null ? attr.toString() : null;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
jQueryResult = element.html();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// log.debug('jQuery extraction:', { resolvedJQuery, jQueryResult });
|
|
62
|
-
return jQueryResult;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
_this.$ = cheerio_1.default.load(target, options);
|
|
66
|
-
return _this;
|
|
67
|
-
}
|
|
68
|
-
return CheerioExtractor;
|
|
69
|
-
}(parametrized_extractor_1.ParametrizedExtractor));
|
|
70
|
-
exports.CheerioExtractor = CheerioExtractor;
|
|
71
|
-
function getIndex(selection, len) {
|
|
72
|
-
var index;
|
|
73
|
-
if (selection === value_utils_1.RANDOM_SELECT_OPT) {
|
|
74
|
-
index = random(0, len - 1);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
index = value_utils_1.parameterValueToNumber(selection, { integer: true });
|
|
78
|
-
if (index == null) {
|
|
79
|
-
throw new errors_1.PresentableError('Invalid index: ' + selection);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return index;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=cheerio-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cheerio-extractor.js","sourceRoot":"","sources":["../../../src/parameters/extractors/cheerio-extractor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,oDAA8B;AAC9B,sCAAyC;AACzC,8CAA2E;AAE3E,mEAAiE;AACjE,0DAAmE;AAEnE;IAAsC,oCAAqB;IAGzD,0BAAY,MAAM,EAAE,UAAsB,EAAE,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;QAAxE,YACE,kBAAM,UAAU,CAAC,SAElB;QALD;;;;;WAAU;QAOV;;;;mBAAkB,UAChB,cAAsB,EACtB,SAAuB,EACvB,gBAAyB;gBADzB,0BAAA,EAAA,eAAuB;gBAGvB,IAAI,YAAY,CAAC;gBAEjB,IAAM,OAAO,GAAG,KAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;gBACvC,IAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;gBAElC,IAAI,UAAU,KAAK,CAAC,EAAE;oBACpB,YAAY,GAAG,IAAI,CAAC;iBACrB;qBAAM;oBACL,IAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;oBAC9C,IAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;oBAElC,IAAI,gBAAgB,EAAE;wBACpB,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBAC5C,YAAY,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;qBACtD;yBAAM;wBACL,YAAY,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;qBAC/B;iBACF;gBAED,qEAAqE;gBAErE,OAAO,YAAY,CAAC;YACtB,CAAC;WAAC;QA9BA,KAAI,CAAC,CAAC,GAAG,iBAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;IACzC,CAAC;IA8BH,uBAAC;AAAD,CAAC,AApCD,CAAsC,8CAAqB,GAoC1D;AApCY,4CAAgB;AAsC7B,SAAS,QAAQ,CAAC,SAAiB,EAAE,GAAG;IACtC,IAAI,KAAoB,CAAC;IACzB,IAAI,SAAS,KAAK,+BAAiB,EAAE;QACnC,KAAK,GAAG,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;KAC5B;SAAM;QACL,KAAK,GAAG,oCAAsB,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,MAAM,IAAI,yBAAgB,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;SAC3D;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Parameters } from '../type';
|
|
2
|
-
import { ParametrizedExtractor } from './parametrized-extractor';
|
|
3
|
-
export declare class ExpressionExtractor extends ParametrizedExtractor {
|
|
4
|
-
constructor(parameters: Parameters);
|
|
5
|
-
extractResolved: (resolvedQuery: string) => string;
|
|
6
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.ExpressionExtractor = void 0;
|
|
19
|
-
var parametrized_extractor_1 = require("./parametrized-extractor");
|
|
20
|
-
var ExpressionExtractor = /** @class */ (function (_super) {
|
|
21
|
-
__extends(ExpressionExtractor, _super);
|
|
22
|
-
function ExpressionExtractor(parameters) {
|
|
23
|
-
var _this = _super.call(this, parameters) || this;
|
|
24
|
-
Object.defineProperty(_this, "extractResolved", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: function (resolvedQuery) {
|
|
29
|
-
// log.debug('Expression extraction resolved:', resolvedQuery);
|
|
30
|
-
return resolvedQuery;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return _this;
|
|
34
|
-
}
|
|
35
|
-
return ExpressionExtractor;
|
|
36
|
-
}(parametrized_extractor_1.ParametrizedExtractor));
|
|
37
|
-
exports.ExpressionExtractor = ExpressionExtractor;
|
|
38
|
-
//# sourceMappingURL=expression-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"expression-extractor.js","sourceRoot":"","sources":["../../../src/parameters/extractors/expression-extractor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,mEAAiE;AAEjE;IAAyC,uCAAqB;IAC5D,6BAAY,UAAsB;QAAlC,YACE,kBAAM,UAAU,CAAC,SAClB;QAED;;;;mBAAkB,UAAC,aAAqB;gBACtC,+DAA+D;gBAC/D,OAAO,aAAa,CAAC;YACvB,CAAC;WAAC;;IALF,CAAC;IAMH,0BAAC;AAAD,CAAC,AATD,CAAyC,8CAAqB,GAS7D;AATY,kDAAmB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../../src/parameters/extractors/extractor.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Parameters } from '../type';
|
|
2
|
-
import { ParametrizedExtractor } from './parametrized-extractor';
|
|
3
|
-
export declare class HeaderExtractor extends ParametrizedExtractor {
|
|
4
|
-
private headers;
|
|
5
|
-
constructor(res: any, parameters: Parameters);
|
|
6
|
-
extractResolved: (headerName: string) => any;
|
|
7
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HeaderExtractor = void 0;
|
|
19
|
-
var parametrized_extractor_1 = require("./parametrized-extractor");
|
|
20
|
-
var HeaderExtractor = /** @class */ (function (_super) {
|
|
21
|
-
__extends(HeaderExtractor, _super);
|
|
22
|
-
function HeaderExtractor(res, parameters) {
|
|
23
|
-
var _this = _super.call(this, parameters) || this;
|
|
24
|
-
Object.defineProperty(_this, "headers", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: void 0
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(_this, "extractResolved", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: function (headerName) {
|
|
35
|
-
var lowerCaseHeaderName = headerName.toLowerCase();
|
|
36
|
-
var headerValue = _this.headers[lowerCaseHeaderName];
|
|
37
|
-
// some servers return more than one 'set-cookie' headers. For extractions we will merge them.
|
|
38
|
-
if (lowerCaseHeaderName === 'set-cookie' && Array.isArray(headerValue)) {
|
|
39
|
-
headerValue = headerValue.join('; ');
|
|
40
|
-
}
|
|
41
|
-
// log.debug('Header extraction:', { headerName, headerValue });
|
|
42
|
-
return headerValue;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
_this.headers = res.header;
|
|
46
|
-
return _this;
|
|
47
|
-
}
|
|
48
|
-
return HeaderExtractor;
|
|
49
|
-
}(parametrized_extractor_1.ParametrizedExtractor));
|
|
50
|
-
exports.HeaderExtractor = HeaderExtractor;
|
|
51
|
-
//# sourceMappingURL=header-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-extractor.js","sourceRoot":"","sources":["../../../src/parameters/extractors/header-extractor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,mEAAiE;AAEjE;IAAqC,mCAAqB;IAGxD,yBAAY,GAAG,EAAE,UAAsB;QAAvC,YACE,kBAAM,UAAU,CAAC,SAElB;QALD;;;;;WAAgB;QAOhB;;;;mBAAkB,UAAC,UAAkB;gBACnC,IAAM,mBAAmB,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;gBACrD,IAAI,WAAW,GAAG,KAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;gBAEpD,8FAA8F;gBAC9F,IAAI,mBAAmB,KAAK,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;oBACtE,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACtC;gBACD,gEAAgE;gBAEhE,OAAO,WAAW,CAAC;YACrB,CAAC;WAAC;QAdA,KAAI,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC;;IAC5B,CAAC;IAcH,sBAAC;AAAD,CAAC,AApBD,CAAqC,8CAAqB,GAoBzD;AApBY,0CAAe"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CheerioExtractor } from './cheerio-extractor';
|
|
2
|
-
import { ExpressionExtractor } from './expression-extractor';
|
|
3
|
-
import { Extractor } from './extractor';
|
|
4
|
-
import { HeaderExtractor } from './header-extractor';
|
|
5
|
-
import { JsonPathExtractor } from './json-path-extractor';
|
|
6
|
-
import { ParametrizedExtractor } from './parametrized-extractor';
|
|
7
|
-
import { RegexExtractor } from './regex-extractor';
|
|
8
|
-
import { WsExtractor } from './ws-extractor';
|
|
9
|
-
import { XPathExtractor } from './x-path-extractor';
|
|
10
|
-
export { CheerioExtractor, ExpressionExtractor, Extractor, HeaderExtractor, JsonPathExtractor, ParametrizedExtractor, RegexExtractor, WsExtractor, XPathExtractor };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.XPathExtractor = exports.WsExtractor = exports.RegexExtractor = exports.ParametrizedExtractor = exports.JsonPathExtractor = exports.HeaderExtractor = exports.ExpressionExtractor = exports.CheerioExtractor = void 0;
|
|
4
|
-
var cheerio_extractor_1 = require("./cheerio-extractor");
|
|
5
|
-
Object.defineProperty(exports, "CheerioExtractor", { enumerable: true, get: function () { return cheerio_extractor_1.CheerioExtractor; } });
|
|
6
|
-
var expression_extractor_1 = require("./expression-extractor");
|
|
7
|
-
Object.defineProperty(exports, "ExpressionExtractor", { enumerable: true, get: function () { return expression_extractor_1.ExpressionExtractor; } });
|
|
8
|
-
var header_extractor_1 = require("./header-extractor");
|
|
9
|
-
Object.defineProperty(exports, "HeaderExtractor", { enumerable: true, get: function () { return header_extractor_1.HeaderExtractor; } });
|
|
10
|
-
var json_path_extractor_1 = require("./json-path-extractor");
|
|
11
|
-
Object.defineProperty(exports, "JsonPathExtractor", { enumerable: true, get: function () { return json_path_extractor_1.JsonPathExtractor; } });
|
|
12
|
-
var parametrized_extractor_1 = require("./parametrized-extractor");
|
|
13
|
-
Object.defineProperty(exports, "ParametrizedExtractor", { enumerable: true, get: function () { return parametrized_extractor_1.ParametrizedExtractor; } });
|
|
14
|
-
var regex_extractor_1 = require("./regex-extractor");
|
|
15
|
-
Object.defineProperty(exports, "RegexExtractor", { enumerable: true, get: function () { return regex_extractor_1.RegexExtractor; } });
|
|
16
|
-
var ws_extractor_1 = require("./ws-extractor");
|
|
17
|
-
Object.defineProperty(exports, "WsExtractor", { enumerable: true, get: function () { return ws_extractor_1.WsExtractor; } });
|
|
18
|
-
var x_path_extractor_1 = require("./x-path-extractor");
|
|
19
|
-
Object.defineProperty(exports, "XPathExtractor", { enumerable: true, get: function () { return x_path_extractor_1.XPathExtractor; } });
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parameters/extractors/index.ts"],"names":[],"mappings":";;;AAAA,yDAAuD;AAU9C,iGAVA,oCAAgB,OAUA;AATzB,+DAA6D;AASlC,oGATlB,0CAAmB,OASkB;AAP9C,uDAAqD;AAOM,gGAPlD,kCAAe,OAOkD;AAN1E,6DAA0D;AAMkB,kGANnE,uCAAiB,OAMmE;AAL7F,mEAAiE;AAK8B,sGALtF,8CAAqB,OAKsF;AAJpH,qDAAmD;AAImE,+FAJ7G,gCAAc,OAI6G;AAHpI,+CAA6C;AAGyF,4FAH7H,0BAAW,OAG6H;AAFjJ,uDAAoD;AAE+F,+FAF1I,iCAAc,OAE0I"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Parameters } from '../type';
|
|
2
|
-
import { ParametrizedExtractor } from './parametrized-extractor';
|
|
3
|
-
export declare class JsonPathExtractor extends ParametrizedExtractor {
|
|
4
|
-
private obj;
|
|
5
|
-
private parseError?;
|
|
6
|
-
_validateObj: () => void;
|
|
7
|
-
_isHTML: (str: any) => boolean;
|
|
8
|
-
constructor(target: any, parameters: Parameters);
|
|
9
|
-
extractResolved: (jsonPath: string, full?: any) => any;
|
|
10
|
-
apply: (jsonPath: string, value: any) => string;
|
|
11
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.JsonPathExtractor = void 0;
|
|
22
|
-
var jsonpath_1 = __importDefault(require("jsonpath"));
|
|
23
|
-
var parametrized_extractor_1 = require("./parametrized-extractor");
|
|
24
|
-
var errors_1 = require("@loadmill/universal/dist/errors");
|
|
25
|
-
var log_1 = __importDefault(require("@loadmill/universal/dist/log"));
|
|
26
|
-
var JsonPathExtractor = /** @class */ (function (_super) {
|
|
27
|
-
__extends(JsonPathExtractor, _super);
|
|
28
|
-
function JsonPathExtractor(target, parameters) {
|
|
29
|
-
var _this = _super.call(this, parameters) || this;
|
|
30
|
-
Object.defineProperty(_this, "obj", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: void 0
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(_this, "parseError", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
configurable: true,
|
|
39
|
-
writable: true,
|
|
40
|
-
value: void 0
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(_this, "_validateObj", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
configurable: true,
|
|
45
|
-
writable: true,
|
|
46
|
-
value: function () {
|
|
47
|
-
var parseError = _this.parseError;
|
|
48
|
-
if (parseError) {
|
|
49
|
-
throw new errors_1.PresentableError(parseError);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(_this, "_isHTML", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true,
|
|
57
|
-
value: function (str) {
|
|
58
|
-
var pattern = /<[^>]+>/;
|
|
59
|
-
return pattern.test(str);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(_this, "extractResolved", {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
configurable: true,
|
|
65
|
-
writable: true,
|
|
66
|
-
value: function (jsonPath, full) {
|
|
67
|
-
_this._validateObj();
|
|
68
|
-
var jsonPathResult;
|
|
69
|
-
if (jsonPath === '$') {
|
|
70
|
-
jsonPathResult = _this.obj;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
jsonPathResult = jsonpath_1.default.query(_this.obj, jsonPath);
|
|
74
|
-
}
|
|
75
|
-
var res;
|
|
76
|
-
if (jsonPathResult != null) {
|
|
77
|
-
// jsonpath.query retuns an array of results so we axtract it.
|
|
78
|
-
// but if its $ we dont extract from the array since the user asked for the whole object.
|
|
79
|
-
if (!full && Array.isArray(jsonPathResult) && jsonPath !== '$') {
|
|
80
|
-
jsonPathResult = jsonPathResult[0];
|
|
81
|
-
}
|
|
82
|
-
if (jsonPathResult != null) {
|
|
83
|
-
res =
|
|
84
|
-
(typeof jsonPathResult === 'object'
|
|
85
|
-
? JSON.stringify(jsonPathResult)
|
|
86
|
-
: jsonPathResult.toString());
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return res;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
Object.defineProperty(_this, "apply", {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
configurable: true,
|
|
95
|
-
writable: true,
|
|
96
|
-
value: function (jsonPath, value) {
|
|
97
|
-
_this._validateObj();
|
|
98
|
-
log_1.default.debug('JSONPath parameter apply:', { jsonPath: jsonPath, value: value });
|
|
99
|
-
jsonpath_1.default.apply(_this.obj, jsonPath, function () {
|
|
100
|
-
try {
|
|
101
|
-
return JSON.parse(value);
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
return value;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
log_1.default.debug('JSONPath parameter apply result:', { obj: _this.obj });
|
|
108
|
-
return JSON.stringify(_this.obj);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
try {
|
|
112
|
-
_this.obj = JSON.parse(target);
|
|
113
|
-
}
|
|
114
|
-
catch (e) {
|
|
115
|
-
if (_this._isHTML(target)) {
|
|
116
|
-
_this.parseError = 'The response body looks like HTML and not JSON. Check if your authentication is configured correctly.';
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
_this.parseError = 'Response body is not a valid JSON: ' + e.message;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return _this;
|
|
123
|
-
}
|
|
124
|
-
return JsonPathExtractor;
|
|
125
|
-
}(parametrized_extractor_1.ParametrizedExtractor));
|
|
126
|
-
exports.JsonPathExtractor = JsonPathExtractor;
|
|
127
|
-
//# sourceMappingURL=json-path-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-path-extractor.js","sourceRoot":"","sources":["../../../src/parameters/extractors/json-path-extractor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,sDAAgC;AAEhC,mEAAiE;AACjE,0DAAmE;AACnE,qEAA+C;AAE/C;IAAuC,qCAAqB;IAgB1D,2BAAY,MAAM,EAAE,UAAsB;QAA1C,YACE,kBAAM,UAAU,CAAC,SAUlB;QA1BD;;;;;WAAY;QACZ;;;;;WAAoB;QAEpB;;;;mBAAe;gBACL,IAAA,UAAU,GAAK,KAAI,WAAT,CAAU;gBAC5B,IAAI,UAAU,EAAE;oBACd,MAAM,IAAI,yBAAgB,CAAC,UAAU,CAAC,CAAC;iBACxC;YACH,CAAC;WAAC;QAEF;;;;mBAAU,UAAC,GAAG;gBACZ,IAAM,OAAO,GAAG,SAAS,CAAC;gBAC1B,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;WAAC;QAeF;;;;mBAAkB,UAAC,QAAgB,EAAE,IAAK;gBAExC,KAAI,CAAC,YAAY,EAAE,CAAC;gBAEpB,IAAI,cAAc,CAAC;gBACnB,IAAI,QAAQ,KAAK,GAAG,EAAE;oBACpB,cAAc,GAAG,KAAI,CAAC,GAAG,CAAC;iBAC3B;qBACI;oBACH,cAAc,GAAG,kBAAQ,CAAC,KAAK,CAAC,KAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;iBACrD;gBAED,IAAI,GAAG,CAAC;gBAER,IAAI,cAAc,IAAI,IAAI,EAAE;oBAE1B,8DAA8D;oBAC9D,yFAAyF;oBACzF,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,QAAQ,KAAK,GAAG,EAAE;wBAC9D,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;qBACpC;oBAED,IAAI,cAAc,IAAI,IAAI,EAAE;wBAC1B,GAAG;4BACH,CAAE,OAAO,cAAc,KAAK,QAAQ;gCAClC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;gCAChC,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,CAC5B,CAAC;qBACH;iBACF;gBAED,OAAO,GAAG,CAAC;YACb,CAAC;WAAC;QAEF;;;;mBAAQ,UAAC,QAAgB,EAAE,KAAK;gBAC9B,KAAI,CAAC,YAAY,EAAE,CAAC;gBAEpB,aAAG,CAAC,KAAK,CAAC,2BAA2B,EAAE,EAAE,QAAQ,UAAA,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;gBAE5D,kBAAQ,CAAC,KAAK,CAAC,KAAI,CAAC,GAAG,EAAE,QAAQ,EAAE;oBACjC,IAAI;wBACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;qBAC1B;oBAAC,OAAO,KAAK,EAAE;wBACd,OAAO,KAAK,CAAC;qBACd;gBACH,CAAC,CAAC,CAAC;gBAEH,aAAG,CAAC,KAAK,CAAC,kCAAkC,EAAE,EAAE,GAAG,EAAE,KAAI,CAAC,GAAG,EAAE,CAAC,CAAC;gBAEjE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAI,CAAC,GAAG,CAAC,CAAC;YAClC,CAAC;WAAC;QA7DA,IAAI;YACF,KAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC/B;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACxB,KAAI,CAAC,UAAU,GAAG,uGAAuG,CAAC;aAC3H;iBAAM;gBACL,KAAI,CAAC,UAAU,GAAG,qCAAqC,GAAG,CAAC,CAAC,OAAO,CAAC;aACrE;SACF;;IACH,CAAC;IAqDH,wBAAC;AAAD,CAAC,AAhFD,CAAuC,8CAAqB,GAgF3D;AAhFY,8CAAiB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Extractor } from './extractor';
|
|
2
|
-
import { Parameters } from '../type';
|
|
3
|
-
export declare abstract class ParametrizedExtractor implements Extractor {
|
|
4
|
-
private parameters;
|
|
5
|
-
abstract extractResolved: ResolvedExtracter;
|
|
6
|
-
constructor(parameters: Parameters);
|
|
7
|
-
extract: (parametrizedQuery: string | string[]) => string | Promise<string | undefined> | undefined;
|
|
8
|
-
}
|
|
9
|
-
declare type ResolvedExtracter = ((...resolvedQuery: string[]) => string | undefined | Promise<string | undefined>);
|
|
10
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParametrizedExtractor = void 0;
|
|
4
|
-
var __1 = require("../");
|
|
5
|
-
var ParametrizedExtractor = /** @class */ (function () {
|
|
6
|
-
function ParametrizedExtractor(parameters) {
|
|
7
|
-
var _this = this;
|
|
8
|
-
Object.defineProperty(this, "parameters", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value: parameters
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(this, "extract", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: function (parametrizedQuery) {
|
|
19
|
-
if (!Array.isArray(parametrizedQuery)) {
|
|
20
|
-
parametrizedQuery = [parametrizedQuery];
|
|
21
|
-
}
|
|
22
|
-
var resolvedQuery = parametrizedQuery.map(function (q) { return q && __1.parameterUtils.resolveExpression(q, _this.parameters); });
|
|
23
|
-
/* log.debug('Parametrized query resolution:', {
|
|
24
|
-
parametrizedQuery,
|
|
25
|
-
resolvedQuery,
|
|
26
|
-
}); */
|
|
27
|
-
return _this.extractResolved.apply(_this, resolvedQuery);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return ParametrizedExtractor;
|
|
32
|
-
}());
|
|
33
|
-
exports.ParametrizedExtractor = ParametrizedExtractor;
|
|
34
|
-
//# sourceMappingURL=parametrized-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parametrized-extractor.js","sourceRoot":"","sources":["../../../src/parameters/extractors/parametrized-extractor.ts"],"names":[],"mappings":";;;AACA,yBAAqC;AAGrC;IAGE,+BAAoB,UAAsB;QAA1C,iBAA8C;;;;;mBAA1B;;QAEpB;;;;mBAAU,UAAC,iBAAoC;gBAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE;oBACrC,iBAAiB,GAAG,CAAC,iBAAiB,CAAC,CAAC;iBACzC;gBAED,IAAM,aAAa,GAAG,iBAAiB,CAAC,GAAG,CACzC,UAAC,CAAC,IAAK,OAAA,CAAC,IAAI,kBAAc,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAI,CAAC,UAAU,CAAC,EAAzD,CAAyD,CACjE,CAAC;gBACF;;;sBAGM;gBAEN,OAAO,KAAI,CAAC,eAAe,OAApB,KAAI,EAAoB,aAAa,EAAE;YAChD,CAAC;WAAC;IAhB2C,CAAC;IAiBhD,4BAAC;AAAD,CAAC,AApBD,IAoBC;AApBqB,sDAAqB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ParametrizedExtractor } from './parametrized-extractor';
|
|
2
|
-
import { Parameters } from '../type';
|
|
3
|
-
export declare class RegexExtractor extends ParametrizedExtractor {
|
|
4
|
-
private targetProvider;
|
|
5
|
-
constructor(targetProvider: () => string | undefined, parameters: Parameters);
|
|
6
|
-
extractResolved: (regex: string) => string | undefined;
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.RegexExtractor = void 0;
|
|
19
|
-
var parametrized_extractor_1 = require("./parametrized-extractor");
|
|
20
|
-
var regex_matcher_1 = require("./regex-matcher");
|
|
21
|
-
var RegexExtractor = /** @class */ (function (_super) {
|
|
22
|
-
__extends(RegexExtractor, _super);
|
|
23
|
-
function RegexExtractor(targetProvider, parameters) {
|
|
24
|
-
var _this = _super.call(this, parameters) || this;
|
|
25
|
-
Object.defineProperty(_this, "targetProvider", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: targetProvider
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(_this, "extractResolved", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: true,
|
|
34
|
-
writable: true,
|
|
35
|
-
value: function (regex) {
|
|
36
|
-
var target = _this.targetProvider() || '';
|
|
37
|
-
var regExp = new RegExp(regex);
|
|
38
|
-
return regex_matcher_1.matchRegex(regExp, target);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return _this;
|
|
42
|
-
}
|
|
43
|
-
return RegexExtractor;
|
|
44
|
-
}(parametrized_extractor_1.ParametrizedExtractor));
|
|
45
|
-
exports.RegexExtractor = RegexExtractor;
|
|
46
|
-
//# sourceMappingURL=regex-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regex-extractor.js","sourceRoot":"","sources":["../../../src/parameters/extractors/regex-extractor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,mEAAiE;AAEjE,iDAA6C;AAE7C;IAAoC,kCAAqB;IACvD,wBACU,cAAwC,EAChD,UAAsB;QAFxB,YAIE,kBAAM,UAAU,CAAC,SAClB;;;;;mBAJS;;QAMV;;;;mBAAkB,UAAC,KAAa;gBAC9B,IAAM,MAAM,GAAG,KAAI,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC;gBAC3C,IAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;gBACjC,OAAO,0BAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACpC,CAAC;WAAC;;IANF,CAAC;IAOH,qBAAC;AAAD,CAAC,AAbD,CAAoC,8CAAqB,GAaxD;AAbY,wCAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const matchRegex: (regExp: RegExp, target: string) => string | undefined;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.matchRegex = void 0;
|
|
7
|
-
var log_1 = __importDefault(require("@loadmill/universal/dist/log"));
|
|
8
|
-
var MAX_STR_LENGTH = 500;
|
|
9
|
-
var matchRegex = function (regExp, target) {
|
|
10
|
-
var matchArray = regExp.exec(target);
|
|
11
|
-
log_1.default.debug('Regex parameter extraction:', {
|
|
12
|
-
regExp: regExp === null || regExp === void 0 ? void 0 : regExp.toString(),
|
|
13
|
-
matchArray: matchArray,
|
|
14
|
-
type: typeof target,
|
|
15
|
-
target: typeof target === 'string' && target.substring(0, MAX_STR_LENGTH),
|
|
16
|
-
});
|
|
17
|
-
if (matchArray && matchArray[1]) {
|
|
18
|
-
return matchArray[1];
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
exports.matchRegex = matchRegex;
|
|
22
|
-
//# sourceMappingURL=regex-matcher.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regex-matcher.js","sourceRoot":"","sources":["../../../src/parameters/extractors/regex-matcher.ts"],"names":[],"mappings":";;;;;;AAAA,qEAA+C;AAE/C,IAAM,cAAc,GAAG,GAAG,CAAC;AAEpB,IAAM,UAAU,GAAG,UAAC,MAAc,EAAE,MAAc;IACvD,IAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEvC,aAAG,CAAC,KAAK,CAAC,6BAA6B,EAAE;QACvC,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,EAAE;QAC1B,UAAU,YAAA;QACV,IAAI,EAAE,OAAO,MAAM;QACnB,MAAM,EAAE,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC;KAC1E,CAAC,CAAC;IAEH,IAAI,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE;QAC/B,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;KACtB;AACH,CAAC,CAAC;AAbW,QAAA,UAAU,cAarB"}
|