@orpc/openapi-client 0.0.0-next.73eeb92 → 0.0.0-next.85cc28f

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.
@@ -1,6 +1,6 @@
1
1
  import { LinkFetchClient } from '@orpc/client/fetch';
2
2
  import { StandardLink } from '@orpc/client/standard';
3
- import { a as StandardOpenAPIJsonSerializer, b as StandardOpenapiLinkCodec, c as StandardOpenAPISerializer, S as StandardBracketNotationSerializer } from '../../shared/openapi-client.V75iq1Nn.mjs';
3
+ import { a as StandardOpenAPIJsonSerializer, b as StandardOpenapiLinkCodec, c as StandardOpenAPISerializer, S as StandardBracketNotationSerializer } from '../../shared/openapi-client.B-GardF8.mjs';
4
4
  import '@orpc/shared';
5
5
  import '@orpc/client';
6
6
  import '@orpc/contract';
@@ -1,4 +1,4 @@
1
- export { S as StandardBracketNotationSerializer, a as StandardOpenAPIJsonSerializer, c as StandardOpenAPISerializer, b as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.V75iq1Nn.mjs';
1
+ export { S as StandardBracketNotationSerializer, a as StandardOpenAPIJsonSerializer, c as StandardOpenAPISerializer, b as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.B-GardF8.mjs';
2
2
  import '@orpc/shared';
3
3
  import '@orpc/client';
4
4
  import '@orpc/client/standard';
@@ -1,6 +1,6 @@
1
1
  import { isObject, value, get, isAsyncIteratorObject } from '@orpc/shared';
2
2
  import { isORPCErrorStatus, mapEventIterator, toORPCError, ORPCError as ORPCError$1 } from '@orpc/client';
3
- import { toHttpPath } from '@orpc/client/standard';
3
+ import { toHttpPath, getMalformedResponseErrorCode } from '@orpc/client/standard';
4
4
  import { isContractProcedure, fallbackContractConfig, ORPCError } from '@orpc/contract';
5
5
  import { mergeStandardHeaders, ErrorEvent } from '@orpc/standard-server';
6
6
 
@@ -202,7 +202,7 @@ class StandardOpenapiLinkCodec {
202
202
  throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${path.join(".")}`);
203
203
  }
204
204
  const inputStructure = fallbackContractConfig("defaultInputStructure", procedure["~orpc"].route.inputStructure);
205
- return inputStructure === "compact" ? this.#encodeCompact(procedure, path, input, options, baseUrl.toString(), headers) : this.#encodeDetailed(procedure, path, input, options, baseUrl.toString(), headers);
205
+ return inputStructure === "compact" ? this.#encodeCompact(procedure, path, input, options, baseUrl, headers) : this.#encodeDetailed(procedure, path, input, options, baseUrl, headers);
206
206
  }
207
207
  #encodeCompact(procedure, path, input, options, baseUrl, headers) {
208
208
  let httpPath = standardizeHTTPPath(procedure["~orpc"].route.path ?? toHttpPath(path));
@@ -221,7 +221,8 @@ class StandardOpenapiLinkCodec {
221
221
  httpBody = Object.keys(body).length ? body : void 0;
222
222
  }
223
223
  const method = fallbackContractConfig("defaultMethod", procedure["~orpc"].route.method);
224
- const url = new URL(`${baseUrl.toString().replace(/\/$/, "")}${httpPath}`);
224
+ const url = new URL(baseUrl);
225
+ url.pathname = `${url.pathname.replace(/\/$/, "")}${httpPath}`;
225
226
  if (method === "GET") {
226
227
  const serialized = this.serializer.serialize(httpBody, { outputFormat: "URLSearchParams" });
227
228
  for (const [key, value2] of serialized) {
@@ -266,7 +267,8 @@ class StandardOpenapiLinkCodec {
266
267
  mergedHeaders = mergeStandardHeaders(input.headers, headers);
267
268
  }
268
269
  const method = fallbackContractConfig("defaultMethod", procedure["~orpc"].route.method);
269
- const url = new URL(`${baseUrl.toString().replace(/\/$/, "")}${httpPath}`);
270
+ const url = new URL(baseUrl);
271
+ url.pathname = `${url.pathname.replace(/\/$/, "")}${httpPath}`;
270
272
  if (input?.query !== void 0) {
271
273
  const query = this.serializer.serialize(input.query, { outputFormat: "URLSearchParams" });
272
274
  for (const [key, value2] of query) {
@@ -313,7 +315,7 @@ class StandardOpenapiLinkCodec {
313
315
  if (ORPCError.isValidJSON(deserialized)) {
314
316
  throw ORPCError.fromJSON(deserialized);
315
317
  }
316
- throw new ORPCError("MALFORMED_ORPC_ERROR_RESPONSE", {
318
+ throw new ORPCError(getMalformedResponseErrorCode(response.status), {
317
319
  status: response.status,
318
320
  data: deserialized
319
321
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/openapi-client",
3
3
  "type": "module",
4
- "version": "0.0.0-next.73eeb92",
4
+ "version": "0.0.0-next.85cc28f",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -34,13 +34,13 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@orpc/standard-server": "0.0.0-next.73eeb92",
38
- "@orpc/contract": "0.0.0-next.73eeb92",
39
- "@orpc/client": "0.0.0-next.73eeb92",
40
- "@orpc/shared": "0.0.0-next.73eeb92"
37
+ "@orpc/client": "0.0.0-next.85cc28f",
38
+ "@orpc/contract": "0.0.0-next.85cc28f",
39
+ "@orpc/shared": "0.0.0-next.85cc28f",
40
+ "@orpc/standard-server": "0.0.0-next.85cc28f"
41
41
  },
42
42
  "devDependencies": {
43
- "@orpc/server": "0.0.0-next.73eeb92"
43
+ "@orpc/server": "0.0.0-next.85cc28f"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "unbuild",