@orpc/client 0.36.0 → 0.37.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/fetch.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import { ORPCError } from "@orpc/contract";
3
3
  import { fetchReToStandardBody } from "@orpc/server/fetch";
4
4
  import { RPCSerializer } from "@orpc/server/standard";
5
- import { isPlainObject, trim } from "@orpc/shared";
6
- import cd from "content-disposition";
5
+ import { isObject, trim } from "@orpc/shared";
6
+ import { contentDisposition } from "@tinyhttp/content-disposition";
7
7
  var RPCLink = class {
8
8
  fetch;
9
9
  rpcSerializer;
@@ -29,7 +29,7 @@ var RPCLink = class {
29
29
  const clientContext = options.context;
30
30
  const encoded = await this.encode(path, input, options);
31
31
  if (encoded.body instanceof Blob && !encoded.headers.has("content-disposition")) {
32
- encoded.headers.set("content-disposition", cd(encoded.body instanceof File ? encoded.body.name : "blob"));
32
+ encoded.headers.set("content-disposition", contentDisposition(encoded.body instanceof File ? encoded.body.name : "blob"));
33
33
  }
34
34
  const response = await this.fetch(encoded.url, {
35
35
  method: encoded.method,
@@ -65,7 +65,7 @@ var RPCLink = class {
65
65
  const url = new URL(`${trim(this.url, "/")}/${path.map(encodeURIComponent).join("/")}`);
66
66
  headers.append("x-orpc-handler", "rpc");
67
67
  const serialized = this.rpcSerializer.serialize(input);
68
- if (expectMethod === "GET" && isPlainObject(serialized)) {
68
+ if (expectMethod === "GET" && isObject(serialized)) {
69
69
  const tryURL = new URL(url);
70
70
  tryURL.searchParams.append("data", JSON.stringify(serialized));
71
71
  if (tryURL.toString().length <= this.maxURLLength) {
@@ -78,7 +78,15 @@ var RPCLink = class {
78
78
  }
79
79
  }
80
80
  const method = expectMethod === "GET" ? this.fallbackMethod : expectMethod;
81
- if (isPlainObject(serialized)) {
81
+ if (input === void 0) {
82
+ return {
83
+ body: void 0,
84
+ method,
85
+ headers,
86
+ url
87
+ };
88
+ }
89
+ if (isObject(serialized)) {
82
90
  if (!headers.has("content-type")) {
83
91
  headers.set("content-type", "application/json");
84
92
  }
@@ -1,4 +1,4 @@
1
1
  export interface FetchWithContext<TClientContext> {
2
- (input: RequestInfo | URL, init: RequestInit | undefined, context: TClientContext): Promise<Response>;
2
+ (url: Request | string | URL, init: RequestInit | undefined, context: TClientContext): Promise<Response>;
3
3
  }
4
4
  //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/client",
3
3
  "type": "module",
4
- "version": "0.36.0",
4
+ "version": "0.37.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -34,14 +34,14 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "content-disposition": "^0.5.4",
38
- "@orpc/contract": "0.36.0",
39
- "@orpc/server": "0.36.0",
40
- "@orpc/shared": "0.36.0"
37
+ "@tinyhttp/content-disposition": "^2.2.2",
38
+ "@orpc/contract": "0.37.0",
39
+ "@orpc/shared": "0.37.0",
40
+ "@orpc/server": "0.37.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "zod": "^3.24.1",
44
- "@orpc/openapi": "0.36.0"
44
+ "@orpc/openapi": "0.37.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/adapters/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",