@devries-cameron20 / composio Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 04:45 UTC

next
ts 89 lines 2.48 KB
Raw
1 import type { SessionRetrieveInfoResponse } from '@composio/client/resources/auth';
2 import type { OrgProject } from 'src/services/composio-account';
3
4 export const TIMESTAMP = '2026-01-01T00:00:00.000Z';
5
6 /**
7 * A complete `GET /api/v3.1/auth/session/info` response. Suites override only
8 * the fields their scenario is about.
9 */
10 export const makeSessionInfo = (
11 params: {
12 readonly orgId?: string;
13 readonly orgName?: string;
14 readonly projectId?: string;
15 readonly projectNanoId?: string;
16 readonly projectName?: string;
17 readonly orgMemberId?: string;
18 readonly email?: string;
19 readonly name?: string;
20 readonly apiKey?: string;
21 } = {}
22 ): SessionRetrieveInfoResponse => {
23 const orgId = params.orgId ?? 'org_default';
24 const projectId = params.projectId ?? 'project_id_default';
25 return {
26 project: {
27 auto_id: 1,
28 id: projectId,
29 org_id: orgId,
30 name: params.projectName ?? 'Default Project',
31 email: 'project@example.com',
32 nano_id: params.projectNanoId ?? 'project_default',
33 created_at: TIMESTAMP,
34 updated_at: TIMESTAMP,
35 webhook_url: null,
36 event_webhook_url: null,
37 webhook_secret: null,
38 triggers_enabled: true,
39 last_subscribed_at: null,
40 deleted: false,
41 is_new_webhook: false,
42 webhook_version: 'V3',
43 org: { id: orgId, name: params.orgName ?? 'Example Org', plan: 'enterprise' },
44 },
45 api_key:
46 params.apiKey === undefined
47 ? null
48 : {
49 auto_id: 1,
50 id: 'api_key_id',
51 name: 'CLI key',
52 project_id: projectId,
53 org_member_id: params.orgMemberId ?? 'member_default',
54 created_at: TIMESTAMP,
55 updated_at: TIMESTAMP,
56 deleted_at: null,
57 key: params.apiKey,
58 deleted: false,
59 },
60 org_member: {
61 id: params.orgMemberId ?? 'member_default',
62 email: params.email ?? 'cli@example.com',
63 name: params.name ?? 'CLI User',
64 role: 'admin',
65 metadata: {},
66 },
67 };
68 };
69
70 /**
71 * One entry of `GET /api/v3.1/org/project/list`.
72 */
73 export const makeOrgProject = (params: {
74 readonly id: string;
75 readonly name: string;
76 readonly orgId?: string;
77 }): OrgProject => ({
78 id: params.id,
79 org_id: params.orgId ?? 'org_default',
80 name: params.name,
81 email: 'project@example.com',
82 created_at: TIMESTAMP,
83 updated_at: TIMESTAMP,
84 webhook_url: null,
85 event_webhook_url: null,
86 webhook_secret: null,
87 webhook_version: 'V3',
88 deleted: false,
89 });