@apolitical/sdk 0.7.0-beta.1 → 0.7.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.7.0] - 2022-03-21
9
+ ### Added
10
+ - Create user course
11
+
8
12
  ## [0.6.0] - 2022-03-09
9
13
  ### Added
10
14
  - List registrations
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,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 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 C},default:function(){return T},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return R},passwordlessLogin:function(){return r.passwordlessLogin},people:function(){return x},reportError:function(){return e.reportError},sendVerificationEmail:function(){return r.sendVerificationEmail}});var t=c(809),e=c(30),r=c(654),n=c(300),o=c.n(n),a={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"}}}};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}`)}},{APIS:{PEOPLE_API:{BASE_URL:s,ENDPOINTS:{REGISTRATIONS:p}}}}=a;var l={list:async t=>{let e=[];try{const{data:r}=await o().get(`${s}${p}`,{params:t});r&&r.length&&(e=r)}catch(t){await i(t)}return e}},f=c(25);const{OK:d,MULTIPLE_CHOICES:S,NOT_FOUND:E,FORBIDDEN:g}=f.StatusCodes,y=t=>t>=d&&t<S||t===g||t===E,{APIS:{PEOPLE_API:{BASE_URL:O,ENDPOINTS:{USERS:P}}}}=a;var A={read:async t=>{let e=null;try{const{data:r}=await o().get(`${O}${P}/${encodeURIComponent(t)}`,{validateStatus:y});r&&r.slug&&(e=r)}catch(t){await i(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL:I,ENDPOINTS:{USERS:h,USER_COURSES:w}}}}=a;var x={registrations:l,users:A,userCourses:{create:async t=>{try{await o().post(`${I}${h}/me${w}`,t)}catch(t){await i(t)}}}};const{APIS:{MANAGEMENT_API:{BASE_URL:N,ENDPOINTS:{ACCOUNTS:m}}}}=a;var R={accounts:{create:async t=>{try{await o().post(`${N}${m}`,t)}catch(t){throw await i(t),t}},read:async t=>{let e=null;try{({data:e}=await o().get(`${N}${m}/${encodeURIComponent(t)}`))}catch(t){await i(t)}return e},update:async(t,e)=>{try{await o().put(`${N}${m}/${encodeURIComponent(t)}`,e)}catch(t){throw await i(t),t}}}},b=c(408);const C=t=>t&&b.Buffer.from(t,"base64").toString("ascii");function T({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}))}}(),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,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 C},default:function(){return v},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 $},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",USER_COURSES:"/courses",REGISTRATIONS:"/registrations"}},PEOPLE_ENGAGEMENT_API:{BASE_URL:"/api/people-engagement-api",ENDPOINTS:{USERS:"/users",USER_PROPERTIES:"/properties"}}}};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}`)}},{APIS:{MANAGEMENT_API:{BASE_URL:s,ENDPOINTS:{ACCOUNTS:p}}}}=a;var l={accounts:{create:async t=>{try{await o().post(`${s}${p}`,t)}catch(t){throw await i(t),t}},read:async t=>{let e=null;try{({data:e}=await o().get(`${s}${p}/${encodeURIComponent(t)}`))}catch(t){await i(t)}return e},update:async(t,e)=>{try{await o().put(`${s}${p}/${encodeURIComponent(t)}`,e)}catch(t){throw await i(t),t}}}};const{APIS:{PEOPLE_API:{BASE_URL:E,ENDPOINTS:{REGISTRATIONS:S}}}}=a;var f={list:async t=>{let e=[];try{const{data:r}=await o().get(`${E}${S}`,{params:t});r&&r.length&&(e=r)}catch(t){await i(t)}return e}},d=u(25);const{OK:P,MULTIPLE_CHOICES:g,NOT_FOUND:O,FORBIDDEN:A}=d.StatusCodes,I=t=>t>=P&&t<g||t===A||t===O,{APIS:{PEOPLE_API:{BASE_URL:y,ENDPOINTS:{USERS:N}}}}=a;var R={read:async t=>{let e=null;try{const{data:r}=await o().get(`${y}${N}/${encodeURIComponent(t)}`,{validateStatus:I});r&&r.slug&&(e=r)}catch(t){await i(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL:_,ENDPOINTS:{USERS:h,USER_COURSES:w}}}}=a;var T={registrations:f,users:R,userCourses:{create:async(t,e)=>{try{await o().post(`${_}${h}/${t}${w}`,e)}catch(t){await i(t)}}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:U,ENDPOINTS:{USERS:m,USER_PROPERTIES:x}}}}=a;var $={userProperties:{update:async(t,e)=>{try{await o().put(`${U}${m}/me${x}/${t}`,e)}catch(t){await i(t)}}}},b=u(408);const C=t=>t&&b.Buffer.from(t,"base64").toString("ascii");function v({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.7.0-beta.1",
3
+ "version": "0.7.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",