@commercelayer/cli-core
Advanced tools
Comparing version 3.7.1 to 3.7.2
@@ -14,3 +14,3 @@ type ApiMode = 'test' | 'live'; | ||
environment?: ApiMode; | ||
parallelRequests: number; | ||
parallelRequests?: number; | ||
totalRequests?: number; | ||
@@ -17,0 +17,0 @@ minimumDelay?: number; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.requestRateLimitDelay=exports.isResourceCacheable=exports.humanizeResource=exports.execMode=exports.extractDomain=exports.baseURL=void 0;const config_1=__importDefault(require("./config")),baseURL=(e,s)=>`https://${e.toLowerCase()}.${s||config_1.default.api.default_domain}`;exports.baseURL=baseURL;const extractDomain=e=>{if(e)return e.substring(e.indexOf(".")+1)};exports.extractDomain=extractDomain;const execMode=e=>e===!0||e==="live"?"live":"test";exports.execMode=execMode;const humanizeResource=e=>e.replace(/_/g," ");exports.humanizeResource=humanizeResource;const CACHEABLE_RESOURCES=["bundles","imports","markets","prices","price_lists","promotions","external_promotions","fixed_amount_promotions","fixed_price_promotions","free_gift_promotions","free_shipping_promotions","percentage_discount_promotions","skus","sku_options","stock_items","stock_locations"],isResourceCacheable=e=>e!==void 0&&CACHEABLE_RESOURCES.includes(e);exports.isResourceCacheable=isResourceCacheable;const requestRateLimitDelay=(e={environment:"test",parallelRequests:1,minimumDelay:0,securityDelay:0})=>{let s=config_1.default.api.requests_max_num_burst,a=config_1.default.api.requests_max_num_avg;e.environment!=="live"&&(s=Math.floor(s/config_1.default.api.requests_max_num_env_ratio),a=Math.floor(a/config_1.default.api.requests_max_num_env_ratio)),(0,exports.isResourceCacheable)(e.resourceType)&&(s=s*config_1.default.api.requests_max_num_cache_ratio,a=a*config_1.default.api.requests_max_num_cache_ratio);const o=config_1.default.api.requests_max_secs_burst/s,n=config_1.default.api.requests_max_secs_avg/a,u=e.parallelRequests*o,i=e.parallelRequests*n,r=e.totalRequests;let t=0;return r?r>s&&(r>a?t=i:t=u):t=Math.max(u,i),t=t*1e3,e.minimumDelay&&(t=Math.max(e.minimumDelay,t)),e.securityDelay&&(t+=e.securityDelay),t=Math.ceil(t),t};exports.requestRateLimitDelay=requestRateLimitDelay; | ||
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.requestRateLimitDelay=exports.isResourceCacheable=exports.humanizeResource=exports.execMode=exports.extractDomain=exports.baseURL=void 0;const config_1=__importDefault(require("./config")),baseURL=(e,a)=>`https://${e.toLowerCase()}.${a||config_1.default.api.default_domain}`;exports.baseURL=baseURL;const extractDomain=e=>{if(e)return e.substring(e.indexOf(".")+1)};exports.extractDomain=extractDomain;const execMode=e=>e===!0||e==="live"?"live":"test";exports.execMode=execMode;const humanizeResource=e=>e.replace(/_/g," ");exports.humanizeResource=humanizeResource;const CACHEABLE_RESOURCES=["bundles","imports","markets","prices","price_lists","promotions","external_promotions","fixed_amount_promotions","fixed_price_promotions","free_gift_promotions","free_shipping_promotions","percentage_discount_promotions","skus","sku_options","stock_items","stock_locations"],isResourceCacheable=e=>e!==void 0&&CACHEABLE_RESOURCES.includes(e);exports.isResourceCacheable=isResourceCacheable;const requestRateLimitDelay=e=>{const a=e?.environment||"test",i=e?.parallelRequests||1;let s=config_1.default.api.requests_max_num_burst,r=config_1.default.api.requests_max_num_avg;a!=="live"&&(s=Math.floor(s/config_1.default.api.requests_max_num_env_ratio),r=Math.floor(r/config_1.default.api.requests_max_num_env_ratio)),(0,exports.isResourceCacheable)(e?.resourceType)&&(s=s*config_1.default.api.requests_max_num_cache_ratio,r=r*config_1.default.api.requests_max_num_cache_ratio);const n=config_1.default.api.requests_max_secs_burst/s,c=config_1.default.api.requests_max_secs_avg/r,o=i*n,l=i*c,u=e?.totalRequests;let t=0;return u?u>s&&(u>r?t=l:t=o):t=Math.max(o,l),t=t*1e3,e?.minimumDelay&&(t=Math.max(e.minimumDelay,t)),e?.securityDelay&&(t+=e.securityDelay),t=Math.ceil(t),t};exports.requestRateLimitDelay=requestRateLimitDelay; |
@@ -14,3 +14,3 @@ type ApiMode = 'test' | 'live'; | ||
environment?: ApiMode; | ||
parallelRequests: number; | ||
parallelRequests?: number; | ||
totalRequests?: number; | ||
@@ -17,0 +17,0 @@ minimumDelay?: number; |
@@ -1,1 +0,1 @@ | ||
import s from"./config";const _=(e,r)=>`https://${e.toLowerCase()}.${r||s.api.default_domain}`,c=e=>{if(e)return e.substring(e.indexOf(".")+1)},l=e=>e===!0||e==="live"?"live":"test",p=e=>e.replace(/_/g," ");export{_ as baseURL,c as extractDomain,l as execMode,p as humanizeResource};const f=["bundles","imports","markets","prices","price_lists","promotions","external_promotions","fixed_amount_promotions","fixed_price_promotions","free_gift_promotions","free_shipping_promotions","percentage_discount_promotions","skus","sku_options","stock_items","stock_locations"];export const isResourceCacheable=e=>e!==void 0&&f.includes(e),requestRateLimitDelay=(e={environment:"test",parallelRequests:1,minimumDelay:0,securityDelay:0})=>{let r=s.api.requests_max_num_burst,a=s.api.requests_max_num_avg;e.environment!=="live"&&(r=Math.floor(r/s.api.requests_max_num_env_ratio),a=Math.floor(a/s.api.requests_max_num_env_ratio)),isResourceCacheable(e.resourceType)&&(r=r*s.api.requests_max_num_cache_ratio,a=a*s.api.requests_max_num_cache_ratio);const o=s.api.requests_max_secs_burst/r,m=s.api.requests_max_secs_avg/a,u=e.parallelRequests*o,n=e.parallelRequests*m,i=e.totalRequests;let t=0;return i?i>r&&(i>a?t=n:t=u):t=Math.max(u,n),t=t*1e3,e.minimumDelay&&(t=Math.max(e.minimumDelay,t)),e.securityDelay&&(t+=e.securityDelay),t=Math.ceil(t),t}; | ||
import s from"./config";const c=(e,u)=>`https://${e.toLowerCase()}.${u||s.api.default_domain}`,d=e=>{if(e)return e.substring(e.indexOf(".")+1)},v=e=>e===!0||e==="live"?"live":"test",f=e=>e.replace(/_/g," ");export{c as baseURL,d as extractDomain,v as execMode,f as humanizeResource};const x=["bundles","imports","markets","prices","price_lists","promotions","external_promotions","fixed_amount_promotions","fixed_price_promotions","free_gift_promotions","free_shipping_promotions","percentage_discount_promotions","skus","sku_options","stock_items","stock_locations"];export const isResourceCacheable=e=>e!==void 0&&x.includes(e),requestRateLimitDelay=e=>{const u=e?.environment||"test",n=e?.parallelRequests||1;let r=s.api.requests_max_num_burst,a=s.api.requests_max_num_avg;u!=="live"&&(r=Math.floor(r/s.api.requests_max_num_env_ratio),a=Math.floor(a/s.api.requests_max_num_env_ratio)),isResourceCacheable(e?.resourceType)&&(r=r*s.api.requests_max_num_cache_ratio,a=a*s.api.requests_max_num_cache_ratio);const m=s.api.requests_max_secs_burst/r,o=s.api.requests_max_secs_avg/a,_=n*m,l=n*o,i=e?.totalRequests;let t=0;return i?i>r&&(i>a?t=l:t=_):t=Math.max(_,l),t=t*1e3,e?.minimumDelay&&(t=Math.max(e.minimumDelay,t)),e?.securityDelay&&(t+=e.securityDelay),t=Math.ceil(t),t}; |
{ | ||
"name": "@commercelayer/cli-core", | ||
"version": "3.7.1", | ||
"version": "3.7.2", | ||
"main": "lib/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "types": "lib/cjs/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
170044