@dt-esa/dynatrace-api-client
Advanced tools
Comparing version 2.3.1 to 2.3.3
@@ -210,3 +210,3 @@ "use strict"; | ||
const key = this.resolveEntries(path); | ||
const entries = key ? firstPage : firstPage[key]; | ||
const entries = key ? firstPage[key] : null; | ||
if (!key || !Array.isArray(entries)) { | ||
@@ -217,26 +217,10 @@ // console.warn("Cannot automatically page data"); | ||
let nextPageKey = firstPage['nextPageKey']; | ||
do { | ||
const result = await this.request({ | ||
path, | ||
method: "GET", | ||
format: "json", | ||
query: { nextPageKey }, | ||
paging: false, | ||
...reqParams | ||
}); | ||
nextPageKey = result['nextPageKey']; | ||
const newEntries = key ? result : result[key]; | ||
if (typeof reqParams.onPageReceived == "function") { | ||
reqParams.onPageReceived(result); | ||
} | ||
else { | ||
entries.push(...newEntries); | ||
} | ||
} while (nextPageKey); | ||
if (typeof reqParams.onPageReceived == "function") { | ||
return 1; | ||
} | ||
else { | ||
return firstPage; | ||
} | ||
return this.request({ | ||
fullPath: path, | ||
method: "GET", | ||
format: "json", | ||
query: { nextPageKey }, | ||
paging: false, | ||
...reqParams | ||
}); | ||
} | ||
@@ -243,0 +227,0 @@ resolveEntries(path) { |
{ | ||
"name": "@dt-esa/dynatrace-api-client", | ||
"version": "2.3.1", | ||
"version": "2.3.3", | ||
"description": "", | ||
@@ -34,3 +34,3 @@ "main": "./dist/index.js", | ||
"doc": "typedoc src/index.ts", | ||
"publish": "npm version patch --force; npm run build; npm publish" | ||
"pub": "npm version patch --force; npm run build; npm publish" | ||
}, | ||
@@ -37,0 +37,0 @@ "ava": { |
Sorry, the diff of this file is not supported yet
2241617
47988