@envoy/envoy-integrations-sdk 2.0.1-beta.3 → 2.0.1-beta.5
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/lib/EnvoyAPI.js +11 -11
- package/package.json +1 -1
package/lib/EnvoyAPI.js
CHANGED
|
@@ -387,15 +387,16 @@ class EnvoyAPI {
|
|
|
387
387
|
* @returns {Promise<{}>}
|
|
388
388
|
*/
|
|
389
389
|
async getPluginInstallConfig(installId) {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
});
|
|
390
|
+
console.log(`pulling config for ${installId}`);
|
|
391
|
+
const body = await this.request({
|
|
392
|
+
method: 'GET',
|
|
393
|
+
url: `/api/v2/plugin-services/installs/${installId}/config`,
|
|
394
|
+
}).catch((error) => {
|
|
395
|
+
console.log(`encountered error for ${installId}`);
|
|
396
|
+
return EnvoyAPI.safeRequestsError(error);
|
|
398
397
|
});
|
|
398
|
+
|
|
399
|
+
return EnvoyAPI.getDataFromBody(body);
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
/**
|
|
@@ -406,13 +407,11 @@ class EnvoyAPI {
|
|
|
406
407
|
* @returns {Promise<{}>}
|
|
407
408
|
*/
|
|
408
409
|
async setPluginInstallConfig(installId, config = {}) {
|
|
409
|
-
console.log(`pulling config for ${installId}`);
|
|
410
410
|
const body = await this.request({
|
|
411
411
|
method: 'PUT',
|
|
412
412
|
url: `/api/v2/plugin-services/installs/${installId}/config`,
|
|
413
413
|
body: config,
|
|
414
414
|
}).catch((error) => {
|
|
415
|
-
console.log(`encountered error for ${installId}`);
|
|
416
415
|
return EnvoyAPI.safeRequestsError(error);
|
|
417
416
|
});
|
|
418
417
|
|
|
@@ -547,7 +546,7 @@ class EnvoyAPI {
|
|
|
547
546
|
}
|
|
548
547
|
|
|
549
548
|
static safeRequestsError(error) {
|
|
550
|
-
console.log(`constructing error`);
|
|
549
|
+
console.log(`constructing error from ${JSON.stringify(error)}`);
|
|
551
550
|
const safeError = {
|
|
552
551
|
code: error.code ?? error.statusCode,
|
|
553
552
|
message: error.message,
|
|
@@ -557,6 +556,7 @@ class EnvoyAPI {
|
|
|
557
556
|
method: error.request?.method ?? error.options?.method,
|
|
558
557
|
stack: error.stack,
|
|
559
558
|
}
|
|
559
|
+
console.log(`built error`);
|
|
560
560
|
throw safeError;
|
|
561
561
|
}
|
|
562
562
|
}
|