@orpc/standard-server 0.45.1 → 0.47.0
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 +27 -7
- package/dist/index.d.ts +27 -7
- package/dist/index.mjs +5 -5
- package/package.json +2 -2
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
|
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[];
|
@@ -56,24 +56,44 @@ interface StandardHeaders {
|
|
56
56
|
}
|
57
57
|
type StandardBody = undefined | unknown | Blob | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined>;
|
58
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'> {
|
59
69
|
/**
|
60
70
|
* Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
|
61
71
|
*/
|
62
72
|
raw: Record<string, unknown>;
|
63
|
-
method: string;
|
64
|
-
url: URL;
|
65
|
-
headers: StandardHeaders;
|
66
73
|
/**
|
67
|
-
* The body has been parsed
|
74
|
+
* The body has been parsed based on the content-type header.
|
68
75
|
* This method can safely call multiple times (cached).
|
69
76
|
*/
|
70
77
|
body: () => Promise<StandardBody>;
|
71
|
-
signal: AbortSignal | undefined;
|
72
78
|
}
|
73
79
|
interface StandardResponse {
|
74
80
|
status: number;
|
75
81
|
headers: StandardHeaders;
|
82
|
+
/**
|
83
|
+
* The body has been parsed based on the content-type header.
|
84
|
+
*/
|
76
85
|
body: StandardBody;
|
77
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
|
+
}
|
78
98
|
|
79
|
-
export { ErrorEvent, type ErrorEventOptions, EventDecoder, EventDecoderError, type EventDecoderOptions, EventDecoderStream, EventEncoderError, type EventMessage, type EventMeta, type StandardBody, type StandardHeaders, type StandardRequest, type StandardResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, withEventMeta };
|
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
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
|
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[];
|
@@ -56,24 +56,44 @@ interface StandardHeaders {
|
|
56
56
|
}
|
57
57
|
type StandardBody = undefined | unknown | Blob | URLSearchParams | FormData | AsyncIterator<unknown | void, unknown | void, undefined>;
|
58
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'> {
|
59
69
|
/**
|
60
70
|
* Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
|
61
71
|
*/
|
62
72
|
raw: Record<string, unknown>;
|
63
|
-
method: string;
|
64
|
-
url: URL;
|
65
|
-
headers: StandardHeaders;
|
66
73
|
/**
|
67
|
-
* The body has been parsed
|
74
|
+
* The body has been parsed based on the content-type header.
|
68
75
|
* This method can safely call multiple times (cached).
|
69
76
|
*/
|
70
77
|
body: () => Promise<StandardBody>;
|
71
|
-
signal: AbortSignal | undefined;
|
72
78
|
}
|
73
79
|
interface StandardResponse {
|
74
80
|
status: number;
|
75
81
|
headers: StandardHeaders;
|
82
|
+
/**
|
83
|
+
* The body has been parsed based on the content-type header.
|
84
|
+
*/
|
76
85
|
body: StandardBody;
|
77
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
|
+
}
|
78
98
|
|
79
|
-
export { ErrorEvent, type ErrorEventOptions, EventDecoder, EventDecoderError, type EventDecoderOptions, EventDecoderStream, EventEncoderError, type EventMessage, type EventMeta, type StandardBody, type StandardHeaders, type StandardRequest, type StandardResponse, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, withEventMeta };
|
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.mjs
CHANGED
@@ -71,7 +71,7 @@ class EventDecoder {
|
|
71
71
|
}
|
72
72
|
end() {
|
73
73
|
if (this.incomplete) {
|
74
|
-
throw new EventDecoderError("
|
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
|
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
|
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
|
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
|
116
|
+
throw new EventEncoderError("Event's comment must not contain a newline character");
|
117
117
|
}
|
118
118
|
}
|
119
119
|
function encodeEventData(data) {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/standard-server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.47.0",
|
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.
|
27
|
+
"@orpc/shared": "0.47.0"
|
28
28
|
},
|
29
29
|
"scripts": {
|
30
30
|
"build": "unbuild",
|