@designliquido/delegua-http 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- import { AxiosInstance } from "axios";
2
- import { RespostaHttp } from "./resposta-http";
3
- export declare class ClienteHttp {
4
- instanciaAxios: AxiosInstance;
5
- constructor(urlBase?: string, tempoMaximo?: number, cabecalhos?: any);
6
- requisicaoGet(sufixoUrl: string): Promise<RespostaHttp>;
7
- requisicaoPost(sufixoUrl: string, corpo: any): Promise<RespostaHttp>;
8
- requisicaoPut(sufixoUrl: string, corpo: any): Promise<RespostaHttp>;
9
- requisicaoDelete(sufixoUrl: string): Promise<RespostaHttp>;
10
- requisicaoPatch(sufixoUrl: string, corpo: any): Promise<RespostaHttp>;
11
- }
1
+ import { AxiosInstance, RawAxiosRequestHeaders } from "axios";
2
+ import { RespostaHttp } from "./resposta-http";
3
+ export declare class ClienteHttp {
4
+ instanciaAxios: AxiosInstance;
5
+ constructor(urlBase?: string, tempoMaximo?: number, cabecalhos?: any);
6
+ requisicaoGet(sufixoUrl: string, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
7
+ requisicaoPost(sufixoUrl: string, corpo: any, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
8
+ requisicaoPut(sufixoUrl: string, corpo: any, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
9
+ requisicaoDelete(sufixoUrl: string, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
10
+ requisicaoPatch(sufixoUrl: string, corpo: any, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
11
+ }
@@ -1,39 +1,49 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ClienteHttp = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const resposta_http_1 = require("./resposta-http");
9
- class ClienteHttp {
10
- constructor(urlBase = "", tempoMaximo = 5000, cabecalhos = {}) {
11
- this.instanciaAxios = axios_1.default.create({
12
- baseURL: urlBase,
13
- timeout: tempoMaximo,
14
- headers: cabecalhos
15
- });
16
- }
17
- async requisicaoGet(sufixoUrl) {
18
- const respostaAxios = await this.instanciaAxios.get(sufixoUrl);
19
- return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
20
- }
21
- async requisicaoPost(sufixoUrl, corpo) {
22
- const respostaAxios = await this.instanciaAxios.post(sufixoUrl, corpo);
23
- return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
24
- }
25
- async requisicaoPut(sufixoUrl, corpo) {
26
- const respostaAxios = await this.instanciaAxios.put(sufixoUrl, corpo);
27
- return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
28
- }
29
- async requisicaoDelete(sufixoUrl) {
30
- const respostaAxios = await this.instanciaAxios.delete(sufixoUrl);
31
- return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
32
- }
33
- async requisicaoPatch(sufixoUrl, corpo) {
34
- const respostaAxios = await this.instanciaAxios.patch(sufixoUrl, corpo);
35
- return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
36
- }
37
- }
38
- exports.ClienteHttp = ClienteHttp;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ClienteHttp = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const resposta_http_1 = require("./resposta-http");
9
+ class ClienteHttp {
10
+ constructor(urlBase = "", tempoMaximo = 5000, cabecalhos = {}) {
11
+ this.instanciaAxios = axios_1.default.create({
12
+ baseURL: urlBase,
13
+ timeout: tempoMaximo,
14
+ headers: cabecalhos
15
+ });
16
+ }
17
+ async requisicaoGet(sufixoUrl, cabecalhos) {
18
+ const respostaAxios = await this.instanciaAxios.get(sufixoUrl, {
19
+ headers: Object.assign({}, cabecalhos)
20
+ });
21
+ return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
22
+ }
23
+ async requisicaoPost(sufixoUrl, corpo, cabecalhos) {
24
+ const respostaAxios = await this.instanciaAxios.post(sufixoUrl, corpo, {
25
+ headers: Object.assign({}, cabecalhos)
26
+ });
27
+ return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
28
+ }
29
+ async requisicaoPut(sufixoUrl, corpo, cabecalhos) {
30
+ const respostaAxios = await this.instanciaAxios.put(sufixoUrl, corpo, {
31
+ headers: Object.assign({}, cabecalhos)
32
+ });
33
+ return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
34
+ }
35
+ async requisicaoDelete(sufixoUrl, cabecalhos) {
36
+ const respostaAxios = await this.instanciaAxios.delete(sufixoUrl, {
37
+ headers: Object.assign({}, cabecalhos)
38
+ });
39
+ return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
40
+ }
41
+ async requisicaoPatch(sufixoUrl, corpo, cabecalhos) {
42
+ const respostaAxios = await this.instanciaAxios.patch(sufixoUrl, corpo, {
43
+ headers: Object.assign({}, cabecalhos)
44
+ });
45
+ return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
46
+ }
47
+ }
48
+ exports.ClienteHttp = ClienteHttp;
39
49
  //# sourceMappingURL=cliente-http.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cliente-http.js","sourceRoot":"","sources":["../../fontes/cliente-http.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4D;AAC5D,mDAA+C;AAE/C,MAAa,WAAW;IAGpB,YA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,CAAC;IACN,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB,EAAE,KAAU,EAAE,UAAmC;QAClF,MAAM,aAAa,GAA4B,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CACxE,SAAS,EACT,KAAK,EACL;YACI,OAAO,oBACA,UAAU,CAChB;SACJ,CACJ,CAAC;QAEF,OAAO,IAAI,4BAAY,CACnB,aAAa,CAAC,MAAM,EACpB,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,IAAI,CACrB,CAAC;IACN,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,SAAiB,EAAE,UAAmC;QACzE,MAAM,aAAa,GAA4B,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAC3E,SAAS,EACT;YACI,OAAO,oBACA,UAAU,CAChB;SACJ,CACJ,CAAC;QAEF,OAAO,IAAI,4BAAY,CACnB,aAAa,CAAC,MAAM,EACpB,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,IAAI,CACrB,CAAC;IACN,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,SAAiB,EAAE,KAAU,EAAE,UAAmC;QACpF,MAAM,aAAa,GAA4B,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAC1E,SAAS,EACT,KAAK,EACL;YACI,OAAO,oBACA,UAAU,CAChB;SACJ,CACJ,CAAC;QAEF,OAAO,IAAI,4BAAY,CACnB,aAAa,CAAC,MAAM,EACpB,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,IAAI,CACrB,CAAC;IACN,CAAC;CACJ;AAlGD,kCAkGC"}
@@ -1,6 +1,6 @@
1
- export declare class RespostaHttp {
2
- codigoStatus: number;
3
- mensagemStatus: string;
4
- dados: any;
5
- constructor(codigoStatus: number, mensagemStatus: string, dados: any);
6
- }
1
+ export declare class RespostaHttp {
2
+ codigoStatus: number;
3
+ mensagemStatus: string;
4
+ dados: any;
5
+ constructor(codigoStatus: number, mensagemStatus: string, dados: any);
6
+ }
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RespostaHttp = void 0;
4
- class RespostaHttp {
5
- constructor(codigoStatus, mensagemStatus, dados) {
6
- this.codigoStatus = codigoStatus;
7
- this.mensagemStatus = mensagemStatus;
8
- this.dados = dados;
9
- }
10
- }
11
- exports.RespostaHttp = RespostaHttp;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RespostaHttp = void 0;
4
+ class RespostaHttp {
5
+ constructor(codigoStatus, mensagemStatus, dados) {
6
+ this.codigoStatus = codigoStatus;
7
+ this.mensagemStatus = mensagemStatus;
8
+ this.dados = dados;
9
+ }
10
+ }
11
+ exports.RespostaHttp = RespostaHttp;
12
12
  //# sourceMappingURL=resposta-http.js.map
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { ClienteHttp } from "./fontes/cliente-http";
2
- export declare function novoClienteHttp(urlBase?: string, tempoMaximo?: number, cabecalhos?: any): ClienteHttp;
3
- export * from './fontes/resposta-http';
1
+ import { ClienteHttp } from "./fontes/cliente-http";
2
+ export declare function novoClienteHttp(urlBase?: string, tempoMaximo?: number, cabecalhos?: any): ClienteHttp;
3
+ export * from './fontes/resposta-http';
package/index.js CHANGED
@@ -1,24 +1,24 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.novoClienteHttp = void 0;
18
- const cliente_http_1 = require("./fontes/cliente-http");
19
- function novoClienteHttp(urlBase = "", tempoMaximo = 5000, cabecalhos = {}) {
20
- return new cliente_http_1.ClienteHttp(urlBase, tempoMaximo, cabecalhos);
21
- }
22
- exports.novoClienteHttp = novoClienteHttp;
23
- __exportStar(require("./fontes/resposta-http"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.novoClienteHttp = void 0;
18
+ const cliente_http_1 = require("./fontes/cliente-http");
19
+ function novoClienteHttp(urlBase = "", tempoMaximo = 5000, cabecalhos = {}) {
20
+ return new cliente_http_1.ClienteHttp(urlBase, tempoMaximo, cabecalhos);
21
+ }
22
+ exports.novoClienteHttp = novoClienteHttp;
23
+ __exportStar(require("./fontes/resposta-http"), exports);
24
24
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@designliquido/delegua-http",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Biblioteca para acessos HTTP em Delégua",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/DesignLiquido/delegua-http.git"
8
8
  },
9
9
  "scripts": {
10
- "empacotar": "yarn rimraf ./dist && tsc && copyfiles -V ./README.md ./dist && copyfiles -V ./LICENSE ./dist",
10
+ "empacotar": "yarn rimraf ./dist && tsc && yarn copyfiles -V ./README.md ./dist && yarn copyfiles -V ./LICENSE ./dist",
11
11
  "publicar-npm": "npm publish --access public"
12
12
  },
13
13
  "author": "Leonel Sanches da Silva",
14
14
  "dependencies": {
15
- "axios": "^1.4.0"
15
+ "axios": "^1.8.4"
16
16
  },
17
17
  "devDependencies": {
18
- "rimraf": "^5.0.1"
18
+ "copyfiles": "^2.4.1",
19
+ "rimraf": "^6.0.1"
19
20
  }
20
21
  }