@nangohq/node 0.35.5 → 0.35.7
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.cjs +238 -187
- package/dist/index.d.ts +90 -34
- package/dist/index.js +240 -191
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -99,6 +99,83 @@ var Nango = class {
|
|
|
99
99
|
this.activityLogId = config.activityLogId;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* =======
|
|
104
|
+
* INTEGRATIONS
|
|
105
|
+
* LIST
|
|
106
|
+
* GET
|
|
107
|
+
* CREATE
|
|
108
|
+
* UPDATE
|
|
109
|
+
* DELETE
|
|
110
|
+
* =======
|
|
111
|
+
*/
|
|
112
|
+
async listIntegrations() {
|
|
113
|
+
const url = `${this.serverUrl}/config`;
|
|
114
|
+
const response = await import_axios.default.get(url, { headers: this.enrichHeaders({}) });
|
|
115
|
+
return response.data;
|
|
116
|
+
}
|
|
117
|
+
async getIntegration(providerConfigKey, includeIntegrationCredetials = false) {
|
|
118
|
+
const url = `${this.serverUrl}/config/${providerConfigKey}`;
|
|
119
|
+
const response = await import_axios.default.get(url, { headers: this.enrichHeaders({}), params: { include_creds: includeIntegrationCredetials } });
|
|
120
|
+
return response.data;
|
|
121
|
+
}
|
|
122
|
+
async createIntegration(provider, providerConfigKey, credentials) {
|
|
123
|
+
const url = `${this.serverUrl}/config`;
|
|
124
|
+
const response = await import_axios.default.post(url, { provider, provider_config_key: providerConfigKey, ...credentials }, { headers: this.enrichHeaders({}) });
|
|
125
|
+
return response.data;
|
|
126
|
+
}
|
|
127
|
+
async updateIntegration(provider, providerConfigKey, credentials) {
|
|
128
|
+
const url = `${this.serverUrl}/config`;
|
|
129
|
+
const response = await import_axios.default.put(url, { provider, provider_config_key: providerConfigKey, ...credentials }, { headers: this.enrichHeaders({}) });
|
|
130
|
+
return response.data;
|
|
131
|
+
}
|
|
132
|
+
async deleteIntegration(providerConfigKey) {
|
|
133
|
+
const url = `${this.serverUrl}/config/${providerConfigKey}`;
|
|
134
|
+
return await import_axios.default.delete(url, { headers: this.enrichHeaders({}) });
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* =======
|
|
138
|
+
* CONNECTIONS
|
|
139
|
+
* LIST
|
|
140
|
+
* GET
|
|
141
|
+
* IMPORT / CREATE -- DEPRECATED use REST API
|
|
142
|
+
* GET TOKEN
|
|
143
|
+
* GET RAW TOKEN
|
|
144
|
+
* GET METADATA
|
|
145
|
+
* SET METADATA
|
|
146
|
+
* DELETE
|
|
147
|
+
* =======
|
|
148
|
+
*/
|
|
149
|
+
/**
|
|
150
|
+
* Get the list of Connections, which does not contain access credentials.
|
|
151
|
+
*/
|
|
152
|
+
async listConnections(connectionId) {
|
|
153
|
+
const response = await this.listConnectionDetails(connectionId);
|
|
154
|
+
return response.data;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get the Connection object, which also contains access credentials and full credentials payload
|
|
158
|
+
* returned by the external API.
|
|
159
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
160
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
161
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
162
|
+
* you can set the forceRefresh argument to true.
|
|
163
|
+
* @param [refreshToken] - When set this returns the refresh token as part of the response
|
|
164
|
+
*/
|
|
165
|
+
async getConnection(providerConfigKey, connectionId, forceRefresh, refreshToken) {
|
|
166
|
+
const response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh, refreshToken);
|
|
167
|
+
return response.data;
|
|
168
|
+
}
|
|
169
|
+
async importConnection(_connectionArgs) {
|
|
170
|
+
throw new Error(
|
|
171
|
+
"This method has been deprecated, please use the REST API to import a connection. See https://docs.nango.dev/api-reference/connection/post"
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
async createConnection(_connectionArgs) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
"This method has been deprecated, please use the REST API to create a connection. See https://docs.nango.dev/api-reference/connection/post"
|
|
177
|
+
);
|
|
178
|
+
}
|
|
102
179
|
/**
|
|
103
180
|
* For OAuth 2: returns the access token directly as a string.
|
|
104
181
|
* For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
|
|
@@ -133,100 +210,56 @@ var Nango = class {
|
|
|
133
210
|
const credentials = response.data.credentials;
|
|
134
211
|
return credentials.raw;
|
|
135
212
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
140
|
-
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
141
|
-
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
142
|
-
* you can set the forceRefresh argument to true.
|
|
143
|
-
* @param [refreshToken] - When set this returns the refresh token as part of the response
|
|
144
|
-
*/
|
|
145
|
-
async getConnection(providerConfigKey, connectionId, forceRefresh, refreshToken) {
|
|
146
|
-
const response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh, refreshToken);
|
|
147
|
-
return response.data;
|
|
148
|
-
}
|
|
149
|
-
async proxy(config) {
|
|
150
|
-
if (!config.connectionId && this.connectionId) {
|
|
151
|
-
config.connectionId = this.connectionId;
|
|
152
|
-
}
|
|
153
|
-
if (!config.providerConfigKey && this.providerConfigKey) {
|
|
154
|
-
config.providerConfigKey = this.providerConfigKey;
|
|
155
|
-
}
|
|
156
|
-
validateProxyConfiguration(config);
|
|
157
|
-
const { providerConfigKey, connectionId, method, retries, headers: customHeaders, baseUrlOverride } = config;
|
|
158
|
-
const url = `${this.serverUrl}/proxy${config.endpoint[0] === "/" ? "" : "/"}${config.endpoint}`;
|
|
159
|
-
const customPrefixedHeaders = customHeaders && Object.keys(customHeaders).length > 0 ? Object.keys(customHeaders).reduce((acc, key) => {
|
|
160
|
-
acc[`Nango-Proxy-${key}`] = customHeaders[key];
|
|
161
|
-
return acc;
|
|
162
|
-
}, {}) : {};
|
|
163
|
-
const headers = {
|
|
164
|
-
"Connection-Id": connectionId,
|
|
165
|
-
"Provider-Config-Key": providerConfigKey,
|
|
166
|
-
"Base-Url-Override": baseUrlOverride || "",
|
|
167
|
-
"Nango-Is-Sync": this.isSync,
|
|
168
|
-
"Nango-Is-Dry-Run": this.dryRun,
|
|
169
|
-
"Nango-Activity-Log-Id": this.activityLogId || "",
|
|
170
|
-
...customPrefixedHeaders
|
|
171
|
-
};
|
|
172
|
-
if (retries) {
|
|
173
|
-
headers["Retries"] = retries;
|
|
213
|
+
async getMetadata(providerConfigKey, connectionId) {
|
|
214
|
+
if (!providerConfigKey) {
|
|
215
|
+
throw new Error("Provider Config Key is required");
|
|
174
216
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
if (config.params) {
|
|
179
|
-
options.params = config.params;
|
|
217
|
+
if (!connectionId) {
|
|
218
|
+
throw new Error("Connection Id is required");
|
|
180
219
|
}
|
|
181
|
-
|
|
182
|
-
|
|
220
|
+
const response = await this.getConnectionDetails(providerConfigKey, connectionId, false, false, {
|
|
221
|
+
"Nango-Is-Sync": true,
|
|
222
|
+
"Nango-Is-Dry-Run": this.dryRun
|
|
223
|
+
});
|
|
224
|
+
return response.data.metadata;
|
|
225
|
+
}
|
|
226
|
+
async setMetadata(providerConfigKey, connectionId, metadata) {
|
|
227
|
+
if (!providerConfigKey) {
|
|
228
|
+
throw new Error("Provider Config Key is required");
|
|
183
229
|
}
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
return Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
|
|
187
|
-
};
|
|
188
|
-
console.log(
|
|
189
|
-
`Nango Proxy Request: ${method?.toUpperCase()} ${url}${config.params ? `?${stringifyParams(config.params)}` : ""}`
|
|
190
|
-
);
|
|
230
|
+
if (!connectionId) {
|
|
231
|
+
throw new Error("Connection Id is required");
|
|
191
232
|
}
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
} else if (method?.toUpperCase() === "PATCH") {
|
|
195
|
-
return import_axios.default.patch(url, config.data, options);
|
|
196
|
-
} else if (method?.toUpperCase() === "PUT") {
|
|
197
|
-
return import_axios.default.put(url, config.data, options);
|
|
198
|
-
} else if (method?.toUpperCase() === "DELETE") {
|
|
199
|
-
return import_axios.default.delete(url, options);
|
|
200
|
-
} else {
|
|
201
|
-
return import_axios.default.get(url, options);
|
|
233
|
+
if (!metadata) {
|
|
234
|
+
throw new Error("Metadata is required");
|
|
202
235
|
}
|
|
236
|
+
const url = `${this.serverUrl}/connection/${connectionId}/metadata?provider_config_key=${providerConfigKey}`;
|
|
237
|
+
const headers = {
|
|
238
|
+
"Provider-Config-Key": providerConfigKey
|
|
239
|
+
};
|
|
240
|
+
return import_axios.default.post(url, metadata, { headers: this.enrichHeaders(headers) });
|
|
203
241
|
}
|
|
204
|
-
async
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return this.proxy({
|
|
212
|
-
...config,
|
|
213
|
-
method: "POST"
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
async patch(config) {
|
|
217
|
-
return this.proxy({
|
|
218
|
-
...config,
|
|
219
|
-
method: "PATCH"
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
async delete(config) {
|
|
223
|
-
return this.proxy({
|
|
224
|
-
...config,
|
|
225
|
-
method: "DELETE"
|
|
226
|
-
});
|
|
242
|
+
async deleteConnection(providerConfigKey, connectionId) {
|
|
243
|
+
const url = `${this.serverUrl}/connection/${connectionId}?provider_config_key=${providerConfigKey}`;
|
|
244
|
+
const headers = {
|
|
245
|
+
"Content-Type": "application/json",
|
|
246
|
+
"Accept-Encoding": "application/json"
|
|
247
|
+
};
|
|
248
|
+
return import_axios.default.delete(url, { headers: this.enrichHeaders(headers) });
|
|
227
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* =======
|
|
252
|
+
* SYNCS
|
|
253
|
+
* GET RECORDS
|
|
254
|
+
* TRIGGER
|
|
255
|
+
* START
|
|
256
|
+
* PAUSE
|
|
257
|
+
* STATUS
|
|
258
|
+
* GET ENVIRONMENT VARIABLES
|
|
259
|
+
* =======
|
|
260
|
+
*/
|
|
228
261
|
async getRecords(config) {
|
|
229
|
-
const { connectionId, providerConfigKey, model, delta, offset, limit, includeNangoMetadata } = config;
|
|
262
|
+
const { connectionId, providerConfigKey, model, delta, offset, limit, includeNangoMetadata, filter } = config;
|
|
230
263
|
validateSyncRecordConfiguration(config);
|
|
231
264
|
const order = config?.order === "asc" ? "asc" : "desc";
|
|
232
265
|
let sortBy = "id";
|
|
@@ -238,25 +271,13 @@ var Nango = class {
|
|
|
238
271
|
sortBy = "updated_at";
|
|
239
272
|
break;
|
|
240
273
|
}
|
|
241
|
-
let filter = "";
|
|
242
|
-
switch (config.filter) {
|
|
243
|
-
case "deleted":
|
|
244
|
-
filter = "deleted";
|
|
245
|
-
break;
|
|
246
|
-
case "updated":
|
|
247
|
-
filter = "updated";
|
|
248
|
-
break;
|
|
249
|
-
case "added":
|
|
250
|
-
filter = "added";
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
274
|
if (includeNangoMetadata) {
|
|
254
275
|
console.warn(
|
|
255
276
|
`The includeNangoMetadata option will be deprecated soon and will be removed in a future release. Each record now has a _nango_metadata property which includes the same properties.`
|
|
256
277
|
);
|
|
257
278
|
}
|
|
258
279
|
const includeMetadata = includeNangoMetadata || false;
|
|
259
|
-
const url = `${this.serverUrl}/sync/records/?model=${model}&order=${order}&delta=${delta || ""}&offset=${offset || ""}&limit=${limit || ""}&sort_by=${sortBy || ""}&include_nango_metadata=${includeMetadata}
|
|
280
|
+
const url = `${this.serverUrl}/sync/records/?model=${model}&order=${order}&delta=${delta || ""}&offset=${offset || ""}&limit=${limit || ""}&sort_by=${sortBy || ""}&include_nango_metadata=${includeMetadata}${filter ? `&filter=${filter}` : ""}`;
|
|
260
281
|
const headers = {
|
|
261
282
|
"Connection-Id": connectionId,
|
|
262
283
|
"Provider-Config-Key": providerConfigKey
|
|
@@ -267,69 +288,6 @@ var Nango = class {
|
|
|
267
288
|
const response = await import_axios.default.get(url, options);
|
|
268
289
|
return response.data;
|
|
269
290
|
}
|
|
270
|
-
async getConnectionDetails(providerConfigKey, connectionId, forceRefresh = false, refreshToken = false, additionalHeader = {}) {
|
|
271
|
-
const url = `${this.serverUrl}/connection/${connectionId}`;
|
|
272
|
-
const headers = {
|
|
273
|
-
"Content-Type": "application/json",
|
|
274
|
-
"Accept-Encoding": "application/json"
|
|
275
|
-
};
|
|
276
|
-
if (additionalHeader) {
|
|
277
|
-
Object.assign(headers, additionalHeader);
|
|
278
|
-
}
|
|
279
|
-
const params = {
|
|
280
|
-
provider_config_key: providerConfigKey,
|
|
281
|
-
force_refresh: forceRefresh,
|
|
282
|
-
refresh_token: refreshToken
|
|
283
|
-
};
|
|
284
|
-
return import_axios.default.get(url, { params, headers: this.enrichHeaders(headers) });
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Get the list of Connections, which does not contain access credentials.
|
|
288
|
-
*/
|
|
289
|
-
async listConnections(connectionId) {
|
|
290
|
-
const response = await this.listConnectionDetails(connectionId);
|
|
291
|
-
return response.data;
|
|
292
|
-
}
|
|
293
|
-
async getIntegration(providerConfigKey, includeIntegrationCredetials = false) {
|
|
294
|
-
const url = `${this.serverUrl}/config/${providerConfigKey}`;
|
|
295
|
-
const response = await import_axios.default.get(url, { headers: this.enrichHeaders({}), params: { include_creds: includeIntegrationCredetials } });
|
|
296
|
-
return response.data;
|
|
297
|
-
}
|
|
298
|
-
async setMetadata(providerConfigKey, connectionId, metadata) {
|
|
299
|
-
if (!providerConfigKey) {
|
|
300
|
-
throw new Error("Provider Config Key is required");
|
|
301
|
-
}
|
|
302
|
-
if (!connectionId) {
|
|
303
|
-
throw new Error("Connection Id is required");
|
|
304
|
-
}
|
|
305
|
-
if (!metadata) {
|
|
306
|
-
throw new Error("Metadata is required");
|
|
307
|
-
}
|
|
308
|
-
const url = `${this.serverUrl}/connection/${connectionId}/metadata?provider_config_key=${providerConfigKey}`;
|
|
309
|
-
const headers = {
|
|
310
|
-
"Provider-Config-Key": providerConfigKey
|
|
311
|
-
};
|
|
312
|
-
return import_axios.default.post(url, metadata, { headers: this.enrichHeaders(headers) });
|
|
313
|
-
}
|
|
314
|
-
async setFieldMapping(_fieldMapping, _optionalProviderConfigKey, _optionalConnectionId) {
|
|
315
|
-
throw new Error("setFieldMapping is deprecated. Please use setMetadata instead.");
|
|
316
|
-
}
|
|
317
|
-
async getMetadata(providerConfigKey, connectionId) {
|
|
318
|
-
if (!providerConfigKey) {
|
|
319
|
-
throw new Error("Provider Config Key is required");
|
|
320
|
-
}
|
|
321
|
-
if (!connectionId) {
|
|
322
|
-
throw new Error("Connection Id is required");
|
|
323
|
-
}
|
|
324
|
-
const response = await this.getConnectionDetails(providerConfigKey, connectionId, false, false, {
|
|
325
|
-
"Nango-Is-Sync": true,
|
|
326
|
-
"Nango-Is-Dry-Run": this.dryRun
|
|
327
|
-
});
|
|
328
|
-
return response.data.metadata;
|
|
329
|
-
}
|
|
330
|
-
async getFieldMapping(_optionalProviderConfigKey, _optionalConnectionId) {
|
|
331
|
-
throw new Error("getFieldMapping is deprecated. Please use getMetadata instead.");
|
|
332
|
-
}
|
|
333
291
|
async triggerSync(providerConfigKey, syncs, connectionId) {
|
|
334
292
|
const url = `${this.serverUrl}/sync/trigger`;
|
|
335
293
|
if (typeof syncs === "string") {
|
|
@@ -342,7 +300,7 @@ var Nango = class {
|
|
|
342
300
|
};
|
|
343
301
|
return import_axios.default.post(url, body, { headers: this.enrichHeaders() });
|
|
344
302
|
}
|
|
345
|
-
async
|
|
303
|
+
async startSync(providerConfigKey, syncs, connectionId) {
|
|
346
304
|
if (!providerConfigKey) {
|
|
347
305
|
throw new Error("Provider Config Key is required");
|
|
348
306
|
}
|
|
@@ -352,15 +310,15 @@ var Nango = class {
|
|
|
352
310
|
if (typeof syncs === "string") {
|
|
353
311
|
throw new Error("Syncs must be an array of strings. If it is a single sync, please wrap it in an array.");
|
|
354
312
|
}
|
|
355
|
-
const url = `${this.serverUrl}/sync/pause`;
|
|
356
313
|
const body = {
|
|
357
314
|
syncs: syncs || [],
|
|
358
315
|
provider_config_key: providerConfigKey,
|
|
359
316
|
connection_id: connectionId
|
|
360
317
|
};
|
|
318
|
+
const url = `${this.serverUrl}/sync/start`;
|
|
361
319
|
return import_axios.default.post(url, body, { headers: this.enrichHeaders() });
|
|
362
320
|
}
|
|
363
|
-
async
|
|
321
|
+
async pauseSync(providerConfigKey, syncs, connectionId) {
|
|
364
322
|
if (!providerConfigKey) {
|
|
365
323
|
throw new Error("Provider Config Key is required");
|
|
366
324
|
}
|
|
@@ -370,12 +328,12 @@ var Nango = class {
|
|
|
370
328
|
if (typeof syncs === "string") {
|
|
371
329
|
throw new Error("Syncs must be an array of strings. If it is a single sync, please wrap it in an array.");
|
|
372
330
|
}
|
|
331
|
+
const url = `${this.serverUrl}/sync/pause`;
|
|
373
332
|
const body = {
|
|
374
333
|
syncs: syncs || [],
|
|
375
334
|
provider_config_key: providerConfigKey,
|
|
376
335
|
connection_id: connectionId
|
|
377
336
|
};
|
|
378
|
-
const url = `${this.serverUrl}/sync/start`;
|
|
379
337
|
return import_axios.default.post(url, body, { headers: this.enrichHeaders() });
|
|
380
338
|
}
|
|
381
339
|
async syncStatus(providerConfigKey, syncs, connectionId) {
|
|
@@ -397,6 +355,24 @@ var Nango = class {
|
|
|
397
355
|
const response = await import_axios.default.get(url, { headers: this.enrichHeaders(), params });
|
|
398
356
|
return response.data;
|
|
399
357
|
}
|
|
358
|
+
async getEnvironmentVariables() {
|
|
359
|
+
const url = `${this.serverUrl}/environment-variables`;
|
|
360
|
+
const headers = {
|
|
361
|
+
"Content-Type": "application/json",
|
|
362
|
+
"Accept-Encoding": "application/json"
|
|
363
|
+
};
|
|
364
|
+
const response = await import_axios.default.get(url, { headers: this.enrichHeaders(headers) });
|
|
365
|
+
if (!response.data) {
|
|
366
|
+
return [];
|
|
367
|
+
}
|
|
368
|
+
return response.data;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* =======
|
|
372
|
+
* ACTIONS
|
|
373
|
+
* TRIGGER
|
|
374
|
+
* =======
|
|
375
|
+
*/
|
|
400
376
|
async triggerAction(providerConfigKey, connectionId, actionName, input) {
|
|
401
377
|
const url = `${this.serverUrl}/action/trigger`;
|
|
402
378
|
const headers = {
|
|
@@ -410,35 +386,110 @@ var Nango = class {
|
|
|
410
386
|
const response = await import_axios.default.post(url, body, { headers: this.enrichHeaders(headers) });
|
|
411
387
|
return response.data;
|
|
412
388
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
389
|
+
/**
|
|
390
|
+
* =======
|
|
391
|
+
* PROXY
|
|
392
|
+
* GET
|
|
393
|
+
* POST
|
|
394
|
+
* PUT
|
|
395
|
+
* PATCH
|
|
396
|
+
* DELETE
|
|
397
|
+
* =======
|
|
398
|
+
*/
|
|
399
|
+
async proxy(config) {
|
|
400
|
+
if (!config.connectionId && this.connectionId) {
|
|
401
|
+
config.connectionId = this.connectionId;
|
|
402
|
+
}
|
|
403
|
+
if (!config.providerConfigKey && this.providerConfigKey) {
|
|
404
|
+
config.providerConfigKey = this.providerConfigKey;
|
|
405
|
+
}
|
|
406
|
+
validateProxyConfiguration(config);
|
|
407
|
+
const { providerConfigKey, connectionId, method, retries, headers: customHeaders, baseUrlOverride } = config;
|
|
408
|
+
const url = `${this.serverUrl}/proxy${config.endpoint[0] === "/" ? "" : "/"}${config.endpoint}`;
|
|
409
|
+
const customPrefixedHeaders = customHeaders && Object.keys(customHeaders).length > 0 ? Object.keys(customHeaders).reduce((acc, key) => {
|
|
410
|
+
acc[`Nango-Proxy-${key}`] = customHeaders[key];
|
|
411
|
+
return acc;
|
|
412
|
+
}, {}) : {};
|
|
420
413
|
const headers = {
|
|
421
|
-
"
|
|
422
|
-
"
|
|
414
|
+
"Connection-Id": connectionId,
|
|
415
|
+
"Provider-Config-Key": providerConfigKey,
|
|
416
|
+
"Base-Url-Override": baseUrlOverride || "",
|
|
417
|
+
"Nango-Is-Sync": this.isSync,
|
|
418
|
+
"Nango-Is-Dry-Run": this.dryRun,
|
|
419
|
+
"Nango-Activity-Log-Id": this.activityLogId || "",
|
|
420
|
+
...customPrefixedHeaders
|
|
423
421
|
};
|
|
424
|
-
|
|
422
|
+
if (retries) {
|
|
423
|
+
headers["Retries"] = retries;
|
|
424
|
+
}
|
|
425
|
+
const options = {
|
|
426
|
+
headers: this.enrichHeaders(headers)
|
|
427
|
+
};
|
|
428
|
+
if (config.params) {
|
|
429
|
+
options.params = config.params;
|
|
430
|
+
}
|
|
431
|
+
if (config.paramsSerializer) {
|
|
432
|
+
options.paramsSerializer = config.paramsSerializer;
|
|
433
|
+
}
|
|
434
|
+
if (this.dryRun) {
|
|
435
|
+
const stringifyParams = (params) => {
|
|
436
|
+
return Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
|
|
437
|
+
};
|
|
438
|
+
console.log(
|
|
439
|
+
`Nango Proxy Request: ${method?.toUpperCase()} ${url}${config.params ? `?${stringifyParams(config.params)}` : ""}`
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
if (method?.toUpperCase() === "POST") {
|
|
443
|
+
return import_axios.default.post(url, config.data, options);
|
|
444
|
+
} else if (method?.toUpperCase() === "PATCH") {
|
|
445
|
+
return import_axios.default.patch(url, config.data, options);
|
|
446
|
+
} else if (method?.toUpperCase() === "PUT") {
|
|
447
|
+
return import_axios.default.put(url, config.data, options);
|
|
448
|
+
} else if (method?.toUpperCase() === "DELETE") {
|
|
449
|
+
return import_axios.default.delete(url, options);
|
|
450
|
+
} else {
|
|
451
|
+
return import_axios.default.get(url, options);
|
|
452
|
+
}
|
|
425
453
|
}
|
|
426
|
-
async
|
|
427
|
-
|
|
454
|
+
async get(config) {
|
|
455
|
+
return this.proxy({
|
|
456
|
+
...config,
|
|
457
|
+
method: "GET"
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
async post(config) {
|
|
461
|
+
return this.proxy({
|
|
462
|
+
...config,
|
|
463
|
+
method: "POST"
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
async patch(config) {
|
|
467
|
+
return this.proxy({
|
|
468
|
+
...config,
|
|
469
|
+
method: "PATCH"
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
async delete(config) {
|
|
473
|
+
return this.proxy({
|
|
474
|
+
...config,
|
|
475
|
+
method: "DELETE"
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
async getConnectionDetails(providerConfigKey, connectionId, forceRefresh = false, refreshToken = false, additionalHeader = {}) {
|
|
479
|
+
const url = `${this.serverUrl}/connection/${connectionId}`;
|
|
428
480
|
const headers = {
|
|
429
481
|
"Content-Type": "application/json",
|
|
430
482
|
"Accept-Encoding": "application/json"
|
|
431
483
|
};
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return [];
|
|
484
|
+
if (additionalHeader) {
|
|
485
|
+
Object.assign(headers, additionalHeader);
|
|
435
486
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
});
|
|
487
|
+
const params = {
|
|
488
|
+
provider_config_key: providerConfigKey,
|
|
489
|
+
force_refresh: forceRefresh,
|
|
490
|
+
refresh_token: refreshToken
|
|
491
|
+
};
|
|
492
|
+
return import_axios.default.get(url, { params, headers: this.enrichHeaders(headers) });
|
|
442
493
|
}
|
|
443
494
|
async listConnectionDetails(connectionId) {
|
|
444
495
|
let url = `${this.serverUrl}/connection?`;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { AuthModes, OAuth1Credentials, OAuth2Credentials, ProxyConfiguration, GetRecordsRequestConfig, BasicApiCredentials, ApiKeyCredentials, Metadata, Connection, ConnectionList, Integration, IntegrationWithCreds, SyncStatusResponse } from './types.js';
|
|
2
|
+
import { AuthModes, OAuth1Credentials, OAuth2Credentials, ProxyConfiguration, GetRecordsRequestConfig, BasicApiCredentials, ApiKeyCredentials, AppCredentials, Metadata, Connection, ConnectionList, Integration, IntegrationWithCreds, SyncStatusResponse } from './types.js';
|
|
3
3
|
export declare const stagingHost = "https://api-staging.nango.dev";
|
|
4
4
|
export declare const prodHost = "https://api.nango.dev";
|
|
5
5
|
interface NangoProps {
|
|
@@ -59,6 +59,58 @@ export declare class Nango {
|
|
|
59
59
|
dryRun: boolean;
|
|
60
60
|
activityLogId?: number;
|
|
61
61
|
constructor(config: NangoProps);
|
|
62
|
+
/**
|
|
63
|
+
* =======
|
|
64
|
+
* INTEGRATIONS
|
|
65
|
+
* LIST
|
|
66
|
+
* GET
|
|
67
|
+
* CREATE
|
|
68
|
+
* UPDATE
|
|
69
|
+
* DELETE
|
|
70
|
+
* =======
|
|
71
|
+
*/
|
|
72
|
+
listIntegrations(): Promise<Pick<Integration, 'unique_key' | 'provider'>[]>;
|
|
73
|
+
getIntegration(providerConfigKey: string, includeIntegrationCredetials?: boolean): Promise<Integration | IntegrationWithCreds>;
|
|
74
|
+
createIntegration(provider: string, providerConfigKey: string, credentials?: Record<string, string>): Promise<Integration>;
|
|
75
|
+
updateIntegration(provider: string, providerConfigKey: string, credentials?: Record<string, string>): Promise<Integration>;
|
|
76
|
+
deleteIntegration(providerConfigKey: string): Promise<AxiosResponse<void>>;
|
|
77
|
+
/**
|
|
78
|
+
* =======
|
|
79
|
+
* CONNECTIONS
|
|
80
|
+
* LIST
|
|
81
|
+
* GET
|
|
82
|
+
* IMPORT / CREATE -- DEPRECATED use REST API
|
|
83
|
+
* GET TOKEN
|
|
84
|
+
* GET RAW TOKEN
|
|
85
|
+
* GET METADATA
|
|
86
|
+
* SET METADATA
|
|
87
|
+
* DELETE
|
|
88
|
+
* =======
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Get the list of Connections, which does not contain access credentials.
|
|
92
|
+
*/
|
|
93
|
+
listConnections(connectionId?: string): Promise<{
|
|
94
|
+
connections: ConnectionList[];
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Get the Connection object, which also contains access credentials and full credentials payload
|
|
98
|
+
* returned by the external API.
|
|
99
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
100
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
101
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
102
|
+
* you can set the forceRefresh argument to true.
|
|
103
|
+
* @param [refreshToken] - When set this returns the refresh token as part of the response
|
|
104
|
+
*/
|
|
105
|
+
getConnection(providerConfigKey: string, connectionId: string, forceRefresh?: boolean, refreshToken?: boolean): Promise<Connection>;
|
|
106
|
+
importConnection(_connectionArgs: CreateConnectionOAuth1 | (CreateConnectionOAuth2 & {
|
|
107
|
+
metadata: string;
|
|
108
|
+
connection_config: string;
|
|
109
|
+
})): Promise<void>;
|
|
110
|
+
createConnection(_connectionArgs: CreateConnectionOAuth1 | (CreateConnectionOAuth2 & {
|
|
111
|
+
metadata: string;
|
|
112
|
+
connection_config: string;
|
|
113
|
+
})): Promise<void>;
|
|
62
114
|
/**
|
|
63
115
|
* For OAuth 2: returns the access token directly as a string.
|
|
64
116
|
* For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
|
|
@@ -69,7 +121,7 @@ export declare class Nango {
|
|
|
69
121
|
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
70
122
|
* you can set the forceRefresh argument to true.
|
|
71
123
|
* */
|
|
72
|
-
getToken(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<string | OAuth1Token | BasicApiCredentials | ApiKeyCredentials>;
|
|
124
|
+
getToken(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<string | OAuth1Token | BasicApiCredentials | ApiKeyCredentials | AppCredentials>;
|
|
73
125
|
/**
|
|
74
126
|
* Get the full (fresh) credentials payload returned by the external API,
|
|
75
127
|
* which also contains access credentials.
|
|
@@ -79,50 +131,54 @@ export declare class Nango {
|
|
|
79
131
|
* you can set the forceRefresh argument to true.
|
|
80
132
|
* */
|
|
81
133
|
getRawTokenResponse<T = Record<string, any>>(providerConfigKey: string, connectionId: string, forceRefresh?: boolean): Promise<T>;
|
|
134
|
+
getMetadata<T = Metadata>(providerConfigKey: string, connectionId: string): Promise<T>;
|
|
135
|
+
setMetadata(providerConfigKey: string, connectionId: string, metadata: Record<string, any>): Promise<AxiosResponse<void>>;
|
|
136
|
+
deleteConnection(providerConfigKey: string, connectionId: string): Promise<AxiosResponse<void>>;
|
|
82
137
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
138
|
+
* =======
|
|
139
|
+
* SYNCS
|
|
140
|
+
* GET RECORDS
|
|
141
|
+
* TRIGGER
|
|
142
|
+
* START
|
|
143
|
+
* PAUSE
|
|
144
|
+
* STATUS
|
|
145
|
+
* GET ENVIRONMENT VARIABLES
|
|
146
|
+
* =======
|
|
90
147
|
*/
|
|
91
|
-
getConnection(providerConfigKey: string, connectionId: string, forceRefresh?: boolean, refreshToken?: boolean): Promise<Connection>;
|
|
92
|
-
proxy<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
93
|
-
get<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
94
|
-
post<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
95
|
-
patch<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
96
|
-
delete<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
97
148
|
getRecords<T = any>(config: GetRecordsRequestConfig): Promise<(T & {
|
|
98
149
|
_nango_metadata: RecordMetadata;
|
|
99
150
|
})[]>;
|
|
100
|
-
private getConnectionDetails;
|
|
101
|
-
/**
|
|
102
|
-
* Get the list of Connections, which does not contain access credentials.
|
|
103
|
-
*/
|
|
104
|
-
listConnections(connectionId?: string): Promise<{
|
|
105
|
-
connections: ConnectionList[];
|
|
106
|
-
}>;
|
|
107
|
-
getIntegration(providerConfigKey: string, includeIntegrationCredetials?: boolean): Promise<Integration | IntegrationWithCreds>;
|
|
108
|
-
setMetadata(providerConfigKey: string, connectionId: string, metadata: Record<string, any>): Promise<AxiosResponse<void>>;
|
|
109
|
-
setFieldMapping(_fieldMapping: Record<string, string>, _optionalProviderConfigKey?: string, _optionalConnectionId?: string): Promise<AxiosResponse<void>>;
|
|
110
|
-
getMetadata<T = Metadata>(providerConfigKey: string, connectionId: string): Promise<T>;
|
|
111
|
-
getFieldMapping(_optionalProviderConfigKey?: string, _optionalConnectionId?: string): Promise<Record<string, string>>;
|
|
112
151
|
triggerSync(providerConfigKey: string, syncs?: string[], connectionId?: string): Promise<void>;
|
|
113
|
-
pauseSync(providerConfigKey: string, syncs: string[], connectionId?: string): Promise<void>;
|
|
114
152
|
startSync(providerConfigKey: string, syncs: string[], connectionId?: string): Promise<void>;
|
|
153
|
+
pauseSync(providerConfigKey: string, syncs: string[], connectionId?: string): Promise<void>;
|
|
115
154
|
syncStatus(providerConfigKey: string, syncs: '*' | string[], connectionId?: string): Promise<SyncStatusResponse>;
|
|
116
|
-
triggerAction(providerConfigKey: string, connectionId: string, actionName: string, input: Record<string, unknown>): Promise<object>;
|
|
117
|
-
createConnection(_connectionArgs: CreateConnectionOAuth1 | (CreateConnectionOAuth2 & {
|
|
118
|
-
metadata: string;
|
|
119
|
-
connection_config: string;
|
|
120
|
-
})): Promise<void>;
|
|
121
|
-
deleteConnection(providerConfigKey: string, connectionId: string): Promise<void>;
|
|
122
155
|
getEnvironmentVariables(): Promise<{
|
|
123
156
|
name: string;
|
|
124
157
|
value: string;
|
|
125
158
|
}[]>;
|
|
159
|
+
/**
|
|
160
|
+
* =======
|
|
161
|
+
* ACTIONS
|
|
162
|
+
* TRIGGER
|
|
163
|
+
* =======
|
|
164
|
+
*/
|
|
165
|
+
triggerAction(providerConfigKey: string, connectionId: string, actionName: string, input: Record<string, unknown>): Promise<object>;
|
|
166
|
+
/**
|
|
167
|
+
* =======
|
|
168
|
+
* PROXY
|
|
169
|
+
* GET
|
|
170
|
+
* POST
|
|
171
|
+
* PUT
|
|
172
|
+
* PATCH
|
|
173
|
+
* DELETE
|
|
174
|
+
* =======
|
|
175
|
+
*/
|
|
176
|
+
proxy<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
177
|
+
get<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
178
|
+
post<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
179
|
+
patch<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
180
|
+
delete<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
181
|
+
private getConnectionDetails;
|
|
126
182
|
private listConnectionDetails;
|
|
127
183
|
private enrichHeaders;
|
|
128
184
|
}
|
package/dist/index.js
CHANGED
|
@@ -44,6 +44,79 @@ export class Nango {
|
|
|
44
44
|
this.activityLogId = config.activityLogId;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* =======
|
|
49
|
+
* INTEGRATIONS
|
|
50
|
+
* LIST
|
|
51
|
+
* GET
|
|
52
|
+
* CREATE
|
|
53
|
+
* UPDATE
|
|
54
|
+
* DELETE
|
|
55
|
+
* =======
|
|
56
|
+
*/
|
|
57
|
+
async listIntegrations() {
|
|
58
|
+
const url = `${this.serverUrl}/config`;
|
|
59
|
+
const response = await axios.get(url, { headers: this.enrichHeaders({}) });
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
async getIntegration(providerConfigKey, includeIntegrationCredetials = false) {
|
|
63
|
+
const url = `${this.serverUrl}/config/${providerConfigKey}`;
|
|
64
|
+
const response = await axios.get(url, { headers: this.enrichHeaders({}), params: { include_creds: includeIntegrationCredetials } });
|
|
65
|
+
return response.data;
|
|
66
|
+
}
|
|
67
|
+
async createIntegration(provider, providerConfigKey, credentials) {
|
|
68
|
+
const url = `${this.serverUrl}/config`;
|
|
69
|
+
const response = await axios.post(url, { provider, provider_config_key: providerConfigKey, ...credentials }, { headers: this.enrichHeaders({}) });
|
|
70
|
+
return response.data;
|
|
71
|
+
}
|
|
72
|
+
async updateIntegration(provider, providerConfigKey, credentials) {
|
|
73
|
+
const url = `${this.serverUrl}/config`;
|
|
74
|
+
const response = await axios.put(url, { provider, provider_config_key: providerConfigKey, ...credentials }, { headers: this.enrichHeaders({}) });
|
|
75
|
+
return response.data;
|
|
76
|
+
}
|
|
77
|
+
async deleteIntegration(providerConfigKey) {
|
|
78
|
+
const url = `${this.serverUrl}/config/${providerConfigKey}`;
|
|
79
|
+
return await axios.delete(url, { headers: this.enrichHeaders({}) });
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* =======
|
|
83
|
+
* CONNECTIONS
|
|
84
|
+
* LIST
|
|
85
|
+
* GET
|
|
86
|
+
* IMPORT / CREATE -- DEPRECATED use REST API
|
|
87
|
+
* GET TOKEN
|
|
88
|
+
* GET RAW TOKEN
|
|
89
|
+
* GET METADATA
|
|
90
|
+
* SET METADATA
|
|
91
|
+
* DELETE
|
|
92
|
+
* =======
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* Get the list of Connections, which does not contain access credentials.
|
|
96
|
+
*/
|
|
97
|
+
async listConnections(connectionId) {
|
|
98
|
+
const response = await this.listConnectionDetails(connectionId);
|
|
99
|
+
return response.data;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get the Connection object, which also contains access credentials and full credentials payload
|
|
103
|
+
* returned by the external API.
|
|
104
|
+
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
105
|
+
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
106
|
+
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
107
|
+
* you can set the forceRefresh argument to true.
|
|
108
|
+
* @param [refreshToken] - When set this returns the refresh token as part of the response
|
|
109
|
+
*/
|
|
110
|
+
async getConnection(providerConfigKey, connectionId, forceRefresh, refreshToken) {
|
|
111
|
+
const response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh, refreshToken);
|
|
112
|
+
return response.data;
|
|
113
|
+
}
|
|
114
|
+
async importConnection(_connectionArgs) {
|
|
115
|
+
throw new Error('This method has been deprecated, please use the REST API to import a connection. See https://docs.nango.dev/api-reference/connection/post');
|
|
116
|
+
}
|
|
117
|
+
async createConnection(_connectionArgs) {
|
|
118
|
+
throw new Error('This method has been deprecated, please use the REST API to create a connection. See https://docs.nango.dev/api-reference/connection/post');
|
|
119
|
+
}
|
|
47
120
|
/**
|
|
48
121
|
* For OAuth 2: returns the access token directly as a string.
|
|
49
122
|
* For OAuth 2: If you want to obtain a new refresh token from the provider before the current token has expired,
|
|
@@ -78,106 +151,56 @@ export class Nango {
|
|
|
78
151
|
const credentials = response.data.credentials;
|
|
79
152
|
return credentials.raw;
|
|
80
153
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* @param providerConfigKey - This is the unique Config Key for the integration
|
|
85
|
-
* @param connectionId - This is the unique connection identifier used to identify this connection
|
|
86
|
-
* @param [forceRefresh] - When set, this is used to obtain a new refresh token from the provider before the current token has expired,
|
|
87
|
-
* you can set the forceRefresh argument to true.
|
|
88
|
-
* @param [refreshToken] - When set this returns the refresh token as part of the response
|
|
89
|
-
*/
|
|
90
|
-
async getConnection(providerConfigKey, connectionId, forceRefresh, refreshToken) {
|
|
91
|
-
const response = await this.getConnectionDetails(providerConfigKey, connectionId, forceRefresh, refreshToken);
|
|
92
|
-
return response.data;
|
|
93
|
-
}
|
|
94
|
-
async proxy(config) {
|
|
95
|
-
if (!config.connectionId && this.connectionId) {
|
|
96
|
-
config.connectionId = this.connectionId;
|
|
97
|
-
}
|
|
98
|
-
if (!config.providerConfigKey && this.providerConfigKey) {
|
|
99
|
-
config.providerConfigKey = this.providerConfigKey;
|
|
100
|
-
}
|
|
101
|
-
validateProxyConfiguration(config);
|
|
102
|
-
const { providerConfigKey, connectionId, method, retries, headers: customHeaders, baseUrlOverride } = config;
|
|
103
|
-
const url = `${this.serverUrl}/proxy${config.endpoint[0] === '/' ? '' : '/'}${config.endpoint}`;
|
|
104
|
-
const customPrefixedHeaders = customHeaders && Object.keys(customHeaders).length > 0
|
|
105
|
-
? Object.keys(customHeaders).reduce((acc, key) => {
|
|
106
|
-
acc[`Nango-Proxy-${key}`] = customHeaders[key];
|
|
107
|
-
return acc;
|
|
108
|
-
}, {})
|
|
109
|
-
: {};
|
|
110
|
-
const headers = {
|
|
111
|
-
'Connection-Id': connectionId,
|
|
112
|
-
'Provider-Config-Key': providerConfigKey,
|
|
113
|
-
'Base-Url-Override': baseUrlOverride || '',
|
|
114
|
-
'Nango-Is-Sync': this.isSync,
|
|
115
|
-
'Nango-Is-Dry-Run': this.dryRun,
|
|
116
|
-
'Nango-Activity-Log-Id': this.activityLogId || '',
|
|
117
|
-
...customPrefixedHeaders
|
|
118
|
-
};
|
|
119
|
-
if (retries) {
|
|
120
|
-
headers['Retries'] = retries;
|
|
121
|
-
}
|
|
122
|
-
const options = {
|
|
123
|
-
headers: this.enrichHeaders(headers)
|
|
124
|
-
};
|
|
125
|
-
if (config.params) {
|
|
126
|
-
options.params = config.params;
|
|
127
|
-
}
|
|
128
|
-
if (config.paramsSerializer) {
|
|
129
|
-
options.paramsSerializer = config.paramsSerializer;
|
|
130
|
-
}
|
|
131
|
-
if (this.dryRun) {
|
|
132
|
-
const stringifyParams = (params) => {
|
|
133
|
-
return Object.keys(params)
|
|
134
|
-
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
|
|
135
|
-
.join('&');
|
|
136
|
-
};
|
|
137
|
-
console.log(`Nango Proxy Request: ${method?.toUpperCase()} ${url}${config.params ? `?${stringifyParams(config.params)}` : ''}`);
|
|
138
|
-
}
|
|
139
|
-
if (method?.toUpperCase() === 'POST') {
|
|
140
|
-
return axios.post(url, config.data, options);
|
|
154
|
+
async getMetadata(providerConfigKey, connectionId) {
|
|
155
|
+
if (!providerConfigKey) {
|
|
156
|
+
throw new Error('Provider Config Key is required');
|
|
141
157
|
}
|
|
142
|
-
|
|
143
|
-
|
|
158
|
+
if (!connectionId) {
|
|
159
|
+
throw new Error('Connection Id is required');
|
|
144
160
|
}
|
|
145
|
-
|
|
146
|
-
|
|
161
|
+
const response = await this.getConnectionDetails(providerConfigKey, connectionId, false, false, {
|
|
162
|
+
'Nango-Is-Sync': true,
|
|
163
|
+
'Nango-Is-Dry-Run': this.dryRun
|
|
164
|
+
});
|
|
165
|
+
return response.data.metadata;
|
|
166
|
+
}
|
|
167
|
+
async setMetadata(providerConfigKey, connectionId, metadata) {
|
|
168
|
+
if (!providerConfigKey) {
|
|
169
|
+
throw new Error('Provider Config Key is required');
|
|
147
170
|
}
|
|
148
|
-
|
|
149
|
-
|
|
171
|
+
if (!connectionId) {
|
|
172
|
+
throw new Error('Connection Id is required');
|
|
150
173
|
}
|
|
151
|
-
|
|
152
|
-
|
|
174
|
+
if (!metadata) {
|
|
175
|
+
throw new Error('Metadata is required');
|
|
153
176
|
}
|
|
177
|
+
const url = `${this.serverUrl}/connection/${connectionId}/metadata?provider_config_key=${providerConfigKey}`;
|
|
178
|
+
const headers = {
|
|
179
|
+
'Provider-Config-Key': providerConfigKey
|
|
180
|
+
};
|
|
181
|
+
return axios.post(url, metadata, { headers: this.enrichHeaders(headers) });
|
|
154
182
|
}
|
|
155
|
-
async
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return this.proxy({
|
|
163
|
-
...config,
|
|
164
|
-
method: 'POST'
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
async patch(config) {
|
|
168
|
-
return this.proxy({
|
|
169
|
-
...config,
|
|
170
|
-
method: 'PATCH'
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
async delete(config) {
|
|
174
|
-
return this.proxy({
|
|
175
|
-
...config,
|
|
176
|
-
method: 'DELETE'
|
|
177
|
-
});
|
|
183
|
+
async deleteConnection(providerConfigKey, connectionId) {
|
|
184
|
+
const url = `${this.serverUrl}/connection/${connectionId}?provider_config_key=${providerConfigKey}`;
|
|
185
|
+
const headers = {
|
|
186
|
+
'Content-Type': 'application/json',
|
|
187
|
+
'Accept-Encoding': 'application/json'
|
|
188
|
+
};
|
|
189
|
+
return axios.delete(url, { headers: this.enrichHeaders(headers) });
|
|
178
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* =======
|
|
193
|
+
* SYNCS
|
|
194
|
+
* GET RECORDS
|
|
195
|
+
* TRIGGER
|
|
196
|
+
* START
|
|
197
|
+
* PAUSE
|
|
198
|
+
* STATUS
|
|
199
|
+
* GET ENVIRONMENT VARIABLES
|
|
200
|
+
* =======
|
|
201
|
+
*/
|
|
179
202
|
async getRecords(config) {
|
|
180
|
-
const { connectionId, providerConfigKey, model, delta, offset, limit, includeNangoMetadata } = config;
|
|
203
|
+
const { connectionId, providerConfigKey, model, delta, offset, limit, includeNangoMetadata, filter } = config;
|
|
181
204
|
validateSyncRecordConfiguration(config);
|
|
182
205
|
const order = config?.order === 'asc' ? 'asc' : 'desc';
|
|
183
206
|
let sortBy = 'id';
|
|
@@ -189,23 +212,11 @@ export class Nango {
|
|
|
189
212
|
sortBy = 'updated_at';
|
|
190
213
|
break;
|
|
191
214
|
}
|
|
192
|
-
let filter = '';
|
|
193
|
-
switch (config.filter) {
|
|
194
|
-
case 'deleted':
|
|
195
|
-
filter = 'deleted';
|
|
196
|
-
break;
|
|
197
|
-
case 'updated':
|
|
198
|
-
filter = 'updated';
|
|
199
|
-
break;
|
|
200
|
-
case 'added':
|
|
201
|
-
filter = 'added';
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
215
|
if (includeNangoMetadata) {
|
|
205
216
|
console.warn(`The includeNangoMetadata option will be deprecated soon and will be removed in a future release. Each record now has a _nango_metadata property which includes the same properties.`);
|
|
206
217
|
}
|
|
207
218
|
const includeMetadata = includeNangoMetadata || false;
|
|
208
|
-
const url = `${this.serverUrl}/sync/records/?model=${model}&order=${order}&delta=${delta || ''}&offset=${offset || ''}&limit=${limit || ''}&sort_by=${sortBy || ''}&include_nango_metadata=${includeMetadata}
|
|
219
|
+
const url = `${this.serverUrl}/sync/records/?model=${model}&order=${order}&delta=${delta || ''}&offset=${offset || ''}&limit=${limit || ''}&sort_by=${sortBy || ''}&include_nango_metadata=${includeMetadata}${filter ? `&filter=${filter}` : ''}`;
|
|
209
220
|
const headers = {
|
|
210
221
|
'Connection-Id': connectionId,
|
|
211
222
|
'Provider-Config-Key': providerConfigKey
|
|
@@ -216,69 +227,6 @@ export class Nango {
|
|
|
216
227
|
const response = await axios.get(url, options);
|
|
217
228
|
return response.data;
|
|
218
229
|
}
|
|
219
|
-
async getConnectionDetails(providerConfigKey, connectionId, forceRefresh = false, refreshToken = false, additionalHeader = {}) {
|
|
220
|
-
const url = `${this.serverUrl}/connection/${connectionId}`;
|
|
221
|
-
const headers = {
|
|
222
|
-
'Content-Type': 'application/json',
|
|
223
|
-
'Accept-Encoding': 'application/json'
|
|
224
|
-
};
|
|
225
|
-
if (additionalHeader) {
|
|
226
|
-
Object.assign(headers, additionalHeader);
|
|
227
|
-
}
|
|
228
|
-
const params = {
|
|
229
|
-
provider_config_key: providerConfigKey,
|
|
230
|
-
force_refresh: forceRefresh,
|
|
231
|
-
refresh_token: refreshToken
|
|
232
|
-
};
|
|
233
|
-
return axios.get(url, { params: params, headers: this.enrichHeaders(headers) });
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Get the list of Connections, which does not contain access credentials.
|
|
237
|
-
*/
|
|
238
|
-
async listConnections(connectionId) {
|
|
239
|
-
const response = await this.listConnectionDetails(connectionId);
|
|
240
|
-
return response.data;
|
|
241
|
-
}
|
|
242
|
-
async getIntegration(providerConfigKey, includeIntegrationCredetials = false) {
|
|
243
|
-
const url = `${this.serverUrl}/config/${providerConfigKey}`;
|
|
244
|
-
const response = await axios.get(url, { headers: this.enrichHeaders({}), params: { include_creds: includeIntegrationCredetials } });
|
|
245
|
-
return response.data;
|
|
246
|
-
}
|
|
247
|
-
async setMetadata(providerConfigKey, connectionId, metadata) {
|
|
248
|
-
if (!providerConfigKey) {
|
|
249
|
-
throw new Error('Provider Config Key is required');
|
|
250
|
-
}
|
|
251
|
-
if (!connectionId) {
|
|
252
|
-
throw new Error('Connection Id is required');
|
|
253
|
-
}
|
|
254
|
-
if (!metadata) {
|
|
255
|
-
throw new Error('Metadata is required');
|
|
256
|
-
}
|
|
257
|
-
const url = `${this.serverUrl}/connection/${connectionId}/metadata?provider_config_key=${providerConfigKey}`;
|
|
258
|
-
const headers = {
|
|
259
|
-
'Provider-Config-Key': providerConfigKey
|
|
260
|
-
};
|
|
261
|
-
return axios.post(url, metadata, { headers: this.enrichHeaders(headers) });
|
|
262
|
-
}
|
|
263
|
-
async setFieldMapping(_fieldMapping, _optionalProviderConfigKey, _optionalConnectionId) {
|
|
264
|
-
throw new Error('setFieldMapping is deprecated. Please use setMetadata instead.');
|
|
265
|
-
}
|
|
266
|
-
async getMetadata(providerConfigKey, connectionId) {
|
|
267
|
-
if (!providerConfigKey) {
|
|
268
|
-
throw new Error('Provider Config Key is required');
|
|
269
|
-
}
|
|
270
|
-
if (!connectionId) {
|
|
271
|
-
throw new Error('Connection Id is required');
|
|
272
|
-
}
|
|
273
|
-
const response = await this.getConnectionDetails(providerConfigKey, connectionId, false, false, {
|
|
274
|
-
'Nango-Is-Sync': true,
|
|
275
|
-
'Nango-Is-Dry-Run': this.dryRun
|
|
276
|
-
});
|
|
277
|
-
return response.data.metadata;
|
|
278
|
-
}
|
|
279
|
-
async getFieldMapping(_optionalProviderConfigKey, _optionalConnectionId) {
|
|
280
|
-
throw new Error('getFieldMapping is deprecated. Please use getMetadata instead.');
|
|
281
|
-
}
|
|
282
230
|
async triggerSync(providerConfigKey, syncs, connectionId) {
|
|
283
231
|
const url = `${this.serverUrl}/sync/trigger`;
|
|
284
232
|
if (typeof syncs === 'string') {
|
|
@@ -291,7 +239,7 @@ export class Nango {
|
|
|
291
239
|
};
|
|
292
240
|
return axios.post(url, body, { headers: this.enrichHeaders() });
|
|
293
241
|
}
|
|
294
|
-
async
|
|
242
|
+
async startSync(providerConfigKey, syncs, connectionId) {
|
|
295
243
|
if (!providerConfigKey) {
|
|
296
244
|
throw new Error('Provider Config Key is required');
|
|
297
245
|
}
|
|
@@ -301,15 +249,15 @@ export class Nango {
|
|
|
301
249
|
if (typeof syncs === 'string') {
|
|
302
250
|
throw new Error('Syncs must be an array of strings. If it is a single sync, please wrap it in an array.');
|
|
303
251
|
}
|
|
304
|
-
const url = `${this.serverUrl}/sync/pause`;
|
|
305
252
|
const body = {
|
|
306
253
|
syncs: syncs || [],
|
|
307
254
|
provider_config_key: providerConfigKey,
|
|
308
255
|
connection_id: connectionId
|
|
309
256
|
};
|
|
257
|
+
const url = `${this.serverUrl}/sync/start`;
|
|
310
258
|
return axios.post(url, body, { headers: this.enrichHeaders() });
|
|
311
259
|
}
|
|
312
|
-
async
|
|
260
|
+
async pauseSync(providerConfigKey, syncs, connectionId) {
|
|
313
261
|
if (!providerConfigKey) {
|
|
314
262
|
throw new Error('Provider Config Key is required');
|
|
315
263
|
}
|
|
@@ -319,12 +267,12 @@ export class Nango {
|
|
|
319
267
|
if (typeof syncs === 'string') {
|
|
320
268
|
throw new Error('Syncs must be an array of strings. If it is a single sync, please wrap it in an array.');
|
|
321
269
|
}
|
|
270
|
+
const url = `${this.serverUrl}/sync/pause`;
|
|
322
271
|
const body = {
|
|
323
272
|
syncs: syncs || [],
|
|
324
273
|
provider_config_key: providerConfigKey,
|
|
325
274
|
connection_id: connectionId
|
|
326
275
|
};
|
|
327
|
-
const url = `${this.serverUrl}/sync/start`;
|
|
328
276
|
return axios.post(url, body, { headers: this.enrichHeaders() });
|
|
329
277
|
}
|
|
330
278
|
async syncStatus(providerConfigKey, syncs, connectionId) {
|
|
@@ -346,6 +294,24 @@ export class Nango {
|
|
|
346
294
|
const response = await axios.get(url, { headers: this.enrichHeaders(), params });
|
|
347
295
|
return response.data;
|
|
348
296
|
}
|
|
297
|
+
async getEnvironmentVariables() {
|
|
298
|
+
const url = `${this.serverUrl}/environment-variables`;
|
|
299
|
+
const headers = {
|
|
300
|
+
'Content-Type': 'application/json',
|
|
301
|
+
'Accept-Encoding': 'application/json'
|
|
302
|
+
};
|
|
303
|
+
const response = await axios.get(url, { headers: this.enrichHeaders(headers) });
|
|
304
|
+
if (!response.data) {
|
|
305
|
+
return [];
|
|
306
|
+
}
|
|
307
|
+
return response.data;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* =======
|
|
311
|
+
* ACTIONS
|
|
312
|
+
* TRIGGER
|
|
313
|
+
* =======
|
|
314
|
+
*/
|
|
349
315
|
async triggerAction(providerConfigKey, connectionId, actionName, input) {
|
|
350
316
|
const url = `${this.serverUrl}/action/trigger`;
|
|
351
317
|
const headers = {
|
|
@@ -359,33 +325,116 @@ export class Nango {
|
|
|
359
325
|
const response = await axios.post(url, body, { headers: this.enrichHeaders(headers) });
|
|
360
326
|
return response.data;
|
|
361
327
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
328
|
+
/**
|
|
329
|
+
* =======
|
|
330
|
+
* PROXY
|
|
331
|
+
* GET
|
|
332
|
+
* POST
|
|
333
|
+
* PUT
|
|
334
|
+
* PATCH
|
|
335
|
+
* DELETE
|
|
336
|
+
* =======
|
|
337
|
+
*/
|
|
338
|
+
async proxy(config) {
|
|
339
|
+
if (!config.connectionId && this.connectionId) {
|
|
340
|
+
config.connectionId = this.connectionId;
|
|
341
|
+
}
|
|
342
|
+
if (!config.providerConfigKey && this.providerConfigKey) {
|
|
343
|
+
config.providerConfigKey = this.providerConfigKey;
|
|
344
|
+
}
|
|
345
|
+
validateProxyConfiguration(config);
|
|
346
|
+
const { providerConfigKey, connectionId, method, retries, headers: customHeaders, baseUrlOverride } = config;
|
|
347
|
+
const url = `${this.serverUrl}/proxy${config.endpoint[0] === '/' ? '' : '/'}${config.endpoint}`;
|
|
348
|
+
const customPrefixedHeaders = customHeaders && Object.keys(customHeaders).length > 0
|
|
349
|
+
? Object.keys(customHeaders).reduce((acc, key) => {
|
|
350
|
+
acc[`Nango-Proxy-${key}`] = customHeaders[key];
|
|
351
|
+
return acc;
|
|
352
|
+
}, {})
|
|
353
|
+
: {};
|
|
367
354
|
const headers = {
|
|
368
|
-
'
|
|
369
|
-
'
|
|
355
|
+
'Connection-Id': connectionId,
|
|
356
|
+
'Provider-Config-Key': providerConfigKey,
|
|
357
|
+
'Base-Url-Override': baseUrlOverride || '',
|
|
358
|
+
'Nango-Is-Sync': this.isSync,
|
|
359
|
+
'Nango-Is-Dry-Run': this.dryRun,
|
|
360
|
+
'Nango-Activity-Log-Id': this.activityLogId || '',
|
|
361
|
+
...customPrefixedHeaders
|
|
370
362
|
};
|
|
371
|
-
|
|
363
|
+
if (retries) {
|
|
364
|
+
headers['Retries'] = retries;
|
|
365
|
+
}
|
|
366
|
+
const options = {
|
|
367
|
+
headers: this.enrichHeaders(headers)
|
|
368
|
+
};
|
|
369
|
+
if (config.params) {
|
|
370
|
+
options.params = config.params;
|
|
371
|
+
}
|
|
372
|
+
if (config.paramsSerializer) {
|
|
373
|
+
options.paramsSerializer = config.paramsSerializer;
|
|
374
|
+
}
|
|
375
|
+
if (this.dryRun) {
|
|
376
|
+
const stringifyParams = (params) => {
|
|
377
|
+
return Object.keys(params)
|
|
378
|
+
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
|
|
379
|
+
.join('&');
|
|
380
|
+
};
|
|
381
|
+
console.log(`Nango Proxy Request: ${method?.toUpperCase()} ${url}${config.params ? `?${stringifyParams(config.params)}` : ''}`);
|
|
382
|
+
}
|
|
383
|
+
if (method?.toUpperCase() === 'POST') {
|
|
384
|
+
return axios.post(url, config.data, options);
|
|
385
|
+
}
|
|
386
|
+
else if (method?.toUpperCase() === 'PATCH') {
|
|
387
|
+
return axios.patch(url, config.data, options);
|
|
388
|
+
}
|
|
389
|
+
else if (method?.toUpperCase() === 'PUT') {
|
|
390
|
+
return axios.put(url, config.data, options);
|
|
391
|
+
}
|
|
392
|
+
else if (method?.toUpperCase() === 'DELETE') {
|
|
393
|
+
return axios.delete(url, options);
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
return axios.get(url, options);
|
|
397
|
+
}
|
|
372
398
|
}
|
|
373
|
-
async
|
|
374
|
-
|
|
399
|
+
async get(config) {
|
|
400
|
+
return this.proxy({
|
|
401
|
+
...config,
|
|
402
|
+
method: 'GET'
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
async post(config) {
|
|
406
|
+
return this.proxy({
|
|
407
|
+
...config,
|
|
408
|
+
method: 'POST'
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
async patch(config) {
|
|
412
|
+
return this.proxy({
|
|
413
|
+
...config,
|
|
414
|
+
method: 'PATCH'
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
async delete(config) {
|
|
418
|
+
return this.proxy({
|
|
419
|
+
...config,
|
|
420
|
+
method: 'DELETE'
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
async getConnectionDetails(providerConfigKey, connectionId, forceRefresh = false, refreshToken = false, additionalHeader = {}) {
|
|
424
|
+
const url = `${this.serverUrl}/connection/${connectionId}`;
|
|
375
425
|
const headers = {
|
|
376
426
|
'Content-Type': 'application/json',
|
|
377
427
|
'Accept-Encoding': 'application/json'
|
|
378
428
|
};
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return [];
|
|
429
|
+
if (additionalHeader) {
|
|
430
|
+
Object.assign(headers, additionalHeader);
|
|
382
431
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
});
|
|
432
|
+
const params = {
|
|
433
|
+
provider_config_key: providerConfigKey,
|
|
434
|
+
force_refresh: forceRefresh,
|
|
435
|
+
refresh_token: refreshToken
|
|
436
|
+
};
|
|
437
|
+
return axios.get(url, { params: params, headers: this.enrichHeaders(headers) });
|
|
389
438
|
}
|
|
390
439
|
async listConnectionDetails(connectionId) {
|
|
391
440
|
let url = `${this.serverUrl}/connection?`;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EACH,SAAS,EAcZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAEzF,MAAM,CAAC,MAAM,WAAW,GAAG,+BAA+B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,uBAAuB,CAAC;AAiChD,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAChB,+BAAmB,CAAA;IACnB,uCAA2B,CAAA;AAC/B,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AA2BD,MAAM,OAAO,KAAK;IACd,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,YAAY,CAAU;IACtB,iBAAiB,CAAU;IAC3B,MAAM,GAAG,KAAK,CAAC;IACf,MAAM,GAAG,KAAK,CAAC;IACf,a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
|
|
8
9
|
export interface CredentialsCommon<T = Record<string, any>> {
|
|
9
10
|
type: AuthModes;
|
|
@@ -20,6 +21,12 @@ export interface OAuth2Credentials extends CredentialsCommon {
|
|
|
20
21
|
refresh_token?: string;
|
|
21
22
|
expires_at?: Date | undefined;
|
|
22
23
|
}
|
|
24
|
+
export interface AppCredentials {
|
|
25
|
+
type?: AuthModes.App;
|
|
26
|
+
access_token: string;
|
|
27
|
+
expires_at?: Date | undefined;
|
|
28
|
+
raw: Record<string, any>;
|
|
29
|
+
}
|
|
23
30
|
export interface ProxyConfiguration {
|
|
24
31
|
endpoint: string;
|
|
25
32
|
providerConfigKey?: string;
|
|
@@ -33,6 +40,8 @@ export interface ProxyConfiguration {
|
|
|
33
40
|
baseUrlOverride?: string;
|
|
34
41
|
decompress?: boolean;
|
|
35
42
|
}
|
|
43
|
+
type FilterAction = 'added' | 'updated' | 'deleted';
|
|
44
|
+
type CombinedFilterAction = `${FilterAction},${FilterAction}`;
|
|
36
45
|
export interface GetRecordsRequestConfig {
|
|
37
46
|
providerConfigKey: string;
|
|
38
47
|
connectionId: string;
|
|
@@ -43,7 +52,7 @@ export interface GetRecordsRequestConfig {
|
|
|
43
52
|
sortBy?: 'updatedAt' | 'createdAt' | 'id';
|
|
44
53
|
order?: 'asc' | 'desc';
|
|
45
54
|
includeNangoMetadata?: boolean;
|
|
46
|
-
filter?:
|
|
55
|
+
filter?: FilterAction | CombinedFilterAction;
|
|
47
56
|
}
|
|
48
57
|
export interface BasicApiCredentials {
|
|
49
58
|
type?: AuthModes.Basic;
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACjB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;IACjB,4BAAe,CAAA;IACf,+BAAkB,CAAA;IAClB,wBAAW,CAAA;AACf,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB"}
|