@orpc/standard-server 0.0.0-next.c0ca4c7 → 0.0.0-next.c40d0c9
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +16 -2
- package/package.json +2 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition';
|
|
2
|
-
|
|
3
1
|
interface EventMessage {
|
|
4
2
|
event: string | undefined;
|
|
5
3
|
id: string | undefined;
|
|
@@ -88,6 +86,8 @@ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
|
|
|
88
86
|
body: () => Promise<StandardBody>;
|
|
89
87
|
}
|
|
90
88
|
|
|
89
|
+
declare function generateContentDisposition(filename: string): string;
|
|
90
|
+
declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
|
|
91
91
|
declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
|
|
92
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 };
|
|
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, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, withEventMeta };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition';
|
|
2
|
-
|
|
3
1
|
interface EventMessage {
|
|
4
2
|
event: string | undefined;
|
|
5
3
|
id: string | undefined;
|
|
@@ -88,6 +86,8 @@ interface StandardLazyResponse extends Omit<StandardResponse, 'body'> {
|
|
|
88
86
|
body: () => Promise<StandardBody>;
|
|
89
87
|
}
|
|
90
88
|
|
|
89
|
+
declare function generateContentDisposition(filename: string): string;
|
|
90
|
+
declare function getFilenameFromContentDisposition(contentDisposition: string): string | undefined;
|
|
91
91
|
declare function mergeStandardHeaders(a: StandardHeaders, b: StandardHeaders): StandardHeaders;
|
|
92
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 };
|
|
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, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, mergeStandardHeaders, withEventMeta };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isTypescriptObject, toArray } from '@orpc/shared';
|
|
2
|
-
export { contentDisposition, parse as parseContentDisposition } from '@tinyhttp/content-disposition';
|
|
3
2
|
|
|
4
3
|
class EventEncoderError extends TypeError {
|
|
5
4
|
}
|
|
@@ -183,6 +182,21 @@ function getEventMeta(container) {
|
|
|
183
182
|
return isTypescriptObject(container) ? Reflect.get(container, EVENT_SOURCE_META_SYMBOL) : void 0;
|
|
184
183
|
}
|
|
185
184
|
|
|
185
|
+
function generateContentDisposition(filename) {
|
|
186
|
+
const escapedFileName = filename.replace(/"/g, '\\"');
|
|
187
|
+
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)));
|
|
188
|
+
return `inline; filename="${escapedFileName}"; filename*=utf-8''${encodedFilenameStar}`;
|
|
189
|
+
}
|
|
190
|
+
function getFilenameFromContentDisposition(contentDisposition) {
|
|
191
|
+
const encodedFilenameStarMatch = contentDisposition.match(/filename\*=(UTF-8'')?([^;]*)/i);
|
|
192
|
+
if (encodedFilenameStarMatch && typeof encodedFilenameStarMatch[2] === "string") {
|
|
193
|
+
return decodeURIComponent(encodedFilenameStarMatch[2]);
|
|
194
|
+
}
|
|
195
|
+
const encodedFilenameMatch = contentDisposition.match(/filename="((?:\\"|[^"])*)"/i);
|
|
196
|
+
if (encodedFilenameMatch && typeof encodedFilenameMatch[1] === "string") {
|
|
197
|
+
return encodedFilenameMatch[1].replace(/\\"/g, '"');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
186
200
|
function mergeStandardHeaders(a, b) {
|
|
187
201
|
const merged = { ...a };
|
|
188
202
|
for (const key in b) {
|
|
@@ -201,4 +215,4 @@ function mergeStandardHeaders(a, b) {
|
|
|
201
215
|
return merged;
|
|
202
216
|
}
|
|
203
217
|
|
|
204
|
-
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, getEventMeta, mergeStandardHeaders, withEventMeta };
|
|
218
|
+
export { ErrorEvent, EventDecoder, EventDecoderError, EventDecoderStream, EventEncoderError, assertEventComment, assertEventId, assertEventName, assertEventRetry, decodeEventMessage, encodeEventComments, encodeEventData, encodeEventMessage, generateContentDisposition, getEventMeta, getFilenameFromContentDisposition, 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.
|
|
4
|
+
"version": "0.0.0-next.c40d0c9",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@orpc/shared": "0.0.0-next.c0ca4c7"
|
|
26
|
+
"@orpc/shared": "0.0.0-next.c40d0c9"
|
|
28
27
|
},
|
|
29
28
|
"scripts": {
|
|
30
29
|
"build": "unbuild",
|