@gatling.io/core 0.1.0 → 0.1.2

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 (70) hide show
  1. package/LICENSE +202 -0
  2. package/package.json +4 -3
  3. package/target/assertions.d.ts +1 -1
  4. package/target/checks/multipleFind.d.ts +1 -1
  5. package/target/closedInjection.d.ts +94 -1
  6. package/target/closedInjection.js +21 -1
  7. package/target/feeders.d.ts +0 -11
  8. package/target/index.d.ts +17 -2
  9. package/target/index.js +16 -4
  10. package/target/openInjection.d.ts +140 -2
  11. package/target/openInjection.js +46 -1
  12. package/target/population.d.ts +3 -4
  13. package/target/population.js +2 -3
  14. package/target/protocol.d.ts +1 -2
  15. package/target/protocol.js +0 -1
  16. package/target/scenario.d.ts +12 -2
  17. package/target/scenario.js +7 -2
  18. package/target/session.d.ts +89 -0
  19. package/target/session.js +2 -1
  20. package/target/structure/asLongAs.d.ts +1 -2
  21. package/target/structure/asLongAs.js +1 -2
  22. package/target/structure/asLongAsDuring.d.ts +1 -2
  23. package/target/structure/asLongAsDuring.js +1 -2
  24. package/target/structure/choices.d.ts +2 -3
  25. package/target/structure/choices.js +0 -1
  26. package/target/structure/doIf.d.ts +2 -3
  27. package/target/structure/doIf.js +1 -2
  28. package/target/structure/doIfOrElse.d.ts +2 -3
  29. package/target/structure/doIfOrElse.js +1 -2
  30. package/target/structure/doSwitch.d.ts +1 -2
  31. package/target/structure/doSwitch.js +1 -2
  32. package/target/structure/doSwitchOrElse.d.ts +1 -2
  33. package/target/structure/doSwitchOrElse.js +1 -2
  34. package/target/structure/doWhile.d.ts +1 -2
  35. package/target/structure/doWhile.js +1 -2
  36. package/target/structure/doWhileDuring.d.ts +1 -2
  37. package/target/structure/doWhileDuring.js +1 -2
  38. package/target/structure/during.d.ts +1 -2
  39. package/target/structure/during.js +1 -2
  40. package/target/structure/errors.d.ts +1 -2
  41. package/target/structure/errors.js +1 -2
  42. package/target/structure/execs.d.ts +2 -3
  43. package/target/structure/execs.js +0 -1
  44. package/target/structure/feeds.d.ts +1 -2
  45. package/target/structure/feeds.js +1 -2
  46. package/target/structure/forEach.d.ts +1 -2
  47. package/target/structure/forEach.js +1 -2
  48. package/target/structure/forever.d.ts +0 -1
  49. package/target/structure/forever.js +0 -1
  50. package/target/structure/groups.d.ts +0 -1
  51. package/target/structure/groups.js +1 -2
  52. package/target/structure/index.d.ts +0 -1
  53. package/target/structure/index.js +0 -1
  54. package/target/structure/jvmStructureBuilder.d.ts +0 -1
  55. package/target/structure/jvmStructureBuilder.js +0 -1
  56. package/target/structure/paces.d.ts +1 -2
  57. package/target/structure/paces.js +1 -2
  58. package/target/structure/randomSwitch.d.ts +1 -2
  59. package/target/structure/randomSwitch.js +0 -1
  60. package/target/structure/randomSwitchOrElse.d.ts +1 -2
  61. package/target/structure/randomSwitchOrElse.js +0 -1
  62. package/target/structure/rendezVous.d.ts +0 -1
  63. package/target/structure/rendezVous.js +0 -1
  64. package/target/structure/repeat.d.ts +1 -2
  65. package/target/structure/repeat.js +1 -2
  66. package/target/structure/roundRobinSwitch.d.ts +1 -2
  67. package/target/structure/roundRobinSwitch.js +0 -1
  68. package/target/structure/uniformRandomSwitch.d.ts +1 -2
  69. package/target/structure/uniformRandomSwitch.js +0 -1
  70. package/target/throttling.d.ts +5 -3
@@ -1,6 +1,5 @@
1
- import "@gatling.io/jvm-types";
2
- import { Wrapper } from "./common";
3
1
  import { Duration } from "./utils/duration";
