@evlop/commons 1.0.169 → 1.0.170

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ declare const axios: import("axios").AxiosInstance;
2
+ export default axios;
3
+ //# sourceMappingURL=axios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../../src/helpers/axios.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,KAAK,+BAET,CAAC;AAOF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,17 @@
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
+ const axios_1 = __importDefault(require("axios"));
7
+ const constants_1 = require("../constants");
8
+ const axios_retry_1 = __importDefault(require("axios-retry"));
9
+ const axios = axios_1.default.create({
10
+ baseURL: constants_1.API_BASE_URL || '/api',
11
+ });
12
+ axios_retry_1.default(axios, {
13
+ retries: Number.MAX_SAFE_INTEGER,
14
+ retryDelay: (retryNumber) => Math.min(10000, axios_retry_1.default.exponentialDelay(retryNumber)),
15
+ });
16
+ exports.default = axios;
17
+ //# sourceMappingURL=axios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../src/helpers/axios.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,4CAA4C;AAC5C,8DAAqC;AAErC,MAAM,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,wBAAY,IAAI,MAAM;CAClC,CAAC,CAAC;AAEH,qBAAU,CAAC,KAAK,EAAE;IACd,OAAO,EAAE,MAAM,CAAC,gBAAgB;IAChC,UAAU,EAAE,CAAC,WAAW,EAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,qBAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACvF,CAAC,CAAC;AAEH,kBAAe,KAAK,CAAC"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"restApiMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middlewares/restApiMiddleware.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,6BACT,QAAQ,cAAW,GAAG,QAgEzC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
@@ -4,21 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.restApiMiddleware = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const helpers_1 = require("../helpers");
7
+ const lodash_1 = require("lodash");
9
8
  const actions_1 = require("../actions");
10
9
  const getUserToken_1 = __importDefault(require("../adapters/getUserToken"));
11
- const constants_1 = require("../constants");
12
- const lodash_1 = require("lodash");
13
- const axios_retry_1 = __importDefault(require("axios-retry"));
10
+ const helpers_1 = require("../helpers");
11
+ const axios_1 = __importDefault(require("../helpers/axios"));
14
12
  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
