@apolitical/sdk 0.4.0-beta.5 → 0.4.0-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.
- package/CHANGELOG.md +5 -0
- package/README.md +7 -4
- package/build/index.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ 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.4.0] - 2022-02-22
|
|
9
|
+
### Added
|
|
10
|
+
- Auth0 Web Auth
|
|
11
|
+
- Create account in Management API
|
|
12
|
+
|
|
8
13
|
## [0.3.0] - 2022-02-08
|
|
9
14
|
### Added
|
|
10
15
|
- Management API Accounts Resource
|
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ yarn add @apolitical/sdk
|
|
|
23
23
|
## Available Scripts
|
|
24
24
|
|
|
25
25
|
In the project directory, you can run:
|
|
26
|
+
|
|
26
27
|
### `yarn run test`
|
|
27
28
|
|
|
28
29
|
Runs the test (and the interactive mode can be enabled with `--watchAll`).
|
|
@@ -45,15 +46,17 @@ const loadSdk = require('@apolitical/sdk');
|
|
|
45
46
|
|
|
46
47
|
const sdk = loadSdk({
|
|
47
48
|
origin: window.origin || window.location.origin,
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
errorsContext: {
|
|
50
|
+
apiKey: decodeBase64(process.env.REACT_APP_GCP_ERRORS_API_KEY),
|
|
51
|
+
serviceName: 'some-service',
|
|
52
|
+
},
|
|
50
53
|
});
|
|
51
54
|
```
|
|
52
55
|
|
|
53
56
|
And then, you can use all the functionality provided by the SDK. For example:
|
|
54
57
|
|
|
55
58
|
```js
|
|
56
|
-
sdk.
|
|
57
|
-
console.info('
|
|
59
|
+
sdk.people.users.read('me').then((result) => {
|
|
60
|
+
console.info('User:', result);
|
|
58
61
|
});
|
|
59
62
|
```
|
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("
|
|
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}},u={};function s(t){var e=u[t];if(void 0!==e)return e.exports;var r=u[t]={exports:{}};return a[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 y},default:function(){return x},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return g},people:function(){return f},reportError:function(){return e.reportError}});var t=s(809),e=s(30),r=s(654),n=s(300),o=s.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=s(25);const u=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 u(t)}return e}}};const{APIS:{MANAGEMENT_API:{BASE_URL:d,ENDPOINTS:{ACCOUNTS:S}}}}=i;var g={accounts:{create:async t=>{try{await o().post(`${d}${S}`,t),await(0,r.sendVerificationEmail)(t.email,!1,!0)}catch(t){throw await u(t),t}},read:async t=>{let e=null;try{({data:e}=await o().get(`${d}${S}/${t}`))}catch(t){await u(t)}return e}}},E=s(408);const y=t=>t&&E.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}()}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apolitical/sdk",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.8",
|
|
4
4
|
"description": "Browser library to interact with Apolitical's APIs",
|
|
5
5
|
"author": "Apolitical Group Limited <engineering@apolitical.co>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,14 +25,15 @@
|
|
|
25
25
|
"SDK"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@apolitical/auth": "0.0.1-beta.4",
|
|
28
29
|
"@apolitical/content": "0.3.0",
|
|
29
30
|
"@apolitical/error-reporting": "0.1.0",
|
|
30
|
-
"auth0-js": "9.19.0",
|
|
31
31
|
"axios": "0.25.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-beta.4",
|
|
36
37
|
"@apolitical/content": "0.3.0",
|
|
37
38
|
"@apolitical/error-reporting": "0.1.0",
|
|
38
39
|
"axios": "0.25.0",
|