22 * Generated by tsnapi — public API snapshot of `devframe/client`
33 */
44// #region Interfaces
5- export interface DevframeConnection {
6- connectionMeta : ConnectionMeta ;
7- metaBaseUrl : string ;
8- authToken ?: string ;
9- }
10- export interface DevframeRpcClient {
11- events : EventEmitter < RpcClientEvents > ;
12- readonly isTrusted : boolean | null ;
13- readonly status : DevframeConnectionStatus ;
14- readonly connectionError : Error | null ;
15- readonly transport : 'websocket' | 'sse' | 'static' ;
16- readonly connection : DevframeConnection ;
17- readonly connectionMeta : ConnectionMeta ;
18- ensureTrusted : ( _ ?: number ) => Promise < boolean > ;
19- requestTrust : ( ) => Promise < boolean > ;
20- requestTrustWithToken : ( _ : string ) => Promise < boolean > ;
21- requestTrustWithCode : ( _ : string ) => Promise < boolean > ;
22- requestAuthCode : ( _ ?: {
23- reissue ?: boolean ;
24- } ) => Promise < void > ;
25- call : DevframeRpcClientCall ;
26- callEvent : DevframeRpcClientCallEvent ;
27- callOptional : DevframeRpcClientCallOptional ;
28- client : DevframeClientRpcHost ;
29- sharedState : RpcSharedStateHost ;
30- services : DevframeServicesClient ;
31- streaming : RpcStreamingClientHost ;
32- cacheManager : RpcCacheManager ;
33- scope : {
34- < NS extends string > ( _ : NS ) : DevframeScopedClientContext < NS , SettingsForNamespace < NS > > ;
35- ( _ ?: null | '' ) : DevframeRpcClient ;
36- } ;
37- close ?: ( ) => void ;
38- }
39- export interface DevframeRpcClientMode {
40- readonly transport ?: 'websocket' | 'sse' | 'static' ;
41- readonly isTrusted : boolean ;
42- readonly status : DevframeConnectionStatus ;
43- readonly connectionError : Error | null ;
44- ensureTrusted : DevframeRpcClient [ 'ensureTrusted' ] ;
45- requestTrust : DevframeRpcClient [ 'requestTrust' ] ;
46- requestTrustWithToken : DevframeRpcClient [ 'requestTrustWithToken' ] ;
47- requestTrustWithCode : ( _ : string ) => Promise < string | null > ;
48- requestAuthCode : DevframeRpcClient [ 'requestAuthCode' ] ;
49- call : DevframeRpcClient [ 'call' ] ;
50- callEvent : DevframeRpcClient [ 'callEvent' ] ;
51- callOptional : DevframeRpcClient [ 'callOptional' ] ;
52- close ?: ( ) => void ;
53- }
54- export interface DevframeRpcClientOptions extends SetupDevframeConnectionOptions {
55- authToken ?: string ;
56- otpParam ?: string | false ;
57- simpleAuth ?: boolean ;
58- transport ?: 'auto' | 'websocket' | 'sse' ;
59- wsOptions ?: Partial < WsRpcChannelOptions > ;
60- sseOptions ?: Partial < SseRpcChannelOptions > ;
61- rpcOptions ?: Partial < BirpcOptions < DevframeRpcServerFunctions , DevframeRpcClientFunctions , boolean > > ;
62- cacheOptions ?: boolean | Partial < RpcCacheOptions > ;
63- webmcp ?: boolean ;
64- callTimeout ?: number ;
65- }
66- export interface DevframeRpcContext {
67- readonly rpc : DevframeRpcClient ;
68- }
69- export interface DevframeScopedClientContext < NS extends string = string , Settings extends Record < string , any > = Record < string , any > > {
70- readonly namespace : NS ;
71- readonly base : DevframeRpcClient ;
72- rpc : DevframeScopedClientRpc < NS > ;
73- settings : DevframeSettings < Settings > ;
74- scope : DevframeRpcClient [ 'scope' ] ;
75- }
76- export interface DevframeScopedClientRpc < NS extends string = string > {
77- readonly namespace : NS ;
78- register : ( _ : RpcFunctionDefinition < string , any , any , any , any , any , DevframeRpcContext > ) => void ;
79- call : {
80- < T extends keyof ScopedServerFunctions < NS > & string > ( _ : T , ..._ : Parameters < ScopedRpcFn < DevframeRpcServerFunctions , NS , T > > ) : Promise < Awaited < ReturnType < ScopedRpcFn < DevframeRpcServerFunctions , NS , T > > > > ;
81- < T extends keyof DevframeRpcServerFunctions & string > ( _ : T , ..._ : Parameters < Extract < DevframeRpcServerFunctions [ T ] , AnyRpcFn > > ) : Promise < Awaited < ReturnType < Extract < DevframeRpcServerFunctions [ T ] , AnyRpcFn > > > > ;
82- ( _ : string , ..._ : any [ ] ) : Promise < any > ;
83- } ;
84- callEvent : {
85- < T extends keyof ScopedServerFunctions < NS > & string > ( _ : T , ..._ : Parameters < ScopedRpcFn < DevframeRpcServerFunctions , NS , T > > ) : void ;
86- < T extends keyof DevframeRpcServerFunctions & string > ( _ : T , ..._ : Parameters < Extract < DevframeRpcServerFunctions [ T ] , AnyRpcFn > > ) : void ;
87- ( _ : string , ..._ : any [ ] ) : void ;
88- } ;
89- callOptional : {
90- < T extends keyof ScopedServerFunctions < NS > & string > ( _ : T , ..._ : Parameters < ScopedRpcFn < DevframeRpcServerFunctions , NS , T > > ) : Promise < Awaited < ReturnType < ScopedRpcFn < DevframeRpcServerFunctions , NS , T > > > | undefined > ;
91- < T extends keyof DevframeRpcServerFunctions & string > ( _ : T , ..._ : Parameters < Extract < DevframeRpcServerFunctions [ T ] , AnyRpcFn > > ) : Promise < Awaited < ReturnType < Extract < DevframeRpcServerFunctions [ T ] , AnyRpcFn > > > | undefined > ;
92- ( _ : string , ..._ : any [ ] ) : Promise < any > ;
93- } ;
94- sharedState : {
95- < T extends keyof ScopedSharedStates < NS > & string > ( _ : T , _ ?: RpcSharedStateGetOptions < ScopedSharedStates < NS > [ T ] > ) : Promise < SharedState < ScopedSharedStates < NS > [ T ] > > ;
96- < T extends Record < string , any > = Record < string , any > > ( _ : string , _ ?: RpcSharedStateGetOptions < T > ) : Promise < SharedState < T > > ;
97- } ;
98- streaming : DevframeScopedClientStreamingHost ;
99- }
100- export interface DevframeScopedClientStreamingHost {
101- subscribe : < T = unknown > ( _ : string , _ : string , _ ?: StreamingSubscribeOptions ) => StreamReader < T > ;
102- upload : < T = unknown > ( _ : string , _ : string ) => StreamSink < T > ;
103- }
104- export interface DevframeServiceClientHandle < NS extends string = string > extends DevframeServiceMeta {
105- readonly scope : NS ;
106- readonly rpc : DevframeScopedClientRpc < NS > ;
107- }
108- export interface DevframeServicesClient {
109- has : ( _ : string ) => boolean ;
110- get : < PKG extends string > ( _ : PKG ) => DevframeServiceClientHandle < DevframeServiceScopeOf < PKG > > | undefined ;
111- keys : ( ) => string [ ] ;
112- state : ( ) => Promise < SharedState < DevframeServicesState > > ;
113- }
1145export interface RegisterWebMcpToolsOptions {
1156 modelContext ?: WebMcpModelContext ;
1167}
117- export interface RpcClientEvents {
118- 'rpc:is-trusted:updated' : ( _ : boolean ) => void ;
119- 'connection:status' : ( _ : DevframeConnectionStatus , _ : DevframeConnectionStatus ) => void ;
120- 'connection:error' : ( _ : Error ) => void ;
121- 'rpc:error' : ( _ : Error , _ : string ) => void ;
122- }
123- export interface RpcStreamingClientHost {
124- subscribe : < T = unknown > ( _ : string , _ : string , _ ?: StreamingSubscribeOptions ) => StreamReader < T > ;
125- upload : < T = unknown > ( _ : string , _ : string ) => StreamSink < T > ;
126- }
127- export interface SetupDevframeConnectionOptions {
128- connection ?: DevframeConnection ;
129- connectionMeta ?: ConnectionMeta ;
130- baseURL ?: string | string [ ] ;
131- authToken ?: string ;
132- }
133- export interface StreamingSubscribeOptions {
134- highWaterMark ?: number ;
135- }
1368export interface WebMcpModelContext {
1379 registerTool : ( _ : WebMcpToolDescriptor , _ ?: {
13810 signal ?: AbortSignal ;
@@ -178,50 +50,51 @@ export interface WsUrlLocation {
17850}
17951// #endregion
18052
181- // #region Types
182- export type DevframeClientRpcHost = RpcFunctionsCollector < DevframeRpcClientFunctions , DevframeRpcContext > ;
183- export type DevframeConnectionErrorKind = 'connection' | 'auth' | 'timeout' ;
184- export type DevframeConnectionStatus = 'connecting' | 'connected' | 'unauthorized' | 'disconnected' | 'error' ;
185- export type DevframeRpcClientCall = BirpcReturn < DevframeRpcServerFunctions , DevframeRpcClientFunctions > [ '$call' ] ;
186- export type DevframeRpcClientCallEvent = BirpcReturn < DevframeRpcServerFunctions , DevframeRpcClientFunctions > [ '$callEvent' ] ;
187- export type DevframeRpcClientCallOptional = BirpcReturn < DevframeRpcServerFunctions , DevframeRpcClientFunctions > [ '$callOptional' ] ;
188- // #endregion
189-
190- // #region Classes
191- export declare class DevframeConnectionError extends Error {
192- name : string ;
193- readonly kind : DevframeConnectionErrorKind ;
194- constructor ( _ : DevframeConnectionErrorKind , _ : string , _ ?: {
195- cause ?: unknown ;
196- } ) ;
197- }
198- // #endregion
199-
20053// #region Functions
20154export declare function authenticateWithUrlOtp ( _ : Pick < DevframeRpcClient , 'isTrusted' | 'requestTrustWithCode' > , _ ?: {
20255 param ?: string ;
20356} ) : Promise < boolean > ;
20457export declare function consumeOtpFromUrl ( _ ?: string ) : string | undefined ;
20558export declare function createClientSettings < T extends Record < string , any > = Record < string , any > > ( _ : DevframeRpcClient , _ : string ) : DevframeSettings < T > ;
206- export declare function createRpcStreamingClientHost ( _ : DevframeRpcClient ) : RpcStreamingClientHost ;
207- export declare function createScopedClientContext < NS extends string = string > ( _ : DevframeRpcClient , _ : NS ) : DevframeScopedClientContext < NS > ;
208- export declare function getDevframeConnection ( ) : DevframeConnection | undefined ;
209- export declare function getDevframeRpcClient ( _ ?: DevframeRpcClientOptions ) : Promise < DevframeRpcClient > ;
210- export declare function isCallableStatus ( _ : DevframeConnectionStatus ) : boolean ;
21159export declare function readOtpFromUrl ( _ ?: string ) : string | undefined ;
212- export declare function registerDevframeViewerOrigin ( _ : DevframeConnection , _ ?: any ) : Promise < boolean > ;
21360export declare function registerWebMcpTools < LocalFunctions , SetupContext > ( _ : RpcFunctionsCollector < LocalFunctions , SetupContext > , _ ?: RegisterWebMcpToolsOptions ) : ( ) => void ;
214- export declare function resolveClientTransport ( _ : 'auto' | 'websocket' | 'sse' , _ : ConnectionMeta ) : 'websocket' | 'sse' | 'static' ;
21561export declare function resolveSseUrl ( _ : ConnectionMeta [ 'sse' ] , _ : string , _ : WsUrlLocation ) : string ;
21662export declare function resolveWebMcpModelContext ( ) : WebMcpModelContext | undefined ;
21763export declare function resolveWsUrl ( _ : ConnectionMeta [ 'websocket' ] , _ : string , _ : WsUrlLocation ) : string ;
218- export declare function setupDevframeConnection ( _ ?: SetupDevframeConnectionOptions ) : Promise < DevframeConnection > ;
21964// #endregion
22065
22166// #region Variables
22267export declare const connectDevframe : typeof getDevframeRpcClient ;
22368// #endregion
22469
225- // #region Referenced (internal)
226- type AnyRpcFn = ( ..._ : any [ ] ) => any ;
70+ // #region Other
71+ export { createRpcStreamingClientHost }
72+ export { createScopedClientContext }
73+ export { DevframeClientRpcHost }
74+ export { DevframeConnection }
75+ export { DevframeConnectionError }
76+ export { DevframeConnectionErrorKind }
77+ export { DevframeConnectionStatus }
78+ export { DevframeRpcClient }
79+ export { DevframeRpcClientCall }
80+ export { DevframeRpcClientCallEvent }
81+ export { DevframeRpcClientCallOptional }
82+ export { DevframeRpcClientMode }
83+ export { DevframeRpcClientOptions }
84+ export { DevframeRpcContext }
85+ export { DevframeScopedClientContext }
86+ export { DevframeScopedClientRpc }
87+ export { DevframeScopedClientStreamingHost }
88+ export { DevframeServiceClientHandle }
89+ export { DevframeServicesClient }
90+ export { getDevframeConnection }
91+ export { getDevframeRpcClient }
92+ export { isCallableStatus }
93+ export { registerDevframeViewerOrigin }
94+ export { resolveClientTransport }
95+ export { RpcClientEvents }
96+ export { RpcStreamingClientHost }
97+ export { setupDevframeConnection }
98+ export { SetupDevframeConnectionOptions }
99+ export { StreamingSubscribeOptions }
227100// #endregion
0 commit comments