@commercelayer/cli-core
Advanced tools
Comparing version 3.8.2 to 3.8.3
@@ -0,1 +1,2 @@ | ||
import type { Method } from 'axios'; | ||
type ApiMode = 'test' | 'live'; | ||
@@ -11,3 +12,3 @@ export type { ApiMode }; | ||
export { baseURL, extractDomain, execMode, humanizeResource }; | ||
export declare const isResourceCacheable: (resource?: string) => boolean; | ||
export declare const isResourceCacheable: (resource?: string, method?: Method) => boolean; | ||
export type DelayOptions = { | ||
@@ -20,3 +21,4 @@ environment?: ApiMode; | ||
resourceType?: string; | ||
methodType?: 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=>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; | ||
"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; |
import chalk from 'chalk'; | ||
import type { ApiMode } from './api'; | ||
export declare const reset: chalk.Chalk; | ||
@@ -57,2 +58,3 @@ export declare const visible: chalk.Chalk; | ||
test: chalk.Chalk; | ||
execMode: (mode: ApiMode) => chalk.Chalk; | ||
success: chalk.Chalk; | ||
@@ -59,0 +61,0 @@ warning: chalk.Chalk; |
@@ -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.table=exports.cli=exports.msg=exports.api=exports.type=exports.style=exports.bg=exports.italic=exports.underline=exports.dim=exports.bold=exports.magentaBright=exports.magenta=exports.cyanBright=exports.cyan=exports.grey=exports.blackBright=exports.black=exports.whiteBright=exports.white=exports.blueBright=exports.blue=exports.yellowBright=exports.yellow=exports.greenBright=exports.green=exports.redBright=exports.red=exports.hidden=exports.visible=exports.reset=void 0;const chalk_1=__importDefault(require("chalk"));exports.reset=chalk_1.default.reset,exports.visible=chalk_1.default.visible,exports.hidden=chalk_1.default.hidden,exports.red=chalk_1.default.red,exports.redBright=chalk_1.default.redBright,exports.green=chalk_1.default.green,exports.greenBright=chalk_1.default.greenBright,exports.yellow=chalk_1.default.yellow,exports.yellowBright=chalk_1.default.yellowBright,exports.blue=chalk_1.default.blue,exports.blueBright=chalk_1.default.blueBright,exports.white=chalk_1.default.white,exports.whiteBright=chalk_1.default.whiteBright,exports.black=chalk_1.default.black,exports.blackBright=chalk_1.default.blackBright,exports.grey=chalk_1.default.grey,exports.cyan=chalk_1.default.cyan,exports.cyanBright=chalk_1.default.cyanBright,exports.magenta=chalk_1.default.magenta,exports.magentaBright=chalk_1.default.magentaBright,exports.bold=chalk_1.default.bold,exports.dim=chalk_1.default.dim,exports.underline=chalk_1.default.underline,exports.italic=chalk_1.default.italic,exports.bg={white:chalk_1.default.bgWhite,whiteBright:chalk_1.default.bgWhiteBright,black:chalk_1.default.bgBlack,blackBright:chalk_1.default.bgBlackBright,grey:chalk_1.default.bgGrey,red:chalk_1.default.bgRed,redBright:chalk_1.default.bgRedBright,green:chalk_1.default.bgGreen,greenBright:chalk_1.default.bgGreenBright,yellow:chalk_1.default.bgYellow,yellowBright:chalk_1.default.bgYellowBright,blue:chalk_1.default.bgBlue,blueBright:chalk_1.default.bgBlueBright,magenta:chalk_1.default.bgMagenta,magentaBright:chalk_1.default.bgMagentaBright,cyan:chalk_1.default.bgCyan,cyanBright:chalk_1.default.bgCyanBright},exports.style={organization:exports.yellowBright.bold,application:exports.yellowBright.bold,slug:exports.yellowBright,id:exports.bold,token:exports.blueBright,resource:exports.bold,attribute:exports.italic,trigger:exports.cyanBright,kind:exports.cyanBright,live:exports.greenBright,test:exports.yellowBright,success:exports.greenBright,warning:exports.yellowBright,error:exports.redBright,arg:exports.italic,flag:exports.italic,command:exports.italic,value:exports.italic,alias:exports.cyanBright,plugin:exports.blueBright,title:exports.blueBright,path:exports.italic,datetime:exports.cyanBright,number:exports.yellowBright},exports.type={datetime:exports.style.datetime,number:exports.style.number,path:exports.style.path},exports.api={organization:exports.style.organization,application:exports.style.application,slug:exports.style.slug,id:exports.style.id,token:exports.style.token,resource:exports.style.resource,attribute:exports.style.attribute,trigger:exports.style.trigger,kind:exports.style.kind,live:exports.style.live,test:exports.style.test},exports.msg={success:exports.style.success,warning:exports.style.warning,error:exports.style.error},exports.cli={arg:exports.style.arg,flag:exports.style.flag,command:exports.style.command,value:exports.style.value,alias:exports.style.alias,plugin:exports.style.plugin},exports.table={header:exports.yellowBright.bold,key:exports.blueBright}; | ||
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.table=exports.cli=exports.msg=exports.api=exports.type=exports.style=exports.bg=exports.italic=exports.underline=exports.dim=exports.bold=exports.magentaBright=exports.magenta=exports.cyanBright=exports.cyan=exports.grey=exports.blackBright=exports.black=exports.whiteBright=exports.white=exports.blueBright=exports.blue=exports.yellowBright=exports.yellow=exports.greenBright=exports.green=exports.redBright=exports.red=exports.hidden=exports.visible=exports.reset=void 0;const chalk_1=__importDefault(require("chalk"));exports.reset=chalk_1.default.reset,exports.visible=chalk_1.default.visible,exports.hidden=chalk_1.default.hidden,exports.red=chalk_1.default.red,exports.redBright=chalk_1.default.redBright,exports.green=chalk_1.default.green,exports.greenBright=chalk_1.default.greenBright,exports.yellow=chalk_1.default.yellow,exports.yellowBright=chalk_1.default.yellowBright,exports.blue=chalk_1.default.blue,exports.blueBright=chalk_1.default.blueBright,exports.white=chalk_1.default.white,exports.whiteBright=chalk_1.default.whiteBright,exports.black=chalk_1.default.black,exports.blackBright=chalk_1.default.blackBright,exports.grey=chalk_1.default.grey,exports.cyan=chalk_1.default.cyan,exports.cyanBright=chalk_1.default.cyanBright,exports.magenta=chalk_1.default.magenta,exports.magentaBright=chalk_1.default.magentaBright,exports.bold=chalk_1.default.bold,exports.dim=chalk_1.default.dim,exports.underline=chalk_1.default.underline,exports.italic=chalk_1.default.italic,exports.bg={white:chalk_1.default.bgWhite,whiteBright:chalk_1.default.bgWhiteBright,black:chalk_1.default.bgBlack,blackBright:chalk_1.default.bgBlackBright,grey:chalk_1.default.bgGrey,red:chalk_1.default.bgRed,redBright:chalk_1.default.bgRedBright,green:chalk_1.default.bgGreen,greenBright:chalk_1.default.bgGreenBright,yellow:chalk_1.default.bgYellow,yellowBright:chalk_1.default.bgYellowBright,blue:chalk_1.default.bgBlue,blueBright:chalk_1.default.bgBlueBright,magenta:chalk_1.default.bgMagenta,magentaBright:chalk_1.default.bgMagentaBright,cyan:chalk_1.default.bgCyan,cyanBright:chalk_1.default.bgCyanBright},exports.style={organization:exports.yellowBright.bold,application:exports.yellowBright.bold,slug:exports.yellowBright,id:exports.bold,token:exports.blueBright,resource:exports.bold,attribute:exports.italic,trigger:exports.cyanBright,kind:exports.cyanBright,live:exports.greenBright,test:exports.yellowBright,execMode:e=>e==="live"?exports.style.live:exports.style.test,success:exports.greenBright,warning:exports.yellowBright,error:exports.redBright,arg:exports.italic,flag:exports.italic,command:exports.italic,value:exports.italic,alias:exports.cyanBright,plugin:exports.blueBright,title:exports.blueBright,path:exports.italic,datetime:exports.cyanBright,number:exports.yellowBright},exports.type={datetime:exports.style.datetime,number:exports.style.number,path:exports.style.path},exports.api={organization:exports.style.organization,application:exports.style.application,slug:exports.style.slug,id:exports.style.id,token:exports.style.token,resource:exports.style.resource,attribute:exports.style.attribute,trigger:exports.style.trigger,kind:exports.style.kind,live:exports.style.live,test:exports.style.test},exports.msg={success:exports.style.success,warning:exports.style.warning,error:exports.style.error},exports.cli={arg:exports.style.arg,flag:exports.style.flag,command:exports.style.command,value:exports.style.value,alias:exports.style.alias,plugin:exports.style.plugin},exports.table={header:exports.yellowBright.bold,key:exports.blueBright}; |
@@ -0,1 +1,2 @@ | ||
import type { Method } from 'axios'; | ||
type ApiMode = 'test' | 'live'; | ||
@@ -11,3 +12,3 @@ export type { ApiMode }; | ||
export { baseURL, extractDomain, execMode, humanizeResource }; | ||
export declare const isResourceCacheable: (resource?: string) => boolean; | ||
export declare const isResourceCacheable: (resource?: string, method?: Method) => boolean; | ||
export type DelayOptions = { | ||
@@ -20,3 +21,4 @@ environment?: ApiMode; | ||
resourceType?: string; | ||
methodType?: 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",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}; | ||
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 chalk from 'chalk'; | ||
import type { ApiMode } from './api'; | ||
export declare const reset: chalk.Chalk; | ||
@@ -57,2 +58,3 @@ export declare const visible: chalk.Chalk; | ||
test: chalk.Chalk; | ||
execMode: (mode: ApiMode) => chalk.Chalk; | ||
success: chalk.Chalk; | ||
@@ -59,0 +61,0 @@ warning: chalk.Chalk; |
@@ -1,1 +0,1 @@ | ||
import t from"chalk";export const reset=t.reset,visible=t.visible,hidden=t.hidden,red=t.red,redBright=t.redBright,green=t.green,greenBright=t.greenBright,yellow=t.yellow,yellowBright=t.yellowBright,blue=t.blue,blueBright=t.blueBright,white=t.white,whiteBright=t.whiteBright,black=t.black,blackBright=t.blackBright,grey=t.grey,cyan=t.cyan,cyanBright=t.cyanBright,magenta=t.magenta,magentaBright=t.magentaBright,bold=t.bold,dim=t.dim,underline=t.underline,italic=t.italic,bg={white:t.bgWhite,whiteBright:t.bgWhiteBright,black:t.bgBlack,blackBright:t.bgBlackBright,grey:t.bgGrey,red:t.bgRed,redBright:t.bgRedBright,green:t.bgGreen,greenBright:t.bgGreenBright,yellow:t.bgYellow,yellowBright:t.bgYellowBright,blue:t.bgBlue,blueBright:t.bgBlueBright,magenta:t.bgMagenta,magentaBright:t.bgMagentaBright,cyan:t.bgCyan,cyanBright:t.bgCyanBright},style={organization:yellowBright.bold,application:yellowBright.bold,slug:yellowBright,id:bold,token:blueBright,resource:bold,attribute:italic,trigger:cyanBright,kind:cyanBright,live:greenBright,test:yellowBright,success:greenBright,warning:yellowBright,error:redBright,arg:italic,flag:italic,command:italic,value:italic,alias:cyanBright,plugin:blueBright,title:blueBright,path:italic,datetime:cyanBright,number:yellowBright},type={datetime:style.datetime,number:style.number,path:style.path},api={organization:style.organization,application:style.application,slug:style.slug,id:style.id,token:style.token,resource:style.resource,attribute:style.attribute,trigger:style.trigger,kind:style.kind,live:style.live,test:style.test},msg={success:style.success,warning:style.warning,error:style.error},cli={arg:style.arg,flag:style.flag,command:style.command,value:style.value,alias:style.alias,plugin:style.plugin},table={header:yellowBright.bold,key:blueBright}; | ||
import t from"chalk";export const reset=t.reset,visible=t.visible,hidden=t.hidden,red=t.red,redBright=t.redBright,green=t.green,greenBright=t.greenBright,yellow=t.yellow,yellowBright=t.yellowBright,blue=t.blue,blueBright=t.blueBright,white=t.white,whiteBright=t.whiteBright,black=t.black,blackBright=t.blackBright,grey=t.grey,cyan=t.cyan,cyanBright=t.cyanBright,magenta=t.magenta,magentaBright=t.magentaBright,bold=t.bold,dim=t.dim,underline=t.underline,italic=t.italic,bg={white:t.bgWhite,whiteBright:t.bgWhiteBright,black:t.bgBlack,blackBright:t.bgBlackBright,grey:t.bgGrey,red:t.bgRed,redBright:t.bgRedBright,green:t.bgGreen,greenBright:t.bgGreenBright,yellow:t.bgYellow,yellowBright:t.bgYellowBright,blue:t.bgBlue,blueBright:t.bgBlueBright,magenta:t.bgMagenta,magentaBright:t.bgMagentaBright,cyan:t.bgCyan,cyanBright:t.bgCyanBright},style={organization:yellowBright.bold,application:yellowBright.bold,slug:yellowBright,id:bold,token:blueBright,resource:bold,attribute:italic,trigger:cyanBright,kind:cyanBright,live:greenBright,test:yellowBright,execMode:e=>e==="live"?style.live:style.test,success:greenBright,warning:yellowBright,error:redBright,arg:italic,flag:italic,command:italic,value:italic,alias:cyanBright,plugin:blueBright,title:blueBright,path:italic,datetime:cyanBright,number:yellowBright},type={datetime:style.datetime,number:style.number,path:style.path},api={organization:style.organization,application:style.application,slug:style.slug,id:style.id,token:style.token,resource:style.resource,attribute:style.attribute,trigger:style.trigger,kind:style.kind,live:style.live,test:style.test},msg={success:style.success,warning:style.warning,error:style.error},cli={arg:style.arg,flag:style.flag,command:style.command,value:style.value,alias:style.alias,plugin:style.plugin},table={header:yellowBright.bold,key:blueBright}; |
{ | ||
"name": "@commercelayer/cli-core", | ||
"version": "3.8.2", | ||
"version": "3.8.3", | ||
"main": "lib/cjs/index.js", | ||
@@ -22,10 +22,10 @@ "types": "lib/cjs/index.d.ts", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.22.4", | ||
"@babel/preset-typescript": "^7.21.5", | ||
"@commercelayer/eslint-config-ts": "^1.0.0", | ||
"@babel/preset-env": "^7.22.5", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@commercelayer/eslint-config-ts": "^1.0.1", | ||
"@size-limit/preset-small-lib": "^6.0.4", | ||
"@types/jest": "^29.5.2", | ||
"@types/jsonwebtoken": "^8.5.9", | ||
"@types/node": "^20.2.5", | ||
"@typescript-eslint/eslint-plugin": "^5.59.9", | ||
"@types/node": "^20.3.1", | ||
"@typescript-eslint/eslint-plugin": "^5.59.11", | ||
"eslint": "^8.42.0", | ||
@@ -39,3 +39,3 @@ "jest": "^29.5.0", | ||
"@commercelayer/js-auth": "^2.3.0", | ||
"@oclif/core": "^2.8.5", | ||
"@oclif/core": "^2.8.6", | ||
"axios": "1.4.0", | ||
@@ -42,0 +42,0 @@ "chalk": "^4.1.2", |
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
172346
949
Updated@oclif/core@^2.8.6