@orpc/standard-server-fetch 1.11.1 → 1.11.3
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/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +8 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,19 @@ interface ToEventStreamOptions {
|
|
|
23
23
|
* @default ''
|
|
24
24
|
*/
|
|
25
25
|
eventIteratorKeepAliveComment?: string;
|
|
26
|
+
/**
|
|
27
|
+
* If true, an initial comment is sent immediately upon stream start to flush headers.
|
|
28
|
+
* This allows the receiving side to establish the connection without waiting for the first event.
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
eventIteratorInitialCommentEnabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The content of the initial comment sent upon stream start. Must not include newline characters.
|
|
35
|
+
*
|
|
36
|
+
* @default ''
|
|
37
|
+
*/
|
|
38
|
+
eventIteratorInitialComment?: string;
|
|
26
39
|
}
|
|
27
40
|
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
|
|
28
41
|
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,19 @@ interface ToEventStreamOptions {
|
|
|
23
23
|
* @default ''
|
|
24
24
|
*/
|
|
25
25
|
eventIteratorKeepAliveComment?: string;
|
|
26
|
+
/**
|
|
27
|
+
* If true, an initial comment is sent immediately upon stream start to flush headers.
|
|
28
|
+
* This allows the receiving side to establish the connection without waiting for the first event.
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
eventIteratorInitialCommentEnabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The content of the initial comment sent upon stream start. Must not include newline characters.
|
|
35
|
+
*
|
|
36
|
+
* @default ''
|
|
37
|
+
*/
|
|
38
|
+
eventIteratorInitialComment?: string;
|
|
26
39
|
}
|
|
27
40
|
declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
|
|
28
41
|
|
package/dist/index.mjs
CHANGED
|
@@ -75,12 +75,19 @@ function toEventStream(iterator, options = {}) {
|
|
|
75
75
|
const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
|
|
76
76
|
const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
|
|
77
77
|
const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
|
|
78
|
+
const initialCommentEnabled = options.eventIteratorInitialCommentEnabled ?? true;
|
|
79
|
+
const initialComment = options.eventIteratorInitialComment ?? "";
|
|
78
80
|
let cancelled = false;
|
|
79
81
|
let timeout;
|
|
80
82
|
let span;
|
|
81
83
|
const stream = new ReadableStream({
|
|
82
|
-
start() {
|
|
84
|
+
start(controller) {
|
|
83
85
|
span = startSpan("stream_event_iterator");
|
|
86
|
+
if (initialCommentEnabled) {
|
|
87
|
+
controller.enqueue(encodeEventMessage({
|
|
88
|
+
comments: [initialComment]
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
84
91
|
},
|
|
85
92
|
async pull(controller) {
|
|
86
93
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/standard-server-fetch",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@orpc/shared": "1.11.
|
|
27
|
-
"@orpc/standard-server": "1.11.
|
|
26
|
+
"@orpc/shared": "1.11.3",
|
|
27
|
+
"@orpc/standard-server": "1.11.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@hono/node-server": "^1.19.6"
|