Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import { Schema } from 'effect'; |
| 2 | |
| 3 | export const Session = Schema.Struct({ |
| 4 | id: Schema.String, |
| 5 | code: Schema.String, |
| 6 | expiresAt: Schema.DateTimeUtcFromString, |
| 7 | status: Schema.Literals(['pending', 'linked']), |
| 8 | }).annotate({ identifier: 'Session' }); |
| 9 | export type Session = Schema.Schema.Type<typeof Session>; |
| 10 | |
| 11 | const SessionAccount = Schema.Struct({ |
| 12 | id: Schema.String, |
| 13 | email: Schema.String, |
| 14 | name: Schema.String, |
| 15 | }).annotate({ identifier: 'SessionAccount' }); |
| 16 | export type SessionAccount = Schema.Schema.Type<typeof SessionAccount>; |
| 17 | |
| 18 | export const RetrievedSession = Schema.Union([ |
| 19 | Schema.Struct({ ...Session.fields, api_key: Schema.Null, status: Schema.Literal('pending') }), |
| 20 | Schema.Struct({ |
| 21 | ...Session.fields, |
| 22 | api_key: Schema.String, |
| 23 | account: SessionAccount.annotate({ identifier: 'RetrievedSession.Account' }), |
| 24 | status: Schema.Literal('linked'), |
| 25 | }), |
| 26 | ]).annotate({ identifier: 'RetrievedSession' }); |
| 27 | export type RetrievedSession = Schema.Schema.Type<typeof RetrievedSession>; |