@types/k6 0.54.1 → 0.57.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/index.d.ts +84 -0
- k6/experimental/csv/index.d.ts +16 -0
- k6/experimental/webcrypto/index.d.ts +91 -8
- k6/package.json +26 -3
- k6/experimental/browser/index.d.ts +0 -4888
- k6/experimental/tracing/index.d.ts +0 -208
k6/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for k6 (https://grafana.com/docs/k6/lates
|
|
|
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: Fri, 14 Feb 2025 12:02:58 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
k6/browser/index.d.ts
CHANGED
|
@@ -936,6 +936,65 @@ export interface ConsoleMessage {
|
|
|
936
936
|
type(): string;
|
|
937
937
|
}
|
|
938
938
|
|
|
939
|
+
/**
|
|
940
|
+
* {@link MetricMessage} objects are dispatched by page via the
|
|
941
|
+
* `page.on('metric')` event. For each metric that it measured and emitted for
|
|
942
|
+
* the page, k6 browser delivers it to the registered handlers.
|
|
943
|
+
*
|
|
944
|
+
* ```js
|
|
945
|
+
* // Listen for all metric messages in the page and call its tag method to
|
|
946
|
+
* // tag matching URLs with the new tag name.
|
|
947
|
+
* page.on('metric', (metric) => {
|
|
948
|
+
* metric.tag({
|
|
949
|
+
* name: 'test',
|
|
950
|
+
* matches: [
|
|
951
|
+
* {url: /^https:\/\/test\.k6\.io\/\?q=[0-9a-z]+$/, method: 'GET'},
|
|
952
|
+
* ]
|
|
953
|
+
* });
|
|
954
|
+
* });
|
|
955
|
+
* ```
|
|
956
|
+
*/
|
|
957
|
+
export interface MetricMessage {
|
|
958
|
+
/**
|
|
959
|
+
* tag will match the given `tagMatch.matches` with the current metric's URL
|
|
960
|
+
* and name tags. When a match is found it will use `tagMatch.name` to replace
|
|
961
|
+
* the existing URL and name tag values.
|
|
962
|
+
*
|
|
963
|
+
* Doing this helps group metrics with different URL and name tags that, in
|
|
964
|
+
* fact, reference the same resource, allowing for correlation over time and
|
|
965
|
+
* reducing the cardinality of the metrics.
|
|
966
|
+
* @param tagMatch
|
|
967
|
+
*/
|
|
968
|
+
tag(tagMatch: {
|
|
969
|
+
/**
|
|
970
|
+
* The name value that replaces the current metric's URL and name
|
|
971
|
+
* tag values, if a match is found. Required, and must not be an
|
|
972
|
+
* empty string.
|
|
973
|
+
*/
|
|
974
|
+
name: string;
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* An array of objects containing the matchers which will be used
|
|
978
|
+
* to match against the current metric's URL and name tags.
|
|
979
|
+
* Required.
|
|
980
|
+
*/
|
|
981
|
+
matches: Array<{
|
|
982
|
+
/**
|
|
983
|
+
* The regular expression used to find matches in the current
|
|
984
|
+
* metric's URL and name tags. Required.
|
|
985
|
+
*/
|
|
986
|
+
url: RegExp;
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Used to match the metric's method tag. It's optional, and when
|
|
990
|
+
* it's not set it will group all metrics regardless of the method
|
|
991
|
+
* tag.
|
|
992
|
+
*/
|
|
993
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD" | "TRACE" | "CONNECT";
|
|
994
|
+
}>;
|
|
995
|
+
}): void;
|
|
996
|
+
}
|
|
997
|
+
|
|
939
998
|
/**
|
|
940
999
|
* {@link Cookie} represents a cookie in a {@link BrowserContext}.
|
|
941
1000
|
*
|
|
@@ -2952,6 +3011,31 @@ export interface Page {
|
|
|
2952
3011
|
*/
|
|
2953
3012
|
on(event: "console", listener: (consoleMessage: ConsoleMessage) => void): void;
|
|
2954
3013
|
|
|
3014
|
+
/**
|
|
3015
|
+
* page.on('metric') will register a background handler that will listen out
|
|
3016
|
+
* for metrics that are measured and emitted for the page.
|
|
3017
|
+
*
|
|
3018
|
+
* When a {@link MetricMessage} is received by the handler, it can be used to
|
|
3019
|
+
* group different metrics tagged with URL and name so that a correlation can
|
|
3020
|
+
* be found and to reduce the cardinality of the metrics.
|
|
3021
|
+
*
|
|
3022
|
+
* **Usage**
|
|
3023
|
+
*
|
|
3024
|
+
* ```js
|
|
3025
|
+
* // Listen for all metric messages in the page and call its tag method to
|
|
3026
|
+
* // tag matching URLs with the new tag name.
|
|
3027
|
+
* page.on('metric', (metric) => {
|
|
3028
|
+
* metric.tag({
|
|
3029
|
+
* name: 'test',
|
|
3030
|
+
* matches: [
|
|
3031
|
+
* {url: /^https:\/\/test\.k6\.io\/\?q=[0-9a-z]+$/, method: 'GET'},
|
|
3032
|
+
* ]
|
|
3033
|
+
* });
|
|
3034
|
+
* });
|
|
3035
|
+
* ```
|
|
3036
|
+
*/
|
|
3037
|
+
on(event: "metric", listener: (metricMessage: MetricMessage) => void): void;
|
|
3038
|
+
|
|
2955
3039
|
/**
|
|
2956
3040
|
* Returns the page that opened the current page. The first page that is
|
|
2957
3041
|
* navigated to will have a null opener.
|
k6/experimental/csv/index.d.ts
CHANGED
|
@@ -75,6 +75,22 @@ export interface Options {
|
|
|
75
75
|
* The line number the parsing should stop at. Default is undefined.
|
|
76
76
|
*/
|
|
77
77
|
toLine?: number;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* AsObjects indicates that the CSV rows should be returned as objects, where
|
|
81
|
+
* the keys are the header column names, and values are the corresponding
|
|
82
|
+
* row values.
|
|
83
|
+
*
|
|
84
|
+
* When this option is enabled, the first line of the CSV file is treated as the header.
|
|
85
|
+
*
|
|
86
|
+
* If the option is set and no header line is present, this should be considered an error
|
|
87
|
+
* case.
|
|
88
|
+
*
|
|
89
|
+
* This option is incompatible with the `skipFirstLine` option, and if both are set, an error
|
|
90
|
+
* should be returned. Same thing applies if the `fromLine` option is set to a value greater
|
|
91
|
+
* than 0.
|
|
92
|
+
*/
|
|
93
|
+
asObjects?: boolean;
|
|
78
94
|
}
|
|
79
95
|
|
|
80
96
|
export * as default from "k6/experimental/csv";
|
|
@@ -43,7 +43,7 @@ export interface SubtleCrypto {
|
|
|
43
43
|
* @returns A promise that resolves with the decrypted data (also known as "plaintext").
|
|
44
44
|
*/
|
|
45
45
|
decrypt(
|
|
46
|
-
algorithm: AesCtrParams | AesCbcParams | AesGcmParams,
|
|
46
|
+
algorithm: AesCtrParams | AesCbcParams | AesGcmParams | RsaOaepParams,
|
|
47
47
|
key: CryptoKey,
|
|
48
48
|
data: ArrayBuffer | ArrayBufferView | DataView,
|
|
49
49
|
): Promise<ArrayBuffer>;
|
|
@@ -80,7 +80,7 @@ export interface SubtleCrypto {
|
|
|
80
80
|
* @returns A promise that resolves with the encrypted data (also known as "ciphertext").
|
|
81
81
|
*/
|
|
82
82
|
encrypt(
|
|
83
|
-
algorithm: AesCtrParams | AesCbcParams | AesGcmParams,
|
|
83
|
+
algorithm: AesCtrParams | AesCbcParams | AesGcmParams | RsaOaepParams,
|
|
84
84
|
key: CryptoKey,
|
|
85
85
|
data: ArrayBuffer | ArrayBufferView | DataView,
|
|
86
86
|
): Promise<ArrayBuffer>;
|
|
@@ -122,12 +122,12 @@ export interface SubtleCrypto {
|
|
|
122
122
|
* @param extractable indicates whether it will be possible to export the key using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey`.
|
|
123
123
|
* @param keyUsages indicates what can be done with the newly generated key.
|
|
124
124
|
* @throws {SyntaxError} - if the result is a `CryptoKey` of type `secret` or `private` but `keyUsages is empty.
|
|
125
|
-
* @returns A promise that resolves with the newly generated CryptoKeyPair`.
|
|
125
|
+
* @returns A promise that resolves with the newly generated `CryptoKeyPair`.
|
|
126
126
|
*/
|
|
127
127
|
generateKey(
|
|
128
|
-
algorithm: EcKeyGenParams,
|
|
128
|
+
algorithm: EcKeyGenParams | RSAHashedKeyGenParams,
|
|
129
129
|
extractable: boolean,
|
|
130
|
-
keyUsages: Array<"sign" | "verify" | "deriveKey" | "deriveBits">,
|
|
130
|
+
keyUsages: Array<"sign" | "verify" | "deriveKey" | "deriveBits" | "encrypt" | "decrypt">,
|
|
131
131
|
): Promise<CryptoKeyPair>;
|
|
132
132
|
|
|
133
133
|
/**
|
|
@@ -153,7 +153,8 @@ export interface SubtleCrypto {
|
|
|
153
153
|
| "AES-GCM"
|
|
154
154
|
| Algorithm<"AES-CBC" | "AES-CTR" | "AES-GCM">
|
|
155
155
|
| HmacImportParams
|
|
156
|
-
| EcKeyImportParams
|
|
156
|
+
| EcKeyImportParams
|
|
157
|
+
| RsaHashedImportParams,
|
|
157
158
|
extractable: boolean,
|
|
158
159
|
keyUsages: Array<"encrypt" | "decrypt" | "sign" | "verify" | "deriveKey" | "deriveBits">,
|
|
159
160
|
): Promise<CryptoKey>;
|
|
@@ -171,7 +172,7 @@ export interface SubtleCrypto {
|
|
|
171
172
|
* @returns A promise that resolves with the signature.
|
|
172
173
|
*/
|
|
173
174
|
sign(
|
|
174
|
-
algorithm: "HMAC" | Algorithm<"HMAC"> | EcdsaParams,
|
|
175
|
+
algorithm: "HMAC" | Algorithm<"HMAC"> | EcdsaParams | RsaPssParams,
|
|
175
176
|
key: CryptoKey,
|
|
176
177
|
data: ArrayBuffer | ArrayBufferView | DataView,
|
|
177
178
|
): Promise<ArrayBuffer>;
|
|
@@ -187,7 +188,7 @@ export interface SubtleCrypto {
|
|
|
187
188
|
* @returns A promise that resolves with a boolean indicating whether the signature is valid.
|
|
188
189
|
*/
|
|
189
190
|
verify(
|
|
190
|
-
algorithm: "HMAC" | Algorithm<"HMAC"> | EcdsaParams,
|
|
191
|
+
algorithm: "HMAC" | Algorithm<"HMAC"> | EcdsaParams | RsaPssParams,
|
|
191
192
|
key: CryptoKey,
|
|
192
193
|
signature: ArrayBuffer | ArrayBufferView | DataView,
|
|
193
194
|
data: ArrayBuffer | ArrayBufferView | DataView,
|
|
@@ -381,6 +382,24 @@ export interface AesGcmParams extends Algorithm<AlgorithmIdentifier> {
|
|
|
381
382
|
tagLength?: number;
|
|
382
383
|
}
|
|
383
384
|
|
|
385
|
+
/**
|
|
386
|
+
* The `RsaOaepParams` dictionary of the Web Crypto API represents the
|
|
387
|
+
* object that should be passed as the `algorithm` parameter of the
|
|
388
|
+
* `SubtleCrypto.encrypt()` and `SubtleCrypto.decrypt()` methods when
|
|
389
|
+
* using the RSA-OAEP algorithm.
|
|
390
|
+
*/
|
|
391
|
+
export interface RsaOaepParams extends Algorithm<AlgorithmIdentifier> {
|
|
392
|
+
/**
|
|
393
|
+
* The name of the algorithm to use.
|
|
394
|
+
*/
|
|
395
|
+
name: "RSA-OAEP";
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* The label to use. If not provided, it will default to an empty ArrayBuffer.
|
|
399
|
+
*/
|
|
400
|
+
label?: ArrayBuffer | ArrayBufferView | DataView;
|
|
401
|
+
}
|
|
402
|
+
|
|
384
403
|
/**
|
|
385
404
|
* The `HmacKeyGenParams` dictionary of the Web Crypto API represents the
|
|
386
405
|
* object that should be passed as the `algorithm` parameter of the
|
|
@@ -426,6 +445,34 @@ export interface EcKeyGenParams extends Algorithm<AlgorithmIdentifier> {
|
|
|
426
445
|
namedCurve: "P-256" | "P-384" | "P-521";
|
|
427
446
|
}
|
|
428
447
|
|
|
448
|
+
/**
|
|
449
|
+
* The RSAHashedKeyGenParams dictionary of the Web Crypto API represents the
|
|
450
|
+
* object that should be passed as the algorithm parameter into
|
|
451
|
+
* `SubtleCrypto.generateKey()`, when the algorithm is identified
|
|
452
|
+
* as either of RSASSA-PKCS1-v1_5, RSA-PSS or RSA-OAEP.
|
|
453
|
+
*/
|
|
454
|
+
export interface RSAHashedKeyGenParams extends Algorithm<AlgorithmIdentifier> {
|
|
455
|
+
/**
|
|
456
|
+
* The name of the algorithm to use.
|
|
457
|
+
*/
|
|
458
|
+
name: "RSASSA-PKCS1-v1_5" | "RSA-PSS" | "RSA-OAEP";
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* The modulus length, in bits.
|
|
462
|
+
*/
|
|
463
|
+
modulusLength: number;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* The public exponent.
|
|
467
|
+
*/
|
|
468
|
+
publicExponent: Uint8Array;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* The hash algorithm to use.
|
|
472
|
+
*/
|
|
473
|
+
hash: HashAlgorithmIdentifier;
|
|
474
|
+
}
|
|
475
|
+
|
|
429
476
|
/**
|
|
430
477
|
* The `HmacImportParams` dictionary of the Web Crypto API represents the
|
|
431
478
|
* object that should be passed as the `algorithm` parameter of the
|
|
@@ -471,6 +518,24 @@ export interface EcKeyImportParams extends Algorithm<AlgorithmIdentifier> {
|
|
|
471
518
|
namedCurve: "P-256" | "P-384" | "P-521";
|
|
472
519
|
}
|
|
473
520
|
|
|
521
|
+
/**
|
|
522
|
+
* The `RsaHashedImportParams` dictionary of the Web Crypto API represents
|
|
523
|
+
* the object that should be passed as the algorithm parameter
|
|
524
|
+
* into SubtleCrypto.importKey(), when the algorithm is identified
|
|
525
|
+
* as either of RSASSA-PKCS1-v1_5, RSA-PSS or RSA-OAEP.
|
|
526
|
+
*/
|
|
527
|
+
export interface RsaHashedImportParams extends Algorithm<AlgorithmIdentifier> {
|
|
528
|
+
/**
|
|
529
|
+
* The name of the algorithm to use.
|
|
530
|
+
*/
|
|
531
|
+
name: "RSASSA-PKCS1-v1_5" | "RSA-PSS" | "RSA-OAEP";
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* The hash algorithm to use.
|
|
535
|
+
*/
|
|
536
|
+
hash: HashAlgorithmIdentifier;
|
|
537
|
+
}
|
|
538
|
+
|
|
474
539
|
/**
|
|
475
540
|
* The `EcdsaParams` dictionary of the Web Crypto API represents
|
|
476
541
|
* the object that should be passed as the algorithm parameter
|
|
@@ -489,6 +554,24 @@ export interface EcdsaParams extends Algorithm<AlgorithmIdentifier> {
|
|
|
489
554
|
hash: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512";
|
|
490
555
|
}
|
|
491
556
|
|
|
557
|
+
/**
|
|
558
|
+
* The `RsaPssParams` dictionary of the Web Crypto API represents
|
|
559
|
+
* the object that should be passed as the algorithm parameter
|
|
560
|
+
* into SubtleCrypto.sign() or SubtleCrypto.verify()
|
|
561
|
+
* when using the RSA-PSS algorithm.
|
|
562
|
+
*/
|
|
563
|
+
export interface RsaPssParams extends Algorithm<AlgorithmIdentifier> {
|
|
564
|
+
/**
|
|
565
|
+
* The name of the algorithm to use.
|
|
566
|
+
*/
|
|
567
|
+
name: "RSA-PSS";
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* The length of the salt to use.
|
|
571
|
+
*/
|
|
572
|
+
saltLength: number;
|
|
573
|
+
}
|
|
574
|
+
|
|
492
575
|
/**
|
|
493
576
|
* The `EcdhKeyDeriveParams` dictionary of the Web Crypto API represents
|
|
494
577
|
* the object that should be passed as the algorithm parameter
|
k6/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/k6",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "TypeScript definitions for k6",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,6 +54,28 @@
|
|
|
54
54
|
"type": "module",
|
|
55
55
|
"main": "",
|
|
56
56
|
"types": "index.d.ts",
|
|
57
|
+
"exports": {
|
|
58
|
+
".": "./index.d.ts",
|
|
59
|
+
"./options": "./options/index.d.ts",
|
|
60
|
+
"./ws": "./ws/index.d.ts",
|
|
61
|
+
"./http": "./http/index.d.ts",
|
|
62
|
+
"./net/grpc": "./net/grpc/index.d.ts",
|
|
63
|
+
"./html": "./html/index.d.ts",
|
|
64
|
+
"./metrics": "./metrics/index.d.ts",
|
|
65
|
+
"./timers": "./timers/index.d.ts",
|
|
66
|
+
"./execution": "./execution/index.d.ts",
|
|
67
|
+
"./encoding": "./encoding/index.d.ts",
|
|
68
|
+
"./data": "./data/index.d.ts",
|
|
69
|
+
"./crypto": "./crypto/index.d.ts",
|
|
70
|
+
"./browser": "./browser/index.d.ts",
|
|
71
|
+
"./experimental/csv": "./experimental/csv/index.d.ts",
|
|
72
|
+
"./experimental/fs": "./experimental/fs/index.d.ts",
|
|
73
|
+
"./experimental/redis": "./experimental/redis/index.d.ts",
|
|
74
|
+
"./experimental/webcrypto": "./experimental/webcrypto/index.d.ts",
|
|
75
|
+
"./experimental/streams": "./experimental/streams/index.d.ts",
|
|
76
|
+
"./experimental/websockets": "./experimental/websockets/index.d.ts",
|
|
77
|
+
"./package.json": "./package.json"
|
|
78
|
+
},
|
|
57
79
|
"repository": {
|
|
58
80
|
"type": "git",
|
|
59
81
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
@@ -61,6 +83,7 @@
|
|
|
61
83
|
},
|
|
62
84
|
"scripts": {},
|
|
63
85
|
"dependencies": {},
|
|
64
|
-
"
|
|
65
|
-
"
|
|
86
|
+
"peerDependencies": {},
|
|
87
|
+
"typesPublisherContentHash": "79ec80084ae44067fc19284ceb94ca68d3fde05933adbba9cbbed4544a6f017b",
|
|
88
|
+
"typeScriptVersion": "5.0"
|
|
66
89
|
}
|