Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
ts 59 lines 2.43 KB
Raw
1 import { Effect, Schema } from 'effect';
2
3 /**
4 * An auth config item from the list or retrieve endpoints.
5 * Field names match the raw API response (snake_case).
6 *
7 * SECURITY: This schema intentionally excludes `credentials`, `shared_credentials`,
8 * `proxy_config`, and `deprecated_params` fields to prevent secret leakage in CLI output.
9 * Do NOT add credential-bearing fields without adding a redaction layer.
10 */
11 export const AuthConfigItem = Schema.Struct({
12 id: Schema.String,
13 name: Schema.String,
14 no_of_connections: Schema.Int,
15 status: Schema.Literals(['ENABLED', 'DISABLED']),
16 type: Schema.Literals(['default', 'custom']),
17 uuid: Schema.String,
18 toolkit: Schema.Struct({
19 logo: Schema.String,
20 slug: Schema.String,
21 }),
22 auth_scheme: Schema.String.pipe(Schema.withDecodingDefaultType(Effect.succeed(''))),
23 is_composio_managed: Schema.Boolean.pipe(Schema.withDecodingDefaultType(Effect.succeed(false))),
24 is_enabled_for_tool_router: Schema.Boolean.pipe(
25 Schema.withDecodingDefaultType(Effect.succeed(false))
26 ),
27 created_at: Schema.String.pipe(Schema.withDecodingDefaultType(Effect.succeed(''))),
28 }).annotate({ identifier: 'AuthConfigItem' });
29 export type AuthConfigItem = Schema.Schema.Type<typeof AuthConfigItem>;
30
31 export const AuthConfigItems = Schema.Array(AuthConfigItem);
32 export type AuthConfigItems = Schema.Schema.Type<typeof AuthConfigItems>;
33
34 // Auth config list response (single page with total_items for "Listing X of Y" display)
35 export const AuthConfigListResponse = Schema.Struct({
36 items: AuthConfigItems,
37 total_items: Schema.Int,
38 total_pages: Schema.Int,
39 current_page: Schema.Int,
40 next_cursor: Schema.NullOr(Schema.String).pipe(
41 Schema.withDecodingDefaultType(Effect.succeed(null))
42 ),
43 }).annotate({ identifier: 'AuthConfigListResponse' });
44 export type AuthConfigListResponse = Schema.Schema.Type<typeof AuthConfigListResponse>;
45
46 // `auth-configs create` prints this response to stdout, so it stays an
47 // allowlist rather than the client's full type: a field the API adds later
48 // must not reach a pipe without a decision here.
49 export const AuthConfigCreateResponse = Schema.Struct({
50 auth_config: Schema.Struct({
51 id: Schema.String,
52 auth_scheme: Schema.String,
53 is_composio_managed: Schema.Boolean,
54 }),
55 toolkit: Schema.Struct({
56 slug: Schema.String,
57 }),
58 }).annotate({ identifier: 'AuthConfigCreateResponse' });
59 export type AuthConfigCreateResponse = Schema.Schema.Type<typeof AuthConfigCreateResponse>;