diff --git a/.gitignore b/.gitignore index 1a62bcc55..e6b27083e 100644 --- a/.gitignore +++ b/.gitignore @@ -122,6 +122,7 @@ $RECYCLE.BIN/ /dist /node_modules /out/ +engine/language_client_typescript/*.d.ts engine/language_client_typescript/*.d.ts.map engine/language_client_typescript/*.js engine/language_client_ruby/**/*.bundle diff --git a/engine/language_client_typescript/async_context_vars.d.ts b/engine/language_client_typescript/async_context_vars.d.ts deleted file mode 100644 index 5092ab813..000000000 --- a/engine/language_client_typescript/async_context_vars.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { BamlSpan, RuntimeContextManager, BamlRuntime, BamlLogEvent } from './native'; -export declare class BamlCtxManager { - private rt; - private ctx; - constructor(rt: BamlRuntime); - upsertTags(tags: Record): void; - cloneContext(): RuntimeContextManager; - startTrace(name: string, args: Record): [RuntimeContextManager, BamlSpan]; - endTrace(span: BamlSpan, response: any): void; - flush(): void; - onLogEvent(callback: (event: BamlLogEvent) => void): void; - traceFnSync ReturnType>(name: string, func: F): F; - traceFnAsync Promise>(name: string, func: F): F; -} -//# sourceMappingURL=async_context_vars.d.ts.map \ No newline at end of file diff --git a/engine/language_client_typescript/index.d.ts b/engine/language_client_typescript/index.d.ts deleted file mode 100644 index d7fb1b238..000000000 --- a/engine/language_client_typescript/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { BamlRuntime, FunctionResult, FunctionResultStream, BamlImage as Image, BamlAudio as Audio, invoke_runtime_cli, } from './native'; -export { BamlStream } from './stream'; -export { BamlCtxManager } from './async_context_vars'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/engine/language_client_typescript/native.d.ts b/engine/language_client_typescript/native.d.ts deleted file mode 100644 index 13b24cc62..000000000 --- a/engine/language_client_typescript/native.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* auto-generated by NAPI-RS */ -/* eslint-disable */ -export class BamlAudio { - static fromUrl(url: string): BamlAudio - static fromBase64(mediaType: string, base64: string): BamlAudio - isUrl(): boolean - asUrl(): string - asBase64(): [string, string] - toJSON(): any -} - -export class BamlImage { - static fromUrl(url: string): BamlImage - static fromBase64(mediaType: string, base64: string): BamlImage - isUrl(): boolean - asUrl(): string - asBase64(): [string, string] - toJSON(): any -} - -export class BamlRuntime { - static fromDirectory(directory: string, envVars: Record): BamlRuntime - static fromFiles(rootPath: string, files: Record, envVars: Record): BamlRuntime - createContextManager(): RuntimeContextManager - callFunction(functionName: string, args: { [string]: any }, ctx: RuntimeContextManager, tb?: TypeBuilder | undefined | null): Promise - streamFunction(functionName: string, args: { [string]: any }, cb: (err: any, param: FunctionResult) => void, ctx: RuntimeContextManager, tb?: TypeBuilder | undefined | null): FunctionResultStream - setLogEventCallback(func: (err: any, param: BamlLogEvent) => void): void - flush(): TraceStats -} - -export class BamlSpan { - static new(runtime: BamlRuntime, functionName: string, args: any, ctx: RuntimeContextManager): BamlSpan - finish(result: any, ctx: RuntimeContextManager): any -} - -export class ClassBuilder { - field(): FieldType - property(name: string): ClassPropertyBuilder -} - -export class ClassPropertyBuilder { - setType(fieldType: FieldType): ClassPropertyBuilder - alias(alias?: string | undefined | null): ClassPropertyBuilder - description(description?: string | undefined | null): ClassPropertyBuilder -} - -export class EnumBuilder { - value(name: string): EnumValueBuilder - alias(alias?: string | undefined | null): EnumBuilder - field(): FieldType -} - -export class EnumValueBuilder { - alias(alias?: string | undefined | null): EnumValueBuilder - skip(skip?: boolean | undefined | null): EnumValueBuilder - description(description?: string | undefined | null): EnumValueBuilder -} - -export class FieldType { - list(): FieldType - optional(): FieldType -} - -export class FunctionResult { - parsed(): any -} - -export class FunctionResultStream { - onEvent(func: (err: any, param: FunctionResult) => void): void - done(rctx: RuntimeContextManager): Promise -} - -export class RuntimeContextManager { - upsertTags(tags: any): void - deepClone(): RuntimeContextManager -} - -export class TraceStats { - nSpansFailedBeforeSubmit(): number -} - -export class TypeBuilder { - constructor() - getEnum(name: string): EnumBuilder - getClass(name: string): ClassBuilder - list(inner: FieldType): FieldType - optional(inner: FieldType): FieldType - string(): FieldType - int(): FieldType - float(): FieldType - bool(): FieldType - null(): FieldType -} - -export interface BamlLogEvent { - metadata: LogEventMetadata - prompt?: string - rawOutput?: string - parsedOutput?: string - startTime: string -} - -export function invoke_runtime_cli(params: Array): void - -export interface LogEventMetadata { - eventId: string - parentId?: string - rootEventId: string -} - diff --git a/engine/language_client_typescript/stream.d.ts b/engine/language_client_typescript/stream.d.ts deleted file mode 100644 index dd7f000cd..000000000 --- a/engine/language_client_typescript/stream.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { FunctionResult, FunctionResultStream, RuntimeContextManager } from './native'; -export declare class BamlStream { - private ffiStream; - private partialCoerce; - private finalCoerce; - private ctxManager; - private task; - private eventQueue; - constructor(ffiStream: FunctionResultStream, partialCoerce: (result: FunctionResult) => PartialOutputType, finalCoerce: (result: FunctionResult) => FinalOutputType, ctxManager: RuntimeContextManager); - private driveToCompletion; - private driveToCompletionInBg; - [Symbol.asyncIterator](): AsyncIterableIterator; - getFinalResponse(): Promise; -} -//# sourceMappingURL=stream.d.ts.map \ No newline at end of file diff --git a/engine/language_client_typescript/type_builder.d.ts b/engine/language_client_typescript/type_builder.d.ts deleted file mode 100644 index 9a9c70b81..000000000 --- a/engine/language_client_typescript/type_builder.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { ClassPropertyBuilder as _ClassPropertyBuilder, EnumValueBuilder, FieldType, TypeBuilder as _TypeBuilder } from './native'; -type IsLiteral = string extends T ? false : true; -type NameOf = IsLiteral extends true ? T : 'DynamicType'; -type CheckNever = [T] extends [never] ? `Error: Attempt to add value '${Value}' which is already a part of '${NameOf}'.` : T; -type ExcludeFrom = T extends U ? never : T; -type RestrictNot = IsLiteral extends true ? CheckNever, Name, Value> : Value; -export declare class TypeBuilder { - private tb; - protected classes: Set; - protected enums: Set; - constructor({ classes, enums }: { - classes: Set; - enums: Set; - }); - _tb(): _TypeBuilder; - string(): FieldType; - int(): FieldType; - float(): FieldType; - bool(): FieldType; - list(type: FieldType): FieldType; - classBuilder(name: Name, properties: Properties[]): ClassBuilder; - enumBuilder(name: Name, values: T[]): EnumBuilder; - addClass(name: Name): ClassBuilder; - addEnum(name: Name): EnumBuilder; -} -export declare class ClassBuilder { - private properties; - private bldr; - constructor(tb: _TypeBuilder, name: ClassName, properties?: Set); - type(): FieldType; - listProperties(): Array<[string, ClassPropertyBuilder]>; - addProperty(name: RestrictNot, type: FieldType): ClassPropertyBuilder; - property(name: string): ClassPropertyBuilder; -} -declare class ClassPropertyBuilder { - private bldr; - constructor(bldr: _ClassPropertyBuilder); - alias(alias: string | null): ClassPropertyBuilder; - description(description: string | null): ClassPropertyBuilder; -} -export declare class EnumBuilder { - private values; - private bldr; - constructor(tb: _TypeBuilder, name: EnumName, values?: Set); - type(): FieldType; - value(name: S | T): EnumValueBuilder; - listValues(): Array<[string, EnumValueBuilder]>; - addValue(name: RestrictNot): EnumValueBuilder; -} -export {}; -//# sourceMappingURL=type_builder.d.ts.map \ No newline at end of file