@types/k6 0.44.3 → 0.45.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 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, 16 Jun 2023 07:32:49 GMT
11
+ * Last updated: Mon, 19 Jun 2023 12:02:42 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
k6/execution.d.ts CHANGED
@@ -101,9 +101,20 @@ declare namespace execution {
101
101
  idInTest: number;
102
102
 
103
103
  /**
104
- * Hash to set or get VU tags.
104
+ * Map to set or get VU tags.
105
+ * @deprecated should use `metrics.tags` instead of just `tags`
105
106
  */
106
107
  tags: Record<string, number | string | boolean>;
108
+ metrics: {
109
+ /**
110
+ * Map to set or get VU tags.
111
+ */
112
+ tags: Record<string, number | string | boolean>;
113
+ /**
114
+ * Map to set or get VU metadata.
115
+ */
116
+ metadata: Record<string, number | string | boolean>;
117
+ }
107
118
  };
108
119
  }
109
120
 
@@ -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.0",
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": "5b2bbba096263f0ef2834ce4ad15719492ad469e1ad3df1e19ecbd1a8bc532f9",
64
64
  "typeScriptVersion": "4.3"
65
65
  }