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, 06:00 UTC
| 1 | import { parseLiteralValues } from './parse-literal-values'; |
| 2 | import { parseSchema } from './parse-schema'; |
| 3 | import type { ParseContext } from '../context'; |
| 4 | import type { JsonSchemaObject, Serializable } from '../types'; |
| 5 | |
| 6 | export const parseConst = <S>( |
| 7 | jsonSchema: JsonSchemaObject & { const: Serializable }, |
| 8 | ctx: ParseContext<S> |
| 9 | ): S => { |
| 10 | const { const: value, ...baseSchema } = jsonSchema; |
| 11 | return ctx.backend.intersection( |
| 12 | parseSchema(baseSchema, { ...ctx, seen: new Map(ctx.seen) }, true), |
| 13 | parseLiteralValues([value], ctx.backend) |
| 14 | ); |
| 15 | }; |