@types/k6 0.52.0 → 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.
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: Wed, 26 Jun 2024 11:07:12 GMT
11
+ * Last updated: Tue, 13 Aug 2024 10:38:02 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
k6/crypto.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { bytes } from ".";
2
-
3
1
  /**
4
2
  * Generate random bytes.
5
3
  * @param size - Number of bytes to generate.
@@ -181,7 +179,7 @@ export type OutputEncoding = StringEncoding | BinaryEncoding;
181
179
  * @template OE - Output encoding.
182
180
  */
183
181
  export type Output<OE extends OutputEncoding> = OE extends StringEncoding ? string
184
- : OE extends BinaryEncoding ? bytes
182
+ : OE extends BinaryEncoding ? ArrayBuffer
185
183
  : never;
186
184
 
187
185
  /**
@@ -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
@@ -124,11 +124,6 @@ export interface Checkers<VT> {
124
124
  // === Common types ===
125
125
  // --------------------
126
126
 
127
- /**
128
- * Array of numbers. The number range is from 0 to 255.
129
- */
130
- export type bytes = number[];
131
-
132
127
  // === JSON ===
133
128
  // ------------
134
129
 
k6/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/k6",
3
- "version": "0.52.0",
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": "c77eb5d37a165f06102b569ae717ea8b899b5197a284ee88298683ce3ae51dd4",
63
+ "typesPublisherContentHash": "92a8bee7b16799f1931e143dd216dc6b86d2f2e8c322c82b6c5c68090b18d592",
64
64
  "typeScriptVersion": "4.8"
65
65
  }