@evlop/commons 1.0.157 → 1.0.159
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/actions/restApi.d.ts +5 -0
- package/dist/src/actions/restApi.d.ts.map +1 -1
- package/dist/src/actions/restApi.js +4 -1
- package/dist/src/actions/restApi.js.map +1 -1
- package/dist/src/components/hoc/withSettings.d.ts.map +1 -1
- package/dist/src/components/hoc/withSettings.js +1 -1
- package/dist/src/components/hoc/withSettings.js.map +1 -1
- package/dist/src/middlewares/restApiMiddleware.d.ts +1 -1
- package/dist/src/middlewares/restApiMiddleware.d.ts.map +1 -1
- package/dist/src/middlewares/restApiMiddleware.js +69 -62
- package/dist/src/middlewares/restApiMiddleware.js.map +1 -1
- package/package.json +3 -1
@@ -6,6 +6,7 @@ export declare const DELETE = "DELETE";
|
|
6
6
|
export declare const HTTP_REQUEST_START = "HTTP_REQUEST_START";
|
7
7
|
export declare const HTTP_REQUEST_SUCCESS = "HTTP_REQUEST_SUCCESS";
|
8
8
|
export declare const HTTP_REQUEST_FAILED = "HTTP_REQUEST_FAILED";
|
9
|
+
export declare const SET_API_BASE_URL = "SET_API_BASE_URL";
|
9
10
|
interface RequestOptions {
|
10
11
|
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
11
12
|
types?: [string, string, string] & {
|
@@ -29,5 +30,9 @@ export declare const request: (path: string, data?: any, options?: RequestOption
|
|
29
30
|
endpoint: string;
|
30
31
|
data: any;
|
31
32
|
};
|
33
|
+
export declare const setApiBaseUrl: (url: string) => {
|
34
|
+
type: string;
|
35
|
+
url: string;
|
36
|
+
};
|
32
37
|
export {};
|
33
38
|
//# sourceMappingURL=restApi.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"restApi.d.ts","sourceRoot":"","sources":["../../../src/actions/restApi.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,QAAQ,CAAC;AACzB,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,eAAO,MAAM,GAAG,QAAQ,C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,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG;QAAC,MAAM,EAAE,CAAC,CAAA;KAAC,CAAC;IAC/C,UAAU,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,OAAO,SAAU,MAAM,SAAQ,GAAG,YAAiB,cAAc;;;gBAL9B,CAAC;;;;;UAEvC,MAAM;;;;CAUd,CAAC;AAEH,eAAO,MAAM,aAAa,QAAS,MAAM;;;CAAkC,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.request = exports.HTTP_REQUEST_FAILED = exports.HTTP_REQUEST_SUCCESS = exports.HTTP_REQUEST_START = exports.DELETE = exports.PATCH = exports.PUT = exports.POST = exports.GET = void 0;
|
3
|
+
exports.setApiBaseUrl = exports.request = exports.SET_API_BASE_URL = exports.HTTP_REQUEST_FAILED = exports.HTTP_REQUEST_SUCCESS = exports.HTTP_REQUEST_START = exports.DELETE = exports.PATCH = exports.PUT = exports.POST = exports.GET = void 0;
|
4
4
|
exports.GET = 'GET';
|
5
5
|
exports.POST = 'POST';
|
6
6
|
exports.PUT = 'PUT';
|
@@ -9,6 +9,9 @@ exports.DELETE = 'DELETE';
|
|
9
9
|
exports.HTTP_REQUEST_START = 'HTTP_REQUEST_START';
|
10
10
|
exports.HTTP_REQUEST_SUCCESS = 'HTTP_REQUEST_SUCCESS';
|
11
11
|
exports.HTTP_REQUEST_FAILED = 'HTTP_REQUEST_FAILED';
|
12
|
+
exports.SET_API_BASE_URL = 'SET_API_BASE_URL';
|
12
13
|
const request = (path, data = {}, options) => (Object.assign({ isRestRequest: true, types: [exports.HTTP_REQUEST_START, exports.HTTP_REQUEST_SUCCESS, exports.HTTP_REQUEST_FAILED], endpoint: path, method: exports.GET, data }, (options || {})));
|
13
14
|
exports.request = request;
|
15
|
+
const setApiBaseUrl = (url) => ({ type: exports.SET_API_BASE_URL, url });
|
16
|
+
exports.setApiBaseUrl = setApiBaseUrl;
|
14
17
|
//# sourceMappingURL=restApi.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"restApi.js","sourceRoot":"","sources":["../../../src/actions/restApi.tsx"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,KAAK,CAAC;AACZ,QAAA,IAAI,GAAG,MAAM,CAAC;AACd,QAAA,GAAG,GAAG,KAAK,CAAC;AACZ,QAAA,KAAK,GAAG,OAAO,CAAC;AAChB,QAAA,MAAM,GAAG,QAAQ,CAAC;AAElB,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;
|
1
|
+
{"version":3,"file":"restApi.js","sourceRoot":"","sources":["../../../src/actions/restApi.tsx"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,KAAK,CAAC;AACZ,QAAA,IAAI,GAAG,MAAM,CAAC;AACd,QAAA,GAAG,GAAG,KAAK,CAAC;AACZ,QAAA,KAAK,GAAG,OAAO,CAAC;AAChB,QAAA,MAAM,GAAG,QAAQ,CAAC;AAElB,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAE5C,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AAS5C,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,OAAY,EAAE,EAAE,OAAwB,EAAC,EAAE,CAAA,iBAC7E,aAAa,EAAE,IAAI,EACnB,KAAK,EAAC,CAAC,0BAAkB,EAAE,4BAAoB,EAAE,2BAAmB,CAAC,EACrE,QAAQ,EAAE,IAAI,EACd,MAAM,EAAE,WAAG,EACX,IAAI,IACD,CAAC,OAAO,IAAI,EAAE,CAAC,EACpB,CAAC;AAPU,QAAA,OAAO,WAOjB;AAEI,MAAM,aAAa,GAAG,CAAC,GAAW,EAAC,EAAE,CAAA,CAAC,EAAC,IAAI,EAAE,wBAAgB,EAAE,GAAG,EAAC,CAAC,CAAA;AAA9D,QAAA,aAAa,iBAAiD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"withSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/hoc/withSettings.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAiE,MAAM,OAAO,CAAC;AAE5J,OAAO,EAAE,MAAM,EAAgE,MAAM,aAAa,CAAC;AAEnG,aAAK,WAAW,GAAG;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/F,oBAAY,qBAAqB,CAAC,CAAC,SAAS,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;AAE/J,eAAO,MAAM,YAAY;;;;
|
1
|
+
{"version":3,"file":"withSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/hoc/withSettings.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAiE,MAAM,OAAO,CAAC;AAE5J,OAAO,EAAE,MAAM,EAAgE,MAAM,aAAa,CAAC;AAEnG,aAAK,WAAW,GAAG;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/F,oBAAY,qBAAqB,CAAC,CAAC,SAAS,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;AAE/J,eAAO,MAAM,YAAY;;;;8LAqLvB,CAAC;AAGH,eAAO,MAAM,WAAW;;;;8LAAe,CAAC;AACxC,eAAe,YAAY,CAAC"}
|
@@ -181,7 +181,7 @@ const withSettings = ({ name: elementName, valueOptions = [], configurationOptio
|
|
181
181
|
return { stack: [{ id, name: dataModel, ref, values, update: updateData, valueOptions, configurationOptions }, ...toolbarStack], setActiveToolbar };
|
182
182
|
}, [id, dataModel, values, toolbarStack, setActiveToolbar, ref, updateData]);
|
183
183
|
return (react_1.default.createElement(contexts_1.ToolbarProvider, { value: elementContext },
|
184
|
-
react_1.default.createElement(BaseComponent, Object.assign({
|
184
|
+
react_1.default.createElement(BaseComponent, Object.assign({ animate: true, change: change, focused: focused, hovered: hovered, isEditing: editMode }, props, configs, values, extraProps, { action: forwardActions, ref: ref }))));
|
185
185
|
});
|
186
186
|
exports.withSettings = withSettings;
|
187
187
|
exports.withToolbar = exports.withSettings;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"withSettings.js","sourceRoot":"","sources":["../../../../src/components/hoc/withSettings.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmD;AACnD,+CAA4J;AAC5J,6CAAiE;AACjE,uCAAmG;AAM5F,MAAM,YAAY,GAAC,CAAC,EAAC,IAAI,EAAE,WAAW,EAAE,YAAY,GAAG,EAAE,EAAE,oBAAoB,GAAG,EAAE,EAAC,EAAE,EAAE,CAAC,CAAmB,aAAqC,EAAE,EAAE,CAAC,kBAAU,CAA0C,CAAC,KAAU,EAAE,YAAY,EAAE,EAAE;IAE3O,MAAM,MAAM,GAAG,cAAM,EAAE,C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BAAmB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;SACrE;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAExC,MAAM,EAAC,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAC,GAAG,kBAAU,CAAC,yBAAc,CAAC,CAAC;IAE3E,MAAM,cAAc,GAAO,eAAO,CAAC,GAAE,EAAE;QACnC,OAAO,EAAC,KAAK,EAAC,CAAC,EAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,oBAAoB,EAAC,EAAE,GAAG,YAAY,CAAC,EAAE,gBAAgB,EAAC,CAAC;IACnJ,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IAG7E,OAAO,CACH,8BAAC,0BAAe,IAAC,KAAK,EAAE,cAAc;QAClC,8BAAC,aAAa,kBACV,OAAO,QACP,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,IACf,KAAK,EACL,OAAO,EACP,MAAM,EACN,UAAU,IACd,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG,IACV,CACY,CACrB,CAAC;AACN,CAAC,CAAC,CAAC;AArLU,QAAA,YAAY,gBAqLtB;AAGU,QAAA,WAAW,GAAG,oBAAY,CAAC;AACxC,kBAAe,oBAAY,CAAC"}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export declare const restApiMiddleware: (store: any) => (dispatch:
|
1
|
+
export declare const restApiMiddleware: (store: any) => (dispatch: Function) => (action: any) => any;
|
2
2
|
export default restApiMiddleware;
|
3
3
|
//# sourceMappingURL=restApiMiddleware.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"restApiMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middlewares/restApiMiddleware.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"restApiMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middlewares/restApiMiddleware.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,6BAUT,QAAQ,cAAW,GAAG,QAgEzC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
@@ -11,70 +11,77 @@ const getUserToken_1 = __importDefault(require("../adapters/getUserToken"));
|
|
11
11
|
const constants_1 = require("../constants");
|
12
12
|
const lodash_1 = require("lodash");
|
13
13
|
const axios_retry_1 = __importDefault(require("axios-retry"));
|
14
|
-
const
|
15
|
-
const httpClient = axios_1.default.create(
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
const
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
.
|
46
|
-
|
14
|
+
const restApiMiddleware = (store) => {
|
15
|
+
const httpClient = axios_1.default.create({
|
16
|
+
baseURL: constants_1.API_BASE_URL || '/api/',
|
17
|
+
});
|
18
|
+
axios_retry_1.default(httpClient, {
|
19
|
+
retries: Number.MAX_SAFE_INTEGER,
|
20
|
+
retryDelay: (retryNumber) => Math.min(5000, axios_retry_1.default.exponentialDelay(retryNumber)),
|
21
|
+
});
|
22
|
+
return (dispatch) => (action) => {
|
23
|
+
if (action.isRestRequest) {
|
24
|
+
return getUserToken_1.default().then((token) => {
|
25
|
+
const requestOptions = {};
|
26
|
+
if (token) {
|
27
|
+
lodash_1.set(requestOptions, ['headers', 'Authorization'], `Bearer ${token}`);
|
28
|
+
}
|
29
|
+
let endpoint = action.endpoint;
|
30
|
+
const isExternal = helpers_1.isExternalUrl(endpoint);
|
31
|
+
if (!isExternal) {
|
32
|
+
endpoint = endpoint.replace(/^\/api\//, "/");
|
33
|
+
}
|
34
|
+
if (action.pathParams) {
|
35
|
+
// fill path params to URL
|
36
|
+
const { pathParams } = action;
|
37
|
+
endpoint = Object.keys(pathParams).reduce((url, paramName) => {
|
38
|
+
const find = new RegExp(`:${paramName}`, 'g');
|
39
|
+
return url.replace(find, pathParams[paramName]);
|
40
|
+
}, endpoint);
|
41
|
+
}
|
42
|
+
switch (String(action.method).trim().toUpperCase()) {
|
43
|
+
case actions_1.POST: {
|
44
|
+
dispatch({ type: action.types[0] });
|
45
|
+
return httpClient.post(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
|
46
|
+
.then(resp => (resp.data))
|
47
|
+
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
48
|
+
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
49
|
+
}
|
50
|
+
case actions_1.PUT:
|
51
|
+
dispatch({ type: action.types[0] });
|
52
|
+
return httpClient.put(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
|
53
|
+
.then(resp => (resp.data))
|
54
|
+
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
55
|
+
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
56
|
+
case actions_1.PATCH:
|
57
|
+
dispatch({ type: action.types[0] });
|
58
|
+
return httpClient.patch(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
|
59
|
+
.then(resp => (resp.data))
|
60
|
+
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
61
|
+
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
62
|
+
case actions_1.DELETE:
|
63
|
+
dispatch({ type: action.types[0] });
|
64
|
+
return httpClient.delete(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
|
65
|
+
.then(resp => (resp.data))
|
66
|
+
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
67
|
+
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
68
|
+
default:
|
69
|
+
case actions_1.GET:
|
70
|
+
dispatch({ type: action.types[0] });
|
71
|
+
return httpClient.get(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.data }, { params: action.params, headers: action.headers }))
|
72
|
+
.then(resp => resp.data)
|
73
|
+
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
74
|
+
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
47
75
|
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
54
|
-
case actions_1.PATCH:
|
55
|
-
dispatch({ type: action.types[0] });
|
56
|
-
return httpClient.patch(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
|
57
|
-
.then(resp => (resp.data))
|
58
|
-
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
59
|
-
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
60
|
-
case actions_1.DELETE:
|
61
|
-
dispatch({ type: action.types[0] });
|
62
|
-
return httpClient.delete(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
|
63
|
-
.then(resp => (resp.data))
|
64
|
-
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
65
|
-
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
66
|
-
default:
|
67
|
-
case actions_1.GET:
|
68
|
-
dispatch({ type: action.types[0] });
|
69
|
-
return httpClient.get(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.data }, { params: action.params, headers: action.headers }))
|
70
|
-
.then(resp => resp.data)
|
71
|
-
.then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
|
72
|
-
.catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
|
76
|
+
});
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
if (action.type === actions_1.SET_API_BASE_URL) {
|
80
|
+
httpClient.defaults.baseURL = action.url;
|
73
81
|
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
return dispatch(action);
|
82
|
+
return dispatch(action);
|
83
|
+
}
|
84
|
+
};
|
78
85
|
};
|
79
86
|
exports.restApiMiddleware = restApiMiddleware;
|
80
87
|
exports.default = exports.restApiMiddleware;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"restApiMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/restApiMiddleware.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,wCAAyC;AACzC,
|
1
|
+
{"version":3,"file":"restApiMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/restApiMiddleware.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,wCAAyC;AACzC,wCAA0E;AAC1E,4EAAoD;AACpD,4CAA0C;AAC1C,mCAA2C;AAC3C,8DAAqC;AAE9B,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAC,EAAE;IACtC,MAAM,UAAU,GAAG,eAAK,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE,wBAAY,IAAI,OAAO;KACnC,CAAC,CAAC;IAEH,qBAAU,CAAC,UAAU,EAAE;QACnB,OAAO,EAAE,MAAM,CAAC,gBAAgB;QAChC,UAAU,EAAE,CAAC,WAAW,EAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,qBAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;KACtF,CAAC,CAAC;IAEJ,OAAO,CAAC,QAAiB,EAAC,EAAE,CAAA,CAAC,MAAU,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O,QAAQ,CAAC,MAAM,CAAC,CAAC;SAC3B;IAEL,CAAC,CAAA;AAAA,CAAC,CAAC;AA1EU,QAAA,iBAAiB,qBA0E3B;AAEH,kBAAe,yBAAiB,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evlop/commons",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.159",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/main.js",
|
6
6
|
"peerDependencies": {
|
@@ -32,6 +32,7 @@
|
|
32
32
|
"author": "",
|
33
33
|
"license": "ISC",
|
34
34
|
"devDependencies": {
|
35
|
+
"@types/axios": "^0.14.0",
|
35
36
|
"@types/chai": "^4.2.18",
|
36
37
|
"@types/jest": "^26.0.23",
|
37
38
|
"@types/lodash": "^4.14.168",
|
@@ -39,6 +40,7 @@
|
|
39
40
|
"@types/react": "^16.14.0",
|
40
41
|
"@types/react-native": "^0.67.8",
|
41
42
|
"@types/uuid": "^8.3.4",
|
43
|
+
"axios": "^0.27.2",
|
42
44
|
"chai": "^4.3.4",
|
43
45
|
"change-case": "^4.1.2",
|
44
46
|
"handlebars": "^4.7.7",
|