2
+ import { Wrapper } from "./common";
4
3
  import JvmOpenInjectionStep = io.gatling.javaapi.core.OpenInjectionStep;
5
4
  import JvmOpenInjectionStepRamp = io.gatling.javaapi.core.OpenInjectionStep$Ramp;
6
5
  import JvmOpenInjectionStepStressPeak = io.gatling.javaapi.core.OpenInjectionStep$StressPeak;
@@ -9,43 +8,182 @@ import JvmOpenInjectionStepRampRate = io.gatling.javaapi.core.OpenInjectionStep$
9
8
  import JvmOpenInjectionStepRampRateDuring = io.gatling.javaapi.core.RampRate$During;
10
9
  import JvmOpenInjectionStepStairs = io.gatling.javaapi.core.OpenInjectionStep$Stairs;
11
10
  import JvmOpenInjectionStepStairsTimes = io.gatling.javaapi.core.Stairs$Times;
11
+ /**
12
+ * An injection profile step for using an open workload model where you control the arrival rate of
13
+ * new users. In 99.99% of the cases, the right choice, over closed workload model.
14
+ *
15
+ * <p>Immutable, so all methods return a new occurrence and leave the original unmodified.
16
+ */
12
17
  export interface OpenInjectionStep extends Wrapper<JvmOpenInjectionStep> {
13
18
  }
14
19
  export interface ConstantRateOpenInjectionStep extends OpenInjectionStep {
15
20
  randomized(): OpenInjectionStep;
16
21
  }
22
+ /**
23
+ * A DSL for creating a {@link OpenInjectionStep} that will inject a stock of users distributed
24
+ * evenly on a given period of time. Strictly equivalent to {@link ConstantRateOpenInjectionStep}
25
+ */
17
26
  export interface OpenInjectionStepRamp extends Wrapper<JvmOpenInjectionStepRamp> {
27
+ /**
28
+ * Define the duration of the ramp
29
+ *
30
+ * @param duration - the ramp duration
31
+ * @returns a new OpenInjectionStep
32
+ */
18
33
  during(duration: Duration): OpenInjectionStep;
19
34
  }
35
+ /**
36
+ * A DSL for creating a {@link OpenInjectionStep} that will inject a stock of users distributed
37
+ * with a <a hreh="https://en.wikipedia.org/wiki/Heaviside_step_function">Heaviside</a>
38
+ * distribution on a given period of time. Strictly equivalent to {@link OpenInjectionStepConstantRate}
39
+ */
20
40
  export interface OpenInjectionStepStressPeak extends Wrapper<JvmOpenInjectionStepStressPeak> {
41
+ /**
42
+ * Define the duration of the Heaviside distribution
43
+ *
44
+ * @param duration - the duration
45
+ * @returns a new OpenInjectionStep
46
+ */
21
47
  during(duration: Duration): OpenInjectionStep;
22
48
  }
49
+ /**
50
+ * A DSL for creating a {@link OpenInjectionStep} that will inject users at a constant rate for a
51
+ * given duration.
52
+ */
23
53
  export interface OpenInjectionStepConstantRate extends Wrapper<JvmOpenInjectionStepConstantRate> {
54
+ /**
55
+ * Define the duration of the step
56
+ *
57
+ * @param duration - the duration
58
+ * @returns a new OpenInjectionStep
59
+ */
24
60
  during(duration: Duration): ConstantRateOpenInjectionStep;
25
61
  }
62
+ /**
63
+ * A DSL for creating a {@link OpenInjectionStep} that will inject users at a rate that will
64
+ * increase linearly for a given duration.
65
+ */
26
66
  export interface OpenInjectionStepRampRate extends Wrapper<JvmOpenInjectionStepRampRate> {
67
+ /**
68
+ * Define the target rate at the end of the ramp
69
+ *
70
+ * @param to - the target rate
71
+ * @returns the next DSL step
72
+ */
27
73
  to(to: number): OpenInjectionStepRampRateDuring;
28
74
  }
75
+ /**
76
+ * A DSL for creating a {@link OpenInjectionStep} that will inject users at a rate that will
77
+ * increase linearly for a given duration.
78
+ */
29
79
  export interface OpenInjectionStepRampRateDuring extends Wrapper<JvmOpenInjectionStepRampRateDuring> {
80
+ /**
81
+ * Define the duration of the ramp
82
+ *
83
+ * @param duration - the duration
84
+ * @returns a new OpenInjectionStep
85
+ */
30
86
  during(duration: Duration): RampRateOpenInjectionStep;
31
87
  }
