Skip to content

Commit 560d418

Browse files
committed
chore: expose interfaces
1 parent fe09edb commit 560d418

3 files changed

Lines changed: 9 additions & 61 deletions

File tree

‎packages/devframe/src/rpc/types.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ export interface RpcDumpStore<T = any> {
224224
_functions?: T
225225
}
226226

227-
interface RpcFunctionDefinitionWithoutSchemas<
227+
/** RPC function definition whose handler supplies its argument and return types. */
228+
export interface RpcFunctionDefinitionWithoutSchemas<
228229
NAME extends string,
229230
TYPE extends RpcFunctionType,
230231
ARGS extends any[],
@@ -239,7 +240,8 @@ interface RpcFunctionDefinitionWithoutSchemas<
239240
returns?: RS
240241
}
241242

242-
interface RpcFunctionDefinitionWithSchemas<
243+
/** RPC function definition whose argument and return types come from schemas. */
244+
export interface RpcFunctionDefinitionWithSchemas<
243245
NAME extends string,
244246
TYPE extends RpcFunctionType,
245247
AS extends RpcArgsSchema | undefined,

‎tests/__snapshots__/tsnapi/devframe/recipes/common-rpc-functions.snapshot.d.ts‎

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,66 +7,10 @@ export type KnownEditor = 'atom' | 'subl' | 'sublime' | 'sublime_text' | 'wstorm
77

88
// #region Variables
99
/** @deprecated */
10-
export declare const commonRpcFunctions: readonly [{
11-
name: "devframe:open-in-editor";
12-
type?: "action" | undefined;
13-
cacheable?: boolean;
14-
args: readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>];
15-
returns: SimpleSchema<void, void>;
16-
jsonSerializable?: boolean;
17-
agent?: RpcFunctionAgentOptions;
18-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>) | undefined;
19-
handler?: ((args_0: string, args_1: KnownEditor | undefined) => Thenable<void>) | undefined;
20-
dump?: RpcDump<[string, KnownEditor | undefined], Thenable<void>, undefined> | undefined;
21-
snapshot?: boolean;
22-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>> | undefined;
23-
__promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>> | undefined;
24-
}, {
25-
name: "devframe:open-in-finder";
26-
type?: "action" | undefined;
27-
cacheable?: boolean;
28-
args: readonly [SimpleSchema<string, string>];
29-
returns: SimpleSchema<void, void>;
30-
jsonSerializable?: boolean;
31-
agent?: RpcFunctionAgentOptions;
32-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>) | undefined;
33-
handler?: ((args_0: string) => Thenable<void>) | undefined;
34-
dump?: RpcDump<[string], Thenable<void>, undefined> | undefined;
35-
snapshot?: boolean;
36-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>> | undefined;
37-
__promise?: Thenable<RpcFunctionSetupResult<[string], Thenable<void>>> | undefined;
38-
}];
10+
export declare const commonRpcFunctions: readonly [RpcFunctionDefinitionWithSchemas<"devframe:open-in-editor", "action", readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>], SimpleSchema<void, void>, undefined>, RpcFunctionDefinitionWithSchemas<"devframe:open-in-finder", "action", readonly [SimpleSchema<string, string>], SimpleSchema<void, void>, undefined>];
3911
export declare const KNOWN_EDITORS: KnownEditor[];
4012
/** @deprecated */
41-
export declare const openInEditor: {
42-
name: "devframe:open-in-editor";
43-
type?: "action" | undefined;
44-
cacheable?: boolean;
45-
args: readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>];
46-
returns: SimpleSchema<void, void>;
47-
jsonSerializable?: boolean;
48-
agent?: RpcFunctionAgentOptions;
49-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>) | undefined;
50-
handler?: ((args_0: string, args_1: KnownEditor | undefined) => Thenable<void>) | undefined;
51-
dump?: RpcDump<[string, KnownEditor | undefined], Thenable<void>, undefined> | undefined;
52-
snapshot?: boolean;
53-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>> | undefined;
54-
__promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>> | undefined;
55-
};
13+
export declare const openInEditor: RpcFunctionDefinitionWithSchemas<"devframe:open-in-editor", "action", readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>], SimpleSchema<void, void>, undefined>;
5614
/** @deprecated */
57-
export declare const openInFinder: {
58-
name: "devframe:open-in-finder";
59-
type?: "action" | undefined;
60-
cacheable?: boolean;
61-
args: readonly [SimpleSchema<string, string>];
62-
returns: SimpleSchema<void, void>;
63-
jsonSerializable?: boolean;
64-
agent?: RpcFunctionAgentOptions;
65-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>) | undefined;
66-
handler?: ((args_0: string) => Thenable<void>) | undefined;
67-
dump?: RpcDump<[string], Thenable<void>, undefined> | undefined;
68-
snapshot?: boolean;
69-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>> | undefined;
70-
__promise?: Thenable<RpcFunctionSetupResult<[string], Thenable<void>>> | undefined;
71-
};
15+
export declare const openInFinder: RpcFunctionDefinitionWithSchemas<"devframe:open-in-finder", "action", readonly [SimpleSchema<string, string>], SimpleSchema<void, void>, undefined>;
7216
// #endregion

‎tests/__snapshots__/tsnapi/devframe/rpc.snapshot.d.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export { RpcFunctionDefinitionAny }
2929
export { RpcFunctionDefinitionAnyWithContext }
3030
export { RpcFunctionDefinitionBase }
3131
export { RpcFunctionDefinitionToFunction }
32+
export { RpcFunctionDefinitionWithoutSchemas }
33+
export { RpcFunctionDefinitionWithSchemas }
3234
export { RpcFunctionsCollector }
3335
export { RpcFunctionsCollectorBase }
3436
export { RpcFunctionSetupResult }

0 commit comments

Comments
 (0)