Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
51 changes: 50 additions & 1 deletion packages/types/tailor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,53 @@ declare namespace tailor.secretmanager {
vault: string,
name: string
): Promise<string | undefined>;
}
}

declare namespace tailor.iconv {
/**
* Convert string from one encoding to another
*/
function convert<T extends string>(
str: string | Uint8Array | ArrayBuffer,
fromEncoding: string,
toEncoding: T
): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;

/**
* Convert buffer from one encoding to another
*/
function convertBuffer<T extends string>(
buffer: Uint8Array | ArrayBuffer,
fromEncoding: string,
toEncoding: T
): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;

/**
* Decode buffer to string
*/
function decode<T extends string>(
buffer: Uint8Array | ArrayBuffer,
encoding: T
): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;

/**
* Encode string to buffer
*/
function encode<T extends string>(
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;
}
}