@orpc/client 0.0.0-next.a055cad → 0.0.0-next.a895960

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -9,7 +9,8 @@ import { ORPCDeserializer, ORPCSerializer } from "@orpc/transformer";
9
9
  function createProcedureClient(options) {
10
10
  const serializer = new ORPCSerializer();
11
11
  const deserializer = new ORPCDeserializer();
12
- const client = async (input) => {
12
+ const client = async (...args) => {
13
+ const [input, callerOptions] = args;
13
14
  const fetch_ = options.fetch ?? fetch;
14
15
  const url = `${trim(options.baseURL, "/")}/${options.path.map(encodeURIComponent).join("/")}`;
15
16
  let headers = await options.headers?.(input);
@@ -22,7 +23,8 @@ function createProcedureClient(options) {
22
23
  const response = await fetch_(url, {
23
24
  method: "POST",
24
25
  headers,
25
- body
26
+ body,
27
+ signal: callerOptions?.signal
26
28
  });
27
29
  const json = await (async () => {
28
30
  try {
@@ -1,8 +1,7 @@
1
+ import type { Caller } from '@orpc/server';
1
2
  import type { Promisable } from '@orpc/shared';
2
3
  import { type Schema, type SchemaInput, type SchemaOutput } from '@orpc/contract';
3
- export interface ProcedureClient<TInputSchema extends Schema, TOutputSchema extends Schema, TFuncOutput extends SchemaOutput<TOutputSchema>> {
4
- (input: SchemaInput<TInputSchema>): Promise<SchemaOutput<TOutputSchema, TFuncOutput>>;
5
- }
4
+ export type ProcedureClient<TInputSchema extends Schema, TOutputSchema extends Schema, TFuncOutput extends SchemaOutput<TOutputSchema>> = Caller<SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, TFuncOutput>>;
6
5
  export interface CreateProcedureClientOptions {
7
6
  /**
8
7
  * The base url of the server.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/client",
3
3
  "type": "module",
4
- "version": "0.0.0-next.a055cad",
4
+ "version": "0.0.0-next.a895960",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -29,16 +29,16 @@
29
29
  "dist"
30
30
  ],
31
31
  "peerDependencies": {
32
- "@orpc/contract": "0.0.0-next.a055cad",
33
- "@orpc/server": "0.0.0-next.a055cad"
32
+ "@orpc/contract": "0.0.0-next.a895960",
33
+ "@orpc/server": "0.0.0-next.a895960"
34
34
  },
35
35
  "dependencies": {
36
- "@orpc/shared": "0.0.0-next.a055cad",
37
- "@orpc/transformer": "0.0.0-next.a055cad"
36
+ "@orpc/transformer": "0.0.0-next.a895960",
37
+ "@orpc/shared": "0.0.0-next.a895960"
38
38
  },
39
39
  "devDependencies": {
40
40
  "zod": "^3.23.8",
41
- "@orpc/openapi": "0.0.0-next.a055cad"
41
+ "@orpc/openapi": "0.0.0-next.a895960"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",