@orpc/standard-server 0.0.0-next.64450c6 → 0.0.0-next.65596ea

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.
@@ -1,4 +1,4 @@
1
- import { S as StandardHeaders, b as StandardRequest, d as StandardResponse } from '../shared/standard-server.R_NaHlxw.mjs';
1
+ import { S as StandardHeaders, c as StandardRequest, e as StandardResponse } from '../shared/standard-server.BD8Sg1A5.mjs';
2
2
 
3
3
  interface ToBatchRequestOptions {
4
4
  url: URL;
@@ -1,4 +1,4 @@
1
- import { S as StandardHeaders, b as StandardRequest, d as StandardResponse } from '../shared/standard-server.R_NaHlxw.js';
1
+ import { S as StandardHeaders, c as StandardRequest, e as StandardResponse } from '../shared/standard-server.BD8Sg1A5.js';
2
2
 
3
3
  interface ToBatchRequestOptions {
4
4
  url: URL;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StandardHeaders } from './shared/standard-server.R_NaHlxw.mjs';
2
- export { a as StandardBody, c as StandardLazyRequest, e as StandardLazyResponse, b as StandardRequest, d as StandardResponse } from './shared/standard-server.R_NaHlxw.mjs';
1
+ import { S as StandardHeaders, a as StandardLazyResponse } from './shared/standard-server.BD8Sg1A5.mjs';
2
+ export { b as StandardBody, d as StandardLazyRequest, c as StandardRequest, e as StandardResponse } from './shared/standard-server.BD8Sg1A5.mjs';
3
3
 
4
4
  interface EventMessage {
5
5
  event: string | undefined;
@@ -56,6 +56,7 @@ declare function generateContentDisposition(filename: string): string;
56
56
  declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
57
57
  declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
58
58
  declare function flattenHeader(header: string | readonly string[] | undefined): string | undefined;
59
+ declare function replicateStandardLazyResponse(response: StandardLazyResponse, count: number): StandardLazyResponse[];
59
60
 
60
- export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, withEventMeta };
61
+ export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, StandardLazyResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
61
62
  export type { ErrorEventOptions, EventDecoderOptions, EventMessage, EventMeta };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StandardHeaders } from './shared/standard-server.R_NaHlxw.js';
2
- export { a as StandardBody, c as StandardLazyRequest, e as StandardLazyResponse, b as StandardRequest, d as StandardResponse } from './shared/standard-server.R_NaHlxw.js';
1
+ import { S as StandardHeaders, a as StandardLazyResponse } from './shared/standard-server.BD8Sg1A5.js';
2
+ export { b as StandardBody, d as StandardLazyRequest, c as StandardRequest, e as StandardResponse } from './shared/standard-server.BD8Sg1A5.js';
3
3
 
4
4
  interface EventMessage {
5
5
  event: string | undefined;
@@ -56,6 +56,7 @@ declare function generateContentDisposition(filename: string): string;
56
56
  declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
57
57
  declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
58
58
  declare function flattenHeader(header: string | readonly string[] | undefined): string | undefined;
59
+ declare function replicateStandardLazyResponse(response: StandardLazyResponse, count: number): StandardLazyResponse[];
59
60
 
60
- export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, withEventMeta };
61
+ export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, StandardLazyResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
61
62
  export type { ErrorEventOptions, EventDecoderOptions, EventMessage, EventMeta };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { isTypescriptObject, toArray } from '@orpc/shared';
1
+ import { isTypescriptObject, toArray, once, isAsyncIteratorObject, replicateAsyncIterator } from '@orpc/shared';
2
2
 
3
3
  class EventEncoderError extends TypeError {
4
4
  }
@@ -223,5 +223,27 @@ function flattenHeader(header) {
223
223
  }
224
224
  return header.join(", ");
225
225
  }
226
+ function replicateStandardLazyResponse(response, count) {
227
+ const replicated = [];
228
+ let bodyPromise;
229
+ let replicatedAsyncIteratorObjects;
230
+ for (let i = 0; i < count; i++) {
231
+ replicated.push({
232
+ ...response,
233
+ body: once(async () => {
234
+ if (replicatedAsyncIteratorObjects) {
235
+ return replicatedAsyncIteratorObjects.shift();
236
+ }
237
+ const body = await (bodyPromise ??= response.body());
238
+ if (!isAsyncIteratorObject(body)) {
239
+ return body;
240
+ }
241
+ replicatedAsyncIteratorObjects = replicateAsyncIterator(body, count);
242
+ return replicatedAsyncIteratorObjects.shift();
243
+ })
244
+ });
245
+ }
246
+ return replicated;
247
+ }
226
248
 
227
- export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, withEventMeta };
249
+ export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
@@ -35,4 +35,4 @@ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
35
35
  body: () => Promise<StandardBody>;
36
36
  }
37
37
 
38
- export type { StandardHeaders as S, StandardBody as a, StandardRequest as b, StandardLazyRequest as c, StandardResponse as d, StandardLazyResponse as e };
38
+ export type { StandardHeaders as S, StandardLazyResponse as a, StandardBody as b, StandardRequest as c, StandardLazyRequest as d, StandardResponse as e };
@@ -35,4 +35,4 @@ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
35
35
  body: () => Promise<StandardBody>;
36
36
  }
37
37
 
38
- export type { StandardHeaders as S, StandardBody as a, StandardRequest as b, StandardLazyRequest as c, StandardResponse as d, StandardLazyResponse as e };
38
+ export type { StandardHeaders as S, StandardLazyResponse as a, StandardBody as b, StandardRequest as c, StandardLazyRequest as d, StandardResponse as e };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/standard-server",
3
3
  "type": "module",
4
- "version": "0.0.0-next.64450c6",
4
+ "version": "0.0.0-next.65596ea",
5
5
  "license": "MIT",
6
6
  "homepage": "https://unnoq.com",
7
7
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@orpc/shared": "0.0.0-next.64450c6"
31
+ "@orpc/shared": "0.0.0-next.65596ea"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "unbuild",