@orpc/client 0.0.0-next.c29cb6d → 0.0.0-next.c40d0c9

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/index.js DELETED
@@ -1,39 +0,0 @@
1
- // src/client.ts
2
- function createORPCClient(link, options) {
3
- const path = options?.path ?? [];
4
- const procedureClient = async (...[input, options2]) => {
5
- return await link.call(path, input, options2 ?? {});
6
- };
7
- const recursive = new Proxy(procedureClient, {
8
- get(target, key) {
9
- if (typeof key !== "string") {
10
- return Reflect.get(target, key);
11
- }
12
- return createORPCClient(link, {
13
- ...options,
14
- path: [...path, key]
15
- });
16
- }
17
- });
18
- return recursive;
19
- }
20
-
21
- // src/dynamic-link.ts
22
- var DynamicLink = class {
23
- constructor(linkResolver) {
24
- this.linkResolver = linkResolver;
25
- }
26
- async call(path, input, options) {
27
- const resolvedLink = await this.linkResolver(path, input, options);
28
- const output = await resolvedLink.call(path, input, options);
29
- return output;
30
- }
31
- };
32
-
33
- // src/index.ts
34
- export * from "@orpc/shared/error";
35
- export {
36
- DynamicLink,
37
- createORPCClient
38
- };
39
- //# sourceMappingURL=index.js.map
@@ -1,3 +0,0 @@
1
- export * from './orpc-link';
2
- export * from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,19 +0,0 @@
1
- import type { ProcedureClientOptions } from '@orpc/server';
2
- import type { Promisable } from '@orpc/shared';
3
- import type { ClientLink } from '../../types';
4
- import type { FetchWithContext } from './types';
5
- import { type PublicORPCPayloadCodec } from '@orpc/server/fetch';
6
- export interface ORPCLinkOptions<TClientContext> {
7
- url: string;
8
- headers?: (input: unknown, context: TClientContext) => Promisable<Headers | Record<string, string>>;
9
- fetch?: FetchWithContext<TClientContext>;
10
- payloadCodec?: PublicORPCPayloadCodec;
11
- }
12
- export declare class ORPCLink<TClientContext> implements ClientLink<TClientContext> {
13
- private readonly options;
14
- private readonly fetch;
15
- private readonly payloadCodec;
16
- constructor(options: ORPCLinkOptions<TClientContext>);
17
- call(path: readonly string[], input: unknown, options: ProcedureClientOptions<TClientContext>): Promise<unknown>;
18
- }
19
- //# sourceMappingURL=orpc-link.d.ts.map
@@ -1,4 +0,0 @@
1
- export interface FetchWithContext<TClientContext> {
2
- (input: RequestInfo | URL, init: RequestInit | undefined, context: TClientContext): Promise<Response>;
3
- }
4
- //# sourceMappingURL=types.d.ts.map
@@ -1,11 +0,0 @@
1
- import type { ContractRouter } from '@orpc/contract';
2
- import type { ANY_ROUTER, RouterClient } from '@orpc/server';
3
- import type { ClientLink } from './types';
4
- export interface createORPCClientOptions {
5
- /**
6
- * Use as base path for all procedure, useful when you only want to call a subset of the procedure.
7
- */
8
- path?: string[];
9
- }
10
- export declare function createORPCClient<TRouter extends ANY_ROUTER | ContractRouter, TClientContext = unknown>(link: ClientLink<TClientContext>, options?: createORPCClientOptions): RouterClient<TRouter, TClientContext>;
11
- //# sourceMappingURL=client.d.ts.map
@@ -1,15 +0,0 @@
1
- import type { ProcedureClientOptions } from '@orpc/server';
2
- import type { Promisable } from '@orpc/shared';
3
- import type { ClientLink } from './types';
4
- /**
5
- * DynamicLink provides a way to dynamically resolve and delegate calls to other ClientLinks
6
- * based on the request path, input, and context.
7
- */
8
- export declare class DynamicLink<TClientContext> implements ClientLink<TClientContext> {
9
- private readonly linkResolver;
10
- constructor(linkResolver: (path: readonly string[], input: unknown, options: ProcedureClientOptions<TClientContext> & {
11
- context: TClientContext;
12
- }) => Promisable<ClientLink<TClientContext>>);
13
- call(path: readonly string[], input: unknown, options: ProcedureClientOptions<TClientContext>): Promise<unknown>;
14
- }
15
- //# sourceMappingURL=dynamic-link.d.ts.map
@@ -1,6 +0,0 @@
1
- /** unnoq */
2
- export * from './client';
3
- export * from './dynamic-link';
4
- export * from './types';
5
- export * from '@orpc/shared/error';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,5 +0,0 @@
1
- import type { ProcedureClientOptions } from '@orpc/server';
2
- export interface ClientLink<TClientContext> {
3
- call: (path: readonly string[], input: unknown, options: ProcedureClientOptions<TClientContext>) => Promise<unknown>;
4
- }
5
- //# sourceMappingURL=types.d.ts.map