13
  return (dispatch) => (action) => {
23
14
  if (action.isRestRequest) {
24
15
  return getUserToken_1.default().then((token) => {
@@ -42,33 +33,33 @@ const restApiMiddleware = (store) => {
42
33
  switch (String(action.method).trim().toUpperCase()) {
43
34
  case actions_1.POST: {
44
35
  dispatch({ type: action.types[0] });
45
- return httpClient.post(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
36
+ return axios_1.default.post(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
46
37
  .then(resp => (resp.data))
47
38
  .then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
48
39
  .catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
49
40
  }
50
41
  case actions_1.PUT:
51
42
  dispatch({ type: action.types[0] });
52
- return httpClient.put(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
43
+ return axios_1.default.put(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
53
44
  .then(resp => (resp.data))
54
45
  .then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
55
46
  .catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
56
47
  case actions_1.PATCH:
57
48
  dispatch({ type: action.types[0] });
58
- return httpClient.patch(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
49
+ return axios_1.default.patch(endpoint, action.data, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
59
50
  .then(resp => (resp.data))
60
51
  .then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
61
52
  .catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
62
53
  case actions_1.DELETE:
63
54
  dispatch({ type: action.types[0] });
64
- return httpClient.delete(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
55
+ return axios_1.default.delete(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.params, headers: action.headers }))
65
56
  .then(resp => (resp.data))
66
57
  .then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
67
58
  .catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
68
59
  default:
69
60
  case actions_1.GET:
70
61
  dispatch({ type: action.types[0] });
71
- return httpClient.get(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.data }, { params: action.params, headers: action.headers }))
62
+ return axios_1.default.get(endpoint, lodash_1.defaultsDeep(requestOptions, { params: action.data }, { params: action.params, headers: action.headers }))
72
63
  .then(resp => resp.data)
73
64
  .then(response => dispatch(Object.assign(Object.assign({}, action), { success: true, type: action.types[1], response })))
74
65
  .catch(({ response }) => dispatch({ type: action.types[2], error: true, response }));
@@ -77,7 +68,7 @@ const restApiMiddleware = (store) => {
77
68
  }
78
69
  else {
79
70
  if (action.type === actions_1.SET_API_BASE_URL) {
80
- httpClient.defaults.baseURL = action.url;
71
+ axios_1.default.defaults.baseURL = action.url;
81
72
  }
82
73
  return dispatch(action);
83
74
  }
@@ -1 +1 @@
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,EAAC,EAAE;QAC1C,IAAG,MAAM,CAAC,aAAa,EAAC;YACpB,OAAO,sBAAY,EAAE,CAAC,IAAI,CAAC,CAAC,KAAa,EAAE,EAAE;gBACzC,MAAM,cAAc,GAAG,EAAE,CAAC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AC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC,CAAC,CAAC;iBACzF;YACL,CAAC,CAAC,CAAC;SACN;aACG;YACA,IAAG,MAAM,CAAC,IAAI,KAAK,0BAAgB,EAAC;gBAChC,eAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC;aACvC;YACD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;SAC3B;IAEL,CAAC,CAAA;AAAA,CAAC,CAAC;AAjEU,QAAA,iBAAiB,qBAiE3B;AAEH,kBAAe,yBAAiB,CAAC"}
@@ -8,6 +8,8 @@ export declare function registerIcons(icons: any[]): {
8
8
  type: string;
9
9
  icons: any[];
10
10
  };
11
+ export declare const getIcons: (() => Promise<any>) & import("lodash").MemoizedFunction;
12
+ export declare function fetchIcons(): (dispatch: Function) => void;
11
13
  declare const _default: (state: any, action: any) => any;
12
14
  export default _default;
13
15
  //# sourceMappingURL=icons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/reducers/icons.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG;;;EAKrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE;;;EAKzC;;AAKD,wBAWC"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/reducers/icons.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG;;;EAKrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE;;;EAKzC;AAED,eAAO,MAAM,QAAQ,0DAA6F,CAAA;AAClH,wBAAgB,UAAU,eACJ,QAAQ,UAK7B;;AAKD,wBAWC"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerIcons = exports.registerIcon = exports.REGISTER_ICONS = exports.REGISTER_ICON = void 0;
6
+ exports.fetchIcons = exports.getIcons = exports.registerIcons = exports.registerIcon = exports.REGISTER_ICONS = exports.REGISTER_ICON = void 0;
4
7
  const lodash_1 = require("lodash");
8
+ const axios_1 = __importDefault(require("../helpers/axios"));
5
9
  exports.REGISTER_ICON = 'REGISTER_ICON';
6
10
  exports.REGISTER_ICONS = 'REGISTER_ICON';
7
11
  function registerIcon(icon) {
@@ -18,6 +22,15 @@ function registerIcons(icons) {
18
22
  };
19
23
  }
20
24
  exports.registerIcons = registerIcons;
25
+ exports.getIcons = lodash_1.memoize(() => axios_1.default.get('https://cdn.evlop.com/assets-info/icons.json?v=9').then(r => r.data));
26
+ function fetchIcons() {
27
+ return (dispatch) => {
28
+ exports.getIcons().then(icons => {
29
+ dispatch(registerIcons(icons));
30
+ });
31
+ };
32
+ }
33
+ exports.fetchIcons = fetchIcons;
21
34
  let initialState = [];
22
35
  exports.default = (state = initialState, action) => {
23
36
  switch (action.type) {
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../src/reducers/icons.tsx"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEnB,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,cAAc,GAAG,eAAe,CAAC;AAE9C,SAAgB,YAAY,CAAC,IAAS;IAClC,OAAO;QACH,IAAI,EAAE,qBAAa;QACnB,IAAI;KACP,CAAC;AACN,CAAC;AALD,oCAKC;AAED,SAAgB,aAAa,CAAC,KAAY;IACtC,OAAO;QACH,IAAI,EAAE,qBAAa;QACnB,KAAK;KACR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AAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC,CAAA;AACL,CAAC;AAND,gCAMC;AAED,IAAI,YAAY,GAAO,EACtB,CAAC;AAEF,kBAAe,CAAC,KAAK,GAAG,YAAY,EAAE,MAAM,EAAC,EAAE;IAC3C,QAAQ,MAAM,CAAC,IAAI,EAAE;QACjB,KAAK,qBAAa,CAAC,CAAA;YACf,OAAO,eAAM,CAAC,CAAC,GAAG,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAA;SAC/C;QACD,KAAK,sBAAc,CAAC,CAAA;YAChB,OAAO,eAAM,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;SACnD;QACD;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evlop/commons",
3
- "version": "1.0.169",
3
+ "version": "1.0.170",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "peerDependencies": {