88
+ /**
89
+ * A special {@link OpenInjectionStep} that supports "randomized".
90
+ */
32
91
  export interface RampRateOpenInjectionStep extends OpenInjectionStep {
33
92
  randomized(): OpenInjectionStep;
34
93
  }
94
+ /**
95
+ * A DSL for creating a {@link OpenInjectionStep} that will inject users with stairs rates.
96
+ */
35
97
  export interface OpenInjectionStepStairs extends Wrapper<JvmOpenInjectionStepStairs> {
98
+ /**
99
+ * Define the number of levels
100
+ *
101
+ * @param levels - the number of levels in the stairs
102
+ * @returns the next DSL step
103
+ */
36
104
  times(levels: number): OpenInjectionStepStairsTimes;
37
105
  }
106
+ /**
107
+ * A DSL for creating a {@link OpenInjectionStep} that will inject users with stairs rates.
108
+ */
38
109
  export interface OpenInjectionStepStairsTimes extends Wrapper<JvmOpenInjectionStepStairsTimes> {
110
+ /**
111
+ * Define the duration of each level
112
+ *
113
+ * @param duration - the duration
114
+ * @returns the next DSL step
115
+ */
39
116
  eachLevelLasting(duration: Duration): OpenInjectionStepStairsComposite;
40
117
  }
118
+ /**
119
+ * A DSL for creating a {@link OpenInjectionStep} that will inject users with stairs rates.
120
+ */
41
121
  export interface OpenInjectionStepStairsComposite extends OpenInjectionStep {
122
+ /**
123
+ * Define the initial number of users per second rate (optional)
124
+ *
125
+ * @param startingRate - the initial rate
126
+ * @returns a usable {@link OpenInjectionStep}
127
+ */
42
128
  startingFrom(startingRate: number): OpenInjectionStepStairsComposite;
129
+ /**
130
+ * Define ramps separating levels (optional)
131
+ *
132
+ * @param duration - the duration
133
+ * @returns a usable {@link OpenInjectionStep}
134
+ */
43
135
  separatedByRampsLasting(duration: Duration): OpenInjectionStepStairsComposite;
44
136
  }
137
+ /**
138
+ * Bootstrap a new open workload rampUsers injection profile, see {@link OpenInjectionStepRamp}
139
+ *
140
+ * @param users - the total number of users to inject
141
+ * @returns the next DSL step
142
+ */
45
143
  export declare const rampUsers: (users: number) => OpenInjectionStepRamp;
144
+ /**
145
+ * Bootstrap a new open workload stress peak injection profile, see {@link
146
+ * OpenInjectionStepStressPeak}
147
+ *
148
+ * @param users - the total number of users to inject
149
+ * @returns the next DSL step
150
+ */
46
151
  export declare const stressPeakUsers: (users: number) => OpenInjectionStepStressPeak;
152
+ /**
153
+ * Inject a bunch of users at the same time.
154
+ *
155
+ * @param users - the number of users to inject
156
+ * @returns a new OpenInjectionStep
157
+ */
47
158
  export declare const atOnceUsers: (users: number) => OpenInjectionStep;
159
+ /**
160
+ * Bootstrap a new open workload constantUsersPerSec injection profile, see {@link
161
+ * OpenInjectionStepConstantRate}
162
+ *
163
+ * @param rate - the users per second rate
164
+ * @returns the next DSL step
165
+ */
48
166
  export declare const constantUsersPerSec: (rate: number) => OpenInjectionStepConstantRate;
167
+ /**
168
+ * Bootstrap a new open workload rampUsersPerSec injection profile, see {@link
169
+ * OpenInjectionStepRampRate}
170
+ *
171
+ * @param rate - the users per second start rate
172
+ * @returns the next DSL step
173
+ */
49
174
  export declare const rampUsersPerSec: (rate: number) => OpenInjectionStepRampRate;
175
+ /**
176
+ * Don't inject any new user for a given duration
177
+ *
178
+ * @param duration - the duration
179
+ * @returns a new OpenInjectionStep
180
+ */
50
181
  export declare const nothingFor: (duration: Duration) => OpenInjectionStep;
