@gatling.io/core 0.1.0

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 (109) hide show
  1. package/package.json +24 -0
  2. package/target/assertions.d.ts +214 -0
  3. package/target/assertions.js +63 -0
  4. package/target/body.d.ts +150 -0
  5. package/target/body.js +33 -0
  6. package/target/checks/builder.d.ts +10 -0
  7. package/target/checks/builder.js +7 -0
  8. package/target/checks/captureGroup.d.ts +15 -0
  9. package/target/checks/captureGroup.js +9 -0
  10. package/target/checks/condition.d.ts +19 -0
  11. package/target/checks/condition.js +7 -0
  12. package/target/checks/final.d.ts +23 -0
  13. package/target/checks/final.js +10 -0
  14. package/target/checks/find.d.ts +17 -0
  15. package/target/checks/find.js +9 -0
  16. package/target/checks/index.d.ts +408 -0
  17. package/target/checks/index.js +181 -0
  18. package/target/checks/jsonOfTypeFind.d.ts +56 -0
  19. package/target/checks/jsonOfTypeFind.js +16 -0
  20. package/target/checks/jsonOfTypeMultipleFind.d.ts +56 -0
  21. package/target/checks/jsonOfTypeMultipleFind.js +16 -0
  22. package/target/checks/multipleFind.d.ts +57 -0
  23. package/target/checks/multipleFind.js +26 -0
  24. package/target/checks/validate.d.ts +242 -0
  25. package/target/checks/validate.js +50 -0
  26. package/target/closedInjection.d.ts +33 -0
  27. package/target/closedInjection.js +38 -0
  28. package/target/common.d.ts +3 -0
  29. package/target/common.js +2 -0
  30. package/target/feeders.d.ts +203 -0
  31. package/target/feeders.js +74 -0
  32. package/target/filters.d.ts +31 -0
  33. package/target/filters.js +32 -0
  34. package/target/gatlingJvm/app.d.ts +4 -0
  35. package/target/gatlingJvm/app.js +2 -0
  36. package/target/gatlingJvm/callbacks.d.ts +9 -0
  37. package/target/gatlingJvm/callbacks.js +14 -0
  38. package/target/gatlingJvm/collections.d.ts +1 -0
  39. package/target/gatlingJvm/collections.js +31 -0
  40. package/target/index.d.ts +115 -0
  41. package/target/index.js +56 -0
  42. package/target/openInjection.d.ts +51 -0
  43. package/target/openInjection.js +62 -0
  44. package/target/population.d.ts +82 -0
  45. package/target/population.js +22 -0
  46. package/target/protocol.d.ts +5 -0
  47. package/target/protocol.js +3 -0
  48. package/target/scenario.d.ts +10 -0
  49. package/target/scenario.js +17 -0
  50. package/target/session.d.ts +28 -0
  51. package/target/session.js +42 -0
  52. package/target/structure/asLongAs.d.ts +74 -0
  53. package/target/structure/asLongAs.js +47 -0
  54. package/target/structure/asLongAsDuring.d.ts +221 -0
  55. package/target/structure/asLongAsDuring.js +92 -0
  56. package/target/structure/choices.d.ts +18 -0
  57. package/target/structure/choices.js +21 -0
  58. package/target/structure/doIf.d.ts +83 -0
  59. package/target/structure/doIf.js +39 -0
  60. package/target/structure/doIfOrElse.d.ts +86 -0
  61. package/target/structure/doIfOrElse.js +42 -0
  62. package/target/structure/doSwitch.d.ts +27 -0
  63. package/target/structure/doSwitch.js +13 -0
  64. package/target/structure/doSwitchOrElse.d.ts +34 -0
  65. package/target/structure/doSwitchOrElse.js +16 -0
  66. package/target/structure/doWhile.d.ts +28 -0
  67. package/target/structure/doWhile.js +28 -0
  68. package/target/structure/doWhileDuring.d.ts +225 -0
  69. package/target/structure/doWhileDuring.js +92 -0
  70. package/target/structure/during.d.ts +123 -0
  71. package/target/structure/during.js +60 -0
  72. package/target/structure/errors.d.ts +121 -0
  73. package/target/structure/errors.js +42 -0
  74. package/target/structure/execs.d.ts +46 -0
  75. package/target/structure/execs.js +15 -0
  76. package/target/structure/feeds.d.ts +42 -0
  77. package/target/structure/feeds.js +21 -0
  78. package/target/structure/forEach.d.ts +38 -0
  79. package/target/structure/forEach.js +34 -0
  80. package/target/structure/forever.d.ts +16 -0
  81. package/target/structure/forever.js +7 -0
  82. package/target/structure/groups.d.ts +17 -0
  83. package/target/structure/groups.js +9 -0
  84. package/target/structure/index.d.ts +64 -0
  85. package/target/structure/index.js +97 -0
  86. package/target/structure/jvmStructureBuilder.d.ts +28 -0
  87. package/target/structure/jvmStructureBuilder.js +3 -0
  88. package/target/structure/on.d.ts +12 -0
  89. package/target/structure/on.js +7 -0
  90. package/target/structure/paces.d.ts +101 -0
  91. package/target/structure/paces.js +58 -0
  92. package/target/structure/pauses.d.ts +127 -0
  93. package/target/structure/pauses.js +92 -0
  94. package/target/structure/randomSwitch.d.ts +19 -0
  95. package/target/structure/randomSwitch.js +9 -0
  96. package/target/structure/randomSwitchOrElse.d.ts +23 -0
  97. package/target/structure/randomSwitchOrElse.js +12 -0
  98. package/target/structure/rendezVous.d.ts +15 -0
  99. package/target/structure/rendezVous.js +6 -0
  100. package/target/structure/repeat.d.ts +34 -0
  101. package/target/structure/repeat.js +34 -0
  102. package/target/structure/roundRobinSwitch.d.ts +18 -0
  103. package/target/structure/roundRobinSwitch.js +9 -0
  104. package/target/structure/uniformRandomSwitch.d.ts +18 -0
  105. package/target/structure/uniformRandomSwitch.js +9 -0
  106. package/target/throttling.d.ts +43 -0
  107. package/target/throttling.js +36 -0
  108. package/target/utils/duration.d.ts +7 -0
  109. package/target/utils/duration.js +21 -0
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@gatling.io/core",
3
+ "version": "0.1.0",
4
+ "main": "target/index.js",
5
+ "types": "target/index.d.ts",
6
+ "dependencies": {
7
+ "@gatling.io/jvm-types": "0.1.0"
8
+ },
9
+ "devDependencies": {
10
+ "@types/jest": "29.5.12",
11
+ "jest": "29.7.0",
12
+ "prettier": "3.2.5",
13
+ "rimraf": "5.0.5",
14
+ "ts-jest": "29.1.2",
15
+ "ts-node": "10.9.2",
16
+ "typescript": "5.4.5"
17
+ },
18
+ "scripts": {
19
+ "clean": "rimraf target",
20
+ "format": "prettier --write '**/*.ts'",
21
+ "test": "jest",
22
+ "build": "tsc -p ."
23
+ }
24
+ }
@@ -0,0 +1,214 @@
1
+ import JvmAssertion = io.gatling.javaapi.core.Assertion;
2
+ import { Wrapper } from "./common";
3
+ /**
4
+ * Bootstrap a new global assertion that targets stats aggregated on all requests
5
+ *
6
+ * @returns the next DSL step
7
+ */
8
+ export declare const global: () => AssertionWithPath;
9
+ /**
10
+ * Bootstrap a new forAll assertion that targets stats on each individual request type
11
+ *
12
+ * @returns the next DSL step
13
+ */
14
+ export declare const forAll: () => AssertionWithPath;
15
+ /**
16
+ * Bootstrap a new details assertion that targets stats on a specific request type
17
+ *
18
+ * @returns the next DSL step
19
+ */
20
+ export declare const details: (...parts: string[]) => AssertionWithPath;
21
+ /**
22
+ * Step 2 of the Assertion DSL (path defined). Immutable, so all methods return a new occurrence
23
+ * and leave the original unmodified.
24
+ */
25
+ export interface AssertionWithPath {
26
+ /**
27
+ * Specify the Assertion targets the response time metric
28
+ *
29
+ * @returns the next Assertion DSL step
30
+ */
31
+ responseTime(): AssertionWithPathAndTimeMetric;
32
+ /**
33
+ * Specify the Assertion targets the all requests count metric
34
+ *
35
+ * @returns the next Assertion DSL step
36
+ */
37
+ allRequests(): AssertionWithPathAndCountMetric;
38
+ /**
39
+ * Specify the Assertion targets the failed requests count metric
40
+ *
41
+ * @returns the next Assertion DSL step
42
+ */
43
+ failedRequests(): AssertionWithPathAndCountMetric;
44
+ /**
45
+ * Specify the Assertion targets the successful requests count metric
46
+ *
47
+ * @returns the next Assertion DSL step
48
+ */
49
+ successfulRequests(): AssertionWithPathAndCountMetric;
50
+ /**
51
+ * Specify the Assertion targets the requests/s metric
52
+ *
53
+ * @returns the next Assertion DSL step
54
+ */
55
+ requestsPerSec(): AssertionWithPathAndTarget;
56
+ }
57
+ /**
58
+ * Step 3 of the Assertion DSL (path and time metric defined). Immutable, so all methods return a
59
+ * new occurrence and leave the original unmodified.
60
+ */
61
+ export interface AssertionWithPathAndTimeMetric {
62
+ /**
63
+ * Specify the Assertion targets the min value metric
64
+ *
65
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
66
+ */
67
+ min(): AssertionWithPathAndTarget;
68
+ /**
69
+ * Specify the Assertion targets the max value metric
70
+ *
71
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
72
+ */
73
+ max(): AssertionWithPathAndTarget;
74
+ /**
75
+ * Specify the Assertion targets the mean value metric
76
+ *
77
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
78
+ */
79
+ mean(): AssertionWithPathAndTarget;
80
+ /**
81
+ * Specify the Assertion targets the standard deviation metric
82
+ *
83
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
84
+ */
85
+ stdDev(): AssertionWithPathAndTarget;
86
+ /**
87
+ * Specify the Assertion targets the percentile1 metric, as defined in gatling.conf
88
+ *
89
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
90
+ */
91
+ percentile1(): AssertionWithPathAndTarget;
92
+ /**
93
+ * Specify the Assertion targets the percentile2 metric, as defined in gatling.conf
94
+ *
95
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
96
+ */
97
+ percentile2(): AssertionWithPathAndTarget;
98
+ /**
99
+ * Specify the Assertion targets the percentile3 metric, as defined in gatling.conf
100
+ *
101
+ * @returns the next Assertion DSL step
102
+ */
103
+ percentile3(): AssertionWithPathAndTarget;
104
+ /**
105
+ * Specify the Assertion targets the percentile4 metric, as defined in gatling.conf
106
+ *
107
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
108
+ */
109
+ percentile4(): AssertionWithPathAndTarget;
110
+ /**
111
+ * Specify the Assertion targets the given percentile metric
112
+ *
113
+ * @param value - the value of targeted percentile, between 0 and 100)
114
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
115
+ */
116
+ percentile(value: number): AssertionWithPathAndTarget;
117
+ }
118
+ /**
119
+ * Step 3 of the Assertion DSL (path and count metric defined). Immutable, so all methods return a
120
+ * new occurrence and leave the original unmodified.
121
+ */
122
+ export interface AssertionWithPathAndCountMetric {
123
+ /**
124
+ * Specify the Assertion targets the count metric
125
+ *
126
+ * @returns the next Assertion DSL step (condition in the next step must be specified with integer values only)
127
+ */
128
+ count(): AssertionWithPathAndTarget;
129
+ /**
130
+ * Specify the Assertion targets the percentage of total executions metric
131
+ *
132
+ * @returns the next Assertion DSL step (condition in the next step can be specified with a floating point value)
133
+ */
134
+ percent(): AssertionWithPathAndTarget;
135
+ }
136
+ /**
137
+ * Step 4 of the Assertion DSL (path and target defined). Immutable, so all methods return a new
138
+ * occurrence and leave the original unmodified.
139
+ */
140
+ export interface AssertionWithPathAndTarget {
141
+ /**
142
+ * Specify the metric must be strictly less than the expected value
143
+ *
144
+ * @param value - the value
145
+ * @returns a complete Assertion
146
+ */
147
+ lt(value: number): Assertion;
148
+ /**
149
+ * Specify the metric must be less than or equal to the expected value
150
+ *
151
+ * @param value - the value
152
+ * @returns a complete Assertion
153
+ */
154
+ lte(value: number): Assertion;
155
+ /**
156
+ * Specify the metric must be strictly greater than the expected value
157
+ *
158
+ * @param value - the value
159
+ * @returns a complete Assertion
160
+ */
161
+ gt(value: number): Assertion;
162
+ /**
163
+ * Specify the metric must be greater than or equal to the expected value
164
+ *
165
+ * @param value - the value
166
+ * @returns a complete Assertion
167
+ */
168
+ gte(value: number): Assertion;
169
+ /**
170
+ * Specify the metric must be included in the given range
171
+ *
172
+ * @param min - the min, included
173
+ * @param max - the max, included
174
+ * @param inclusive - if bounds must be included in the range
175
+ * @returns a complete Assertion
176
+ */
177
+ between(min: number, max: number, inclusive?: boolean): Assertion;
178
+ /**
179
+ * Specify the metric must be included in a range defined around a mean value with a half range
180
+ * expressed as an absolute value
181
+ *
182
+ * @param mean - the mean of the range
183
+ * @param plusOrMinus - the range half width
184
+ * @param inclusive - if bounds must be included in the range
185
+ * @returns a complete Assertion
186
+ */
187
+ around(mean: number, plusOrMinus: number, inclusive?: boolean): Assertion;
188
+ /**
189
+ * Specify the metric must be included in a range defined around a mean value with a half range
190
+ * expressed as an percentage of the mean value
191
+ *
192
+ * @param mean - the mean of the range
193
+ * @param percentDeviation - the range half width expressed as a percent of the mean
194
+ * @param inclusive - if bounds must be included in the range
195
+ * @returns a complete Assertion
196
+ */
197
+ deviatesAround(mean: number, percentDeviation: number, inclusive?: boolean): Assertion;
198
+ /**
199
+ * Specify the metric must be equal to an expected value
200
+ *
201
+ * @param value - the expected value
202
+ * @returns a complete Assertion
203
+ */
204
+ is(value: number): Assertion;
205
+ /**
206
+ * Specify the metric must be included in a set of values
207
+ *
208
+ * @param values - the expected values
209
+ * @returns a complete Assertion
210
+ */
211
+ in(...values: number[]): Assertion;
212
+ }
213
+ export interface Assertion extends Wrapper<JvmAssertion> {
214
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.details = exports.forAll = exports.global = void 0;
4
+ const jvm_types_1 = require("@gatling.io/jvm-types");
5
+ /**
6
+ * Bootstrap a new global assertion that targets stats aggregated on all requests
7
+ *
8
+ * @returns the next DSL step
9
+ */
10
+ const global = () => wrapAssertionWithPath(jvm_types_1.CoreDsl.global());
11
+ exports.global = global;
12
+ /**
13
+ * Bootstrap a new forAll assertion that targets stats on each individual request type
14
+ *
15
+ * @returns the next DSL step
16
+ */
17
+ const forAll = () => wrapAssertionWithPath(jvm_types_1.CoreDsl.forAll());
18
+ exports.forAll = forAll;
19
+ /**
20
+ * Bootstrap a new details assertion that targets stats on a specific request type
21
+ *
22
+ * @returns the next DSL step
23
+ */
24
+ const details = (...parts) => wrapAssertionWithPath(jvm_types_1.CoreDsl.details(...parts));
25
+ exports.details = details;
26
+ const wrapAssertionWithPath = (_underlying) => ({
27
+ responseTime: () => wrapAssertionWithPathAndTimeMetric(_underlying.responseTime()),
28
+ allRequests: () => wrapAssertionWithPathAndCountMetric(_underlying.allRequests()),
29
+ failedRequests: () => wrapAssertionWithPathAndCountMetric(_underlying.failedRequests()),
30
+ successfulRequests: () => wrapAssertionWithPathAndCountMetric(_underlying.successfulRequests()),
31
+ requestsPerSec: () => wrapAssertionWithPathAndTarget(_underlying.requestsPerSec())
32
+ });
33
+ const wrapAssertionWithPathAndTimeMetric = (_underlying) => ({
34
+ min: () => wrapAssertionWithPathAndTarget(_underlying.min()),
35
+ max: () => wrapAssertionWithPathAndTarget(_underlying.max()),
36
+ mean: () => wrapAssertionWithPathAndTarget(_underlying.mean()),
37
+ stdDev: () => wrapAssertionWithPathAndTarget(_underlying.stdDev()),
38
+ percentile1: () => wrapAssertionWithPathAndTarget(_underlying.percentile1()),
39
+ percentile2: () => wrapAssertionWithPathAndTarget(_underlying.percentile2()),
40
+ percentile3: () => wrapAssertionWithPathAndTarget(_underlying.percentile3()),
41
+ percentile4: () => wrapAssertionWithPathAndTarget(_underlying.percentile4()),
42
+ percentile: (value) => wrapAssertionWithPathAndTarget(_underlying.percentile(value))
43
+ });
44
+ const wrapAssertionWithPathAndCountMetric = (_underlying) => ({
45
+ count: () => wrapAssertionWithPathAndTarget(_underlying.count()),
46
+ percent: () => wrapAssertionWithPathAndTarget(_underlying.percent())
47
+ });
48
+ const wrapAssertionWithPathAndTarget = (_underlying) => ({
49
+ lt: (value) => wrapAssertion(_underlying.lt(value)),
50
+ lte: (value) => wrapAssertion(_underlying.lte(value)),
51
+ gt: (value) => wrapAssertion(_underlying.gt(value)),
52
+ gte: (value) => wrapAssertion(_underlying.gte(value)),
53
+ between: (min, max, inclusive) => wrapAssertion(inclusive !== undefined ? _underlying.between(min, max, inclusive) : _underlying.between(min, max)),
54
+ around: (mean, plusOrMinus, inclusive) => wrapAssertion(inclusive !== undefined ? _underlying.around(mean, plusOrMinus, inclusive) : _underlying.around(mean, plusOrMinus)),
55
+ deviatesAround: (mean, percentDeviation, inclusive) => wrapAssertion(inclusive !== undefined
56
+ ? _underlying.deviatesAround(mean, percentDeviation, inclusive)
57
+ : _underlying.deviatesAround(mean, percentDeviation)),
58
+ is: (value) => wrapAssertion(_underlying.is(value)),
59
+ in: (...values) => wrapAssertion(_underlying.in(values))
60
+ });
61
+ const wrapAssertion = (_underlying) => ({
62
+ _underlying
63
+ });
@@ -0,0 +1,150 @@
1
+ import { Wrapper } from "./common";
2
+ import { Session } from "./session";
3
+ import JvmBody = io.gatling.javaapi.core.Body;
4
+ export interface Body extends Wrapper<JvmBody> {
5
+ }
6
+ export declare namespace Body {
7
+ interface WithBytes extends Body {
8
+ (session: Session): number[];
9
+ }
10
+ interface WithString extends Body {
11
+ (session: Session): string;
12
+ }
13
+ }
14
+ export interface StringBodyFunction {
15
+ /**
16
+ * Create a body from a String.
17
+ *
18
+ * <p>Can also be used as a Function<Session, String> to define the expected value in a check.
19
+ *
20
+ * @param string - the body expressed as a gatling Expression Language String
21
+ * @returns a body
22
+ */
23
+ (string: string): Body.WithString;
24
+ /**
25
+ * Create a body from a String.
26
+ *
27
+ * <p>Can also be used as a Function<Session, String> to define the expected value in a check.
28
+ *
29
+ * @param f - the body expressed as a function
30
+ * @returns a body
31
+ */
32
+ (f: (session: Session) => string): Body.WithString;
33
+ }
34
+ export declare const StringBody: StringBodyFunction;
35
+ export interface RawFileBodyFunction {
36
+ /**
37
+ * Create a body from a file. Bytes will be sent without any transformation.
38
+ *
39
+ * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check.
40
+ *
41
+ * @param filePath - the path of the file, either relative to the root of the classpath, or
42
+ * absolute, expressed as a Gatling Expression Language String
43
+ * @returns a body
44
+ */
45
+ (filePath: string): Body.WithBytes;
46
+ /**
47
+ * Create a body from a file. Bytes will be sent without any transformation.
48
+ *
49
+ * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check.
50
+ *
51
+ * @param filePath - the path of the file, either relative to the root of the classpath, or
52
+ * absolute, expressed as a function
53
+ * @returns a body
54
+ */
55
+ (filePath: (session: Session) => string): Body.WithBytes;
56
+ }
57
+ export declare const RawFileBody: RawFileBodyFunction;
58
+ export interface ElFileBodyFunction {
59
+ /**
60
+ * Create a body from a file. File text content will be processed as a Gatling Expression Language
61
+ * String.
62
+ *
63
+ * <p>Can also be used as a Function<Session, String> to define the expected value in a check.
64
+ *
65
+ * @param filePath - the path of the file, either relative to the root of the classpath, or
66
+ * absolute, expressed as a Gatling Expression Language String
67
+ * @returns a body
68
+ */
69
+ (filePath: string): Body.WithString;
70
+ /**
71
+ * Create a body from a file. File text content will be processed as a Gatling Expression Language
72
+ * String.
73
+ *
74
+ * <p>Can also be used as a Function<Session, String> to define the expected value in a check.
75
+ *
76
+ * @param filePath - the path of the file, either relative to the root of the classpath, or
77
+ * absolute, expressed as a function
78
+ * @returns a body
79
+ */
80
+ (filePath: (session: Session) => string): Body.WithString;
81
+ }
82
+ export declare const ElFileBody: ElFileBodyFunction;
83
+ export interface PebbleStringBodyFunction {
84
+ /**
85
+ * Create a body from String processed as a <a href="https://pebbletemplates.io/">Pebble
86
+ * template</a>.
87
+ *
88
+ * <p>Can also be used as a Function<Session, String> to define the expected value in a check.
89
+ *
90
+ * @param string - the Pebble string
91
+ * @returns a body
92
+ */
93
+ (string: string): Body.WithString;
94
+ }
95
+ export declare const PebbleStringBody: PebbleStringBodyFunction;
96
+ export interface PebbleFileBodyFunction {
97
+ /**
98
+ * Create a body from a file. File text content will be processed as a <a
99
+ * href="https://pebbletemplates.io/">Pebble template</a>.
100
+ *
101
+ * <p>Can also be used as a Function<Session, String> to define the expected value in a check.
102
+ *
103
+ * @param filePath - the path of the file, either relative to the root of the classpath, or
104
+ * absolute, expressed as a Gatling Expression Language String
105
+ * @returns a body
106
+ */
107
+ (filePath: string): Body.WithString;
108
+ /**
109
+ * Create a body from a file. File text content will be processed as a <a
110
+ * href="https://pebbletemplates.io/">Pebble template</a>.
111
+ *
112
+ * <p>Can also be used as a Function<Session, String> to define the expected value in a check.
113
+ *
114
+ * @param filePath - the path of the file, either relative to the root of the classpath, or
115
+ * absolute, expressed as a function
116
+ * @returns a body
117
+ */
118
+ (filePath: (session: Session) => string): Body.WithString;
119
+ }
120
+ export declare const PebbleFileBody: PebbleFileBodyFunction;
121
+ export interface ByteArrayBodyFunction {
122
+ /**
123
+ * Create a body from a byte array. Bytes will be sent as is.
124
+ *
125
+ * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check.
126
+ *
127
+ * @param bytes - the bytes, expressed as a Gatling Expression Language String
128
+ * @returns a body
129
+ */
130
+ (bytes: string): Body.WithBytes;
131
+ /**
132
+ * Create a body from a byte array. Bytes will be sent as is.
133
+ *
134
+ * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check.
135
+ *
136
+ * @param bytes - the bytes
137
+ * @returns a body
138
+ */
139
+ (bytes: number[]): Body.WithBytes;
140
+ /**
141
+ * Create a body from a byte array. Bytes will be sent as is.
142
+ *
143
+ * <p>Can also be used as a Function<Session, byte[]> to define the expected value in a check.
144
+ *
145
+ * @param bytes - the bytes, expressed as a function
146
+ * @returns a body
147
+ */
148
+ (bytes: (session: Session) => number[]): Body.WithBytes;
149
+ }
150
+ export declare const ByteArrayBody: ByteArrayBodyFunction;
package/target/body.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ByteArrayBody = exports.PebbleFileBody = exports.PebbleStringBody = exports.ElFileBody = exports.RawFileBody = exports.StringBody = void 0;
4
+ const jvm_types_1 = require("@gatling.io/jvm-types");
5
+ const callbacks_1 = require("./gatlingJvm/callbacks");
6
+ const session_1 = require("./session");
7
+ const wrapBodyWithBytes = (_underlying) => Object.assign((session) => _underlying.apply(session._underlying), { _underlying });
8
+ const wrapBodyWithString = (_underlying) => Object.assign((session) => _underlying.apply(session._underlying), { _underlying });
9
+ const StringBody = (string) => wrapBodyWithString(typeof string === "function"
10
+ ? jvm_types_1.CoreDsl.StringBody((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(string)))
11
+ : jvm_types_1.CoreDsl.StringBody(string));
12
+ exports.StringBody = StringBody;
13
+ const RawFileBody = (filePath) => wrapBodyWithBytes(typeof filePath === "function"
14
+ ? jvm_types_1.CoreDsl.RawFileBody((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(filePath)))
15
+ : jvm_types_1.CoreDsl.RawFileBody(filePath));
16
+ exports.RawFileBody = RawFileBody;
17
+ const ElFileBody = (filePath) => wrapBodyWithString(typeof filePath === "function"
18
+ ? jvm_types_1.CoreDsl.ElFileBody((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(filePath)))
19
+ : jvm_types_1.CoreDsl.ElFileBody(filePath));
20
+ exports.ElFileBody = ElFileBody;
21
+ const PebbleStringBody = (string) => wrapBodyWithString(jvm_types_1.CoreDsl.PebbleStringBody(string));
22
+ exports.PebbleStringBody = PebbleStringBody;
23
+ const PebbleFileBody = (filePath) => wrapBodyWithString(typeof filePath === "function"
24
+ ? jvm_types_1.CoreDsl.PebbleFileBody((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(filePath)))
25
+ : jvm_types_1.CoreDsl.PebbleFileBody(filePath));
26
+ exports.PebbleFileBody = PebbleFileBody;
27
+ const ByteArrayBody = (bytes) => wrapBodyWithBytes(typeof bytes === "function"
28
+ ? jvm_types_1.CoreDsl.ByteArrayBody((0, callbacks_1.wrapByteArrayCallback)((0, session_1.underlyingSessionTo)(bytes)))
29
+ : typeof bytes === "string"
30
+ ? jvm_types_1.CoreDsl.ByteArrayBody(bytes)
31
+ : jvm_types_1.CoreDsl.ByteArrayBody(bytes));
32
+ exports.ByteArrayBody = ByteArrayBody;
33
+ // TODO registerPebbleExtensions
@@ -0,0 +1,10 @@
1
+ import { Wrapper } from "../common";
2
+ import JvmCheckBuilder = io.gatling.javaapi.core.CheckBuilder;
3
+ /**
4
+ * Java wrapper of a Scala CheckBuilder. Builder of an Action in a Gatling scenario.
5
+ *
6
+ * <p>Immutable, so all methods return a new occurrence and leave the original unmodified.
7
+ */
8
+ export interface CheckBuilder extends Wrapper<JvmCheckBuilder> {
9
+ }
10
+ export declare const wrapCheckBuilder: (_underlying: JvmCheckBuilder) => CheckBuilder;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapCheckBuilder = void 0;
4
+ const wrapCheckBuilder = (_underlying) => ({
5
+ _underlying
6
+ });
7
+ exports.wrapCheckBuilder = wrapCheckBuilder;
@@ -0,0 +1,15 @@
1
+ import { CheckBuilderMultipleFind } from "./multipleFind";
2
+ import JvmCheckBuilderCaptureGroup = io.gatling.javaapi.core.CheckBuilder$CaptureGroupCheckBuilder;
3
+ /**
4
+ * A special {@link CheckBuilderMultipleFind<string>} that can define regex capture groups
5
+ */
6
+ export interface CheckBuilderCaptureGroup extends CheckBuilderMultipleFind<string> {
7
+ /**
8
+ * Define that the check extracts an expected number of values from capture groups
9
+ *
10
+ * @param count - the number of capture groups in the regular expression pattern
11
+ * @returns a new MultipleFind
12
+ */
13
+ captureGroups(count: number): CheckBuilderMultipleFind<string[]>;
14
+ }
15
+ export declare const wrapCheckBuilderCaptureGroup: (_underlying: JvmCheckBuilderCaptureGroup) => CheckBuilderCaptureGroup;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapCheckBuilderCaptureGroup = void 0;
4
+ const multipleFind_1 = require("./multipleFind");
5
+ const wrapCheckBuilderCaptureGroup = (_underlying) => ({
6
+ ...(0, multipleFind_1.wrapCheckBuilderMultipleFind)(_underlying),
7
+ captureGroups: (count) => (0, multipleFind_1.wrapCheckBuilderMultipleFind)(_underlying.captureGroups(count))
8
+ });
9
+ exports.wrapCheckBuilderCaptureGroup = wrapCheckBuilderCaptureGroup;
@@ -0,0 +1,19 @@
1
+ import { CheckBuilder } from "../checks";
2
+ import JvmCheckBuilder = io.gatling.javaapi.core.CheckBuilder;
3
+ interface JvmCondition<T> {
4
+ equals(arg0: any): boolean;
5
+ then(...arg0: JvmCheckBuilder[]): T;
6
+ then(arg0: java.util.List<JvmCheckBuilder>): T;
7
+ toString(): string;
8
+ }
9
+ export interface Condition<T> {
10
+ /**
11
+ * Define the checks to apply when the condition holds true.
12
+ *
13
+ * @param thenChecks - the checks
14
+ * @returns a new HttpProtocolBuilder instance
15
+ */
16
+ then(...thenChecks: CheckBuilder[]): T;
17
+ }
18
+ export declare const wrapCondition: <J, T>(jvmCondition: JvmCondition<J>, wrap: (underlying: J) => T) => Condition<T>;
19
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapCondition = void 0;
4
+ const wrapCondition = (jvmCondition, wrap) => ({
5
+ then: (...thenChecks) => wrap(jvmCondition.then(thenChecks.map((c) => c._underlying)))
6
+ });
7
+ exports.wrapCondition = wrapCondition;
@@ -0,0 +1,23 @@
1
+ import { CheckBuilder } from "./builder";
2
+ import JvmCheckBuilderFinal = io.gatling.javaapi.core.CheckBuilder$Final;
3
+ /**
4
+ * Last step of the Check DSL Immutable, so all methods return a new occurrence and leave the
5
+ * original unmodified.
6
+ */
7
+ export interface CheckBuilderFinal extends CheckBuilder {
8
+ /**
9
+ * Provide a custom name for the check, to be used in case of a failure
10
+ *
11
+ * @param n - the name
12
+ * @returns a new CheckBuilderFinal
13
+ */
14
+ name(n: string): CheckBuilderFinal;
15
+ /**
16
+ * Save the extracted value in the virtual user's Session
17
+ *
18
+ * @param key - the key to store the extracted value in the Session
19
+ * @returns a new CheckBuilderFinal
20
+ */
21
+ saveAs(key: string): CheckBuilderFinal;
22
+ }
23
+ export declare const wrapCheckBuilderFinal: (_underlying: JvmCheckBuilderFinal) => CheckBuilderFinal;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapCheckBuilderFinal = void 0;
4
+ const builder_1 = require("./builder");
5
+ const wrapCheckBuilderFinal = (_underlying) => ({
6
+ ...(0, builder_1.wrapCheckBuilder)(_underlying),
7
+ name: (n) => (0, exports.wrapCheckBuilderFinal)(_underlying.name(n)),
8
+ saveAs: (key) => (0, exports.wrapCheckBuilderFinal)(_underlying.saveAs(key))
9
+ });
10
+ exports.wrapCheckBuilderFinal = wrapCheckBuilderFinal;
@@ -0,0 +1,17 @@
1
+ import { CheckBuilderValidate } from "./validate";
2
+ import JvmCheckBuilderFind = io.gatling.javaapi.core.CheckBuilder$Find;
3
+ /**
4
+ * Step 1 of the Check DSL when the check can only return one single value Immutable, so all
5
+ * methods return a new occurrence and leave the original unmodified.
6
+ *
7
+ * @typeParam X - the type of Java values the check can extract
8
+ */
9
+ export interface CheckBuilderFind<X> extends CheckBuilderValidate<X> {
10
+ /**
11
+ * Target a single/first value
12
+ *
13
+ * @returns the next Check DSL step
14
+ */
15
+ find(): CheckBuilderValidate<X>;
16
+ }
17
+ export declare const wrapCheckBuilderFind: <X>(_underlying: JvmCheckBuilderFind<X>) => CheckBuilderFind<X>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapCheckBuilderFind = void 0;
4
+ const validate_1 = require("./validate");
5
+ const wrapCheckBuilderFind = (_underlying) => ({
6
+ ...(0, validate_1.wrapCheckBuilderValidate)(_underlying),
7
+ find: () => (0, validate_1.wrapCheckBuilderValidate)(_underlying.find())
8
+ });
9
+ exports.wrapCheckBuilderFind = wrapCheckBuilderFind;