@types/k6 0.44.1 → 0.44.3

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 CHANGED
@@ -8,7 +8,7 @@ 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: Fri, 28 Apr 2023 16:02:49 GMT
11
+ * Last updated: Fri, 16 Jun 2023 07:32:49 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
k6/crypto.d.ts CHANGED
@@ -26,7 +26,7 @@ export function hmac<OE extends OutputEncoding>(
26
26
  algorithm: Algorithm,
27
27
  secret: string | ArrayBuffer,
28
28
  input: string | ArrayBuffer,
29
- outputEncoding: OE
29
+ outputEncoding: OE,
30
30
  ): Output<OE>;
31
31
 
32
32
  /**
@@ -38,10 +38,7 @@ export function hmac<OE extends OutputEncoding>(
38
38
  * @example
39
39
  * crypto.md4('hello world!', 'hex')
40
40
  */
41
- export function md4<OE extends OutputEncoding>(
42
- input: string | ArrayBuffer,
43
- outputEncoding: OE
44
- ): Output<OE>;
41
+ export function md4<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
45
42
 
46
43
  /**
47
44
  * Hash with MD5.
@@ -52,10 +49,7 @@ export function md4<OE extends OutputEncoding>(
52
49
  * @example
53
50
  * crypto.md5("hello world!", "hex")
54
51
  */
55
- export function md5<OE extends OutputEncoding>(
56
- input: string | ArrayBuffer,
57
- outputEncoding: OE
58
- ): Output<OE>;
52
+ export function md5<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
59
53
 
60
54
  /**
61
55
  * Hash with SHA-1.
@@ -66,10 +60,7 @@ export function md5<OE extends OutputEncoding>(
66
60
  * @example
67
61
  * crypto.sha1('hello world!', 'hex')
68
62
  */
69
- export function sha1<OE extends OutputEncoding>(
70
- input: string | ArrayBuffer,
71
- outputEncoding: OE
72
- ): Output<OE>;
63
+ export function sha1<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
73
64
 
74
65
  /**
75
66
  * Hash with SHA-256.
@@ -80,10 +71,7 @@ export function sha1<OE extends OutputEncoding>(
80
71
  * @example
81
72
  * crypto.sha256('hello world!', 'hex')
82
73
  */
83
- export function sha256<OE extends OutputEncoding>(
84
- input: string | ArrayBuffer,
85
- outputEncoding: OE
86
- ): Output<OE>;
74
+ export function sha256<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
87
75
 
88
76
  /**
89
77
  * Hash with SHA-384.
@@ -94,10 +82,7 @@ export function sha256<OE extends OutputEncoding>(
94
82
  * @example
95
83
  * crypto.sha384('hello world!', 'hex')
96
84
  */
97
- export function sha384<OE extends OutputEncoding>(
98
- input: string | ArrayBuffer,
99
- outputEncoding: OE
100
- ): Output<OE>;
85
+ export function sha384<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
101
86
 
102
87
  /**
103
88
  * Hash with SHA-512.
@@ -108,10 +93,7 @@ export function sha384<OE extends OutputEncoding>(
108
93
  * @example
109
94
  * crypto.sha512('hello world!', 'hex')
110
95
  */
111
- export function sha512<OE extends OutputEncoding>(
112
- input: string | ArrayBuffer,
113
- outputEncoding: OE
114
- ): Output<OE>;
96
+ export function sha512<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
115
97
 
116
98
  /**
117
99
  * Hash with SHA-512/224.
@@ -122,10 +104,7 @@ export function sha512<OE extends OutputEncoding>(
122
104
  * @example
123
105
  * crypto.sha512_224('hello world!', 'hex')
124
106
  */
125
- export function sha512_224<OE extends OutputEncoding>(
126
- input: string | ArrayBuffer,
127
- outputEncoding: OE
128
- ): Output<OE>;
107
+ export function sha512_224<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
129
108
 
130
109
  /**
131
110
  * Hash with SHA-512/256.
@@ -136,10 +115,7 @@ export function sha512_224<OE extends OutputEncoding>(
136
115
  * @example
137
116
  * crypto.sha512_256('hello world!', 'hex')
138
117
  */
139
- export function sha512_256<OE extends OutputEncoding>(
140
- input: string | ArrayBuffer,
141
- outputEncoding: OE
142
- ): Output<OE>;
118
+ export function sha512_256<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
143
119
 
144
120
  /**
145
121
  * Hash with RIPEMD-160.
@@ -150,10 +126,7 @@ export function sha512_256<OE extends OutputEncoding>(
150
126
  * @example
151
127
  * crypto.ripemd160('hello world!', 'hex')
152
128
  */
