build
This commit is contained in:
parent
1ae6fb6d51
commit
2c3f2b5a66
6 changed files with 113 additions and 58 deletions
30
dist-require/respostas.d.ts
vendored
30
dist-require/respostas.d.ts
vendored
|
|
@ -1,34 +1,40 @@
|
|||
export declare enum codigosResposta {
|
||||
sucesso = 200,
|
||||
erroConhecido = 400,
|
||||
erroPermissao = 401,
|
||||
erroDesconhecido = 500
|
||||
}
|
||||
export type tipoRespostaSucesso<T> = {
|
||||
cod: 200;
|
||||
cod: codigosResposta.sucesso;
|
||||
valor: T;
|
||||
mensagem: undefined;
|
||||
eErro: false;
|
||||
eCerto: true;
|
||||
detalhe?: undefined;
|
||||
detalhes?: string[];
|
||||
};
|
||||
export type tipoRespostaErro = {
|
||||
cod: 400 | 401 | 500;
|
||||
cod: codigosResposta.erroConhecido | codigosResposta.erroDesconhecido | codigosResposta.erroPermissao;
|
||||
valor: undefined;
|
||||
mensagem: string;
|
||||
eErro: true;
|
||||
eCerto: false;
|
||||
detalhe?: string[];
|
||||
detalhes?: string[];
|
||||
};
|
||||
export type tipoResposta<T> = tipoRespostaSucesso<T> | tipoRespostaErro;
|
||||
export declare const gerarRespostas: <T>(registrarErroInterno: (erro: T) => Partial<tipoRespostaErro>) => {
|
||||
valor: <T_1>(valor: T_1) => tipoRespostaSucesso<T_1>;
|
||||
valorTrue: () => tipoRespostaSucesso<true>;
|
||||
erro: (mensagem: string) => tipoRespostaErro;
|
||||
erroPermissao: (mensagem?: string) => tipoRespostaErro;
|
||||
valor: <T_1>(valor: T_1, detalhes?: string[]) => tipoRespostaSucesso<T_1>;
|
||||
valorTrue: (detalhes?: string[]) => tipoRespostaSucesso<true>;
|
||||
erro: (mensagem: string, detalhes?: string[]) => tipoRespostaErro;
|
||||
erroPermissao: (mensagem?: string | undefined | null, detalhes?: string[]) => tipoRespostaErro;
|
||||
erroInterno: (parametros: T, mensagem?: string) => tipoRespostaErro;
|
||||
};
|
||||
/**
|
||||
* Uso de respostas em comuns
|
||||
*/
|
||||
export declare const respostaComuns: {
|
||||
valor: <T>(valor: T) => tipoRespostaSucesso<T>;
|
||||
valorTrue: () => tipoRespostaSucesso<true>;
|
||||
erro: (mensagem: string) => tipoRespostaErro;
|
||||
erroPermissao: (mensagem?: string) => tipoRespostaErro;
|
||||
valor: <T>(valor: T, detalhes?: string[]) => tipoRespostaSucesso<T>;
|
||||
valorTrue: (detalhes?: string[]) => tipoRespostaSucesso<true>;
|
||||
erro: (mensagem: string, detalhes?: string[]) => tipoRespostaErro;
|
||||
erroPermissao: (mensagem?: string | undefined | null, detalhes?: string[]) => tipoRespostaErro;
|
||||
erroInterno: (parametros: unknown, mensagem?: string) => tipoRespostaErro;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue