@apolitical/sdk 0.0.1-beta.7 → 0.0.1-beta.8

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 +2 -11
package/build/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):"function"==typeof define&&define.amd?define(["@apolitical/error-reporting","axios","http-status-codes"],t):"object"==typeof exports?exports.ApoliticalSDK=t(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):e.ApoliticalSDK=t(e["@apolitical/error-reporting"],e.axios,e["http-status-codes"])}(this,(function(e,t,r){return function(){"use strict";var o={30:function(t){t.exports=e},300:function(e){e.exports=t},25:function(e){e.exports=r}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return function(){i.r(a),i.d(a,{default:function(){return x},people:function(){return E},reportError:function(){return y},setContext:function(){return g},template:function(){return S}});var e=i(30),t=i(300),r=i.n(t),o={APIS:{BACKEND_TEMPLATE:{BASE_URL:"/api/backend-template",ENDPOINTS:{DUMMY:"/dummy"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}}},n=i(25);const s=async t=>{let r=!1,o="Error at Apolitical SDK: ";if(t.response){switch(t.response.status){case n.StatusCodes.NOT_FOUND:case n.StatusCodes.FORBIDDEN:r=!0}o+=JSON.stringify(t.response)}else t.request?o+=JSON.stringify(t.request):o+=t.message;if(console.warn(o),!r)try{await(0,e.reportError)(new Error(o))}catch(e){console.warn(`Cannot report error: ${e.message}`)}},{APIS:{PEOPLE_API:{BASE_URL:u,ENDPOINTS:{USERS:p}}}}=o;var c={getUser:async e=>{let t=null;try{({data:t}=await r().get(`${u}${p}/${e}`))}catch(e){await s(e)}return t}};const{APIS:{BACKEND_TEMPLATE:{BASE_URL:l,ENDPOINTS:{DUMMY:f}}}}=o,d={people:c,template:{ping:async()=>{let e=null;try{({data:e}=await r().get(`${l}${f}`))}catch(e){await s(e)}return e}},reportError:e.reportError,setContext:({origin:t,gcpErrorsApiKey:r,serviceName:o})=>{(0,e.setContext)({origin:t,accessToken:r,serviceName:o})}},{people:E,template:S,reportError:y,setContext:g}=d;var x=d}(),a}()}));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):"function"==typeof define&&define.amd?define(["@apolitical/error-reporting","axios","http-status-codes"],r):"object"==typeof exports?exports.ApoliticalSDK=r(require("@apolitical/error-reporting"),require("axios"),require("http-status-codes")):e.ApoliticalSDK=r(e["@apolitical/error-reporting"],e.axios,e["http-status-codes"])}(this,(function(e,r,t){return function(){"use strict";var o={30:function(r){r.exports=e},300:function(e){e.exports=r},25:function(e){e.exports=t}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,a),t.exports}a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,{a:r}),r},a.d=function(e,r){for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){a.r(i),a.d(i,{default:function(){return E}});var e=a(30),r=a(300),t=a.n(r),o={APIS:{BACKEND_TEMPLATE:{BASE_URL:"/api/backend-template",ENDPOINTS:{DUMMY:"/dummy"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}}},n=a(25);const s=async r=>{try{let t=!1,o="Error at Apolitical SDK: ";if(r.response){switch(r.response.status){case n.StatusCodes.NOT_FOUND:case n.StatusCodes.FORBIDDEN:t=!0}o+=JSON.stringify(r.response)}else r.request?o+=JSON.stringify(r.request):o+=r.message;if(console.warn(o),t)return;await(0,e.reportError)(new Error(o))}catch(e){console.warn(`Cannot handle error: ${e.message}`)}},{APIS:{PEOPLE_API:{BASE_URL:u,ENDPOINTS:{USERS:c}}}}=o;var p={user:{read:async e=>{let r=null;try{({data:r}=await t().get(`${u}${c}/${e}`))}catch(e){await s(e)}return r}}};const{APIS:{BACKEND_TEMPLATE:{BASE_URL:l,ENDPOINTS:{DUMMY:f}}}}=o;var d={people:p,template:{dummy:{read:async()=>{let e=null;try{({data:e}=await t().get(`${l}${f}`))}catch(e){await s(e)}return e}}}};function E({origin:r,gcpErrorsApiKey:t,serviceName:o}){return(0,e.setContext)({origin:r,accessToken:t,serviceName:o}),{...d,reportError:e.reportError}}}(),i}()}));
package/package.json CHANGED
@@ -1,17 +1,8 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.0.1-beta.7",
3
+ "version": "0.0.1-beta.8",
4
4
  "description": "Browser library to interact with Apolitical's APIs",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
- "contributors": [
7
- "Anouska Hopkins <anouska.hopkins@apolitical.co>",
8
- "Antonio Cordasco <antonio.cordasco@apolitical.co>",
9
- "Dorothy Yau <dorothy.yau@apolitical.co>",
10
- "Laura Hanna-White <laura.hanna-white@apolitical.co>",
11
- "Fatimat Gbajabiamila <fatimat.gbajabiamila@apolitical.co>",
12
- "Renzo Rozza <renzo.rozza@apolitical.co>",
13
- "Rihards Jukna <rihards.jukna@apolitical.co>"
14
- ],
15
6
  "license": "MIT",
16
7
  "main": "build/index.js",
17
8
  "files": [
@@ -51,7 +42,7 @@
51
42
  "husky": "7.0.4",
52
43
  "jest": "27.4.7",
53
44
  "jest-junit": "13.0.0",
54
- "lint-staged": "12.1.5",
45
+ "lint-staged": "12.1.7",
55
46
  "webpack": "5.65.0",
56
47
  "webpack-cli": "4.9.1"
57
48
  },