153
- export function ripemd160<OE extends OutputEncoding>(
154
- input: string | ArrayBuffer,
155
- outputEncoding: OE
156
- ): Output<OE>;
129
+ export function ripemd160<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
157
130
 
158
131
  /**
159
132
  * Create a hashing object.
@@ -277,7 +250,7 @@ declare namespace crypto {
277
250
  algorithm: Algorithm,
278
251
  secret: string | ArrayBuffer,
279
252
  input: string | ArrayBuffer,
280
- outputEncoding: OE
253
+ outputEncoding: OE,
281
254
  ): Output<OE>;
282
255
 
283
256
  /**
@@ -289,10 +262,7 @@ declare namespace crypto {
289
262
  * @example
290
263
  * crypto.md4('hello world!', 'hex')
291
264
  */
292
- function md4<OE extends OutputEncoding>(
293
- input: string | ArrayBuffer,
294
- outputEncoding: OE
295
- ): Output<OE>;
265
+ function md4<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
296
266
 
297
267
  /**
298
268
  * Hash with MD5.
@@ -303,10 +273,7 @@ declare namespace crypto {
303
273
  * @example
304
274
  * crypto.md5("hello world!", "hex")
305
275
  */
306
- function md5<OE extends OutputEncoding>(
307
- input: string | ArrayBuffer,
308
- outputEncoding: OE
309
- ): Output<OE>;
276
+ function md5<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
310
277
 
311
278
  /**
312
279
  * Hash with SHA-1.
@@ -317,10 +284,7 @@ declare namespace crypto {
317
284
  * @example
318
285
  * crypto.sha1('hello world!', 'hex')
319
286
  */
320
- function sha1<OE extends OutputEncoding>(
321
- input: string | ArrayBuffer,
322
- outputEncoding: OE
323
- ): Output<OE>;
287
+ function sha1<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
324
288
 
325
289
  /**
326
290
  * Hash with SHA-256.
@@ -331,10 +295,7 @@ declare namespace crypto {
331
295
  * @example
332
296
  * crypto.sha256('hello world!', 'hex')
333
297
  */
334
- function sha256<OE extends OutputEncoding>(
335
- input: string | ArrayBuffer,
336
- outputEncoding: OE
337
- ): Output<OE>;
298
+ function sha256<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
338
299
 
339
300
  /**
340
301
  * Hash with SHA-384.
@@ -345,10 +306,7 @@ declare namespace crypto {
345
306
  * @example
346
307
  * crypto.sha384('hello world!', 'hex')
347
308
  */
348
- function sha384<OE extends OutputEncoding>(
349
- input: string | ArrayBuffer,
350
- outputEncoding: OE
351
- ): Output<OE>;
309
+ function sha384<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
352
310
 
353
311
  /**
354
312
  * Hash with SHA-512.
@@ -359,10 +317,7 @@ declare namespace crypto {
359
317
  * @example
360
318
  * crypto.sha512('hello world!', 'hex')
361
319
  */
362
- function sha512<OE extends OutputEncoding>(
363
- input: string | ArrayBuffer,
364
- outputEncoding: OE
365
- ): Output<OE>;
320
+ function sha512<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
366
321
 
367
322
  /**
368
323
  * Hash with SHA-512/224.
@@ -373,10 +328,7 @@ declare namespace crypto {
373
328
  * @example
374
329
  * crypto.sha512_224('hello world!', 'hex')
375
330
  */
376
- function sha512_224<OE extends OutputEncoding>(
377
- input: string | ArrayBuffer,
378
- outputEncoding: OE
379
- ): Output<OE>;
331
+ function sha512_224<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
380
332
 
381
333
  /**
382
334
  * Hash with SHA-512/256.
@@ -387,10 +339,7 @@ declare namespace crypto {
387
339
  * @example
388
340
  * crypto.sha512_256('hello world!', 'hex')
389
341
  */
390
- function sha512_256<OE extends OutputEncoding>(
391
- input: string | ArrayBuffer,
392
- outputEncoding: OE
393
- ): Output<OE>;
342
+ function sha512_256<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
394
343
 
395
344
  /**
396
345
  * Hash with RIPEMD-160.
@@ -401,10 +350,7 @@ declare namespace crypto {
401
350
  * @example
402
351
  * crypto.ripemd160('hello world!', 'hex')
403
352
  */
