@types/k6 0.44.3 → 0.45.1

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.
@@ -0,0 +1,154 @@
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
+ plaintext?: boolean;
21
+
22
+ reflect?: boolean;
23
+
24
+ timeout?: string | number;
25
+
26
+ maxReceiveSize?: number;
27
+
28
+ maxSendSize?: number;
29
+ }
30
+
31
+ export interface Params {
32
+ /**
33
+ * @deprecated Use metadata instead.
34
+ */
35
+ headers?: object;
36
+
37
+ metadata?: object;
38
+
39
+ tags?: object;
40
+
41
+ timeout?: string | number;
42
+ }
43
+
44
+ export interface GrpcError {
45
+ code: number;
46
+ details: string[] | object[];
47
+ message: string;
48
+ }
49
+
50
+ /**
51
+ * This module provides classes for Remote Procedure Calls over HTTP/2.
52
+ * https://k6.io/docs/javascript-api/k6-experimental/grpc/
53
+ */
54
+ declare namespace grpc {
55
+ /**
56
+ * gRPC client to interact with a gRPC server.
57
+ * https://k6.io/docs/javascript-api/k6-experimental/grpc/client/
58
+ */
59
+ class Client {
60
+ protected __brand: never;
61
+
62
+ constructor();
63
+
64
+ /** Opens a connection to a gRPC server. */
65
+ connect(address: string, params?: ConnectParams): void;
66
+
67
+ /** Loads and parses the protocol buffer descriptors. */
68
+ load(importPaths: string[], ...protoFiles: string[]): void;
69
+
70
+ /** Loads a protoset and parses the protocol buffer descriptors */
71
+ loadProtoset(protosetPath: string): void;
72
+
73
+ /** Invokes an unary RPC request. */
74
+ invoke(url: string, request: object, params?: Params): Response;
75
+
76
+ /** Close the connection. */
77
+ close(): void;
78
+ }
79
+
80
+ /**
81
+ * StreamEvent describes the possible events that can be emitted
82
+ * by a gRPC stream.
83
+ */
84
+ enum StreamEvent {
85
+ /**
86
+ * Event fired when data has been received from the server.
87
+ */
88
+ Data = 'data',
89
+
90
+ /**
91
+ * Event fired when a stream has been closed due to an error.
92
+ */
93
+ Error = 'error',
94
+
95
+ /**
96
+ * Event fired when the stream closes.
97
+ */
98
+ End = 'end',
99
+ }
100
+
101
+ /**
102
+ * Stream allows you to use streaming RPCs.
103
+ */
104
+ class Stream {
105
+ /**
106
+ * The gRPC stream constructor, representing a single gRPC stream.
107
+ *
108
+ * @param client - the gRPC client to use, it must be connected.
109
+ * @param url - the RPC method to call.
110
+ * @param params - the parameters to use for the RPC call.
111
+ */
112
+ constructor(client: Client, url: string, params?: Params);
113
+
114
+ /**
115
+ * Set up handler functions for various events on the gRPC stream.
116
+ *
117
+ * @param event - the event to listen for
118
+ * @param listener - the callback to invoke when the event is emitted
119
+ */
120
+ on(event: StreamEvent, listener: (data: object | GrpcError | undefined) => void): void;
121
+
122
+ /**
123
+ * Writes a request to the stream.
124
+ *
125
+ * @param request - the request (message) to send to the server
126
+ */
127
+ write(request: object): void;
128
+
129
+ /**
130
+ * Signals to the server that the client has finished sending messages.
131
+ */
132
+ end(): void;
133
+ }
134
+
135
+ const StatusOK: number;
136
+ const StatusCanceled: number;
137
+ const StatusUnknown: number;
138
+ const StatusInvalidArgument: number;
139
+ const StatusDeadlineExceeded: number;
140
+ const StatusNotFound: number;
141
+ const StatusAlreadyExists: number;
142
+ const StatusPermissionDenied: number;
143
+ const StatusResourceExhausted: number;
144
+ const StatusFailedPrecondition: number;
145
+ const StatusAborted: number;
146
+ const StatusOutOfRange: number;
147
+ const StatusUnimplemented: number;
148
+ const StatusInternal: number;
149
+ const StatusUnavailable: number;
150
+ const StatusDataLoss: number;
151
+ const StatusUnauthenticated: number;
152
+ }
153
+
154
+ export default grpc;
k6/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for k6 0.44
1
+ // Type definitions for k6 0.45
2
2
  // Project: https://k6.io/docs/
3
3
  // Definitions by: na-- <https://github.com/na-->
4
4
  // Mihail Stoykov <https://github.com/MStoykov>
@@ -48,6 +48,7 @@ import './experimental/timers';
48
48
  import './experimental/tracing';
49
49
  import './experimental/webcrypto';
50
50
  import './experimental/websockets';
51
+ import './experimental/grpc';
51
52
  import './ws';
52
53
  import './net/grpc';
53
54
 
k6/options.d.ts CHANGED
@@ -242,6 +242,9 @@ export abstract class BaseScenario {
242
242
 
243
243
  /** Tags specific to this scenario. */
244
244
  tags?: { [name: string]: string };
245
+
246
+ /** Additional options for each scenario */
247
+ options?: ScenarioOptions;
245
248
  }
246
249
 
247
250
  /**
@@ -439,3 +442,8 @@ export type Scenario =
439
442
  | ConstantArrivalRateScenario
440
443
  | RampingArrivalRateScenario
441
444
  | ExternallyControlledScenario;
445
+
446
+ export interface ScenarioOptions {
447
+ /** Browser specific options */
448
+ browser?: any;
449
+ }
k6/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/k6",
3
- "version": "0.44.3",
3
+ "version": "0.45.1",
4
4
  "description": "TypeScript definitions for k6",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
6
6
  "license": "MIT",
@@ -60,6 +60,6 @@
60
60
  },
61
61
  "scripts": {},
62
62
  "dependencies": {},
63
- "typesPublisherContentHash": "361534b19bc50893282724e8e2785b8c69f23e9233af269e95c9050d7957d763",
63
+ "typesPublisherContentHash": "8c673ad1e0d421c8e8a0e61e19b53e64f4a57f91fc024601b5db8bc5742e7d73",
64
64
  "typeScriptVersion": "4.3"
65
65
  }
@@ -1,213 +0,0 @@
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
- }