@ply-ct/ply
Version:
REST API Automated Testing
54 lines (53 loc) • 1.49 kB
TypeScript
/// <reference types="node" />
import * as stream from 'stream';
import { ValueType } from '@ply-ct/ply-values';
import { Log } from './log';
export declare type Values = {
[key: string]: any;
};
export declare const isExpression: (input: string) => boolean;
export interface ValueLocation {
file: string;
line?: number;
}
export declare class ValuesBuilder {
private readonly logger;
private readonly enabledLocs;
private values;
private readonly rowsLoc;
constructor(valuesFiles: {
[file: string]: boolean;
}, logger: Log);
get isRows(): boolean;
read(): Promise<any>;
getRowStream(): Promise<stream.Readable>;
}
/**
* Reads entire csv file into rows in memory
*/
export declare const fromCsv: (file: string) => Promise<any[]>;
/**
* Reads entire xlsx file into rows in memory
*/
export declare const fromXlsx: (file: string) => Promise<any[]>;
export interface RowConverter {
convert(row: any[]): any;
}
export interface ConverterOptions {
trimValues?: boolean;
trimLabels?: boolean;
inferPrimitiveTypes?: boolean;
blankIsNull?: boolean;
dateFormat?: string;
}
export declare class DefaultRowConverter implements RowConverter {
readonly names: string[];
readonly options: ConverterOptions;
constructor(names: any[], options?: ConverterOptions);
splitName(name: string): string[];
convert(row: any[]): any;
/**
* TODO: Date
*/
getValue(str: string): ValueType;
}