@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
@@ -0,0 +1,225 @@
1
+ import "@gatling.io/jvm-types";
2
+ import JvmDoWhileDuring = io.gatling.javaapi.core.loop.DoWhileDuring;
3
+ import { Duration } from "../utils/duration";
4
+ import { SessionTo } from "../session";
5
+ import { On } from "./on";
6
+ export interface DoWhileDuringFunction<T extends DoWhileDuring<T>> {
7
+ /**
8
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
9
+ * isn't reached. The condition is evaluated at the end of the loop.
10
+ *
11
+ * @param condition - the condition, expressed as a Gatling Expression Language String
12
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
13
+ * @returns a DSL component for defining the loop content
14
+ */
15
+ (condition: string, duration: Duration): On<T>;
16
+ /**
17
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
18
+ * isn't reached. The condition is evaluated at the end of the loop.
19
+ *
20
+ * @param condition - the condition, expressed as a Gatling Expression Language String
21
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
22
+ * @param counterName - the name of the loop counter, as stored in the Session
23
+ * @returns a DSL component for defining the loop content
24
+ */
25
+ (condition: string, duration: Duration, counterName: string): On<T>;
26
+ /**
27
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
28
+ * isn't reached. The condition is evaluated at the end of the loop.
29
+ *
30
+ * @param condition - the condition, expressed as a Gatling Expression Language String
31
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
32
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
33
+ * inside the loop
34
+ * @returns a DSL component for defining the loop content
35
+ */
36
+ (condition: string, duration: Duration, exitASAP: boolean): On<T>;
37
+ /**
38
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
39
+ * isn't reached. The condition is evaluated at the end of the loop.
40
+ *
41
+ * @param condition - the condition, expressed as a Gatling Expression Language String
42
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
43
+ * @param counterName - the name of the loop counter, as stored in the Session
44
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
45
+ * inside the loop
46
+ * @returns a DSL component for defining the loop content
47
+ */
48
+ (condition: string, duration: Duration, counterName: string, exitASAP: boolean): On<T>;
49
+ /**
50
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
51
+ * isn't reached. The condition is evaluated at the end of the loop.
52
+ *
53
+ * @param condition - the condition, expressed as a Gatling Expression Language String
54
+ * @param duration - the maximum duration, expressed as a function
55
+ * @returns a DSL component for defining the loop content
56
+ */
57
+ (condition: string, duration: SessionTo<Duration>): On<T>;
58
+ /**
59
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
60
+ * isn't reached. The condition is evaluated at the end of the loop.
61
+ *
62
+ * @param condition - the condition, expressed as a Gatling Expression Language String
63
+ * @param duration - the maximum duration, expressed as a function
64
+ * @param counterName - the name of the loop counter, as stored in the Session
65
+ * @returns a DSL component for defining the loop content
66
+ */
67
+ (condition: string, duration: SessionTo<Duration>, counterName: string): On<T>;
68
+ /**
69
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
70
+ * isn't reached. The condition is evaluated at the end of the loop.
71
+ *
72
+ * @param condition - the condition, expressed as a Gatling Expression Language String
73
+ * @param duration - the maximum duration, expressed as a function
74
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
75
+ * inside the loop
76
+ * @returns a DSL component for defining the loop content
77
+ */
78
+ (condition: string, duration: SessionTo<Duration>, exitASAP: boolean): On<T>;
79
+ /**
80
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
81
+ * isn't reached. The condition is evaluated at the end of the loop.
82
+ *
83
+ * @param condition - the condition, expressed as a Gatling Expression Language String
84
+ * @param duration - the maximum duration, expressed as a function
85
+ * @param counterName - the name of the loop counter, as stored in the Session
86
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
87
+ * inside the loop
88
+ * @returns a DSL component for defining the loop content
89
+ */
90
+ (condition: string, duration: SessionTo<Duration>, counterName: string, exitASAP: boolean): On<T>;
91
+ /**
92
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
93
+ * isn't reached. The condition is evaluated at the end of the loop.
94
+ *
95
+ * @param condition - the condition, expressed as a Gatling Expression Language String
96
+ * @param duration - the maximum duration, expressed as a Gatling Expression Language String that
97
+ * must either evaluate to an integer number of seconds or an object with an explicit time unit
98
+ * @returns a DSL component for defining the loop content
99
+ */
100
+ (condition: string, duration: string): On<T>;
101
+ /**
102
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
103
+ * isn't reached. The condition is evaluated at the end of the loop.
104
+ *
105
+ * @param condition - the condition, expressed as a Gatling Expression Language String
106
+ * @param duration - the maximum duration, expressed as a Gatling Expression Language String that
107
+ * must either evaluate to an integer number of seconds or an object with an explicit time unit
108
+ * @param counterName - the name of the loop counter, as stored in the Session
109
+ * @returns a DSL component for defining the loop content
110
+ */
111
+ (condition: string, duration: string, counterName: string): On<T>;
112
+ /**
113
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
114
+ * isn't reached. The condition is evaluated at the end of the loop.
115
+ *
116
+ * @param condition - the condition, expressed as a Gatling Expression Language String
117
+ * @param duration - the maximum duration, expressed as a Gatling Expression Language String that
118
+ * must either evaluate to an integer number of seconds or an object with an explicit time unit
119
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
120
+ * inside the loop
121
+ * @returns a DSL component for defining the loop content
122
+ */
123
+ (condition: string, duration: string, exitASAP: boolean): On<T>;
124
+ /**
125
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
126
+ * isn't reached. The condition is evaluated at the end of the loop.
127
+ *
128
+ * @param condition - the condition, expressed as a Gatling Expression Language String
129
+ * @param duration - the maximum duration, expressed as a Gatling Expression Language String that
130
+ * must either evaluate to an integer number of seconds or an object with an explicit time unit
131
+ * @param counterName - the name of the loop counter, as stored in the Session
132
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
133
+ * inside the loop
134
+ * @returns a DSL component for defining the loop content
135
+ */
136
+ (condition: string, duration: string, counterName: string, exitASAP: boolean): On<T>;
137
+ /**
138
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
139
+ * isn't reached. The condition is evaluated at the end of the loop.
140
+ *
141
+ * @param condition - the condition, expressed as a function
142
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
143
+ * @returns a DSL component for defining the loop content
144
+ */
145
+ (condition: SessionTo<boolean>, duration: Duration): On<T>;
146
+ /**
147
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
148
+ * isn't reached. The condition is evaluated at the end of the loop.
149
+ *
150
+ * @param condition - the condition, expressed as a function
151
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
152
+ * @param counterName - the name of the loop counter, as stored in the Session
153
+ * @returns a DSL component for defining the loop content
154
+ */
155
+ (condition: SessionTo<boolean>, duration: Duration, counterName: string): On<T>;
156
+ /**
157
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
158
+ * isn't reached. The condition is evaluated at the end of the loop.
159
+ *
160
+ * @param condition - the condition, expressed as a function
161
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
162
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
163
+ * inside the loop
164
+ * @returns a DSL component for defining the loop content
165
+ */
166
+ (condition: SessionTo<boolean>, duration: Duration, exitASAP: boolean): On<T>;
167
+ /**
168
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
169
+ * isn't reached. The condition is evaluated at the end of the loop.
170
+ *
171
+ * @param condition - the condition, expressed as a function
172
+ * @param duration - the maximum duration, either an integer number of seconds or an object with an explicit time unit
173
+ * @param counterName - the name of the loop counter, as stored in the Session
174
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
175
+ * inside the loop
176
+ * @returns a DSL component for defining the loop content
177
+ */
178
+ (condition: SessionTo<boolean>, duration: Duration, counterName: string, exitASAP: boolean): On<T>;
179
+ /**
180
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
181
+ * isn't reached. The condition is evaluated at the end of the loop.
182
+ *
183
+ * @param condition - the condition, expressed as a function
184
+ * @param duration - the maximum duration, expressed as a function
185
+ * @returns a DSL component for defining the loop content
186
+ */
187
+ (condition: SessionTo<boolean>, duration: SessionTo<Duration>): On<T>;
188
+ /**
189
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
190
+ * isn't reached. The condition is evaluated at the end of the loop.
191
+ *
192
+ * @param condition - the condition, expressed as a function
193
+ * @param duration - the maximum duration, expressed as a function
194
+ * @param counterName - the name of the loop counter, as stored in the Session
195
+ * @returns a DSL component for defining the loop content
196
+ */
197
+ (condition: SessionTo<boolean>, duration: SessionTo<Duration>, counterName: string): On<T>;
198
+ /**
199
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
200
+ * isn't reached. The condition is evaluated at the end of the loop.
201
+ *
202
+ * @param condition - the condition, expressed as a function
203
+ * @param duration - the maximum duration, expressed as a function
204
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
205
+ * inside the loop
206
+ * @returns a DSL component for defining the loop content
207
+ */
208
+ (condition: SessionTo<boolean>, duration: SessionTo<Duration>, exitASAP: boolean): On<T>;
209
+ /**
210
+ * Define a loop that will iterate as long as the condition holds true and a maximum duration
211
+ * isn't reached. The condition is evaluated at the end of the loop.
212
+ *
213
+ * @param condition - the condition, expressed as a function
214
+ * @param duration - the maximum duration, expressed as a function
215
+ * @param counterName - the name of the loop counter, as stored in the Session
216
+ * @param exitASAP - if the loop must be interrupted if the condition becomes false or the maximum duration is reached
217
+ * inside the loop
218
+ * @returns a DSL component for defining the loop content
219
+ */
220
+ (condition: SessionTo<boolean>, duration: SessionTo<Duration>, counterName: string, exitASAP: boolean): On<T>;
221
+ }
222
+ export interface DoWhileDuring<T extends DoWhileDuring<T>> {
223
+ doWhileDuring: DoWhileDuringFunction<T>;
224
+ }
225
+ export declare const doWhileDuringImpl: <J2, J1 extends JvmDoWhileDuring<J2, any>, T extends DoWhileDuring<T>>(jvmDoWhileDuring: J1, wrap: (wrapped: J2) => T) => DoWhileDuringFunction<T>;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.doWhileDuringImpl = void 0;
4
+ require("@gatling.io/jvm-types");
5
+ const duration_1 = require("../utils/duration");
6
+ const session_1 = require("../session");
7
+ const callbacks_1 = require("../gatlingJvm/callbacks");
8
+ const on_1 = require("./on");
9
+ const doWhileDuringImpl = (jvmDoWhileDuring, wrap) => (condition, duration, arg2, arg3) => {
10
+ if (arg3 !== undefined && typeof arg2 === "string") {
11
+ // doWhileDuring(condition, duration, counterName, exitASAP)
12
+ if (typeof condition === "function") {
13
+ const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
14
+ if ((0, duration_1.isDuration)(duration)) {
15
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration), arg2, arg3), wrap);
16
+ }
17
+ else if (typeof duration === "function") {
18
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2, arg3), wrap);
19
+ }
20
+ }
21
+ else {
22
+ if ((0, duration_1.isDuration)(duration)) {
23
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, duration_1.toJvmDuration)(duration), arg2, arg3), wrap);
24
+ }
25
+ else if (typeof duration === "function") {
26
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2, arg3), wrap);
27
+ }
28
+ }
29
+ }
30
+ else if (typeof arg2 === "string") {
31
+ // doWhileDuring(condition, duration, counterName)
32
+ if (typeof condition === "function") {
33
+ const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
34
+ if ((0, duration_1.isDuration)(duration)) {
35
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
36
+ }
37
+ else if (typeof duration === "function") {
38
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
39
+ }
40
+ }
41
+ else {
42
+ if ((0, duration_1.isDuration)(duration)) {
43
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
44
+ }
45
+ else if (typeof duration === "function") {
46
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
47
+ }
48
+ }
49
+ }
50
+ else if (typeof arg2 === "boolean") {
51
+ // doWhileDuring(condition, duration, exitASAP)
52
+ if (typeof condition === "function") {
53
+ const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
54
+ if ((0, duration_1.isDuration)(duration)) {
55
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
56
+ }
57
+ else if (typeof duration === "function") {
58
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
59
+ }
60
+ }
61
+ else {
62
+ if ((0, duration_1.isDuration)(duration)) {
63
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, duration_1.toJvmDuration)(duration), arg2), wrap);
64
+ }
65
+ else if (typeof duration === "function") {
66
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg2), wrap);
67
+ }
68
+ }
69
+ }
70
+ else if (arg2 === undefined) {
71
+ // doWhileDuring(condition, duration)
72
+ if (typeof condition === "function") {
73
+ const wrappedCondition = (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition));
74
+ if ((0, duration_1.isDuration)(duration)) {
75
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, duration_1.toJvmDuration)(duration)), wrap);
76
+ }
77
+ else if (typeof duration === "function") {
78
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(wrappedCondition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration))), wrap);
79
+ }
80
+ }
81
+ else {
82
+ if ((0, duration_1.isDuration)(duration)) {
83
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, duration_1.toJvmDuration)(duration)), wrap);
84
+ }
85
+ else if (typeof duration === "function") {
86
+ return (0, on_1.wrapOn)(jvmDoWhileDuring.doWhileDuring(condition, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration))), wrap);
87
+ }
88
+ }
89
+ }
90
+ throw Error(`doWhileDuring() called with invalid arguments ${condition}, ${duration}, ${arg2}, ${arg3}`);
91
+ };
92
+ exports.doWhileDuringImpl = doWhileDuringImpl;
@@ -0,0 +1,123 @@
1
+ import "@gatling.io/jvm-types";
2
+ import JvmDuring = io.gatling.javaapi.core.loop.During;
3
+ import { Duration } from "../utils/duration";
4
+ import { SessionTo } from "../session";
5
+ import { On } from "./on";
6
+ export interface DuringFunction<T extends During<T>> {
7
+ /**
8
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
9
+ * the loop.
10
+ *
11
+ * @param duration - the maximum duration, in seconds or with an explicit time unit
12
+ * @returns a DSL component for defining the loop content
13
+ */
14
+ (duration: Duration): On<T>;
15
+ /**
16
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
17
+ * the loop.
18
+ *
19
+ * @param duration - the maximum duration, in seconds or with an explicit time unit
20
+ * @param exitASAP - if the loop must be interrupted if the max duration is reached inside the loop
21
+ * @returns a DSL component for defining the loop content
22
+ */
23
+ (duration: Duration, exitASAP: boolean): On<T>;
24
+ /**
25
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
26
+ * the loop.
27
+ *
28
+ * @param duration - the maximum duration, in seconds or with an explicit time unit
29
+ * @param counterName - the name of the loop counter, as stored in the Session
30
+ * @returns a DSL component for defining the loop content
31
+ */
32
+ (duration: Duration, counterName: string): On<T>;
33
+ /**
34
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
35
+ * the loop.
36
+ *
37
+ * @param duration - the maximum duration, in seconds or with an explicit time unit
38
+ * @param counterName - the name of the loop counter, as stored in the Session
39
+ * @param exitASAP - if the loop must be interrupted if the max duration is reached inside the loop
40
+ * @returns a DSL component for defining the loop content
41
+ */
42
+ (duration: Duration, counterName: string, exitASAP: boolean): On<T>;
43
+ /**
44
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
45
+ * the loop.
46
+ *
47
+ * @param duration - the maximum duration as a Gatling Expression Language string. This expression must resolve to
48
+ * either a number, then the unit will be seconds, or an object with an explicit time unit.
49
+ * @returns a DSL component for defining the loop content
50
+ */
51
+ (duration: string): On<T>;
52
+ /**
53
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
54
+ * the loop.
55
+ *
56
+ * @param duration - the maximum duration as a Gatling Expression Language string. This expression must resolve to
57
+ * either a number, then the unit will be seconds, or an object with an explicit time unit.
58
+ * @param exitASAP - if the loop must be interrupted if the max duration is reached inside the loop
59
+ * @returns a DSL component for defining the loop content
60
+ */
61
+ (duration: string, exitASAP: boolean): On<T>;
62
+ /**
63
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
64
+ * the loop.
65
+ *
66
+ * @param duration - the maximum duration as a Gatling Expression Language string. This expression must resolve to
67
+ * either a number, then the unit will be seconds, or an object with an explicit time unit.
68
+ * @param counterName - the name of the loop counter, as stored in the Session
69
+ * @returns a DSL component for defining the loop content
70
+ */
71
+ (duration: string, counterName: string): On<T>;
72
+ /**
73
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
74
+ * the loop.
75
+ *
76
+ * @param duration - the maximum duration as a Gatling Expression Language string. This expression must resolve to
77
+ * either a number, then the unit will be seconds, or an object with an explicit time unit.
78
+ * @param counterName - the name of the loop counter, as stored in the Session
79
+ * @param exitASAP - if the loop must be interrupted if the max duration is reached inside the loop
80
+ * @returns a DSL component for defining the loop content
81
+ */
82
+ (duration: string, counterName: string, exitASAP: boolean): On<T>;
83
+ /**
84
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
85
+ * the loop.
86
+ *
87
+ * @param duration - the maximum duration as a function
88
+ * @returns a DSL component for defining the loop content
89
+ */
90
+ (duration: SessionTo<Duration>): On<T>;
91
+ /**
92
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
93
+ * the loop.
94
+ *
95
+ * @param duration - the maximum duration as a function
96
+ * @param exitASAP - if the loop must be interrupted if the max duration is reached inside the loop
97
+ * @returns a DSL component for defining the loop content
98
+ */
99
+ (duration: SessionTo<Duration>, exitASAP: boolean): On<T>;
100
+ /**
101
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
102
+ * the loop.
103
+ *
104
+ * @param duration - the maximum duration as a function
105
+ * @param counterName - the name of the loop counter, as stored in the Session
106
+ * @returns a DSL component for defining the loop content
107
+ */
108
+ (duration: SessionTo<Duration>, counterName: string): On<T>;
109
+ /**
110
+ * Define a loop that will iterate for a given duration. The condition is evaluated at the end of
111
+ * the loop.
112
+ *
113
+ * @param duration - the maximum duration as a function
114
+ * @param counterName - the name of the loop counter, as stored in the Session
115
+ * @param exitASAP - if the loop must be interrupted if the max duration is reached inside the loop
116
+ * @returns a DSL component for defining the loop content
117
+ */
118
+ (duration: SessionTo<Duration>, counterName: string, exitASAP: boolean): On<T>;
119
+ }
120
+ export interface During<T extends During<T>> {
121
+ during: DuringFunction<T>;
122
+ }
123
+ export declare const duringImpl: <J2, J1 extends JvmDuring<J2, any>, T extends During<T>>(jvmDuring: J1, wrap: (wrapped: J2) => T) => DuringFunction<T>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.duringImpl = void 0;
4
+ require("@gatling.io/jvm-types");
5
+ const duration_1 = require("../utils/duration");
6
+ const session_1 = require("../session");
7
+ const callbacks_1 = require("../gatlingJvm/callbacks");
8
+ const on_1 = require("./on");
9
+ const duringImpl = (jvmDuring, wrap) => (duration, arg1, arg2) => {
10
+ if (arg2 !== undefined && typeof arg1 === "string") {
11
+ // during(duration, counterName, exitASAP)
12
+ if ((0, duration_1.isDuration)(duration)) {
13
+ return (0, on_1.wrapOn)(jvmDuring.during((0, duration_1.toJvmDuration)(duration), arg1, arg2), wrap);
14
+ }
15
+ else if (typeof duration === "function") {
16
+ return (0, on_1.wrapOn)(jvmDuring.during((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg1, arg2), wrap);
17
+ }
18
+ else {
19
+ return (0, on_1.wrapOn)(jvmDuring.during(duration, arg1, arg2), wrap);
20
+ }
21
+ }
22
+ else if (typeof arg1 === "string") {
23
+ // during(duration, counterName)
24
+ if ((0, duration_1.isDuration)(duration)) {
25
+ return (0, on_1.wrapOn)(jvmDuring.during((0, duration_1.toJvmDuration)(duration), arg1), wrap);
26
+ }
27
+ else if (typeof duration === "function") {
28
+ return (0, on_1.wrapOn)(jvmDuring.during((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg1), wrap);
29
+ }
30
+ else {
31
+ return (0, on_1.wrapOn)(jvmDuring.during(duration, arg1), wrap);
32
+ }
33
+ }
34
+ else if (typeof arg1 === "boolean") {
35
+ // during(duration, exitASAP)
36
+ if ((0, duration_1.isDuration)(duration)) {
37
+ return (0, on_1.wrapOn)(jvmDuring.during((0, duration_1.toJvmDuration)(duration), arg1), wrap);
38
+ }
39
+ else if (typeof duration === "function") {
40
+ return (0, on_1.wrapOn)(jvmDuring.during((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration)), arg1), wrap);
41
+ }
42
+ else {
43
+ return (0, on_1.wrapOn)(jvmDuring.during(duration, arg1), wrap);
44
+ }
45
+ }
46
+ else if (arg1 === undefined) {
47
+ // during(duration)
48
+ if ((0, duration_1.isDuration)(duration)) {
49
+ return (0, on_1.wrapOn)(jvmDuring.during((0, duration_1.toJvmDuration)(duration)), wrap);
50
+ }
51
+ else if (typeof duration === "function") {
52
+ return (0, on_1.wrapOn)(jvmDuring.during((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionToDuration)(duration))), wrap);
53
+ }
54
+ else {
55
+ return (0, on_1.wrapOn)(jvmDuring.during(duration), wrap);
56
+ }
57
+ }
58
+ throw Error(`during() called with invalid arguments ${duration}, ${arg1}, ${arg2}`);
59
+ };
60
+ exports.duringImpl = duringImpl;
@@ -0,0 +1,121 @@
1
+ import "@gatling.io/jvm-types";
2
+ import JvmErrors = io.gatling.javaapi.core.error.Errors;
3
+ import { SessionTo } from "../session";
4
+ import { On } from "./on";
5
+ export interface ExitBlockOnFailFunction<T extends Errors<T>> {
6
+ /**
7
+ * Define a block that is interrupted for a given virtual user if it experiences a failure.
8
+ *
9
+ * @returns a DSL component for defining the tried block
10
+ */
11
+ (): On<T>;
12
+ }
13
+ export interface TryMaxFunction<T extends Errors<T>> {
14
+ /**
15
+ * Define a block that is interrupted and retried for a given virtual user if it experiences a failure.
16
+ *
17
+ * @param times - the maximum number of tries, including the first one (hence number of retries + 1)
18
+ * @returns a DSL component for defining the tried block
19
+ */
20
+ (times: number | string | SessionTo<number>): On<T>;
21
+ /**
22
+ * Define a block that is interrupted and retried for a given virtual user if it experiences a failure.
23
+ *
24
+ * @param times - the maximum number of tries, including the first one (hence number of retries + 1)
25
+ * @param counterName - the name of the loop counter, as stored in the Session
26
+ * @returns a DSL component for defining the tried block
27
+ */
28
+ (times: number | string | SessionTo<number>, counterName: string): On<T>;
29
+ }
30
+ export interface ExitHereIfFunction<T extends Errors<T>> {
31
+ /**
32
+ * Have the virtual user exit here if the condition holds true
33
+ *
34
+ * @param condition - the condition, expressed as a Gatling Expression Language String
35
+ * @returns a new StructureBuilder
36
+ */
37
+ (condition: string): T;
38
+ /**
39
+ * Have the virtual user exit here if the condition holds true
40
+ *
41
+ * @param condition - the condition, expressed as a function
42
+ * @returns a new StructureBuilder
43
+ */
44
+ (condition: SessionTo<boolean>): T;
45
+ }
46
+ export interface ExitHereFunction<T extends Errors<T>> {
47
+ /**
48
+ * Have the virtual user exit here
49
+ *
50
+ * @returns a new StructureBuilder
51
+ */
52
+ (): T;
53
+ }
54
+ export interface ExitHereIfFailedFunction<T extends Errors<T>> {
55
+ /**
56
+ * Have the virtual user exit here if the state of its Session is failed
57
+ *
58
+ * @returns a new StructureBuilder
59
+ */
60
+ (): T;
61
+ }
62
+ export interface StopInjectorFunction<T extends Errors<T>> {
63
+ /**
64
+ * Have the virtual user abruptly stop the injector
65
+ *
66
+ * @param message - the message, expressed as a Gatling Expression Language String
67
+ * @returns a new StructureBuilder
68
+ */
69
+ (message: string): T;
70
+ /**
71
+ * Have the virtual user abruptly stop the injector
72
+ *
73
+ * @param message - the message, expressed as a function
74
+ * @returns a new StructureBuilder
75
+ */
76
+ (message: SessionTo<string>): T;
77
+ }
78
+ export interface StopInjectorIfFunction<T extends Errors<T>> {
79
+ /**
80
+ * Have the virtual user abruptly stop the injector if a condition is met
81
+ *
82
+ * @param message - the message, expressed as a Gatling Expression Language String
83
+ * @param condition - the condition, expressed as a Gatling Expression Language String
84
+ * @returns a new StructureBuilder
85
+ */
86
+ (message: string, condition: string): T;
87
+ /**
88
+ * Have the virtual user abruptly stop the injector if a condition is met
89
+ *
90
+ * @param message - the message, expressed as a Gatling Expression Language String
91
+ * @param condition - the condition, expressed as a function
92
+ * @returns a new StructureBuilder
93
+ */
94
+ (message: string, condition: SessionTo<boolean>): T;
95
+ /**
96
+ * Have the virtual user abruptly stop the injector if a condition is met
97
+ *
98
+ * @param message - the message, expressed as a function
99
+ * @param condition - the condition, expressed as a Gatling Expression Language String
100
+ * @returns a new StructureBuilder
101
+ */
102
+ (message: SessionTo<string>, condition: string): T;
103
+ /**
104
+ * Have the virtual user abruptly stop the injector if a condition is met
105
+ *
106
+ * @param message - the message, expressed as a function
107
+ * @param condition - the condition, expressed as a function
108
+ * @returns a new StructureBuilder
109
+ */
110
+ (message: SessionTo<string>, condition: SessionTo<boolean>): T;
111
+ }
112
+ export interface Errors<T extends Errors<T>> {
113
+ exitBlockOnFail: ExitBlockOnFailFunction<T>;
114
+ tryMax: TryMaxFunction<T>;
115
+ exitHereIf: ExitHereIfFunction<T>;
116
+ exitHere: ExitHereFunction<T>;
117
+ exitHereIfFailed: ExitHereIfFailedFunction<T>;
118
+ stopInjector: StopInjectorFunction<T>;
119
+ stopInjectorIf: StopInjectorIfFunction<T>;
120
+ }
121
+ export declare const errorsImpl: <J2, J1 extends JvmErrors<J2, any>, T extends Errors<T>>(jvmErrors: J1, wrap: (wrapped: J2) => T) => Errors<T>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.errorsImpl = void 0;
4
+ require("@gatling.io/jvm-types");
5
+ const session_1 = require("../session");
6
+ const callbacks_1 = require("../gatlingJvm/callbacks");
7
+ const on_1 = require("./on");
8
+ const errorsImpl = (jvmErrors, wrap) => ({
9
+ exitBlockOnFail: () => (0, on_1.wrapOn)(jvmErrors.exitBlockOnFail(), wrap),
10
+ tryMax: (times) => (0, on_1.wrapOn)(typeof times === "function"
11
+ ? jvmErrors.tryMax((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(times)))
12
+ : typeof times === "string"
13
+ ? jvmErrors.tryMax(times)
14
+ : jvmErrors.tryMax(times), wrap),
15
+ exitHereIf: (condition) => wrap(typeof condition === "function"
16
+ ? jvmErrors.exitHereIf((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition)))
17
+ : jvmErrors.exitHereIf(condition)),
18
+ exitHere: () => wrap(jvmErrors.exitHere()),
19
+ exitHereIfFailed: () => wrap(jvmErrors.exitHereIfFailed()),
20
+ stopInjector: (message) => wrap(typeof message === "function"
21
+ ? jvmErrors.stopInjector((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(message)))
22
+ : jvmErrors.stopInjector(message)),
23
+ stopInjectorIf: (message, condition) => {
24
+ if (typeof message === "function") {
25
+ if (typeof condition === "function") {
26
+ return wrap(jvmErrors.stopInjectorIf((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(message)), (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition))));
27
+ }
28
+ else {
29
+ return wrap(jvmErrors.stopInjectorIf((0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(message)), condition));
30
+ }
31
+ }
32
+ else {
33
+ if (typeof condition === "function") {
34
+ return wrap(jvmErrors.stopInjectorIf(message, (0, callbacks_1.wrapCallback)((0, session_1.underlyingSessionTo)(condition))));
35
+ }
36
+ else {
37
+ return wrap(jvmErrors.stopInjectorIf(message, condition));
38
+ }
39
+ }
40
+ }
41
+ });
42
+ exports.errorsImpl = errorsImpl;