@nangohq/node 0.9.0 → 0.15.0
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 +29 -10
- package/dist/index.js +87 -19
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +26 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +9 -0
- package/dist/utils.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProxyConfiguration } from './types';
|
|
1
2
|
export declare class Nango {
|
|
2
3
|
serverUrl: string;
|
|
3
4
|
secretKey: string;
|
|
@@ -6,21 +7,39 @@ export declare class Nango {
|
|
|
6
7
|
secretKey?: string;
|
|
7
8
|
});
|
|
8
9
|
/**
|
|
9
|
-
* Get fresh access credentials to authenticate your requests.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
10
|
* For OAuth 2: returns the access token directly as a string.
|
|
11
|
+
* For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
|
|
12
|
+
* you can set the forceRefresh argument to true."
|
|
13
13
|
* For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
15
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
16
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
17
|
+
* you can set the forceRefresh argument to true.
|
|
18
|
+
* */
|
|
19
|
+
getToken(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
|
|
16
20
|
/**
|
|
17
|
-
* Get the full (fresh) credentials payload returned by the external API,
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
* Get the full (fresh) credentials payload returned by the external API,
|
|
22
|
+
* which also contains access credentials.
|
|
23
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
24
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
25
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
26
|
+
* you can set the forceRefresh argument to true.
|
|
27
|
+
* */
|
|
28
|
+
getRawTokenResponse(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
|
|
20
29
|
/**
|
|
21
|
-
* Get the Connection object, which also contains access credentials and full credentials payload
|
|
30
|
+
* Get the Connection object, which also contains access credentials and full credentials payload
|
|
31
|
+
* returned by the external API.
|
|
32
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
33
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
34
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
35
|
+
* you can set the forceRefresh argument to true.
|
|
22
36
|
*/
|
|
23
|
-
getConnection(providerConfigKey: string, connectionId: string): Promise<any>;
|
|
37
|
+
getConnection(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
|
|
38
|
+
proxy(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
|
|
39
|
+
get(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
|
|
40
|
+
post(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
|
|
41
|
+
patch(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
|
|
42
|
+
delete(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
|
|
24
43
|
private getConnectionDetails;
|
|
25
44
|
/**
|
|
26
45
|
* Get the list of Connections, which does not contain access credentials.
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
|
|
2
|
+
import { validateProxyConfiguration } from './utils.js';
|
|
3
|
+
const prodHost = 'https://api.nango.dev';
|
|
4
|
+
const stagingHost = 'https://api-staging.nango.dev';
|
|
5
|
+
const forceBearerAuth = true; // For development.
|
|
3
6
|
export class Nango {
|
|
4
7
|
serverUrl;
|
|
5
8
|
secretKey;
|
|
6
9
|
constructor(config = {}) {
|
|
7
|
-
config.host = config.host ||
|
|
10
|
+
config.host = config.host || prodHost;
|
|
8
11
|
this.serverUrl = config.host;
|
|
9
12
|
if (this.serverUrl.slice(-1) === '/') {
|
|
10
13
|
this.serverUrl = this.serverUrl.slice(0, -1);
|
|
@@ -18,45 +21,110 @@ export class Nango {
|
|
|
18
21
|
this.secretKey = config.secretKey || '';
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
|
-
* Get fresh access credentials to authenticate your requests.
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
24
|
* For OAuth 2: returns the access token directly as a string.
|
|
25
|
+
* For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
|
|
26
|
+
* you can set the forceRefresh argument to true."
|
|
25
27
|
* For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
29
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
30
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
31
|
+
* you can set the forceRefresh argument to true.
|
|
32
|
+
* */
|
|
33
|
+
async getToken(providerConfigKey, connectionId, forceRefresh) {
|
|
34
|
+
let response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
|
|
29
35
|
switch (response.data.credentials.type) {
|
|
30
36
|
case 'OAUTH2':
|
|
31
37
|
return response.data.credentials.access_token;
|
|
32
38
|
case 'OAUTH1':
|
|
33
39
|
return { oAuthToken: response.data.credentials.oauth_token, oAuthTokenSecret: response.data.credentials.oauth_token_secret };
|
|
34
40
|
default:
|
|
35
|
-
throw Error(`Unrecognized OAuth type '${response.data.credentials.type}' in stored credentials.`);
|
|
41
|
+
throw new Error(`Unrecognized OAuth type '${response.data.credentials.type}' in stored credentials.`);
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
/**
|
|
39
|
-
* Get the full (fresh) credentials payload returned by the external API,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
* Get the full (fresh) credentials payload returned by the external API,
|
|
46
|
+
* which also contains access credentials.
|
|
47
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
48
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
49
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
50
|
+
* you can set the forceRefresh argument to true.
|
|
51
|
+
* */
|
|
52
|
+
async getRawTokenResponse(providerConfigKey, connectionId, forceRefresh) {
|
|
53
|
+
let response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
|
|
43
54
|
return response.data.credentials.raw;
|
|
44
55
|
}
|
|
45
56
|
/**
|
|
46
|
-
* Get the Connection object, which also contains access credentials and full credentials payload
|
|
57
|
+
* Get the Connection object, which also contains access credentials and full credentials payload
|
|
58
|
+
* returned by the external API.
|
|
59
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
60
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
61
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
62
|
+
* you can set the forceRefresh argument to true.
|
|
47
63
|
*/
|
|
48
|
-
async getConnection(providerConfigKey, connectionId) {
|
|
49
|
-
let response = await this.getConnectionDetails(providerConfigKey, connectionId);
|
|
64
|
+
async getConnection(providerConfigKey, connectionId, forceRefresh) {
|
|
65
|
+
let response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
|
|
50
66
|
return response.data;
|
|
51
67
|
}
|
|
52
|
-
async
|
|
68
|
+
async proxy(config) {
|
|
69
|
+
validateProxyConfiguration(config);
|
|
70
|
+
const { providerConfigKey, connectionId, method } = config;
|
|
71
|
+
const url = `${this.serverUrl}/proxy/${config.endpoint}`;
|
|
72
|
+
const headers = {
|
|
73
|
+
'Connection-Id': connectionId,
|
|
74
|
+
'Provider-Config-Key': providerConfigKey
|
|
75
|
+
};
|
|
76
|
+
const options = {
|
|
77
|
+
headers: this.enrichHeaders(headers)
|
|
78
|
+
};
|
|
79
|
+
if (method?.toUpperCase() === 'POST') {
|
|
80
|
+
return axios.post(url, config.data, options);
|
|
81
|
+
}
|
|
82
|
+
else if (method?.toUpperCase() === 'PATCH') {
|
|
83
|
+
return axios.patch(url, config.data, options);
|
|
84
|
+
}
|
|
85
|
+
else if (method?.toUpperCase() === 'PUT') {
|
|
86
|
+
return axios.put(url, config.data, options);
|
|
87
|
+
}
|
|
88
|
+
else if (method?.toUpperCase() === 'DELETE') {
|
|
89
|
+
return axios.delete(url, options);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return axios.get(url, options);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async get(config) {
|
|
96
|
+
return this.proxy({
|
|
97
|
+
...config,
|
|
98
|
+
method: 'GET'
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
async post(config) {
|
|
102
|
+
return this.proxy({
|
|
103
|
+
...config,
|
|
104
|
+
method: 'POST'
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async patch(config) {
|
|
108
|
+
return this.proxy({
|
|
109
|
+
...config,
|
|
110
|
+
method: 'PATCH'
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async delete(config) {
|
|
114
|
+
return this.proxy({
|
|
115
|
+
...config,
|
|
116
|
+
method: 'DELETE'
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async getConnectionDetails(providerConfigKey, connectionId, forceRefresh = false) {
|
|
53
120
|
let url = `${this.serverUrl}/connection/${connectionId}`;
|
|
54
121
|
let headers = {
|
|
55
122
|
'Content-Type': 'application/json',
|
|
56
123
|
'Accept-Encoding': 'application/json'
|
|
57
124
|
};
|
|
58
125
|
let params = {
|
|
59
|
-
provider_config_key: providerConfigKey
|
|
126
|
+
provider_config_key: providerConfigKey,
|
|
127
|
+
force_refresh: forceRefresh
|
|
60
128
|
};
|
|
61
129
|
return axios.get(url, { params: params, headers: this.enrichHeaders(headers) });
|
|
62
130
|
}
|
|
@@ -76,7 +144,7 @@ export class Nango {
|
|
|
76
144
|
return axios.get(url, { headers: this.enrichHeaders(headers) });
|
|
77
145
|
}
|
|
78
146
|
enrichHeaders(headers = {}) {
|
|
79
|
-
if (this.serverUrl ===
|
|
147
|
+
if (this.serverUrl === prodHost || this.serverUrl === stagingHost || forceBearerAuth) {
|
|
80
148
|
headers['Authorization'] = 'Bearer ' + this.secretKey;
|
|
81
149
|
}
|
|
82
150
|
else if (this.secretKey) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAIxD,MAAM,QAAQ,GAAG,uBAAuB,CAAC;AACzC,MAAM,WAAW,GAAG,+BAA+B,CAAC;AACpD,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,mBAAmB;AAEjD,MAAM,OAAO,KAAK;IACd,SAAS,CAAS;IAClB,SAAS,CAAS;IAElB,YAAY,SAAgD,EAAE;QAC1D,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,QAAQ,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC;QAE7B,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;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AAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAClD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACzB,CAAC;IAEO,KAAK,CAAC,qBAAqB;QAC/B,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,aAAa,CAAC;QAEzC,IAAI,OAAO,GAAG;YACV,cAAc,EAAE,kBAAkB;YAClC,iBAAiB,EAAE,kBAAkB;SACxC,CAAC;QAEF,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;IAEO,aAAa,CAAC,UAAqD,EAAE;QACzE,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,IAAI,CAAC,SAAS,KAAK,WAAW,IAAI,eAAe,EAAE;YAClF,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;SACzD;aAAM,IAAI,IAAI,CAAC,SAAS,EAAE;YACvB,OAAO,CAAC,eAAe,CAAC,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAC9F;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface ProxyConfiguration {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
endpoint: string;
|
|
4
|
+
providerConfigKey: string;
|
|
5
|
+
connectionId: string;
|
|
6
|
+
method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'get' | 'post' | 'patch' | 'put' | 'delete';
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
params?: string | Record<string, string>;
|
|
9
|
+
paramsSerializer?: {
|
|
10
|
+
encode?: (param: string) => string;
|
|
11
|
+
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions) => void;
|
|
12
|
+
indexes?: boolean;
|
|
13
|
+
};
|
|
14
|
+
data?: unknown;
|
|
15
|
+
}
|
|
16
|
+
interface ParamsSerializerOptions {
|
|
17
|
+
encode?: ParamEncoder;
|
|
18
|
+
serialize?: CustomParamsSerializer;
|
|
19
|
+
}
|
|
20
|
+
interface ParamEncoder {
|
|
21
|
+
(value: any, defaultEncoder: (value: any) => any): any;
|
|
22
|
+
}
|
|
23
|
+
interface CustomParamsSerializer {
|
|
24
|
+
(params: Record<string, any>, options?: ParamsSerializerOptions): string;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":""}
|
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const validateProxyConfiguration = (config) => {
|
|
2
|
+
const requiredParams = ['endpoint', 'providerConfigKey', 'connectionId'];
|
|
3
|
+
requiredParams.forEach((param) => {
|
|
4
|
+
if (typeof config[param] === 'undefined') {
|
|
5
|
+
throw new Error(`${param} is missing and is required to make a proxy call!`);
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../lib/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACrE,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;IAEzE,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7B,IAAI,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,WAAW,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,mDAAmD,CAAC,CAAC;SAChF;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|