@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 42 lines 1.01 KB
Raw
1 import type { BasicBuilder } from './BasicBuilder';
2 import { DocComment } from './DocComment';
3 import { TypeBuilder } from './TypeBuilder';
4 import { ValueBuilder } from './ValueBuilder';
5 import { Writer } from './Writer';
6
7 export class ConstDeclaration implements BasicBuilder {
8 private docComment?: DocComment;
9 private value?: ValueBuilder;
10
11 constructor(
12 readonly name: string,
13 readonly type?: TypeBuilder
14 ) {}
15
16 setDocComment(docComment: DocComment): this {
17 this.docComment = docComment;
18 return this;
19 }
20
21 setValue(value: ValueBuilder): this {
22 this.value = value;
23 return this;
24 }
25
26 write(writer: Writer): void {
27 if (this.docComment) {
28 writer.write(this.docComment);
29 }
30 writer.write('const ').write(this.name);
31 if (this.type) {
32 writer.write(': ').write(this.type);
33 }
34 if (this.value) {
35 writer.write(' = ').write(this.value);
36 }
37 }
38 }
39
40 export function constDeclaration(name: string, type?: TypeBuilder) {
41 return new ConstDeclaration(name, type);
42 }