@nangohq/node 0.6.0 → 0.6.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/dist/index.d.ts +5 -5
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class Nango {
|
|
2
2
|
serverUrl: string;
|
|
3
3
|
secretKey: string;
|
|
4
4
|
constructor(serverUrl?: string, secretKey?: string);
|
|
@@ -9,15 +9,15 @@ export declare class Pizzly {
|
|
|
9
9
|
* For OAuth 2: returns the access token directly as a string.
|
|
10
10
|
* For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
getToken(providerConfigKey: string, connectionId: string): Promise<any>;
|
|
13
13
|
/**
|
|
14
14
|
* Get the full (fresh) credentials payload returned by the external API, which also contains access credentials.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
getRawTokenResponse(providerConfigKey: string, connectionId: string): Promise<any>;
|
|
17
17
|
/**
|
|
18
18
|
* Get the Connection object, which also contains access credentials and full credentials payload returned by the external API.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
private
|
|
20
|
+
getConnection(providerConfigKey: string, connectionId: string): Promise<any>;
|
|
21
|
+
private getConnectionDetails;
|
|
22
22
|
private enrichHeaders;
|
|
23
23
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
export class
|
|
2
|
+
export class Nango {
|
|
3
3
|
serverUrl;
|
|
4
4
|
secretKey;
|
|
5
5
|
constructor(serverUrl, secretKey = '') {
|
|
@@ -11,7 +11,7 @@ export class Pizzly {
|
|
|
11
11
|
new URL(this.serverUrl);
|
|
12
12
|
}
|
|
13
13
|
catch (err) {
|
|
14
|
-
throw new Error(`Invalid URL provided for the
|
|
14
|
+
throw new Error(`Invalid URL provided for the Nango host: ${this.serverUrl}`);
|
|
15
15
|
}
|
|
16
16
|
this.secretKey = secretKey;
|
|
17
17
|
}
|
|
@@ -22,8 +22,8 @@ export class Pizzly {
|
|
|
22
22
|
* For OAuth 2: returns the access token directly as a string.
|
|
23
23
|
* For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
|
|
24
24
|
*/
|
|
25
|
-
async
|
|
26
|
-
let response = await this.
|
|
25
|
+
async getToken(providerConfigKey, connectionId) {
|
|
26
|
+
let response = await this.getConnectionDetails(providerConfigKey, connectionId);
|
|
27
27
|
switch (response.data.credentials.type) {
|
|
28
28
|
case 'OAUTH2':
|
|
29
29
|
return response.data.credentials.access_token;
|
|
@@ -36,18 +36,18 @@ export class Pizzly {
|
|
|
36
36
|
/**
|
|
37
37
|
* Get the full (fresh) credentials payload returned by the external API, which also contains access credentials.
|
|
38
38
|
*/
|
|
39
|
-
async
|
|
40
|
-
let response = await this.
|
|
39
|
+
async getRawTokenResponse(providerConfigKey, connectionId) {
|
|
40
|
+
let response = await this.getConnectionDetails(providerConfigKey, connectionId);
|
|
41
41
|
return response.data.credentials.raw;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Get the Connection object, which also contains access credentials and full credentials payload returned by the external API.
|
|
45
45
|
*/
|
|
46
|
-
async
|
|
47
|
-
let response = await this.
|
|
46
|
+
async getConnection(providerConfigKey, connectionId) {
|
|
47
|
+
let response = await this.getConnectionDetails(providerConfigKey, connectionId);
|
|
48
48
|
return response.data;
|
|
49
49
|
}
|
|
50
|
-
async
|
|
50
|
+
async getConnectionDetails(providerConfigKey, connectionId) {
|
|
51
51
|
let url = `${this.serverUrl}/connection/${connectionId}`;
|
|
52
52
|
let headers = {
|
|
53
53
|
'Content-Type': 'application/json'
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","s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