@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 +17 -0
- package/README.md +1 -1
- package/build/index.js +1 -1
- package/package.json +32 -28
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
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e
|
|
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.
|
|
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/
|
|
28
|
-
"
|
|
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/
|
|
33
|
-
"
|
|
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": "
|
|
38
|
-
"@babel/core": "7.16.
|
|
39
|
-
"babel-
|
|
40
|
-
"babel-
|
|
41
|
-
"babel
|
|
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.
|
|
46
|
-
"webpack": "5.
|
|
47
|
-
"webpack-cli": "4.9.
|
|
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
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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": ">=
|
|
104
|
+
"node": ">=16.13.0"
|
|
101
105
|
},
|
|
102
106
|
"lint-staged": {
|
|
103
107
|
"*.js": "eslint --cache --fix --ignore-path .gitignore",
|