@designliquido/delegua-http 0.1.1 → 0.1.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.
- package/fontes/cliente-http.d.ts +7 -5
- package/fontes/cliente-http.d.ts.map +1 -0
- package/fontes/cliente-http.js +25 -10
- package/fontes/cliente-http.js.map +1 -1
- package/fontes/interfaces/argumento-interface.d.ts +5 -0
- package/fontes/interfaces/argumento-interface.d.ts.map +1 -0
- package/fontes/interfaces/argumento-interface.js +3 -0
- package/fontes/interfaces/argumento-interface.js.map +1 -0
- package/fontes/interfaces/index.d.ts +2 -0
- package/fontes/interfaces/index.d.ts.map +1 -0
- package/fontes/interfaces/index.js +18 -0
- package/fontes/interfaces/index.js.map +1 -0
- package/fontes/resposta-http.d.ts +1 -0
- package/fontes/resposta-http.d.ts.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -0
- package/jest.config.d.ts +1 -0
- package/jest.config.d.ts.map +1 -0
- package/package.json +8 -4
- package/testes/cliente-http.test.d.ts +0 -1
- package/testes/cliente-http.test.js +0 -12
- package/testes/cliente-http.test.js.map +0 -1
package/fontes/cliente-http.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { AxiosInstance, RawAxiosRequestHeaders } from "axios";
|
|
2
2
|
import { RespostaHttp } from "./resposta-http";
|
|
3
|
+
import { ArgumentoInterface } from "./interfaces";
|
|
3
4
|
export declare class ClienteHttp {
|
|
4
5
|
instanciaAxios: AxiosInstance;
|
|
5
6
|
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>;
|
|
7
|
+
requisicaoGet(sufixoUrl: string | ArgumentoInterface, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
|
|
8
|
+
requisicaoPost(sufixoUrl: string | ArgumentoInterface, corpo: any, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
|
|
9
|
+
requisicaoPut(sufixoUrl: string | ArgumentoInterface, corpo: any, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
|
|
10
|
+
requisicaoDelete(sufixoUrl: string | ArgumentoInterface, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
|
|
11
|
+
requisicaoPatch(sufixoUrl: string | ArgumentoInterface, corpo: any, cabecalhos?: RawAxiosRequestHeaders): Promise<RespostaHttp>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=cliente-http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliente-http.d.ts","sourceRoot":"","sources":["../../fontes/cliente-http.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAiB,sBAAsB,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,qBAAa,WAAW;IACpB,cAAc,EAAE,aAAa,CAAC;gBAElB,OAAO,GAAE,MAAW,EAAE,WAAW,GAAE,MAAa,EAAE,UAAU,GAAE,GAAQ;IAQ5E,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,UAAU,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC;IAkBjH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC;IAmB9H,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC;IAmB7H,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,UAAU,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC;IAkBpH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC;CAkBxI"}
|
package/fontes/cliente-http.js
CHANGED
|
@@ -15,32 +15,47 @@ class ClienteHttp {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
async requisicaoGet(sufixoUrl, cabecalhos) {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const sufixoUrlResolvido = sufixoUrl.hasOwnProperty("valor") ? sufixoUrl.valor : sufixoUrl;
|
|
19
|
+
const respostaAxios = await this.instanciaAxios.get(`${sufixoUrlResolvido}`, {
|
|
20
|
+
headers: {
|
|
21
|
+
...cabecalhos
|
|
22
|
+
}
|
|
20
23
|
});
|
|
21
24
|
return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
|
|
22
25
|
}
|
|
23
26
|
async requisicaoPost(sufixoUrl, corpo, cabecalhos) {
|
|
24
|
-
const
|
|
25
|
-
|
|
27
|
+
const sufixoUrlResolvido = sufixoUrl.hasOwnProperty("valor") ? sufixoUrl.valor : sufixoUrl;
|
|
28
|
+
const respostaAxios = await this.instanciaAxios.post(`${sufixoUrlResolvido}`, corpo, {
|
|
29
|
+
headers: {
|
|
30
|
+
...cabecalhos
|
|
31
|
+
}
|
|
26
32
|
});
|
|
27
33
|
return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
|
|
28
34
|
}
|
|
29
35
|
async requisicaoPut(sufixoUrl, corpo, cabecalhos) {
|
|
30
|
-
const
|
|
31
|
-
|
|
36
|
+
const sufixoUrlResolvido = sufixoUrl.hasOwnProperty("valor") ? sufixoUrl.valor : sufixoUrl;
|
|
37
|
+
const respostaAxios = await this.instanciaAxios.put(`${sufixoUrlResolvido}`, corpo, {
|
|
38
|
+
headers: {
|
|
39
|
+
...cabecalhos
|
|
40
|
+
}
|
|
32
41
|
});
|
|
33
42
|
return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
|
|
34
43
|
}
|
|
35
44
|
async requisicaoDelete(sufixoUrl, cabecalhos) {
|
|
36
|
-
const
|
|
37
|
-
|
|
45
|
+
const sufixoUrlResolvido = sufixoUrl.hasOwnProperty("valor") ? sufixoUrl.valor : sufixoUrl;
|
|
46
|
+
const respostaAxios = await this.instanciaAxios.delete(`${sufixoUrlResolvido}`, {
|
|
47
|
+
headers: {
|
|
48
|
+
...cabecalhos
|
|
49
|
+
}
|
|
38
50
|
});
|
|
39
51
|
return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
|
|
40
52
|
}
|
|
41
53
|
async requisicaoPatch(sufixoUrl, corpo, cabecalhos) {
|
|
42
|
-
const
|
|
43
|
-
|
|
54
|
+
const sufixoUrlResolvido = sufixoUrl.hasOwnProperty("valor") ? sufixoUrl.valor : sufixoUrl;
|
|
55
|
+
const respostaAxios = await this.instanciaAxios.patch(`${sufixoUrlResolvido}`, corpo, {
|
|
56
|
+
headers: {
|
|
57
|
+
...cabecalhos
|
|
58
|
+
}
|
|
44
59
|
});
|
|
45
60
|
return new resposta_http_1.RespostaHttp(respostaAxios.status, respostaAxios.statusText, respostaAxios.data);
|
|
46
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cliente-http.js","sourceRoot":"","sources":["../../fontes/cliente-http.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAoF;AACpF,mDAA+C;
|
|
1
|
+
{"version":3,"file":"cliente-http.js","sourceRoot":"","sources":["../../fontes/cliente-http.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAoF;AACpF,mDAA+C;AAG/C,MAAa,WAAW;IAGpB,YAAY,UAAkB,EAAE,EAAE,cAAsB,IAAI,EAAE,aAAkB,EAAE;QAC9E,IAAI,CAAC,cAAc,GAAG,eAAK,CAAC,MAAM,CAAC;YAC/B,OAAO,EAAE,GAAG,OAAO,EAAE;YACrB,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,UAAU;SACtB,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAsC,EAAE,UAAmC;QAC3F,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,SAAgC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACnH,MAAM,aAAa,GAA4B,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CACxE,GAAG,kBAAkB,EAAE,EACvB;YACI,OAAO,EAAE;gBACL,GAAG,UAAU;aAChB;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,cAAc,CAAC,SAAsC,EAAE,KAAU,EAAE,UAAmC;QACxG,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,SAAgC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACnH,MAAM,aAAa,GAA4B,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CACzE,GAAG,kBAAkB,EAAE,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c,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,SAAgC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACnH,MAAM,aAAa,GAA4B,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAC1E,GAAG,kBAAkB,EAAE,EACvB,KAAK,EACL;YACI,OAAO,EAAE;gBACL,GAAG,UAAU;aAChB;SACJ,CACJ,CAAC;QAEF,OAAO,IAAI,4BAAY,CACnB,aAAa,CAAC,MAAM,EACpB,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,IAAI,CACrB,CAAC;IACN,CAAC;CACJ;AAvGD,kCAuGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argumento-interface.d.ts","sourceRoot":"","sources":["../../../fontes/interfaces/argumento-interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argumento-interface.js","sourceRoot":"","sources":["../../../fontes/interfaces/argumento-interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../fontes/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
__exportStar(require("./argumento-interface"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../fontes/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resposta-http.d.ts","sourceRoot":"","sources":["../../fontes/resposta-http.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,GAAG,CAAC;gBAEC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;CAKvE"}
|
package/index.d.ts
CHANGED
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAE,MAAW,EAAE,WAAW,GAAE,MAAa,EAAE,UAAU,GAAE,GAAQ,GAAG,WAAW,CAE3H;AAED,cAAc,wBAAwB,CAAC"}
|
package/jest.config.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;8BAEjB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;AAAvD,wBAQE"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designliquido/delegua-http",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Biblioteca para acessos HTTP em Delégua",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
5
7
|
"repository": {
|
|
6
8
|
"type": "git",
|
|
7
9
|
"url": "git+https://github.com/DesignLiquido/delegua-http.git"
|
|
8
10
|
},
|
|
9
11
|
"scripts": {
|
|
10
|
-
"empacotar": "yarn rimraf ./dist && tsc && yarn copyfiles -V ./README.md ./dist && yarn copyfiles -V ./LICENSE ./dist",
|
|
11
|
-
"publicar-npm": "npm publish --access public"
|
|
12
|
+
"empacotar": "yarn rimraf ./dist && tsc && yarn copyfiles -V ./README.md ./dist && yarn copyfiles -V ./LICENSE ./dist && yarn copyfiles -V ./package.json ./dist",
|
|
13
|
+
"publicar-npm": "npm publish ./dist --access public",
|
|
14
|
+
"testes-unitarios": "jest --passWithNoTests --coverage"
|
|
12
15
|
},
|
|
13
16
|
"author": "Leonel Sanches da Silva",
|
|
14
17
|
"dependencies": {
|
|
@@ -16,10 +19,11 @@
|
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"@types/jest": "^29.5.14",
|
|
22
|
+
"@types/node": "^22.14.0",
|
|
19
23
|
"copyfiles": "^2.4.1",
|
|
20
24
|
"jest": "^29.7.0",
|
|
21
25
|
"rimraf": "^6.0.1",
|
|
22
|
-
"ts-jest": "^29.3.
|
|
26
|
+
"ts-jest": "^29.3.4",
|
|
23
27
|
"ts-node": "^10.9.2",
|
|
24
28
|
"typescript": "^5.8.3"
|
|
25
29
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const __1 = require("..");
|
|
4
|
-
describe('Cliente HTTP', () => {
|
|
5
|
-
it('Deve trazer dados com sucesso', async () => {
|
|
6
|
-
const clienteHttp = (0, __1.novoClienteHttp)(undefined, "https://github.com");
|
|
7
|
-
const resultado = await clienteHttp.requisicaoGet("/DesignLiquido/delegua");
|
|
8
|
-
expect(resultado).toBeTruthy();
|
|
9
|
-
expect(resultado.codigoStatus).toBe(200);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=cliente-http.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cliente-http.test.js","sourceRoot":"","sources":["../../testes/cliente-http.test.ts"],"names":[],"mappings":";;AAAA,0BAAqC;AAErC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,WAAW,GAAG,IAAA,mBAAe,EAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACrE,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;QAC5E,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|