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 type { BasicBuilder } from './BasicBuilder'; |
| 2 | import { TypeBuilder } from './TypeBuilder'; |
| 3 | import { Writer } from './Writer'; |
| 4 | |
| 5 | export abstract class ValueBuilder implements BasicBuilder { |
| 6 | as(type: TypeBuilder): TypeAssertion { |
| 7 | return new TypeAssertion(this, type); |
| 8 | } |
| 9 | |
| 10 | abstract write(writer: Writer<undefined>): void; |
| 11 | } |
| 12 | |
| 13 | // Must be in the same file due to a circular dependency |
| 14 | export class TypeAssertion extends ValueBuilder { |
| 15 | #value: ValueBuilder; |
| 16 | #type: TypeBuilder; |
| 17 | |
| 18 | constructor(value: ValueBuilder, type: TypeBuilder) { |
| 19 | super(); |
| 20 | this.#value = value; |
| 21 | this.#type = type; |
| 22 | } |
| 23 | |
| 24 | override write(writer: Writer): void { |
| 25 | writer.write(this.#value).write(' as ').write(this.#type); |
| 26 | } |
| 27 | } |