182
+ /**
183
+ * Bootstrap a new open workload incrementUsersPerSec injection profile, see {@link
184
+ * OpenInjectionStepStairs}
185
+ *
186
+ * @param rateIncrement - the difference of users per second rate between levels of the stairs
187
+ * @returns the next DSL step
188
+ */
51
189
  export declare const incrementUsersPerSec: (rateIncrement: number) => OpenInjectionStepStairs;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.incrementUsersPerSec = exports.nothingFor = exports.rampUsersPerSec = exports.constantUsersPerSec = exports.atOnceUsers = exports.stressPeakUsers = exports.rampUsers = void 0;
4
- require("@gatling.io/jvm-types");
5
4
  const jvm_types_1 = require("@gatling.io/jvm-types");
6
5
  const duration_1 = require("./utils/duration");
7
6
  const wrapOpenInjectionStep = (_underlying) => ({ _underlying });
@@ -46,17 +45,63 @@ const wrapOpenInjectionStepStairsComposite = (_underlying) => ({
46
45
  startingFrom: (startingRate) => wrapOpenInjectionStepStairsComposite(_underlying.startingFrom(startingRate)),
47
46
  separatedByRampsLasting: (duration) => wrapOpenInjectionStepStairsComposite(_underlying.separatedByRampsLasting((0, duration_1.toJvmDuration)(duration)))
48
47
  });
48
+ /**
49
+ * Bootstrap a new open workload rampUsers injection profile, see {@link OpenInjectionStepRamp}
50
+ *
51
+ * @param users - the total number of users to inject
52
+ * @returns the next DSL step
53
+ */
49
54
  const rampUsers = (users) => wrapOpenInjectionStepRamp(jvm_types_1.CoreDsl.rampUsers(users));
50
55
  exports.rampUsers = rampUsers;
56
+ /**
57
+ * Bootstrap a new open workload stress peak injection profile, see {@link
58
+ * OpenInjectionStepStressPeak}
59
+ *
60
+ * @param users - the total number of users to inject
61
+ * @returns the next DSL step
62
+ */
51
63
  const stressPeakUsers = (users) => wrapOpenInjectionStepStressPeak(jvm_types_1.CoreDsl.stressPeakUsers(users));
52
64
  exports.stressPeakUsers = stressPeakUsers;
65
+ /**
66
+ * Inject a bunch of users at the same time.
67
+ *
68
+ * @param users - the number of users to inject
69
+ * @returns a new OpenInjectionStep
70
+ */
53
71
  const atOnceUsers = (users) => wrapOpenInjectionStep(jvm_types_1.CoreDsl.atOnceUsers(users));
54
72
  exports.atOnceUsers = atOnceUsers;
73
+ /**
74
+ * Bootstrap a new open workload constantUsersPerSec injection profile, see {@link
75
+ * OpenInjectionStepConstantRate}
76
+ *
77
+ * @param rate - the users per second rate
78
+ * @returns the next DSL step
79
+ */
55
80
  const constantUsersPerSec = (rate) => wrapOpenInjectionStepConstantRate(jvm_types_1.CoreDsl.constantUsersPerSec(rate));
56
81
  exports.constantUsersPerSec = constantUsersPerSec;
82
+ /**
83
+ * Bootstrap a new open workload rampUsersPerSec injection profile, see {@link
84
+ * OpenInjectionStepRampRate}
85
+ *
86
+ * @param rate - the users per second start rate
87
+ * @returns the next DSL step
88
+ */
57
89
  const rampUsersPerSec = (rate) => wrapOpenInjectionStepRampRate(jvm_types_1.CoreDsl.rampUsersPerSec(rate));
58
90
  exports.rampUsersPerSec = rampUsersPerSec;
91
+ /**
92
+ * Don't inject any new user for a given duration
93
+ *
94
+ * @param duration - the duration
95
+ * @returns a new OpenInjectionStep
96
+ */
59
97
  const nothingFor = (duration) => wrapOpenInjectionStep(jvm_types_1.CoreDsl.nothingFor((0, duration_1.toJvmDuration)(duration)));
60
98
  exports.nothingFor = nothingFor;
99
+ /**
100
+ * Bootstrap a new open workload incrementUsersPerSec injection profile, see {@link
101
+ * OpenInjectionStepStairs}
102
+ *
103
+ * @param rateIncrement - the difference of users per second rate between levels of the stairs
104
+ * @returns the next DSL step
105
+ */
61
106
  const incrementUsersPerSec = (rateIncrement) => wrapOpenInjectionStepStairs(jvm_types_1.CoreDsl.incrementUsersPerSec(rateIncrement));
