@nangohq/node 0.21.14 → 0.21.16

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 CHANGED
@@ -1,2 +1,86 @@
1
- import { Nango, NangoSync, SyncWebhookBody as NangoSyncWebhookBody, HubspotModels } from '@nangohq/shared';
2
- export { Nango, NangoSync, NangoSyncWebhookBody, HubspotModels };
1
+ import type { AuthModes, OAuth1Credentials, OAuth2Credentials, ProxyConfiguration, GetRecordsRequestConfig } from './types.js';
2
+ export declare const stagingHost = "https://api-staging.nango.dev";
3
+ export declare const prodHost = "https://api.nango.dev";
4
+ interface NangoProps {
5
+ host?: string;
6
+ secretKey?: string;
7
+ connectionId?: string;
8
+ providerConfigKey?: string;
9
+ isSync?: boolean;
10
+ dryRun?: boolean;
11
+ activityLogId?: number;
12
+ }
13
+ interface CreateConnectionOAuth1 extends OAuth1Credentials {
14
+ connection_id: string;
15
+ provider_config_key: string;
16
+ type: AuthModes.OAuth1;
17
+ }
18
+ interface CreateConnectionOAuth2 extends OAuth2Credentials {
19
+ connection_id: string;
20
+ provider_config_key: string;
21
+ type: AuthModes.OAuth2;
22
+ }
23
+ export declare class Nango {
24
+ serverUrl: string;
25
+ secretKey: string;
26
+ connectionId?: string;
27
+ providerConfigKey?: string;
28
+ isSync: boolean;
29
+ dryRun: boolean;
30
+ activityLogId?: number;
31
+ constructor(config?: NangoProps);
32
+ /**
33
+ * For OAuth 2: returns the access token directly as a string.
34
+ * For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
35
+ * you can set the forceRefresh argument to true."
36
+ * For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
37
+ * @param providerConfigKey - This is the unique Config Key for the integration
38
+ * @param connectionId - This is the unique connection identifier used to identify this connection
39
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
40
+ * you can set the forceRefresh argument to true.
41
+ * */
42
+ getToken(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
43
+ /**
44
+ * Get the full (fresh) credentials payload returned by the external API,
45
+ * which also contains access credentials.
46
+ * @param providerConfigKey - This is the unique Config Key for the integration
47
+ * @param connectionId - This is the unique connection identifier used to identify this connection
48
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
49
+ * you can set the forceRefresh argument to true.
50
+ * */
51
+ getRawTokenResponse(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
52
+ /**
53
+ * Get the Connection object, which also contains access credentials and full credentials payload
54
+ * returned by the external API.
55
+ * @param providerConfigKey - This is the unique Config Key for the integration
56
+ * @param connectionId - This is the unique connection identifier used to identify this connection
57
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
58
+ * you can set the forceRefresh argument to true.
59
+ * @param [refreshToken] - When set this returns the refresh token as part of the response
60
+ */
61
+ getConnection(providerConfigKey: string, connectionId: string, forceRefresh?: boolean, refreshToken?: boolean): Promise<any>;
62
+ proxy(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
63
+ get(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
64
+ post(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
65
+ patch(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
66
+ delete(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
67
+ getRecords(config: GetRecordsRequestConfig): Promise<any>;
68
+ private getConnectionDetails;
69
+ /**
70
+ * Get the list of Connections, which does not contain access credentials.
71
+ */
72
+ listConnections(connectionId?: string): Promise<any>;
73
+ setFieldMapping(fieldMapping: Record<string, string>, optionalProviderConfigKey?: string, optionalConnectionId?: string): Promise<import("axios").AxiosResponse<any, any>>;
74
+ getFieldMapping(optionalProviderConfigKey?: string, optionalConnectionId?: string): Promise<any>;
75
+ triggerSync({ connectionId, providerConfigKey }: {
76
+ connectionId: string;
77
+ providerConfigKey: string;
78
+ }): Promise<import("axios").AxiosResponse<any, any>>;
79
+ createConnection(connectionArgs: CreateConnectionOAuth1 | (CreateConnectionOAuth2 & {
80
+ metadata: string;
81
+ connection_config: string;
82
+ })): Promise<import("axios").AxiosResponse<any, any>>;
83
+ private listConnectionDetails;
84
+ private enrichHeaders;
85
+ }
86
+ export {};
package/dist/index.js CHANGED
@@ -1,3 +1,250 @@
1
- import { Nango, NangoSync, HubspotModels } from '@nangohq/shared';
2
- export { Nango, NangoSync, HubspotModels };
1
+ import axios from 'axios';
2
+ import { validateProxyConfiguration, validateSyncRecordConfiguration } from './utils.js';
3
+ export const stagingHost = 'https://api-staging.nango.dev';
4
+ export const prodHost = 'https://api.nango.dev';
5
+ export class Nango {
6
+ serverUrl;
7
+ secretKey;
8
+ connectionId;
9
+ providerConfigKey;
10
+ isSync = false;
11
+ dryRun = false;
12
+ activityLogId;
13
+ constructor(config = {}) {
14
+ config.host = config.host || prodHost;
15
+ this.serverUrl = config.host;
16
+ if (this.serverUrl.slice(-1) === '/') {
17
+ this.serverUrl = this.serverUrl.slice(0, -1);
18
+ }
19
+ try {
20
+ new URL(this.serverUrl);
21
+ }
22
+ catch (err) {
23
+ throw new Error(`Invalid URL provided for the Nango host: ${this.serverUrl}`);
24
+ }
25
+ this.secretKey = config.secretKey || '';
26
+ this.connectionId = config.connectionId || '';
27
+ this.providerConfigKey = config.providerConfigKey || '';
28
+ if (config.isSync) {
29
+ this.isSync = config.isSync;
30
+ }
31
+ if (config.dryRun) {
32
+ this.dryRun = config.dryRun;
33
+ }
34
+ if (config.activityLogId) {
35
+ this.activityLogId = config.activityLogId;
36
+ }
37
+ }
38
+ /**
39
+ * For OAuth 2: returns the access token directly as a string.
40
+ * For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
41
+ * you can set the forceRefresh argument to true."
42
+ * For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
43
+ * @param providerConfigKey - This is the unique Config Key for the integration
44
+ * @param connectionId - This is the unique connection identifier used to identify this connection
45
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
46
+ * you can set the forceRefresh argument to true.
47
+ * */
48
+ async getToken(providerConfigKey, connectionId, forceRefresh) {
49
+ const response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
50
+ switch (response.data.credentials.type) {
51
+ case 'OAUTH2':
52
+ return response.data.credentials.access_token;
53
+ case 'OAUTH1':
54
+ return { oAuthToken: response.data.credentials.oauth_token, oAuthTokenSecret: response.data.credentials.oauth_token_secret };
55
+ default:
56
+ throw new Error(`Unrecognized OAuth type '${response.data.credentials.type}' in stored credentials.`);
57
+ }
58
+ }
59
+ /**
60
+ * Get the full (fresh) credentials payload returned by the external API,
61
+ * which also contains access credentials.
62
+ * @param providerConfigKey - This is the unique Config Key for the integration
63
+ * @param connectionId - This is the unique connection identifier used to identify this connection
64
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
65
+ * you can set the forceRefresh argument to true.
66
+ * */
67
+ async getRawTokenResponse(providerConfigKey, connectionId, forceRefresh) {
68
+ const response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
69
+ return response.data.credentials.raw;
70
+ }
71
+ /**
72
+ * Get the Connection object, which also contains access credentials and full credentials payload
73
+ * returned by the external API.
74
+ * @param providerConfigKey - This is the unique Config Key for the integration
75
+ * @param connectionId - This is the unique connection identifier used to identify this connection
76
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
77
+ * you can set the forceRefresh argument to true.
78
+ * @param [refreshToken] - When set this returns the refresh token as part of the response
79
+ */
80
+ async getConnection(providerConfigKey, connectionId, forceRefresh, refreshToken) {
81
+ const response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh, refreshToken);
82
+ return response.data;
83
+ }
84
+ async proxy(config) {
85
+ if (!config.connectionId && this.connectionId) {
86
+ config.connectionId = this.connectionId;
87
+ }
88
+ if (!config.providerConfigKey && this.providerConfigKey) {
89
+ config.providerConfigKey = this.providerConfigKey;
90
+ }
91
+ validateProxyConfiguration(config);
92
+ const { providerConfigKey, connectionId, method, retries, headers: customHeaders, baseUrlOverride } = config;
93
+ const url = `${this.serverUrl}/proxy/${config.endpoint}`;
94
+ const headers = {
95
+ 'Connection-Id': connectionId,
96
+ 'Provider-Config-Key': providerConfigKey,
97
+ 'Base-Url-Override': baseUrlOverride || '',
98
+ 'Nango-Is-Sync': this.isSync,
99
+ 'Nango-Is-Dry-Run': this.dryRun,
100
+ 'Nango-Activity-Log-Id': this.activityLogId || '',
101
+ ...customHeaders
102
+ };
103
+ if (retries) {
104
+ headers['Retries'] = retries;
105
+ }
106
+ const options = {
107
+ headers: this.enrichHeaders(headers)
108
+ };
109
+ if (config.params) {
110
+ options.params = config.params;
111
+ }
112
+ if (config.paramsSerializer) {
113
+ options.paramsSerializer = config.paramsSerializer;
114
+ }
115
+ if (method?.toUpperCase() === 'POST') {
116
+ return axios.post(url, config.data, options);
117
+ }
118
+ else if (method?.toUpperCase() === 'PATCH') {
119
+ return axios.patch(url, config.data, options);
120
+ }
121
+ else if (method?.toUpperCase() === 'PUT') {
122
+ return axios.put(url, config.data, options);
123
+ }
124
+ else if (method?.toUpperCase() === 'DELETE') {
125
+ return axios.delete(url, options);
126
+ }
127
+ else {
128
+ return axios.get(url, options);
129
+ }
130
+ }
131
+ async get(config) {
132
+ return this.proxy({
133
+ ...config,
134
+ method: 'GET'
135
+ });
136
+ }
137
+ async post(config) {
138
+ return this.proxy({
139
+ ...config,
140
+ method: 'POST'
141
+ });
142
+ }
143
+ async patch(config) {
144
+ return this.proxy({
145
+ ...config,
146
+ method: 'PATCH'
147
+ });
148
+ }
149
+ async delete(config) {
150
+ return this.proxy({
151
+ ...config,
152
+ method: 'DELETE'
153
+ });
154
+ }
155
+ async getRecords(config) {
156
+ const { connectionId, providerConfigKey, model, delta, offset, limit } = config;
157
+ validateSyncRecordConfiguration(config);
158
+ const url = `${this.serverUrl}/sync/records/?model=${model}&delta=${delta || ''}&offset=${offset || ''}&limit=${limit || ''}`;
159
+ const headers = {
160
+ 'Connection-Id': connectionId,
161
+ 'Provider-Config-Key': providerConfigKey
162
+ };
163
+ const options = {
164
+ headers: this.enrichHeaders(headers)
165
+ };
166
+ const response = await axios.get(url, options);
167
+ return response.data;
168
+ }
169
+ async getConnectionDetails(providerConfigKey, connectionId, forceRefresh = false, refreshToken = false, additionalHeader = {}) {
170
+ const url = `${this.serverUrl}/connection/${connectionId}`;
171
+ const headers = {
172
+ 'Content-Type': 'application/json',
173
+ 'Accept-Encoding': 'application/json'
174
+ };
175
+ if (additionalHeader) {
176
+ Object.assign(headers, additionalHeader);
177
+ }
178
+ const params = {
179
+ provider_config_key: providerConfigKey,
180
+ force_refresh: forceRefresh,
181
+ refresh_token: refreshToken
182
+ };
183
+ return axios.get(url, { params: params, headers: this.enrichHeaders(headers) });
184
+ }
185
+ /**
186
+ * Get the list of Connections, which does not contain access credentials.
187
+ */
188
+ async listConnections(connectionId) {
189
+ const response = await this.listConnectionDetails(connectionId);
190
+ return response.data;
191
+ }
192
+ async setFieldMapping(fieldMapping, optionalProviderConfigKey, optionalConnectionId) {
193
+ const providerConfigKey = optionalProviderConfigKey || this.providerConfigKey;
194
+ const connectionId = optionalConnectionId || this.connectionId;
195
+ const url = `${this.serverUrl}/connection/${connectionId}/field-mapping?provider_config_key=${providerConfigKey}`;
196
+ const headers = {
197
+ 'Provider-Config-Key': providerConfigKey
198
+ };
199
+ return axios.post(url, fieldMapping, { headers: this.enrichHeaders(headers) });
200
+ }
201
+ async getFieldMapping(optionalProviderConfigKey, optionalConnectionId) {
202
+ const providerConfigKey = optionalProviderConfigKey || this.providerConfigKey;
203
+ const connectionId = optionalConnectionId || this.connectionId;
204
+ if (!providerConfigKey) {
205
+ throw new Error('Provider Config Key is required');
206
+ }
207
+ if (!connectionId) {
208
+ throw new Error('Connection Id is required');
209
+ }
210
+ const response = await this.getConnectionDetails(providerConfigKey, connectionId, false, false, {
211
+ 'Nango-Is-Sync': true,
212
+ 'Nango-Is-Dry-Run': this.dryRun
213
+ });
214
+ return response.data.field_mappings;
215
+ }
216
+ async triggerSync({ connectionId, providerConfigKey }) {
217
+ const url = `${this.serverUrl}/sync/trigger`;
218
+ const headers = {
219
+ 'Connection-Id': connectionId,
220
+ 'Provider-Config-Key': providerConfigKey
221
+ };
222
+ return axios.post(url, {}, { headers: this.enrichHeaders(headers) });
223
+ }
224
+ async createConnection(connectionArgs) {
225
+ const url = `${this.serverUrl}/connection`;
226
+ const body = connectionArgs;
227
+ return axios.post(url, body, { headers: this.enrichHeaders() });
228
+ }
229
+ async listConnectionDetails(connectionId) {
230
+ let url = `${this.serverUrl}/connection?`;
231
+ if (connectionId) {
232
+ url = url.concat(`connectionId=${connectionId}`);
233
+ }
234
+ const headers = {
235
+ 'Content-Type': 'application/json',
236
+ 'Accept-Encoding': 'application/json'
237
+ };
238
+ return axios.get(url, { headers: this.enrichHeaders(headers) });
239
+ }
240
+ enrichHeaders(headers = {}) {
241
+ if (this.serverUrl === prodHost || this.serverUrl === stagingHost) {
242
+ headers['Authorization'] = 'Bearer ' + this.secretKey;
243
+ }
244
+ else if (this.secretKey) {
245
+ headers['Authorization'] = 'Basic ' + Buffer.from(this.secretKey + ':').toString('base64');
246
+ }
247
+ return headers;
248
+ }
249
+ }
3
250
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAA2C,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3G,OAAO,EAAE,KAAK,EAAE,SAAS,EAAwB,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,0BAA0B,EA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AAC,SAAS,KAAK,QAAQ,IAAI,IAAI,CAAC,SAAS,KAAK,WAAW,EAAE;YAC/D,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"}
@@ -0,0 +1,52 @@
1
+ import { ProxyService } from 'lib/services/proxy';
2
+ import type { ProxyConfiguration } from 'lib/types';
3
+ export declare class Nango {
4
+ serverUrl: string;
5
+ secretKey: string;
6
+ proxyService: ProxyService;
7
+ constructor(config?: {
8
+ host?: string;
9
+ secretKey?: string;
10
+ });
11
+ /**
12
+ * For OAuth 2: returns the access token directly as a string.
13
+ * For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
14
+ * you can set the forceRefresh argument to true."
15
+ * For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
16
+ * @param providerConfigKey - This is the unique Config Key for the integration
17
+ * @param connectionId - This is the unique connection identifier used to identify this connection
18
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
19
+ * you can set the forceRefresh argument to true.
20
+ * */
21
+ getToken(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
22
+ /**
23
+ * Get the full (fresh) credentials payload returned by the external API,
24
+ * which also contains access credentials.
25
+ * @param providerConfigKey - This is the unique Config Key for the integration
26
+ * @param connectionId - This is the unique connection identifier used to identify this connection
27
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
28
+ * you can set the forceRefresh argument to true.
29
+ * */
30
+ getRawTokenResponse(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
31
+ /**
32
+ * Get the Connection object, which also contains access credentials and full credentials payload
33
+ * returned by the external API.
34
+ * @param providerConfigKey - This is the unique Config Key for the integration
35
+ * @param connectionId - This is the unique connection identifier used to identify this connection
36
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
37
+ * you can set the forceRefresh argument to true.
38
+ */
39
+ getConnection(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<any>;
40
+ proxy(config: ProxyConfiguration): Promise<void>;
41
+ get(config: ProxyConfiguration): Promise<void>;
42
+ post(config: ProxyConfiguration): Promise<void>;
43
+ patch(config: ProxyConfiguration): Promise<void>;
44
+ delete(config: ProxyConfiguration): Promise<void>;
45
+ private getConnectionDetails;
46
+ /**
47
+ * Get the list of Connections, which does not contain access credentials.
48
+ */
49
+ listConnections(): Promise<any>;
50
+ private listConnectionDetails;
51
+ private enrichHeaders;
52
+ }
@@ -0,0 +1,155 @@
1
+ import axios from 'axios';
2
+ import { ProxyService } from 'lib/services/proxy';
3
+ const prodHost = 'https://api.nango.dev';
4
+ const stagingHost = 'https://api-staging.nango.dev';
5
+ const forceBearerAuth = true; // For development.
6
+ console.log(forceBearerAuth);
7
+ export class Nango {
8
+ serverUrl;
9
+ secretKey;
10
+ proxyService;
11
+ constructor(config = {}) {
12
+ config.host = config.host || prodHost;
13
+ this.serverUrl = config.host;
14
+ if (this.serverUrl.slice(-1) === '/') {
15
+ this.serverUrl = this.serverUrl.slice(0, -1);
16
+ }
17
+ try {
18
+ new URL(this.serverUrl);
19
+ }
20
+ catch (err) {
21
+ throw new Error(`Invalid URL provided for the Nango host: ${this.serverUrl}`);
22
+ }
23
+ this.secretKey = config.secretKey || '';
24
+ this.proxyService = new ProxyService();
25
+ }
26
+ /**
27
+ * For OAuth 2: returns the access token directly as a string.
28
+ * For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
29
+ * you can set the forceRefresh argument to true."
30
+ * For OAuth 1: returns an object with 'oAuthToken' and 'oAuthTokenSecret' fields.
31
+ * @param providerConfigKey - This is the unique Config Key for the integration
32
+ * @param connectionId - This is the unique connection identifier used to identify this connection
33
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
34
+ * you can set the forceRefresh argument to true.
35
+ * */
36
+ async getToken(providerConfigKey, connectionId, forceRefresh) {
37
+ let response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
38
+ switch (response.data.credentials.type) {
39
+ case 'OAUTH2':
40
+ return response.data.credentials.access_token;
41
+ case 'OAUTH1':
42
+ return { oAuthToken: response.data.credentials.oauth_token, oAuthTokenSecret: response.data.credentials.oauth_token_secret };
43
+ default:
44
+ throw new Error(`Unrecognized OAuth type '${response.data.credentials.type}' in stored credentials.`);
45
+ }
46
+ }
47
+ /**
48
+ * Get the full (fresh) credentials payload returned by the external API,
49
+ * which also contains access credentials.
50
+ * @param providerConfigKey - This is the unique Config Key for the integration
51
+ * @param connectionId - This is the unique connection identifier used to identify this connection
52
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
53
+ * you can set the forceRefresh argument to true.
54
+ * */
55
+ async getRawTokenResponse(providerConfigKey, connectionId, forceRefresh) {
56
+ let response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
57
+ return response.data.credentials.raw;
58
+ }
59
+ /**
60
+ * Get the Connection object, which also contains access credentials and full credentials payload
61
+ * returned by the external API.
62
+ * @param providerConfigKey - This is the unique Config Key for the integration
63
+ * @param connectionId - This is the unique connection identifier used to identify this connection
64
+ * @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
65
+ * you can set the forceRefresh argument to true.
66
+ */
67
+ async getConnection(providerConfigKey, connectionId, forceRefresh) {
68
+ let response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh);
69
+ return response.data;
70
+ }
71
+ async proxy(config) {
72
+ this.proxyService.validateConfiguration(config);
73
+ const { providerConfigKey, connectionId, method: providedMethod } = config;
74
+ switch (providedMethod) {
75
+ case 'POST':
76
+ case 'post':
77
+ config.method = 'POST';
78
+ break;
79
+ case 'DELETE':
80
+ case 'delete':
81
+ config.method = 'DELETE';
82
+ break;
83
+ case 'PATCH':
84
+ case 'patch':
85
+ config.method = 'PATCH';
86
+ break;
87
+ default:
88
+ config.method = 'GET';
89
+ break;
90
+ }
91
+ const tokenResponse = await this.getToken(providerConfigKey, connectionId);
92
+ return await this.proxyService.run(tokenResponse, config);
93
+ }
94
+ async get(config) {
95
+ return this.proxy({
96
+ ...config,
97
+ method: 'GET'
98
+ });
99
+ }
100
+ async post(config) {
101
+ return this.proxy({
102
+ ...config,
103
+ method: 'POST'
104
+ });
105
+ }
106
+ async patch(config) {
107
+ return this.proxy({
108
+ ...config,
109
+ method: 'PATCH'
110
+ });
111
+ }
112
+ async delete(config) {
113
+ return this.proxy({
114
+ ...config,
115
+ method: 'DELETE'
116
+ });
117
+ }
118
+ async getConnectionDetails(providerConfigKey, connectionId, forceRefresh = false) {
119
+ let url = `${this.serverUrl}/connection/${connectionId}`;
120
+ let headers = {
121
+ 'Content-Type': 'application/json',
122
+ 'Accept-Encoding': 'application/json'
123
+ };
124
+ let params = {
125
+ provider_config_key: providerConfigKey,
126
+ force_refresh: forceRefresh
127
+ };
128
+ return axios.get(url, { params: params, headers: this.enrichHeaders(headers) });
129
+ }
130
+ /**
131
+ * Get the list of Connections, which does not contain access credentials.
132
+ */
133
+ async listConnections() {
134
+ let response = await this.listConnectionDetails();
135
+ return response.data;
136
+ }
137
+ async listConnectionDetails() {
138
+ let url = `${this.serverUrl}/connection`;
139
+ let headers = {
140
+ 'Content-Type': 'application/json',
141
+ 'Accept-Encoding': 'application/json'
142
+ };
143
+ return axios.get(url, { headers: this.enrichHeaders(headers) });
144
+ }
145
+ enrichHeaders(headers = {}) {
146
+ if (this.serverUrl === prodHost || this.serverUrl === stagingHost || forceBearerAuth) {
147
+ headers['Authorization'] = 'Bearer ' + this.secretKey;
148
+ }
149
+ else if (this.secretKey) {
150
+ headers['Authorization'] = 'Basic ' + Buffer.from(this.secretKey + ':').toString('base64');
151
+ }
152
+ return headers;
153
+ }
154
+ }
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,MAAM,QAAQ,GAAG,uBAAuB,CAAC;AACzC,MAAM,WAAW,GAAG,+BAA+B,CAAC;AACpD,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,mBAAmB;AAEjD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC5B,MAAM,OAAO,KAAK;IACd,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,YAAY,CAAe;IAE3B,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;YAClC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAChD;QAED,IAAI;YACA,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC3B;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;SACjF;QAED,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;IAC3C,CAAC;IAED;;;;;;;;;SASK;IACE,KAAK,CAAC,QAAQ,C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GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAC9F;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
@@ -0,0 +1,5 @@
1
+ import type { ProxyConfiguration } from 'lib/types';
2
+ export declare class ProxyService {
3
+ validateConfiguration(config: ProxyConfiguration): void;
4
+ run(tokenResponse: unknown, config: ProxyConfiguration): void;
5
+ }
@@ -0,0 +1,14 @@
1
+ export class ProxyService {
2
+ validateConfiguration(config) {
3
+ const requiredParams = ['endpoint', 'providerConfigKey', 'connectionId'];
4
+ requiredParams.forEach((param) => {
5
+ if (typeof config[param] === 'undefined') {
6
+ throw new Error(`${param} is missing and is required to make a proxy call!`);
7
+ }
8
+ });
9
+ }
10
+ run(tokenResponse, config) {
11
+ console.log(tokenResponse, config);
12
+ }
13
+ }
14
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../lib/services/proxy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACd,qBAAqB,CAAC,MAA0B;QACnD,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAEzE,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7B,IAAI,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,WAAW,EAAE;gBACtC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,mDAAmD,CAAC,CAAC;aAChF;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,GAAG,CAAC,aAAsB,EAAE,MAA0B;QACzD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;CACJ"}
@@ -0,0 +1,25 @@
1
+ export interface ProxyConfiguration {
2
+ [key: string]: any;
3
+ endpoint: string;
4
+ providerConfigKey: string;
5
+ connectionId: string;
6
+ method?: 'GET' | 'POST' | 'PATCH' | 'DELETE' | 'get' | 'post' | 'patch' | '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
+ }
15
+ interface ParamsSerializerOptions {
16
+ encode?: ParamEncoder;
17
+ serialize?: CustomParamsSerializer;
18
+ }
19
+ interface ParamEncoder {
20
+ (value: any, defaultEncoder: (value: any) => any): any;
21
+ }
22
+ interface CustomParamsSerializer {
23
+ (params: Record<string, any>, options?: ParamsSerializerOptions): string;
24
+ }
25
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ProxyConfiguration } from '../types';
2
+ export declare class ProxyService {
3
+ validateConfiguration(config: ProxyConfiguration): void;
4
+ run(tokenResponse: unknown, config: ProxyConfiguration): void;
5
+ }
@@ -0,0 +1,14 @@
1
+ export class ProxyService {
2
+ validateConfiguration(config) {
3
+ const requiredParams = ['endpoint', 'providerConfigKey', 'connectionId'];
4
+ requiredParams.forEach((param) => {
5
+ if (typeof config[param] === 'undefined') {
6
+ throw new Error(`${param} is missing and is required to make a proxy call!`);
7
+ }
8
+ });
9
+ }
10
+ run(tokenResponse, config) {
11
+ console.log(tokenResponse, config);
12
+ }
13
+ }
14
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../lib/services/proxy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACd,qBAAqB,CAAC,MAA0B;QACnD,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAEzE,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7B,IAAI,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,WAAW,EAAE;gBACtC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,mDAAmD,CAAC,CAAC;aAChF;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,GAAG,CAAC,aAAsB,EAAE,MAA0B;QACzD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;CACJ"}
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/axios/index.d.ts","../lib/types.ts","../lib/services/proxy.ts","../lib/index.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/braintree/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/@types/cookie-parser/index.d.ts","../../../node_modules/@types/cors/index.d.ts","../../../node_modules/@types/express-session/index.d.ts","../../../node_modules/@types/ip/index.d.ts","../../../node_modules/@types/js-yaml/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/jsonwebtoken/index.d.ts","../../../node_modules/@types/oauth/index.d.ts","../../../node_modules/@types/passport/index.d.ts","../../../node_modules/@types/passport-http/index.d.ts","../../../node_modules/@types/passport-strategy/index.d.ts","../../../node_modules/@types/passport-local/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/simple-oauth2/index.d.ts","../../../node_modules/@types/triple-beam/index.d.ts","../../../node_modules/@types/uuid/index.d.ts","../../../node_modules/@types/ws/index.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9","746d62152361558ea6d6115cf0da4dd10ede041d14882ede3568bce5dc4b4f1f","d11a03592451da2d1065e09e61f4e2a9bf68f780f4f6623c18b57816a9679d17",{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"6c55633c733c8378db65ac3da7a767c3cf2cf3057f0565a9124a16a3a2019e87","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"34c839eaaa6d78c8674ae2c37af2236dee6831b13db7b4ef4df3ec889a04d4f2","affectsGlobalScope":true},{"version":"34478567f8a80171f88f2f30808beb7da15eac0538ae91282dd33dce928d98ed","affectsGlobalScope":true},{"version":"ab7d58e6161a550ff92e5aff755dc37fe896245348332cd5f1e1203479fe0ed1","affectsGlobalScope":true},{"version":"6bda95ea27a59a276e46043b7065b55bd4b316c25e70e29b572958fa77565d43","affectsGlobalScope":true},{"version":"aedb8de1abb2ff1095c153854a6df7deae4a5709c37297f9d6e9948b6806fa66","affectsGlobalScope":true},{"version":"a4da0551fd39b90ca7ce5f68fb55d4dc0c1396d589b612e1902f68ee090aaada","affectsGlobalScope":true},{"version":"11ffe3c281f375fff9ffdde8bbec7669b4dd671905509079f866f2354a788064","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"17affcd8cc646e7f05e4b96d325b893d22542dd2c2c63ead572ca1bea346ebc9",{"version":"2b21f6177a596db7551ccce17756fbfbec7fb90c280d18a59a1d10f0ad0a1cbf","signature":"40b291835f1cc7c069348d9adcf18e7659a51bf02a6f08324e92d5826621f71f"},{"version":"73e08f880b36dd05e5c4fea6a0f7f245d5127467b5779cb805e284ac1eb26ab1","signature":"5fa07a5085950cd6c288c5be2a0e8fccb4a6ca2c8c0f8ce758dbca894dd0ae3f"},{"version":"336da78e01226cf10116018dca8dc30d1bfe3e5c3cff97d7127c12835e6bd24d","signature":"d4894531936c5aa7a22a23724cd619688a424f5b09921f11c1718f3459f2981f"},"7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"ca72190df0eb9b09d4b600821c8c7b6c9747b75a1c700c4d57dc0bb72abc074c","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"bb65c6267c5d6676be61acbf6604cf0a4555ac4b505df58ac15c831fcbff4e3e","affectsGlobalScope":true},"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","afcc1c426b76db7ec80e563d4fb0ba9e6bcc6e63c2d7e9342e649dc56d26347f","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","75ecef44f126e2ae018b4abbd85b6e8a2e2ba1638ebec56cc64274643ce3567b","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","b01a80007e448d035a16c74b5c95a5405b2e81b12fabcf18b75aa9eb9ef28990","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","dbe5aa5a5dd8bd1c6a8d11b1310c3f0cdabaacc78a37b394a8c7b14faeb5fb84","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"d076fede3cb042e7b13fc29442aaa03a57806bc51e2b26a67a01fbc66a7c0c12","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","fd93cee2621ff42dabe57b7be402783fd1aa69ece755bcba1e0290547ae60513","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","213fc4f2b172d8beb74b77d7c1b41488d67348066d185e4263470cbb010cd6e8",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","4c8525f256873c7ba3135338c647eaf0ca7115a1a2805ae2d0056629461186ce","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"f7db71191aa7aac5d6bc927ed6e7075c2763d22c7238227ec0c63c8cf5cb6a8b","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"e9a8d4274033cb520ee12d6f68d161ba2b9128b87399645d3916b71187032836","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","a097d9cf5c82e501a7d27072f8f7bb4d1ee240cbf8797e7cd4bf0b2dff826649","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"ae3fe461989bbd951344efc1f1fe932360ce7392e6126bdb225a82a1bbaf15ee","affectsGlobalScope":true},"5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","f47887b61c6cf2f48746980390d6cb5b8013518951d912cfb37fe748071942be","15c88bfd1b8dc7231ff828ae8df5d955bae5ebca4cf2bcb417af5821e52299ae",{"version":"1b78398949ba8cd33ff048652ce14906ce8b799f70c841c024e14666ef458254","affectsGlobalScope":true},"6fbd58e4015b9ae31ea977d4d549eb24a1102cc798b57ec5d70868b542c06612",{"version":"ac95a3079883f7bde32a463e28af2c8e6d61d6220a1062c4e736df5215f92f77","affectsGlobalScope":true},"4d2319a2a33bd370e1b85399fa1b83751725981f21aae64a521b1db123e38cf4","686e548ae30250d62532c8cacb43fccc922b693408371bd3503563c4a0f28eed","f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","a52ef4dbbf82de3df527d9691b67834f8ced2724d307a10d68383a30bcb08b55","ee4b33bde3c17180fc5ef9f8d3f153659fd9827ae82eef9ca4e8956ca343fadd",{"version":"040c1f3ce256bb5444033f734d44ebb602579a3267e05ef8a70a97c348cce7e0","affectsGlobalScope":true},"1e23915482078e1d3a7cc45bbf311e6112f2ec74d8de77a70ab7eec518f765bd","29d59e921bc723594bbfc98230d24f38f0d5a669f28fcf989b7468f4f95b7c52","0f58b1b8384c140d59981d48be871fb55d676a60e5c9e85b6c206a6e010aed36","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","77c1d91a129ba60b8c405f9f539e42df834afb174fe0785f89d92a2c7c16b77a","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","6aee496bf0ecfbf6731aa8cca32f4b6e92cdc0a444911a7d88410408a45ecc5d","fae4f60d64401c5f361d13652c914f1e029b1e263470c957072957a0fe2f875c","df5941f81d2d8a084c12b67bfa2a3a9fd2703ee68d75bd2299b15af3fa400d5e","fab58e600970e66547644a44bc9918e3223aa2cbd9e8763cec004b2cfb48827e","77c5c7f8578d139c74102a29384f5f4f0792a12d819ddcdcaf8307185ff2d45d"],"options":{"allowUnreachableCode":false,"allowUnusedLabels":false,"composite":true,"declaration":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"importsNotUsedAsValues":2,"module":7,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noPropertyAccessFromIndexSignature":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"fileIdsList":[[77,104,111,112],[92,104,111],[77,104,111],[104,121],[77,104],[74,77,104,111,115,116],[74,104,121],[104,113,116,117,120],[104,111],[104],[67,104,111],[104,119],[104,118],[58,104],[61,104],[62,67,95,104],[63,74,75,82,92,103,104],[63,64,74,82,104],[65,104],[66,67,75,83,104],[67,92,100,104],[68,70,74,82,104],[69,104],[70,71,104],[74,104],[72,74,104],[74,75,76,92,103,104],[74,75,76,89,92,95,104],[104,108],[77,82,92,103,104],[74,75,77,78,82,92,100,103,104],[77,79,92,100,103,104],[58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110],[74,80,104],[81,103,104],[70,74,82,92,104],[83,104],[84,104],[61,85,104],[86,102,104,108],[87,104],[88,104],[74,89,90,104],[89,91,104,106],[62,74,92,93,94,95,104],[62,92,94,104],[92,93,104],[95,104],[96,104],[74,98,99,104],[98,99,104],[67,82,92,100,104],[101,104],[82,102,104],[62,77,88,103,104],[67,104],[92,104,105],[104,106],[104,107],[62,67,74,76,85,92,103,104,106,108],[92,104,109],[77,103,104,111],[104,121,130],[104,121,130,132],[77,104,121],[104,134,173],[104,134,158,173],[104,173],[104,134],[104,134,159,173],[104,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172],[104,159,173],[77,104,111,119],[74,77,79,92,100,103,104,109,111],[54,55,56,104],[55,104],[55,56],[55]],"referencedMap":[[113,1],[114,2],[112,3],[122,4],[123,5],[117,6],[124,7],[121,8],[125,9],[126,10],[127,10],[128,11],[118,12],[119,13],[58,14],[59,14],[61,15],[62,16],[63,17],[64,18],[65,19],[66,20],[67,21],[68,22],[69,23],[70,24],[71,24],[73,25],[72,26],[74,25],[75,27],[76,28],[60,29],[110,10],[77,30],[78,31],[79,32],[111,33],[80,34],[81,35],[82,36],[83,37],[84,38],[85,39],[86,40],[87,41],[88,42],[89,43],[90,43],[91,44],[92,45],[94,46],[93,47],[95,48],[96,49],[97,10],[98,50],[99,51],[100,52],[101,53],[102,54],[103,55],[104,56],[105,57],[106,58],[107,59],[108,60],[109,61],[129,62],[131,63],[133,64],[132,63],[130,65],[116,10],[115,10],[158,66],[159,67],[134,68],[137,68],[156,66],[157,66],[147,66],[146,69],[144,66],[139,66],[152,66],[150,66],[154,66],[138,66],[151,66],[155,66],[140,66],[141,66],[153,66],[135,66],[142,66],[143,66],[145,66],[149,66],[160,70],[148,66],[136,66],[173,71],[172,10],[167,70],[169,72],[168,70],[161,70],[162,70],[164,70],[166,70],[170,72],[171,72],[163,72],[165,72],[120,73],[174,10],[175,10],[176,10],[177,74],[54,10],[11,10],[10,10],[2,10],[12,10],[13,10],[14,10],[15,10],[16,10],[17,10],[18,10],[19,10],[3,10],[4,10],[23,10],[20,10],[21,10],[22,10],[24,10],[25,10],[26,10],[5,10],[27,10],[28,10],[29,10],[30,10],[6,10],[34,10],[31,10],[32,10],[33,10],[35,10],[7,10],[36,10],[41,10],[42,10],[37,10],[38,10],[39,10],[40,10],[8,10],[46,10],[43,10],[44,10],[45,10],[47,10],[9,10],[48,10],[49,10],[50,10],[51,10],[52,10],[1,10],[53,10],[57,75],[56,76],[55,10]],"exportedModulesMap":[[113,1],[114,2],[112,3],[122,4],[123,5],[117,6],[124,7],[121,8],[125,9],[126,10],[127,10],[128,11],[118,12],[119,13],[58,14],[59,14],[61,15],[62,16],[63,17],[64,18],[65,19],[66,20],[67,21],[68,22],[69,23],[70,24],[71,24],[73,25],[72,26],[74,25],[75,27],[76,28],[60,29],[110,10],[77,30],[78,31],[79,32],[111,33],[80,34],[81,35],[82,36],[83,37],[84,38],[85,39],[86,40],[87,41],[88,42],[89,43],[90,43],[91,44],[92,45],[94,46],[93,47],[95,48],[96,49],[97,10],[98,50],[99,51],[100,52],[101,53],[102,54],[103,55],[104,56],[105,57],[106,58],[107,59],[108,60],[109,61],[129,62],[131,63],[133,64],[132,63],[130,65],[116,10],[115,10],[158,66],[159,67],[134,68],[137,68],[156,66],[157,66],[147,66],[146,69],[144,66],[139,66],[152,66],[150,66],[154,66],[138,66],[151,66],[155,66],[140,66],[141,66],[153,66],[135,66],[142,66],[143,66],[145,66],[149,66],[160,70],[148,66],[136,66],[173,71],[172,10],[167,70],[169,72],[168,70],[161,70],[162,70],[164,70],[166,70],[170,72],[171,72],[163,72],[165,72],[120,73],[174,10],[175,10],[176,10],[177,74],[54,10],[11,10],[10,10],[2,10],[12,10],[13,10],[14,10],[15,10],[16,10],[17,10],[18,10],[19,10],[3,10],[4,10],[23,10],[20,10],[21,10],[22,10],[24,10],[25,10],[26,10],[5,10],[27,10],[28,10],[29,10],[30,10],[6,10],[34,10],[31,10],[32,10],[33,10],[35,10],[7,10],[36,10],[41,10],[42,10],[37,10],[38,10],[39,10],[40,10],[8,10],[46,10],[43,10],[44,10],[45,10],[47,10],[9,10],[48,10],[49,10],[50,10],[51,10],[52,10],[1,10],[53,10],[57,77],[56,78]],"semanticDiagnosticsPerFile":[113,114,112,122,123,117,124,121,125,126,127,128,118,119,58,59,61,62,63,64,65,66,67,68,69,70,71,73,72,74,75,76,60,110,77,78,79,111,80,81,82,83,84,85,86,87,88,89,90,91,92,94,93,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,129,131,133,132,130,116,115,158,159,134,137,156,157,147,146,144,139,152,150,154,138,151,155,140,141,153,135,142,143,145,149,160,148,136,173,172,167,169,168,161,162,164,166,170,171,163,165,120,174,175,176,177,54,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,34,31,32,33,35,7,36,41,42,37,38,39,40,8,46,43,44,45,47,9,48,49,50,51,52,1,53,57,56,55],"latestChangedDtsFile":"./lib/index.d.ts"},"version":"4.9.3"}
package/dist/types.d.ts CHANGED
@@ -1,27 +1,40 @@
1
+ import type { ParamsSerializerOptions } from 'axios';
2
+ export declare enum AuthModes {
3
+ OAuth1 = "OAUTH1",
4
+ OAuth2 = "OAUTH2"
5
+ }
6
+ export interface CredentialsCommon {
7
+ type: AuthModes;
8
+ raw: Record<string, string>;
9
+ }
10
+ export interface OAuth1Credentials extends CredentialsCommon {
11
+ type: AuthModes.OAuth1;
12
+ oauth_token: string;
13
+ oauth_token_secret: string;
14
+ }
15
+ export interface OAuth2Credentials extends CredentialsCommon {
16
+ type: AuthModes.OAuth2;
17
+ access_token: string;
18
+ refresh_token?: string;
19
+ expires_at?: Date | undefined;
20
+ }
1
21
  export interface ProxyConfiguration {
2
- [key: string]: any;
3
22
  endpoint: string;
4
- providerConfigKey: string;
5
- connectionId: string;
23
+ providerConfigKey?: string;
24
+ connectionId?: string;
6
25
  method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'get' | 'post' | 'patch' | 'put' | 'delete';
7
26
  headers?: Record<string, string>;
8
27
  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
- };
28
+ paramsSerializer?: ParamsSerializerOptions;
14
29
  data?: unknown;
15
30
  retries?: number;
31
+ baseUrlOverride?: string;
16
32
  }
17
- interface ParamsSerializerOptions {
18
- encode?: ParamEncoder;
19
- serialize?: CustomParamsSerializer;
20
- }
21
- interface ParamEncoder {
22
- (value: any, defaultEncoder: (value: any) => any): any;
23
- }
24
- interface CustomParamsSerializer {
25
- (params: Record<string, any>, options?: ParamsSerializerOptions): string;
33
+ export interface GetRecordsRequestConfig {
34
+ providerConfigKey: string;
35
+ connectionId: string;
36
+ model: string;
37
+ delta?: string;
38
+ offset?: number;
39
+ limit?: number;
26
40
  }
27
- export {};
package/dist/types.js CHANGED
@@ -1,2 +1,6 @@
1
- export {};
1
+ export var AuthModes;
2
+ (function (AuthModes) {
3
+ AuthModes["OAuth1"] = "OAUTH1";
4
+ AuthModes["OAuth2"] = "OAUTH2";
5
+ })(AuthModes || (AuthModes = {}));
2
6
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;AACrB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}
package/dist/utils.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import type { ProxyConfiguration } from './types';
1
+ import type { ProxyConfiguration, GetRecordsRequestConfig } from './types.js';
2
2
  export declare const validateProxyConfiguration: (config: ProxyConfiguration) => void;
3
+ export declare const validateSyncRecordConfiguration: (config: GetRecordsRequestConfig) => void;
package/dist/utils.js CHANGED
@@ -6,4 +6,12 @@ export const validateProxyConfiguration = (config) => {
6
6
  }
7
7
  });
8
8
  };
9
+ export const validateSyncRecordConfiguration = (config) => {
10
+ const requiredParams = ['model', 'providerConfigKey', 'connectionId'];
11
+ requiredParams.forEach((param) => {
12
+ if (typeof config[param] === 'undefined') {
13
+ throw new Error(`${param} is missing and is required to make a proxy call!`);
14
+ }
15
+ });
16
+ };
9
17
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +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"}
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,GAAoC,CAAC,UAAU,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;IAE1G,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;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAA+B,EAAE,EAAE;IAC/E,MAAM,cAAc,GAAyC,CAAC,OAAO,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;IAE5G,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/node",
3
- "version": "0.21.14",
3
+ "version": "0.21.16",
4
4
  "description": "Nango's Node client.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,7 +13,6 @@
13
13
  },
14
14
  "license": "SEE LICENSE IN LICENSE FILE IN GIT REPOSITORY",
15
15
  "dependencies": {
16
- "@nangohq/shared": "0.21.14",
17
16
  "axios": "^1.2.0"
18
17
  },
19
18
  "engines": {
package/dist/sync.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import type { DataResponse, HubspotModels, ProxyConfiguration, SyncWebhookBody, LogLevel, UpsertResponse } from '@nangohq/shared';
2
- export { SyncWebhookBody as NangoSyncWebhookBody, HubspotModels };
3
- import { Nango } from './index';
4
- interface NangoProps {
5
- activityLogId?: number;
6
- lastSyncDate?: Date;
7
- syncId?: string;
8
- nangoConnectionId?: number;
9
- syncJobId?: number;
10
- }
11
- interface UserLogParameters {
12
- success?: boolean;
13
- level?: LogLevel;
14
- }
15
- export declare class NangoSync {
16
- nango: Nango;
17
- activityLogId?: number;
18
- lastSyncDate?: Date;
19
- syncId?: string;
20
- nangoConnectionId?: number;
21
- syncJobId?: number;
22
- private throttledCreateActivityLogMessage;
23
- constructor(config?: NangoProps);
24
- setLastSyncDate(date: Date): void;
25
- proxy(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
26
- get(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
27
- post(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
28
- patch(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
29
- delete(config: ProxyConfiguration): Promise<import("axios").AxiosResponse<any, any>>;
30
- batchSend(results: DataResponse[], model: string): Promise<UpsertResponse | null>;
31
- log(content: string, userDefinedLevel?: UserLogParameters): Promise<void>;
32
- }
package/dist/sync.js DELETED
@@ -1,97 +0,0 @@
1
- import _ from 'lodash';
2
- import { updateSyncJobResult, createActivityLogMessage, dataService, syncDataService } from '@nangohq/shared';
3
- import { Nango } from './index';
4
- export class NangoSync {
5
- nango;
6
- activityLogId;
7
- lastSyncDate;
8
- syncId;
9
- nangoConnectionId;
10
- syncJobId;
11
- throttledCreateActivityLogMessage;
12
- constructor(config = {}) {
13
- this.throttledCreateActivityLogMessage = _.throttle(createActivityLogMessage, 1000);
14
- if (config.activityLogId) {
15
- this.activityLogId = config.activityLogId;
16
- }
17
- this.nango = new Nango(config);
18
- if (config.syncId) {
19
- this.syncId = config.syncId;
20
- }
21
- if (config.nangoConnectionId) {
22
- this.nangoConnectionId = config.nangoConnectionId;
23
- }
24
- if (config.syncJobId) {
25
- this.syncJobId = config.syncJobId;
26
- }
27
- }
28
- setLastSyncDate(date) {
29
- this.lastSyncDate = date;
30
- }
31
- async proxy(config) {
32
- return this.nango.proxy(config);
33
- }
34
- async get(config) {
35
- return this.proxy({
36
- ...config,
37
- method: 'GET'
38
- });
39
- }
40
- async post(config) {
41
- return this.proxy({
42
- ...config,
43
- method: 'POST'
44
- });
45
- }
46
- async patch(config) {
47
- return this.proxy({
48
- ...config,
49
- method: 'PATCH'
50
- });
51
- }
52
- async delete(config) {
53
- return this.proxy({
54
- ...config,
55
- method: 'DELETE'
56
- });
57
- }
58
- async batchSend(results, model) {
59
- if (!this.nangoConnectionId || !this.syncId || !this.activityLogId || !this.syncJobId) {
60
- throw new Error('Nango Connection Id, Sync Id, Activity Log Id and Sync Job Id are all required');
61
- }
62
- const formattedResults = syncDataService.formatDataRecords(results, this.nangoConnectionId, model, this.syncId);
63
- const responseResults = await dataService.upsert(formattedResults, '_nango_sync_data_records', 'external_id', this.nangoConnectionId, model, this.activityLogId);
64
- if (responseResults) {
65
- const updatedResults = { added: responseResults.addedKeys.length, updated: responseResults.updatedKeys.length };
66
- await createActivityLogMessage({
67
- level: 'info',
68
- activity_log_id: this.activityLogId,
69
- content: `Batch send was a success and resulted in ${JSON.stringify(updatedResults, null, 2)}`,
70
- timestamp: Date.now()
71
- });
72
- await updateSyncJobResult(this.syncJobId, updatedResults);
73
- return responseResults;
74
- }
75
- else {
76
- await createActivityLogMessage({
77
- level: 'error',
78
- activity_log_id: this.activityLogId,
79
- content: `There was an issue with the batch send`,
80
- timestamp: Date.now()
81
- });
82
- return null;
83
- }
84
- }
85
- async log(content, userDefinedLevel) {
86
- if (!this.activityLogId) {
87
- throw new Error('There is no current activity log stream to log to');
88
- }
89
- await this.throttledCreateActivityLogMessage({
90
- level: userDefinedLevel?.level ?? 'info',
91
- activity_log_id: this.activityLogId,
92
- content,
93
- timestamp: Date.now()
94
- });
95
- }
96
- }
97
- //# sourceMappingURL=sync.js.map
package/dist/sync.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync.js","sourceRoot":"","sources":["../lib/sync.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK9G,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAehC,MAAM,OAAO,SAAS;IAClB,KAAK,CAAQ;IACb,aAAa,CAAU;IACvB,YAAY,CAAQ;IACpB,MAAM,CAAU;IAChB,iBAAiB,CAAU;IAC3B,SAAS,CAAU;IAEX,iCAAiC,CAAC;IAE1C,YAAY,SAAqB,EAAE;QAC/B,IAAI,CAAC,iCAAiC,GAAG,CAAC,CAAC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