Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commercelayer/cli-core

Package Overview
Dependencies
Maintainers
5
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercelayer/cli-core - npm Package Compare versions

Comparing version 1.3.15 to 1.4.0

lib/cjs/help.d.ts

1

lib/cjs/index.d.ts

@@ -10,2 +10,3 @@ export * as clApi from './api';

export * as clUtil from './util';
export { default as cLHelp } from './help';
/** Types **/

@@ -12,0 +13,0 @@ export type { ApiMode } from './api';

2

lib/cjs/index.js

@@ -1,1 +0,1 @@

"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,u)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.clUtil=exports.clUpdate=exports.clToken=exports.clColor=exports.clOutput=exports.clCommand=exports.clConfig=exports.clApplication=exports.clApi=void 0,exports.clApi=__importStar(require("./api")),exports.clApplication=__importStar(require("./application"));var config_1=require("./config");Object.defineProperty(exports,"clConfig",{enumerable:!0,get:function(){return __importDefault(config_1).default}}),exports.clCommand=__importStar(require("./command")),exports.clOutput=__importStar(require("./output")),exports.clColor=__importStar(require("./color")),exports.clToken=__importStar(require("./token")),exports.clUpdate=__importStar(require("./update")),exports.clUtil=__importStar(require("./util"));
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,u)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.cLHelp=exports.clUtil=exports.clUpdate=exports.clToken=exports.clColor=exports.clOutput=exports.clCommand=exports.clConfig=exports.clApplication=exports.clApi=void 0,exports.clApi=__importStar(require("./api")),exports.clApplication=__importStar(require("./application"));var config_1=require("./config");Object.defineProperty(exports,"clConfig",{enumerable:!0,get:function(){return __importDefault(config_1).default}}),exports.clCommand=__importStar(require("./command")),exports.clOutput=__importStar(require("./output")),exports.clColor=__importStar(require("./color")),exports.clToken=__importStar(require("./token")),exports.clUpdate=__importStar(require("./update")),exports.clUtil=__importStar(require("./util"));var help_1=require("./help");Object.defineProperty(exports,"cLHelp",{enumerable:!0,get:function(){return __importDefault(help_1).default}});

