@orpc/standard-server 0.0.0-next.f107a0e → 0.0.0-next.f356b86
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 +5 -7
- package/dist/index.d.mts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.mjs +22 -2
- package/package.json +2 -2
package/README.md
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
31
31
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
32
32
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
33
|
-
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
|
33
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
|
34
34
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
35
35
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
36
36
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
@@ -49,14 +49,12 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
49
49
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
50
50
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
51
51
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
52
|
-
- [@orpc/
|
52
|
+
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
53
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
53
54
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
54
|
-
- [@orpc/
|
55
|
-
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
56
|
-
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
57
|
-
- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
|
55
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
58
56
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
59
|
-
- [@orpc/
|
57
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
60
58
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
61
59
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
62
60
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
package/dist/index.d.mts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { AsyncIteratorClass } from '@orpc/shared';
|
1
2
|
import { S as StandardHeaders, a as StandardLazyResponse } from './shared/standard-server.BD8Sg1A5.mjs';
|
2
3
|
export { b as StandardBody, d as StandardLazyRequest, c as StandardRequest, e as StandardResponse } from './shared/standard-server.BD8Sg1A5.mjs';
|
3
4
|
|
@@ -52,11 +53,23 @@ type EventMeta = Partial<Pick<EventMessage, 'retry' | 'id' | 'comments'>>;
|
|
52
53
|
declare function withEventMeta<T extends object>(container: T, meta: EventMeta): T;
|
53
54
|
declare function getEventMeta(container: unknown): EventMeta | undefined;
|
54
55
|
|
56
|
+
interface experimental_HibernationEventIteratorCallback {
|
57
|
+
(id: string): void;
|
58
|
+
}
|
59
|
+
declare class experimental_HibernationEventIterator<T, TReturn = unknown, TNext = unknown> extends AsyncIteratorClass<T, TReturn, TNext> {
|
60
|
+
/**
|
61
|
+
* this property is not transferred to the client, so it should be optional for type safety
|
62
|
+
*/
|
63
|
+
readonly hibernationCallback?: experimental_HibernationEventIteratorCallback;
|
64
|
+
constructor(hibernationCallback: experimental_HibernationEventIteratorCallback);
|
65
|
+
}
|
66
|
+
|
55
67
|
declare function generateContentDisposition(filename: string): string;
|
56
68
|
declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
|
57
69
|
declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
|
58
70
|
declare function flattenHeader(header: string | readonly string[] | undefined): string | undefined;
|
59
71
|
declare function replicateStandardLazyResponse(response: StandardLazyResponse, count: number): StandardLazyResponse[];
|
72
|
+
declare function isEventIteratorHeaders(headers: StandardHeaders): boolean;
|
60
73
|
|
61
|
-
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, StandardLazyResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
|
62
|
-
export type { ErrorEventOptions, EventDecoderOptions, EventMessage, EventMeta };
|
74
|
+
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, StandardLazyResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, experimental_HibernationEventIterator, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, isEventIteratorHeaders, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
|
75
|
+
export type { ErrorEventOptions, EventDecoderOptions, EventMessage, EventMeta, experimental_HibernationEventIteratorCallback };
|
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { AsyncIteratorClass } from '@orpc/shared';
|
1
2
|
import { S as StandardHeaders, a as StandardLazyResponse } from './shared/standard-server.BD8Sg1A5.js';
|
2
3
|
export { b as StandardBody, d as StandardLazyRequest, c as StandardRequest, e as StandardResponse } from './shared/standard-server.BD8Sg1A5.js';
|
3
4
|
|
@@ -52,11 +53,23 @@ type EventMeta = Partial<Pick<EventMessage, 'retry' | 'id' | 'comments'>>;
|
|
52
53
|
declare function withEventMeta<T extends object>(container: T, meta: EventMeta): T;
|
53
54
|
declare function getEventMeta(container: unknown): EventMeta | undefined;
|
54
55
|
|
56
|
+
interface experimental_HibernationEventIteratorCallback {
|
57
|
+
(id: string): void;
|
58
|
+
}
|
59
|
+
declare class experimental_HibernationEventIterator<T, TReturn = unknown, TNext = unknown> extends AsyncIteratorClass<T, TReturn, TNext> {
|
60
|
+
/**
|
61
|
+
* this property is not transferred to the client, so it should be optional for type safety
|
62
|
+
*/
|
63
|
+
readonly hibernationCallback?: experimental_HibernationEventIteratorCallback;
|
64
|
+
constructor(hibernationCallback: experimental_HibernationEventIteratorCallback);
|
65
|
+
}
|
66
|
+
|
55
67
|
declare function generateContentDisposition(filename: string): string;
|
56
68
|
declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
|
57
69
|
declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
|
58
70
|
declare function flattenHeader(header: string | readonly string[] | undefined): string | undefined;
|
59
71
|
declare function replicateStandardLazyResponse(response: StandardLazyResponse, count: number): StandardLazyResponse[];
|
72
|
+
declare function isEventIteratorHeaders(headers: StandardHeaders): boolean;
|
60
73
|
|
61
|
-
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, StandardLazyResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
|
62
|
-
export type { ErrorEventOptions, EventDecoderOptions, EventMessage, EventMeta };
|
74
|
+
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, StandardHeaders, StandardLazyResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, experimental_HibernationEventIterator, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, isEventIteratorHeaders, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
|
75
|
+
export type { ErrorEventOptions, EventDecoderOptions, EventMessage, EventMeta, experimental_HibernationEventIteratorCallback };
|
package/dist/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isTypescriptObject, toArray, once, isAsyncIteratorObject, replicateAsyncIterator } from '@orpc/shared';
|
1
|
+
import { isTypescriptObject, AsyncIteratorClass, toArray, once, isAsyncIteratorObject, replicateAsyncIterator } from '@orpc/shared';
|
2
2
|
|
3
3
|
class EventEncoderError extends TypeError {
|
4
4
|
}
|
@@ -182,6 +182,23 @@ function getEventMeta(container) {
|
|
182
182
|
return isTypescriptObject(container) ? Reflect.get(container, EVENT_SOURCE_META_SYMBOL) : void 0;
|
183
183
|
}
|
184
184
|
|
185
|
+
class experimental_HibernationEventIterator extends AsyncIteratorClass {
|
186
|
+
/**
|
187
|
+
* this property is not transferred to the client, so it should be optional for type safety
|
188
|
+
*/
|
189
|
+
hibernationCallback;
|
190
|
+
constructor(hibernationCallback) {
|
191
|
+
super(async () => {
|
192
|
+
throw new Error("Cannot iterate over hibernating iterator directly");
|
193
|
+
}, async (reason) => {
|
194
|
+
if (reason !== "next") {
|
195
|
+
throw new Error("Cannot cleanup hibernating iterator directly");
|
196
|
+
}
|
197
|
+
});
|
198
|
+
this.hibernationCallback = hibernationCallback;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
185
202
|
function generateContentDisposition(filename) {
|
186
203
|
const escapedFileName = filename.replace(/"/g, '\\"');
|
187
204
|
const encodedFilenameStar = encodeURIComponent(filename).replace(/['()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g, (str, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
|
@@ -245,5 +262,8 @@ function replicateStandardLazyResponse(response, count) {
|
|
245
262
|
}
|
246
263
|
return replicated;
|
247
264
|
}
|
265
|
+
function isEventIteratorHeaders(headers) {
|
266
|
+
return Boolean(flattenHeader(headers["content-type"])?.startsWith("text/event-stream") && flattenHeader(headers["content-disposition"]) === void 0);
|
267
|
+
}
|
248
268
|
|
249
|
-
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, replicateStandardLazyResponse, withEventMeta };
|
269
|
+
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, experimental_HibernationEventIterator, flattenHeader, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, isEventIteratorHeaders, mergeStandardHeaders, replicateStandardLazyResponse, 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.
|
4
|
+
"version": "0.0.0-next.f356b86",
|
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.
|
31
|
+
"@orpc/shared": "0.0.0-next.f356b86"
|
32
32
|
},
|
33
33
|
"scripts": {
|
34
34
|
"build": "unbuild",
|