@allthings/sdk 8.0.0 → 8.1.1
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/README.md +49 -44
- package/dist/cli.js +400 -330
- package/dist/lib.cjs.js +398 -328
- package/dist/lib.esm.js +398 -328
- package/dist/lib.umd.min.js +1 -1
- package/dist/src/oauth/authorizationCodeGrant.d.ts +4 -4
- package/dist/src/oauth/implicitGrant.d.ts +2 -2
- package/dist/src/oauth/makeFetchTokenRequester.d.ts +1 -1
- package/dist/src/oauth/passwordGrant.d.ts +2 -2
- package/dist/src/oauth/refreshTokenGrant.d.ts +2 -2
- package/dist/src/oauth/types.d.ts +1 -1
- package/dist/src/rest/delete.d.ts +2 -6
- package/dist/src/rest/get.d.ts +2 -6
- package/dist/src/rest/methods/conversation.d.ts +0 -2
- package/dist/src/rest/methods/file.d.ts +0 -2
- package/dist/src/rest/methods/idLookup.d.ts +1 -3
- package/dist/src/rest/methods/ticket.d.ts +0 -2
- package/dist/src/rest/methods/user.d.ts +2 -6
- package/dist/src/rest/patch.d.ts +2 -6
- package/dist/src/rest/post.d.ts +2 -6
- package/dist/src/rest/put.d.ts +2 -6
- package/dist/src/rest/request.d.ts +2 -7
- package/dist/src/rest/types.d.ts +1 -1
- package/dist/src/utils/functional.d.ts +3 -4
- package/dist/src/utils/logger.d.ts +0 -1
- package/dist/src/utils/object.d.ts +1 -5
- package/dist/src/utils/upload.d.ts +0 -2
- package/package.json +35 -36
package/README.md
CHANGED
|
@@ -4,19 +4,19 @@ Allthings Node/Javascript SDK
|
|
|
4
4
|
|
|
5
5
|
## Contents
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
|
|
7
|
+
1. [Installation & Usage](#installation--usage)
|
|
8
|
+
2. [Configuration](#configuration)
|
|
9
9
|
1. [Options](#configuration-options)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
3. [Authentication](#authentication)
|
|
11
|
+
4. [API](#api)
|
|
12
|
+
5. [OAuth Implicit Grant Example](#oauth-implicit-grant-example-example)
|
|
13
|
+
6. [OAuth Authorization Code Grant Example](#oauth-authorization-code-grant-example)
|
|
14
|
+
7. [Release management & versioning](#release-management--versioning)
|
|
15
15
|
|
|
16
16
|
## Installation & Usage
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
yarn add @allthings/sdk
|
|
19
|
+
yarn add -DE @allthings/sdk
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
```javascript
|
|
@@ -31,20 +31,6 @@ client
|
|
|
31
31
|
.then((viewer) => console.log(`Welcome back ${viewer.username}!`))
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
<!--
|
|
35
|
-
```javascript
|
|
36
|
-
const allthingsSdk = require('@allthings/sdk')
|
|
37
|
-
|
|
38
|
-
const allthings = allthingsSdk({
|
|
39
|
-
accessToken: '043dab7447450772example1214b552838003522',
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
allthings.query.viewer().then(viewer =>
|
|
43
|
-
console.log(`Welcome back ${viewer.username}!`)
|
|
44
|
-
)
|
|
45
|
-
```
|
|
46
|
-
-->
|
|
47
|
-
|
|
48
34
|
## Configuration
|
|
49
35
|
|
|
50
36
|
### Request logs
|
|
@@ -58,7 +44,7 @@ value can be anything which is truthy.
|
|
|
58
44
|
The available configuration options are outlined here:
|
|
59
45
|
|
|
60
46
|
| Option | Default | Description |
|
|
61
|
-
|
|
47
|
+
|------------------|---------|---------------------------------------------------------------------------------------------------------------------------------|
|
|
62
48
|
| **accessToken** | | API Access Token |
|
|
63
49
|
| **clientId** | | OAuth 2.0 clientId |
|
|
64
50
|
| **clientSecret** | | OAuth 2.0 client secret |
|
|
@@ -95,23 +81,23 @@ client
|
|
|
95
81
|
## OAuth Authorization Code Grant Example
|
|
96
82
|
|
|
97
83
|
1. Initialize instance of `client`:
|
|
98
|
-
|
|
99
|
-
```javascript
|
|
100
|
-
const allthings = require('@allthings/sdk')
|
|
101
|
-
|
|
102
|
-
const client = allthings.restClient({
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
})
|
|
107
|
-
```
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
const allthings = require('@allthings/sdk')
|
|
87
|
+
|
|
88
|
+
const client = allthings.restClient({
|
|
89
|
+
clientId: '5d038ef2441f4de574005c54_example',
|
|
90
|
+
clientSecret: '40f63f981ff082dbc8d273983ac3852c2e51e90856123156',
|
|
91
|
+
redirectUri: 'https://example-app.com/callback',
|
|
92
|
+
})
|
|
93
|
+
```
|
|
108
94
|
|
|
109
95
|
2. Construct a URI to send authorization request to using a `state` which should be unique per request and hard to guess. It can be generated with `client.oauth.generateState()` method:
|
|
110
96
|
|
|
111
|
-
```javascript
|
|
112
|
-
const state = client.oauth.generateState()
|
|
113
|
-
const authorizationUri = client.oauth.authorizationCode.getUri(state)
|
|
114
|
-
```
|
|
97
|
+
```javascript
|
|
98
|
+
const state = client.oauth.generateState()
|
|
99
|
+
const authorizationUri = client.oauth.authorizationCode.getUri(state)
|
|
100
|
+
```
|
|
115
101
|
|
|
116
102
|
3. Direct user's browser to the constructed URI.
|
|
117
103
|
|
|
@@ -476,14 +462,33 @@ See semantic-releases [docs](https://github.com/semantic-release/semantic-releas
|
|
|
476
462
|
|
|
477
463
|
### Development release
|
|
478
464
|
|
|
479
|
-
|
|
465
|
+
1. **Create or check out the target branch** from the commit you want to release:
|
|
480
466
|
|
|
481
|
-
```sh
|
|
482
|
-
|
|
483
|
-
```
|
|
467
|
+
```sh
|
|
468
|
+
git checkout -b beta # or alpha / next
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
2. **Push the branch** to trigger the CI pipeline:
|
|
472
|
+
|
|
473
|
+
```sh
|
|
474
|
+
git push --force origin HEAD:beta # or alpha / next
|
|
475
|
+
```
|
|
484
476
|
|
|
485
|
-
|
|
477
|
+
The pipeline will automatically run `semantic-release`, which detects the branch name, bumps the version with the appropriate pre-release tag, and publishes it to npm under the matching dist-tag. Check [Actions page](https://github.com/allthings/cloud-toolkit/actions) for the release logs.
|
|
486
478
|
|
|
479
|
+
3. **Install the pre-release** in another project:
|
|
480
|
+
|
|
481
|
+
```sh
|
|
482
|
+
npm install @allthings/cloud-toolkit@beta # or @alpha / @next
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
or use exact release (check [versions on npm](https://www.npmjs.com/package/@allthings/cloud-toolkit?activeTab=versions)):
|
|
486
|
+
|
|
487
|
+
```sh
|
|
488
|
+
npm install @allthings/cloud-toolkit@x.x.x-beta.x
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
4. **Promote to stable** – once the pre-release is validated, create a PR form your target branch.
|
|
487
492
|
|
|
488
493
|
## Local tests
|
|
489
494
|
|
|
@@ -498,9 +503,9 @@ ALLTHINGS_OAUTH_PASSWORD="<oauth_password>" \
|
|
|
498
503
|
|
|
499
504
|
```
|
|
500
505
|
|
|
501
|
-
if you don't want to init the shell, please also provide next env variables to command as well:
|
|
506
|
+
if you don't want to init the shell, please also provide next env variables to command as well:
|
|
507
|
+
|
|
502
508
|
- ALLTHINGS_ACCOUNTS_RECAPTCHA_SECRET_KEY
|
|
503
509
|
- SSL_PASS
|
|
504
510
|
|
|
505
511
|
Credentials could be found in `dev.secrets` repo.
|
|
506
|
-
|