@adastradev/serverless-discovery-sdk
Advanced tools
Comparing version 2.3.3-beta.1689261522904 to 2.3.3-beta.1689262131375
@@ -1,3 +0,3 @@ | ||
import { ServiceApiModel } from "./ServiceApiModel"; | ||
import { ApiCredentials } from "./ApiCredentials"; | ||
import { ServiceApiModel } from './ServiceApiModel'; | ||
import { ApiCredentials } from './ApiCredentials'; | ||
export declare class DiscoveryServiceApi { | ||
@@ -4,0 +4,0 @@ private apigClient; |
@@ -15,3 +15,3 @@ "use strict"; | ||
exports.DiscoveryServiceApi = void 0; | ||
var apigClientFactory = require("@adastradev/aws-api-gateway-client").default; // tslint:disable-line | ||
var apigClientFactory = require('@adastradev/aws-api-gateway-client').default; // tslint:disable-line | ||
var retryOptions = { | ||
@@ -27,24 +27,24 @@ retries: 3, | ||
error.response.status === 504); | ||
}, | ||
} | ||
}; | ||
var DiscoveryServiceApi = /** @class */ (function () { | ||
function DiscoveryServiceApi(serviceEndpointUri, region, credentials) { | ||
if (credentials.type === "None") { | ||
this.apigClient = apigClientFactory.newClient(__assign({ accessKey: "", invokeUrl: serviceEndpointUri, region: region, secretKey: "" }, retryOptions)); | ||
if (credentials.type === 'None') { | ||
this.apigClient = apigClientFactory.newClient(__assign({ accessKey: '', invokeUrl: serviceEndpointUri, region: region, secretKey: '' }, retryOptions)); | ||
} | ||
else if (credentials.type === "IAM") { | ||
else if (credentials.type === 'IAM') { | ||
var iamCreds = credentials; | ||
this.apigClient = apigClientFactory.newClient(__assign({ accessKey: iamCreds.accessKeyId, invokeUrl: serviceEndpointUri, region: region, secretKey: iamCreds.secretAccessKey }, retryOptions)); | ||
} | ||
else if (credentials.type === "BearerToken") { | ||
else if (credentials.type === 'BearerToken') { | ||
var tokenCreds = credentials; | ||
this.additionalParams = { | ||
headers: { | ||
Authorization: "Bearer " + tokenCreds.idToken, | ||
Authorization: 'Bearer ' + tokenCreds.idToken | ||
}, | ||
}; | ||
this.apigClient = apigClientFactory.newClient(__assign({ accessKey: "", invokeUrl: serviceEndpointUri, region: region, secretKey: "" }, retryOptions)); | ||
this.apigClient = apigClientFactory.newClient(__assign({ accessKey: '', invokeUrl: serviceEndpointUri, region: region, secretKey: '' }, retryOptions)); | ||
} | ||
else { | ||
throw Error("Unsupported credential type in DiscoveryServiceApi"); | ||
throw Error('Unsupported credential type in DiscoveryServiceApi'); | ||
} | ||
@@ -54,4 +54,4 @@ } | ||
var params = { id: id }; | ||
var pathTemplate = "/catalog/service/{id}"; | ||
var method = "GET"; | ||
var pathTemplate = '/catalog/service/{id}'; | ||
var method = 'GET'; | ||
var additionalParams = {}; | ||
@@ -62,9 +62,9 @@ var body = {}; | ||
DiscoveryServiceApi.prototype.lookupService = function (serviceName, stageName, version, externalID, shouldInvalidateCache) { | ||
if (stageName === void 0) { stageName = ""; } | ||
if (version === void 0) { version = ""; } | ||
if (externalID === void 0) { externalID = ""; } | ||
if (stageName === void 0) { stageName = ''; } | ||
if (version === void 0) { version = ''; } | ||
if (externalID === void 0) { externalID = ''; } | ||
if (shouldInvalidateCache === void 0) { shouldInvalidateCache = false; } | ||
var params = {}; | ||
var pathTemplate = "/catalog/service"; | ||
var method = "GET"; | ||
var pathTemplate = '/catalog/service'; | ||
var method = 'GET'; | ||
var additionalParams = { | ||
@@ -75,3 +75,3 @@ queryParams: { | ||
Version: version, | ||
ExternalID: externalID, | ||
ExternalID: externalID | ||
}, | ||
@@ -81,3 +81,3 @@ }; | ||
additionalParams = __assign(__assign({}, additionalParams), { headers: { | ||
"Cache-Control": "max-age=0", | ||
'Cache-Control': 'max-age=0', | ||
} }); | ||
@@ -87,4 +87,4 @@ } | ||
// We need more than stageName only | ||
if (stageName === "" && version === "" && externalID === "") { | ||
throw new Error("Must provide more than service name only"); | ||
if (stageName === '' && version === '' && externalID === '') { | ||
throw new Error('Must provide more than service name only'); | ||
} | ||
@@ -95,4 +95,4 @@ return this.apigClient.invokeApi(params, pathTemplate, method, additionalParams, body); | ||
var params = {}; | ||
var pathTemplate = "/catalog/service"; | ||
var method = "POST"; | ||
var pathTemplate = '/catalog/service'; | ||
var method = 'POST'; | ||
var additionalParams = {}; | ||
@@ -104,4 +104,4 @@ var body = service; | ||
var params = { id: id }; | ||
var pathTemplate = "/catalog/service/{id}"; | ||
var method = "DELETE"; | ||
var pathTemplate = '/catalog/service/{id}'; | ||
var method = 'DELETE'; | ||
var additionalParams = {}; | ||
@@ -108,0 +108,0 @@ var body = {}; |
{ | ||
"name": "@adastradev/serverless-discovery-sdk", | ||
"version": "2.3.3-beta.1689261522904", | ||
"version": "2.3.3-beta.1689262131375", | ||
"description": "Serverless Service Discovery API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
23347