@orpc/standard-server 0.0.0-next.fea68c1 → 0.0.0-next.ff68fdb
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 +4 -2
- package/dist/index.d.mts +99 -0
- package/dist/index.d.ts +99 -0
- package/dist/{index.js → index.mjs} +56 -66
- package/package.json +6 -11
- package/dist/src/event-source/decoder.d.ts +0 -16
- package/dist/src/event-source/encoder.d.ts +0 -7
- package/dist/src/event-source/errors.d.ts +0 -15
- package/dist/src/event-source/index.d.ts +0 -6
- package/dist/src/event-source/meta.d.ts +0 -5
- package/dist/src/event-source/types.d.ts +0 -10
- package/dist/src/index.d.ts +0 -4
- package/dist/src/types.d.ts +0 -25
- package/dist/src/utils.d.ts +0 -2
package/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<div align="center">
|
2
|
-
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 />
|
2
|
+
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<h1></h1>
|
@@ -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.
|
@@ -55,6 +55,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
55
55
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
56
56
|
- [@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
57
|
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
58
|
+
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
59
|
+
- [@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
60
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
59
61
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
60
62
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
package/dist/index.d.mts
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition';
|
2
|
+
|
3
|
+
interface EventMessage {
|
4
|
+
event: string | undefined;
|
5
|
+
id: string | undefined;
|
6
|
+
data: string | undefined;
|
7
|
+
/**
|
8
|
+
* The number of milliseconds to wait before retrying the event iterator if error occurs.
|
9
|
+
*/
|
10
|
+
retry: number | undefined;
|
11
|
+
comments: string[];
|
12
|
+
}
|
13
|
+
|
14
|
+
declare function decodeEventMessage(encoded: string): EventMessage;
|
15
|
+
interface EventDecoderOptions {
|
16
|
+
onEvent?: (event: EventMessage) => void;
|
17
|
+
}
|
18
|
+
declare class EventDecoder {
|
19
|
+
private options;
|
20
|
+
private incomplete;
|
21
|
+
constructor(options?: EventDecoderOptions);
|
22
|
+
feed(chunk: string): void;
|
23
|
+
end(): void;
|
24
|
+
}
|
25
|
+
declare class EventDecoderStream extends TransformStream<string, EventMessage> {
|
26
|
+
constructor();
|
27
|
+
}
|
28
|
+
|
29
|
+
declare function assertEventId(id: string): void;
|
30
|
+
declare function assertEventName(event: string): void;
|
31
|
+
declare function assertEventRetry(retry: number): void;
|
32
|
+
declare function assertEventComment(comment: string): void;
|
33
|
+
declare function encodeEventData(data: string | undefined): string;
|
34
|
+
declare function encodeEventComments(comments: string[] | undefined): string;
|
35
|
+
declare function encodeEventMessage(message: Partial<EventMessage>): string;
|
36
|
+
|
37
|
+
declare class EventEncoderError extends TypeError {
|
38
|
+
}
|
39
|
+
declare class EventDecoderError extends TypeError {
|
40
|
+
}
|
41
|
+
interface ErrorEventOptions extends ErrorOptions {
|
42
|
+
message?: string;
|
43
|
+
data?: unknown;
|
44
|
+
}
|
45
|
+
declare class ErrorEvent extends Error {
|
46
|
+
data: unknown;
|
47
|
+
constructor(options?: ErrorEventOptions);
|
48
|
+
}
|
49
|
+
|
50
|
+
type EventMeta = Partial<Pick<EventMessage, 'retry' | 'id' | 'comments'>>;
|
51
|
+
declare function withEventMeta<T extends object>(container: T, meta: EventMeta): T;
|
52
|
+
declare function getEventMeta(container: unknown): EventMeta | undefined;
|
53
|
+
|
54
|
+
interface StandardHeaders {
|
55
|
+
[key: string]: string | string[] | undefined;
|
56
|
+
}
|
57
|
+
type StandardBody = undefined | unknown | Blob | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined>;
|
58
|
+
interface StandardRequest {
|
59
|
+
method: string;
|
60
|
+
url: URL;
|
61
|
+
headers: StandardHeaders;
|
62
|
+
/**
|
63
|
+
* The body has been parsed based on the content-type header.
|
64
|
+
*/
|
65
|
+
body: StandardBody;
|
66
|
+
signal: AbortSignal | undefined;
|
67
|
+
}
|
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
|
+
/**
|
74
|
+
* The body has been parsed based on the content-type header.
|
75
|
+
* This method can safely call multiple times (cached).
|
76
|
+
*/
|
77
|
+
body: () => Promise<StandardBody>;
|
78
|
+
}
|
79
|
+
interface StandardResponse {
|
80
|
+
status: number;
|
81
|
+
headers: StandardHeaders;
|
82
|
+
/**
|
83
|
+
* The body has been parsed based on the content-type header.
|
84
|
+
*/
|
85
|
+
body: StandardBody;
|
86
|
+
}
|
87
|
+
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
|
+
/**
|
93
|
+
* The body has been parsed based on the content-type header.
|
94
|
+
* This method can safely call multiple times (cached).
|
95
|
+
*/
|
96
|
+
body: () => Promise<StandardBody>;
|
97
|
+
}
|
98
|
+
|
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 };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition';
|
2
|
+
|
3
|
+
interface EventMessage {
|
4
|
+
event: string | undefined;
|
5
|
+
id: string | undefined;
|
6
|
+
data: string | undefined;
|
7
|
+
/**
|
8
|
+
* The number of milliseconds to wait before retrying the event iterator if error occurs.
|
9
|
+
*/
|
10
|
+
retry: number | undefined;
|
11
|
+
comments: string[];
|
12
|
+
}
|
13
|
+
|
14
|
+
declare function decodeEventMessage(encoded: string): EventMessage;
|
15
|
+
interface EventDecoderOptions {
|
16
|
+
onEvent?: (event: EventMessage) => void;
|
17
|
+
}
|
18
|
+
declare class EventDecoder {
|
19
|
+
private options;
|
20
|
+
private incomplete;
|
21
|
+
constructor(options?: EventDecoderOptions);
|
22
|
+
feed(chunk: string): void;
|
23
|
+
end(): void;
|
24
|
+
}
|
25
|
+
declare class EventDecoderStream extends TransformStream<string, EventMessage> {
|
26
|
+
constructor();
|
27
|
+
}
|
28
|
+
|
29
|
+
declare function assertEventId(id: string): void;
|
30
|
+
declare function assertEventName(event: string): void;
|
31
|
+
declare function assertEventRetry(retry: number): void;
|
32
|
+
declare function assertEventComment(comment: string): void;
|
33
|
+
declare function encodeEventData(data: string | undefined): string;
|
34
|
+
declare function encodeEventComments(comments: string[] | undefined): string;
|
35
|
+
declare function encodeEventMessage(message: Partial<EventMessage>): string;
|
36
|
+
|
37
|
+
declare class EventEncoderError extends TypeError {
|
38
|
+
}
|
39
|
+
declare class EventDecoderError extends TypeError {
|
40
|
+
}
|
41
|
+
interface ErrorEventOptions extends ErrorOptions {
|
42
|
+
message?: string;
|
43
|
+
data?: unknown;
|
44
|
+
}
|
45
|
+
declare class ErrorEvent extends Error {
|
46
|
+
data: unknown;
|
47
|
+
constructor(options?: ErrorEventOptions);
|
48
|
+
}
|
49
|
+
|
50
|
+
type EventMeta = Partial<Pick<EventMessage, 'retry' | 'id' | 'comments'>>;
|
51
|
+
declare function withEventMeta<T extends object>(container: T, meta: EventMeta): T;
|
52
|
+
declare function getEventMeta(container: unknown): EventMeta | undefined;
|
53
|
+
|
54
|
+
interface StandardHeaders {
|
55
|
+
[key: string]: string | string[] | undefined;
|
56
|
+
}
|
57
|
+
type StandardBody = undefined | unknown | Blob | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined>;
|
58
|
+
interface StandardRequest {
|
59
|
+
method: string;
|
60
|
+
url: URL;
|
61
|
+
headers: StandardHeaders;
|
62
|
+
/**
|
63
|
+
* The body has been parsed based on the content-type header.
|
64
|
+
*/
|
65
|
+
body: StandardBody;
|
66
|
+
signal: AbortSignal | undefined;
|
67
|
+
}
|
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
|
+
/**
|
74
|
+
* The body has been parsed based on the content-type header.
|
75
|
+
* This method can safely call multiple times (cached).
|
76
|
+
*/
|
77
|
+
body: () => Promise<StandardBody>;
|
78
|
+
}
|
79
|
+
interface StandardResponse {
|
80
|
+
status: number;
|
81
|
+
headers: StandardHeaders;
|
82
|
+
/**
|
83
|
+
* The body has been parsed based on the content-type header.
|
84
|
+
*/
|
85
|
+
body: StandardBody;
|
86
|
+
}
|
87
|
+
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
|
+
/**
|
93
|
+
* The body has been parsed based on the content-type header.
|
94
|
+
* This method can safely call multiple times (cached).
|
95
|
+
*/
|
96
|
+
body: () => Promise<StandardBody>;
|
97
|
+
}
|
98
|
+
|
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 };
|
@@ -1,38 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
}
|
6
|
-
|
1
|
+
import { isTypescriptObject } from '@orpc/shared';
|
2
|
+
export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition';
|
3
|
+
|
4
|
+
class EventEncoderError extends TypeError {
|
5
|
+
}
|
6
|
+
class EventDecoderError extends TypeError {
|
7
|
+
}
|
8
|
+
class ErrorEvent extends Error {
|
7
9
|
data;
|
8
10
|
constructor(options) {
|
9
11
|
super(options?.message ?? "An error event was received", options);
|
10
12
|
this.data = options?.data;
|
11
13
|
}
|
12
|
-
}
|
13
|
-
var UnknownEvent = class extends ErrorEvent {
|
14
|
-
};
|
14
|
+
}
|
15
15
|
|
16
|
-
// src/event-source/decoder.ts
|
17
16
|
function decodeEventMessage(encoded) {
|
18
17
|
const lines = encoded.replace(/\n+$/, "").split(/\n/);
|
19
18
|
const message = {
|
20
|
-
data:
|
19
|
+
data: void 0,
|
21
20
|
event: void 0,
|
22
21
|
id: void 0,
|
23
|
-
retry: void 0
|
22
|
+
retry: void 0,
|
23
|
+
comments: []
|
24
24
|
};
|
25
25
|
for (const line of lines) {
|
26
|
-
const index = line.indexOf(":
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
throw new EventDecoderError(`Duplicate EventSource message key: ${key}`);
|
34
|
-
}
|
35
|
-
if (key === "data") {
|
26
|
+
const index = line.indexOf(":");
|
27
|
+
const key = index === -1 ? line : line.slice(0, index);
|
28
|
+
const value = index === -1 ? "" : line.slice(index + 1).replace(/^\s/, "");
|
29
|
+
if (index === 0) {
|
30
|
+
message.comments.push(value);
|
31
|
+
} else if (key === "data") {
|
32
|
+
message.data ??= "";
|
36
33
|
message.data += `${value}
|
37
34
|
`;
|
38
35
|
} else if (key === "event") {
|
@@ -41,18 +38,15 @@ function decodeEventMessage(encoded) {
|
|
41
38
|
message.id = value;
|
42
39
|
} else if (key === "retry") {
|
43
40
|
const maybeInteger = Number.parseInt(value);
|
44
|
-
if (
|
45
|
-
|
41
|
+
if (Number.isInteger(maybeInteger) && maybeInteger >= 0 && maybeInteger.toString() === value) {
|
42
|
+
message.retry = maybeInteger;
|
46
43
|
}
|
47
|
-
message.retry = maybeInteger;
|
48
|
-
} else {
|
49
|
-
throw new EventDecoderError(`Unknown EventSource message key: ${key}`);
|
50
44
|
}
|
51
45
|
}
|
52
|
-
message.data = message.data
|
46
|
+
message.data = message.data?.replace(/\n$/, "");
|
53
47
|
return message;
|
54
48
|
}
|
55
|
-
|
49
|
+
class EventDecoder {
|
56
50
|
constructor(options = {}) {
|
57
51
|
this.options = options;
|
58
52
|
}
|
@@ -63,12 +57,9 @@ var EventDecoder = class {
|
|
63
57
|
if (lastCompleteIndex === -1) {
|
64
58
|
return;
|
65
59
|
}
|
66
|
-
const completes = this.incomplete.slice(0, lastCompleteIndex
|
60
|
+
const completes = this.incomplete.slice(0, lastCompleteIndex).split(/\n\n/);
|
67
61
|
this.incomplete = this.incomplete.slice(lastCompleteIndex + 2);
|
68
62
|
for (const encoded of completes) {
|
69
|
-
if (!encoded) {
|
70
|
-
continue;
|
71
|
-
}
|
72
63
|
const message = decodeEventMessage(`${encoded}
|
73
64
|
|
74
65
|
`);
|
@@ -79,10 +70,12 @@ var EventDecoder = class {
|
|
79
70
|
this.incomplete = "";
|
80
71
|
}
|
81
72
|
end() {
|
82
|
-
this.
|
73
|
+
if (this.incomplete) {
|
74
|
+
throw new EventDecoderError("Event Iterator ended before complete");
|
75
|
+
}
|
83
76
|
}
|
84
|
-
}
|
85
|
-
|
77
|
+
}
|
78
|
+
class EventDecoderStream extends TransformStream {
|
86
79
|
constructor() {
|
87
80
|
let decoder;
|
88
81
|
super({
|
@@ -101,26 +94,30 @@ var EventDecoderStream = class extends TransformStream {
|
|
101
94
|
}
|
102
95
|
});
|
103
96
|
}
|
104
|
-
}
|
97
|
+
}
|
105
98
|
|
106
|
-
// src/event-source/encoder.ts
|
107
99
|
function assertEventId(id) {
|
108
100
|
if (id.includes("\n")) {
|
109
|
-
throw new EventEncoderError("Event
|
101
|
+
throw new EventEncoderError("Event's id must not contain a newline character");
|
110
102
|
}
|
111
103
|
}
|
112
104
|
function assertEventName(event) {
|
113
105
|
if (event.includes("\n")) {
|
114
|
-
throw new EventEncoderError("Event
|
106
|
+
throw new EventEncoderError("Event's event must not contain a newline character");
|
115
107
|
}
|
116
108
|
}
|
117
109
|
function assertEventRetry(retry) {
|
118
110
|
if (!Number.isInteger(retry) || retry < 0) {
|
119
|
-
throw new EventEncoderError("Event
|
111
|
+
throw new EventEncoderError("Event's retry must be a integer and >= 0");
|
112
|
+
}
|
113
|
+
}
|
114
|
+
function assertEventComment(comment) {
|
115
|
+
if (comment.includes("\n")) {
|
116
|
+
throw new EventEncoderError("Event's comment must not contain a newline character");
|
120
117
|
}
|
121
118
|
}
|
122
119
|
function encodeEventData(data) {
|
123
|
-
const lines = data
|
120
|
+
const lines = data?.split(/\n/) ?? [];
|
124
121
|
let output = "";
|
125
122
|
for (const line of lines) {
|
126
123
|
output += `data: ${line}
|
@@ -128,8 +125,18 @@ function encodeEventData(data) {
|
|
128
125
|
}
|
129
126
|
return output;
|
130
127
|
}
|
128
|
+
function encodeEventComments(comments) {
|
129
|
+
let output = "";
|
130
|
+
for (const comment of comments ?? []) {
|
131
|
+
assertEventComment(comment);
|
132
|
+
output += `: ${comment}
|
133
|
+
`;
|
134
|
+
}
|
135
|
+
return output;
|
136
|
+
}
|
131
137
|
function encodeEventMessage(message) {
|
132
138
|
let output = "";
|
139
|
+
output += encodeEventComments(message.comments);
|
133
140
|
if (message.event !== void 0) {
|
134
141
|
assertEventName(message.event);
|
135
142
|
output += `event: ${message.event}
|
@@ -150,9 +157,7 @@ function encodeEventMessage(message) {
|
|
150
157
|
return output;
|
151
158
|
}
|
152
159
|
|
153
|
-
|
154
|
-
import { isTypescriptObject } from "@orpc/shared";
|
155
|
-
var EVENT_SOURCE_META_SYMBOL = Symbol("ORPC_EVENT_SOURCE_META");
|
160
|
+
const EVENT_SOURCE_META_SYMBOL = Symbol("ORPC_EVENT_SOURCE_META");
|
156
161
|
function withEventMeta(container, meta) {
|
157
162
|
if (meta.id !== void 0) {
|
158
163
|
assertEventId(meta.id);
|
@@ -160,6 +165,11 @@ function withEventMeta(container, meta) {
|
|
160
165
|
if (meta.retry !== void 0) {
|
161
166
|
assertEventRetry(meta.retry);
|
162
167
|
}
|
168
|
+
if (meta.comments !== void 0) {
|
169
|
+
for (const comment of meta.comments) {
|
170
|
+
assertEventComment(comment);
|
171
|
+
}
|
172
|
+
}
|
163
173
|
return new Proxy(container, {
|
164
174
|
get(target, prop, receiver) {
|
165
175
|
if (prop === EVENT_SOURCE_META_SYMBOL) {
|
@@ -173,24 +183,4 @@ function getEventMeta(container) {
|
|
173
183
|
return isTypescriptObject(container) ? Reflect.get(container, EVENT_SOURCE_META_SYMBOL) : void 0;
|
174
184
|
}
|
175
185
|
|
176
|
-
|
177
|
-
import { contentDisposition, parse } from "@tinyhttp/content-disposition";
|
178
|
-
export {
|
179
|
-
ErrorEvent,
|
180
|
-
EventDecoder,
|
181
|
-
EventDecoderError,
|
182
|
-
EventDecoderStream,
|
183
|
-
EventEncoderError,
|
184
|
-
UnknownEvent,
|
185
|
-
assertEventId,
|
186
|
-
assertEventName,
|
187
|
-
assertEventRetry,
|
188
|
-
contentDisposition,
|
189
|
-
decodeEventMessage,
|
190
|
-
encodeEventData,
|
191
|
-
encodeEventMessage,
|
192
|
-
getEventMeta,
|
193
|
-
parse as parseContentDisposition,
|
194
|
-
withEventMeta
|
195
|
-
};
|
196
|
-
//# sourceMappingURL=index.js.map
|
186
|
+
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, 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.ff68fdb",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://unnoq.com",
|
7
7
|
"repository": {
|
@@ -14,25 +14,20 @@
|
|
14
14
|
],
|
15
15
|
"exports": {
|
16
16
|
".": {
|
17
|
-
"types": "./dist/
|
18
|
-
"import": "./dist/index.
|
19
|
-
"default": "./dist/index.
|
20
|
-
},
|
21
|
-
"./🔒/*": {
|
22
|
-
"types": "./dist/src/*.d.ts"
|
17
|
+
"types": "./dist/index.d.mts",
|
18
|
+
"import": "./dist/index.mjs",
|
19
|
+
"default": "./dist/index.mjs"
|
23
20
|
}
|
24
21
|
},
|
25
22
|
"files": [
|
26
|
-
"!**/*.map",
|
27
|
-
"!**/*.tsbuildinfo",
|
28
23
|
"dist"
|
29
24
|
],
|
30
25
|
"dependencies": {
|
31
26
|
"@tinyhttp/content-disposition": "^2.2.2",
|
32
|
-
"@orpc/shared": "0.0.0-next.
|
27
|
+
"@orpc/shared": "0.0.0-next.ff68fdb"
|
33
28
|
},
|
34
29
|
"scripts": {
|
35
|
-
"build": "
|
30
|
+
"build": "unbuild",
|
36
31
|
"build:watch": "pnpm run build --watch",
|
37
32
|
"type:check": "tsc -b"
|
38
33
|
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { EventMessage } from './types';
|
2
|
-
export declare function decodeEventMessage(encoded: string): EventMessage;
|
3
|
-
export interface EventDecoderOptions {
|
4
|
-
onEvent?: (event: EventMessage) => void;
|
5
|
-
}
|
6
|
-
export declare class EventDecoder {
|
7
|
-
private options;
|
8
|
-
private incomplete;
|
9
|
-
constructor(options?: EventDecoderOptions);
|
10
|
-
feed(chunk: string): void;
|
11
|
-
end(): void;
|
12
|
-
}
|
13
|
-
export declare class EventDecoderStream extends TransformStream<string, EventMessage> {
|
14
|
-
constructor();
|
15
|
-
}
|
16
|
-
//# sourceMappingURL=decoder.d.ts.map
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { EventMessage } from './types';
|
2
|
-
export declare function assertEventId(id: string): void;
|
3
|
-
export declare function assertEventName(event: string): void;
|
4
|
-
export declare function assertEventRetry(retry: number): void;
|
5
|
-
export declare function encodeEventData(data: string | undefined): string;
|
6
|
-
export declare function encodeEventMessage(message: Partial<EventMessage>): string;
|
7
|
-
//# sourceMappingURL=encoder.d.ts.map
|
@@ -1,15 +0,0 @@
|
|
1
|
-
export declare class EventEncoderError extends TypeError {
|
2
|
-
}
|
3
|
-
export declare class EventDecoderError extends TypeError {
|
4
|
-
}
|
5
|
-
export interface ErrorEventOptions extends ErrorOptions {
|
6
|
-
message?: string;
|
7
|
-
data?: unknown;
|
8
|
-
}
|
9
|
-
export declare class ErrorEvent extends Error {
|
10
|
-
data: unknown;
|
11
|
-
constructor(options?: ErrorEventOptions);
|
12
|
-
}
|
13
|
-
export declare class UnknownEvent extends ErrorEvent {
|
14
|
-
}
|
15
|
-
//# sourceMappingURL=errors.d.ts.map
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { EventMessage } from './types';
|
2
|
-
export type EventMeta = Partial<Pick<EventMessage, 'retry' | 'id'>>;
|
3
|
-
export declare function withEventMeta<T extends object>(container: T, meta: EventMeta): T;
|
4
|
-
export declare function getEventMeta(container: unknown): EventMeta | undefined;
|
5
|
-
//# sourceMappingURL=meta.d.ts.map
|
@@ -1,10 +0,0 @@
|
|
1
|
-
export interface EventMessage {
|
2
|
-
event: string | undefined;
|
3
|
-
id: string | undefined;
|
4
|
-
data: string;
|
5
|
-
/**
|
6
|
-
* The number of milliseconds to wait before retrying the event source if error occurs.
|
7
|
-
*/
|
8
|
-
retry: number | undefined;
|
9
|
-
}
|
10
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/index.d.ts
DELETED
package/dist/src/types.d.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
export interface StandardHeaders {
|
2
|
-
[key: string]: string | string[] | undefined;
|
3
|
-
}
|
4
|
-
export type StandardBody = undefined | unknown | Blob | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined>;
|
5
|
-
export interface StandardRequest {
|
6
|
-
/**
|
7
|
-
* Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
|
8
|
-
*/
|
9
|
-
raw: Record<string, unknown>;
|
10
|
-
method: string;
|
11
|
-
url: URL;
|
12
|
-
headers: StandardHeaders;
|
13
|
-
/**
|
14
|
-
* The body has been parsed base on the content-type header.
|
15
|
-
* This method can safely call multiple times (cached).
|
16
|
-
*/
|
17
|
-
body: () => Promise<StandardBody>;
|
18
|
-
signal: AbortSignal | undefined;
|
19
|
-
}
|
20
|
-
export interface StandardResponse {
|
21
|
-
status: number;
|
22
|
-
headers: StandardHeaders;
|
23
|
-
body: StandardBody;
|
24
|
-
}
|
25
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/utils.d.ts
DELETED