@apolitical/sdk 0.0.2 → 0.0.4

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/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.0.4] - 2022-01-31
9
+ ### Fixed
10
+ - Buffer dependency
11
+ - Node.js version
12
+ ### Removed
13
+ - Template example
14
+
15
+ ## [0.0.3] - 2022-01-12
16
+ ### Added
17
+ - Exposed `reportError` function
18
+ ### Fixed
19
+ - Resources naming (must be plural)
8
20
 
9
21
  ## [0.0.2] - 2022-01-06
10
22
  ### Added
package/README.md CHANGED
@@ -6,7 +6,7 @@ Browser library to interact with Apolitical's APIs
6
6
 
7
7
  Requires the following to run:
8
8
 
9
- - [node.js][node] 12.20.1+
9
+ - [node.js][node] 16.13.0+
10
10
  - [yarn][yarn]
11
11
 
12
12
  [node]: https://nodejs.org/en/download/
package/build/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):"function"==typeof define&&define.amd?define(["@apolitical/error-reporting","axios","http-status-codes"],r):"object"==typeof exports?exports.ApoliticalSDK=r(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):e.ApoliticalSDK=r(e["@apolitical/error-reporting"],e.axios,e["http-status-codes"])}(this,(function(e,r,t){return function(){"use strict";var o={30:function(r){r.exports=e},300:function(e){e.exports=r},25:function(e){e.exports=t}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,a),t.exports}a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,{a:r}),r},a.d=function(e,r){for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){a.r(i),a.d(i,{default:function(){return E}});var e=a(30),r=a(300),t=a.n(r),o={APIS:{BACKEND_TEMPLATE:{BASE_URL:"/api/backend-template",ENDPOINTS:{DUMMY:"/dummy"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}}},n=a(25);const s=async r=>{try{let t=!1,o="Error at Apolitical SDK: ";if(r.response){switch(r.response.status){case n.StatusCodes.NOT_FOUND:case n.StatusCodes.FORBIDDEN:t=!0}o+=JSON.stringify(r.response)}else r.request?o+=JSON.stringify(r.request):o+=r.message;if(console.warn(o),t)return;await(0,e.reportError)(new Error(o))}catch(e){console.warn(`Cannot handle error: ${e.message}`)}},{APIS:{PEOPLE_API:{BASE_URL:u,ENDPOINTS:{USERS:c}}}}=o;var p={user:{read:async e=>{let r=null;try{({data:r}=await t().get(`${u}${c}/${e}`))}catch(e){await s(e)}return r}}};const{APIS:{BACKEND_TEMPLATE:{BASE_URL:l,ENDPOINTS:{DUMMY:f}}}}=o;var d={people:p,template:{dummy:{read:async()=>{let e=null;try{({data:e}=await t().get(`${l}${f}`))}catch(e){await s(e)}return e}}}};function E({origin:r,gcpErrorsApiKey:t,serviceName:o}){return(0,e.setContext)({origin:r,accessToken:t,serviceName:o}),{...d,reportError:e.reportError}}}(),i}()}));
1
+ !function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):"function"==typeof define&&define.amd?define(["@apolitical/error-reporting","axios","http-status-codes"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):r.ApoliticalSDK=e(r["@apolitical/error-reporting"],r.axios,r["http-status-codes"])}(this,(function(r,e,t){return function(){"use strict";var o={30:function(e){e.exports=r},300:function(r){r.exports=e},25:function(r){r.exports=t}},n={};function i(r){var e=n[r];if(void 0!==e)return e.exports;var t=n[r]={exports:{}};return o[r](t,t.exports,i),t.exports}i.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return i.d(e,{a:e}),e},i.d=function(r,e){for(var t in e)i.o(e,t)&&!i.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},i.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},i.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var s={};return function(){i.r(s),i.d(s,{default:function(){return c},reportError:function(){return r.reportError}});var r=i(30),e=i(300),t=i.n(e),o=i(25);const{APIS:{PEOPLE_API:{BASE_URL:n,ENDPOINTS:{USERS:a}}}}={APIS:{PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}}};var u={people:{users:{read:async e=>{let i=null;try{({data:i}=await t().get(`${n}${a}/${e}`))}catch(e){await(async e=>{try{let t=!1,n="Error at Apolitical SDK: ";if(e.response){switch(e.response.status){case o.StatusCodes.NOT_FOUND:case o.StatusCodes.FORBIDDEN:t=!0}n+=JSON.stringify(e.response)}else e.request?n+=JSON.stringify(e.request):n+=e.message;if(console.warn(n),t)return;await(0,r.reportError)(new Error(n))}catch(r){console.warn(`Cannot handle error: ${r.message}`)}})(e)}return i}}}};function c({origin:e,gcpErrorsApiKey:t,serviceName:o}){return(0,r.setContext)({origin:e,accessToken:t,serviceName:o}),{...u,reportError:r.reportError}}}(),s}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Browser library to interact with Apolitical's APIs",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -24,44 +24,36 @@
24
24
  "SDK"