@@ -1,3 +0,3 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatError=exports.formatOutput=exports.localeDate=exports.cleanDate=exports.maxLength=exports.center=exports.printCSV=exports.printJSON=exports.printObject=void 0;const util_1=require("util"),printObject=(r,e)=>(0,util_1.inspect)(r,{showHidden:!1,depth:null,colors:(e==null?void 0:e.color)===void 0?!0:e.color,sorted:(e==null?void 0:e.sort)===void 0?!1:e==null?void 0:e.sort,maxArrayLength:1/0,breakLength:(e==null?void 0:e.width)||120});exports.printObject=printObject;const printJSON=(r,e)=>JSON.stringify(r,null,(e==null?void 0:e.unformatted)?void 0:(e==null?void 0:e.tabSize)||4);exports.printJSON=printJSON;const printCSV=(r,e)=>{if(!r||r.length===0)return"";const n=Object.keys(r[0]).filter(t=>["id","type"].includes(t)?e&&e.fields.includes(t):!0);let a=n.map(t=>t.toUpperCase().replace(/_/g," ")).join(";")+`
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatError=exports.formatOutput=exports.localeDate=exports.cleanDate=exports.maxLength=exports.center=exports.printCSV=exports.printJSON=exports.printObject=void 0;const util_1=require("util"),printObject=(r,e)=>(0,util_1.inspect)(r,{showHidden:!1,depth:null,colors:e?.color===void 0?!0:e.color,sorted:e?.sort===void 0?!1:e?.sort,maxArrayLength:1/0,breakLength:e?.width||120});exports.printObject=printObject;const printJSON=(r,e)=>JSON.stringify(r,null,e?.unformatted?void 0:e?.tabSize||4);exports.printJSON=printJSON;const printCSV=(r,e)=>{if(!r||r.length===0)return"";const n=Object.keys(r[0]).filter(t=>["id","type"].includes(t)?e&&e.fields.includes(t):!0);let a=n.map(t=>t.toUpperCase().replace(/_/g," ")).join(";")+`
`;return r.forEach(t=>{a+=n.map(l=>t[l]).join(";")+`
`}),a};exports.printCSV=printCSV;const center=(r,e)=>r.padStart(r.length+Math.floor((e-r.length)/2)," ").padEnd(e," ");exports.center=center;const maxLength=(r,e)=>r.reduce((n,a)=>{const t=Array.isArray(a[e])?a[e].join():a[e];return Math.max(n,String(t).length)},0);exports.maxLength=maxLength;const cleanDate=r=>r.replace("T"," ").replace("Z","").substring(0,r.lastIndexOf("."));exports.cleanDate=cleanDate;const localeDate=r=>r?new Date(Date.parse(r)).toLocaleString():"";exports.localeDate=localeDate;const formatOutput=(r,e,{color:n=!0}={})=>{if(!r)return"";if(typeof r=="string")return r;if(e){if(e.csv)return printCSV(r,e);if(e.json)return printJSON(r,{unformatted:e.unformatted})}return printObject(r,{color:n})};exports.formatOutput=formatOutput;const formatError=(r,e)=>formatOutput(r.errors||r,e);exports.formatError=formatError;

@@ -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.isAccessTokenExpiring=exports.revokeAccessToken=exports.getAccessToken=exports.generateAccessToken=exports.decodeAccessToken=void 0;const jsonwebtoken_1=__importDefault(require("jsonwebtoken")),config_1=__importDefault(require("./config")),https_1=__importDefault(require("https")),util_1=require("./util"),api_1=require("./api"),js_auth_1=require("@commercelayer/js-auth"),decodeAccessToken=e=>{const t=jsonwebtoken_1.default.decode(e);if(t===null)throw new Error("Error decoding access token");return t};exports.decodeAccessToken=decodeAccessToken;const generateAccessToken=(e,t,o)=>{const n=Object.assign(Object.assign({},e),{exp:Math.floor(Date.now()/1e3)+o*60,rand:Math.random()}),r=config_1.default.api.token_encoding_algorithm,c=jsonwebtoken_1.default.sign(n,t,{algorithm:r,noTimestamp:!0}),i=jsonwebtoken_1.default.verify(c,t,{algorithms:[r]});return{accessToken:c,info:i,expMinutes:o}};exports.generateAccessToken=generateAccessToken;const getAccessToken=async e=>{const t={clientId:e.clientId,clientSecret:e.clientSecret,endpoint:(0,api_1.baseURL)(e.slug,e.domain),scope:e.scope||""};if(e.email&&e.password){const o={username:e.email,password:e.password};return(0,js_auth_1.getCustomerToken)(t,o)}return(0,js_auth_1.clientCredentials)(t)};exports.getAccessToken=getAccessToken;const revokeAccessToken=async(e,t)=>{const o=JSON.stringify({grant_type:"client_credentials",client_id:e.clientId,client_secret:e.clientSecret,token:t}),s={hostname:(0,api_1.baseURL)(e.slug,e.domain).replace("https://","").replace("http://",""),port:443,path:"/oauth/revoke",method:"POST",headers:{"Content-Type":"application/json","Content-Length":o.length}};try{const n=https_1.default.request(s);n.on("error",r=>{}),n.write(o),n.end()}catch{}await(0,util_1.sleep)(300)};exports.revokeAccessToken=revokeAccessToken;const isAccessTokenExpiring=(e,t)=>{const o=30,s=(t||config_1.default.api.token_expiration_mins)*60,n=Number(e.created_at);return Math.floor(Date.now()/1e3)-n>=s-o};exports.isAccessTokenExpiring=isAccessTokenExpiring;
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.isAccessTokenExpiring=exports.revokeAccessToken=exports.getAccessToken=exports.generateAccessToken=exports.decodeAccessToken=void 0;const jsonwebtoken_1=__importDefault(require("jsonwebtoken")),config_1=__importDefault(require("./config")),https_1=__importDefault(require("https")),util_1=require("./util"),api_1=require("./api"),js_auth_1=require("@commercelayer/js-auth"),decodeAccessToken=e=>{const t=jsonwebtoken_1.default.decode(e);if(t===null)throw new Error("Error decoding access token");return t};exports.decodeAccessToken=decodeAccessToken;const generateAccessToken=(e,t,n)=>{const o=Object.assign(Object.assign({},e),{exp:Math.floor(Date.now()/1e3)+n*60,rand:Math.random()}),r=config_1.default.api.token_encoding_algorithm,c=jsonwebtoken_1.default.sign(o,t,{algorithm:r,noTimestamp:!0}),i=jsonwebtoken_1.default.verify(c,t,{algorithms:[r]});return{accessToken:c,info:i,expMinutes:n}};exports.generateAccessToken=generateAccessToken;const getAccessToken=async e=>{const t={clientId:e.clientId,clientSecret:e.clientSecret,endpoint:(0,api_1.baseURL)(e.slug,e.domain),scope:e.scope||""};if(e.email&&e.password){const n={username:e.email,password:e.password};return(0,js_auth_1.getCustomerToken)(t,n)}return(0,js_auth_1.clientCredentials)(t)};exports.getAccessToken=getAccessToken;const revokeAccessToken=async(e,t)=>{const n=JSON.stringify({grant_type:"client_credentials",client_id:e.clientId,client_secret:e.clientSecret,token:t}),s={hostname:(0,api_1.baseURL)(e.slug,e.domain).replace("https://","").replace("http://",""),port:443,path:"/oauth/revoke",method:"POST",headers:{"Content-Type":"application/json","Content-Length":n.length}};try{const o=https_1.default.request(s);o.on("error",r=>{}),o.write(n),o.end()}catch{}await(0,util_1.sleep)(300)};exports.revokeAccessToken=revokeAccessToken;const isAccessTokenExpiring=(e,t)=>{const s=(t||config_1.default.api.token_expiration_mins)*60,o=Number(e.created_at);return Math.floor(Date.now()/1e3)-o>=s-30};exports.isAccessTokenExpiring=isAccessTokenExpiring;

@@ -1,4 +0,4 @@

"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkUpdate=void 0;const chalk_1=__importDefault(require("chalk")),update_notifier_1=__importDefault(require("update-notifier")),UPDATE_CHECK_INTERVAL_HOURS=1,checkUpdate=e=>{const t=(0,update_notifier_1.default)({pkg:e,updateCheckInterval:1e3*60*60*UPDATE_CHECK_INTERVAL_HOURS});if(t.update){const a=!0,n=a?"commercelayer plugins:update":"{updateCommand}";t.notify({isGlobal:!a,message:`-= ${chalk_1.default.bgWhite.black.bold(` ${e.description} `)} =-
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkUpdate=void 0;const chalk_1=__importDefault(require("chalk")),update_notifier_1=__importDefault(require("update-notifier")),UPDATE_CHECK_INTERVAL_HOURS=1,checkUpdate=e=>{const t=(0,update_notifier_1.default)({pkg:e,updateCheckInterval:36e5*UPDATE_CHECK_INTERVAL_HOURS});if(t.update){const a="commercelayer plugins:update";t.notify({isGlobal:!1,message:`-= ${chalk_1.default.bgWhite.black.bold(` ${e.description} `)} =-
New version available: ${chalk_1.default.dim("{currentVersion}")} -> ${chalk_1.default.green("{latestVersion}")}
Run ${chalk_1.default.cyanBright(n)} to update`})}};exports.checkUpdate=checkUpdate;
Run ${chalk_1.default.cyanBright(a)} to update`})}};exports.checkUpdate=checkUpdate;

@@ -5,2 +5,3 @@ /** Await ms milliseconds */

declare const log: (message?: string, ...args: unknown[]) => void;
export { sleep, resetConsole, log };
declare const capitalize: (str: string | undefined) => string | undefined;
export { sleep, resetConsole, log, capitalize };

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.log=exports.resetConsole=exports.sleep=void 0;const util_1=require("util"),sleep=async e=>new Promise(t=>setTimeout(t,e));exports.sleep=sleep;const resetConsole=()=>{const e="[?25h",t="[?7h";process.stdout.write(`${e}${t}`)};exports.resetConsole=resetConsole;const log=(e="",...t)=>{e=typeof e=="string"?e:(0,util_1.inspect)(e),process.stdout.write((0,util_1.format)(e,...t)+`
`)};exports.log=log;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.capitalize=exports.log=exports.resetConsole=exports.sleep=void 0;const util_1=require("util"),sleep=async e=>new Promise(t=>setTimeout(t,e));exports.sleep=sleep;const resetConsole=()=>{const e="\x1B[?25h",t="\x1B[?7h";process.stdout.write(`${e}${t}`)};exports.resetConsole=resetConsole;const log=(e="",...t)=>{e=typeof e=="string"?e:(0,util_1.inspect)(e),process.stdout.write((0,util_1.format)(e,...t)+`
`)};exports.log=log;const capitalize=e=>{if(!e)return e;let t=e.toLowerCase();return t=t.substring(0,1).toUpperCase()+t.substring(1),t};exports.capitalize=capitalize;

@@ -1,1 +0,1 @@

const s=["integration","sales_channel","webapp"],e=["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"],t=["in_progress","pending","completed","interrupted"],_={api:{default_domain:"commercelayer.io",token_expiration_mins:60*2,token_encoding_algorithm:"HS512",requests_max_num_burst:50,requests_max_secs_burst:10,requests_max_num_avg:600,requests_max_secs_avg:5*60,page_max_size:25,page_default_size:10},application:{kinds:s},imports:{max_size:2e3,statuses:t,types:e,max_queue_length:10},webhooks:{retry_number:5}};export default _;
const s=["integration","sales_channel","webapp"],e=["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"],t=["in_progress","pending","completed","interrupted"],_={api:{default_domain:"commercelayer.io",token_expiration_mins:120,token_encoding_algorithm:"HS512",requests_max_num_burst:50,requests_max_secs_burst:10,requests_max_num_avg:600,requests_max_secs_avg:300,page_max_size:25,page_default_size:10},application:{kinds:s},imports:{max_size:2e3,statuses:t,types:e,max_queue_length:10},webhooks:{retry_number:5}};export default _;

@@ -10,2 +10,3 @@ export * as clApi from './api';

export * as clUtil from './util';
export { default as cLHelp } from './help';
/** Types **/

@@ -12,0 +13,0 @@ export type { ApiMode } from './api';

@@ -1,1 +0,1 @@

import*as o from"./api";export{o as clApi};import*as t from"./application";export{t as clApplication};export{default as clConfig}from"./config";import*as p from"./command";export{p as clCommand};import*as a from"./output";export{a as clOutput};import*as r from"./color";export{r as clColor};import*as l from"./token";export{l as clToken};import*as c from"./update";export{c as clUpdate};import*as m from"./util";export{m as clUtil};
import*as o from"./api";export{o as clApi};import*as r from"./application";export{r as clApplication};export{default as clConfig}from"./config";import*as t from"./command";export{t as clCommand};import*as p from"./output";export{p as clOutput};import*as a from"./color";export{a as clColor};import*as l from"./token";export{l as clToken};import*as m from"./update";export{m as clUpdate};import*as c from"./util";export{c as clUtil};export{default as cLHelp}from"./help";

@@ -1,3 +0,3 @@

import{inspect as f}from"util";const u=(e,r)=>f(e,{showHidden:!1,depth:null,colors:(r==null?void 0:r.color)===void 0?!0:r.color,sorted:(r==null?void 0:r.sort)===void 0?!1:r==null?void 0:r.sort,maxArrayLength:1/0,breakLength:(r==null?void 0:r.width)||120}),d=(e,r)=>JSON.stringify(e,null,(r==null?void 0:r.unformatted)?void 0:(r==null?void 0:r.tabSize)||4),a=(e,r)=>{if(!e||e.length===0)return"";const t=Object.keys(e[0]).filter(n=>["id","type"].includes(n)?r&&r.fields.includes(n):!0);let l=t.map(n=>n.toUpperCase().replace(/_/g," ")).join(";")+`
import{inspect as f}from"util";const d=(e,r)=>f(e,{showHidden:!1,depth:null,colors:r?.color===void 0?!0:r.color,sorted:r?.sort===void 0?!1:r?.sort,maxArrayLength:1/0,breakLength:r?.width||120}),u=(e,r)=>JSON.stringify(e,null,r?.unformatted?void 0:r?.tabSize||4),a=(e,r)=>{if(!e||e.length===0)return"";const t=Object.keys(e[0]).filter(n=>["id","type"].includes(n)?r&&r.fields.includes(n):!0);let l=t.map(n=>n.toUpperCase().replace(/_/g," ")).join(";")+`
`;return e.forEach(n=>{l+=t.map(i=>n[i]).join(";")+`
`}),l},s=(e,r)=>e.padStart(e.length+Math.floor((r-e.length)/2)," ").padEnd(r," "),h=(e,r)=>e.reduce((t,l)=>{const n=Array.isArray(l[r])?l[r].join():l[r];return Math.max(t,String(n).length)},0),m=e=>e.replace("T"," ").replace("Z","").substring(0,e.lastIndexOf(".")),o=e=>e?new Date(Date.parse(e)).toLocaleString():"",c=(e,r,{color:t=!0}={})=>{if(!e)return"";if(typeof e=="string")return e;if(r){if(r.csv)return a(e,r);if(r.json)return d(e,{unformatted:r.unformatted})}return u(e,{color:t})},v=(e,r)=>c(e.errors||e,r);export{u as printObject,d as printJSON,a as printCSV,s as center,h as maxLength,m as cleanDate,o as localeDate,c as formatOutput,v as formatError};
`}),l},s=(e,r)=>e.padStart(e.length+Math.floor((r-e.length)/2)," ").padEnd(r," "),h=(e,r)=>e.reduce((t,l)=>{const n=Array.isArray(l[r])?l[r].join():l[r];return Math.max(t,String(n).length)},0),m=e=>e.replace("T"," ").replace("Z","").substring(0,e.lastIndexOf(".")),o=e=>e?new Date(Date.parse(e)).toLocaleString():"",c=(e,r,{color:t=!0}={})=>{if(!e)return"";if(typeof e=="string")return e;if(r){if(r.csv)return a(e,r);if(r.json)return u(e,{unformatted:r.unformatted})}return d(e,{color:t})},v=(e,r)=>c(e.errors||e,r);export{d as printObject,u as printJSON,a as printCSV,s as center,h as maxLength,m as cleanDate,o as localeDate,c as formatOutput,v as formatError};

@@ -1,1 +0,1 @@

import i from"jsonwebtoken";import a from"./config";import p from"https";import{sleep as d}from"./util";import{baseURL as l}from"./api";import{clientCredentials as g,getCustomerToken as f}from"@commercelayer/js-auth";const k=e=>{const t=i.decode(e);if(t===null)throw new Error("Error decoding access token");return t},w=(e,t,o)=>{const n=Object.assign(Object.assign({},e),{exp:Math.floor(Date.now()/1e3)+o*60,rand:Math.random()}),s=a.api.token_encoding_algorithm,c=i.sign(n,t,{algorithm:s,noTimestamp:!0}),m=i.verify(c,t,{algorithms:[s]});return{accessToken:c,info:m,expMinutes:o}},h=async e=>{const t={clientId:e.clientId,clientSecret:e.clientSecret,endpoint:l(e.slug,e.domain),scope:e.scope||""};if(e.email&&e.password){const o={username:e.email,password:e.password};return f(t,o)}return g(t)},y=async(e,t)=>{const o=JSON.stringify({grant_type:"client_credentials",client_id:e.clientId,client_secret:e.clientSecret,token:t}),r={hostname:l(e.slug,e.domain).replace("https://","").replace("http://",""),port:443,path:"/oauth/revoke",method:"POST",headers:{"Content-Type":"application/json","Content-Length":o.length}};try{const n=p.request(r);n.on("error",s=>{}),n.write(o),n.end()}catch{}await d(300)},T=(e,t)=>{const o=30,r=(t||a.api.token_expiration_mins)*60,n=Number(e.created_at);return Math.floor(Date.now()/1e3)-n>=r-o};export{k as decodeAccessToken,w as generateAccessToken,h as getAccessToken,y as revokeAccessToken,T as isAccessTokenExpiring};
import i from"jsonwebtoken";import a from"./config";import p from"https";import{sleep as d}from"./util";import{baseURL as l}from"./api";import{clientCredentials as g,getCustomerToken as f}from"@commercelayer/js-auth";const k=e=>{const t=i.decode(e);if(t===null)throw new Error("Error decoding access token");return t},w=(e,t,o)=>{const n=Object.assign(Object.assign({},e),{exp:Math.floor(Date.now()/1e3)+o*60,rand:Math.random()}),s=a.api.token_encoding_algorithm,c=i.sign(n,t,{algorithm:s,noTimestamp:!0}),m=i.verify(c,t,{algorithms:[s]});return{accessToken:c,info:m,expMinutes:o}},y=async e=>{const t={clientId:e.clientId,clientSecret:e.clientSecret,endpoint:l(e.slug,e.domain),scope:e.scope||""};if(e.email&&e.password){const o={username:e.email,password:e.password};return f(t,o)}return g(t)},T=async(e,t)=>{const o=JSON.stringify({grant_type:"client_credentials",client_id:e.clientId,client_secret:e.clientSecret,token:t}),r={hostname:l(e.slug,e.domain).replace("https://","").replace("http://",""),port:443,path:"/oauth/revoke",method:"POST",headers:{"Content-Type":"application/json","Content-Length":o.length}};try{const n=p.request(r);n.on("error",s=>{}),n.write(o),n.end()}catch{}await d(300)},h=(e,t)=>{const r=(t||a.api.token_expiration_mins)*60,n=Number(e.created_at);return Math.floor(Date.now()/1e3)-n>=r-30};export{k as decodeAccessToken,w as generateAccessToken,y as getAccessToken,T as revokeAccessToken,h as isAccessTokenExpiring};

@@ -1,4 +0,4 @@

import e from"chalk";import i from"update-notifier";const r=1,c=t=>{const o=i({pkg:t,updateCheckInterval:1e3*60*60*r});if(o.update){const n=!0,a=n?"commercelayer plugins:update":"{updateCommand}";o.notify({isGlobal:!n,message:`-= ${e.bgWhite.black.bold(` ${t.description} `)} =-
import e from"chalk";import i from"update-notifier";const a=1,r=t=>{const o=i({pkg:t,updateCheckInterval:36e5*a});if(o.update){const n="commercelayer plugins:update";o.notify({isGlobal:!1,message:`-= ${e.bgWhite.black.bold(` ${t.description} `)} =-
New version available: ${e.dim("{currentVersion}")} -> ${e.green("{latestVersion}")}
Run ${e.cyanBright(a)} to update`})}};export{c as checkUpdate};
Run ${e.cyanBright(n)} to update`})}};export{r as checkUpdate};

@@ -5,2 +5,3 @@ /** Await ms milliseconds */

declare const log: (message?: string, ...args: unknown[]) => void;
export { sleep, resetConsole, log };
declare const capitalize: (str: string | undefined) => string | undefined;
export { sleep, resetConsole, log, capitalize };

@@ -1,2 +0,2 @@

import{format as r,inspect as n}from"util";const s=async t=>new Promise(o=>setTimeout(o,t)),e=()=>{const t="[?25h",o="[?7h";process.stdout.write(`${t}${o}`)},c=(t="",...o)=>{t=typeof t=="string"?t:n(t),process.stdout.write(r(t,...o)+`
`)};export{s as sleep,e as resetConsole,c as log};
import{format as r,inspect as s}from"util";const e=async t=>new Promise(o=>setTimeout(o,t)),n=()=>{const t="\x1B[?25h",o="\x1B[?7h";process.stdout.write(`${t}${o}`)},i=(t="",...o)=>{t=typeof t=="string"?t:s(t),process.stdout.write(r(t,...o)+`
`)},c=t=>{if(!t)return t;let o=t.toLowerCase();return o=o.substring(0,1).toUpperCase()+o.substring(1),o};export{e as sleep,n as resetConsole,i as log,c as capitalize};
{
"name": "@commercelayer/cli-core",
"version": "1.3.15",
"version": "1.4.0",
"main": "lib/cjs/index.js",

@@ -36,2 +36,3 @@ "types": "lib/cjs/index.d.ts",

"@commercelayer/js-auth": "^2.2.8",
"@oclif/core": "^1.10.0",
"chalk": "^4.1.2",

@@ -47,3 +48,3 @@ "jsonwebtoken": "^8.5.1",

"@types/jsonwebtoken": "^8.5.6",
"@types/node": "^16.11.0",
"@types/node": "^17.0.21",
"@types/update-notifier": "^5.1.0",

@@ -50,0 +51,0 @@ "@typescript-eslint/eslint-plugin": "^5.2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc