@types/k6 0.57.1 → 1.0.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 +30 -0
- k6/experimental/webcrypto/index.d.ts +25 -0
- k6/package.json +3 -2
- k6/secrets/index.d.ts +36 -0
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, 21 Mar 2025 14:35:17 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
k6/browser/index.d.ts
CHANGED
|
@@ -3036,6 +3036,36 @@ export interface Page {
|
|
|
3036
3036
|
*/
|
|
3037
3037
|
on(event: "metric", listener: (metricMessage: MetricMessage) => void): void;
|
|
3038
3038
|
|
|
3039
|
+
/**
|
|
3040
|
+
* Registers a handler function to listen for the network requests that
|
|
3041
|
+
* the page makes. The handler will receive an instance of {@link Request},
|
|
3042
|
+
* which includes information about the request.
|
|
3043
|
+
*
|
|
3044
|
+
* **Usage**
|
|
3045
|
+
*
|
|
3046
|
+
* ```js
|
|
3047
|
+
* page.on('request', request => {
|
|
3048
|
+
* console.log(request.url());
|
|
3049
|
+
* });
|
|
3050
|
+
* ```
|
|
3051
|
+
*/
|
|
3052
|
+
on(event: "request", listener: (request: Request) => void): void;
|
|
3053
|
+
|
|
3054
|
+
/**
|
|
3055
|
+
* Registers a handler function to listen for the network responses that the
|
|
3056
|
+
* page receives. The handler will receive an instance of {@link Response},
|
|
3057
|
+
* which includes information about the response.
|
|
3058
|
+
*
|
|
3059
|
+
* **Usage**
|
|
3060
|
+
*
|
|
3061
|
+
* ```js
|
|
3062
|
+
* page.on('response', response => {
|
|
3063
|
+
* console.log(response.url());
|
|
3064
|
+
* });
|
|
3065
|
+
* ```
|
|
3066
|
+
*/
|
|
3067
|
+
on(event: "response", listener: (response: Response) => void): void;
|
|
3068
|
+
|
|
3039
3069
|
/**
|
|
3040
3070
|
* Returns the page that opened the current page. The first page that is
|
|
3041
3071
|
* navigated to will have a null opener.
|
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
* https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/webcrypto/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use global crypto instead.
|
|
10
|
+
*/
|
|
8
11
|
export const crypto: Crypto;
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use global crypto instead.
|
|
15
|
+
*/
|
|
10
16
|
export interface Crypto extends SubtleCrypto {
|
|
11
17
|
/**
|
|
12
18
|
* Returns a SubtleCrypto object providing access to common cryptographic
|
|
13
19
|
* primitives, like hashing, signing, encryption, or decryption.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated use global crypto.subtle instead.
|
|
14
22
|
*/
|
|
15
23
|
readonly subtle: SubtleCrypto;
|
|
16
24
|
|
|
@@ -20,6 +28,8 @@ export interface Crypto extends SubtleCrypto {
|
|
|
20
28
|
* @param typedArray - The TypedArray to fill with random values.
|
|
21
29
|
* @throws {QuotaExceededError} - thrown if the `byteLength` of `typedArray` exceeds 65536.
|
|
22
30
|
* @returns The typedArray argument.
|
|
31
|
+
*
|
|
32
|
+
* @deprecated use global crypto.getRandomValues crypto instead.
|
|
23
33
|
*/
|
|
24
34
|
getRandomValues(typedArray: TypedArray): TypedArray;
|
|
25
35
|
|
|
@@ -27,10 +37,15 @@ export interface Crypto extends SubtleCrypto {
|
|
|
27
37
|
* Returns a 36 character long string containing a cryptographically random UUID v4.
|
|
28
38
|
*
|
|
29
39
|
* @returns A 36 character long string containing a cryptographically random UUID v4.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated use global crypto.randomUUID instead.
|
|
30
42
|
*/
|
|
31
43
|
randomUUID(): string;
|
|
32
44
|
}
|
|
33
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated use global crypto.subtle instead.
|
|
48
|
+
*/
|
|
34
49
|
export interface SubtleCrypto {
|
|
35
50
|
/**
|
|
36
51
|
* The `decrypt()` method decrypts some encrypted data.
|
|
@@ -41,6 +56,7 @@ export interface SubtleCrypto {
|
|
|
41
56
|
* @throws {InvalidAccessError} - if the provided key cannot be used for the decrypt operation.
|
|
42
57
|
* @throws {OperationError} - if the operation failed for an operation-specific reason.
|
|
43
58
|
* @returns A promise that resolves with the decrypted data (also known as "plaintext").
|
|
59
|
+
* @deprecated use global crypto.subtle.decrypt instead.
|
|
44
60
|
*/
|
|
45
61
|
decrypt(
|
|
46
62
|
algorithm: AesCtrParams | AesCbcParams | AesGcmParams | RsaOaepParams,
|
|
@@ -63,6 +79,7 @@ export interface SubtleCrypto {
|
|
|
63
79
|
* @param algorithm names the algorithm to use.
|
|
64
80
|
* @param data the data to be digested
|
|
65
81
|
* @returns A promise that resolves with the digest value.
|
|
82
|
+
* @deprecated use global crypto.subtle.digest instead.
|
|
66
83
|
*/
|
|
67
84
|
digest(
|
|
68
85
|
algorithm: HashAlgorithmIdentifier | Algorithm<HashAlgorithmIdentifier>,
|
|
@@ -78,6 +95,7 @@ export interface SubtleCrypto {
|
|
|
78
95
|
* @throws {InvalidAccessError} - if the provided key cannot be used for the encrypt operation.
|
|
79
96
|
* @throws {OperationError} - if the operation failed for an operation-specific reason.
|
|
80
97
|
* @returns A promise that resolves with the encrypted data (also known as "ciphertext").
|
|
98
|
+
* @deprecated use global crypto.subtle.encrypt instead.
|
|
81
99
|
*/
|
|
82
100
|
encrypt(
|
|
83
101
|
algorithm: AesCtrParams | AesCbcParams | AesGcmParams | RsaOaepParams,
|
|
@@ -97,6 +115,7 @@ export interface SubtleCrypto {
|
|
|
97
115
|
* @throws {NotSupportedError} - if the format is not supported.
|
|
98
116
|
* @throws {TypeError} - when trying to use an invalid format.
|
|
99
117
|
* @returns A promise that resolves with the exported key.
|
|
118
|
+
* @deprecated use global crypto.subtle.exportKey instead.
|
|
100
119
|
*/
|
|
101
120
|
exportKey(format: "raw" | "jwk" | "spki" | "pkcs8", key: CryptoKey): Promise<ArrayBuffer | JWK>;
|
|
102
121
|
|
|
@@ -108,6 +127,7 @@ export interface SubtleCrypto {
|
|
|
108
127
|
* @param keyUsages indicates what can be done with the newly generated key.
|
|
109
128
|
* @throws {SyntaxError} - if the result is a `CryptoKey` of type `secret` or `private` but `keyUsages is empty.
|
|
110
129
|
* @returns A promise that resolves with the newly generated `CryptoKey`.
|
|
130
|
+
* @deprecated use global crypto.subtle.generateKey instead.
|
|
111
131
|
*/
|
|
112
132
|
generateKey(
|
|
113
133
|
algorithm: AesKeyGenParams | HmacKeyGenParams,
|
|
@@ -123,6 +143,7 @@ export interface SubtleCrypto {
|
|
|
123
143
|
* @param keyUsages indicates what can be done with the newly generated key.
|
|
124
144
|
* @throws {SyntaxError} - if the result is a `CryptoKey` of type `secret` or `private` but `keyUsages is empty.
|
|
125
145
|
* @returns A promise that resolves with the newly generated `CryptoKeyPair`.
|
|
146
|
+
* @deprecated use global crypto.subtle.generateKey instead.
|
|
126
147
|
*/
|
|
127
148
|
generateKey(
|
|
128
149
|
algorithm: EcKeyGenParams | RSAHashedKeyGenParams,
|
|
@@ -143,6 +164,7 @@ export interface SubtleCrypto {
|
|
|
143
164
|
* @throws {SyntaxError} - if the result is a `CryptoKey` of type `secret` or `private` but `keyUsages is empty.
|
|
144
165
|
* @throws {TypeError} - when trying to use an invalid format or if the `keyData` is not suited for that format.
|
|
145
166
|
* @returns A promise that resolves with the imported `CryptoKey`.
|
|
167
|
+
* @deprecated use global crypto.subtle.importKey instead.
|
|
146
168
|
*/
|
|
147
169
|
importKey(
|
|
148
170
|
format: "raw" | "jwk" | "spki" | "pkcs8",
|
|
@@ -170,6 +192,7 @@ export interface SubtleCrypto {
|
|
|
170
192
|
* @param data the data to sign.
|
|
171
193
|
* @throws {InvalidAccessError} - if the provided key cannot be used for the sign operation.
|
|
172
194
|
* @returns A promise that resolves with the signature.
|
|
195
|
+
* @deprecated use global crypto.subtle.sign instead.
|
|
173
196
|
*/
|
|
174
197
|
sign(
|
|
175
198
|
algorithm: "HMAC" | Algorithm<"HMAC"> | EcdsaParams | RsaPssParams,
|
|
@@ -186,6 +209,7 @@ export interface SubtleCrypto {
|
|
|
186
209
|
* @param data the data to verify.
|
|
187
210
|
* @throws {InvalidAccessError} - if the provided key cannot be used for the verify operation.
|
|
188
211
|
* @returns A promise that resolves with a boolean indicating whether the signature is valid.
|
|
212
|
+
* @deprecated use global crypto.subtle.verify instead.
|
|
189
213
|
*/
|
|
190
214
|
verify(
|
|
191
215
|
algorithm: "HMAC" | Algorithm<"HMAC"> | EcdsaParams | RsaPssParams,
|
|
@@ -200,6 +224,7 @@ export interface SubtleCrypto {
|
|
|
200
224
|
* @param algorithm defines the derivation algorithm to use.
|
|
201
225
|
* @param baseKey A `CryptoKey` representing the input to the derivation algorithm. Currently, only an ECDH private key is possible.
|
|
202
226
|
* @param length A number representing the number of bits to derive. Currently, the number should be a multiple of 8.
|
|
227
|
+
* @deprecated use global crypto.subtle.deriveBits instead.
|
|
203
228
|
*/
|
|
204
229
|
deriveBits(
|
|
205
230
|
algorithm: EcdhKeyDeriveParams,
|
k6/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/k6",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "TypeScript definitions for k6",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"./execution": "./execution/index.d.ts",
|
|
57
57
|
"./encoding": "./encoding/index.d.ts",
|
|
58
58
|
"./data": "./data/index.d.ts",
|
|
59
|
+
"./secrets": "./secrets/index.d.ts",
|
|
59
60
|
"./crypto": "./crypto/index.d.ts",
|
|
60
61
|
"./browser": "./browser/index.d.ts",
|
|
61
62
|
"./experimental/csv": "./experimental/csv/index.d.ts",
|
|
@@ -74,6 +75,6 @@
|
|
|
74
75
|
"scripts": {},
|
|
75
76
|
"dependencies": {},
|
|
76
77
|
"peerDependencies": {},
|
|
77
|
-
"typesPublisherContentHash": "
|
|
78
|
+
"typesPublisherContentHash": "58c97ff8e44e2c27110a210bdb48e95b60da0774d7f2d40e07084a3dc51e7fbd",
|
|
78
79
|
"typeScriptVersion": "5.0"
|
|
79
80
|
}
|
k6/secrets/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides a way to access secrets provided by secret sources
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
declare abstract class SecretSource {
|
|
6
|
+
/**
|
|
7
|
+
* get a secret from the default secret source if such is setup
|
|
8
|
+
*
|
|
9
|
+
* @param key - the key for the secret
|
|
10
|
+
* @returns a promise that will resolve to a string.
|
|
11
|
+
*/
|
|
12
|
+
get(key: string): Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* get a secret from the default secret source if such is setup
|
|
17
|
+
*
|
|
18
|
+
* @param key - the key for the secret
|
|
19
|
+
* @returns a promise that will resolve to a string.
|
|
20
|
+
*/
|
|
21
|
+
declare function get(key: string): Promise<string>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* returns a secret source for the provided name
|
|
25
|
+
*
|
|
26
|
+
* @param name - the name the secret source set with
|
|
27
|
+
* @returns a source with the name.
|
|
28
|
+
*/
|
|
29
|
+
declare function source(name: string): SecretSource;
|
|
30
|
+
|
|
31
|
+
declare const _default: {
|
|
32
|
+
"get": typeof get,
|
|
33
|
+
"source": typeof source,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default _default;
|