@loadmill/core 0.3.49 → 0.3.52

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 (84) hide show
  1. package/dist/conf/extrema.d.ts +1 -1
  2. package/dist/conf/extrema.js +2 -2
  3. package/dist/conf/extrema.js.map +1 -1
  4. package/dist/conf/types.d.ts +12 -0
  5. package/dist/conf/validate.d.ts +2 -1
  6. package/dist/conf/validate.js +6 -1
  7. package/dist/conf/validate.js.map +1 -1
  8. package/dist/multipart-form-data/form-data-utils.js +2 -2
  9. package/dist/multipart-form-data/form-data-utils.js.map +1 -1
  10. package/dist/multipart-form-data/is-binary-file.d.ts +2 -0
  11. package/dist/multipart-form-data/is-binary-file.js +215 -0
  12. package/dist/multipart-form-data/is-binary-file.js.map +1 -0
  13. package/dist/multipart-form-data/multipart-text-to-post-form-data.d.ts +5 -1
  14. package/dist/multipart-form-data/multipart-text-to-post-form-data.js +96 -35
  15. package/dist/multipart-form-data/multipart-text-to-post-form-data.js.map +1 -1
  16. package/dist/parameters/extractions.d.ts +2 -1
  17. package/dist/parameters/extractions.js.map +1 -1
  18. package/dist/parameters/index.d.ts +1 -1
  19. package/dist/parameters/index.js +4 -0
  20. package/dist/parameters/index.js.map +1 -1
  21. package/dist/parameters/parameter-regex-providers.d.ts +2 -0
  22. package/dist/parameters/parameter-regex-providers.js +3 -1
  23. package/dist/parameters/parameter-regex-providers.js.map +1 -1
  24. package/dist/request/index.d.ts +1 -0
  25. package/dist/request/index.js +5 -5
  26. package/dist/request/index.js.map +1 -1
  27. package/package.json +7 -2
  28. package/src/conf/defaults.ts +0 -25
  29. package/src/conf/extrema.ts +0 -35
  30. package/src/conf/index.ts +0 -95
  31. package/src/conf/notifications.ts +0 -17
  32. package/src/conf/types.ts +0 -86
  33. package/src/conf/validate.ts +0 -548
  34. package/src/distributed-logger-reporter.ts +0 -19
  35. package/src/echo/firehose.ts +0 -64
  36. package/src/echo/index.ts +0 -4
  37. package/src/echo/stats.ts +0 -84
  38. package/src/har/index.ts +0 -81
  39. package/src/multipart-form-data/form-data-utils.ts +0 -81
  40. package/src/multipart-form-data/multipart-text-to-post-form-data.ts +0 -89
  41. package/src/parameters/extractions.ts +0 -51
  42. package/src/parameters/extractors/cheerio-extractor.ts +0 -57
  43. package/src/parameters/extractors/expression-extractor.ts +0 -13
  44. package/src/parameters/extractors/extractor.ts +0 -3
  45. package/src/parameters/extractors/header-extractor.ts +0 -24
  46. package/src/parameters/extractors/index.ts +0 -10
  47. package/src/parameters/extractors/json-path-extractor.ts +0 -63
  48. package/src/parameters/extractors/parametrized-extractor.ts +0 -27
  49. package/src/parameters/extractors/regex-extractor.ts +0 -18
  50. package/src/parameters/extractors/regex-matcher.ts +0 -17
  51. package/src/parameters/extractors/ws-extractor.ts +0 -91
  52. package/src/parameters/generate-random.ts +0 -114
  53. package/src/parameters/index.ts +0 -621
  54. package/src/parameters/json-path-utils.ts +0 -20
  55. package/src/parameters/operators/binary-operator.ts +0 -23
  56. package/src/parameters/operators/index.ts +0 -39
  57. package/src/parameters/parameter-functions/boolean-parameter-functions.ts +0 -24
  58. package/src/parameters/parameter-functions/crypto.ts +0 -55
  59. package/src/parameters/parameter-functions/json-schema.ts +0 -29
  60. package/src/parameters/parameter-functions/numeric-input-parameter-functions.ts +0 -22
  61. package/src/parameters/parameter-functions/numeric-parameter-functions.ts +0 -37
  62. package/src/parameters/parameter-functions/parameter-function-utils.ts +0 -55
  63. package/src/parameters/parameter-functions/parameter-function.ts +0 -7
  64. package/src/parameters/parameter-functions/parameter-functions.ts +0 -54
  65. package/src/parameters/parameter-functions/random-parameter-functions.ts +0 -22
  66. package/src/parameters/parameter-functions/textual-parameter-functions.ts +0 -464
  67. package/src/parameters/parameter-regex-providers.ts +0 -74
  68. package/src/parameters/resolvers/random-parameters-resolver.ts +0 -8
  69. package/src/parameters/type.ts +0 -7
  70. package/src/parameters/value-utils.ts +0 -47
  71. package/src/request/index.ts +0 -525
  72. package/src/schema/json-schema-generator.ts +0 -76
  73. package/test/conf/validate.spec.js +0 -141
  74. package/test/har/is-har.spec.js +0 -33
  75. package/test/multipart-form-data/form-data-utils.spec.ts +0 -121
  76. package/test/multipart-form-data/resources/multipart-form-data-file-text-content.json +0 -5
  77. package/test/parameters/builtin-functions.spec.js +0 -85
  78. package/test/parameters/json-path-utils.spec.ts +0 -50
  79. package/test/parameters/parameter-functions.spec.js +0 -48
  80. package/test/parameters/parameter-utils.spec.js +0 -185
  81. package/test/parameters/regex-functions.spec.ts +0 -57
  82. package/test/parameters/value-utils.spec.js +0 -73
  83. package/test/schema/json-schema-generator.spec.js +0 -227
  84. package/tsconfig.json +0 -9
