@apolitical/sdk 0.4.0-beta.0 → 0.4.0-beta.1

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,23 @@ 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.3.0] - 2022-02-08
9
+ ### Added
10
+ - Management API Accounts Resource
11
+
12
+ ## [0.2.0] - 2022-02-01
13
+ ### Changed
14
+ - SDK interface
15
+
16
+ ## [0.1.0] - 2022-01-31
17
+ ### Fixed
18
+ - Buffer dependency
19
+ - Node.js version
20
+ ### Added
21
+ - Decode base64 functionality
22
+ - Apolitical content
23
+ ### Removed
24
+ - Template example
8
25
 
9
26
  ## [0.0.3] - 2022-01-12
10
27
  ### 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 N},reportError:function(){return e.reportError}});var e=a(30),r=a(300),t=a.n(r),o={APIS:{BACKEND_TEMPLATE:{BASE_URL:"/api/backend-template",ENDPOINTS:{DUMMY:"/dummy"}},MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts/:email"}},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={users:{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 E={dummy:{read:async()=>{let e=null;try{({data:e}=await t().get(`${l}${f}`))}catch(e){await s(e)}return e}}};const{APIS:{MANAGEMENT_API:{BASE_URL:d,ENDPOINTS:{ACCOUNTS:S}}}}=o;var A={management:{accounts:{read:async e=>{let r=null;try{({data:r}=await t().get(`${d}${S}/${e}`))}catch(e){await s(e)}return r}}},people:p,template:E};function N({origin:r,gcpErrorsApiKey:t,serviceName:o}){return(0,e.setContext)({origin:r,accessToken:t,serviceName:o}),{...A,reportError:e.reportError}}}(),i}()}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("axios"),require("http-status-codes"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","axios","http-status-codes","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("axios"),require("http-status-codes"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t.axios,t["http-status-codes"],t.buffer)}(this,(function(t,e,r,n,o){return function(){"use strict";var i={809:function(e){e.exports=t},30:function(t){t.exports=e},300:function(t){t.exports=r},408:function(t){t.exports=o},25:function(t){t.exports=n}},a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={exports:{}};return i[t](r,r.exports,s),r.exports}s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,{a:e}),e},s.d=function(t,e){for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return function(){s.r(u),s.d(u,{decodeBase64:function(){return g},default:function(){return y},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return S},people:function(){return f},reportError:function(){return e.reportError}});var t=s(809),e=s(30),r=s(300),n=s.n(r),o={APIS:{MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}}},i=s(25);const a=async t=>{try{let r=!1,n="Error at Apolitical SDK: ";if(t.response){switch(t.response.status){case i.StatusCodes.NOT_FOUND:case i.StatusCodes.FORBIDDEN:r=!0}n+=JSON.stringify(t.response)}else t.request?n+=JSON.stringify(t.request):n+=t.message;if(console.warn(n),r)return;await(0,e.reportError)(new Error(n))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}},{APIS:{PEOPLE_API:{BASE_URL:c,ENDPOINTS:{USERS:p}}}}=o;var f={users:{read:async t=>{let e=null;try{({data:e}=await n().get(`${c}${p}/${t}`))}catch(t){await a(t)}return e}}};const{APIS:{MANAGEMENT_API:{BASE_URL:l,ENDPOINTS:{ACCOUNTS:d}}}}=o;var S={accounts:{create:async t=>{try{await n().post(`${l}${d}`,t)}catch(t){await a(t)}},read:async t=>{let e=null;try{({data:e}=await n().get(`${l}${d}/${t}`))}catch(t){await a(t)}return e}}},E=s(408);const g=t=>t&&E.Buffer.from(t,"base64").toString("ascii");function y({contentContext:r=null,errorsContext:n=null,origin:o}){r&&(0,t.setContext)(Object.assign({},r,{origin:o})),n&&(0,e.setContext)(Object.assign({},n,{origin:o}))}}(),u}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.4.0-beta.0",
3
+ "version": "0.4.0-beta.1",
4
4
  "description": "Browser library to interact with Apolitical's APIs",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -16,7 +16,8 @@
16
16
  "lint": "eslint --ext .js ./lib",
17
17
  "format": "prettier --write 'lib/**/*.+(js|json)'",
18
18
  "lint-format": "lint-staged",
19
- "prepare": "husky install"
19
+ "prepare": "husky install",
20
+ "prepack": "yarn build"
20
21
  },
21
22
  "keywords": [
22
23
  "JavaScript",
@@ -24,44 +25,40 @@
24
25
  "SDK"
25
26
  ],
26
27
  "dependencies": {
27
- "@apolitical/error-reporting": "0.0.1",
28
- "axios": "0.24.0",
28
+ "@apolitical/content": "0.3.0",
29
+ "@apolitical/error-reporting": "0.1.0",
30
+ "axios": "0.25.0",
31
+ "buffer": "6.0.3",
29
32
  "http-status-codes": "2.2.0"
30
33
  },
31
34
  "peerDependencies": {
32
- "@apolitical/error-reporting": "0.0.1",
33
- "axios": "0.24.0",
35
+ "@apolitical/content": "0.3.0",
36
+ "@apolitical/error-reporting": "0.1.0",
37
+ "axios": "0.25.0",
38
+ "buffer": "6.0.3",
34
39
  "http-status-codes": "2.2.0"
35
40
  },
36
41
  "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",
42
+ "@apolitical/eslint-config": "1.0.2",
43
+ "@babel/core": "7.16.12",
44
+ "@babel/eslint-parser": "7.16.5",
45
+ "@babel/plugin-transform-runtime": "7.16.10",
46
+ "@babel/preset-env": "7.16.11",
42
47
  "husky": "7.0.4",
43
48
  "jest": "27.4.7",
44
49
  "jest-junit": "13.0.0",
45
- "lint-staged": "12.1.7",
46
- "webpack": "5.65.0",
47
- "webpack-cli": "4.9.1"
50
+ "lint-staged": "12.3.2",
51
+ "webpack": "5.68.0",
52
+ "webpack-cli": "4.9.2"
48
53
  },
49
54
  "eslintConfig": {
50
55
  "extends": [
51
- "eslint:recommended",
52
- "plugin:prettier/recommended",
53
- "plugin:jest/recommended"
56
+ "@apolitical/eslint-config/base.config"
54
57
  ],
55
58
  "env": {
56
- "browser": true,
57
- "node": true,
58
- "es6": true,
59
- "jest": true
59
+ "browser": true
60
60
  },
61
- "plugins": [
62
- "jest"
63
- ],
64
- "parser": "babel-eslint"
61
+ "parser": "@babel/eslint-parser"
65
62
  },
66
63
  "prettier": "@apolitical/eslint-config/prettier.config",
67
64
  "browserslist": {
@@ -93,11 +90,18 @@
93
90
  },
94
91
  "babel": {
95
92
  "presets": [
96
- "react-app"
97
- ]
93
+ "@babel/preset-env"
94
+ ],
95
+ "env": {
96
+ "test": {
97
+ "plugins": [
98
+ "@babel/plugin-transform-runtime"
99
+ ]
100
+ }
101
+ }
98
102
  },
99
103
  "engines": {
100
- "node": ">=12.20.1"
104
+ "node": ">=16.13.0"
101
105
  },
102
106
  "lint-staged": {
103
107
  "*.js": "eslint --cache --fix --ignore-path .gitignore",