@apolitical/sdk 0.4.1 → 0.5.1-rc-00

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,14 @@ 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.5.1] - 2022-03-08
9
+ ### Updated
10
+ - @apolitical/auth version
11
+
12
+ ## [0.5.0] - 2022-03-03
13
+ ### Added
14
+ - Update account functionality
15
+
8
16
  ## [0.4.1] - 2022-02-28
9
17
  ### Added
10
18
  - Expose `sendVerificationEmail` from auth module
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("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","@apolitical/auth","axios","http-status-codes","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t["@apolitical/auth"],t.axios,t["http-status-codes"],t.buffer)}(this,(function(t,e,r,n,o,i){return function(){"use strict";var a={654:function(t){t.exports=r},809:function(e){e.exports=t},30:function(t){t.exports=e},300:function(t){t.exports=n},408:function(t){t.exports=i},25:function(t){t.exports=o}},s={};function u(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return a[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 c={};return function(){u.r(c),u.d(c,{decodeBase64:function(){return y},default:function(){return x},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return E},passwordlessLogin:function(){return r.passwordlessLogin},people:function(){return f},reportError:function(){return e.reportError},sendVerificationEmail:function(){return r.sendVerificationEmail}});var t=u(809),e=u(30),r=u(654),n=u(300),o=u.n(n),i={APIS:{MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}}},a=u(25);const s=async t=>{try{let r=!1,n="Error at Apolitical SDK: ";if(t.response){switch(t.response.status){case a.StatusCodes.NOT_FOUND:case a.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:l,ENDPOINTS:{USERS:p}}}}=i;var f={users:{read:async t=>{let e=null;try{({data:e}=await o().get(`${l}${p}/${t}`))}catch(t){await s(t)}return e}}};const{APIS:{MANAGEMENT_API:{BASE_URL:d,ENDPOINTS:{ACCOUNTS:g}}}}=i;var E={accounts:{create:async t=>{try{await o().post(`${d}${g}`,t)}catch(t){throw await s(t),t}},read:async t=>{let e=null;try{({data:e}=await o().get(`${d}${g}/${t}`))}catch(t){await s(t)}return e}}},S=u(408);const y=t=>t&&S.Buffer.from(t,"base64").toString("ascii");function x({authContext:n=null,contentContext:o=null,errorsContext:i=null,origin:a}){n&&(0,r.setContext)(Object.assign({},n,{origin:a})),o&&(0,t.setContext)(Object.assign({},o,{origin:a})),i&&(0,e.setContext)(Object.assign({},i,{origin:a}))}}(),c}()}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","@apolitical/auth","axios","http-status-codes","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t["@apolitical/auth"],t.axios,t["http-status-codes"],t.buffer)}(this,(function(t,e,r,n,o,a){return function(){"use strict";var i={654:function(t){t.exports=r},809:function(e){e.exports=t},30:function(t){t.exports=e},300:function(t){t.exports=n},408:function(t){t.exports=a},25:function(t){t.exports=o}},s={};function u(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[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 c={};return function(){u.r(c),u.d(c,{decodeBase64:function(){return w},default:function(){return b},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return O},passwordlessLogin:function(){return r.passwordlessLogin},people:function(){return y},reportError:function(){return e.reportError},sendVerificationEmail:function(){return r.sendVerificationEmail}});var t=u(809),e=u(30),r=u(654),n=u(300),o=u.n(n),a={APIS:{MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}}};const i=async t=>{try{const{message:r,response:n,request:o}=t;let a=r;n?a+=` - The request was made and the server responded with ${JSON.stringify({status:n.status,data:n.data})}`:o&&(a+=" - The request was made but no response was received"),console.warn(a),await(0,e.reportError)(new Error(a))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}};var s=u(25);const{OK:p,MULTIPLE_CHOICES:l,NOT_FOUND:f,FORBIDDEN:d}=s.StatusCodes,g=t=>t>=p&&t<l||t===d||t===f,{APIS:{PEOPLE_API:{BASE_URL:E,ENDPOINTS:{USERS:S}}}}=a;var y={users:{read:async t=>{let e=null;try{const{data:r}=await o().get(`${E}${S}/${encodeURIComponent(t)}`,{validateStatus:g});r&&r.slug&&(e=r)}catch(t){await i(t)}return e}}};const{APIS:{MANAGEMENT_API:{BASE_URL:x,ENDPOINTS:{ACCOUNTS:h}}}}=a;var O={accounts:{create:async t=>{try{await o().post(`${x}${h}`,t)}catch(t){throw await i(t),t}},read:async t=>{let e=null;try{({data:e}=await o().get(`${x}${h}/${encodeURIComponent(t)}`))}catch(t){await i(t)}return e},update:async(t,e)=>{try{await o().put(`${x}${h}/${encodeURIComponent(t)}`,e)}catch(t){throw await i(t),t}}}},m=u(408);const w=t=>t&&m.Buffer.from(t,"base64").toString("ascii");function b({authContext:n=null,contentContext:o=null,errorsContext:a=null,origin:i}){n&&(0,r.setContext)(Object.assign({},n,{origin:i})),o&&(0,t.setContext)(Object.assign({},o,{origin:i})),a&&(0,e.setContext)(Object.assign({},a,{origin:i}))}}(),c}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.4.1",
3
+ "version": "0.5.1-rc-00",
4
4
  "description": "Browser library to interact with Apolitical's APIs",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -28,15 +28,15 @@
28
28
  "@apolitical/auth": "0.0.1",
29
29
  "@apolitical/content": "0.3.0",
30
30
  "@apolitical/error-reporting": "0.1.0",
31
- "axios": "0.25.0",
31
+ "axios": "0.26.0",
32
32
  "buffer": "6.0.3",
33
33
  "http-status-codes": "2.2.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@apolitical/auth": "0.0.1",
36
+ "@apolitical/auth": "0.0.2-rc-00",
37
37
  "@apolitical/content": "0.3.0",
38
38
  "@apolitical/error-reporting": "0.1.0",
39
- "axios": "0.25.0",
39
+ "axios": "0.26.0",
40
40
  "buffer": "6.0.3",
41
41
  "http-status-codes": "2.2.0"
42
42
  },