shopify-admin-api
Advanced tools
Comparing version
@@ -135,3 +135,3 @@ "use strict"; | ||
url.path('/admin'); | ||
const response = await node_fetch_1.default(url.toString(), { | ||
const response = await (0, node_fetch_1.default)(url.toString(), { | ||
method: 'HEAD', | ||
@@ -138,0 +138,0 @@ headers: base_service_1.default.buildDefaultHeaders(), |
@@ -55,3 +55,6 @@ "use strict"; | ||
this._callLimits.current = current; | ||
this._callLimits.retryAfter = retryAfter && parseFloat(retryAfter) || this._callLimits.retryAfter && Math.max(0, (this._callLimits.retryAfter - timestamp + oldTimestamp) / 1000); | ||
this._callLimits.retryAfter = | ||
(retryAfter && parseFloat(retryAfter)) || | ||
(this._callLimits.retryAfter && | ||
Math.max(0, (this._callLimits.retryAfter - timestamp + oldTimestamp) / 1000)); | ||
return this._callLimits; | ||
@@ -113,3 +116,3 @@ } | ||
joinUriPaths(...paths) { | ||
return url_join_1.default(...paths).replace(/\/\.json/gi, '.json'); | ||
return (0, url_join_1.default)(...paths).replace(/\/\.json/gi, '.json'); | ||
} | ||
@@ -152,11 +155,11 @@ async createRequest(method, path, rootElement, payload) { | ||
*/ | ||
let result = await BaseService._apiInfo[this.shopDomain].requestQueue.add(async () => { | ||
const result = await BaseService._apiInfo[this.shopDomain].requestQueue.add(async () => { | ||
do { | ||
// Check that we don't hit call limit | ||
let { remaining, retryAfter } = this.getCallLimits(); | ||
while (remaining < 5 || retryAfter && retryAfter > 0) { | ||
while (remaining < 5 || (retryAfter && retryAfter > 0)) { | ||
({ remaining, retryAfter } = this.getCallLimits()); | ||
await new Promise((res) => setTimeout(res, Math.max((5 - remaining) * 500), (retryAfter || 0) * 1000)); | ||
} | ||
let res = await node_fetch_1.default(url.toString(), options); | ||
const res = await (0, node_fetch_1.default)(url.toString(), options); | ||
const headerCallLimits = res.headers.get('x-shopify-shop-api-call-limit'); | ||
@@ -163,0 +166,0 @@ const headerRetryAfter = res.headers.get('retry-after'); |
@@ -58,3 +58,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this._callLimits.current = current; | ||
this._callLimits.retryAfter = retryAfter && parseFloat(retryAfter) || this._callLimits.retryAfter && Math.max(0, (this._callLimits.retryAfter - timestamp + oldTimestamp) / 1000); | ||
this._callLimits.retryAfter = | ||
(retryAfter && parseFloat(retryAfter)) || | ||
(this._callLimits.retryAfter && | ||
Math.max(0, (this._callLimits.retryAfter - timestamp + oldTimestamp) / 1000)); | ||
return this._callLimits; | ||
@@ -155,11 +158,11 @@ } | ||
*/ | ||
let result = yield BaseService._apiInfo[this.shopDomain].requestQueue.add(() => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield BaseService._apiInfo[this.shopDomain].requestQueue.add(() => __awaiter(this, void 0, void 0, function* () { | ||
do { | ||
// Check that we don't hit call limit | ||
let { remaining, retryAfter } = this.getCallLimits(); | ||
while (remaining < 5 || retryAfter && retryAfter > 0) { | ||
while (remaining < 5 || (retryAfter && retryAfter > 0)) { | ||
({ remaining, retryAfter } = this.getCallLimits()); | ||
yield new Promise((res) => setTimeout(res, Math.max((5 - remaining) * 500), (retryAfter || 0) * 1000)); | ||
} | ||
let res = yield fetch(url.toString(), options); | ||
const res = yield fetch(url.toString(), options); | ||
const headerCallLimits = res.headers.get('x-shopify-shop-api-call-limit'); | ||
@@ -166,0 +169,0 @@ const headerRetryAfter = res.headers.get('retry-after'); |
@@ -33,3 +33,3 @@ import { AuthGrant, AuthScope } from '../enums'; | ||
*/ | ||
export declare function isValidShopifyDomain(shopifyDomain: string): Promise<boolean>; | ||
export declare function isValidShopifyDomain(shopifyDomain: string): Promise<any>; | ||
/** | ||
@@ -36,0 +36,0 @@ * Builds an authorization URL for Shopify OAuth integration. Send your user to this URL where they'll be asked to accept installation of your Shopify app. |
{ | ||
"name": "shopify-admin-api", | ||
"version": "2.17.0", | ||
"version": "2.17.1", | ||
"description": "Shopify Admin API is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.", | ||
@@ -46,6 +46,6 @@ "main": "dist/cjs/index.js", | ||
"dependencies": { | ||
"@yarnpkg/pnpify": "^3.0.0-rc.6", | ||
"crypto-js": "^4.0.0", | ||
"@yarnpkg/pnpify": "^3.1.1-rc.5", | ||
"crypto-js": "^4.1.1", | ||
"jsuri": "^1.3.1", | ||
"node-fetch": "^2.6.1", | ||
"node-fetch": "^2.6.6", | ||
"p-queue": "^6.6.2", | ||
@@ -56,13 +56,13 @@ "tap-bail": "^1.0.0", | ||
"devDependencies": { | ||
"@tsconfig/node16": "^1.0.1", | ||
"@types/crypto-js": "^4.0.1", | ||
"@tsconfig/node16": "^1.0.2", | ||
"@types/crypto-js": "^4.0.2", | ||
"@types/jsuri": "^1.3.30", | ||
"@types/node": "^15.12.2", | ||
"@types/node-fetch": "^2.5.10", | ||
"@types/url-join": "^4.0.0", | ||
"@types/node": "^16.11.10", | ||
"@types/node-fetch": "^3.0.3", | ||
"@types/url-join": "^4.0.1", | ||
"alsatian": "^3.2.1", | ||
"barrelsby": "^2.2.0", | ||
"concurrently": "^6.2.0", | ||
"barrelsby": "^2.3.0", | ||
"concurrently": "^6.4.0", | ||
"dotenv": "^10.0.0", | ||
"glob": "^7.1.7", | ||
"glob": "^7.2.0", | ||
"logspect": "^1.3.1", | ||
@@ -72,5 +72,5 @@ "mkdirp": "^1.0.4", | ||
"tap-spec": "^5.0.0", | ||
"ts-node": "^10.0.0", | ||
"ts-node": "^10.4.0", | ||
"tslint": "^6.1.3", | ||
"typescript": "^4.3.4" | ||
"typescript": "4.4.4" | ||
}, | ||
@@ -77,0 +77,0 @@ "scripts": { |
{ | ||
"extends": "./tsconfig.cjs.json", | ||
"include": ["tests", "src"], | ||
"include": ["tests", "src"] | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12460
0.05%1
-50%481989
-0.01%488
-0.2%Updated
Updated
Updated