@types/k6 0.53.1 → 0.54.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.
- k6/README.md +1 -1
- k6/{browser.d.ts → browser/index.d.ts} +37 -1
- k6/{crypto.d.ts → crypto/index.d.ts} +1 -162
- k6/encoding/index.d.ts +46 -0
- k6/execution/index.d.ts +115 -0
- k6/experimental/{browser.d.ts → browser/index.d.ts} +1 -1
- k6/experimental/csv/index.d.ts +80 -0
- k6/experimental/{fs.d.ts → fs/index.d.ts} +2 -0
- k6/experimental/{redis.d.ts → redis/index.d.ts} +5 -0
- k6/experimental/{tracing.d.ts → tracing/index.d.ts} +3 -1
- k6/experimental/{websockets.d.ts → websockets/index.d.ts} +5 -4
- k6/global.d.ts +11 -3
- k6/{http.d.ts → http/index.d.ts} +14 -227
- k6/index.d.ts +3 -22
- k6/net/grpc/index.d.ts +218 -0
- k6/{options.d.ts → options/index.d.ts} +1 -1
- k6/package.json +3 -2
- k6/{ws.d.ts → ws/index.d.ts} +2 -41
- k6/encoding.d.ts +0 -90
- k6/execution.d.ts +0 -121
- k6/net/grpc.d.ts +0 -202
- k6/timers.d.ts +0 -47
- /k6/{data.d.ts → data/index.d.ts} +0 -0
- /k6/experimental/{streams.d.ts → streams/index.d.ts} +0 -0
- /k6/experimental/{webcrypto.d.ts → webcrypto/index.d.ts} +0 -0
- /k6/{html.d.ts → html/index.d.ts} +0 -0
- /k6/{metrics.d.ts → metrics/index.d.ts} +0 -0
- /k6/{experimental/timers.d.ts → timers/index.d.ts} +0 -0
k6/{http.d.ts → http/index.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Selection } from "../html/index.js";
|
|
2
|
+
import { JSONValue } from "../index.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Make DELETE request.
|
|
@@ -143,6 +143,17 @@ export function asyncRequest<RT extends ResponseType | undefined>(
|
|
|
143
143
|
params?: RefinedParams<RT> | null,
|
|
144
144
|
): Promise<RefinedResponse<RT>>;
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Creates a URL with set name tag.
|
|
148
|
+
* https://grafana.com/docs/k6/latest/using-k6/http-requests/#url-grouping
|
|
149
|
+
* @param strings - Passed string values.
|
|
150
|
+
* @param args - Tagged template expressions.
|
|
151
|
+
* @returns HTTP URL object.
|
|
152
|
+
* @example
|
|
153
|
+
* http.get(http.url`http://example.com/posts/${id}`) // tags.name="http://example.com/posts/${}",
|
|
154
|
+
*/
|
|
155
|
+
export function url(strings: TemplateStringsArray, ...args: Array<string | number | boolean>): HttpURL;
|
|
156
|
+
|
|
146
157
|
/**
|
|
147
158
|
* Batch multiple HTTP requests together,
|
|
148
159
|
* to issue them in parallel over multiple TCP connections.
|
|
@@ -792,228 +803,4 @@ interface HttpURL {
|
|
|
792
803
|
__brand: "http-url";
|
|
793
804
|
}
|
|
794
805
|
|
|
795
|
-
|
|
796
|
-
* The http module contains functionality for performing HTTP transactions.
|
|
797
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/
|
|
798
|
-
*/
|
|
799
|
-
declare namespace http {
|
|
800
|
-
/**
|
|
801
|
-
* Make DELETE request.
|
|
802
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/del/
|
|
803
|
-
* @param url - Request URL.
|
|
804
|
-
* @param body - Discouraged. Request body. Object form encoded.
|
|
805
|
-
* @param params - Request parameters.
|
|
806
|
-
* @returns Resulting response.
|
|
807
|
-
*/
|
|
808
|
-
function del<RT extends ResponseType | undefined>(
|
|
809
|
-
url: string | HttpURL,
|
|
810
|
-
body?: RequestBody | null,
|
|
811
|
-
params?: RefinedParams<RT> | null,
|
|
812
|
-
): RefinedResponse<RT>;
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* Make HEAD request.
|
|
816
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/head/
|
|
817
|
-
* @param url - Request URL.
|
|
818
|
-
* @param params - Request parameters.
|
|
819
|
-
* @returns Resulting response.
|
|
820
|
-
* @example
|
|
821
|
-
* http.head('https://test.k6.io')
|
|
822
|
-
*/
|
|
823
|
-
function head<RT extends ResponseType | undefined>(
|
|
824
|
-
url: string | HttpURL,
|
|
825
|
-
params?: RefinedParams<RT> | null,
|
|
826
|
-
): RefinedResponse<RT>;
|
|
827
|
-
|
|
828
|
-
/**
|
|
829
|
-
* Make GET request.
|
|
830
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/get/
|
|
831
|
-
* @param url - Request URL.
|
|
832
|
-
* @param params - Request parameters.
|
|
833
|
-
* @returns Resulting response.
|
|
834
|
-
* @example
|
|
835
|
-
* http.get('https://k6.io')
|
|
836
|
-
*/
|
|
837
|
-
function get<RT extends ResponseType | undefined>(
|
|
838
|
-
url: string | HttpURL,
|
|
839
|
-
params?: RefinedParams<RT> | null,
|
|
840
|
-
): RefinedResponse<RT>;
|
|
841
|
-
|
|
842
|
-
/**
|
|
843
|
-
* Make OPTIONS request.
|
|
844
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/options/
|
|
845
|
-
* @param url - Request URL.
|
|
846
|
-
* @param body - Request body. Object form encoded.
|
|
847
|
-
* @param params - Request parameters.
|
|
848
|
-
* @returns Resulting response.
|
|
849
|
-
*/
|
|
850
|
-
function options<RT extends ResponseType | undefined>(
|
|
851
|
-
url: string | HttpURL,
|
|
852
|
-
body?: RequestBody | null,
|
|
853
|
-
params?: RefinedParams<RT> | null,
|
|
854
|
-
): RefinedResponse<RT>;
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* Make PATCH request.
|
|
858
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/patch/
|
|
859
|
-
* @param url - Request URL.
|
|
860
|
-
* @param body - Request body. Object form encoded.
|
|
861
|
-
* @param params - Request parameters.
|
|
862
|
-
* @returns Resulting response.
|
|
863
|
-
*/
|
|
864
|
-
function patch<RT extends ResponseType | undefined>(
|
|
865
|
-
url: string | HttpURL,
|
|
866
|
-
body?: RequestBody | null,
|
|
867
|
-
params?: RefinedParams<RT> | null,
|
|
868
|
-
): RefinedResponse<RT>;
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Make POST request.
|
|
872
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/post/
|
|
873
|
-
* @param url - Request URL.
|
|
874
|
-
* @param body - Request body. Object form encoded.
|
|
875
|
-
* @param params - Request parameters.
|
|
876
|
-
* @returns Resulting response.
|
|
877
|
-
* @example
|
|
878
|
-
* let formData = {name: 'k6'};
|
|
879
|
-
* let headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
880
|
-
* http.post(url, formData, { headers: headers });
|
|
881
|
-
*/
|
|
882
|
-
function post<RT extends ResponseType | undefined>(
|
|
883
|
-
url: string | HttpURL,
|
|
884
|
-
body?: RequestBody | null,
|
|
885
|
-
params?: RefinedParams<RT> | null,
|
|
886
|
-
): RefinedResponse<RT>;
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* Make PUT request.
|
|
890
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/put/
|
|
891
|
-
* @param url - Request URL.
|
|
892
|
-
* @param body - Request body. Object form encoded.
|
|
893
|
-
* @param params - Request parameters.
|
|
894
|
-
* @returns Resulting response.
|
|
895
|
-
*/
|
|
896
|
-
function put<RT extends ResponseType | undefined>(
|
|
897
|
-
url: string | HttpURL,
|
|
898
|
-
body?: RequestBody | null,
|
|
899
|
-
params?: RefinedParams<RT> | null,
|
|
900
|
-
): RefinedResponse<RT>;
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Make request.
|
|
904
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/request/
|
|
905
|
-
* @param method - HTTP method.
|
|
906
|
-
* @param url - Request URL.
|
|
907
|
-
* @param body - Request body. Object form encoded.
|
|
908
|
-
* @param params - Request parameters.
|
|
909
|
-
* @returns Resulting response.
|
|
910
|
-
* @example
|
|
911
|
-
* let formData = {name: 'k6'};
|
|
912
|
-
* let headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
913
|
-
* http.request('POST', url, formData, { headers: headers });
|
|
914
|
-
*/
|
|
915
|
-
function request<RT extends ResponseType | undefined>(
|
|
916
|
-
method: string,
|
|
917
|
-
url: string | HttpURL,
|
|
918
|
-
body?: RequestBody | null,
|
|
919
|
-
params?: RefinedParams<RT> | null,
|
|
920
|
-
): RefinedResponse<RT>;
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Make async request.
|
|
924
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/asyncrequest/
|
|
925
|
-
* @param method - HTTP method.
|
|
926
|
-
* @param url - Request URL.
|
|
927
|
-
* @param body - Request body. Object form encoded.
|
|
928
|
-
* @param params - Request parameters.
|
|
929
|
-
* @returns Resulting response.
|
|
930
|
-
* @example
|
|
931
|
-
* let formData = {name: 'k6'};
|
|
932
|
-
* let headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
933
|
-
* http.asyncRequest('POST', url, formData, { headers: headers });
|
|
934
|
-
*/
|
|
935
|
-
function asyncRequest<RT extends ResponseType | undefined>(
|
|
936
|
-
method: string,
|
|
937
|
-
url: string | HttpURL,
|
|
938
|
-
body?: RequestBody | null,
|
|
939
|
-
params?: RefinedParams<RT> | null,
|
|
940
|
-
): Promise<RefinedResponse<RT>>;
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* Creates a URL with set name tag.
|
|
944
|
-
* https://grafana.com/docs/k6/latest/using-k6/http-requests/#url-grouping
|
|
945
|
-
* @param strings - Passed string values.
|
|
946
|
-
* @param args - Tagged template expressions.
|
|
947
|
-
* @returns HTTP URL object.
|
|
948
|
-
* @example
|
|
949
|
-
* http.get(http.url`http://example.com/posts/${id}`) // tags.name="http://example.com/posts/${}",
|
|
950
|
-
*/
|
|
951
|
-
function url(strings: TemplateStringsArray, ...args: Array<string | number | boolean>): HttpURL;
|
|
952
|
-
|
|
953
|
-
/**
|
|
954
|
-
* Batch multiple HTTP requests together,
|
|
955
|
-
* to issue them in parallel over multiple TCP connections.
|
|
956
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/batch/
|
|
957
|
-
* @param requests - Request specifications.
|
|
958
|
-
* @returns Resulting responses.
|
|
959
|
-
* @example
|
|
960
|
-
* let req1 = {
|
|
961
|
-
* method: 'GET',
|
|
962
|
-
* url: 'https://httpbin.org/get',
|
|
963
|
-
* };
|
|
964
|
-
* let req2 = {
|
|
965
|
-
* method: 'POST',
|
|
966
|
-
* url: 'https://httpbin.org/post',
|
|
967
|
-
* body: {
|
|
968
|
-
* hello: 'world!',
|
|
969
|
-
* },
|
|
970
|
-
* params: {
|
|
971
|
-
* headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
972
|
-
* },
|
|
973
|
-
* };
|
|
974
|
-
* let responses = http.batch([req1, req2]);
|
|
975
|
-
*/
|
|
976
|
-
function batch<Q extends BatchRequests>(requests: Q): BatchResponses<Q>;
|
|
977
|
-
|
|
978
|
-
/**
|
|
979
|
-
* Create a file object used for building multipart requests (file uploads).
|
|
980
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/file/
|
|
981
|
-
* @param data - File data.
|
|
982
|
-
* @param filename - Filename. Included in MIME message.
|
|
983
|
-
* @param contentType - Content type. Included in MIME message.
|
|
984
|
-
* @returns File data object.
|
|
985
|
-
* @example
|
|
986
|
-
* let binFile = open('/path/to/file.bin', 'b');
|
|
987
|
-
*
|
|
988
|
-
* export default function() {
|
|
989
|
-
* let f = http.file(binFile, 'test.bin');
|
|
990
|
-
* console.log(md5(f.data, 'hex'));
|
|
991
|
-
* console.log(f.filename);
|
|
992
|
-
* console.log(f.content_type);
|
|
993
|
-
* }
|
|
994
|
-
*/
|
|
995
|
-
function file(data: string | ArrayBuffer, filename?: string, contentType?: string): FileData;
|
|
996
|
-
|
|
997
|
-
/**
|
|
998
|
-
* Get active cookie jar.
|
|
999
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/cookiejar/
|
|
1000
|
-
* @returns Active cookie jar.
|
|
1001
|
-
* @example
|
|
1002
|
-
* let jar = http.cookieJar();
|
|
1003
|
-
*/
|
|
1004
|
-
function cookieJar(): CookieJar;
|
|
1005
|
-
/**
|
|
1006
|
-
* Returns a callback to be used with setResponseCallback to mark responses
|
|
1007
|
-
* as expected based only on their status codes.
|
|
1008
|
-
* https://staging.k6.io/docs/javascript-api/k6-http/expectedstatuses-statuses/
|
|
1009
|
-
*/
|
|
1010
|
-
function expectedStatuses(...param: Array<number | ExpectedStatusesObject>): ExpectedStatusesCallback;
|
|
1011
|
-
|
|
1012
|
-
/**
|
|
1013
|
-
* Set the response callback to be called to determine if a response was expected/successful or not.
|
|
1014
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-http/setresponsecallback/
|
|
1015
|
-
*/
|
|
1016
|
-
function setResponseCallback(responseCallback: ExpectedStatusesCallback): void;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
export default http;
|
|
806
|
+
export * as default from "k6/http";
|
k6/index.d.ts
CHANGED
|
@@ -17,28 +17,7 @@
|
|
|
17
17
|
* @packageDocumentation
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import "./global"; // Type global environment
|
|
21
|
-
|
|
22
|
-
// Expose everything to autoimport
|
|
23
|
-
import "./browser";
|
|
24
|
-
import "./crypto";
|
|
25
|
-
import "./data";
|
|
26
|
-
import "./encoding";
|
|
27
|
-
import "./execution";
|
|
28
|
-
import "./html";
|
|
29
|
-
import "./http";
|
|
30
|
-
import "./metrics";
|
|
31
|
-
import "./options";
|
|
32
|
-
import "./experimental/browser";
|
|
33
|
-
import "./experimental/fs";
|
|
34
|
-
import "./experimental/redis";
|
|
35
|
-
import "./experimental/timers";
|
|
36
|
-
import "./experimental/tracing";
|
|
37
|
-
import "./experimental/webcrypto";
|
|
38
|
-
import "./experimental/websockets";
|
|
39
|
-
import "./timers";
|
|
40
|
-
import "./ws";
|
|
41
|
-
import "./net/grpc";
|
|
20
|
+
import "./global.js"; // Type global environment
|
|
42
21
|
|
|
43
22
|
// === Main ===
|
|
44
23
|
// ------------
|
|
@@ -143,3 +122,5 @@ export interface JSONArray extends Array<JSONValue> {}
|
|
|
143
122
|
export interface JSONObject {
|
|
144
123
|
[key: string]: JSONValue;
|
|
145
124
|
}
|
|
125
|
+
|
|
126
|
+
export * as default from "k6";
|
k6/net/grpc/index.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// === Response ===
|
|
2
|
+
// ----------------
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* gRPC response.
|
|
6
|
+
*/
|
|
7
|
+
export interface Response {
|
|
8
|
+
status: number;
|
|
9
|
+
|
|
10
|
+
message: object;
|
|
11
|
+
|
|
12
|
+
headers: object;
|
|
13
|
+
|
|
14
|
+
trailers: object;
|
|
15
|
+
|
|
16
|
+
error: object;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ConnectParams {
|
|
20
|
+
/**
|
|
21
|
+
* If `true` will connect to the gRPC server using plaintext i.e. insecure.
|
|
22
|
+
*/
|
|
23
|
+
plaintext?: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* If `true` connection will try to use the gRPC server reflection protocol.
|
|
27
|
+
* https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
|
|
28
|
+
*/
|
|
29
|
+
reflect?: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Metadata to send with reflection request.
|
|
33
|
+
*/
|
|
34
|
+
reflectMetadata?: object;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Connection timeout to use.
|
|
38
|
+
*/
|
|
39
|
+
timeout?: string | number;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Maximum message size in bytes the client can receive.
|
|
43
|
+
*/
|
|
44
|
+
maxReceiveSize?: number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Maximum message size in bytes the client can send.
|
|
48
|
+
*/
|
|
49
|
+
maxSendSize?: number;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* TLS settings of the connection.
|
|
53
|
+
*/
|
|
54
|
+
tls?: TLSParams;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface TLSParams {
|
|
58
|
+
/**
|
|
59
|
+
* PEM formatted client certificate.
|
|
60
|
+
*/
|
|
61
|
+
cert: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* PEM formatted client private key.
|
|
65
|
+
*/
|
|
66
|
+
key: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Password for decrypting the client's private key.
|
|
70
|
+
*/
|
|
71
|
+
password?: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* PEM formatted string/strings of the certificate authorities.
|
|
75
|
+
*/
|
|
76
|
+
cacerts?: string | string[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface Params {
|
|
80
|
+
/**
|
|
81
|
+
* Object with key-value pairs representing custom metadata the user would like to add to the request.
|
|
82
|
+
*/
|
|
83
|
+
metadata?: object;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Key-value pairs where the keys are names of tags and the values are tag values
|
|
87
|
+
*/
|
|
88
|
+
tags?: object;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Request timeout to use.
|
|
92
|
+
*/
|
|
93
|
+
timeout?: string | number;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Specify if response messages should be discarded.
|
|
97
|
+
*/
|
|
98
|
+
discardResponseMessage?: boolean;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface GrpcError {
|
|
102
|
+
code: number;
|
|
103
|
+
details: string[] | object[];
|
|
104
|
+
message: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* gRPC client to interact with a gRPC server.
|
|
109
|
+
* https://grafana.com/docs/k6/latest/javascript-api/k6-net-grpc/client/
|
|
110
|
+
*/
|
|
111
|
+
export class Client {
|
|
112
|
+
protected __brand: never;
|
|
113
|
+
|
|
114
|
+
constructor();
|
|
115
|
+
|
|
116
|
+
/** Opens a connection to a gRPC server. */
|
|
117
|
+
connect(address: string, params?: ConnectParams): void;
|
|
118
|
+
|
|
119
|
+
/** Loads and parses the protocol buffer descriptors. */
|
|
120
|
+
load(importPaths: string[], ...protoFiles: string[]): void;
|
|
121
|
+
|
|
122
|
+
/** Loads a protoset and parses the protocol buffer descriptors */
|
|
123
|
+
loadProtoset(protosetPath: string): void;
|
|
124
|
+
|
|
125
|
+
/** Invokes an unary RPC request. */
|
|
126
|
+
invoke(url: string, request: object, params?: Params): Response;
|
|
127
|
+
|
|
128
|
+
/** Asynchronously invokes an unary RPC request. */
|
|
129
|
+
asyncInvoke(url: string, request: object, params?: Params): Promise<Response>;
|
|
130
|
+
|
|
131
|
+
/** Close the connection. */
|
|
132
|
+
close(): void;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* StreamEvent describes the possible events that can be emitted
|
|
137
|
+
* by a gRPC stream.
|
|
138
|
+
*/
|
|
139
|
+
export type StreamEvent =
|
|
140
|
+
/**
|
|
141
|
+
* Event fired when data has been received from the server.
|
|
142
|
+
*/
|
|
143
|
+
| "data"
|
|
144
|
+
/**
|
|
145
|
+
* Event fired when a stream has been closed due to an error.
|
|
146
|
+
*/
|
|
147
|
+
| "error"
|
|
148
|
+
/**
|
|
149
|
+
* Event fired when the stream closes.
|
|
150
|
+
*/
|
|
151
|
+
| "end";
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* StreamMessageMetadata handles gRPC stream messages's metadata
|
|
155
|
+
*/
|
|
156
|
+
export interface StreamMessageMetadata {
|
|
157
|
+
/**
|
|
158
|
+
* Contains the timestamp of the original event (for example, when a message has been received).
|
|
159
|
+
*/
|
|
160
|
+
ts: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Stream allows you to use streaming RPCs.
|
|
165
|
+
*/
|
|
166
|
+
export class Stream {
|
|
167
|
+
/**
|
|
168
|
+
* The gRPC stream constructor, representing a single gRPC stream.
|
|
169
|
+
*
|
|
170
|
+
* @param client - the gRPC client to use, it must be connected.
|
|
171
|
+
* @param url - the RPC method to call.
|
|
172
|
+
* @param params - the parameters to use for the RPC call.
|
|
173
|
+
*/
|
|
174
|
+
constructor(client: Client, url: string, params?: Params);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Set up handler functions for various events on the gRPC stream.
|
|
178
|
+
*
|
|
179
|
+
* @param event - the event to listen for
|
|
180
|
+
* @param listener - the callback to invoke when the event is emitted
|
|
181
|
+
*/
|
|
182
|
+
on(
|
|
183
|
+
event: StreamEvent,
|
|
184
|
+
listener: (data: object | GrpcError | undefined, metadata: StreamMessageMetadata) => void,
|
|
185
|
+
): void;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Writes a request to the stream.
|
|
189
|
+
*
|
|
190
|
+
* @param request - the request (message) to send to the server
|
|
191
|
+
*/
|
|
192
|
+
write(request: object): void;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Signals to the server that the client has finished sending messages.
|
|
196
|
+
*/
|
|
197
|
+
end(): void;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const StatusOK: number;
|
|
201
|
+
export const StatusCanceled: number;
|
|
202
|
+
export const StatusUnknown: number;
|
|
203
|
+
export const StatusInvalidArgument: number;
|
|
204
|
+
export const StatusDeadlineExceeded: number;
|
|
205
|
+
export const StatusNotFound: number;
|
|
206
|
+
export const StatusAlreadyExists: number;
|
|
207
|
+
export const StatusPermissionDenied: number;
|
|
208
|
+
export const StatusResourceExhausted: number;
|
|
209
|
+
export const StatusFailedPrecondition: number;
|
|
210
|
+
export const StatusAborted: number;
|
|
211
|
+
export const StatusOutOfRange: number;
|
|
212
|
+
export const StatusUnimplemented: number;
|
|
213
|
+
export const StatusInternal: number;
|
|
214
|
+
export const StatusUnavailable: number;
|
|
215
|
+
export const StatusDataLoss: number;
|
|
216
|
+
export const StatusUnauthenticated: number;
|
|
217
|
+
|
|
218
|
+
export * as default from "k6/net/grpc";
|
k6/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/k6",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"description": "TypeScript definitions for k6",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"url": "https://github.com/joanlopez"
|
|
52
52
|
}
|
|
53
53
|
],
|
|
54
|
+
"type": "module",
|
|
54
55
|
"main": "",
|
|
55
56
|
"types": "index.d.ts",
|
|
56
57
|
"repository": {
|
|
@@ -60,6 +61,6 @@
|
|
|
60
61
|
},
|
|
61
62
|
"scripts": {},
|
|
62
63
|
"dependencies": {},
|
|
63
|
-
"typesPublisherContentHash": "
|
|
64
|
+
"typesPublisherContentHash": "117f96c1bd174240bb9f518388a69fc69bbb14dd874730e2db3ea53c0513b9c6",
|
|
64
65
|
"typeScriptVersion": "4.8"
|
|
65
66
|
}
|
k6/{ws.d.ts → ws/index.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CookieJar } from "
|
|
1
|
+
import { CookieJar } from "k6/http";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Open WebSocket connection.
|
|
@@ -280,43 +280,4 @@ export abstract class WebSocketError {
|
|
|
280
280
|
error(): string;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
|
|
284
|
-
* This module provides a WebSocket client implementing the WebSocket protocol.
|
|
285
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-ws/
|
|
286
|
-
*/
|
|
287
|
-
declare namespace ws {
|
|
288
|
-
/**
|
|
289
|
-
* Open WebSocket connection.
|
|
290
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-ws/connect/
|
|
291
|
-
* @param url - Request URL.
|
|
292
|
-
* @param callback - Logic to execute with socket.
|
|
293
|
-
* @returns HTTP response to connection request.
|
|
294
|
-
* @example
|
|
295
|
-
* let res = ws.connect(url, function(socket) {
|
|
296
|
-
* socket.on('open', function() {
|
|
297
|
-
* console.log('WebSocket connection established!');
|
|
298
|
-
* socket.close();
|
|
299
|
-
* });
|
|
300
|
-
* });
|
|
301
|
-
*/
|
|
302
|
-
function connect(url: string, callback: Executor): Response;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Open WebSocket connection.
|
|
306
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-ws/connect/
|
|
307
|
-
* @param url - Request URL.
|
|
308
|
-
* @param params - Request parameters.
|
|
309
|
-
* @param callback - Logic to execute with socket.
|
|
310
|
-
* @returns HTTP response to connection request.
|
|
311
|
-
* @example
|
|
312
|
-
* let res = ws.connect(url, { param1: true } , function(socket) {
|
|
313
|
-
* socket.on('open', function() {
|
|
314
|
-
* console.log('WebSocket connection established!');
|
|
315
|
-
* socket.close();
|
|
316
|
-
* });
|
|
317
|
-
* });
|
|
318
|
-
*/
|
|
319
|
-
function connect(url: string, params: Params | null, callback: Executor): Response;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export default ws;
|
|
283
|
+
export * as default from "k6/ws";
|
k6/encoding.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base64 decode a string.
|
|
3
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
|
|
4
|
-
* @param input - The string to base64 decode.
|
|
5
|
-
* @param encoding - Base64 variant.
|
|
6
|
-
* @returns The base64 decoded version of the input string in either string or ArrayBuffer format, depending on the `format` parameter.
|
|
7
|
-
* @example
|
|
8
|
-
* encoding.b64decode(str)
|
|
9
|
-
* encoding.b64decode(str, 'rawstd')
|
|
10
|
-
* const decBuffer = encoding.b64decode(str, 'rawurl')
|
|
11
|
-
* let decBin = new Uint8Array(decBuffer);
|
|
12
|
-
*/
|
|
13
|
-
export function b64decode(input: string, encoding?: Base64Variant): ArrayBuffer;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Base64 decode a string.
|
|
17
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
|
|
18
|
-
* @param input - The string to base64 decode.
|
|
19
|
-
* @param encoding - Base64 variant.
|
|
20
|
-
* @param format - If 's' return the data as a string, otherwise an ArrayBuffer object .
|
|
21
|
-
* @returns The base64 decoded version of the input string in either string or ArrayBuffer format, depending on the `format` parameter.
|
|
22
|
-
* @example
|
|
23
|
-
* encoding.b64decode(str)
|
|
24
|
-
* encoding.b64decode(str, 'rawstd')
|
|
25
|
-
* const decodedString = encoding.b64decode(str, 'rawurl', 's')
|
|
26
|
-
*/
|
|
27
|
-
export function b64decode(input: string, encoding: Base64Variant, format: "s"): string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Base64 encode a string.
|
|
31
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64encode/
|
|
32
|
-
* @param input - String to encode or ArrayBuffer object.
|
|
33
|
-
* @param encoding - Base64 variant.
|
|
34
|
-
* @returns Base64 encoded string.
|
|
35
|
-
* @example
|
|
36
|
-
* encoding.b64encode(str)
|
|
37
|
-
* encoding.b64encode(str, 'rawstd')
|
|
38
|
-
*/
|
|
39
|
-
export function b64encode(input: string | ArrayBuffer, encoding?: Base64Variant): string;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Base64 variant.
|
|
43
|
-
*/
|
|
44
|
-
export type Base64Variant = "std" | "rawstd" | "url" | "rawurl";
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The encoding module provides base64 encoding/decoding.
|
|
48
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/
|
|
49
|
-
*/
|
|
50
|
-
declare namespace encoding {
|
|
51
|
-
/**
|
|
52
|
-
* Base64 decode a string.
|
|
53
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
|
|
54
|
-
* @param input - The string to base64 decode.
|
|
55
|
-
* @param encoding - Base64 variant.
|
|
56
|
-
* @returns The base64 decoded version of the input string in either string or ArrayBuffer format, depending on the `format` parameter.
|
|
57
|
-
* @example
|
|
58
|
-
* encoding.b64decode(str)
|
|
59
|
-
* encoding.b64decode(str, 'rawstd')
|
|
60
|
-
* const decBuffer = encoding.b64decode(str, 'rawurl')
|
|
61
|
-
* let decBin = new Uint8Array(decBuffer);
|
|
62
|
-
*/
|
|
63
|
-
function b64decode(input: string, encoding?: Base64Variant): ArrayBuffer;
|
|
64
|
-
/**
|
|
65
|
-
* Base64 decode a string.
|
|
66
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
|
|
67
|
-
* @param input - The string to base64 decode.
|
|
68
|
-
* @param encoding - Base64 variant.
|
|
69
|
-
* @param format - If 's' return the data as a string, otherwise an ArrayBuffer object .
|
|
70
|
-
* @returns The base64 decoded version of the input string in either string or ArrayBuffer format, depending on the `format` parameter.
|
|
71
|
-
* @example
|
|
72
|
-
* encoding.b64decode(str)
|
|
73
|
-
* encoding.b64decode(str, 'rawstd')
|
|
74
|
-
* const decodedString = encoding.b64decode(str, 'rawurl', 's')
|
|
75
|
-
*/
|
|
76
|
-
function b64decode(input: string, encoding: Base64Variant, format: "s"): string;
|
|
77
|
-
/**
|
|
78
|
-
* Base64 decode a string.
|
|
79
|
-
* https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
|
|
80
|
-
* @param input - Base64 encoded string or ArrayBuffer object.
|
|
81
|
-
* @param encoding - Base64 variant.
|
|
82
|
-
* @returns Decoded string.
|
|
83
|
-
* @example
|
|
84
|
-
* encoding.b64encode(str)
|
|
85
|
-
* encoding.b64encode(str, 'rawstd')
|
|
86
|
-
*/
|
|
87
|
-
function b64encode(input: string | ArrayBuffer, encoding?: Base64Variant): string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default encoding;
|