@stordata/vsphere-soapify 1.0.20250324212333 → 1.0.20250418083505
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/gl-sbom-npm-npm.cdx.json +3 -3
- package/lib/client.js +31 -10
- package/lib/client.spec.js +1 -0
- package/package.json +1 -1
package/gl-sbom-npm-npm.cdx.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bomFormat": "CycloneDX",
|
|
3
3
|
"specVersion": "1.4",
|
|
4
|
-
"serialNumber": "urn:uuid:
|
|
4
|
+
"serialNumber": "urn:uuid:fbf8a787-8339-49a0-a585-fd5787e98e4e",
|
|
5
5
|
"version": 1,
|
|
6
6
|
"metadata": {
|
|
7
|
-
"timestamp": "2025-
|
|
7
|
+
"timestamp": "2025-04-18T08:34:56Z",
|
|
8
8
|
"tools": [
|
|
9
9
|
{
|
|
10
10
|
"vendor": "GitLab",
|
|
11
11
|
"name": "Gemnasium",
|
|
12
|
-
"version": "5.
|
|
12
|
+
"version": "5.9.2"
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"authors": [
|
package/lib/client.js
CHANGED
|
@@ -168,7 +168,7 @@ module.exports = class Client {
|
|
|
168
168
|
* Instance type can be an asterisk (*) to specify all instances or empty string ("") to specify aggregated statistics
|
|
169
169
|
* @param {Array<String>} [properties=[]] The optional list of entity properties
|
|
170
170
|
*
|
|
171
|
-
* @returns {Promise<
|
|
171
|
+
* @returns {Promise<object[]>} A Promise resolving to an array of Objects { metric string and key to call }
|
|
172
172
|
*/
|
|
173
173
|
async getPerfCounters(type, counters, properties = []) {
|
|
174
174
|
const perfMng = await this.getPerformanceManager(), /* eslint-disable one-var */
|
|
@@ -196,21 +196,42 @@ module.exports = class Client {
|
|
|
196
196
|
}),
|
|
197
197
|
chunks = _.chunk(specs, this.features.maxQuerySpecSize / _.size(counterToId));
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
.
|
|
201
|
-
|
|
202
|
-
.then(result => result.map(perf => ({
|
|
203
|
-
entity: _.find(entities, { ref: perf.entity.ref }),
|
|
204
|
-
sampleInfo: perf.sampleInfo,
|
|
205
|
-
value: perf.value.filter(metric => Array.isArray(metric.value)).map(metric => ({
|
|
199
|
+
function toValidMetric(acc, metric) {
|
|
200
|
+
if (Array.isArray(metric.value)) {
|
|
201
|
+
acc.push({
|
|
206
202
|
value: metric.value,
|
|
207
203
|
id: {
|
|
208
204
|
counterId: metric.id.counterId,
|
|
209
205
|
counterName: idToCounter[metric.id.counterId],
|
|
210
206
|
instance: metric.id.instance
|
|
211
207
|
}
|
|
212
|
-
})
|
|
213
|
-
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return acc;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function toValidPerfSample(acc, perf) {
|
|
215
|
+
if (perf.value) {
|
|
216
|
+
acc.push({
|
|
217
|
+
entity: entities.find(entity => entity.ref === perf.entity.ref),
|
|
218
|
+
sampleInfo: perf.sampleInfo,
|
|
219
|
+
value: perf.value.reduce(toValidMetric, [])
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return acc;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function concatValidPerfResults(acc, result) {
|
|
227
|
+
if (result) {
|
|
228
|
+
return acc.concat(result.reduce(toValidPerfSample, []));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return acc;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return Promise.all(chunks.map(chunk => perfMng.queryPerf(chunk))).then(results => results.reduce(concatValidPerfResults, []));
|
|
214
235
|
}
|
|
215
236
|
|
|
216
237
|
login(username, password) {
|
package/lib/client.spec.js
CHANGED
|
@@ -17439,6 +17439,7 @@ describe('The Client class', function() {
|
|
|
17439
17439
|
this.mockSoapOperation('5.5', 'getPerfCountersForVms/full/RetrievePropertiesEx');
|
|
17440
17440
|
this.mockSoapOperation('5.5', 'getPerfCountersForVms/full_max10/QueryPerf_chunk1');
|
|
17441
17441
|
this.mockSoapOperation('5.5', 'getPerfCountersForVms/full_max10/QueryPerf_chunk2');
|
|
17442
|
+
this.mockSoapOperation('5.5', 'getPerfCountersForVms/full_max10/QueryPerf_chunk3');
|
|
17442
17443
|
|
|
17443
17444
|
return client.getPerfCounters(VirtualMachine, {
|
|
17444
17445
|
'cpu.usage.none.percent': '',
|