@openworkers/workers-types 0.1.5 → 0.1.6

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenWorkers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openworkers/workers-types",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "TypeScript types for the OpenWorkers runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
package/types/fetch.d.ts CHANGED
@@ -136,7 +136,7 @@ declare global {
136
136
  formData(): Promise<FormData>;
137
137
 
138
138
  /** Reads the body as JSON. */
139
- json(): Promise<unknown>;
139
+ json<T = unknown>(): Promise<T>;
140
140
 
141
141
  /** Reads the body as text. */
142
142
  text(): Promise<string>;
@@ -227,7 +227,7 @@ declare global {
227
227
  formData(): Promise<FormData>;
228
228
 
229
229
  /** Reads the body as JSON. */
230
- json(): Promise<unknown>;
230
+ json<T = unknown>(): Promise<T>;
231
231
 
232
232
  /** Reads the body as text. */
233
233
  text(): Promise<string>;
@@ -73,6 +73,12 @@ declare global {
73
73
  /** The amount of data the consumer wants, or null if the stream is closed. */
74
74
  readonly desiredSize: number | null;
75
75
 
76
+ /**
77
+ * An AbortSignal that is aborted when the stream consumer cancels/disconnects.
78
+ * Use this to detect client disconnection and stop producing data.
79
+ */
80
+ readonly signal?: AbortSignal;
81
+
76
82
  /** Closes the stream. No more chunks can be enqueued after this. */
77
83
  close(): void;
78
84
 
@@ -42,6 +42,13 @@ declare global {
42
42
  * Must be called before any response is sent.
43
43
  */
44
44
  passThroughOnException(): void;
45
+
46
+ /**
47
+ * Properties passed to the worker.
48
+ * For Hono/Cloudflare Workers compatibility.
49
+ * @deprecated Not implemented in OpenWorkers
50
+ */
51
+ props: never;
45
52
  }
46
53
 
47
54
  /**