@caplets/core 0.15.0 → 0.17.0

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/auth.d.ts CHANGED
@@ -53,6 +53,15 @@ export declare class FileOAuthProvider implements OAuthClientProvider {
53
53
  codeVerifier(): string;
54
54
  addClientAuthentication: (headers: Headers, params: URLSearchParams) => Promise<void>;
55
55
  }
56
+ export type StartedOAuthFlow = {
57
+ authorizationUrl: string;
58
+ complete(callbackUrl: string): Promise<void>;
59
+ };
60
+ export declare function startOAuthFlow(server: CapletServerConfig, options: {
61
+ redirectUri: string;
62
+ authDir?: string;
63
+ print?: (line: string) => void;
64
+ }): Promise<StartedOAuthFlow>;
56
65
  export declare function runOAuthFlow(server: CapletServerConfig, options?: {
57
66
  noOpen?: boolean;
58
67
  authDir?: string;
@@ -61,6 +70,11 @@ export declare function runOAuthFlow(server: CapletServerConfig, options?: {
61
70
  open?: (url: string) => Promise<void>;
62
71
  print?: (line: string) => void;
63
72
  }): Promise<AuthResult>;
73
+ export declare function startGenericOAuthFlow(target: GenericAuthTarget, options: {
74
+ redirectUri: string;
75
+ authDir?: string;
76
+ print?: (line: string) => void;
77
+ }): Promise<StartedOAuthFlow>;
64
78
  export declare function runGenericOAuthFlow(target: GenericAuthTarget, options?: {
65
79
  noOpen?: boolean;
66
80
  authDir?: string;
@@ -1,4 +1,13 @@
1
+ import { type GenericAuthTarget } from "../auth";
2
+ import { loadConfig, type GraphQlEndpointConfig, type HttpApiConfig } from "../config";
3
+ type AuthTarget = ReturnType<typeof authTargets>[number];
1
4
  type AuthListFormat = "plain" | "markdown" | "json";
5
+ export type AuthStatusRow = {
6
+ server: string;
7
+ status: "missing" | "expired" | "authenticated";
8
+ expiresAt?: string;
9
+ scope?: string;
10
+ };
2
11
  export declare function loginAuth(serverId: string, options: {
3
12
  configPath?: string;
4
13
  noOpen: boolean;
@@ -11,10 +20,25 @@ export declare function logoutAuth(serverId: string, options: {
11
20
  configPath?: string;
12
21
  writeOut: (value: string) => void;
13
22
  }): void;
23
+ export declare function logoutAuthResult(serverId: string, options: {
24
+ authDir?: string;
25
+ configPath?: string;
26
+ }): {
27
+ server: string;
28
+ deleted: boolean;
29
+ };
14
30
  export declare function listAuth(options: {
15
31
  authDir?: string;
16
32
  configPath?: string;
17
33
  writeOut: (value: string) => void;
18
34
  format?: AuthListFormat;
19
35
  }): void;
36
+ export declare function listAuthRows(options: {
37
+ authDir?: string;
38
+ configPath?: string;
39
+ }): AuthStatusRow[];
40
+ export declare function formatAuthRows(rows: AuthStatusRow[], format: Exclude<AuthListFormat, "json">): string;
41
+ export declare function findAuthTarget(serverId: string, config?: import("../config").CapletsConfig): AuthTarget | undefined;
42
+ declare function authTargets(config: ReturnType<typeof loadConfig>): (import("../config").CapletServerConfig | import("../config").OpenApiEndpointConfig | (GraphQlEndpointConfig & GenericAuthTarget) | (HttpApiConfig & GenericAuthTarget))[];
43
+ export declare function assertLoginTarget(target: AuthTarget | undefined, serverId: string): asserts target is AuthTarget;
20
44
  export {};
package/dist/cli.d.ts CHANGED
@@ -1,13 +1,17 @@
1
1
  import { Command } from "commander";
2
+ import { type ServeOptions } from "./serve";
2
3
  export { initConfig, starterConfig } from "./cli/init";
3
4
  export { installCaplets, normalizeGitRepo } from "./cli/install";
4
5
  export { addCliCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApiCaplet, } from "./cli/add";
5
6
  type CliIO = {
6
7
  writeOut?: (value: string) => void;
7
8
  writeErr?: (value: string) => void;
9
+ env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
10
+ fetch?: typeof fetch;
8
11
  authDir?: string;
9
12
  version?: string;
10
13
  setExitCode?: (code: number) => void;
14
+ serve?: (options: ServeOptions) => Promise<void>;
11
15
  };
12
16
  export declare function runCli(args: string[], io?: CliIO): Promise<void>;
13
17
  export declare function createProgram(io?: CliIO): Command;
package/dist/index.d.ts CHANGED
@@ -3,3 +3,5 @@ export { runCli, createProgram } from "./cli";
3
3
  export { parseConfig, loadConfig } from "./config";
4
4
  export { capabilityDescription, ServerRegistry } from "./registry";
5
5
  export { generatedToolInputSchema, handleServerTool } from "./tools";
6
+ export { serveCaplets, serveHttp, serveResolvedCaplets, serveStdio } from "./serve";
7
+ export type { HttpServeOptions, RawServeOptions, ServeOptions, StdioServeOptions } from "./serve";