shopify-api-node
Advanced tools
Comparing version 3.7.3 to 3.8.0
29
index.js
@@ -62,3 +62,5 @@ 'use strict'; | ||
current: undefined, | ||
max: undefined | ||
max: undefined, | ||
actualQueryCost: undefined, | ||
requestedQueryCost: undefined | ||
}; | ||
@@ -196,15 +198,22 @@ | ||
* | ||
* @param {String} throttle The status returned in the GraphQL response | ||
* @param {Object} cost The `extensions.cost` object returned in the GraphQL | ||
* response | ||
* @private | ||
*/ | ||
Shopify.prototype.updateGraphqlLimits = function updateGraphqlLimits(throttle) { | ||
if (!throttle) return; | ||
Shopify.prototype.updateGraphqlLimits = function updateGraphqlLimits({ | ||
throttleStatus, | ||
actualQueryCost, | ||
requestedQueryCost | ||
}) { | ||
if (!throttleStatus) return; | ||
const limits = this.callGraphqlLimits; | ||
limits.current = | ||
throttleStatus.maximumAvailable - throttleStatus.currentlyAvailable; | ||
limits.remaining = throttleStatus.currentlyAvailable; | ||
limits.restoreRate = throttleStatus.restoreRate; | ||
limits.max = throttleStatus.maximumAvailable; | ||
limits.requestedQueryCost = requestedQueryCost; | ||
limits.actualQueryCost = actualQueryCost; | ||
limits.current = throttle.maximumAvailable - throttle.currentlyAvailable; | ||
limits.remaining = throttle.currentlyAvailable; | ||
limits.restoreRate = throttle.restoreRate; | ||
limits.max = throttle.maximumAvailable; | ||
this.emit('callGraphqlLimits', limits); | ||
@@ -246,3 +255,3 @@ }; | ||
if (res.body.extensions && res.body.extensions.cost) { | ||
this.updateGraphqlLimits(res.body.extensions.cost.throttleStatus); | ||
this.updateGraphqlLimits(res.body.extensions.cost); | ||
} | ||
@@ -249,0 +258,0 @@ |
{ | ||
"name": "shopify-api-node", | ||
"version": "3.7.3", | ||
"version": "3.8.0", | ||
"description": "Shopify API bindings for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
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
196791
6105