@nmtjs/client 0.14.4 → 0.15.0-beta.1
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/LICENSE.md +1 -1
- package/README.md +1 -1
- package/package.json +15 -24
- package/dist/common.d.ts +0 -38
- package/dist/common.js +0 -60
- package/dist/runtime.d.ts +0 -21
- package/dist/runtime.js +0 -105
- package/dist/static.d.ts +0 -9
- package/dist/static.js +0 -27
- package/dist/types.d.ts +0 -54
- package/dist/types.js +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2025 Denys Ilchyshyn
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -2,42 +2,33 @@
|
|
|
2
2
|
"name": "@nmtjs/client",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"exports": {
|
|
5
|
-
".":
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"module-sync": "./dist/common.js"
|
|
9
|
-
},
|
|
10
|
-
"./runtime": {
|
|
11
|
-
"types": "./dist/runtime.d.ts",
|
|
12
|
-
"import": "./dist/runtime.js",
|
|
13
|
-
"module-sync": "./dist/runtime.js"
|
|
14
|
-
},
|
|
15
|
-
"./static": {
|
|
16
|
-
"types": "./dist/static.d.ts",
|
|
17
|
-
"import": "./dist/static.js",
|
|
18
|
-
"module-sync": "./dist/static.js"
|
|
19
|
-
}
|
|
5
|
+
".": "./dist/index.js",
|
|
6
|
+
"./runtime": "./dist/clients/runtime.js",
|
|
7
|
+
"./static": "./dist/clients/static.js"
|
|
20
8
|
},
|
|
21
9
|
"peerDependencies": {
|
|
22
|
-
"@nmtjs/type": "0.
|
|
23
|
-
"@nmtjs/common": "0.
|
|
24
|
-
"@nmtjs/contract": "0.
|
|
25
|
-
"@nmtjs/protocol": "0.
|
|
10
|
+
"@nmtjs/type": "0.15.0-beta.1",
|
|
11
|
+
"@nmtjs/common": "0.15.0-beta.1",
|
|
12
|
+
"@nmtjs/contract": "0.15.0-beta.1",
|
|
13
|
+
"@nmtjs/protocol": "0.15.0-beta.1"
|
|
26
14
|
},
|
|
27
15
|
"devDependencies": {
|
|
28
|
-
"@nmtjs/
|
|
29
|
-
"@nmtjs/type": "0.
|
|
30
|
-
"@nmtjs/
|
|
31
|
-
"@nmtjs/
|
|
16
|
+
"@nmtjs/_tests": "0.15.0-beta.1",
|
|
17
|
+
"@nmtjs/type": "0.15.0-beta.1",
|
|
18
|
+
"@nmtjs/contract": "0.15.0-beta.1",
|
|
19
|
+
"@nmtjs/common": "0.15.0-beta.1",
|
|
20
|
+
"@nmtjs/protocol": "0.15.0-beta.1"
|
|
32
21
|
},
|
|
33
22
|
"files": [
|
|
34
23
|
"dist",
|
|
35
24
|
"LICENSE.md",
|
|
36
25
|
"README.md"
|
|
37
26
|
],
|
|
38
|
-
"version": "0.
|
|
27
|
+
"version": "0.15.0-beta.1",
|
|
39
28
|
"scripts": {
|
|
29
|
+
"clean-build": "rm -rf ./dist",
|
|
40
30
|
"build": "tsc",
|
|
31
|
+
"dev": "tsc --watch",
|
|
41
32
|
"type-check": "tsc --noEmit"
|
|
42
33
|
}
|
|
43
34
|
}
|
package/dist/common.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { TypeProvider } from '@nmtjs/common';
|
|
2
|
-
import type { TAnyAPIContract } from '@nmtjs/contract';
|
|
3
|
-
import type { ProtocolBaseClientCallOptions, ProtocolBaseTransformer, ProtocolTransport } from '@nmtjs/protocol/client';
|
|
4
|
-
import { ProtocolError } from '@nmtjs/protocol/client';
|
|
5
|
-
import type { ClientCallers, ResolveAPIRouterRoutes } from './types.ts';
|
|
6
|
-
export { ErrorCode, ProtocolBlob, type ProtocolBlobMetadata, TransportType, } from '@nmtjs/protocol';
|
|
7
|
-
export * from './types.ts';
|
|
8
|
-
export declare class ClientError extends ProtocolError {
|
|
9
|
-
}
|
|
10
|
-
export interface BaseClientOptions<SafeCall extends boolean = false> {
|
|
11
|
-
timeout: number;
|
|
12
|
-
autoreconnect?: boolean;
|
|
13
|
-
safe?: SafeCall;
|
|
14
|
-
}
|
|
15
|
-
export declare abstract class BaseClient<APIContract extends TAnyAPIContract = TAnyAPIContract, SafeCall extends boolean = false, InputTypeProvider extends TypeProvider = TypeProvider, OutputTypeProvider extends TypeProvider = TypeProvider, Routes extends {
|
|
16
|
-
contract: APIContract['router'];
|
|
17
|
-
routes: ResolveAPIRouterRoutes<APIContract['router'], InputTypeProvider, OutputTypeProvider>;
|
|
18
|
-
} = {
|
|
19
|
-
contract: APIContract['router'];
|
|
20
|
-
routes: ResolveAPIRouterRoutes<APIContract['router'], InputTypeProvider, OutputTypeProvider>;
|
|
21
|
-
}> {
|
|
22
|
-
readonly transport: ProtocolTransport;
|
|
23
|
-
readonly options: BaseClientOptions<SafeCall>;
|
|
24
|
-
_: {
|
|
25
|
-
api: Routes;
|
|
26
|
-
safe: SafeCall;
|
|
27
|
-
};
|
|
28
|
-
protected abstract transformer: ProtocolBaseTransformer;
|
|
29
|
-
protected callers: ClientCallers<Routes, SafeCall>;
|
|
30
|
-
auth: any;
|
|
31
|
-
protected reconnectTimeout: number;
|
|
32
|
-
constructor(transport: ProtocolTransport, options: BaseClientOptions<SafeCall>);
|
|
33
|
-
protected _call(procedure: string, payload: any, options: ProtocolBaseClientCallOptions): Promise<any>;
|
|
34
|
-
get call(): ClientCallers<Routes, SafeCall>;
|
|
35
|
-
setAuth(auth: any): void;
|
|
36
|
-
connect(): Promise<void>;
|
|
37
|
-
disconnect(): Promise<void>;
|
|
38
|
-
}
|
package/dist/common.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { noopFn } from '@nmtjs/common';
|
|
2
|
-
import { ProtocolError } from '@nmtjs/protocol/client';
|
|
3
|
-
export { ErrorCode, ProtocolBlob, TransportType, } from '@nmtjs/protocol';
|
|
4
|
-
export * from "./types.js";
|
|
5
|
-
export class ClientError extends ProtocolError {
|
|
6
|
-
}
|
|
7
|
-
const DEFAULT_RECONNECT_TIMEOUT = 1000;
|
|
8
|
-
export class BaseClient {
|
|
9
|
-
transport;
|
|
10
|
-
options;
|
|
11
|
-
_;
|
|
12
|
-
callers;
|
|
13
|
-
auth;
|
|
14
|
-
reconnectTimeout = DEFAULT_RECONNECT_TIMEOUT;
|
|
15
|
-
constructor(transport, options) {
|
|
16
|
-
this.transport = transport;
|
|
17
|
-
this.options = options;
|
|
18
|
-
if (this.options.autoreconnect) {
|
|
19
|
-
this.transport.on('disconnected', async (reason) => {
|
|
20
|
-
if (reason === 'server') {
|
|
21
|
-
this.connect();
|
|
22
|
-
}
|
|
23
|
-
else if (reason === 'error') {
|
|
24
|
-
const timeout = new Promise((resolve) => setTimeout(resolve, this.reconnectTimeout));
|
|
25
|
-
const connected = new Promise((_, reject) => this.transport.once('connected', reject));
|
|
26
|
-
this.reconnectTimeout += DEFAULT_RECONNECT_TIMEOUT;
|
|
27
|
-
await Promise.race([timeout, connected]).then(this.connect.bind(this), noopFn);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
this.transport.on('connected', () => {
|
|
31
|
-
this.reconnectTimeout = DEFAULT_RECONNECT_TIMEOUT;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async _call(procedure, payload, options) {
|
|
36
|
-
const call = await this.transport.call(procedure, payload, options, this.transformer);
|
|
37
|
-
if (this.options.safe) {
|
|
38
|
-
return await call.promise
|
|
39
|
-
.then((result) => ({ result }))
|
|
40
|
-
.catch((error) => ({ error }));
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return await call.promise.catch((error) => {
|
|
44
|
-
throw error;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
get call() {
|
|
49
|
-
return this.callers;
|
|
50
|
-
}
|
|
51
|
-
setAuth(auth) {
|
|
52
|
-
this.auth = auth;
|
|
53
|
-
}
|
|
54
|
-
connect() {
|
|
55
|
-
return this.transport.connect(this.auth, this.transformer);
|
|
56
|
-
}
|
|
57
|
-
disconnect() {
|
|
58
|
-
return this.transport.disconnect();
|
|
59
|
-
}
|
|
60
|
-
}
|
package/dist/runtime.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { TAnyAPIContract, TAnyProcedureContract, TAnyRouterContract } from '@nmtjs/contract';
|
|
2
|
-
import { ProtocolBaseTransformer } from '@nmtjs/protocol/client';
|
|
3
|
-
import type { RuntimeInputContractTypeProvider, RuntimeOutputContractTypeProvider } from './common.ts';
|
|
4
|
-
import { BaseClient } from './common.ts';
|
|
5
|
-
export declare class RuntimeContractTransformer extends ProtocolBaseTransformer {
|
|
6
|
-
protected procedures: Map<string, TAnyProcedureContract>;
|
|
7
|
-
constructor(procedures: Map<string, TAnyProcedureContract>);
|
|
8
|
-
decodeRPC(procedure: string, payload: any): any;
|
|
9
|
-
decodeRPCChunk(procedure: string, payload: any): unknown;
|
|
10
|
-
encodeRPC(procedure: string, payload: any): unknown;
|
|
11
|
-
protected getProcedureContract(procedure: string): TAnyProcedureContract;
|
|
12
|
-
protected build(router: TAnyRouterContract): void;
|
|
13
|
-
}
|
|
14
|
-
export declare class RuntimeClient<APIContract extends TAnyAPIContract, SafeCall extends boolean = false> extends BaseClient<APIContract, SafeCall, RuntimeInputContractTypeProvider, RuntimeOutputContractTypeProvider> {
|
|
15
|
-
contract: APIContract;
|
|
16
|
-
protected transformer: RuntimeContractTransformer;
|
|
17
|
-
protected procedures: Map<string, TAnyProcedureContract>;
|
|
18
|
-
constructor(contract: APIContract, ...args: ConstructorParameters<typeof BaseClient<APIContract, SafeCall>>);
|
|
19
|
-
protected resolveProcedures(router: TAnyRouterContract): void;
|
|
20
|
-
protected buildCallers(): any;
|
|
21
|
-
}
|
package/dist/runtime.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { IsProcedureContract, IsRouterContract } from '@nmtjs/contract';
|
|
2
|
-
import { ErrorCode } from '@nmtjs/protocol';
|
|
3
|
-
import { ProtocolBaseTransformer } from '@nmtjs/protocol/client';
|
|
4
|
-
import { NeemataTypeError, t } from '@nmtjs/type';
|
|
5
|
-
import { BaseClient, ClientError } from "./common.js";
|
|
6
|
-
export class RuntimeContractTransformer extends ProtocolBaseTransformer {
|
|
7
|
-
procedures;
|
|
8
|
-
constructor(procedures) {
|
|
9
|
-
super();
|
|
10
|
-
this.procedures = procedures;
|
|
11
|
-
}
|
|
12
|
-
decodeRPC(procedure, payload) {
|
|
13
|
-
const contract = this.getProcedureContract(procedure);
|
|
14
|
-
const type = contract.output;
|
|
15
|
-
if (type instanceof t.NeverType)
|
|
16
|
-
return undefined;
|
|
17
|
-
return payload;
|
|
18
|
-
}
|
|
19
|
-
decodeRPCChunk(procedure, payload) {
|
|
20
|
-
const contract = this.getProcedureContract(procedure);
|
|
21
|
-
const type = contract.stream;
|
|
22
|
-
if (!type || type instanceof t.NeverType)
|
|
23
|
-
return undefined;
|
|
24
|
-
return type.decode(payload);
|
|
25
|
-
}
|
|
26
|
-
encodeRPC(procedure, payload) {
|
|
27
|
-
const contract = this.getProcedureContract(procedure);
|
|
28
|
-
const type = contract.input;
|
|
29
|
-
if (type instanceof t.NeverType)
|
|
30
|
-
return undefined;
|
|
31
|
-
try {
|
|
32
|
-
return type.encode(payload);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
if (error instanceof NeemataTypeError) {
|
|
36
|
-
throw new ClientError(ErrorCode.ValidationError, `Invalid payload for ${procedure}: ${error.message}`, error.issues);
|
|
37
|
-
}
|
|
38
|
-
throw error;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
getProcedureContract(procedure) {
|
|
42
|
-
const proc = this.procedures.get(procedure);
|
|
43
|
-
if (!proc) {
|
|
44
|
-
throw new ClientError(ErrorCode.NotFound, `Procedure contract not found for procedure: ${procedure}`);
|
|
45
|
-
}
|
|
46
|
-
return proc;
|
|
47
|
-
}
|
|
48
|
-
build(router) {
|
|
49
|
-
const routes = Object.values(router.routes);
|
|
50
|
-
for (const route of routes) {
|
|
51
|
-
if (IsRouterContract(route)) {
|
|
52
|
-
this.build(route);
|
|
53
|
-
}
|
|
54
|
-
else if (IsProcedureContract(route)) {
|
|
55
|
-
this.procedures.set(route.name, route);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export class RuntimeClient extends BaseClient {
|
|
61
|
-
contract;
|
|
62
|
-
transformer;
|
|
63
|
-
procedures = new Map();
|
|
64
|
-
constructor(contract, ...args) {
|
|
65
|
-
super(...args);
|
|
66
|
-
this.contract = contract;
|
|
67
|
-
this.resolveProcedures(this.contract.router);
|
|
68
|
-
this.transformer = new RuntimeContractTransformer(this.procedures);
|
|
69
|
-
this.callers = this.buildCallers();
|
|
70
|
-
}
|
|
71
|
-
resolveProcedures(router) {
|
|
72
|
-
const routes = Object.values(router.routes);
|
|
73
|
-
for (const route of routes) {
|
|
74
|
-
if (IsRouterContract(route)) {
|
|
75
|
-
this.resolveProcedures(route);
|
|
76
|
-
}
|
|
77
|
-
else if (IsProcedureContract(route)) {
|
|
78
|
-
this.procedures.set(route.name, route);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
buildCallers() {
|
|
83
|
-
const callers = Object.create(null);
|
|
84
|
-
for (const [name, procedure] of this.procedures) {
|
|
85
|
-
const parts = name.split('/');
|
|
86
|
-
let current = callers;
|
|
87
|
-
for (let i = 0; i < parts.length; i++) {
|
|
88
|
-
const part = parts[i];
|
|
89
|
-
if (i === parts.length - 1) {
|
|
90
|
-
current[part] = (payload, options = {}) => this._call(name, payload, {
|
|
91
|
-
timeout: procedure.timeout || options.timeout || this.options.timeout,
|
|
92
|
-
...options,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
if (!current[part]) {
|
|
97
|
-
current[part] = {};
|
|
98
|
-
}
|
|
99
|
-
current = current[part];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return callers;
|
|
104
|
-
}
|
|
105
|
-
}
|
package/dist/static.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TAnyAPIContract } from '@nmtjs/contract';
|
|
2
|
-
import { ProtocolBaseTransformer } from '@nmtjs/protocol/client';
|
|
3
|
-
import type { StaticInputContractTypeProvider, StaticOutputContractTypeProvider } from './common.ts';
|
|
4
|
-
import { BaseClient } from './common.ts';
|
|
5
|
-
export declare class StaticClient<APIContract extends TAnyAPIContract, SafeCall extends boolean = false> extends BaseClient<APIContract, SafeCall, StaticInputContractTypeProvider, StaticOutputContractTypeProvider> {
|
|
6
|
-
protected transformer: ProtocolBaseTransformer;
|
|
7
|
-
constructor(...args: ConstructorParameters<typeof BaseClient<APIContract, SafeCall>>);
|
|
8
|
-
protected createProxy(target: any, path?: string[]): any;
|
|
9
|
-
}
|
package/dist/static.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ProtocolBaseTransformer } from '@nmtjs/protocol/client';
|
|
2
|
-
import { BaseClient } from "./common.js";
|
|
3
|
-
export class StaticClient extends BaseClient {
|
|
4
|
-
transformer;
|
|
5
|
-
constructor(...args) {
|
|
6
|
-
super(...args);
|
|
7
|
-
this.transformer = new ProtocolBaseTransformer();
|
|
8
|
-
this.callers = this.createProxy(Object.create(null));
|
|
9
|
-
}
|
|
10
|
-
createProxy(target, path = []) {
|
|
11
|
-
return new Proxy(target, {
|
|
12
|
-
get: (obj, prop) => {
|
|
13
|
-
// `await client.call.something` or `await client.call.something.nested`
|
|
14
|
-
// without explicitly calling a function implicitly calls .then() on a target
|
|
15
|
-
// FIXME: this basically makes "then" a reserved word for static Client
|
|
16
|
-
if (prop === 'then')
|
|
17
|
-
return obj;
|
|
18
|
-
const newPath = [...path, String(prop)];
|
|
19
|
-
const caller = (payload, options) => this._call(newPath.join('/'), payload, {
|
|
20
|
-
...options,
|
|
21
|
-
timeout: options?.timeout ?? this.options.timeout,
|
|
22
|
-
});
|
|
23
|
-
return this.createProxy(caller, newPath);
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { CallTypeProvider, OneOf, TypeProvider } from '@nmtjs/common';
|
|
2
|
-
import type { TAnyAPIContract, TAnyProcedureContract, TAnyRouterContract } from '@nmtjs/contract';
|
|
3
|
-
import type { ProtocolBaseClientCallOptions, ProtocolError, ProtocolServerStreamInterface } from '@nmtjs/protocol/client';
|
|
4
|
-
import type { BaseTypeAny, t } from '@nmtjs/type';
|
|
5
|
-
export interface StaticInputContractTypeProvider extends TypeProvider {
|
|
6
|
-
output: this['input'] extends BaseTypeAny ? t.infer.decode.input<this['input']> : never;
|
|
7
|
-
}
|
|
8
|
-
export interface RuntimeInputContractTypeProvider extends TypeProvider {
|
|
9
|
-
output: this['input'] extends BaseTypeAny ? t.infer.encode.input<this['input']> : never;
|
|
10
|
-
}
|
|
11
|
-
export interface StaticOutputContractTypeProvider extends TypeProvider {
|
|
12
|
-
output: this['input'] extends BaseTypeAny ? t.infer.encode.output<this['input']> : never;
|
|
13
|
-
}
|
|
14
|
-
export interface RuntimeOutputContractTypeProvider extends TypeProvider {
|
|
15
|
-
output: this['input'] extends BaseTypeAny ? t.infer.decode.output<this['input']> : never;
|
|
16
|
-
}
|
|
17
|
-
export type AnyResolvedAPIContractProcedure = {
|
|
18
|
-
contract: TAnyProcedureContract;
|
|
19
|
-
input: any;
|
|
20
|
-
output: any;
|
|
21
|
-
};
|
|
22
|
-
export type AnyResolvedAPIContractRouter = {
|
|
23
|
-
contract: TAnyRouterContract;
|
|
24
|
-
routes: Record<string, AnyResolvedAPIContractRouter | AnyResolvedAPIContractProcedure>;
|
|
25
|
-
};
|
|
26
|
-
export type AnyResolvedAPIContract = Record<string, Record<string, AnyResolvedAPIContractProcedure | AnyResolvedAPIContractRouter>>;
|
|
27
|
-
export type ResolveAPIRouterRoutes<T extends TAnyRouterContract, InputTypeProvider extends TypeProvider = TypeProvider, OutputTypeProvider extends TypeProvider = TypeProvider> = {
|
|
28
|
-
[K in keyof T['routes']]: T['routes'][K] extends TAnyRouterContract ? {
|
|
29
|
-
contract: T['routes'][K];
|
|
30
|
-
routes: ResolveAPIRouterRoutes<T['routes'][K], InputTypeProvider, OutputTypeProvider>;
|
|
31
|
-
} : T['routes'][K] extends TAnyProcedureContract ? {
|
|
32
|
-
contract: T['routes'][K];
|
|
33
|
-
input: CallTypeProvider<InputTypeProvider, T['routes'][K]['input']>;
|
|
34
|
-
output: T['routes'][K]['stream'] extends undefined | t.NeverType ? CallTypeProvider<OutputTypeProvider, T['routes'][K]['output']> : {
|
|
35
|
-
result: CallTypeProvider<OutputTypeProvider, T['routes'][K]['output']>;
|
|
36
|
-
stream: ProtocolServerStreamInterface<CallTypeProvider<OutputTypeProvider, T['routes'][K]['stream']>>;
|
|
37
|
-
};
|
|
38
|
-
} : never;
|
|
39
|
-
};
|
|
40
|
-
export type ResolveAPIContract<C extends TAnyAPIContract = TAnyAPIContract, InputTypeProvider extends TypeProvider = TypeProvider, OutputTypeProvider extends TypeProvider = TypeProvider> = ResolveAPIRouterRoutes<C['router'], InputTypeProvider, OutputTypeProvider>;
|
|
41
|
-
export type ClientCaller<Procedure extends AnyResolvedAPIContractProcedure, SafeCall extends boolean> = (...args: Procedure['input'] extends t.NeverType ? [data?: undefined, options?: Partial<ProtocolBaseClientCallOptions>] : undefined extends t.infer.encode.input<Procedure['contract']['input']> ? [
|
|
42
|
-
data?: Procedure['input'],
|
|
43
|
-
options?: Partial<ProtocolBaseClientCallOptions>
|
|
44
|
-
] : [
|
|
45
|
-
data: Procedure['input'],
|
|
46
|
-
options?: Partial<ProtocolBaseClientCallOptions>
|
|
47
|
-
]) => SafeCall extends true ? Promise<OneOf<[{
|
|
48
|
-
output: Procedure['output'];
|
|
49
|
-
}, {
|
|
50
|
-
error: ProtocolError;
|
|
51
|
-
}]>> : Promise<Procedure['output']>;
|
|
52
|
-
export type ClientCallers<Resolved extends AnyResolvedAPIContractRouter, SafeCall extends boolean> = {
|
|
53
|
-
[K in keyof Resolved['routes']]: Resolved['routes'][K] extends AnyResolvedAPIContractProcedure ? ClientCaller<Resolved['routes'][K], SafeCall> : Resolved['routes'][K] extends AnyResolvedAPIContractRouter ? ClientCallers<Resolved['routes'][K], SafeCall> : never;
|
|
54
|
-
};
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|