62
107
  exports.incrementUsersPerSec = incrementUsersPerSec;
@@ -1,11 +1,10 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmPopulationBuilder = io.gatling.javaapi.core.PopulationBuilder;
1
+ import { Duration } from "./utils/duration";
2
+ import { PauseType } from "./structure/pauses";
3
3
  import { Wrapper } from "./common";
4
4
  import { ProtocolBuilder } from "./protocol";
5
5
  import { SessionTo } from "./session";
6
- import { Duration } from "./utils/duration";
7
- import { PauseType } from "./structure/pauses";
8
6
  import { ThrottleStep } from "./throttling";
7
+ import JvmPopulationBuilder = io.gatling.javaapi.core.PopulationBuilder;
9
8
  /**
10
9
  * A builder for a Population = a Scenario + an injection profile.
11
10
  *
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.wrapPopulationBuilder = void 0;
4
- require("@gatling.io/jvm-types");
5
- const session_1 = require("./session");
4
+ const callbacks_1 = require("./gatlingJvm/callbacks");
6
5
  const duration_1 = require("./utils/duration");
7
6
  const pauses_1 = require("./structure/pauses");
8
- const callbacks_1 = require("./gatlingJvm/callbacks");
7
+ const session_1 = require("./session");
9
8
  const wrapPopulationBuilder = (_underlying) => ({
10
9
  _underlying,
11
10
  protocols: (...protocols) => (0, exports.wrapPopulationBuilder)(_underlying.protocols(protocols.map((p) => p._underlying))),
@@ -1,5 +1,4 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmProtocolBuilder = io.gatling.javaapi.core.ProtocolBuilder;
3
1
  import { Wrapper } from "./common";
2
+ import JvmProtocolBuilder = io.gatling.javaapi.core.ProtocolBuilder;
4
3
  export interface ProtocolBuilder extends Wrapper<JvmProtocolBuilder> {
5
4
  }
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- require("@gatling.io/jvm-types");
@@ -1,10 +1,20 @@
1
- import "@gatling.io/jvm-types";
2
- import { StructureBuilder } from "./structure";
3
1
  import { ClosedInjectionStep } from "./closedInjection";
4
2
  import { OpenInjectionStep } from "./openInjection";
5
3
  import { PopulationBuilder } from "./population";
4
+ import { StructureBuilder } from "./structure";
5
+ /**
6
+ * Javascript wrapper of a Java ScenarioBuilder.
7
+ *
8
+ * <p>Immutable, so all methods return a new occurrence and leave the original unmodified.
9
+ */
6
10
  export interface ScenarioBuilder extends StructureBuilder<ScenarioBuilder> {
7
11
  injectOpen(...steps: OpenInjectionStep[]): PopulationBuilder;
8
12
  injectClosed(...steps: ClosedInjectionStep[]): PopulationBuilder;
9
13
  }
14
+ /**
15
+ * Create a new immutable Scenario builder
16
+ *
17
+ * @param name - the scenario name
18
+ * @returns a new Scenario builder
19
+ */
10
20
  export declare const scenario: (name: string) => ScenarioBuilder;
@@ -1,15 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scenario = void 0;
4
- require("@gatling.io/jvm-types");
5
4
  const jvm_types_1 = require("@gatling.io/jvm-types");
6
- const structure_1 = require("./structure");
7
5
  const population_1 = require("./population");
6
+ const structure_1 = require("./structure");
8
7
  const wrapScenarioBuilder = (jvmScenarioBuilder) => ({
9
8
  injectOpen: (...steps) => (0, population_1.wrapPopulationBuilder)(jvmScenarioBuilder.injectOpen(steps.map((s) => s._underlying))),
10
9
  injectClosed: (...steps) => (0, population_1.wrapPopulationBuilder)(jvmScenarioBuilder.injectClosed(steps.map((s) => s._underlying))),
11
10
  ...(0, structure_1.structureBuilderImpl)(jvmScenarioBuilder, wrapScenarioBuilder)
12
11
  });
