@orpc/standard-server-fetch 0.0.0-next.4534675 → 0.0.0-next.6176ee9

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 CHANGED
@@ -21,7 +21,7 @@ interface ToEventStreamOptions {
21
21
  */
22
22
  eventIteratorKeepAliveComment?: string;
23
23
  }
24
- declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options: ToEventStreamOptions): ReadableStream<Uint8Array>;
24
+ declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
25
25
 
26
26
  declare function toStandardBody(re: Request | Response): Promise<StandardBody>;
27
27
  interface ToFetchBodyOptions extends ToEventStreamOptions {
@@ -30,7 +30,7 @@ interface ToFetchBodyOptions extends ToEventStreamOptions {
30
30
  * @param body
31
31
  * @param headers - The headers can be changed by the function and effects on the original headers.
32
32
  */
33
- declare function toFetchBody(body: StandardBody, headers: Headers, options: ToFetchBodyOptions): string | Blob | FormData | URLSearchParams | undefined | ReadableStream<Uint8Array>;
33
+ declare function toFetchBody(body: StandardBody, headers: Headers, options?: ToFetchBodyOptions): string | Blob | FormData | URLSearchParams | undefined | ReadableStream<Uint8Array>;
34
34
 
35
35
  /**
36
36
  * @param headers
@@ -46,11 +46,11 @@ declare function toFetchHeaders(headers: StandardHeaders, fetchHeaders?: Headers
46
46
  declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
47
47
  interface ToFetchRequestOptions extends ToFetchBodyOptions {
48
48
  }
49
- declare function toFetchRequest(request: StandardRequest, options: ToFetchRequestOptions): Request;
49
+ declare function toFetchRequest(request: StandardRequest, options?: ToFetchRequestOptions): Request;
50
50
 
51
51
  interface ToFetchResponseOptions extends ToFetchBodyOptions {
52
52
  }
53
- declare function toFetchResponse(response: StandardResponse, options: ToFetchResponseOptions): Response;
53
+ declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
54
54
  declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
55
55
 
56
56
  export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchRequestOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@ interface ToEventStreamOptions {
21
21
  */
22
22
  eventIteratorKeepAliveComment?: string;
23
23
  }
24
- declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options: ToEventStreamOptions): ReadableStream<Uint8Array>;
24
+ declare function toEventStream(iterator: AsyncIterator<unknown | void, unknown | void, void>, options?: ToEventStreamOptions): ReadableStream<Uint8Array>;
25
25
 
26
26
  declare function toStandardBody(re: Request | Response): Promise<StandardBody>;
27
27
  interface ToFetchBodyOptions extends ToEventStreamOptions {
@@ -30,7 +30,7 @@ interface ToFetchBodyOptions extends ToEventStreamOptions {
30
30
  * @param body
31
31
  * @param headers - The headers can be changed by the function and effects on the original headers.
32
32
  */
33
- declare function toFetchBody(body: StandardBody, headers: Headers, options: ToFetchBodyOptions): string | Blob | FormData | URLSearchParams | undefined | ReadableStream<Uint8Array>;
33
+ declare function toFetchBody(body: StandardBody, headers: Headers, options?: ToFetchBodyOptions): string | Blob | FormData | URLSearchParams | undefined | ReadableStream<Uint8Array>;
34
34
 
35
35
  /**
36
36
  * @param headers
@@ -46,11 +46,11 @@ declare function toFetchHeaders(headers: StandardHeaders, fetchHeaders?: Headers
46
46
  declare function toStandardLazyRequest(request: Request): StandardLazyRequest;
47
47
  interface ToFetchRequestOptions extends ToFetchBodyOptions {
48
48
  }
49
- declare function toFetchRequest(request: StandardRequest, options: ToFetchRequestOptions): Request;
49
+ declare function toFetchRequest(request: StandardRequest, options?: ToFetchRequestOptions): Request;
50
50
 
51
51
  interface ToFetchResponseOptions extends ToFetchBodyOptions {
52
52
  }
53
- declare function toFetchResponse(response: StandardResponse, options: ToFetchResponseOptions): Response;
53
+ declare function toFetchResponse(response: StandardResponse, options?: ToFetchResponseOptions): Response;
54
54
  declare function toStandardLazyResponse(response: Response): StandardLazyResponse;
55
55
 
56
56
  export { type ToEventStreamOptions, type ToFetchBodyOptions, type ToFetchRequestOptions, type ToFetchResponseOptions, toEventIterator, toEventStream, toFetchBody, toFetchHeaders, toFetchRequest, toFetchResponse, toStandardBody, toStandardHeaders, toStandardLazyRequest, toStandardLazyResponse };
package/dist/index.mjs CHANGED
@@ -42,7 +42,7 @@ function toEventIterator(stream) {
42
42
  }
43
43
  return gen();
44
44
  }
45
- function toEventStream(iterator, options) {
45
+ function toEventStream(iterator, options = {}) {
46
46
  const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
47
47
  const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
48
48
  const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
@@ -125,7 +125,7 @@ async function toStandardBody(re) {
125
125
  type: blob.type
126
126
  });
127
127
  }
128
- function toFetchBody(body, headers, options) {
128
+ function toFetchBody(body, headers, options = {}) {
129
129
  headers.delete("content-type");
130
130
  headers.delete("content-disposition");
131
131
  if (body === void 0) {
@@ -198,7 +198,7 @@ function toStandardLazyRequest(request) {
198
198
  }
199
199
  };
200
200
  }
201
- function toFetchRequest(request, options) {
201
+ function toFetchRequest(request, options = {}) {
202
202
  const headers = toFetchHeaders(request.headers);
203
203
  const body = toFetchBody(request.body, headers, options);
204
204
  return new Request(request.url, {
@@ -209,7 +209,7 @@ function toFetchRequest(request, options) {
209
209
  });
210
210
  }
211
211
 
212
- function toFetchResponse(response, options) {
212
+ function toFetchResponse(response, options = {}) {
213
213
  const headers = toFetchHeaders(response.headers);
214
214
  const body = toFetchBody(response.body, headers, options);
215
215
  return new Response(body, { headers, status: response.status });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/standard-server-fetch",
3
3
  "type": "module",
4
- "version": "0.0.0-next.4534675",
4
+ "version": "0.0.0-next.6176ee9",
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": "0.0.0-next.4534675",
27
- "@orpc/standard-server": "0.0.0-next.4534675"
26
+ "@orpc/shared": "0.0.0-next.6176ee9",
27
+ "@orpc/standard-server": "0.0.0-next.6176ee9"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@hono/node-server": "^1.13.8"