@apolitical/sdk 0.8.0-beta.2 → 0.8.0-beta.3

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.
Files changed (2) hide show
  1. package/build/index.js +1 -1
  2. package/package.json +1 -1
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,a,o){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=o},25:function(t){t.exports=a}},s={};function c(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return i[t](r,r.exports,c),r.exports}c.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return c.d(e,{a:e}),e},c.d=function(t,e){for(var r in e)c.o(e,r)&&!c.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},c.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},c.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(){c.r(u),c.d(u,{decodeBase64:function(){return v},default:function(){return q},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return l},passwordlessLogin:function(){return r.passwordlessLogin},people:function(){return $},peopleEngagement:function(){return b},reportError:function(){return e.reportError},sendVerificationEmail:function(){return r.sendVerificationEmail}});var t=c(809),e=c(30),r=c(654),n=c(300),a=c.n(n),o={APIS:{MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users",USER_COURSES:"/courses",REGISTRATIONS:"/registrations"}},PEOPLE_ENGAGEMENT_API:{BASE_URL:"/api/people-engagement-api",ENDPOINTS:{USERS:"/users",USER_PROPERTIES:"/properties"}}},USERS:{MYSELF_SLUG:"me"}};const i=async t=>{try{const{message:r,response:n,request:a}=t;let o=r;n?o+=` - The request was made and the server responded with ${JSON.stringify({status:n.status,data:n.data})}`:a&&(o+=" - The request was made but no response was received"),console.warn(o),await(0,e.reportError)(new Error(o))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}},{APIS:{MANAGEMENT_API:{BASE_URL:s,ENDPOINTS:{ACCOUNTS:p}}}}=o;var l={accounts:{create:async t=>{try{await a().post(`${s}${p}`,t)}catch(t){throw await i(t),t}},read:async t=>{let e=null;try{({data:e}=await a().get(`${s}${p}/${encodeURIComponent(t)}`))}catch(t){await i(t)}return e},update:async(t,e)=>{try{await a().put(`${s}${p}/${encodeURIComponent(t)}`,e)}catch(t){throw await i(t),t}}}};const{APIS:{PEOPLE_API:{BASE_URL:E,ENDPOINTS:{REGISTRATIONS:S}}}}=o;var f={list:async t=>{let e=[];try{const{data:r}=await a().get(`${E}${S}`,{params:t});r&&r.length&&(e=r)}catch(t){await i(t)}return e}},d=c(25);const{OK:P,MULTIPLE_CHOICES:g,NOT_FOUND:O,FORBIDDEN:y}=d.StatusCodes,A=t=>t>=P&&t<g||t===y||t===O,{APIS:{PEOPLE_API:{BASE_URL:I,ENDPOINTS:{USERS:R}}}}=o;var N={read:async t=>{let e=null;try{const{data:r}=await a().get(`${I}${R}/${encodeURIComponent(t)}`,{validateStatus:A});r&&r.slug&&(e=r)}catch(t){await i(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL:U,ENDPOINTS:{USERS:_,USER_COURSES:h}}},USERS:{MYSELF_SLUG:w}}=o;var $={registrations:f,users:N,userCourses:{create:async t=>{try{await a().post(`${U}${_}/${w}${h}`,t)}catch(t){await i(t)}},list:async(t,e)=>{let r=[];try{const{data:t}=await a().get(`${U}${_}/${w}${h}`,{params:e});t&&t.length&&(r=t)}catch(t){await i(t)}return r}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:m,ENDPOINTS:{USERS:T,USER_PROPERTIES:x}}},USERS:{MYSELF_SLUG:L}}=o;var b={userProperties:{update:async(t,e)=>{try{await a().put(`${m}${T}/${L}${x}/${t}`,e)}catch(t){await i(t)}}}},C=c(408);const v=t=>t&&C.Buffer.from(t,"base64").toString("ascii");function q({authContext:n=null,contentContext:a=null,errorsContext:o=null,origin:i}){n&&(0,r.setContext)(Object.assign({},n,{origin:i})),a&&(0,t.setContext)(Object.assign({},a,{origin:i})),o&&(0,e.setContext)(Object.assign({},o,{origin:i}))}}(),u}()}));
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,a,o){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=o},25:function(t){t.exports=a}},s={};function c(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return i[t](r,r.exports,c),r.exports}c.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return c.d(e,{a:e}),e},c.d=function(t,e){for(var r in e)c.o(e,r)&&!c.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},c.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},c.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(){c.r(u),c.d(u,{decodeBase64:function(){return q},default:function(){return D},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return l},passwordlessLogin:function(){return r.passwordlessLogin},people:function(){return T},peopleEngagement:function(){return C},reportError:function(){return e.reportError},sendVerificationEmail:function(){return r.sendVerificationEmail}});var t=c(809),e=c(30),r=c(654),n=c(300),a=c.n(n),o={APIS:{MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users",USER_COURSES:"/courses",REGISTRATIONS:"/registrations"}},PEOPLE_ENGAGEMENT_API:{BASE_URL:"/api/people-engagement-api",ENDPOINTS:{USERS:"/users",USER_PROPERTIES:"/properties"}}},USERS:{MYSELF_SLUG:"me"}};const i=async t=>{try{const{message:r,response:n,request:a}=t;let o=r;n?o+=` - The request was made and the server responded with ${JSON.stringify({status:n.status,data:n.data})}`:a&&(o+=" - The request was made but no response was received"),console.warn(o),await(0,e.reportError)(new Error(o))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}},{APIS:{MANAGEMENT_API:{BASE_URL:s,ENDPOINTS:{ACCOUNTS:p}}}}=o;var l={accounts:{create:async t=>{try{await a().post(`${s}${p}`,t)}catch(t){throw await i(t),t}},read:async t=>{let e=null;try{({data:e}=await a().get(`${s}${p}/${encodeURIComponent(t)}`))}catch(t){await i(t)}return e},update:async(t,e)=>{try{await a().put(`${s}${p}/${encodeURIComponent(t)}`,e)}catch(t){throw await i(t),t}}}};const{APIS:{PEOPLE_API:{BASE_URL:E,ENDPOINTS:{REGISTRATIONS:S}}}}=o;var f={list:async t=>{let e=[];try{const{data:r}=await a().get(`${E}${S}`,{params:t});r&&r.length&&(e=r)}catch(t){await i(t)}return e}},d=c(25);const{OK:P,MULTIPLE_CHOICES:g,NOT_FOUND:O,FORBIDDEN:y}=d.StatusCodes,A=t=>t>=P&&t<g||t===y||t===O,{APIS:{PEOPLE_API:{BASE_URL:I,ENDPOINTS:{USERS:R}}}}=o;var N={read:async t=>{let e=null;try{const{data:r}=await a().get(`${I}${R}/${encodeURIComponent(t)}`,{validateStatus:A});r&&r.slug&&(e=r)}catch(t){await i(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL:U,ENDPOINTS:{USERS:_,USER_COURSES:h}}},USERS:{MYSELF_SLUG:w}}=o,m=`${U}${_}/${w}${h}`;var T={registrations:f,users:N,userCourses:{create:async t=>{try{await a().post(m,t)}catch(t){await i(t)}},list:async t=>{let e=[];try{const{data:r}=await a().get(m,{params:t});r&&r.length&&(e=r)}catch(t){await i(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:x,ENDPOINTS:{USERS:L,USER_PROPERTIES:$}}},USERS:{MYSELF_SLUG:b}}=o;var C={userProperties:{update:async(t,e)=>{try{await a().put(`${x}${L}/${b}${$}/${t}`,e)}catch(t){await i(t)}}}},v=c(408);const q=t=>t&&v.Buffer.from(t,"base64").toString("ascii");function D({authContext:n=null,contentContext:a=null,errorsContext:o=null,origin:i}){n&&(0,r.setContext)(Object.assign({},n,{origin:i})),a&&(0,t.setContext)(Object.assign({},a,{origin:i})),o&&(0,e.setContext)(Object.assign({},o,{origin:i}))}}(),u}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.8.0-beta.2",
3
+ "version": "0.8.0-beta.3",
4
4
  "description": "Browser library to interact with Apolitical's APIs",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",