404
- function ripemd160<OE extends OutputEncoding>(
405
- input: string | ArrayBuffer,
406
- outputEncoding: OE
407
- ): Output<OE>;
353
+ function ripemd160<OE extends OutputEncoding>(input: string | ArrayBuffer, outputEncoding: OE): Output<OE>;
408
354
 
409
355
  /**
410
356
  * Create a hashing object.
k6/data.d.ts CHANGED
@@ -7,10 +7,10 @@ export const SharedArray: {
7
7
  * Given a name and a function that returns an array, the SharedArray constructor returns the same array but sharing the array memory between VUs.
8
8
  * https://k6.io/docs/javascript-api/k6-data/sharedarray/
9
9
  */
10
- new(name: string, callback: () => []): [];
10
+ new (name: string, callback: () => []): [];
11
11
  /**
12
12
  * Given a name and a function that returns an array, the SharedArray constructor returns the same array but sharing the array memory between VUs.
13
13
  * https://k6.io/docs/javascript-api/k6-data/sharedarray/
14
14
  */
15
- new<T>(name: string, callback: () => T[]): T[];
15
+ new <T>(name: string, callback: () => T[]): T[];
16
16
  };
k6/encoding.d.ts CHANGED
@@ -24,7 +24,7 @@ export function b64decode(input: string, encoding?: Base64Variant): ArrayBuffer;
24
24
  * encoding.b64decode(str, 'rawstd')
25
25
  * const decodedString = encoding.b64decode(str, 'rawurl', 's')
26
26
  */
27
- export function b64decode(input: string, encoding: Base64Variant, format: 's'): string;
27
+ export function b64decode(input: string, encoding: Base64Variant, format: 's'): string;
28
28
 
