@statoscope/stats-extension-package-info
Advanced tools
Comparing version 5.7.1 to 5.9.0
@@ -6,10 +6,10 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const entity_resolver_1 = __importDefault(require("@statoscope/helpers/dist/entity-resolver")); | ||
const indexer_1 = __importDefault(require("@statoscope/helpers/dist/indexer")); | ||
const makeAPI = (source) => { | ||
const packageResolvers = new Map(); | ||
const instanceResolvers = new Map(); | ||
const packageIndexes = new Map(); | ||
const instanceIndexes = new Map(); | ||
for (const compilation of source.payload.compilations) { | ||
packageResolvers.set(compilation.id, entity_resolver_1.default(compilation.packages, (r) => r.name)); | ||
packageIndexes.set(compilation.id, (0, indexer_1.default)((r) => r.name, compilation.packages)); | ||
for (const packageItem of compilation.packages) { | ||
instanceResolvers.set(packageItem, entity_resolver_1.default(packageItem.instances, (r) => r.path)); | ||
instanceIndexes.set(packageItem, (0, indexer_1.default)((r) => r.path, packageItem.instances)); | ||
} | ||
@@ -20,11 +20,11 @@ } | ||
var _a, _b; | ||
return (_b = (_a = packageResolvers.get(compilationId)) === null || _a === void 0 ? void 0 : _a(packageId)) !== null && _b !== void 0 ? _b : null; | ||
return (_b = (_a = packageIndexes.get(compilationId)) === null || _a === void 0 ? void 0 : _a.get(packageId)) !== null && _b !== void 0 ? _b : null; | ||
}, | ||
getInstance(compilationId, packageId, instancePath) { | ||
var _a, _b, _c, _d; | ||
const resolvedPackage = (_b = (_a = packageResolvers.get(compilationId)) === null || _a === void 0 ? void 0 : _a(packageId)) !== null && _b !== void 0 ? _b : null; | ||
const resolvedPackage = (_b = (_a = packageIndexes.get(compilationId)) === null || _a === void 0 ? void 0 : _a.get(packageId)) !== null && _b !== void 0 ? _b : null; | ||
if (!resolvedPackage) { | ||
return null; | ||
} | ||
return (_d = (_c = instanceResolvers.get(resolvedPackage)) === null || _c === void 0 ? void 0 : _c(instancePath)) !== null && _d !== void 0 ? _d : null; | ||
return (_d = (_c = instanceIndexes.get(resolvedPackage)) === null || _c === void 0 ? void 0 : _c.get(instancePath)) !== null && _d !== void 0 ? _d : null; | ||
}, | ||
@@ -31,0 +31,0 @@ }; |
@@ -7,3 +7,4 @@ "use strict"; | ||
const entity_resolver_1 = __importDefault(require("@statoscope/helpers/dist/entity-resolver")); | ||
const version_1 = require("./version"); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { name, version, author, homepage, description } = require('../package.json'); | ||
class Generator { | ||
@@ -15,11 +16,11 @@ constructor(adapter) { | ||
this.descriptor = { | ||
name: version_1.name, | ||
version: version_1.version, | ||
author: version_1.author, | ||
homepage: version_1.homepage, | ||
description: version_1.description, | ||
name, | ||
version, | ||
author, | ||
homepage, | ||
description, | ||
adapter: this.adapter, | ||
}; | ||
this.payload = { compilations: [] }; | ||
this.resolveCompilation = entity_resolver_1.default(this.payload.compilations, (item) => item.id); | ||
this.resolveCompilation = (0, entity_resolver_1.default)(this.payload.compilations, (item) => item.id, null, false); | ||
} | ||
@@ -37,3 +38,3 @@ handleInstance(compilationId, packageName, instance, info) { | ||
}; | ||
packageResolver = entity_resolver_1.default(compilation.packages, (item) => item.name); | ||
packageResolver = (0, entity_resolver_1.default)(compilation.packages, (item) => item.name, null, false); | ||
this.packageResolvers.set(compilation, packageResolver); | ||
@@ -47,3 +48,3 @@ this.payload.compilations.push(compilation); | ||
compilation.packages.push(resolvedPackage); | ||
this.instanceResolvers.set(resolvedPackage, entity_resolver_1.default(instances, (item) => item.path)); | ||
this.instanceResolvers.set(resolvedPackage, (0, entity_resolver_1.default)(instances, (item) => item.path, null, false)); | ||
} | ||
@@ -50,0 +51,0 @@ const instanceResolver = this.instanceResolvers.get(resolvedPackage); |
{ | ||
"name": "@statoscope/stats-extension-package-info", | ||
"version": "5.7.1", | ||
"version": "5.9.0", | ||
"description": "Statoscope extension for collecting package info (e.g. available versions)", | ||
@@ -8,3 +8,2 @@ "main": "./dist/index.js", | ||
"build": "../../node_modules/.bin/tsc", | ||
"buildVersionTS": "node ../../scripts/extract-version.js --field author --field homepage", | ||
"prepublishOnly": "npm run build" | ||
@@ -23,3 +22,3 @@ }, | ||
"dependencies": { | ||
"@statoscope/helpers": "5.7.1" | ||
"@statoscope/helpers": "5.9.0" | ||
}, | ||
@@ -30,3 +29,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "064a4cec944bc1438f48afbe8c127f22d82b4a60" | ||
"gitHead": "f8e8a9cd721828a4bc53a2f808441d81e5fdbf84" | ||
} |
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
8598
9
145
+ Added@statoscope/helpers@5.9.0(transitive)
- Removed@statoscope/helpers@5.7.1(transitive)
Updated@statoscope/helpers@5.9.0