@types/k6 0.51.1 → 0.53.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.
@@ -55,7 +55,7 @@ export class WebSocket {
55
55
  *
56
56
  * @param data - the data to send to the server
57
57
  */
58
- send(data: string | ArrayBuffer): void;
58
+ send(data: string | ArrayBuffer | Blob): void;
59
59
 
60
60
  /**
61
61
  * Bind event names to event handlers to be executed when their
@@ -123,6 +123,25 @@ export class WebSocket {
123
123
  onpong: () => void;
124
124
  }
125
125
 
126
+ export type BlobPart = ArrayBuffer | ArrayBufferView | Blob | string;
127
+
128
+ export interface BlobOptions {
129
+ type?: string | undefined;
130
+ }
131
+
132
+ /**
133
+ * The Blob represents binary data and can be used to interact with it.
134
+ */
135
+ export class Blob {
136
+ readonly type: string;
137
+ readonly size: number;
138
+ constructor(blobParts?: BlobPart[], options?: BlobOptions);
139
+ arrayBuffer(): Promise<ArrayBuffer>;
140
+ bytes(): Promise<Uint8Array>;
141
+ slice(start?: number, end?: number): Blob;
142
+ text(): Promise<string>;
143
+ }
144
+
126
145
  /**
127
146
  * k6 specific WebSocket parameters.
128
147
  * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/websockets/params/
@@ -177,9 +196,7 @@ export enum ReadyState {
177
196
  * transmitted over a Websocket connection.
178
197
  */
179
198
  export enum BinaryType {
180
- /**
181
- * Binary data is returned in ArrayBuffer form. k6 supports only this type.
182
- */
199
+ Blob = "blob",
183
200
  ArrayBuffer = "arraybuffer",
184
201
  }
185
202
 
@@ -226,7 +243,7 @@ export interface MessageEvent {
226
243
  /**
227
244
  * The data sent by the message emitter.
228
245
  */
229
- data: string | ArrayBuffer;
246
+ data: string | ArrayBuffer | Blob;
230
247
 
231
248
  /**
232
249
  * the type of the event.
k6/global.d.ts CHANGED
@@ -6,8 +6,6 @@
6
6
  * others in both contexts. Comments note availability.
7
7
  */
8
8
 
9
- import { bytes } from ".";
10
-
11
9
  export {};
12
10
 
13
11
  // Available without importing
k6/http.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { bytes, JSONValue } from ".";
1
+ import { JSONValue } from ".";
2
2
  import { Selection } from "./html";
3
3
 
4
4
  /**
@@ -185,7 +185,7 @@ export function batch<Q extends BatchRequests>(requests: Q): BatchResponses<Q>;
185
185
  * console.log(f.content_type);
186
186
  * }
187
187
  */
188
- export function file(data: string | bytes | ArrayBuffer, filename?: string, contentType?: string): FileData;
188
+ export function file(data: string | ArrayBuffer, filename?: string, contentType?: string): FileData;
189
189
 
190
190
  /**
191
191
  * Get active cookie jar.
@@ -688,7 +688,7 @@ export abstract class FileData {
688
688
  protected __brand: never;
689
689
 
690
690
  /** File data. */
691
- data: string | bytes | ArrayBuffer;
691
+ data: string | ArrayBuffer;
692
692
 
693
693
  /** Filename to include in MIME message. */
694
694
  filename?: string;
@@ -992,7 +992,7 @@ declare namespace http {
992
992
  * console.log(f.content_type);
993
993
  * }
994
994
  */
995
- function file(data: string | bytes | ArrayBuffer, filename?: string, contentType?: string): FileData;
995
+ function file(data: string | ArrayBuffer, filename?: string, contentType?: string): FileData;
996
996
 
997
997
  /**
998
998
  * Get active cookie jar.
k6/index.d.ts CHANGED
@@ -20,6 +20,7 @@
20
20
  import "./global"; // Type global environment
21
21
 
22
22
  // Expose everything to autoimport
23
+ import "./browser";
23
24
  import "./crypto";
24
25
  import "./data";
25
26
  import "./encoding";
@@ -123,11 +124,6 @@ export interface Checkers<VT> {
123
124
  // === Common types ===
124
125
  // --------------------
125
126
 
126
- /**
127
- * Array of numbers. The number range is from 0 to 255.
128
- */
129
- export type bytes = number[];
130
-
131
127
  // === JSON ===
132
128
  // ------------
133
129
 
k6/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/k6",
3
- "version": "0.51.1",
3
+ "version": "0.53.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": "bd1f1b832fb8e72e78b06940251c84e29343e751bc29b44b6a5c3d96d356e07f",
63
+ "typesPublisherContentHash": "92a8bee7b16799f1931e143dd216dc6b86d2f2e8c322c82b6c5c68090b18d592",
64
64
  "typeScriptVersion": "4.8"
65
65
  }