@adastradev/serverless-discovery-sdk
Advanced tools
Comparing version 1.1.2-beta.3 to 1.1.2
@@ -10,3 +10,3 @@ export interface ICloudDependency { | ||
private cloudDependencies; | ||
constructor(serviceEndpointUri: string, region?: string, defaultStageName?: string, lookupVersionPostfix?: string, configPath?: string); | ||
constructor(serviceEndpointUri: string, region?: string, defaultStageName?: string, lookupVersionPostfix?: string, configPath?: string, cloudDeps?: Map<string, string>); | ||
readonly cloudDependencyNames: string[]; | ||
@@ -13,0 +13,0 @@ getDependency(name: string): ICloudDependency | undefined; |
@@ -39,6 +39,7 @@ "use strict"; | ||
var DiscoveryServiceApi_1 = require("./DiscoveryServiceApi"); | ||
var finder = require("find-package-json"); | ||
var appRoot = require("app-root-path"); | ||
var fs = require("fs"); | ||
var Path = require("path"); | ||
var DiscoverySdk = /** @class */ (function () { | ||
function DiscoverySdk(serviceEndpointUri, region, defaultStageName, lookupVersionPostfix, configPath) { | ||
function DiscoverySdk(serviceEndpointUri, region, defaultStageName, lookupVersionPostfix, configPath, cloudDeps) { | ||
this.cloudDependencies = new Map(); | ||
@@ -54,5 +55,8 @@ this.api = new DiscoveryServiceApi_1.DiscoveryServiceApi(serviceEndpointUri, region || 'us-east-1', { type: 'None' }); | ||
} | ||
else { | ||
console.log('DEBUG: VERSION_POSTFIX not found'); | ||
} | ||
} | ||
this.lookupVersionPostfix = lookupVersionPostfix; | ||
this.populateDependencies(configPath); | ||
this.populateDependencies(configPath, cloudDeps); | ||
} | ||
@@ -88,4 +92,4 @@ Object.defineProperty(DiscoverySdk.prototype, "cloudDependencyNames", { | ||
if (version && this.lookupVersionPostfix) { | ||
version = version + this.lookupVersionPostfix; | ||
console.log("DEBUG: Version updated with prefix: " + version); | ||
version += this.lookupVersionPostfix; | ||
console.log("DEBUG: Version updated with postfix: " + version); | ||
} | ||
@@ -103,3 +107,12 @@ if (!externalID) { | ||
}; | ||
DiscoverySdk.prototype.populateDependencies = function (configPath) { | ||
DiscoverySdk.prototype.populateDependencies = function (configPath, cloudDeps) { | ||
// Can provide all of dependencies or be overridden by a config file. | ||
if (cloudDeps) { | ||
console.log("DEBUG: Passed cloudDeps"); | ||
console.log(cloudDeps); | ||
for (var _i = 0, _a = Array.from(cloudDeps.keys()); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
this.cloudDependencies.set(key, { name: key, version: cloudDeps.get(key) }); | ||
} | ||
} | ||
console.log("DEBUG: populateDependencies: (configPath: " + configPath + ")"); | ||
@@ -111,21 +124,4 @@ if (configPath !== undefined) { | ||
// Look for the package.json file in the root project folder | ||
// const basePackage = finder().next(); | ||
var basePackagePath = void 0; | ||
var it_1 = 0; | ||
basePackagePath = ''; | ||
while (true) { | ||
console.log(it_1++); | ||
if (finder().next().done || it_1 > 30) { | ||
break; | ||
} | ||
} | ||
// while (true) { | ||
// const bp = finder().next(); | ||
// console.log(`${it++} ${bp.filename}`); | ||
// if (it > 5 || bp.done) { | ||
// basePackagePath = bp.filename; | ||
// break; | ||
// } | ||
// } | ||
if (basePackagePath) { | ||
var basePackagePath = Path.join(appRoot.path, 'package.json'); | ||
if (fs.existsSync(basePackagePath)) { | ||
console.log("DEBUG: Searched for config. Found at: " + basePackagePath); | ||
@@ -135,3 +131,3 @@ this.readConfig(basePackagePath); | ||
else { | ||
console.log("DEBUG: Never found a config file"); | ||
console.log("DEBUG: Never found a config file at: " + basePackagePath); | ||
} | ||
@@ -154,3 +150,3 @@ } | ||
else { | ||
console.log("DEBUG: cloudDependencies not found"); | ||
console.log("DEBUG: cloudDependencies section not found in config file."); | ||
} | ||
@@ -157,0 +153,0 @@ }; |
{ | ||
"name": "@adastradev/serverless-discovery-sdk", | ||
"version": "1.1.2-beta.3", | ||
"version": "1.1.2", | ||
"description": "Serverless Service Discovery API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
19824
1
317