mp-holistic
Version:
si prefigge l'umile compito di aiutare nella creazione di : - un server API REST mediante express - un semplice ORM per Postgres Questo tramite decoratori o classi particolari.
87 lines (86 loc) • 3.24 kB
TypeScript
import { IMetaParametro } from "../../metadata/parametro.metadata";
import { Request, Response } from "express";
import { SanificatoreCampo } from "./SanificatoreCampo";
import { ErroreMio } from "./ErroreMio";
import { ITracciamentoQualita } from "../metodo.express";
import { IFile } from "../metodo/MetodoParametri";
export declare type TypePosizione = "body" | "query" | 'header';
export declare type TypeDovePossoTrovarlo = TypeInterazone | "qui" | 'non-qui';
export declare type TypeInterazone = "rotta" | "middleware" | 'ambo';
export interface IResponse {
body: string;
}
export interface IParametri {
body: string;
query: string;
header: string;
}
export interface INonTrovato {
nome: string;
posizioneParametro: number;
}
export interface IParametriEstratti {
valoriParametri: any[];
nontrovato: INonTrovato[];
errori: IRitornoValidatore[];
}
export interface INonTrovato {
nome: string;
posizioneParametro: number;
}
export interface IRitornoValidatore {
body?: any | string;
approvato: boolean;
messaggio: string;
stato?: number;
terminale?: IMetaParametro;
}
export interface IReturn {
body: any | string;
stato: number;
nonTrovati?: INonTrovato[];
inErrore?: IRitornoValidatore[];
attore?: any;
}
export interface ISpawTrigger {
nome: string;
posizione: TypePosizione;
}
export declare type TypeMetod = "get" | "put" | "post" | "patch" | "purge" | "delete" | "file";
export declare function IsJsonString(str: string): boolean;
export declare function SostituisciRicorsivo(sanific: SanificatoreCampo[], currentNode: any): any;
/**
* @messaggio : inserisci qui il messaggio sara incontenuto del body o del testo nel .send() di express
* @codiceErrore inserisci qui l'errore che sara posi messo nello stato della risposta express
* @nomeClasse inserire solo se si alla creazione ovvero nel throw new ErroreMio(....)
* @nomeFunzione inserire solo se si alla creazione ovvero nel throw new ErroreMio(....)
* @percorsoErrore campo gestito dala classe GestioneErrore, se proprio si vuole inserire solo se si è nella fase di rilancio di un errore
*/
export interface IErroreMio {
messaggio: string;
codiceErrore: number;
nomeClasse?: string;
nomeFunzione?: string;
percorsoErrore?: string;
}
export interface IGestioneErrore {
error: Error;
nomeClasse?: string;
nomeFunzione?: string;
}
export declare function GestioneErrore(item: IGestioneErrore): ErroreMio;
export declare function CalcolaChiaveMemoryCache(req: Request): string;
export interface ILogbase {
data: Date;
body: any;
params: any;
header: any;
local: string;
remote: string;
url: string;
nomeMetodo?: string;
}
export declare function InizializzaLogbaseIn(req: Request, nomeMetodo?: string): ILogbase;
export declare function Rispondi(res: Response, item: IReturn, id: ITracciamentoQualita, isFile?: IFile, key?: string, durationSecondi?: number): void;
export declare function ConstruisciErrore(messaggio: any): IReturn;
export declare function InizializzaLogbaseOut(res: Response, nomeMetodo?: string): ILogbase;