@orpc/standard-server 0.0.0-next.d16a1b6 → 0.0.0-next.d1f8ea3

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
@@ -32,7 +32,7 @@
32
32
  - **Contract-First Development 📜**: (Optional) Define your API contract upfront and implement it with confidence.
33
33
  - **Exceptional Developer Experience ✨**: Enjoy a streamlined workflow with robust typing and clear, in-code documentation.
34
34
  - **Multi-Runtime Support 🌍**: Run your code seamlessly on Cloudflare, Deno, Bun, Node.js, and more.
35
- - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue), Pinia Colada, and more.
35
+ - **Framework Integrations 🧩**: Supports Tanstack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
36
  - **Server Actions ⚡️**: Fully compatible with React Server Actions on Next.js, TanStack Start, and more.
37
37
  - **Standard Schema Support 🗂️**: Effortlessly work with Zod, Valibot, ArkType, and others right out of the box.
38
38
  - **Fast & Lightweight 💨**: Built on native APIs across all runtimes – optimized for speed and efficiency.
@@ -53,16 +53,29 @@ You can find the full documentation [here](https://orpc.unnoq.com).
53
53
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
54
54
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
55
55
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
56
+ - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
56
57
  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
57
58
  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
59
+ - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
60
+ - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
58
61
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
62
  - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
60
63
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
64
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
65
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
61
66
 
62
67
  ## `@orpc/standard-server`
63
68
 
64
69
  This package is designed to be used as a base for other server implementations.
65
70
 
71
+ ## Sponsors
72
+
73
+ <p align="center">
74
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
75
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
76
+ </a>
77
+ </p>
78
+
66
79
  ## License
67
80
 
68
81
  Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ interface EventMessage {
5
5
  id: string | undefined;
6
6
  data: string | undefined;
7
7
  /**
8
- * The number of milliseconds to wait before retrying the event source if error occurs.
8
+ * The number of milliseconds to wait before retrying the event iterator if error occurs.
9
9
  */
10
10
  retry: number | undefined;
11
11
  comments: string[];
@@ -66,10 +66,6 @@ interface StandardRequest {
66
66
  signal: AbortSignal | undefined;
67
67
  }
68
68
  interface StandardLazyRequest extends Omit<StandardRequest, 'body'> {
69
- /**
70
- * Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
71
- */
72
- raw: Record<string, unknown>;
73
69
  /**
74
70
  * The body has been parsed based on the content-type header.
75
71
  * This method can safely call multiple times (cached).
@@ -85,10 +81,6 @@ interface StandardResponse {
85
81
  body: StandardBody;
86
82
  }
87
83
  interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
88
- /**
89
- * Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
90
- */
91
- raw: Record<string, unknown>;
92
84
  /**
93
85
  * The body has been parsed based on the content-type header.
94
86
  * This method can safely call multiple times (cached).
@@ -96,4 +88,6 @@ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
96
88
  body: () => Promise<StandardBody>;
97
89
  }
98
90
 
99
- export { ErrorEvent, type ErrorEventOptions, EventDecoder, EventDecoderError, type EventDecoderOptions, EventDecoderStream, EventEncoderError, type EventMessage, type EventMeta, type StandardBody, type StandardHeaders, type StandardLazyRequest, type StandardLazyResponse, type StandardRequest, type StandardResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, withEventMeta };
91
+ declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
92
+
93
+ export { ErrorEvent, type ErrorEventOptions, EventDecoder, EventDecoderError, type EventDecoderOptions, EventDecoderStream, EventEncoderError, type EventMessage, type EventMeta, type StandardBody, type StandardHeaders, type StandardLazyRequest, type StandardLazyResponse, type StandardRequest, type StandardResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, mergeStandardHeaders, withEventMeta };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ interface EventMessage {
5
5
  id: string | undefined;
6
6
  data: string | undefined;
7
7
  /**
8
- * The number of milliseconds to wait before retrying the event source if error occurs.
8
+ * The number of milliseconds to wait before retrying the event iterator if error occurs.
9
9
  */
10
10
  retry: number | undefined;
11
11
  comments: string[];
@@ -66,10 +66,6 @@ interface StandardRequest {
66
66
  signal: AbortSignal | undefined;
67
67
  }
68
68
  interface StandardLazyRequest extends Omit<StandardRequest, 'body'> {
69
- /**
70
- * Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
71
- */
72
- raw: Record<string, unknown>;
73
69
  /**
74
70
  * The body has been parsed based on the content-type header.
75
71
  * This method can safely call multiple times (cached).
@@ -85,10 +81,6 @@ interface StandardResponse {
85
81
  body: StandardBody;
86
82
  }
87
83
  interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
88
- /**
89
- * Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
90
- */
91
- raw: Record<string, unknown>;
92
84
  /**
93
85
  * The body has been parsed based on the content-type header.
94
86
  * This method can safely call multiple times (cached).
@@ -96,4 +88,6 @@ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
96
88
  body: () => Promise<StandardBody>;
97
89
  }
98
90
 
99
- export { ErrorEvent, type ErrorEventOptions, EventDecoder, EventDecoderError, type EventDecoderOptions, EventDecoderStream, EventEncoderError, type EventMessage, type EventMeta, type StandardBody, type StandardHeaders, type StandardLazyRequest, type StandardLazyResponse, type StandardRequest, type StandardResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, withEventMeta };
91
+ declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
92
+
93
+ export { ErrorEvent, type ErrorEventOptions, EventDecoder, EventDecoderError, type EventDecoderOptions, EventDecoderStream, EventEncoderError, type EventMessage, type EventMeta, type StandardBody, type StandardHeaders, type StandardLazyRequest, type StandardLazyResponse, type StandardRequest, type StandardResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, mergeStandardHeaders, withEventMeta };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { isTypescriptObject } from '@orpc/shared';
1
+ import { isTypescriptObject, toArray } from '@orpc/shared';
2
2
  export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition';
3
3
 
4
4
  class EventEncoderError extends TypeError {
@@ -71,7 +71,7 @@ class EventDecoder {
71
71
  }
72
72
  end() {
73
73
  if (this.incomplete) {
74
- throw new EventDecoderError("EventSource ended before complete");
74
+ throw new EventDecoderError("Event Iterator ended before complete");
75
75
  }
76
76
  }
77
77
  }
@@ -98,22 +98,22 @@ class EventDecoderStream extends TransformStream {
98
98
 
99
99
  function assertEventId(id) {
100
100
  if (id.includes("\n")) {
101
- throw new EventEncoderError("Event-source id must not contain a newline character");
101
+ throw new EventEncoderError("Event's id must not contain a newline character");
102
102
  }
103
103
  }
104
104
  function assertEventName(event) {
105
105
  if (event.includes("\n")) {
106
- throw new EventEncoderError("Event-source event must not contain a newline character");
106
+ throw new EventEncoderError("Event's event must not contain a newline character");
107
107
  }
108
108
  }
109
109
  function assertEventRetry(retry) {
110
110
  if (!Number.isInteger(retry) || retry < 0) {
111
- throw new EventEncoderError("Event-source retry must be a integer and >= 0");
111
+ throw new EventEncoderError("Event's retry must be a integer and >= 0");
112
112
  }
113
113
  }
114
114
  function assertEventComment(comment) {
115
115
  if (comment.includes("\n")) {
116
- throw new EventEncoderError("Event-source comment must not contain a newline character");
116
+ throw new EventEncoderError("Event's comment must not contain a newline character");
117
117
  }
118
118
  }
119
119
  function encodeEventData(data) {
@@ -183,4 +183,22 @@ function getEventMeta(container) {
183
183
  return isTypescriptObject(container) ? Reflect.get(container, EVENT_SOURCE_META_SYMBOL) : void 0;
184
184
  }
185
185
 
186
- export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, withEventMeta };
186
+ function mergeStandardHeaders(a, b) {
187
+ const merged = { ...a };
188
+ for (const key in b) {
189
+ if (Array.isArray(b[key])) {
190
+ merged[key] = [...toArray(merged[key]), ...b[key]];
191
+ } else if (b[key] !== void 0) {
192
+ if (Array.isArray(merged[key])) {
193
+ merged[key] = [...merged[key], b[key]];
194
+ } else if (merged[key] !== void 0) {
195
+ merged[key] = [merged[key], b[key]];
196
+ } else {
197
+ merged[key] = b[key];
198
+ }
199
+ }
200
+ }
201
+ return merged;
202
+ }
203
+
204
+ export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, mergeStandardHeaders, withEventMeta };
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.d16a1b6",
4
+ "version": "0.0.0-next.d1f8ea3",
5
5
  "license": "MIT",
6
6
  "homepage": "https://unnoq.com",
7
7
  "repository": {
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@tinyhttp/content-disposition": "^2.2.2",
27
- "@orpc/shared": "0.0.0-next.d16a1b6"
27
+ "@orpc/shared": "0.0.0-next.d1f8ea3"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "unbuild",