@orpc/standard-server-fetch 0.0.0-next.fe89a39 → 0.0.0-next.ff2168f

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/README.md CHANGED
@@ -1,23 +1,23 @@
1
1
  <div align="center">
2
- <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
2
+ <image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
3
3
  </div>
4
4
 
5
5
  <h1></h1>
6
6
 
7
7
  <div align="center">
8
- <a href="https://codecov.io/gh/unnoq/orpc">
9
- <img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
8
+ <a href="https://codecov.io/gh/middleapi/orpc">
9
+ <img alt="codecov" src="https://codecov.io/gh/middleapi/orpc/branch/main/graph/badge.svg">
10
10
  </a>
11
11
  <a href="https://www.npmjs.com/package/@orpc/standard-server-fetch">
12
12
  <img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fstandard-server-fetch?logo=npm" />
13
13
  </a>
14
- <a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
15
- <img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
14
+ <a href="https://github.com/middleapi/orpc/blob/main/LICENSE">
15
+ <img alt="MIT License" src="https://img.shields.io/github/license/middleapi/orpc?logo=open-source-initiative" />
16
16
  </a>
17
17
  <a href="https://discord.gg/TXEbwRBvQn">
18
18
  <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
19
19
  </a>
20
- <a href="https://deepwiki.com/unnoq/orpc">
20
+ <a href="https://deepwiki.com/middleapi/orpc">
21
21
  <img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
22
22
  </a>
23
23
  </div>
@@ -45,7 +45,7 @@
45
45
 
46
46
  ## Documentation
47
47
 
48
- You can find the full documentation [here](https://orpc.unnoq.com).
48
+ You can find the full documentation [here](https://orpc.dev).
49
49
 
50
50
  ## Packages
51
51
 
@@ -78,4 +78,4 @@ You can find the full documentation [here](https://orpc.unnoq.com).
78
78
 
79
79
  ## License
80
80
 
81
- Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
81
+ Distributed under the MIT License. See [LICENSE](https://github.com/middleapi/orpc/blob/main/LICENSE) for more information.
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,12 +1,12 @@
1
1
  {
2
2
  "name": "@orpc/standard-server-fetch",
3
3
  "type": "module",
4
- "version": "0.0.0-next.fe89a39",
4
+ "version": "0.0.0-next.ff2168f",
5
5
  "license": "MIT",
6
- "homepage": "https://unnoq.com",
6
+ "homepage": "https://orpc.dev",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/unnoq/orpc.git",
9
+ "url": "git+https://github.com/middleapi/orpc.git",
10
10
  "directory": "packages/standard-server-fetch"
11
11
  },
12
12
  "keywords": [
@@ -23,11 +23,11 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@orpc/standard-server": "0.0.0-next.fe89a39",
27
- "@orpc/shared": "0.0.0-next.fe89a39"
26
+ "@orpc/shared": "0.0.0-next.ff2168f",
27
+ "@orpc/standard-server": "0.0.0-next.ff2168f"
28
28
  },
29
29
  "devDependencies": {
30
- "@hono/node-server": "^1.19.5"
30
+ "@hono/node-server": "^1.19.9"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "unbuild",