12
+ /**
13
+ * Create a new immutable Scenario builder
14
+ *
15
+ * @param name - the scenario name
16
+ * @returns a new Scenario builder
17
+ */
13
18
  const scenario = (name) => {
14
19
  const jvmScenarioBuilder = jvm_types_1.CoreDsl.scenario(name);
15
20
  return wrapScenarioBuilder(jvmScenarioBuilder);
@@ -1,21 +1,110 @@
1
1
  import { Duration } from "./utils/duration";
2
2
  import { Wrapper } from "./common";
3
3
  import JvmSession = io.gatling.javaapi.core.Session;
4
+ /**
5
+ * The state of a given virtual user.
6
+ *
7
+ * <p>Immutable, so all methods return a new occurrence and leave the original unmodified.
8
+ */
4
9
  export interface Session extends Wrapper<JvmSession> {
10
+ /**
11
+ * Get a stored value by its key
12
+ *
13
+ * @param key - the storage key
14
+ * @typeParam T - the type of the desired value
15
+ * @returns the value if it exists, null otherwise
16
+ */
5
17
  get<T>(key: string): T;
18
+ /**
19
+ * Create a new instance updated with a given attribute, possibly overriding an existing one
20
+ *
21
+ * @param key - the attribute key
22
+ * @param value - the attribute value
23
+ * @returns a new instance with the new stored attribute
24
+ */
6
25
  set(key: string, value: any): Session;
26
+ /**
27
+ * Create a new instance updated with a given byte array (number[]), possibly overriding an existing one
28
+ *
29
+ * @param key - the attribute key
30
+ * @param value - the attribute value
31
+ * @returns a new instance with the new stored attribute
32
+ */
7
33
  setByteArray(key: string, value: number[]): Session;
34
+ /**
35
+ * Create a new instance updated with multiple attributes, possibly overriding existing ones
36
+ *
37
+ * @param newAttributes - the new attributes
38
+ * @returns a new instance with the new stored attributes
39
+ */
8
40
  setAll(newAttributes: Record<string, any>): Session;
41
+ /**
42
+ * Create a new instance updated with an attribute removed
43
+ *
44
+ * @param key - the key of the attribute to remove
45
+ * @returns a new instance with the attribute removed
46
+ */
9
47
  remove(key: string): Session;
48
+ /**
49
+ * Create a new instance updated with all attributes removed except Gatling internal ones
50
+ *
51
+ * @returns a new instance with a reset user state
52
+ */
10
53
  reset(): Session;
54
+ /**
55
+ * Create a new instance updated with multiple attributes removed
56
+ *
57
+ * @param keys - the keys of the attributes to remove
58
+ * @returns a new instance with the attributes removed
59
+ */
11
60
  removeAll(...keys: string[]): Session;
61
+ /**
62
+ * Check if the Session contains a given attribute key
63
+ *
64
+ * @param key - the attribute key
65
+ * @returns true is the key is defined
66
+ */
12
67
  contains(key: string): boolean;
68
+ /**
69
+ * @returns if the Session's status is failure
70
+ */
13
71
  isFailed(): boolean;
72
+ /**
73
+ * Create a new instance with the status forced to "succeeded"
74
+ *
75
+ * @returns a new instance with the new status
76
+ */
14
77
  markAsSucceeded(): Session;
78
+ /**
79
+ * Create a new instance with the status forced to "failed"
80
+ *
81
+ * @returns a new instance with the new status
82
+ */
15
83
  markAsFailed(): Session;
84
+ /**
85
+ * Provide the name of the scenario of the virtual user
86
+ *
87
+ * @returns the virtual user's scenario name
88
+ */
16
89
  scenario(): string;
90
+ /**
91
+ * Provide the list of groups at the current position for the virtual user
92
+ *
93
+ * @returns the list of groups, from shallowest to deepest
94
+ */
17
95
  groups(): string[];
96
+ /**
97
+ * Provide the unique (for this injector) id of the virtual user
98
+ *
99
+ * @returns the virtual user's id
100
+ */
18
101
  userId(): number;
102
+ /**
103
+ * Provide a representation of the Session content
104
+ *
105
+ * @returns the Session content as a pretty printed string
106
+ */
107
+ toString(): string;
19
108
  }
20
109
  export declare const wrapSession: (_underlying: JvmSession) => Session;
21
110
  export type Expression<T> = T | ((session: Session) => T);
package/target/session.js CHANGED
@@ -27,7 +27,8 @@ const wrapSession = (_underlying) => ({
27
27
  markAsFailed: () => (0, exports.wrapSession)(_underlying.markAsFailed()),
28
28
  scenario: () => _underlying.scenario(),
29
29
  groups: () => _underlying.groups(),
30
- userId: () => _underlying.userId()
30
+ userId: () => _underlying.userId(),
31
+ toString: () => _underlying.toString()
31
32
  });
32
33
  exports.wrapSession = wrapSession;
33
34
  const underlyingSessionTransform = (f) => (jvmSession) => f((0, exports.wrapSession)(jvmSession))._underlying;
@@ -1,7 +1,6 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmAsLongAs = io.gatling.javaapi.core.loop.AsLongAs;
3
1
  import { SessionTo } from "../session";
4
2
  import { On } from "./on";
3
+ import JvmAsLongAs = io.gatling.javaapi.core.loop.AsLongAs;
5
4
  export interface AsLongAsFunction<T extends AsLongAs<T>> {
6
5
  /**
7
6
  * Define a loop that will iterate as long as the condition holds true
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.asLongAsImpl = void 0;
4
- require("@gatling.io/jvm-types");
5
- const session_1 = require("../session");
6
4
  const callbacks_1 = require("../gatlingJvm/callbacks");
5
+ const session_1 = require("../session");
7
6
  const on_1 = require("./on");
8
7
  const asLongAsImpl = (jvmAsLongAs, wrap) => (condition, arg1, arg2) => {
9
8
  if (arg2 !== undefined && typeof arg1 === "string") {
@@ -1,8 +1,7 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmAsLongAsDuring = io.gatling.javaapi.core.loop.AsLongAsDuring;
3
1
  import { Duration } from "../utils/duration";
4
2
  import { SessionTo } from "../session";
5
3
  import { On } from "./on";
4
+ import JvmAsLongAsDuring = io.gatling.javaapi.core.loop.AsLongAsDuring;
6
5
  export interface AsLongAsDuringFunction<T extends AsLongAsDuring<T>> {
7
6
  /**
8
7
  * Define a loop that will iterate as long as the condition holds true and a maximum duration
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.asLongAsDuringImpl = void 0;
4
- require("@gatling.io/jvm-types");
4
+ const callbacks_1 = require("../gatlingJvm/callbacks");
5
5
  const duration_1 = require("../utils/duration");
6
6
  const session_1 = require("../session");
7
- const callbacks_1 = require("../gatlingJvm/callbacks");
8
7
  const on_1 = require("./on");
9
8
  const asLongAsDuringImpl = (jvmAsLongAsDuring, wrap) => (condition, duration, arg2, arg3) => {
10
9
  if (arg3 !== undefined && typeof arg2 === "string") {
@@ -1,8 +1,7 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmChoiceWithKey = io.gatling.javaapi.core.Choice$WithKey;
3
- import JvmChoiceWithWeight = io.gatling.javaapi.core.Choice$WithWeight;
4
1
  import { Wrapper } from "../common";
5
2
  import { Executable } from "./execs";
3
+ import JvmChoiceWithKey = io.gatling.javaapi.core.Choice$WithKey;
4
+ import JvmChoiceWithWeight = io.gatling.javaapi.core.Choice$WithWeight;
6
5
  export interface ChoiceWithKey extends Wrapper<JvmChoiceWithKey> {
7
6
  }
8
7
  interface ChoiceWithKeyThen {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.percent = exports.onCase = void 0;
4
- require("@gatling.io/jvm-types");
5
4
  const jvm_types_1 = require("@gatling.io/jvm-types");
6
5
  const wrapChoiceWithKey = (_underlying) => ({
7
6
  _underlying
@@ -1,8 +1,7 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmDoIf = io.gatling.javaapi.core.condition.DoIf;
3
- import JvmDoIfEquals = io.gatling.javaapi.core.condition.DoIfEquals;
4
1
  import { SessionTo } from "../session";
5
2
  import { Executable } from "./execs";
3
+ import JvmDoIf = io.gatling.javaapi.core.condition.DoIf;
4
+ import JvmDoIfEquals = io.gatling.javaapi.core.condition.DoIfEquals;
6
5
  export interface Then<T> {
7
6
  then(executable: Executable<any>, ...executables: Executable<any>[]): T;
8
7
  }
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doIfEqualsImpl = exports.doIfImpl = void 0;
4
- require("@gatling.io/jvm-types");
5
- const session_1 = require("../session");
6
4
  const callbacks_1 = require("../gatlingJvm/callbacks");
5
+ const session_1 = require("../session");
7
6
  const wrapThen = (jvmThen, wrap) => ({
8
7
  then: (executable, ...executables) => wrap(jvmThen.then(executable._underlying, ...executables.map((e) => e._underlying)))
9
8
  });
@@ -1,8 +1,7 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmDoIfOrElse = io.gatling.javaapi.core.condition.DoIfOrElse;
3
- import JvmDoIfEqualsOrElse = io.gatling.javaapi.core.condition.DoIfEqualsOrElse;
4
1
  import { SessionTo } from "../session";
5
2
  import { Executable } from "./execs";
3
+ import JvmDoIfOrElse = io.gatling.javaapi.core.condition.DoIfOrElse;
4
+ import JvmDoIfEqualsOrElse = io.gatling.javaapi.core.condition.DoIfEqualsOrElse;
6
5
  export interface Then<T> {
7
6
  then(executable: Executable<any>, ...executables: Executable<any>[]): OrElse<T>;
8
7
  }
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doIfEqualsOrElseImpl = exports.doIfOrElseImpl = void 0;
4
- require("@gatling.io/jvm-types");
5
- const session_1 = require("../session");
6
4
  const callbacks_1 = require("../gatlingJvm/callbacks");
5
+ const session_1 = require("../session");
7
6
  const wrapThen = (jvmThen, wrap) => ({
8
7
  then: (executable, ...executables) => wrapOrElse(jvmThen.then(executable._underlying, ...executables.map((e) => e._underlying)), wrap)
9
8
  });
@@ -1,7 +1,6 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmDoSwitch = io.gatling.javaapi.core.condition.DoSwitch;
3
1
  import { SessionTo } from "../session";
4
2
  import { ChoiceWithKey } from "./choices";
3
+ import JvmDoSwitch = io.gatling.javaapi.core.condition.DoSwitch;
5
4
  export interface On<T> {
6
5
  on(...choices: ChoiceWithKey[]): T;
7
6
  }
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doSwitchImpl = void 0;
4
- require("@gatling.io/jvm-types");
5
- const session_1 = require("../session");
6
4
  const callbacks_1 = require("../gatlingJvm/callbacks");
5
+ const session_1 = require("../session");
7
6
  const wrapOn = (jvmOn, wrap) => ({
8
7
  on: (...choices) => wrap(jvmOn.on(choices.map((c) => c._underlying)))
9
8
  });
@@ -1,8 +1,7 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmDoSwitchOrElse = io.gatling.javaapi.core.condition.DoSwitchOrElse;
3
1
  import { SessionTo } from "../session";
4
2
  import { ChoiceWithKey } from "./choices";
5
3
  import { Executable } from "./execs";
4
+ import JvmDoSwitchOrElse = io.gatling.javaapi.core.condition.DoSwitchOrElse;
6
5
  export interface On<T> {
7
6
  on(...choices: ChoiceWithKey[]): OrElse<T>;
8
7
  }
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doSwitchOrElseImpl = void 0;
4
- require("@gatling.io/jvm-types");
5
- const session_1 = require("../session");
6
4
  const callbacks_1 = require("../gatlingJvm/callbacks");
5
+ const session_1 = require("../session");
7
6
  const wrapOn = (jvmOn, wrap) => ({
8
7
  on: (...choices) => wrapOrElse(jvmOn.on(choices.map((c) => c._underlying)), wrap)
9
8
  });
@@ -1,7 +1,6 @@
1
- import "@gatling.io/jvm-types";
2
- import JvmDoWhile = io.gatling.javaapi.core.loop.DoWhile;
3
1
  import { SessionTo } from "../session";
4
2
  import { On } from "./on";
3
+ import JvmDoWhile = io.gatling.javaapi.core.loop.DoWhile;
5
4
  export interface DoWhileFunction<T extends DoWhile<T>> {
6
5
  /**
7
6
  * Define a loop that will iterate as long as the condition holds true. The condition is evaluated
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doWhileImpl = void 0;
4
- require("@gatling.io/jvm-types");
5
- const session_1 = require("../session");
6
4
  const callbacks_1 = require("../gatlingJvm/callbacks");
5
+ const session_1 = require("../session");
7
6
  const on_1 = require("./on");
8
7
  const doWhileImpl = (jvmDoWhile, wrap) => (condition, counterName) => {
9
8
  if (counterName !== undefined) {