@gatling.io/grpc 3.14.600

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Gatling JS - gRPC module
2
+
3
+ Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).
4
+
5
+ This package contains the Gatling JS DSL for [the gRPC protocol](https://docs.gatling.io/reference/script/grpc/protocol/).
6
+
7
+ To get started with Gatling JS, see our [introduction to JavaScript scripting](https://docs.gatling.io/tutorials/scripting-intro-js);
8
+ or simply have a look at our demo projects:
9
+
10
+ - https://github.com/gatling/gatling-js-demo
11
+ - https://github.com/gatling/gatling-grpc-demo
12
+
13
+ ## Questions, help?
14
+
15
+ Read the [documentation](https://docs.gatling.io).
16
+
17
+ Join the [Gatling Community Forum](https://community.gatling.io).
18
+
19
+ Found a real bug? Raise an [issue](https://github.com/gatling/gatling/issues).
package/jest.config.js ADDED
@@ -0,0 +1,5 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@gatling.io/grpc",
3
+ "version": "3.14.600",
4
+ "license": "Apache-2.0",
5
+ "homepage": "https://gatling.io",
6
+ "repository": "github:gatling/gatling-js",
7
+ "bugs": "https://github.com/gatling/gatling/issues",
8
+ "keywords": [
9
+ "gatling",
10
+ "typescript",
11
+ "test",
12
+ "testing",
13
+ "loadtest",
14
+ "loadtesting",
15
+ "load test",
16
+ "load testing",
17
+ "performance test",
18
+ "performance testing"
19
+ ],
20
+ "main": "target/index.js",
21
+ "types": "target/index.d.ts",
22
+ "dependencies": {
23
+ "@gatling.io/core": "3.14.600",
24
+ "@gatling.io/jvm-types": "3.14.600"
25
+ },
26
+ "devDependencies": {
27
+ "@types/jest": "30.0.0",
28
+ "jest": "30.1.3",
29
+ "prettier": "3.6.2",
30
+ "rimraf": "6.0.1",
31
+ "ts-jest": "29.4.1",
32
+ "ts-node": "10.9.2",
33
+ "typescript": "5.9.2"
34
+ },
35
+ "scripts": {
36
+ "clean": "rimraf target",
37
+ "format": "prettier --write '**/*.ts'",
38
+ "format-check": "prettier --check '**/*.ts'",
39
+ "test": "jest",
40
+ "build": "tsc -p ."
41
+ }
42
+ }
@@ -0,0 +1,23 @@
1
+ import { ActionBuilder, CheckBuilder, Duration, Session } from "@gatling.io/core";
2
+ import { MessageResponseTimePolicy } from "./grpc";
3
+ import { GrpcHeaders } from "./headers";
4
+ import JvmDescriptorsDescriptor = com.google.protobuf.Descriptors$Descriptor;
5
+ import JvmGrpcBidirectionalStreamingServiceBuilder = io.gatling.javaapi.grpc.GrpcBidirectionalStreamingServiceBuilder;
6
+ export interface GrpcBidiStreamAwaitStreamEndActionBuilder extends ActionBuilder {
7
+ }
8
+ export interface GrpcBidirectionalStreamingServiceBuilder extends GrpcHeaders<GrpcBidirectionalStreamingServiceBuilder> {
9
+ check(...checks: CheckBuilder[]): GrpcBidirectionalStreamingServiceBuilder;
10
+ deadlineAfter(duration: Duration): GrpcBidirectionalStreamingServiceBuilder;
11
+ messageRequestName(messageRequestName: string): GrpcBidirectionalStreamingServiceBuilder;
12
+ messageRequestName(messageRequestName: (session: Session) => string): GrpcBidirectionalStreamingServiceBuilder;
13
+ messageResponseTimePolicy(messageResponseTimePolicy: MessageResponseTimePolicy): GrpcBidirectionalStreamingServiceBuilder;
14
+ streamName(streamName: string): GrpcBidirectionalStreamingServiceBuilder;
15
+ start(): ActionBuilder;
16
+ send(request: any): ActionBuilder;
17
+ send(request: (session: Session) => any): ActionBuilder;
18
+ halfClose(): ActionBuilder;
19
+ awaitStreamEnd(): GrpcBidiStreamAwaitStreamEndActionBuilder;
20
+ awaitStreamEnd(reconcile: (main: Session, forked: Session) => Session): GrpcBidiStreamAwaitStreamEndActionBuilder;
21
+ cancel(): ActionBuilder;
22
+ }
23
+ export declare const wrapGrpcBidirectionalStreamingServiceBuilder: (inputDescriptor: JvmDescriptorsDescriptor) => ((_underlying: JvmGrpcBidirectionalStreamingServiceBuilder<any, any>) => GrpcBidirectionalStreamingServiceBuilder);
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapGrpcBidirectionalStreamingServiceBuilder = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ const dynamic_1 = require("./dynamic");
6
+ const grpc_1 = require("./grpc");
7
+ const headers_1 = require("./headers");
8
+ const wrapGrpcBidiStreamAwaitStreamEndActionBuilder = (_underlying) => (0, core_1.wrapActionBuilder)(_underlying);
9
+ const wrapGrpcBidirectionalStreamingServiceBuilder = (inputDescriptor) => (_underlying) => {
10
+ const toJvmDynamicMessage = (0, dynamic_1.wrapToJvmDynamicMessage)(inputDescriptor);
11
+ const wrap = (0, exports.wrapGrpcBidirectionalStreamingServiceBuilder)(inputDescriptor);
12
+ return {
13
+ ...(0, headers_1.wrapGrpcHeaders)(_underlying, wrap),
14
+ // Chainable methods / global stream configuration
15
+ // FIXME callCredentials
16
+ check: (...checks) => wrap(_underlying.check(checks.map((check) => check._underlying))),
17
+ deadlineAfter: (duration) => {
18
+ if ((0, core_1.isDuration)(duration)) {
19
+ return wrap(_underlying.deadlineAfter((0, core_1.toJvmDuration)(duration)));
20
+ }
21
+ throw Error(`deadlineAfter() called with invalid argument ${duration}`);
22
+ },
23
+ messageRequestName: (messageRequestName) => wrap(typeof messageRequestName === "function"
24
+ ? _underlying.messageRequestName((0, core_1.underlyingSessionTo)(messageRequestName))
25
+ : _underlying.messageRequestName(messageRequestName)),
26
+ messageResponseTimePolicy: (messageResponseTimePolicy) => wrap(_underlying.messageResponseTimePolicy((0, grpc_1.toJvmMessageResponseTimePolicy)(messageResponseTimePolicy))),
27
+ streamName: (streamName) => wrap(_underlying.streamName(streamName)),
28
+ // Terminal methods / specific actions
29
+ start: () => (0, core_1.wrapActionBuilder)(_underlying.start()),
30
+ send: (request) => {
31
+ return (0, core_1.wrapActionBuilder)(typeof request === "function"
32
+ ? _underlying.send((0, dynamic_1.underlyingSessionToJvmDynamicMessage)(request, toJvmDynamicMessage))
33
+ : _underlying.send(toJvmDynamicMessage(request)));
34
+ },
35
+ halfClose: () => (0, core_1.wrapActionBuilder)(_underlying.halfClose()),
36
+ awaitStreamEnd: (reconcile) => wrapGrpcBidiStreamAwaitStreamEndActionBuilder(typeof reconcile === "function"
37
+ ? _underlying.awaitStreamEnd((0, core_1.underlyingBiSessionTransform)(reconcile))
38
+ : _underlying.awaitStreamEnd()),
39
+ cancel: () => (0, core_1.wrapActionBuilder)(_underlying.cancel())
40
+ };
41
+ };
42
+ exports.wrapGrpcBidirectionalStreamingServiceBuilder = wrapGrpcBidirectionalStreamingServiceBuilder;
@@ -0,0 +1,9 @@
1
+ import { CheckBuilderFind, CheckBuilderMultipleFind } from "@gatling.io/core";
2
+ import { Status } from "./grpc";
3
+ export declare const statusCode: () => CheckBuilderFind<Status.Code>;
4
+ export declare const statusDescription: () => CheckBuilderFind<string>;
5
+ export declare const asciiHeader: (key: string) => CheckBuilderMultipleFind<string>;
6
+ export declare const binaryHeader: (key: string) => CheckBuilderMultipleFind<number[]>;
7
+ export declare const asciiTrailer: (key: string) => CheckBuilderMultipleFind<string>;
8
+ export declare const binaryTrailer: (key: string) => CheckBuilderMultipleFind<number[]>;
9
+ export declare const response: (transform: (x: any) => any) => CheckBuilderFind<any>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.response = exports.binaryTrailer = exports.asciiTrailer = exports.binaryHeader = exports.asciiHeader = exports.statusDescription = exports.statusCode = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ const jvm_types_1 = require("@gatling.io/jvm-types");
6
+ const dynamic_1 = require("./dynamic");
7
+ const grpc_1 = require("./grpc");
8
+ const statusCode = () => (0, core_1.wrapCheckBuilderFind)(grpc_1.GrpcDslAddons.statusCodeAsString());
9
+ exports.statusCode = statusCode;
10
+ const statusDescription = () => (0, core_1.wrapCheckBuilderFind)(jvm_types_1.GrpcDsl.statusDescription());
11
+ exports.statusDescription = statusDescription;
12
+ const asciiHeader = (key) => (0, core_1.wrapCheckBuilderMultipleFind)(jvm_types_1.GrpcDsl.asciiHeader(key));
13
+ exports.asciiHeader = asciiHeader;
14
+ // FIXME Uint8Array?
15
+ const binaryHeader = (key) => (0, core_1.wrapCheckBuilderMultipleFind)(jvm_types_1.GrpcDsl.binaryHeader(key));
16
+ exports.binaryHeader = binaryHeader;
17
+ const asciiTrailer = (key) => (0, core_1.wrapCheckBuilderMultipleFind)(jvm_types_1.GrpcDsl.asciiTrailer(key));
18
+ exports.asciiTrailer = asciiTrailer;
19
+ const binaryTrailer = (key) => (0, core_1.wrapCheckBuilderMultipleFind)(jvm_types_1.GrpcDsl.binaryTrailer(key));
20
+ exports.binaryTrailer = binaryTrailer;
21
+ const response = (transform) => (0, core_1.wrapCheckBuilderFind)(jvm_types_1.GrpcDsl.response((0, dynamic_1.transformJvmDynamicMessage)(transform)));
22
+ exports.response = response;
@@ -0,0 +1,23 @@
1
+ import { ActionBuilder, CheckBuilder, Duration, Session } from "@gatling.io/core";
2
+ import { GrpcHeaders } from "./headers";
3
+ import { MessageResponseTimePolicy } from "./grpc";
4
+ import JvmDescriptorsDescriptor = com.google.protobuf.Descriptors$Descriptor;
5
+ import JvmGrpcClientStreamingServiceBuilder = io.gatling.javaapi.grpc.GrpcClientStreamingServiceBuilder;
6
+ export interface GrpcClientStreamAwaitStreamEndActionBuilder extends ActionBuilder {
7
+ }
8
+ export interface GrpcClientStreamingServiceBuilder extends GrpcHeaders<GrpcClientStreamingServiceBuilder> {
9
+ check(...checks: CheckBuilder[]): GrpcClientStreamingServiceBuilder;
10
+ deadlineAfter(duration: Duration): GrpcClientStreamingServiceBuilder;
11
+ messageRequestName(messageRequestName: string): GrpcClientStreamingServiceBuilder;
12
+ messageRequestName(messageRequestName: (session: Session) => string): GrpcClientStreamingServiceBuilder;
13
+ messageResponseTimePolicy(messageResponseTimePolicy: MessageResponseTimePolicy): GrpcClientStreamingServiceBuilder;
14
+ streamName(streamName: string): GrpcClientStreamingServiceBuilder;
15
+ start(): ActionBuilder;
16
+ send(request: any): ActionBuilder;
17
+ send(request: (session: Session) => any): ActionBuilder;
18
+ halfClose(): ActionBuilder;
19
+ awaitStreamEnd(): GrpcClientStreamAwaitStreamEndActionBuilder;
20
+ awaitStreamEnd(reconcile: (main: Session, forked: Session) => Session): GrpcClientStreamAwaitStreamEndActionBuilder;
21
+ cancel(): ActionBuilder;
22
+ }
23
+ export declare const wrapGrpcClientStreamingServiceBuilder: (inputDescriptor: JvmDescriptorsDescriptor) => ((_underlying: JvmGrpcClientStreamingServiceBuilder<any, any>) => GrpcClientStreamingServiceBuilder);
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapGrpcClientStreamingServiceBuilder = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ const dynamic_1 = require("./dynamic");
6
+ const headers_1 = require("./headers");
7
+ const grpc_1 = require("./grpc");
8
+ const wrapGrpcClientStreamAwaitStreamEndActionBuilder = (_underlying) => (0, core_1.wrapActionBuilder)(_underlying);
9
+ const wrapGrpcClientStreamingServiceBuilder = (inputDescriptor) => (_underlying) => {
10
+ const toJvmDynamicMessage = (0, dynamic_1.wrapToJvmDynamicMessage)(inputDescriptor);
11
+ const wrap = (0, exports.wrapGrpcClientStreamingServiceBuilder)(inputDescriptor);
12
+ return {
13
+ ...(0, headers_1.wrapGrpcHeaders)(_underlying, wrap),
14
+ // Chainable methods / global stream configuration
15
+ // FIXME callCredentials
16
+ check: (...checks) => wrap(_underlying.check(checks.map((check) => check._underlying))),
17
+ deadlineAfter: (duration) => {
18
+ if ((0, core_1.isDuration)(duration)) {
19
+ return wrap(_underlying.deadlineAfter((0, core_1.toJvmDuration)(duration)));
20
+ }
21
+ throw Error(`deadlineAfter() called with invalid argument ${duration}`);
22
+ },
23
+ messageRequestName: (messageRequestName) => wrap(typeof messageRequestName === "function"
24
+ ? _underlying.messageRequestName((0, core_1.underlyingSessionTo)(messageRequestName))
25
+ : _underlying.messageRequestName(messageRequestName)),
26
+ messageResponseTimePolicy: (messageResponseTimePolicy) => wrap(_underlying.messageResponseTimePolicy((0, grpc_1.toJvmMessageResponseTimePolicy)(messageResponseTimePolicy))),
27
+ streamName: (streamName) => wrap(_underlying.streamName(streamName)),
28
+ // Terminal methods / specific actions
29
+ start: () => (0, core_1.wrapActionBuilder)(_underlying.start()),
30
+ send: (request) => {
31
+ return (0, core_1.wrapActionBuilder)(typeof request === "function"
32
+ ? _underlying.send((0, dynamic_1.underlyingSessionToJvmDynamicMessage)(request, toJvmDynamicMessage))
33
+ : _underlying.send(toJvmDynamicMessage(request)));
34
+ },
35
+ halfClose: () => (0, core_1.wrapActionBuilder)(_underlying.halfClose()),
36
+ awaitStreamEnd: (reconcile) => wrapGrpcClientStreamAwaitStreamEndActionBuilder(typeof reconcile === "function"
37
+ ? _underlying.awaitStreamEnd((0, core_1.underlyingBiSessionTransform)(reconcile))
38
+ : _underlying.awaitStreamEnd()),
39
+ cancel: () => (0, core_1.wrapActionBuilder)(_underlying.cancel())
40
+ };
41
+ };
42
+ exports.wrapGrpcClientStreamingServiceBuilder = wrapGrpcClientStreamingServiceBuilder;
@@ -0,0 +1,17 @@
1
+ import { SessionTo } from "@gatling.io/core";
2
+ import JvmDescriptorsDescriptor = com.google.protobuf.Descriptors$Descriptor;
3
+ import JvmSession = io.gatling.javaapi.core.Session;
4
+ export interface JvmGrpcMethodDescriptorWrapper {
5
+ inputDescriptor(): JvmDescriptorsDescriptor;
6
+ outputDescriptor(): JvmDescriptorsDescriptor;
7
+ descriptor(): any;
8
+ }
9
+ export interface JvmGrpcDynamicStatic {
10
+ convertFromMessage(message: any): Record<string, any>;
11
+ convertToMessage(input: Record<string, any>, descriptor: JvmDescriptorsDescriptor): any;
12
+ loadMethodDescriptor(pkg: string | null, service: string, method: string): JvmGrpcMethodDescriptorWrapper;
13
+ }
14
+ export declare const GrpcDynamic: JvmGrpcDynamicStatic;
15
+ export declare const transformJvmDynamicMessage: (f: (x: any) => any) => ((dynamicMessage: any) => any);
16
+ export declare const wrapToJvmDynamicMessage: (inputDescriptor: JvmDescriptorsDescriptor) => (request: Record<string, any>) => any;
17
+ export declare const underlyingSessionToJvmDynamicMessage: (f: SessionTo<any>, toJvmDynamicMessage: (request: any) => any) => ((jvmSession: JvmSession) => any);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.underlyingSessionToJvmDynamicMessage = exports.wrapToJvmDynamicMessage = exports.transformJvmDynamicMessage = exports.GrpcDynamic = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ exports.GrpcDynamic = Java.type("io.gatling.javaapi.grpc.GrpcDynamic");
6
+ const transformJvmDynamicMessage = (f) => (dynamicMessage) => f(exports.GrpcDynamic.convertFromMessage(dynamicMessage));
7
+ exports.transformJvmDynamicMessage = transformJvmDynamicMessage;
8
+ const wrapToJvmDynamicMessage = (inputDescriptor) => (request) => exports.GrpcDynamic.convertToMessage(request, inputDescriptor);
9
+ exports.wrapToJvmDynamicMessage = wrapToJvmDynamicMessage;
10
+ const underlyingSessionToJvmDynamicMessage = (f, toJvmDynamicMessage) => (jvmSession) => toJvmDynamicMessage(f((0, core_1.wrapSession)(jvmSession)));
11
+ exports.underlyingSessionToJvmDynamicMessage = underlyingSessionToJvmDynamicMessage;
@@ -0,0 +1,151 @@
1
+ import { SessionTo } from "@gatling.io/core";
2
+ import JvmChannelCredentials = io.grpc.ChannelCredentials;
3
+ import JvmCheckBuilderFind = io.gatling.javaapi.core.CheckBuilder$Find;
4
+ import JvmGrpcDslMessageResponseTimePolicy = io.gatling.javaapi.grpc.GrpcDsl$MessageResponseTimePolicy;
5
+ import JvmGrpcProtocolBuilder = io.gatling.javaapi.grpc.GrpcProtocolBuilder;
6
+ import JvmSession = io.gatling.javaapi.core.Session;
7
+ export interface GrpcDslAddonsStatic {
8
+ statusCodeAsString(): JvmCheckBuilderFind<Status.Code>;
9
+ channelCredentials(rootCerts?: string, certChain?: string, privateKey?: string): JvmChannelCredentials;
10
+ channelCredentialsEL(protocol: JvmGrpcProtocolBuilder, credentials: string): JvmGrpcProtocolBuilder;
11
+ }
12
+ export declare const GrpcDslAddons: GrpcDslAddonsStatic;
13
+ export interface CallCredentials {
14
+ }
15
+ export interface ChannelCredentials {
16
+ rootCerts?: string;
17
+ certChain?: string;
18
+ privateKey?: string;
19
+ }
20
+ export declare const toJvmCredentials: (credentials: ChannelCredentials) => JvmChannelCredentials;
21
+ export declare const underlyingSessionToCredentials: (f: SessionTo<ChannelCredentials>) => ((jvmSession: JvmSession) => JvmChannelCredentials);
22
+ export type MessageResponseTimePolicy = "FROM_STREAM_START" | "FROM_LAST_MESSAGE_SENT" | "FROM_LAST_MESSAGE_RECEIVED";
23
+ export declare const toJvmMessageResponseTimePolicy: (policy: MessageResponseTimePolicy) => JvmGrpcDslMessageResponseTimePolicy;
24
+ export declare namespace Status {
25
+ type Code =
26
+ /**
27
+ * The operation completed successfully.
28
+ */
29
+ "OK"
30
+ /**
31
+ * The operation was cancelled (typically by the caller).
32
+ */
33
+ | "CANCELLED"
34
+ /**
35
+ * Unknown error. An example of where this error may be returned is
36
+ * if a Status value received from another address space belongs to
37
+ * an error-space that is not known in this address space. Also
38
+ * errors raised by APIs that do not return enough error information
39
+ * may be converted to this error.
40
+ */
41
+ | "UNKNOWN"
42
+ /**
43
+ * Client specified an invalid argument. Note that this differs
44
+ * from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
45
+ * that are problematic regardless of the state of the system
46
+ * (e.g., a malformed file name).
47
+ */
48
+ | "INVALID_ARGUMENT"
49
+ /**
50
+ * Deadline expired before operation could complete. For operations
51
+ * that change the state of the system, this error may be returned
52
+ * even if the operation has completed successfully. For example, a
53
+ * successful response from a server could have been delayed long
54
+ * enough for the deadline to expire.
55
+ */
56
+ | "DEADLINE_EXCEEDED"
57
+ /**
58
+ * Some requested entity (e.g., file or directory) was not found.
59
+ */
60
+ | "NOT_FOUND"
61
+ /**
62
+ * Some entity that we attempted to create (e.g., file or directory) already exists.
63
+ */
64
+ | "ALREADY_EXISTS"
65
+ /**
66
+ * The caller does not have permission to execute the specified
67
+ * operation. PERMISSION_DENIED must not be used for rejections
68
+ * caused by exhausting some resource (use RESOURCE_EXHAUSTED
69
+ * instead for those errors). PERMISSION_DENIED must not be
70
+ * used if the caller cannot be identified (use UNAUTHENTICATED
71
+ * instead for those errors).
72
+ */
73
+ | "PERMISSION_DENIED"
74
+ /**
75
+ * Some resource has been exhausted, perhaps a per-user quota, or
76
+ * perhaps the entire file system is out of space.
77
+ */
78
+ | "RESOURCE_EXHAUSTED"
79
+ /**
80
+ * Operation was rejected because the system is not in a state
81
+ * required for the operation's execution. For example, directory
82
+ * to be deleted may be non-empty, an rmdir operation is applied to
83
+ * a non-directory, etc.
84
+ *
85
+ * <p>A litmus test that may help a service implementor in deciding
86
+ * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
87
+ * (a) Use UNAVAILABLE if the client can retry just the failing call.
88
+ * (b) Use ABORTED if the client should retry at a higher-level
89
+ * (e.g., restarting a read-modify-write sequence).
90
+ * (c) Use FAILED_PRECONDITION if the client should not retry until
91
+ * the system state has been explicitly fixed. E.g., if an "rmdir"
92
+ * fails because the directory is non-empty, FAILED_PRECONDITION
93
+ * should be returned since the client should not retry unless
94
+ * they have first fixed up the directory by deleting files from it.
95
+ */
96
+ | "FAILED_PRECONDITION"
97
+ /**
98
+ * The operation was aborted, typically due to a concurrency issue
99
+ * like sequencer check failures, transaction aborts, etc.
100
+ *
101
+ * <p>See litmus test above for deciding between FAILED_PRECONDITION,
102
+ * ABORTED, and UNAVAILABLE.
103
+ */
104
+ | "ABORTED"
105
+ /**
106
+ * Operation was attempted past the valid range. E.g., seeking or
107
+ * reading past end of file.
108
+ *
109
+ * <p>Unlike INVALID_ARGUMENT, this error indicates a problem that may
110
+ * be fixed if the system state changes. For example, a 32-bit file
111
+ * system will generate INVALID_ARGUMENT if asked to read at an
112
+ * offset that is not in the range [0,2^32-1], but it will generate
113
+ * OUT_OF_RANGE if asked to read from an offset past the current
114
+ * file size.
115
+ *
116
+ * <p>There is a fair bit of overlap between FAILED_PRECONDITION and OUT_OF_RANGE.
117
+ * We recommend using OUT_OF_RANGE (the more specific error) when it applies
118
+ * so that callers who are iterating through
119
+ * a space can easily look for an OUT_OF_RANGE error to detect when they are done.
120
+ */
121
+ | "OUT_OF_RANGE"
122
+ /**
123
+ * Operation is not implemented or not supported/enabled in this service.
124
+ */
125
+ | "UNIMPLEMENTED"
126
+ /**
127
+ * Internal errors. Means some invariants expected by underlying
128
+ * system has been broken. If you see one of these errors,
129
+ * something is very broken.
130
+ */
131
+ | "INTERNAL"
132
+ /**
133
+ * The service is currently unavailable. This is a most likely a
134
+ * transient condition and may be corrected by retrying with
135
+ * a backoff. Note that it is not always safe to retry
136
+ * non-idempotent operations.
137
+ *
138
+ * <p>See litmus test above for deciding between FAILED_PRECONDITION,
139
+ * ABORTED, and UNAVAILABLE.
140
+ */
141
+ | "UNAVAILABLE"
142
+ /**
143
+ * Unrecoverable data loss or corruption.
144
+ */
145
+ | "DATA_LOSS"
146
+ /**
147
+ * The request does not have valid authentication credentials for the
148
+ * operation.
149
+ */
150
+ | "UNAUTHENTICATED";
151
+ }
package/target/grpc.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toJvmMessageResponseTimePolicy = exports.underlyingSessionToCredentials = exports.toJvmCredentials = exports.GrpcDslAddons = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ const jvm_types_1 = require("@gatling.io/jvm-types");
6
+ exports.GrpcDslAddons = Java.type("io.gatling.javaapi.grpc.GrpcDslAddons");
7
+ const toJvmCredentials = (credentials) => exports.GrpcDslAddons.channelCredentials(credentials.rootCerts, credentials.certChain, credentials.privateKey);
8
+ exports.toJvmCredentials = toJvmCredentials;
9
+ const underlyingSessionToCredentials = (f) => (jvmSession) => (0, exports.toJvmCredentials)(f((0, core_1.wrapSession)(jvmSession)));
10
+ exports.underlyingSessionToCredentials = underlyingSessionToCredentials;
11
+ const toJvmMessageResponseTimePolicy = (policy) => {
12
+ if (policy === "FROM_STREAM_START") {
13
+ return jvm_types_1.GrpcDsl$MessageResponseTimePolicy.FromStreamStart;
14
+ }
15
+ else if (policy === "FROM_LAST_MESSAGE_SENT") {
16
+ return jvm_types_1.GrpcDsl$MessageResponseTimePolicy.FromLastMessageSent;
17
+ }
18
+ else if (policy === "FROM_LAST_MESSAGE_RECEIVED") {
19
+ return jvm_types_1.GrpcDsl$MessageResponseTimePolicy.FromLastMessageReceived;
20
+ }
21
+ throw Error(`Unhandled message response time policy ${policy}`);
22
+ };
23
+ exports.toJvmMessageResponseTimePolicy = toJvmMessageResponseTimePolicy;
@@ -0,0 +1,19 @@
1
+ import { Session } from "@gatling.io/core";
2
+ import JvmGrpcHeaders = io.gatling.javaapi.grpc.GrpcHeaders;
3
+ export declare namespace GrpcHeaders {
4
+ import JvmValue = io.gatling.javaapi.grpc.GrpcHeaders$Value;
5
+ interface Value<B, V> {
6
+ value(value: V): B;
7
+ value(value: (session: Session) => V): B;
8
+ valueEL(value: string): B;
9
+ }
10
+ const wrapAsciiValue: <B extends GrpcHeaders<B>, J>(_underlying: JvmValue<J, string>, wrap: (underlying: J) => B) => Value<B, string>;
11
+ const wrapBinaryValue: <B extends GrpcHeaders<B>, J>(_underlying: JvmValue<J, number[]>, wrap: (underlying: J) => B) => Value<B, number[]>;
12
+ }
13
+ export interface GrpcHeaders<B extends GrpcHeaders<B>> {
14
+ asciiHeader(key: string): GrpcHeaders.Value<B, string>;
15
+ asciiHeaders(map: Record<string, string>): B;
16
+ binaryHeader(key: string): GrpcHeaders.Value<B, number[]>;
17
+ binaryHeaders(map: Record<string, number[]>): B;
18
+ }
19
+ export declare const wrapGrpcHeaders: <B extends GrpcHeaders<B>, J>(_underlying: JvmGrpcHeaders<J, any>, wrap: (underlying: J) => B) => GrpcHeaders<B>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapGrpcHeaders = exports.GrpcHeaders = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ var GrpcHeaders;
6
+ (function (GrpcHeaders) {
7
+ GrpcHeaders.wrapAsciiValue = (_underlying, wrap) => ({
8
+ value: (value) => wrap((0, core_1.isSessionTo)(value) ? _underlying.value((0, core_1.underlyingSessionTo)(value)) : _underlying.value(value)),
9
+ valueEL: (value) => wrap(_underlying.valueEL(value))
10
+ });
11
+ GrpcHeaders.wrapBinaryValue = (_underlying, wrap) => ({
12
+ value: (value) => wrap((0, core_1.isSessionTo)(value)
13
+ ? _underlying.value((0, core_1.asByteArrayFunction)((0, core_1.underlyingSessionTo)(value)))
14
+ : _underlying.value((0, core_1.asByteArray)(value))),
15
+ valueEL: (value) => wrap(_underlying.valueEL(value))
16
+ });
17
+ })(GrpcHeaders || (exports.GrpcHeaders = GrpcHeaders = {}));
18
+ const wrapGrpcHeaders = (_underlying, wrap) => ({
19
+ asciiHeader: (key) => GrpcHeaders.wrapAsciiValue(_underlying.asciiHeader(key), wrap),
20
+ asciiHeaders: (map) => wrap(_underlying.asciiHeaders(map)),
21
+ binaryHeader: (key) => GrpcHeaders.wrapBinaryValue(_underlying.binaryHeader(key), wrap),
22
+ // FIXME Uint8Array?
23
+ binaryHeaders: (map) => wrap(_underlying.binaryHeaders((0, core_1.asByteArrayMap)(map)))
24
+ });
25
+ exports.wrapGrpcHeaders = wrapGrpcHeaders;
@@ -0,0 +1,30 @@
1
+ import { Expression, Session } from "@gatling.io/core";
2
+ import { GrpcUnaryServiceBuilder } from "./unary";
3
+ export * from "./bidiStream";
4
+ export * from "./checks";
5
+ export * from "./clientStream";
6
+ export * from "./grpc";
7
+ export * from "./protocol";
8
+ export * from "./serverStream";
9
+ export * from "./unary";
10
+ import { GrpcBidirectionalStreamingServiceBuilder } from "./bidiStream";
11
+ import { GrpcClientStreamingServiceBuilder } from "./clientStream";
12
+ import { GrpcProtocolBuilder } from "./protocol";
13
+ import { GrpcServerStreamingServiceBuilder } from "./serverStream";
14
+ export declare namespace Grpc {
15
+ interface Apply {
16
+ (requestName: string): Grpc;
17
+ (requestName: (session: Session) => string): Grpc;
18
+ }
19
+ const apply: (requestName: Expression<string>) => Grpc;
20
+ }
21
+ export interface Grpc {
22
+ unary(fullMethodName: string): GrpcUnaryServiceBuilder;
23
+ serverStream(fullMethodName: string): GrpcServerStreamingServiceBuilder;
24
+ serverStream(fullMethodName: string, streamName: string): GrpcServerStreamingServiceBuilder;
25
+ clientStream(fullMethodName: string): GrpcClientStreamingServiceBuilder;
26
+ clientStream(fullMethodName: string, streamName: string): GrpcClientStreamingServiceBuilder;
27
+ bidiStream(fullMethodName: string): GrpcBidirectionalStreamingServiceBuilder;
28
+ bidiStream(fullMethodName: string, streamName: string): GrpcBidirectionalStreamingServiceBuilder;
29
+ }
30
+ export declare const grpc: Grpc.Apply & GrpcProtocolBuilder;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.grpc = exports.Grpc = void 0;
18
+ const core_1 = require("@gatling.io/core");
19
+ const jvm_types_1 = require("@gatling.io/jvm-types");
20
+ const unary_1 = require("./unary");
21
+ __exportStar(require("./bidiStream"), exports);
22
+ __exportStar(require("./checks"), exports);
23
+ __exportStar(require("./clientStream"), exports);
24
+ __exportStar(require("./grpc"), exports);
25
+ __exportStar(require("./protocol"), exports);
26
+ __exportStar(require("./serverStream"), exports);
27
+ __exportStar(require("./unary"), exports);
28
+ const bidiStream_1 = require("./bidiStream");
29
+ const clientStream_1 = require("./clientStream");
30
+ const dynamic_1 = require("./dynamic");
31
+ const protocol_1 = require("./protocol");
32
+ const serverStream_1 = require("./serverStream");
33
+ var Grpc;
34
+ (function (Grpc) {
35
+ Grpc.apply = (requestName) => {
36
+ // Handle overloading
37
+ const jvmGrpc = typeof requestName === "function"
38
+ ? jvm_types_1.GrpcDsl.grpc((0, core_1.underlyingSessionTo)(requestName))
39
+ : jvm_types_1.GrpcDsl.grpc(requestName);
40
+ return wrapGrpc(jvmGrpc);
41
+ };
42
+ })(Grpc || (exports.Grpc = Grpc = {}));
43
+ const methodDescriptorWrapper = (fullMethodName) => {
44
+ const split1 = fullMethodName.split("/");
45
+ if (split1.length !== 2) {
46
+ throw Error(`Invalid gRPC method name '${fullMethodName}': method name must use the format 'package.Service/Method', or 'Service/Method' if there is no package defined.`);
47
+ }
48
+ const [fullServiceName, methodName] = split1;
49
+ const split2 = fullServiceName.split(".");
50
+ const serviceName = split2.pop();
51
+ const packageName = split2.length > 0 ? split2.join(".") : null;
52
+ return dynamic_1.GrpcDynamic.loadMethodDescriptor(packageName, serviceName, methodName);
53
+ };
54
+ const wrapGrpc = (_underlying) => ({
55
+ unary: (fullMethodName) => {
56
+ const wrapper = methodDescriptorWrapper(fullMethodName);
57
+ return (0, unary_1.wrapGrpcUnaryServiceBuilder)(_underlying.unary(wrapper.descriptor()), wrapper.inputDescriptor());
58
+ },
59
+ serverStream: (fullMethodName, streamName) => {
60
+ const wrapper = methodDescriptorWrapper(fullMethodName);
61
+ const wrap = (0, serverStream_1.wrapGrpcServerStreamingServiceBuilder)(wrapper.inputDescriptor());
62
+ return wrap(typeof streamName === "undefined"
63
+ ? _underlying.serverStream(wrapper.descriptor())
64
+ : _underlying.serverStream(wrapper.descriptor(), streamName));
65
+ },
66
+ clientStream: (fullMethodName, streamName) => {
67
+ const wrapper = methodDescriptorWrapper(fullMethodName);
68
+ const wrap = (0, clientStream_1.wrapGrpcClientStreamingServiceBuilder)(wrapper.inputDescriptor());
69
+ return wrap(typeof streamName === "undefined"
70
+ ? _underlying.clientStream(wrapper.descriptor())
71
+ : _underlying.clientStream(wrapper.descriptor(), streamName));
72
+ },
73
+ bidiStream: (fullMethodName, streamName) => {
74
+ const wrapper = methodDescriptorWrapper(fullMethodName);
75
+ const wrap = (0, bidiStream_1.wrapGrpcBidirectionalStreamingServiceBuilder)(wrapper.inputDescriptor());
76
+ return wrap(typeof streamName === "undefined"
77
+ ? _underlying.bidiStream(wrapper.descriptor())
78
+ : _underlying.bidiStream(wrapper.descriptor(), streamName));
79
+ }
80
+ });
81
+ exports.grpc = Object.assign(Grpc.apply, protocol_1.grpcProtocolBuilder);
@@ -0,0 +1,26 @@
1
+ import { ProtocolBuilder, Session } from "@gatling.io/core";
2
+ import { GrpcHeaders } from "./headers";
3
+ import JvmGrpcProtocolBuilder = io.gatling.javaapi.grpc.GrpcProtocolBuilder;
4
+ import { ChannelCredentials } from "./grpc";
5
+ export interface GrpcProtocolBuilder extends GrpcHeaders<GrpcProtocolBuilder>, ProtocolBuilder {
6
+ channelCredentials(credentials: ChannelCredentials): GrpcProtocolBuilder;
7
+ channelCredentials(credentials: string): GrpcProtocolBuilder;
8
+ channelCredentials(credentials: (session: Session) => ChannelCredentials): GrpcProtocolBuilder;
9
+ forAddress(host: string, port: number): GrpcProtocolBuilder;
10
+ forTarget(target: string): GrpcProtocolBuilder;
11
+ overrideAuthority(authority: string): GrpcProtocolBuilder;
12
+ shareChannel(): GrpcProtocolBuilder;
13
+ shareSslContext(): GrpcProtocolBuilder;
14
+ useChannelPool(poolSize: number): GrpcProtocolBuilder;
15
+ usePlaintext(): GrpcProtocolBuilder;
16
+ useInsecureTrustManager(): GrpcProtocolBuilder;
17
+ useStandardTrustManager(): GrpcProtocolBuilder;
18
+ useCustomCertificateTrustManager(certificatePath: string): GrpcProtocolBuilder;
19
+ useCustomLoadBalancingPolicy(policy: string): GrpcProtocolBuilder;
20
+ useCustomLoadBalancingPolicy(policy: string, jsonPolicyConfig: string): GrpcProtocolBuilder;
21
+ usePickFirstLoadBalancingPolicy(): GrpcProtocolBuilder;
22
+ usePickRandomLoadBalancingPolicy(): GrpcProtocolBuilder;
23
+ useRoundRobinLoadBalancingPolicy(): GrpcProtocolBuilder;
24
+ }
25
+ export declare const wrapGrpcProtocolBuilder: (_underlying: JvmGrpcProtocolBuilder) => GrpcProtocolBuilder;
26
+ export declare const grpcProtocolBuilder: GrpcProtocolBuilder;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.grpcProtocolBuilder = exports.wrapGrpcProtocolBuilder = void 0;
4
+ const headers_1 = require("./headers");
5
+ const grpc_1 = require("./grpc");
6
+ const wrapGrpcProtocolBuilder = (_underlying) => ({
7
+ _underlying,
8
+ ...(0, headers_1.wrapGrpcHeaders)(_underlying, exports.wrapGrpcProtocolBuilder),
9
+ //public GrpcProtocolBuilder callCredentials(@NonNull Function<Session, CallCredentials> credentials) {
10
+ //public GrpcProtocolBuilder callCredentials(@NonNull String credentials) {
11
+ //public GrpcProtocolBuilder callCredentials(@NonNull CallCredentials credentials) {
12
+ channelCredentials: (credentials) => (0, exports.wrapGrpcProtocolBuilder)(typeof credentials === "string"
13
+ ? grpc_1.GrpcDslAddons.channelCredentialsEL(_underlying, credentials)
14
+ : typeof credentials === "function"
15
+ ? _underlying.channelCredentials((0, grpc_1.underlyingSessionToCredentials)(credentials))
16
+ : _underlying.channelCredentials((0, grpc_1.toJvmCredentials)(credentials))),
17
+ forAddress: (host, port) => (0, exports.wrapGrpcProtocolBuilder)(_underlying.forAddress(host, port)),
18
+ forTarget: (target) => (0, exports.wrapGrpcProtocolBuilder)(_underlying.forTarget(target)),
19
+ overrideAuthority: (authority) => (0, exports.wrapGrpcProtocolBuilder)(_underlying.overrideAuthority(authority)),
20
+ shareChannel: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.shareChannel()),
21
+ shareSslContext: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.shareSslContext()),
22
+ useChannelPool: (poolSize) => (0, exports.wrapGrpcProtocolBuilder)(_underlying.useChannelPool(poolSize)),
23
+ usePlaintext: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.usePlaintext()),
24
+ useInsecureTrustManager: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.useInsecureTrustManager()),
25
+ useStandardTrustManager: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.useStandardTrustManager()),
26
+ useCustomCertificateTrustManager: (certificatePath) => (0, exports.wrapGrpcProtocolBuilder)(_underlying.useCustomCertificateTrustManager(certificatePath)),
27
+ useCustomLoadBalancingPolicy: (policy, jsonPolicyConfig) => (0, exports.wrapGrpcProtocolBuilder)(typeof jsonPolicyConfig === "undefined"
28
+ ? _underlying.useCustomLoadBalancingPolicy(policy)
29
+ : _underlying.useCustomLoadBalancingPolicy(policy, jsonPolicyConfig)),
30
+ usePickFirstLoadBalancingPolicy: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.usePickFirstLoadBalancingPolicy()),
31
+ usePickRandomLoadBalancingPolicy: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.usePickRandomLoadBalancingPolicy()),
32
+ useRoundRobinLoadBalancingPolicy: () => (0, exports.wrapGrpcProtocolBuilder)(_underlying.useRoundRobinLoadBalancingPolicy())
33
+ });
34
+ exports.wrapGrpcProtocolBuilder = wrapGrpcProtocolBuilder;
35
+ exports.grpcProtocolBuilder = (0, exports.wrapGrpcProtocolBuilder)(
36
+ // GrpcDsl.grpc doesn't get properly generated by java2ts because of conflicts with methods of the same name
37
+ Java.type("io.gatling.javaapi.grpc.GrpcDsl").grpc);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ import { ActionBuilder, CheckBuilder, Duration, Session } from "@gatling.io/core";
2
+ import { GrpcHeaders } from "./headers";
3
+ import { MessageResponseTimePolicy } from "./grpc";
4
+ import JvmDescriptorsDescriptor = com.google.protobuf.Descriptors$Descriptor;
5
+ import JvmGrpcServerStreamingServiceBuilder = io.gatling.javaapi.grpc.GrpcServerStreamingServiceBuilder;
6
+ export interface GrpcServerStreamAwaitStreamEndActionBuilder extends ActionBuilder {
7
+ }
8
+ export interface GrpcServerStreamStreamSendActionBuilder extends ActionBuilder {
9
+ }
10
+ export interface GrpcServerStreamingServiceBuilder extends GrpcHeaders<GrpcServerStreamingServiceBuilder> {
11
+ check(...checks: CheckBuilder[]): GrpcServerStreamingServiceBuilder;
12
+ deadlineAfter(duration: Duration): GrpcServerStreamingServiceBuilder;
13
+ messageRequestName(messageRequestName: string): GrpcServerStreamingServiceBuilder;
14
+ messageRequestName(messageRequestName: (session: Session) => string): GrpcServerStreamingServiceBuilder;
15
+ messageResponseTimePolicy(messageResponseTimePolicy: MessageResponseTimePolicy): GrpcServerStreamingServiceBuilder;
16
+ streamName(streamName: string): GrpcServerStreamingServiceBuilder;
17
+ send(request: any): GrpcServerStreamStreamSendActionBuilder;
18
+ send(request: (session: Session) => any): GrpcServerStreamStreamSendActionBuilder;
19
+ awaitStreamEnd(): GrpcServerStreamAwaitStreamEndActionBuilder;
20
+ awaitStreamEnd(reconcile: (main: Session, forked: Session) => Session): GrpcServerStreamAwaitStreamEndActionBuilder;
21
+ cancel(): ActionBuilder;
22
+ }
23
+ export declare const wrapGrpcServerStreamingServiceBuilder: (inputDescriptor: JvmDescriptorsDescriptor) => ((_underlying: JvmGrpcServerStreamingServiceBuilder<any, any>) => GrpcServerStreamingServiceBuilder);
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapGrpcServerStreamingServiceBuilder = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ const dynamic_1 = require("./dynamic");
6
+ const headers_1 = require("./headers");
7
+ const grpc_1 = require("./grpc");
8
+ const wrapGrpcServerStreamAwaitStreamEndActionBuilder = (_underlying) => (0, core_1.wrapActionBuilder)(_underlying);
9
+ const wrapGrpcServerStreamStreamSendActionBuilder = (_underlying) => (0, core_1.wrapActionBuilder)(_underlying);
10
+ const wrapGrpcServerStreamingServiceBuilder = (inputDescriptor) => (_underlying) => {
11
+ const toJvmDynamicMessage = (0, dynamic_1.wrapToJvmDynamicMessage)(inputDescriptor);
12
+ const wrap = (0, exports.wrapGrpcServerStreamingServiceBuilder)(inputDescriptor);
13
+ return {
14
+ ...(0, headers_1.wrapGrpcHeaders)(_underlying, wrap),
15
+ // Chainable methods / global stream configuration
16
+ // FIXME callCredentials
17
+ check: (...checks) => wrap(_underlying.check(checks.map((check) => check._underlying))),
18
+ deadlineAfter: (duration) => {
19
+ if ((0, core_1.isDuration)(duration)) {
20
+ return wrap(_underlying.deadlineAfter((0, core_1.toJvmDuration)(duration)));
21
+ }
22
+ throw Error(`deadlineAfter() called with invalid argument ${duration}`);
23
+ },
24
+ messageRequestName: (messageRequestName) => wrap(typeof messageRequestName === "function"
25
+ ? _underlying.messageRequestName((0, core_1.underlyingSessionTo)(messageRequestName))
26
+ : _underlying.messageRequestName(messageRequestName)),
27
+ messageResponseTimePolicy: (messageResponseTimePolicy) => wrap(_underlying.messageResponseTimePolicy((0, grpc_1.toJvmMessageResponseTimePolicy)(messageResponseTimePolicy))),
28
+ streamName: (streamName) => wrap(_underlying.streamName(streamName)),
29
+ // Terminal methods / specific actions
30
+ send: (request) => {
31
+ return wrapGrpcServerStreamStreamSendActionBuilder(typeof request === "function"
32
+ ? _underlying.send((0, dynamic_1.underlyingSessionToJvmDynamicMessage)(request, toJvmDynamicMessage))
33
+ : _underlying.send(toJvmDynamicMessage(request)));
34
+ },
35
+ awaitStreamEnd: (reconcile) => wrapGrpcServerStreamAwaitStreamEndActionBuilder(typeof reconcile === "function"
36
+ ? _underlying.awaitStreamEnd((0, core_1.underlyingBiSessionTransform)(reconcile))
37
+ : _underlying.awaitStreamEnd()),
38
+ cancel: () => (0, core_1.wrapActionBuilder)(_underlying.cancel())
39
+ };
40
+ };
41
+ exports.wrapGrpcServerStreamingServiceBuilder = wrapGrpcServerStreamingServiceBuilder;
@@ -0,0 +1,13 @@
1
+ import { ActionBuilder, CheckBuilder, Duration, Session } from "@gatling.io/core";
2
+ import { GrpcHeaders } from "./headers";
3
+ import JvmDescriptorsDescriptor = com.google.protobuf.Descriptors$Descriptor;
4
+ import JvmGrpcUnaryServiceBuilder = io.gatling.javaapi.grpc.GrpcUnaryServiceBuilder;
5
+ export interface GrpcUnaryActionBuilder extends GrpcHeaders<GrpcUnaryActionBuilder>, ActionBuilder {
6
+ check(...checks: CheckBuilder[]): GrpcUnaryActionBuilder;
7
+ deadlineAfter(duration: Duration): GrpcUnaryActionBuilder;
8
+ }
9
+ export interface GrpcUnaryServiceBuilder {
10
+ send(request: any): GrpcUnaryActionBuilder;
11
+ send(request: (session: Session) => any): GrpcUnaryActionBuilder;
12
+ }
13
+ export declare const wrapGrpcUnaryServiceBuilder: (_underlying: JvmGrpcUnaryServiceBuilder<any, any>, inputDescriptor: JvmDescriptorsDescriptor) => GrpcUnaryServiceBuilder;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapGrpcUnaryServiceBuilder = void 0;
4
+ const core_1 = require("@gatling.io/core");
5
+ const dynamic_1 = require("./dynamic");
6
+ const headers_1 = require("./headers");
7
+ const wrapGrpcUnaryActionBuilder = (_underlying) => ({
8
+ _underlying,
9
+ ...(0, headers_1.wrapGrpcHeaders)(_underlying, wrapGrpcUnaryActionBuilder),
10
+ /*callCredentials: (credentials) =>
11
+ wrapGrpcUnaryActionBuilder(
12
+ typeof credentials === "string"
13
+ ? _underlying.callCredentials(credentials as string)
14
+ : typeof credentials === "function"
15
+ ? _underlying.callCredentials(underlyingSessionTo(credentials as any)) // FIXME ??
16
+ : _underlying.callCredentials(credentials as any)
17
+ ),*/
18
+ check: (...checks) => wrapGrpcUnaryActionBuilder(_underlying.check(checks.map((check) => check._underlying))),
19
+ deadlineAfter: (duration) => {
20
+ if ((0, core_1.isDuration)(duration)) {
21
+ return wrapGrpcUnaryActionBuilder(_underlying.deadlineAfter((0, core_1.toJvmDuration)(duration)));
22
+ }
23
+ throw Error(`deadlineAfter() called with invalid argument ${duration}`);
24
+ }
25
+ });
26
+ const wrapGrpcUnaryServiceBuilder = (_underlying, inputDescriptor) => {
27
+ const toJvmDynamicMessage = (0, dynamic_1.wrapToJvmDynamicMessage)(inputDescriptor);
28
+ return {
29
+ send: (request) => {
30
+ return wrapGrpcUnaryActionBuilder(typeof request === "function"
31
+ ? _underlying.send((0, dynamic_1.underlyingSessionToJvmDynamicMessage)(request, toJvmDynamicMessage))
32
+ : _underlying.send(toJvmDynamicMessage(request)));
33
+ }
34
+ };
35
+ };
36
+ exports.wrapGrpcUnaryServiceBuilder = wrapGrpcUnaryServiceBuilder;