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
| 1 | import { Schema } from 'effect'; |
| 2 | import { OptionFromOptionalNullOr } from 'effect/Schema'; |
| 3 | import { JSONTransformSchema } from './utils/json-transform-schema'; |
| 4 | |
| 5 | /** |
| 6 | * Organization and developer-project identifiers for a CLI project profile. |
| 7 | * Stored in `~/.composio/_keys/<projectId>.json` (global registry) |
| 8 | * and `<cwd>/.composio/project.json` (per-directory developer config). |
| 9 | */ |
| 10 | export const ProjectKeys = Schema.Struct({ |
| 11 | /** |
| 12 | * Organization member ID (maps to `x-org-id` header). |
| 13 | */ |
| 14 | orgId: Schema.String, |
| 15 | |
| 16 | /** |
| 17 | * Project ID (maps to `x-project-id` header). |
| 18 | */ |
| 19 | projectId: Schema.String, |
| 20 | |
| 21 | /** |
| 22 | * Human-readable project name from session/info (optional for backward compat). |
| 23 | */ |
| 24 | projectName: OptionFromOptionalNullOr(Schema.String, { onNoneEncoding: null }), |
| 25 | |
| 26 | /** |
| 27 | * Human-readable org name from session/info (optional for backward compat). |
| 28 | */ |
| 29 | orgName: OptionFromOptionalNullOr(Schema.String, { onNoneEncoding: null }), |
| 30 | |
| 31 | /** |
| 32 | * User email from session/info (optional for backward compat). |
| 33 | */ |
| 34 | email: OptionFromOptionalNullOr(Schema.String, { onNoneEncoding: null }), |
| 35 | |
| 36 | /** |
| 37 | * Optional test user identifier used by CLI/e2e flows. |
| 38 | */ |
| 39 | testUserId: OptionFromOptionalNullOr(Schema.String, { onNoneEncoding: null }), |
| 40 | }).pipe( |
| 41 | Schema.encodeKeys({ |
| 42 | orgId: 'org_id', |
| 43 | projectId: 'project_id', |
| 44 | projectName: 'project_name', |
| 45 | orgName: 'org_name', |
| 46 | testUserId: 'test_user_id', |
| 47 | }), |
| 48 | Schema.annotate({ |
| 49 | identifier: 'ProjectKeys', |
| 50 | description: 'Organization and project identifiers for a CLI project profile', |
| 51 | }) |
| 52 | ); |
| 53 | |
| 54 | export type ProjectKeys = Schema.Schema.Type<typeof ProjectKeys>; |
| 55 | |
| 56 | export const ProjectKeysJSON = JSONTransformSchema(ProjectKeys); |
| 57 | export const projectKeysFromJSON = Schema.decodeEffect(ProjectKeysJSON, { |
| 58 | onExcessProperty: 'ignore', |
| 59 | }); |
| 60 | export const projectKeysToJSON = Schema.encodeEffect(ProjectKeysJSON); |