@orpc/standard-server-peer 0.0.0-next.d5f6b77 → 1.2.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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -7
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { toArray, isAsyncIteratorObject, stringifyJSON, createAsyncIteratorObject, isTypescriptObject, SequentialIdGenerator, AsyncIdQueue } from '@orpc/shared';
2
- import { getFilenameFromContentDisposition, generateContentDisposition, withEventMeta, ErrorEvent, getEventMeta } from '@orpc/standard-server';
1
+ import { isAsyncIteratorObject, stringifyJSON, createAsyncIteratorObject, isTypescriptObject, SequentialIdGenerator, AsyncIdQueue } from '@orpc/shared';
2
+ import { flattenHeader, getFilenameFromContentDisposition, generateContentDisposition, withEventMeta, ErrorEvent, getEventMeta } from '@orpc/standard-server';
3
3
 
4
4
  var MessageType = /* @__PURE__ */ ((MessageType2) => {
5
5
  MessageType2[MessageType2["REQUEST"] = 1] = "REQUEST";
@@ -55,9 +55,9 @@ async function decodeRequestMessage(raw) {
55
55
  const payload = message.p;
56
56
  const headers = payload.h ?? {};
57
57
  let body = payload.b;
58
- const contentType = toArray(headers["content-type"])[0];
58
+ const contentType = flattenHeader(headers["content-type"]);
59
59
  if (blobData) {
60
- const contentDisposition = toArray(headers["content-disposition"])[0];
60
+ const contentDisposition = flattenHeader(headers["content-disposition"]);
61
61
  if (contentDisposition === void 0 && contentType?.startsWith("multipart/form-data")) {
62
62
  const tempRes = new Response(blobData, { headers: { "content-type": contentType } });
63
63
  body = await tempRes.formData();
@@ -116,9 +116,9 @@ async function decodeResponseMessage(raw) {
116
116
  const payload = message.p;
117
117
  const headers = payload.h ?? {};
118
118
  let body = payload.b;
119
- const contentType = toArray(headers["content-type"])[0];
119
+ const contentType = flattenHeader(headers["content-type"]);
120
120
  if (blobData) {
121
- const contentDisposition = toArray(headers["content-disposition"])[0];
121
+ const contentDisposition = flattenHeader(headers["content-disposition"]);
122
122
  if (contentDisposition === void 0 && contentType?.startsWith("multipart/form-data")) {
123
123
  const tempRes = new Response(blobData, { headers: { "content-type": contentType } });
124
124
  body = await tempRes.formData();
@@ -160,7 +160,7 @@ async function prepareBodyAndHeadersForSerialization(body, originalHeaders) {
160
160
  return { body, headers };
161
161
  }
162
162
  function isEventIteratorHeaders(headers) {
163
- return Boolean(toArray(headers["content-type"])[0]?.startsWith("text/event-stream") && headers["content-disposition"] === void 0);
163
+ return Boolean(flattenHeader(headers["content-type"])?.startsWith("text/event-stream") && headers["content-disposition"] === void 0);
164
164
  }
165
165
  const JSON_AND_BINARY_DELIMITER = 255;
166
166
  async function encodeRawMessage(data, blobData) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/standard-server-peer",
3
3
  "type": "module",
4
- "version": "0.0.0-next.d5f6b77",
4
+ "version": "1.2.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://unnoq.com",
7
7
  "repository": {
@@ -23,8 +23,8 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@orpc/shared": "0.0.0-next.d5f6b77",
27
- "@orpc/standard-server": "0.0.0-next.d5f6b77"
26
+ "@orpc/shared": "1.2.0",
27
+ "@orpc/standard-server": "1.2.0"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "unbuild",