@commercelayer/cli-core
Advanced tools
Comparing version 3.8.3 to 3.8.4
@@ -20,4 +20,4 @@ import type { Method } from 'axios'; | ||
resourceType?: string; | ||
methodType?: Method; | ||
method?: Method; | ||
}; | ||
export declare const requestRateLimitDelay: (options?: DelayOptions) => 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,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,a)=>CACHEABLE_RESOURCES.includes(e||"")&&(a||"").toLowerCase()==="get";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; | ||
"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,a)=>CACHEABLE_RESOURCES.includes(e||"")&&(a||"get").toLowerCase()==="get";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,e?.method)&&(s=s*config_1.default.api.requests_max_num_cache_ratio,r=r*config_1.default.api.requests_max_num_cache_ratio);const c=config_1.default.api.requests_max_secs_burst/s,n=config_1.default.api.requests_max_secs_avg/r,l=i*c,o=i*n,u=e?.totalRequests;let t=0;return u?u>s&&(u>r?t=o:t=l):t=Math.max(l,o),t=t*1e3,e?.minimumDelay&&(t=Math.max(e.minimumDelay,t)),e?.securityDelay&&(t+=e.securityDelay),t=Math.ceil(t),t};exports.requestRateLimitDelay=requestRateLimitDelay; |
@@ -20,4 +20,4 @@ import type { Method } from 'axios'; | ||
resourceType?: string; | ||
methodType?: Method; | ||
method?: Method; | ||
}; | ||
export declare const requestRateLimitDelay: (options?: DelayOptions) => number; |
@@ -1,1 +0,1 @@ | ||
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",x=e=>e.replace(/_/g," ");export{c as baseURL,d as extractDomain,v as execMode,x 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,u)=>f.includes(e||"")&&(u||"").toLowerCase()==="get",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 o=s.api.requests_max_secs_burst/r,m=s.api.requests_max_secs_avg/a,_=n*o,l=n*m,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}; | ||
import r from"./config";const c=(e,u)=>`https://${e.toLowerCase()}.${u||r.api.default_domain}`,d=e=>{if(e)return e.substring(e.indexOf(".")+1)},v=e=>e===!0||e==="live"?"live":"test",x=e=>e.replace(/_/g," ");export{c as baseURL,d as extractDomain,v as execMode,x 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,u)=>f.includes(e||"")&&(u||"get").toLowerCase()==="get",requestRateLimitDelay=e=>{const u=e?.environment||"test",l=e?.parallelRequests||1;let s=r.api.requests_max_num_burst,a=r.api.requests_max_num_avg;u!=="live"&&(s=Math.floor(s/r.api.requests_max_num_env_ratio),a=Math.floor(a/r.api.requests_max_num_env_ratio)),isResourceCacheable(e?.resourceType,e?.method)&&(s=s*r.api.requests_max_num_cache_ratio,a=a*r.api.requests_max_num_cache_ratio);const m=r.api.requests_max_secs_burst/s,o=r.api.requests_max_secs_avg/a,n=l*m,_=l*o,i=e?.totalRequests;let t=0;return i?i>s&&(i>a?t=_:t=n):t=Math.max(n,_),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.8.3", | ||
"version": "3.8.4", | ||
"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
172364