@vroskus/library-api 1.0.1 → 1.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -3
- package/package.json +36 -10
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,6 @@ declare class ApiService<C extends $Config> {
|
|
|
29
29
|
setResponseContextListener({ listener, }: $SetResponseContextListenerParams): $SetResponseContextListenerResponse;
|
|
30
30
|
pushRequestContext(config: AxiosRequestConfig<unknown>, requestId: string): void;
|
|
31
31
|
pushResponseContext(response: AxiosResponse<unknown>): void;
|
|
32
|
-
initMock(): void;
|
|
32
|
+
initMock(mockSetup: (mock: AxiosMockAdapter) => void): void;
|
|
33
33
|
}
|
|
34
34
|
export default ApiService;
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
13
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
27
|
};
|
|
@@ -17,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const
|
|
32
|
+
const axios = __importStar(require("axios"));
|
|
21
33
|
const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
|
|
22
34
|
const lodash_1 = __importDefault(require("lodash"));
|
|
23
35
|
const uuid_1 = require("uuid");
|
|
@@ -33,7 +45,7 @@ class ApiService {
|
|
|
33
45
|
timeout,
|
|
34
46
|
withCredentials: true,
|
|
35
47
|
};
|
|
36
|
-
this.connection =
|
|
48
|
+
this.connection = axios.default.create(connectionConfig);
|
|
37
49
|
this.unauthenticatedHandler = () => { };
|
|
38
50
|
this.requestContextListener = () => { };
|
|
39
51
|
this.responseContextListener = () => { };
|
|
@@ -121,8 +133,9 @@ class ApiService {
|
|
|
121
133
|
const cleanResponseContext = lodash_1.default.omitBy(responseContext, lodash_1.default.isUndefined);
|
|
122
134
|
this.responseContextListener(cleanResponseContext);
|
|
123
135
|
}
|
|
124
|
-
initMock() {
|
|
136
|
+
initMock(mockSetup) {
|
|
125
137
|
this.mock = new axios_mock_adapter_1.default(this.connection);
|
|
138
|
+
mockSetup(this.mock);
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
exports.default = ApiService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vroskus/library-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Api",
|
|
5
5
|
"author": "Vilius Roškus <vilius@regattas.eu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,11 +13,14 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"dist/"
|
|
15
15
|
],
|
|
16
|
+
"type": "module",
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "tsc",
|
|
18
19
|
"test": "npm run test:eslint && npm run test:e2e",
|
|
19
|
-
"test:eslint": "eslint src --fix",
|
|
20
|
-
"test:e2e": "
|
|
20
|
+
"test:eslint": "eslint src test --fix",
|
|
21
|
+
"test:e2e": "npm run test:e2e:run && npm run test:e2e:post",
|
|
22
|
+
"test:e2e:run": "jest --ci --colors",
|
|
23
|
+
"test:e2e:post": "jest-coverage-thresholds-bumper"
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
26
|
"axios": "1.6.2",
|
|
@@ -26,20 +29,43 @@
|
|
|
26
29
|
"uuid": "9.0.1"
|
|
27
30
|
},
|
|
28
31
|
"devDependencies": {
|
|
29
|
-
"@types/jest": "29.5.
|
|
30
|
-
"@types/lodash": "4.14.
|
|
31
|
-
"@types/node": "20.
|
|
32
|
+
"@types/jest": "29.5.10",
|
|
33
|
+
"@types/lodash": "4.14.202",
|
|
34
|
+
"@types/node": "20.10.2",
|
|
32
35
|
"@types/query-string": "6.3.0",
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
34
|
-
"@typescript-eslint/parser": "6.
|
|
35
|
-
"eslint": "8.
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "6.13.1",
|
|
37
|
+
"@typescript-eslint/parser": "6.13.1",
|
|
38
|
+
"eslint": "8.55.0",
|
|
36
39
|
"eslint-config-airbnb-base": "15.0.0",
|
|
37
40
|
"eslint-config-airbnb-typescript": "17.1.0",
|
|
38
41
|
"eslint-plugin-import": "2.29.0",
|
|
39
42
|
"eslint-plugin-import-newlines": "1.3.4",
|
|
40
43
|
"eslint-plugin-react": "7.33.2",
|
|
41
44
|
"eslint-plugin-sort": "2.11.0",
|
|
45
|
+
"jest": "29.7.0",
|
|
46
|
+
"jest-coverage-thresholds-bumper": "1.1.0",
|
|
42
47
|
"npm-check": "6.0.1",
|
|
43
|
-
"
|
|
48
|
+
"ts-jest": "29.1.1",
|
|
49
|
+
"typescript": "5.3.2"
|
|
50
|
+
},
|
|
51
|
+
"jest": {
|
|
52
|
+
"preset": "ts-jest",
|
|
53
|
+
"testEnvironment": "node",
|
|
54
|
+
"coverageReporters": [
|
|
55
|
+
"json-summary",
|
|
56
|
+
"text"
|
|
57
|
+
],
|
|
58
|
+
"collectCoverage": true,
|
|
59
|
+
"collectCoverageFrom": [
|
|
60
|
+
"src/**/*.ts"
|
|
61
|
+
],
|
|
62
|
+
"coverageThreshold": {
|
|
63
|
+
"global": {
|
|
64
|
+
"branches": 54.54,
|
|
65
|
+
"functions": 50,
|
|
66
|
+
"lines": 70,
|
|
67
|
+
"statements": 67.03
|
|
68
|
+
}
|
|
69
|
+
}
|
|
44
70
|
}
|
|
45
71
|
}
|