@apolitical/sdk 0.3.0-beta.1 → 0.4.0-beta.2

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,10 @@ 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
+
8
12
  ## [0.2.0] - 2022-02-01
9
13
  ### Changed
10
14
  - SDK interface
package/build/index.js CHANGED
@@ -1 +1 @@
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 u(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={exports:{}};return i[t](r,r.exports,u),r.exports}u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,{a:e}),e},u.d=function(t,e){for(var r in e)u.o(e,r)&&!u.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return function(){u.r(s),u.d(s,{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=u(809),e=u(30),r=u(300),n=u.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=u(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:{read:async t=>{let e=null;try{({data:e}=await n().get(`${l}${d}/${t}`))}catch(t){await a(t)}return e}}},E=u(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}))}}(),s}()}));
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 c={};return function(){s.r(c),s.d(c,{decodeBase64:function(){return P},default:function(){return T},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return y},people:function(){return g},reportError:function(){return e.reportError}});var t=s(809),e=s(30),r={APIS:{MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}},APOLITICAL:{WEBSITES:{BETA:"https://beta.apolitical.co",BETA_2:"https://beta-2.apolitical.co",LIVE:"https://apolitical.co",RC:"https://rc.apolitical.co"}},AUTH0:{PASSWORDLESS_START:{REDIRECT_URI:"/signup/verify-email?changedEmail=true&postSignup=false",RESPONSE_TYPE:"token id_token",SCOPE:"openid profile email"}}};const{APOLITICAL:{WEBSITES:{BETA:n,BETA_2:o,LIVE:i,RC:a}}}=r;let u={auth0Config:null};var l=s(300),p=s.n(l),f=s(25);const E=async t=>{try{let r=!1,n="Error at Apolitical SDK: ";if(t.response){switch(t.response.status){case f.StatusCodes.NOT_FOUND:case f.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:S,ENDPOINTS:{USERS:d}}}}=r;var g={users:{read:async t=>{let e=null;try{({data:e}=await p().get(`${S}${d}/${t}`))}catch(t){await E(t)}return e}}};const{APIS:{MANAGEMENT_API:{BASE_URL:A,ENDPOINTS:{ACCOUNTS:b}}}}=r;var y={accounts:{create:async t=>{try{await p().post(`${A}${b}`,t)}catch(t){await E(t)}},read:async t=>{let e=null;try{({data:e}=await p().get(`${A}${b}/${t}`))}catch(t){await E(t)}return e}}},O=s(408);const P=t=>t&&O.Buffer.from(t,"base64").toString("ascii");function T({authContext:r=null,contentContext:s=null,errorsContext:c=null,origin:l}){r&&(({auth0Configs:t,origin:e=null})=>{u.auth0Config=((t,e)=>{const r=JSON.parse(P(t));let s=null,c=null;switch(s="undefined"!=typeof window?window.origin||window.location.origin:e,s){case n:c=r.beta;break;case o:c=r["beta-2"];break;case i:c=r.live;break;case a:c=r.rc;break;default:c=r.local}return c})(t,e)})(Object.assign({},r,{origin:l})),s&&(0,t.setContext)(Object.assign({},s,{origin:l})),c&&(0,e.setContext)(Object.assign({},c,{origin:l}))}}(),c}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.3.0-beta.1",
3
+ "version": "0.4.0-beta.2",
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",
@@ -26,6 +27,7 @@
26
27
  "dependencies": {
27
28
  "@apolitical/content": "0.3.0",
28
29
  "@apolitical/error-reporting": "0.1.0",
30
+ "auth0-js": "9.19.0",
29
31
  "axios": "0.25.0",
30
32
  "buffer": "6.0.3",
31
33
  "http-status-codes": "2.2.0"