@types/k6 0.41.0 → 0.43.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 +2 -2
- k6/experimental/redis.d.ts +42 -42
- k6/experimental/tracing.d.ts +206 -0
- k6/experimental/websockets.d.ts +138 -9
- k6/http.d.ts +40 -0
- k6/index.d.ts +3 -1
- k6/package.json +8 -3
k6/README.md
CHANGED
|
@@ -8,9 +8,9 @@ This package contains type definitions for k6 (https://k6.io/docs/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 20 Feb 2023 16:02:34 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: none
|
|
14
14
|
|
|
15
15
|
# Credits
|
|
16
|
-
These definitions were written by [na--](https://github.com/na--), [Mihail Stoykov](https://github.com/MStoykov), [Ivan](https://github.com/codebien), [Théo Crevon](https://github.com/oleiade), [Oleg Bespalov](https://github.com/olegbespalov), [Pepe Cano](https://github.com/ppcano), and [Nicole van der Hoeven](https://github.com/nicolevanderhoeven).
|
|
16
|
+
These definitions were written by [na--](https://github.com/na--), [Mihail Stoykov](https://github.com/MStoykov), [Ivan](https://github.com/codebien), [Ivan Mirić](https://github.com/imiric), [Théo Crevon](https://github.com/oleiade), [Oleg Bespalov](https://github.com/olegbespalov), [Pepe Cano](https://github.com/ppcano), and [Nicole van der Hoeven](https://github.com/nicolevanderhoeven).
|
k6/experimental/redis.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This module provides a redis client allowing users to interact with redis,
|
|
3
3
|
* directly from their k6 scripts.
|
|
4
4
|
*
|
|
5
|
-
* https://k6.io/docs/javascript-api/k6-redis/
|
|
5
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* It exposes a promise-based API, allowing users to interact with Redis in an asynchronous manner.
|
|
12
12
|
*
|
|
13
|
-
* https://k6.io/docs/javascript-api/k6-redis/client
|
|
13
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client
|
|
14
14
|
*/
|
|
15
15
|
export class Client {
|
|
16
16
|
protected __brand: never;
|
|
@@ -29,7 +29,7 @@ export class Client {
|
|
|
29
29
|
*
|
|
30
30
|
* If the key already exists, it is overwritten.
|
|
31
31
|
*
|
|
32
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-set
|
|
32
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-set
|
|
33
33
|
*
|
|
34
34
|
* @param key - key to set
|
|
35
35
|
* @param value - value to set
|
|
@@ -41,7 +41,7 @@ export class Client {
|
|
|
41
41
|
/**
|
|
42
42
|
* Gets the value of a key.
|
|
43
43
|
*
|
|
44
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-get
|
|
44
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-get
|
|
45
45
|
*
|
|
46
46
|
* @param key - key to get
|
|
47
47
|
* @returns a promise that resolves to the value of the key.
|
|
@@ -52,7 +52,7 @@ export class Client {
|
|
|
52
52
|
* Atomically sets the value of a key and returns the value
|
|
53
53
|
* previously stored at that key.
|
|
54
54
|
*
|
|
55
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-getset
|
|
55
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-getset
|
|
56
56
|
*
|
|
57
57
|
* @param key - key to get and set
|
|
58
58
|
* @param value - value to set
|
|
@@ -65,7 +65,7 @@ export class Client {
|
|
|
65
65
|
*
|
|
66
66
|
* A key is ignored if it does not exist.
|
|
67
67
|
*
|
|
68
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-del
|
|
68
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-del
|
|
69
69
|
*
|
|
70
70
|
* @param keys - keys to delete
|
|
71
71
|
* @returns a promise that resolves to the number of keys that were removed.
|
|
@@ -75,7 +75,7 @@ export class Client {
|
|
|
75
75
|
/**
|
|
76
76
|
* Get the value of a key and delete it.
|
|
77
77
|
*
|
|
78
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-getdel
|
|
78
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-getdel
|
|
79
79
|
*
|
|
80
80
|
* @param key - the key to get and delete
|
|
81
81
|
* @returns a promise that resolves to the value of the key that was deleted.
|
|
@@ -85,7 +85,7 @@ export class Client {
|
|
|
85
85
|
/**
|
|
86
86
|
* Returns the number of the provided keys arguments that exist.
|
|
87
87
|
*
|
|
88
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-exists
|
|
88
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-exists
|
|
89
89
|
*
|
|
90
90
|
* @param keys - the keys to check the existence of
|
|
91
91
|
* @returns a promise that resolves to the number of keys that exist.
|
|
@@ -98,7 +98,7 @@ export class Client {
|
|
|
98
98
|
* If the key does not exist, it is set to 0 before performing the operation.
|
|
99
99
|
* If the key exists but cannot be treated as a number, the returned promise will be rejected.
|
|
100
100
|
*
|
|
101
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-incr
|
|
101
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-incr
|
|
102
102
|
*
|
|
103
103
|
* @param key - key to increment the value of
|
|
104
104
|
* @returns a promise that resolves to the value of the key after the increment.
|
|
@@ -111,7 +111,7 @@ export class Client {
|
|
|
111
111
|
* If the key does not exist, it is set to 0 before performing the operation.
|
|
112
112
|
* If the key exists but cannot be treated as a number, the returned promise will be rejected.
|
|
113
113
|
*
|
|
114
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-incrby
|
|
114
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-incrby
|
|
115
115
|
*
|
|
116
116
|
* @param key - key to increment the value of
|
|
117
117
|
* @param increment - amount to increment the value of the key by
|
|
@@ -125,7 +125,7 @@ export class Client {
|
|
|
125
125
|
* If the key does not exist, it is set to 0 before performing the operation.
|
|
126
126
|
* If the key exists but cannot be treated as a number, the returned promise will be rejected.
|
|
127
127
|
*
|
|
128
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-decr
|
|
128
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-decr
|
|
129
129
|
*
|
|
130
130
|
* @param key - key to decrement the value of
|
|
131
131
|
* @returns a promise that resolves to the value of the key after the decrement.
|
|
@@ -138,7 +138,7 @@ export class Client {
|
|
|
138
138
|
* If the key does not exist, it is set to 0 before performing the operation.
|
|
139
139
|
* If the key exists but cannot be treated as a number, the returned promise will be rejected.
|
|
140
140
|
*
|
|
141
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-decrby
|
|
141
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-decrby
|
|
142
142
|
*
|
|
143
143
|
* @param key - key to decrement the value of
|
|
144
144
|
* @param decrement - amount to decrement the value of the key by
|
|
@@ -151,7 +151,7 @@ export class Client {
|
|
|
151
151
|
*
|
|
152
152
|
* If the database is empty, the returned promise will be rejected.
|
|
153
153
|
*
|
|
154
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-randomkey
|
|
154
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-randomkey
|
|
155
155
|
*
|
|
156
156
|
* @returns a promise that resolves to a random key.
|
|
157
157
|
*/
|
|
@@ -160,7 +160,7 @@ export class Client {
|
|
|
160
160
|
/**
|
|
161
161
|
* Returns the values of all the specified keys.
|
|
162
162
|
*
|
|
163
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-mget
|
|
163
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-mget
|
|
164
164
|
*
|
|
165
165
|
* @param keys - the keys to get the values of
|
|
166
166
|
* @returns a promise that resolves to an array of the values of the keys.
|
|
@@ -173,7 +173,7 @@ export class Client {
|
|
|
173
173
|
* Calling expire with a non-positive timeout value will result in the being deleted rather
|
|
174
174
|
* than expired.
|
|
175
175
|
*
|
|
176
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-expire
|
|
176
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-expire
|
|
177
177
|
*
|
|
178
178
|
* @param key - key to set the time to live of
|
|
179
179
|
* @param seconds - value to set the time to live of the key to (in seconds)
|
|
@@ -184,7 +184,7 @@ export class Client {
|
|
|
184
184
|
/**
|
|
185
185
|
* Returns the remaining time to live of a key that has a timeout.
|
|
186
186
|
*
|
|
187
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-ttl
|
|
187
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-ttl
|
|
188
188
|
*
|
|
189
189
|
* @param key - the key to get the time to live of
|
|
190
190
|
* @returns a promise that resolves to the time to live of the key, in seconds.
|
|
@@ -194,7 +194,7 @@ export class Client {
|
|
|
194
194
|
/**
|
|
195
195
|
* Removes the existing timeout on a key.
|
|
196
196
|
*
|
|
197
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-persist
|
|
197
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-persist
|
|
198
198
|
*
|
|
199
199
|
* @param key - the key to remove the timeout of.
|
|
200
200
|
* @returns a promise that resolves to true if the operation succeeded, false otherwise.
|
|
@@ -206,7 +206,7 @@ export class Client {
|
|
|
206
206
|
*
|
|
207
207
|
* If the key exists but does not hold a list, the returned promise will be rejected.
|
|
208
208
|
*
|
|
209
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-lpush
|
|
209
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-lpush
|
|
210
210
|
*
|
|
211
211
|
* @param key - key holding the list to prepend to
|
|
212
212
|
* @param values - values to prepend to the list
|
|
@@ -219,7 +219,7 @@ export class Client {
|
|
|
219
219
|
*
|
|
220
220
|
* If the key exists but does not hold a list, the returned promise will be rejected.
|
|
221
221
|
*
|
|
222
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-rpush
|
|
222
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-rpush
|
|
223
223
|
*
|
|
224
224
|
* @param key - key holding the list to append to
|
|
225
225
|
* @param values - values to append to the list
|
|
@@ -230,7 +230,7 @@ export class Client {
|
|
|
230
230
|
/**
|
|
231
231
|
* Removes and returns the value at the head of the list stored at key.
|
|
232
232
|
*
|
|
233
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-lpop
|
|
233
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-lpop
|
|
234
234
|
*
|
|
235
235
|
* @param key - key holding the list to pop the head of
|
|
236
236
|
* @returns a promise that resolves to the value that was popped.
|
|
@@ -240,7 +240,7 @@ export class Client {
|
|
|
240
240
|
/**
|
|
241
241
|
* Removes and returns the value at the tail of the list stored at key.
|
|
242
242
|
*
|
|
243
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-rpop
|
|
243
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-rpop
|
|
244
244
|
*
|
|
245
245
|
* @param key - key holding the list to pop the tail of
|
|
246
246
|
* @returns a promise that resolves to the value that was popped.
|
|
@@ -253,7 +253,7 @@ export class Client {
|
|
|
253
253
|
* The offsets are zero-based. These offsets can be negative numbers indicating
|
|
254
254
|
* offsets starting at the end of the list.
|
|
255
255
|
*
|
|
256
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-lrange
|
|
256
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-lrange
|
|
257
257
|
*
|
|
258
258
|
* @param key - key holding the list to get the range of
|
|
259
259
|
* @param start - index of the first element to return
|
|
@@ -268,7 +268,7 @@ export class Client {
|
|
|
268
268
|
* The offsets are zero-based. These offsets can be negative numbers indicating
|
|
269
269
|
* offsets starting at the end of the list.
|
|
270
270
|
*
|
|
271
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-lindex
|
|
271
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-lindex
|
|
272
272
|
*
|
|
273
273
|
* @param key - key holding the list to get the element of
|
|
274
274
|
* @param index - index of the element to get
|
|
@@ -279,7 +279,7 @@ export class Client {
|
|
|
279
279
|
/**
|
|
280
280
|
* Sets the value of an element in the list stored at key to new value.
|
|
281
281
|
*
|
|
282
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-lset
|
|
282
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-lset
|
|
283
283
|
*
|
|
284
284
|
* @param key - key holding the list to set the element of
|
|
285
285
|
* @param index - index of the element to set
|
|
@@ -295,7 +295,7 @@ export class Client {
|
|
|
295
295
|
* If the `count` is 0, all occurrences of `value` are removed.
|
|
296
296
|
* If the `count` is negative, elements are removed from the tail of the list (from right to left).
|
|
297
297
|
*
|
|
298
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-lrem
|
|
298
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-lrem
|
|
299
299
|
*
|
|
300
300
|
* @param key - key holding the list to remove the element of
|
|
301
301
|
* @param count - the number of elements matching the value to remove
|
|
@@ -309,7 +309,7 @@ export class Client {
|
|
|
309
309
|
*
|
|
310
310
|
* If the key does not exist, it is interpreted as an empty list and 0 is returned.
|
|
311
311
|
*
|
|
312
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-llen
|
|
312
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-llen
|
|
313
313
|
*
|
|
314
314
|
* @param key - key holding the list to get the length of
|
|
315
315
|
* @returns a promise that resolves to the length of the list.
|
|
@@ -322,7 +322,7 @@ export class Client {
|
|
|
322
322
|
* If the key does not exist, a new key holding a hash is created.
|
|
323
323
|
* If the field already exists, it is overwritten.
|
|
324
324
|
*
|
|
325
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hset
|
|
325
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hset
|
|
326
326
|
*
|
|
327
327
|
* @param key - key holding the hash to set the field's value of
|
|
328
328
|
* @param field - field to set the value of
|
|
@@ -337,7 +337,7 @@ export class Client {
|
|
|
337
337
|
* If the key does not exist, a new key holding a hash is created.
|
|
338
338
|
* If the field already exists, the returned promise will be rejected.
|
|
339
339
|
*
|
|
340
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hsetnx
|
|
340
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hsetnx
|
|
341
341
|
*
|
|
342
342
|
* @param key - key holding the hash to set the field's value of
|
|
343
343
|
* @param field - field to set the value of
|
|
@@ -350,7 +350,7 @@ export class Client {
|
|
|
350
350
|
*
|
|
351
351
|
* Returns the value of the specified hash field.
|
|
352
352
|
*
|
|
353
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hget
|
|
353
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hget
|
|
354
354
|
*
|
|
355
355
|
* @param key - key holding the hash to get the field's value of
|
|
356
356
|
* @param field - field to get the value of
|
|
@@ -361,7 +361,7 @@ export class Client {
|
|
|
361
361
|
/**
|
|
362
362
|
* Deletes the specified fields from the hash stored at key.
|
|
363
363
|
*
|
|
364
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hdel
|
|
364
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hdel
|
|
365
365
|
*
|
|
366
366
|
* @param key - key holding the hash to delete the fields of
|
|
367
367
|
* @param fields - fields to delete from the hash
|
|
@@ -372,7 +372,7 @@ export class Client {
|
|
|
372
372
|
/**
|
|
373
373
|
* Returns all fields and values of the hash stored at key.
|
|
374
374
|
*
|
|
375
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hgetall
|
|
375
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hgetall
|
|
376
376
|
*
|
|
377
377
|
* @param key - the key holding the hash to get the fields of
|
|
378
378
|
* @returns a promise that resolves to an object of field/value pairs.
|
|
@@ -382,7 +382,7 @@ export class Client {
|
|
|
382
382
|
/**
|
|
383
383
|
* Returns all fields of the hash stored at key.
|
|
384
384
|
*
|
|
385
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hkeys
|
|
385
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hkeys
|
|
386
386
|
*
|
|
387
387
|
* @param key - the key holding the hash to get the fields of
|
|
388
388
|
* @returns a promise that resolves to an array of field names.
|
|
@@ -392,7 +392,7 @@ export class Client {
|
|
|
392
392
|
/**
|
|
393
393
|
* Returns all values of the hash stored at key.
|
|
394
394
|
*
|
|
395
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hvals
|
|
395
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hvals
|
|
396
396
|
*
|
|
397
397
|
* @param key - the key holding the hash to get the fields' values of
|
|
398
398
|
* @returns a promise that resolves to an array of field values.
|
|
@@ -402,7 +402,7 @@ export class Client {
|
|
|
402
402
|
/**
|
|
403
403
|
* Return the number of fields contained in the hash stored at key.
|
|
404
404
|
*
|
|
405
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hlen
|
|
405
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hlen
|
|
406
406
|
*
|
|
407
407
|
* @param key - the key holding the hash to get the number of fields of
|
|
408
408
|
* @returns a promise that resolves to the number of fields in the hash.
|
|
@@ -416,7 +416,7 @@ export class Client {
|
|
|
416
416
|
* If the field does not exist, it is set to 0 before the operation is performed.
|
|
417
417
|
* If the field does not hold a nummerical value, the returned promise will be rejected.
|
|
418
418
|
*
|
|
419
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-hincrby
|
|
419
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-hincrby
|
|
420
420
|
*
|
|
421
421
|
* @param key - the key holding the hash to get the number of fields of
|
|
422
422
|
* @param field - the hash's field to increment the value of
|
|
@@ -431,7 +431,7 @@ export class Client {
|
|
|
431
431
|
* Specified elements that are already a member of the set are ignored.
|
|
432
432
|
* If the key does not exist, a new set is created before adding the specified elements.
|
|
433
433
|
*
|
|
434
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-sadd
|
|
434
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-sadd
|
|
435
435
|
*
|
|
436
436
|
* @param key - the key holding the set to add a member to
|
|
437
437
|
* @param members - the members to add to the set
|
|
@@ -445,7 +445,7 @@ export class Client {
|
|
|
445
445
|
* Specified members that are not a member of this set are ignored.
|
|
446
446
|
* If key does not exist, it is treated as an empty set and this command returns 0.
|
|
447
447
|
*
|
|
448
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-srem
|
|
448
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-srem
|
|
449
449
|
*
|
|
450
450
|
* @param key - the key holding the set to remove a member from
|
|
451
451
|
* @param members - the members to remove from the set
|
|
@@ -456,7 +456,7 @@ export class Client {
|
|
|
456
456
|
/**
|
|
457
457
|
* Returns whether or not the specified member is a member of the set stored at key.
|
|
458
458
|
*
|
|
459
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-sismembers
|
|
459
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-sismembers
|
|
460
460
|
*
|
|
461
461
|
* @param key - the key holding the set to check the belonging of
|
|
462
462
|
* @param member - the member to check the belonging of
|
|
@@ -467,7 +467,7 @@ export class Client {
|
|
|
467
467
|
/**
|
|
468
468
|
* Returns the members of the set stored at key.
|
|
469
469
|
*
|
|
470
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-smembers
|
|
470
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-smembers
|
|
471
471
|
*
|
|
472
472
|
* @param key - the key holding the set to get the members of
|
|
473
473
|
* @returns a promise that resolves to an array of members in the set.
|
|
@@ -477,7 +477,7 @@ export class Client {
|
|
|
477
477
|
/**
|
|
478
478
|
* Returns a random member of the set value stored at key.
|
|
479
479
|
*
|
|
480
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-srandmember
|
|
480
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-srandmember
|
|
481
481
|
*
|
|
482
482
|
* @param key - the key holding the set to get the random member of
|
|
483
483
|
* @returns a promise that resolves to a random member of the set.
|
|
@@ -487,7 +487,7 @@ export class Client {
|
|
|
487
487
|
/**
|
|
488
488
|
* Pops a random member from the set stored at key.
|
|
489
489
|
*
|
|
490
|
-
* https://k6.io/docs/javascript-api/k6-redis/client/client-spop
|
|
490
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/client/client-spop
|
|
491
491
|
*
|
|
492
492
|
* @param key - the key holding the set to pop the random member of
|
|
493
493
|
* @returns a promise that resolves to the popped member.
|
|
@@ -498,7 +498,7 @@ export class Client {
|
|
|
498
498
|
/**
|
|
499
499
|
* Options for configuring the redis Client.
|
|
500
500
|
*
|
|
501
|
-
* https://k6.io/docs/javascript-api/k6-redis/options
|
|
501
|
+
* https://k6.io/docs/javascript-api/k6-experimental/redis/options
|
|
502
502
|
*/
|
|
503
503
|
export interface Options {
|
|
504
504
|
/**
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides ways to instrument k6 scripts HTTP calls with tracing information.
|
|
3
|
+
*
|
|
4
|
+
* It most notably exposes an `instrumentHTTP` function that can be used to wrap the `http` module's
|
|
5
|
+
* function calls with tracing information. It also exposes a `Client` class that can be used to
|
|
6
|
+
* instrument HTTP calls in a more fine-grained way.
|
|
7
|
+
*
|
|
8
|
+
* https://k6.io/docs/javascript-api/k6-experimental/tracing/
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { RefinedParams, RefinedResponse, RequestBody, ResponseType } from '../http';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The instrumentHTTP function instruments the k6 http module
|
|
15
|
+
* with tracing capabilities. It will transparently replace each
|
|
16
|
+
* of the k6 http module functions with its instrumented
|
|
17
|
+
* counterpart, in place.
|
|
18
|
+
*
|
|
19
|
+
* instrumentHTTP can only be called in the init context of the script.
|
|
20
|
+
*
|
|
21
|
+
* @param options - The options to use when instrumenting the http module.
|
|
22
|
+
*/
|
|
23
|
+
export function instrumentHTTP(options: Options): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Client is an HTTP client class that attaches tracing information
|
|
27
|
+
* to its requests.
|
|
28
|
+
*
|
|
29
|
+
* It lets users include a tracing context in their HTTP requests
|
|
30
|
+
* so that tracing backends (such as Grafana Tempo) can incorporate
|
|
31
|
+
* their results.
|
|
32
|
+
*
|
|
33
|
+
* https://k6.io/docs/javascript-api/k6-experimental/tracing/client/
|
|
34
|
+
*/
|
|
35
|
+
export class Client {
|
|
36
|
+
protected __brand: never;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Instantiates a new tracing Client.
|
|
40
|
+
*
|
|
41
|
+
* @param options - The options to use for this Client.
|
|
42
|
+
*/
|
|
43
|
+
constructor(options: Options);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Performs a DELETE request instrumented with trace context
|
|
47
|
+
* headers.
|
|
48
|
+
*
|
|
49
|
+
* @param url - Request URL.
|
|
50
|
+
* @param body - Discouraged. Request body. Object form encoded.
|
|
51
|
+
* @param params - Request parameters.
|
|
52
|
+
* @returns Resulting response.
|
|
53
|
+
*/
|
|
54
|
+
del<RT extends ResponseType | undefined>(
|
|
55
|
+
url: string | HttpURL,
|
|
56
|
+
body?: RequestBody | null,
|
|
57
|
+
params?: RefinedParams<RT> | null
|
|
58
|
+
): RefinedResponse<RT>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Performs a HEAD request instrumented with trace context headers.
|
|
62
|
+
*
|
|
63
|
+
* @param url - Request URL.
|
|
64
|
+
* @param params - Request parameters.
|
|
65
|
+
* @returns Resulting response.
|
|
66
|
+
*/
|
|
67
|
+
head<RT extends ResponseType | undefined>(
|
|
68
|
+
url: string | HttpURL,
|
|
69
|
+
params?: RefinedParams<RT> | null
|
|
70
|
+
): RefinedResponse<RT>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Performs a GET request instrumented with trace context headers.
|
|
74
|
+
*
|
|
75
|
+
* @param url - Request URL.
|
|
76
|
+
* @param params - Request parameters.
|
|
77
|
+
* @returns Resulting response.
|
|
78
|
+
*/
|
|
79
|
+
get<RT extends ResponseType | undefined>(
|
|
80
|
+
url: string | HttpURL,
|
|
81
|
+
params?: RefinedParams<RT> | null
|
|
82
|
+
): RefinedResponse<RT>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Performs an OPTIONS request instrumented with trace context headers.
|
|
86
|
+
*
|
|
87
|
+
* @param url - Request URL.
|
|
88
|
+
* @param body - Request body. Object form encoded.
|
|
89
|
+
* @param params - Request parameters.
|
|
90
|
+
* @returns Resulting response.
|
|
91
|
+
*/
|
|
92
|
+
options<RT extends ResponseType | undefined>(
|
|
93
|
+
url: string | HttpURL,
|
|
94
|
+
body?: RequestBody | null,
|
|
95
|
+
params?: RefinedParams<RT> | null
|
|
96
|
+
): RefinedResponse<RT>;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Performs a PATCH request instrumented with trace context headers.
|
|
100
|
+
*
|
|
101
|
+
* @param url - Request URL.
|
|
102
|
+
* @param body - Request body. Object form encoded.
|
|
103
|
+
* @param params - Request parameters.
|
|
104
|
+
* @returns Resulting response.
|
|
105
|
+
*/
|
|
106
|
+
patch<RT extends ResponseType | undefined>(
|
|
107
|
+
url: string | HttpURL,
|
|
108
|
+
body?: RequestBody | null,
|
|
109
|
+
params?: RefinedParams<RT> | null
|
|
110
|
+
): RefinedResponse<RT>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Performs a POST request instrumented with trace context headers.
|
|
114
|
+
*
|
|
115
|
+
* @param url - Request URL.
|
|
116
|
+
* @param body - Request body. Object form encoded.
|
|
117
|
+
* @param params - Request parameters.
|
|
118
|
+
* @returns Resulting response.
|
|
119
|
+
*/
|
|
120
|
+
post<RT extends ResponseType | undefined>(
|
|
121
|
+
url: string | HttpURL,
|
|
122
|
+
body?: RequestBody | null,
|
|
123
|
+
params?: RefinedParams<RT> | null
|
|
124
|
+
): RefinedResponse<RT>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Performs a PUT request instrumented with trace context headers.
|
|
128
|
+
*
|
|
129
|
+
* @param url - Request URL.
|
|
130
|
+
* @param body - Request body. Object form encoded.
|
|
131
|
+
* @param params - Request parameters.
|
|
132
|
+
* @returns Resulting response.
|
|
133
|
+
*/
|
|
134
|
+
put<RT extends ResponseType | undefined>(
|
|
135
|
+
url: string | HttpURL,
|
|
136
|
+
body?: RequestBody | null,
|
|
137
|
+
params?: RefinedParams<RT> | null
|
|
138
|
+
): RefinedResponse<RT>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Performs a HTTP request instrumented with trace context headers.
|
|
142
|
+
*
|
|
143
|
+
* @param method - HTTP method.
|
|
144
|
+
* @param url - Request URL.
|
|
145
|
+
* @param body - Request body. Object form encoded.
|
|
146
|
+
* @param params - Request parameters.
|
|
147
|
+
* @returns Resulting response.
|
|
148
|
+
*/
|
|
149
|
+
request<RT extends ResponseType | undefined>(
|
|
150
|
+
method: string,
|
|
151
|
+
url: string | HttpURL,
|
|
152
|
+
body?: RequestBody | null,
|
|
153
|
+
params?: RefinedParams<RT> | null
|
|
154
|
+
): RefinedResponse<RT>;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The asyncRequest method starts the process of performing a HTTP request
|
|
158
|
+
* asynchronously, returning a promise which is fulfilled once the response
|
|
159
|
+
* is available. The performed request is instrumented with trace context
|
|
160
|
+
* headers.
|
|
161
|
+
*
|
|
162
|
+
* @param method - HTTP method.
|
|
163
|
+
* @param url - Request URL.
|
|
164
|
+
* @param body - Request body. Object form encoded.
|
|
165
|
+
* @param params - Request parameters.
|
|
166
|
+
* @returns Resulting response.
|
|
167
|
+
*/
|
|
168
|
+
asyncRequest<RT extends ResponseType | undefined>(
|
|
169
|
+
method: string,
|
|
170
|
+
url: string | HttpURL,
|
|
171
|
+
body?: RequestBody | null,
|
|
172
|
+
params?: RefinedParams<RT> | null
|
|
173
|
+
): Promise<RefinedResponse<RT>>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The Options object allows configuring the tracing instrumentation behavior.
|
|
178
|
+
*
|
|
179
|
+
* https://k6.io/docs/javascript-api/k6-experimental/tracing/options/
|
|
180
|
+
*/
|
|
181
|
+
export interface Options {
|
|
182
|
+
/**
|
|
183
|
+
* The trace context propagation format.
|
|
184
|
+
*
|
|
185
|
+
* Currently supported: `w3c` and `jaeger`.
|
|
186
|
+
*
|
|
187
|
+
* Defaults to `w3c`.
|
|
188
|
+
*/
|
|
189
|
+
propagator: 'w3c' | 'jaeger';
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The probability of each request having
|
|
193
|
+
* its `sampled` flag set to true.
|
|
194
|
+
* Its value should be within the `0 <= n <= 100` bounds.
|
|
195
|
+
*
|
|
196
|
+
* Defaults to `100`.
|
|
197
|
+
*/
|
|
198
|
+
sampling?: number;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Returned value from http.url method.
|
|
203
|
+
*/
|
|
204
|
+
export interface HttpURL {
|
|
205
|
+
__brand: "http-url";
|
|
206
|
+
}
|
k6/experimental/websockets.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { CookieJar } from '../http';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* This module provides an experimental implementation of the WebSocket API
|
|
3
5
|
* for k6.
|
|
6
|
+
*
|
|
7
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
10
|
/**
|
|
@@ -37,13 +41,17 @@ export class WebSocket {
|
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
43
|
* The Websocket constructor returns a newly created WebSocket object.
|
|
44
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/
|
|
40
45
|
*
|
|
41
46
|
* @param url - The URL to which to connect; this should be the URL to which the WebSocket server will respond.
|
|
47
|
+
* @param protocols - Either a single protocol string or an array of protocol strings. The param is reserved for future use and will be presently ignored.
|
|
48
|
+
* @param params - Used for setting various WebSocket connection parameters such as headers, cookie jar, compression, etc.
|
|
42
49
|
*/
|
|
43
|
-
constructor(url: string);
|
|
50
|
+
constructor(url: string, protocols?: null, params?: Params | null);
|
|
44
51
|
|
|
45
52
|
/**
|
|
46
53
|
* Enqueues data to be transmitted to the server over the WebSocket connection.
|
|
54
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-send/
|
|
47
55
|
*
|
|
48
56
|
* @param data - the data to send to the server
|
|
49
57
|
*/
|
|
@@ -52,16 +60,91 @@ export class WebSocket {
|
|
|
52
60
|
/**
|
|
53
61
|
* Bind event names to event handlers to be executed when their
|
|
54
62
|
* respective event is received by the server.
|
|
63
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-addeventlistener/
|
|
55
64
|
*
|
|
56
65
|
* @param event - the event to listen for
|
|
57
66
|
* @param listener - the callback to invoke when the event is emitted
|
|
58
67
|
*/
|
|
59
|
-
addEventListener(event: EventName, listener: (
|
|
68
|
+
addEventListener(event: EventName, listener: (event: MessageEvent | ErrorEvent) => void): void;
|
|
60
69
|
|
|
61
70
|
/**
|
|
62
71
|
* Closes the WebSocket connection or connection attempt, if any.
|
|
72
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-close/
|
|
73
|
+
*
|
|
74
|
+
* @param code - An integer WebSocket connection close code value indicating a reason for closure.
|
|
75
|
+
* @param reason - A human-readable string WebSocket connection close reason. No longer than 123 bytes of UTF-8 text.
|
|
76
|
+
*/
|
|
77
|
+
close(code?: number, reason?: string): void;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Sends a ping message over the WebSocket connection.
|
|
81
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-ping/
|
|
82
|
+
*/
|
|
83
|
+
ping(): void;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Sets an event handler which is invoked when a message event happens.
|
|
87
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-onmessage/
|
|
88
|
+
*
|
|
89
|
+
* @param event - the message event
|
|
63
90
|
*/
|
|
64
|
-
|
|
91
|
+
onmessage: (event?: MessageEvent) => void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Sets an event handler which is invoked when the WebSocket connection's opens.
|
|
95
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-onopen/
|
|
96
|
+
*/
|
|
97
|
+
onopen: () => void;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Sets an event handler which is invoked when the WebSocket connection's closes.
|
|
101
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-onclose/
|
|
102
|
+
*/
|
|
103
|
+
onclose: () => void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Sets an event handler which is invoked when errors occur.
|
|
107
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-onerror/
|
|
108
|
+
*
|
|
109
|
+
* @param event - the error event
|
|
110
|
+
*/
|
|
111
|
+
onerror: (event?: ErrorEvent) => void;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Sets an event handler which is invoked when a ping message is received.
|
|
115
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-onping/
|
|
116
|
+
*/
|
|
117
|
+
onping: () => void;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Sets an event handler which is invoked when a pong message is received.
|
|
121
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/websocket/websocket-onpong/
|
|
122
|
+
*/
|
|
123
|
+
onpong: () => void;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* k6 specific WebSocket parameters.
|
|
128
|
+
* https://k6.io/docs/javascript-api/k6-experimental/websockets/params/
|
|
129
|
+
*/
|
|
130
|
+
export interface Params {
|
|
131
|
+
/** Request headers. */
|
|
132
|
+
headers?: Record<string, string>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Compression algorithm.
|
|
136
|
+
* If the option is left unset, it defaults to no compression.
|
|
137
|
+
*/
|
|
138
|
+
compression?: CompressionAlgorithm;
|
|
139
|
+
|
|
140
|
+
/** The custom metric tags. */
|
|
141
|
+
tags?: Record<string, number | string | boolean>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The cookie jar that will be used when making the initial HTTP request to establish the WebSocket connection.
|
|
145
|
+
* If empty, the default VU cookie jar will be used.
|
|
146
|
+
*/
|
|
147
|
+
jar?: CookieJar;
|
|
65
148
|
}
|
|
66
149
|
|
|
67
150
|
/**
|
|
@@ -90,10 +173,15 @@ export enum ReadyState {
|
|
|
90
173
|
}
|
|
91
174
|
|
|
92
175
|
/**
|
|
93
|
-
*
|
|
176
|
+
* BinaryType describes the possible types of binary data that can be
|
|
94
177
|
* transmitted over a Websocket connection.
|
|
95
178
|
*/
|
|
96
|
-
export
|
|
179
|
+
export enum BinaryType {
|
|
180
|
+
/**
|
|
181
|
+
* Binary data is returned in ArrayBuffer form. k6 supports only this type.
|
|
182
|
+
*/
|
|
183
|
+
ArrayBuffer = 'ArrayBuffer'
|
|
184
|
+
}
|
|
97
185
|
|
|
98
186
|
/**
|
|
99
187
|
* EventName describes the possible events that can be emitted
|
|
@@ -101,7 +189,7 @@ export type BinaryType = 'arrayBuffer';
|
|
|
101
189
|
*/
|
|
102
190
|
export enum EventName {
|
|
103
191
|
/**
|
|
104
|
-
* Event fired when the connection is opened and ready to
|
|
192
|
+
* Event fired when the connection is opened and ready to communicate.
|
|
105
193
|
*/
|
|
106
194
|
Open = 'open',
|
|
107
195
|
|
|
@@ -119,10 +207,20 @@ export enum EventName {
|
|
|
119
207
|
* Event fired when a message has been received from the server.
|
|
120
208
|
*/
|
|
121
209
|
Message = 'message',
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Event fired when a ping message has been received from the server.
|
|
213
|
+
*/
|
|
214
|
+
Ping = 'ping',
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Event fired when a pong message has been received from the server.
|
|
218
|
+
*/
|
|
219
|
+
Pong = 'pong',
|
|
122
220
|
}
|
|
123
221
|
|
|
124
222
|
/**
|
|
125
|
-
* MessageEvent is a simple
|
|
223
|
+
* MessageEvent is a simple interface that holds the data of a message received from the server.
|
|
126
224
|
*/
|
|
127
225
|
export interface MessageEvent {
|
|
128
226
|
/**
|
|
@@ -136,9 +234,9 @@ export interface MessageEvent {
|
|
|
136
234
|
type: MessageType;
|
|
137
235
|
|
|
138
236
|
/**
|
|
139
|
-
* The time
|
|
237
|
+
* The read-only property that returns the time (in milliseconds) at which the event was created.
|
|
140
238
|
*/
|
|
141
|
-
|
|
239
|
+
timestamp: number;
|
|
142
240
|
}
|
|
143
241
|
|
|
144
242
|
/**
|
|
@@ -174,3 +272,34 @@ export enum MessageType {
|
|
|
174
272
|
*/
|
|
175
273
|
PongMessage = 10,
|
|
176
274
|
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* ErrorEvent is a simple interface that holds the data of an error event.
|
|
278
|
+
*/
|
|
279
|
+
export interface ErrorEvent {
|
|
280
|
+
/**
|
|
281
|
+
* the type of the event.
|
|
282
|
+
*/
|
|
283
|
+
type: MessageType;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The read-only property that returns the error message.
|
|
287
|
+
*/
|
|
288
|
+
error: string;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* The read-only property that returns the time (in milliseconds) at which the event was created.
|
|
292
|
+
*/
|
|
293
|
+
timestamp: number;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* CompressionAlgorithm describes the possible compression algorithms.
|
|
298
|
+
*/
|
|
299
|
+
export enum CompressionAlgorithm {
|
|
300
|
+
/**
|
|
301
|
+
* Deflate compression algorithm.
|
|
302
|
+
* k6 supports only this compression algorithm.
|
|
303
|
+
*/
|
|
304
|
+
Deflate = 'deflate'
|
|
305
|
+
}
|
k6/http.d.ts
CHANGED
|
@@ -123,6 +123,26 @@ export function request<RT extends ResponseType | undefined>(
|
|
|
123
123
|
params?: RefinedParams<RT> | null
|
|
124
124
|
): RefinedResponse<RT>;
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Make async request.
|
|
128
|
+
* https://k6.io/docs/javascript-api/k6-http/asyncrequest/
|
|
129
|
+
* @param method - HTTP method.
|
|
130
|
+
* @param url - Request URL.
|
|
131
|
+
* @param body - Request body. Object form encoded.
|
|
132
|
+
* @param params - Request parameters.
|
|
133
|
+
* @returns Resulting response.
|
|
134
|
+
* @example
|
|
135
|
+
* let formData = {name: 'k6'};
|
|
136
|
+
* let headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
137
|
+
* http.asyncRequest('POST', url, formData, { headers: headers });
|
|
138
|
+
*/
|
|
139
|
+
export function asyncRequest<RT extends ResponseType | undefined>(
|
|
140
|
+
method: string,
|
|
141
|
+
url: string | HttpURL,
|
|
142
|
+
body?: RequestBody | null,
|
|
143
|
+
params?: RefinedParams<RT> | null
|
|
144
|
+
): Promise<RefinedResponse<RT>>;
|
|
145
|
+
|
|
126
146
|
/**
|
|
127
147
|
* Batch multiple HTTP requests together,
|
|
128
148
|
* to issue them in parallel over multiple TCP connections.
|
|
@@ -903,6 +923,26 @@ declare namespace http {
|
|
|
903
923
|
params?: RefinedParams<RT> | null
|
|
904
924
|
): RefinedResponse<RT>;
|
|
905
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Make async request.
|
|
928
|
+
* https://k6.io/docs/javascript-api/k6-http/asyncrequest/
|
|
929
|
+
* @param method - HTTP method.
|
|
930
|
+
* @param url - Request URL.
|
|
931
|
+
* @param body - Request body. Object form encoded.
|
|
932
|
+
* @param params - Request parameters.
|
|
933
|
+
* @returns Resulting response.
|
|
934
|
+
* @example
|
|
935
|
+
* let formData = {name: 'k6'};
|
|
936
|
+
* let headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
937
|
+
* http.asyncRequest('POST', url, formData, { headers: headers });
|
|
938
|
+
*/
|
|
939
|
+
function asyncRequest<RT extends ResponseType | undefined>(
|
|
940
|
+
method: string,
|
|
941
|
+
url: string | HttpURL,
|
|
942
|
+
body?: RequestBody | null,
|
|
943
|
+
params?: RefinedParams<RT> | null
|
|
944
|
+
): Promise<RefinedResponse<RT>>;
|
|
945
|
+
|
|
906
946
|
/**
|
|
907
947
|
* Creates a URL with set name tag.
|
|
908
948
|
* https://k6.io/docs/using-k6/http-requests/#url-grouping
|
k6/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
// Type definitions for k6 0.
|
|
1
|
+
// Type definitions for k6 0.43
|
|
2
2
|
// Project: https://k6.io/docs/
|
|
3
3
|
// Definitions by: na-- <https://github.com/na-->
|
|
4
4
|
// Mihail Stoykov <https://github.com/MStoykov>
|
|
5
5
|
// Ivan <https://github.com/codebien>
|
|
6
|
+
// Ivan Mirić <https://github.com/imiric>
|
|
6
7
|
// Théo Crevon <https://github.com/oleiade>
|
|
7
8
|
// Oleg Bespalov <https://github.com/olegbespalov>
|
|
8
9
|
// Pepe Cano <https://github.com/ppcano>
|
|
@@ -42,6 +43,7 @@ import './metrics';
|
|
|
42
43
|
import './options';
|
|
43
44
|
import './experimental/redis';
|
|
44
45
|
import './experimental/timers';
|
|
46
|
+
import './experimental/tracing';
|
|
45
47
|
import './experimental/websockets';
|
|
46
48
|
import './ws';
|
|
47
49
|
import './net/grpc';
|
k6/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/k6",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "TypeScript definitions for k6",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"url": "https://github.com/codebien",
|
|
21
21
|
"githubUsername": "codebien"
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Ivan Mirić",
|
|
25
|
+
"url": "https://github.com/imiric",
|
|
26
|
+
"githubUsername": "imiric"
|
|
27
|
+
},
|
|
23
28
|
{
|
|
24
29
|
"name": "Théo Crevon",
|
|
25
30
|
"url": "https://github.com/oleiade",
|
|
@@ -50,6 +55,6 @@
|
|
|
50
55
|
},
|
|
51
56
|
"scripts": {},
|
|
52
57
|
"dependencies": {},
|
|
53
|
-
"typesPublisherContentHash": "
|
|
54
|
-
"typeScriptVersion": "4.
|
|
58
|
+
"typesPublisherContentHash": "9a5f8c5ed0a28eaa972298a4b9dbd230251a9bde3528c3f1531dfad264024ad0",
|
|
59
|
+
"typeScriptVersion": "4.2"
|
|
55
60
|
}
|