@@ -1,114 +0,0 @@
1
- import uuid from 'uuid';
2
- import randomstring from 'randomstring';
3
- import clamp = require('lodash/clamp');
4
- import random = require('lodash/random');
5
- import { parameterValueToNumber } from './value-utils';
6
- import { PresentableError } from '@loadmill/universal/dist/errors';
7
-
8
- const MAX_RANDOM_LEN = 100;
9
- const DEFAULT_RANDOM_LEN = 10;
10
- // 2^32
11
- const DEFAULT_MAX_RANDOM_INT = 4294967296;
12
-
13
- export enum RandomTypes {
14
- hex = 'hex',
15
- uuid = 'uuid',
16
- from = 'from',
17
- chars = 'chars',
18
- number = 'number',
19
- digits = 'digits',
20
- uppers = 'uppers',
21
- lowers = 'lowers',
22
- letters = 'letters',
23
- boolean = 'boolean',
24
- }
25
-
26
- export function generateRandom(kind: string, arg1?: string, arg2?: string) {
27
- if (!kind) {
28
- return null;
29
- }
30
-
31
- if (kind === RandomTypes.uuid) {
32
- return uuid.v4();
33
- } else if (kind === RandomTypes.number) {
34
- let min = 0,
35
- max = DEFAULT_MAX_RANDOM_INT;
36
-
37
- if (arg2) {
38
- min = nonNegativeInt(arg1);
39
- max = nonNegativeInt(arg2);
40
-
41
- if (min > max) {
42
- const temp = min;
43
- min = max;
44
- max = temp;
45
- }
46
- } else if (arg1) {
47
- max = nonNegativeInt(arg1);
48
- }
49
-
50
- // Assumes both are integers!
51
- return random(min, max);
52
- } else if (kind === RandomTypes.boolean) {
53
- const probability = nonNegativeInt(arg1, 50) / 100;
54
-
55
- return (
56
- probability >= 1 ||
57
- (probability !== 0 && Math.random() <= probability)
58
- ).toString();
59
- } else {
60
- const length = nonNegativeInt(
61
- kind === RandomTypes.from ? arg2 : arg1,
62
- DEFAULT_RANDOM_LEN
63
- );
64
- const options: { length; charset?; capitalization? } = {
65
- length: clamp(length, 0, MAX_RANDOM_LEN),
66
- };
67
-
68
- if (kind === RandomTypes.chars) {
69
- options.charset = 'alphanumeric';
70
- } else if (kind === RandomTypes.digits) {
71
- options.charset = 'numeric';
72
- } else if (kind === RandomTypes.hex) {
73
- options.charset = 'hex';
74
- } else if (
75
- kind === RandomTypes.letters ||
76
- kind === RandomTypes.lowers ||
77
- kind === RandomTypes.uppers
78
- ) {
79
- options.charset = 'alphabetic';
80
-
81
- if (kind !== RandomTypes.letters) {
82
- options.capitalization =
83
- kind === RandomTypes.lowers ? 'lowercase' : 'uppercase';
84
- }
85
- } else if (kind === RandomTypes.from) {
86
- if (!arg1) {
87
- return null;
88
- }
89
- options.charset = arg1;
90
- } else {
91
- options.charset = kind;
92
- }
93
-
94
- return randomstring.generate(options);
95
- }
96
- }
97
-
98
- function nonNegativeInt(arg?: string, def?: number) {
99
- let value;
100
-
101
- if (!arg) {
102
- value = def;
103
- } else {
104
- value = parameterValueToNumber(arg, { integer: true, nonNegative: true });
105
- }
106
-
107
- if (value == null) {
108
- throw new PresentableError(
109
- 'Argument must be a non-negative integer, instead found: ' + arg
110
- );
111
- }
112
-
113
- return value;
114
- }