25
25
  ],
26
26
  "dependencies": {
27
- "@apolitical/error-reporting": "0.0.1",
28
- "axios": "0.24.0",
27
+ "@apolitical/error-reporting": "0.0.3-beta.2",
28
+ "axios": "0.25.0",
29
29
  "http-status-codes": "2.2.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@apolitical/error-reporting": "0.0.1",
33
- "axios": "0.24.0",
32
+ "@apolitical/error-reporting": "0.0.3-beta.2",
33
+ "axios": "0.25.0",
34
34
  "http-status-codes": "2.2.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@apolitical/eslint-config": "0.0.1",
38
- "@babel/core": "7.16.7",
39
- "babel-eslint": "10.1.0",
40
- "babel-loader": "8.2.3",
41
- "babel-preset-react-app": "10.0.1",
37
+ "@apolitical/eslint-config": "1.0.2-beta.1",
38
+ "@babel/core": "7.16.12",
39
+ "@babel/eslint-parser": "7.16.5",
40
+ "@babel/plugin-transform-runtime": "7.16.10",
41
+ "@babel/preset-env": "7.16.11",
42
42
  "husky": "7.0.4",
43
43
  "jest": "27.4.7",
44
44
  "jest-junit": "13.0.0",
45
- "lint-staged": "12.1.7",
46
- "webpack": "5.65.0",
47
- "webpack-cli": "4.9.1"
45
+ "lint-staged": "12.3.2",
46
+ "webpack": "5.67.0",
47
+ "webpack-cli": "4.9.2"
48
48
  },
49
49
  "eslintConfig": {
50
50
  "extends": [
51
- "eslint:recommended",
52
- "plugin:prettier/recommended",
53
- "plugin:jest/recommended"
51
+ "@apolitical/eslint-config/base.config"
54
52
  ],
55
53
  "env": {
56
- "browser": true,
57
- "node": true,
58
- "es6": true,
59
- "jest": true
54
+ "browser": true
60
55
  },
61
- "plugins": [
62
- "jest"
63
- ],
64
- "parser": "babel-eslint"
56
+ "parser": "@babel/eslint-parser"
65
57
  },
66
58
  "prettier": "@apolitical/eslint-config/prettier.config",
67
59
  "browserslist": {
@@ -93,11 +85,18 @@
93
85
  },
94
86
  "babel": {
95
87
  "presets": [
96
- "react-app"
97
- ]
88
+ "@babel/preset-env"
89
+ ],
90
+ "env": {
91
+ "test": {
92
+ "plugins": [
93
+ "@babel/plugin-transform-runtime"
94
+ ]
95
+ }
96
+ }
98
97
  },
99
98
  "engines": {
100
- "node": ">=12.20.1"
99
+ "node": ">=16.13.0"
101
100
  },
102
101
  "lint-staged": {
103
102
  "*.js": "eslint --cache --fix --ignore-path .gitignore",