///
///
///
///
///
import chalk from 'chalk';
import progress from 'cli-progress';
import fs from 'fs';
import { Transporter } from 'nodemailer';
import Mail from 'nodemailer/lib/mailer';
import SMTPTransport from 'nodemailer/lib/smtp-transport';
import "reflect-metadata";
import superagent from 'superagent';
import vm from 'vm';
import { DataSource, FindOptionsWhere, QueryRunner } from 'typeorm';
import { ApiRequest } from '../controllers/custom_request';
import { PayloadProps } from './payload';
declare class ResizeImage {
filename: string;
quality?: number;
width?: number;
height?: number;
target?: string;
}
declare class Image {
resizeImage(params: ResizeImage): Promise;
}
declare class Event {
emit(name: string, params: any): Promise;
on(name: string, callback: (args: any[]) => Promise): Promise;
}
declare class Schedule {
on(options: string, event: Function): Promise;
}
declare class ProcessResponse {
stack: any;
error: string;
stdout: any;
stderr: string;
constructor(stack: any, error: string, stdout: any, stderr: string);
}
declare class Barcode {
readerImage(filePath: string): Promise;
}
declare class Process {
execute(command: string): Promise;
}
declare class MiscelaneaApi {
private login;
sendFile(fileName: string, fileType: string, filePath: string, base64: string): Promise;
deleteFile(fileName: string, fileType: string, filePath: string): Promise;
generateUrl(fileName: string, fileType: string, filePath: string): Promise;
}
declare class Logger {
info(message: string): void;
imp(message: string): void;
warn(message: string): void;
err(message: string): void;
}
declare class Report {
downloadLib(): Promise;
loadJasperReportNodeApi(reportPath: string, reportName: string, reportBody: any): Promise;
}
declare class DateTime {
getDayOfWeek(date: Date): number;
getDayOfWeekNow(): number;
getLabelDayOfWeek(date: Date): string;
getLabelDayOfWeekNow(): string;
addDay(date: Date, days: number): Date;
addHours(date: Date, hours: number): Date;
addMinutes(date: Date, minutes: number): Date;
addSecunds(date: Date, secunds: number): Date;
addWeeks(date: Date, weeks: number): Date;
addMonths(date: Date, months: number): Date;
addYears(date: Date, years: number): Date;
newDate(): Date;
newDateTime(): Date;
dateFormat(date: Date, format: string): string;
fromNow(date: Date): string;
toDate(value: string, format?: string): Date;
}
declare class Project {
pkgMainFolder(): any;
mainFolder(): any;
}
declare class Reflection {
getMethods(target: any): any[];
isDecorator(name: string, service: object, attribute?: string): boolean;
decoratorValue(name: string, service: object, attribute?: string): any;
getDecorators(target: any, propertyName?: string | symbol): any;
}
declare class Repository {
get(name: string, params?: any[]): string;
}
declare class Fs {
extractFileExt(pathFile: string): string;
extractFileName(pathFile: string): string;
renameFile(path: string, pathTarget: string): void;
private listFilesRecursively;
listFiles(pathDirectory: string): Promise;
deleteDirectory(pathDirectory: string): void;
deleteFile(fileName: string): void;
info(fileName: string): fs.Stats;
extension(fileName: string): string;
createDirectory(pathDirectory: string): void;
exists(path: string): boolean;
readTextSync(fileName: string, encoding?: BufferEncoding): string;
readTextArraySync(fileName: string, encoding?: BufferEncoding): string[];
readText(fileName: string, encoding?: BufferEncoding): Promise;
readTextArray(fileName: string, encoding?: BufferEncoding): Promise;
writeText(fileName: string, text: string, encoding?: BufferEncoding): Promise;
writeTextFull(fileName: string, text: string, encoding?: BufferEncoding): Promise;
writeBuffer(fileName: string, buffer: NodeJS.ArrayBufferView): Promise;
lastLinesFile(filename: string, lines: number): Promise;
}
declare class Import {
getValue(line: string, index: number, delimiter?: string): string;
joinValue(values: any[], delimiter?: string): string;
getLength(line: string, delimiter?: string): number;
}
declare class ObjectDef {
isEmpty(source: object): boolean;
changekey(object: object, oldKey: string, newKey: string): object;
lowerKeys(object: object): object;
clone(object: object): object;
join(object: any, target: any): object;
}
declare class Miscelanea {
nvl(valueOr: any, valueTar: any): any;
joinPath(...paths: string[]): string;
removeLastPath(path: string): string;
keySet(text: string, key: string, value: any): string;
keyGet(text: string, key: string): string;
hash(): string;
random(min: number, max: number): number;
isValidCpf(value: any): boolean;
isValidCnpj(value: any): boolean;
waitTime(time: number): Promise;
isNull(value: any, otherValue: any): any;
splitTo(value: string, to: string, index: number): string;
}
declare class Crypto {
toMd5(value: any): string;
toBCrypt(value: any, saltRound?: number): string;
bCryptCompare(value: any, cryptValue: string): boolean;
}
declare class Tokenaccess {
isValid(tokenaccess: string, authorization?: string): Promise;
getData(tokenaccess: string, authorization?: string): Promise;
create(algorithm: any, data: any, authorization: string, expiresIn?: string | number): Promise;
}
declare class Url {
isValid(url: string): Promise;
}
declare class Numeric {
parcValue(value: number, parc: number, first?: boolean, decimals?: number): number;
justNumber(value: any): any;
justNumberWithZero(value: any): any;
trunc(value: number, decimals?: number): number;
round(value: number, decimals?: number): number;
format(value: number, locale?: string, options?: Intl.NumberFormatOptions): string;
}
declare class Find {
whereDef(values: any, useOr?: boolean): FindOptionsWhere | FindOptionsWhere[];
}
declare class Connection {
getDataSource(name?: string): DataSource;
getIO(name?: string, callback?: (io: QueryRunner) => Promise): Promise;
}
declare class Variable {
global: Global;
}
declare class Global {
get(name: string): T;
set(name: string, value: T): void;
unSet(name: string): void;
}
declare class ProgressBar {
getColor(): chalk.Chalk;
start(bar: progress.Bar, length: number): Promise;
startMultiBar(multiBar: progress.MultiBar, length: number): Promise;
increment(bar: progress.Bar): Promise;
stop(bar: progress.Bar): Promise;
createMultiBar(color?: chalk.Chalk, title?: string): Promise;
create(color?: chalk.Chalk, title?: string): Promise;
}
declare class Sequencial {
generateUIID(): string;
generateNextID(io: QueryRunner, tabela: string): Promise;
generateNextCode(io: QueryRunner, reference: string): Promise;
}
declare class Text {
capitalizeFirstLetter(value: string): string;
removeLastLetter(value: string): string;
lastLetter(value: string): string;
removeAccent(value: string): string;
repeatText(value: string, times: number): string;
completeEnd(value: string, char: string, times: number): string;
completeStart(value: string, char: string, times: number): string;
changeValue(value: string, key: any, newValue: any): string;
changeIndex(value: string, params: any[]): string;
changeValueDef(value: string, params: any, fieldsDate?: string[], fieldsDateTime?: string[], fieldsMoney?: string[], fieldsNumber?: string[]): string;
}
declare class Base64 {
mimeTypeToExtension(mimeType: string): String;
fileUrlToBase64(url: string): Promise;
Base64ToFile(buffer: string, fileName: string): Promise;
}
declare class Request {
rest(): superagent.SuperAgentStatic;
}
declare class Email {
createServer(def: SMTPTransport | SMTPTransport.Options | string): Transporter;
sendMail(server: Transporter, mailOptions: Mail.Options): Promise;
}
export declare class Download {
file(sourceUrl: string, targetFileName: string): Promise;
}
export declare class JavaScript {
run(script: string, sandbox?: vm.Context): Promise;
}
export declare class Generics {
create(type: (new () => T)): T;
}
export declare class BodyConditionDef {
field?: string;
operation?: string;
value?: any;
}
export declare class bodyConditionFilter {
field?: string;
operation?: string;
value?: string;
}
export declare class BodyCondition {
condition?: BodyConditionDef;
filter?: any[] | bodyConditionFilter[];
}
export declare class JsTs {
exists(fileName: string): boolean;
}
export declare class Share {
createSharedFiles(): Promise;
}
export declare class ArrayDef {
removeDuplicate(array: any[]): any[];
}
declare class PayloadPix {
generate(payData: PayloadProps): Promise;
generateBufferQrCode(payData: PayloadProps): Promise;
generateQrCode(payData: PayloadProps, target: string): Promise;
}
export declare class Scraping {
getUrlData(url: string): Promise;
getLoadData(data: any): Promise;
}
export declare class NodeCache {
}
export declare class Helper {
static scraping(): Scraping;
static payloadPix(): PayloadPix;
static share(): Share;
static logger(): Logger;
static miscelaneaApi(): MiscelaneaApi;
static array(): ArrayDef;
static barcode(): Barcode;
static jsTs(): JsTs;
static sequencial(): Sequencial;
static generics(): Generics;
static download(): Download;
static request(): Request;
static text(): Text;
static find(): Find;
static email(): Email;
static numeric(): Numeric;
static tokenAccess(): Tokenaccess;
static miscelanea(): Miscelanea;
static fs(): Fs;
static reflection(): Reflection;
static project(): Project;
static report(): Report;
static datetime(): DateTime;
static progressBar(): ProgressBar;
static crypto(): Crypto;
static event(): Event;
static schedule(): Schedule;
static object(): ObjectDef;
static base64(): Base64;
static repository(): Repository;
static process(): Process;
static variable(): Variable;
static image(): Image;
static url(): Url;
static javaScript(): JavaScript;
static import(): Import;
static connection(): Connection;
static userHelper(req?: ApiRequest): Promise;
}
export {};