@orpc/client 0.36.1 → 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,7 +2,7 @@
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";
5
+ import { isObject, trim } from "@orpc/shared";
6
6
  import { contentDisposition } from "@tinyhttp/content-disposition";
7
7
  var RPCLink = class {
8
8
  fetch;
@@ -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.1",
4
+ "version": "0.37.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -35,13 +35,13 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@tinyhttp/content-disposition": "^2.2.2",
38
- "@orpc/shared": "0.36.1",
39
- "@orpc/contract": "0.36.1",
40
- "@orpc/server": "0.36.1"
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.1"
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'",