diff --git a/packages/types/package.json b/packages/types/package.json index 24b6d7a..ef45653 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@tailor-platform/function-types", - "version": "0.3.0", + "version": "0.4.0", "description": "TypeScript types for Tailor Platform Function service", "repository": { "type": "git", diff --git a/packages/types/tailor.d.ts b/packages/types/tailor.d.ts index 010e117..3c7ba8a 100644 --- a/packages/types/tailor.d.ts +++ b/packages/types/tailor.d.ts @@ -51,4 +51,53 @@ declare namespace tailor.secretmanager { vault: string, name: string ): Promise; -} \ No newline at end of file +} + +declare namespace tailor.iconv { + /** + * Convert string from one encoding to another + */ + function convert( + str: string | Uint8Array | ArrayBuffer, + fromEncoding: string, + toEncoding: T + ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array; + + /** + * Convert buffer from one encoding to another + */ + function convertBuffer( + buffer: Uint8Array | ArrayBuffer, + fromEncoding: string, + toEncoding: T + ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array; + + /** + * Decode buffer to string + */ + function decode( + buffer: Uint8Array | ArrayBuffer, + encoding: T + ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array; + + /** + * Encode string to buffer + */ + function encode( + str: string, + encoding: T + ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array; + + /** + * Get list of supported encodings + */ + function encodings(): string[]; + + /** + * Iconv class for compatibility with node-iconv + */ + class Iconv { + constructor(fromEncoding: string, toEncoding: string); + convert(input: string | Uint8Array | ArrayBuffer): string | Uint8Array; + } +}