29
29
  /**
30
30
  * Base64 encode a string.
@@ -0,0 +1,213 @@
1
+ import {
2
+ Rect,
3
+ ElementHandlePointerOptions,
4
+ ElementClickOptions,
5
+ KeyboardModifierOptions,
6
+ TimeoutOptions,
7
+ KeyboardPressOptions,
8
+ ScreenshotOptions,
9
+ ElementHandleOptions,
10
+ MouseMoveOptions,
11
+ StrictnessOptions,
12
+ InputElementState,
13
+ ElementState,
14
+ SelectOptionsObject,
15
+ } from './';
16
+ import { JSHandle } from './js_handle';
17
+ import { Frame } from './frame';
18
+
19
+ /**
20
+ * ElementHandle represents an in-page DOM element.
21
+ */
22
+ export class ElementHandle extends JSHandle {
23
+ /**
24
+ * Finds an element matching the specified selector in the `ElementHandle`'s subtree.
25
+ * @param selector A selector to query element for.
26
+ * @returns An `ElementHandle` pointing to the result element or `null`.
27
+ */
28
+ $(selector: string): ElementHandle | null;
29
+
30
+ /**
31
+ * Finds all elements matching the specified selector in the `ElementHandle`'s subtree.
32
+ * @param selector A selector to query element for.
33
+ * @returns A list of `ElementHandle`s pointing to the result elements.
34
+ */
35
+ $$(selector: string): ElementHandle[];
36
+
37
+ /**
38
+ * This method returns the bounding box of the element.
39
+ * @returns Element's bounding box.
40
+ */
41
+ boundingBox(): Rect;
42
+
43
+ /**
44
+ * Get the content frame for element handles.
45
+ * @returns The content frame handle of the element handle.
46
+ */
47
+ contentFrame(): Frame;
48
+
49
+ /**
50
+ * Fill the `input` or `textarea` element with the provided `value`.
51
+ * @param value Value to fill for the `input` or `textarea` element.
52
+ * @param options Element handle options.
53
+ */
54
+ fill(value: string, options?: ElementHandleOptions): void;
55
+
56
+ /**
57
+ * Focuses the element.
58
+ */
59
+ focus(): void;
60
+
61
+ /**
62
+ * Fetch the element's attribute value.
63
+ * @param name Attribute name to get the value for.
64
+ * @returns Attribute value.
65
+ */
66
+ getAttribute(name: string): string | null;
67
+
68
+ /**
69
+ * Scrolls element into view and hovers over its center point.
70
+ * @param options Hover options.
71
+ */
72
+ hover(options?: ElementClickOptions & KeyboardModifierOptions): void;
73
+
74
+ /**
75
+ * Returns the `element.innerHTML`.
76
+ * @returns Element's innerHTML.
77
+ */
78
+ innerHTML(): string;
79
+
80
+ /**
81
+ * Returns the `element.innerText`.
82
+ * @returns Element's innerText.
83
+ */
84
+ innerText(): string;
85
+
86
+ /**
87
+ * Returns `input.value` for the selected `input`, `textarea` or `select` element.
88
+ * @returns The input value of the element.
89
+ */
90
+ inputValue(options?: TimeoutOptions): string;
91
+
92
+ /**
93
+ * Checks if a checkbox or radio is checked.
94
+ * @returns Whether the element is checked.
95
+ */
96
+ isChecked(): boolean;
97
+
98
+ /**
99
+ * Checks if the element is disabled.
100
+ * @returns Whether the element is disabled.
101
+ */
102
+ isDisabled(): boolean;
103
+
104
+ /**
105
+ * Checks if the element is editable.
106
+ * @returns Whether the element is editable.
107
+ */
108
+ isEditable(): boolean;
109
+
110
+ /**
111
+ * Checks if the element is enabled.
112
+ * @returns Whether the element is enabled.
113
+ */
114
+ isEnabled(): boolean;
115
+
116
+ /**
117
+ * Checks if the element is hidden.
118
+ * @returns Whether the element is hidden.
119
+ */
120
+ isHidden(): boolean;
121
+
122
+ /**
123
+ * Checks if the element is visible.
124
+ * @returns Whether the element is visible.
125
+ */
126
+ isVisible(): boolean;
127
+
128
+ /**
129
+ * Returns the frame containing the given element.
130
+ * @returns The frame that contains the element handle.
131
+ */
132
+ ownerFrame(): Frame;
133
+
134
+ /**
135
+ * Focuses the element, and then uses `keyboard.down` and `keyboard.up` with the specified key.
136
+ * @param key A keyboard key name or a single character to press.
137
+ * @param options Keyboard press options.
138
+ */
139
+ press(key: string, options?: KeyboardPressOptions): void;
140
+
141
+ /**
142
+ * This method scrolls element into view, if needed, and then captures a
143
+ * screenshot of it.
144
+ * @param options Screenshot options.
145
+ * @returns An `ArrayBuffer` with the screenshot data.
146
+ */
147
+ screenshot(options?: ScreenshotOptions & TimeoutOptions): ArrayBuffer;
148
+
149
+ /**
150
+ * This method checks whether the element is actionable using provided options, and
151
+ * then tries to scroll it into view, unless it is completely visible.
152
+ * @param options Element handle options.
153
+ */
154
+ scrollIntoViewIfNeeded(options?: ElementHandleOptions): void;
155
+
156
+ /**
157
+ * Select one or more options of a `<select>` element which match the values.
158
+ * @param values Values of options to select.
159
+ * @param options Element handle options.
160
+ * @returns List of selected options.
161
+ */
162
+ selectOption(
163
+ values: string | ElementHandle | SelectOptionsObject | string[] | ElementHandle[] | SelectOptionsObject[],
164
+ options?: ElementHandleOptions,
165
+ ): string[];
166
+
167
+ /**
168
+ * Focuses the element and selects all its text content.
169
+ * @param options Element handle options.
170
+ */
171
+ selectText(options?: ElementHandleOptions): void;
172
+
173
+ /**
174
+ * Scrolls element into view if needed, and then uses `page.tapscreen` to tap in the center of the element
175
+ * or at the specified position.
176
+ * @param options Tap options.
177
+ */
178
+ tap(options?: MouseMoveOptions): void;
179
+
180
+ /**
181
+ * Returns the `node.textContent`.
182
+ * @returns The text content of the element.
183
+ */
184
+ textContent(): string;
185
+
186
+ /**
187
+ * Scrolls element into view, focuses element and types text.
188
+ * @param text Text to type into the element.
189
+ * @param options Typing options.
190
+ */
191
+ type(text: string, options?: KeyboardPressOptions): void;
192
+
193
+ /**
194
+ * Scrolls element into view, and if it's an input element of type
195
+ * checkbox that is already checked, clicks on it to mark it as unchecked.
196
+ * @param options Click options.
197
+ */
198
+ uncheck(options?: ElementClickOptions & StrictnessOptions): void;
199
+
200
+ /**
201
+ * Returns when the element satisfies the `state`.
202
+ * @param state Wait for element to satisfy this state.
203
+ * @param options Wait options.
204
+ */
205
+ waitForElementState(state: InputElementState, options?: TimeoutOptions): void;
206
+
207
+ /**
208
+ * Returns when the child element matching `selector` satisfies the `state`.
209
+ * @param selector A selector to query for.
210
+ * @param options Wait options.
211
+ */
212
+ waitForSelector(selector: string, options?: { state?: ElementState } & StrictnessOptions & TimeoutOptions): void;
213
+ }