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

@commercelayer/cli-core

Package Overview
Dependencies
Maintainers
6
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 2.0.0-beta.2 to 2.0.0

2

lib/cjs/api.d.ts

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

declare type ApiMode = 'test' | 'live';
type ApiMode = 'test' | 'live';
export type { ApiMode };

@@ -3,0 +3,0 @@ /** Build base URL */

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

declare type ApiConfig = {
type ApiConfig = {
default_domain: string;
default_app_domain: string;
token_expiration_mins: number;

@@ -14,7 +15,7 @@ token_encoding_algorithm: string;

};
declare type ApplicationConfig = {
type ApplicationConfig = {
kinds: readonly string[];
login_scopes: readonly string[];
};
declare type ImportsConfig = {
type ImportsConfig = {
max_size: number;

@@ -25,9 +26,9 @@ statuses: readonly string[];

};
declare type WebhooksConfig = {
type WebhooksConfig = {
retry_number: number;
};
declare type CliConfig = {
type CliConfig = {
applications: readonly string[];
};
declare type Config = {
type Config = {
api: ApiConfig;

@@ -34,0 +35,0 @@ application: ApplicationConfig;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const IMPORTS_RESOURCE_TYPES=["bundles","coupons","customer_subscriptions","customers","gift_cards","orders","prices","sku_lists","sku_list_items","sku_options","skus","stock_items","tax_categories"],IMPORTS_STATUSES=["in_progress","pending","completed","interrupted"],config={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:150,requests_max_secs_avg:60,requests_max_num_oauth:15,requests_max_secs_oauth:60,page_max_size:25,page_default_size:10},application:{kinds:["integration","sales_channel","webapp"],login_scopes:["market","stock_location"]},imports:{max_size:2e3,statuses:IMPORTS_STATUSES,types:IMPORTS_RESOURCE_TYPES,max_queue_length:10},webhooks:{retry_number:5},cli:{applications:["integration","sales_channel"]}};exports.default=config;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const IMPORTS_RESOURCE_TYPES=["bundles","coupons","customer_subscriptions","customers","gift_cards","orders","prices","sku_lists","sku_list_items","sku_options","skus","stock_items","tax_categories"],IMPORTS_STATUSES=["in_progress","pending","completed","interrupted"],config={api:{default_domain:"commercelayer.io",default_app_domain:"commercelayer.app",token_expiration_mins:60*2,token_encoding_algorithm:"HS512",requests_max_num_burst:50,requests_max_secs_burst:10,requests_max_num_avg:150,requests_max_secs_avg:60,requests_max_num_oauth:15,requests_max_secs_oauth:60,page_max_size:25,page_default_size:10},application:{kinds:["integration","sales_channel","webapp"],login_scopes:["market","stock_location"]},imports:{max_size:2e3,statuses:IMPORTS_STATUSES,types:IMPORTS_RESOURCE_TYPES,max_queue_length:10},webhooks:{retry_number:5},cli:{applications:["integration","sales_channel"]}};exports.default=config;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const core_1=require("@oclif/core"),text_1=require("./text"),PRINT_TRACE=!1;class CLICommandHelp extends core_1.CommandHelp{examples(o){return PRINT_TRACE&&console.log("---------- command.examples"),super.examples(o)}}class CLIBaseHelp extends core_1.Help{async showHelp(o){return PRINT_TRACE&&console.log("---------- showHelp"),super.showHelp(o)}async showRootHelp(){return PRINT_TRACE&&console.log("---------- showRootHelp"),super.showRootHelp()}async showTopicHelp(o){return PRINT_TRACE&&console.log("---------- showTopicHelp"),super.showTopicHelp(o)}async showCommandHelp(o){PRINT_TRACE&&console.log("---------- showCommandHelp");const s=o.id,e=s?s.split(":").length:1,t=this.sortedTopics.filter(l=>l.name.startsWith(s+":")&&l.name.split(":").length===e+1),n=this.sortedCommands.filter(l=>l.id.startsWith(s+":")&&l.id.split(":").length===e+1),r=o.description&&this.render(o.description).split(`
`)[0];r&&console.log((0,text_1.capitalize)(r)+`
`)[0];r&&console.log(`${(0,text_1.capitalize)(r)}
`),console.log(this.formatCommand(o)),console.log(""),t.length>0&&(console.log(this.formatTopics(t)),console.log("")),n.length>0&&(console.log(this.formatCommands(n)),console.log(""))}formatRoot(){return PRINT_TRACE&&console.log("---------- formatRoot"),super.formatRoot()}formatTopic(o){return PRINT_TRACE&&console.log("---------- formatTopic"),super.formatTopic(o)}formatTopics(o){PRINT_TRACE&&console.log("---------- formatTopics");const s=o.filter(e=>!e.hidden).map(e=>(e.description=(0,text_1.capitalize)(e.description),e));return super.formatTopics(s)}formatCommands(o){return PRINT_TRACE&&console.log("---------- formatCommands"),super.formatCommands(o).split(`
`).map(s=>{let e=0;return s.split(" ").map(t=>(t||"").trim()!==""&&++e===2?(0,text_1.capitalize)(t):t).join(" ")}).join(`
`)}formatCommand(o){return PRINT_TRACE&&console.log("---------- formatCommand"),super.formatCommand(o)}getCommandHelpClass(o){return PRINT_TRACE&&console.log("---------- getCommandHelpClass"),new CLICommandHelp(o,this.config,this.opts)}}exports.default=CLIBaseHelp;

@@ -13,3 +13,3 @@ /** Print a formatted object */

/** Print object in CSV format */
declare const printCSV: (obj: Array<object>, flags?: any) => string;
declare const printCSV: (obj: object[], flags?: any) => string;
/** Center a string in the given width space */

@@ -16,0 +16,0 @@ declare const center: (str: string, width: number) => string;

@@ -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?.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;
"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?.fields.includes(t):!0);let l=n.map(t=>t.toUpperCase().replace(/_/g," ")).join(";")+`
`;return r.forEach(t=>{l+=n.map(a=>t[a]).join(";")+`
`}),l};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,l)=>{const t=Array.isArray(l[e])?l[e].join():l[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;
import { AppAuth } from './application';
import { AuthReturnType } from '@commercelayer/js-auth';
export declare type AccessTokenInfo = {
export type AccessTokenInfo = {
organization: {

@@ -28,3 +28,3 @@ id: string;

};
export declare type CustomToken = {
export type CustomToken = {
accessToken: string;

@@ -31,0 +31,0 @@ info: AccessTokenInfo;

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

declare type ApiMode = 'test' | 'live';
type ApiMode = 'test' | 'live';
export type { ApiMode };

@@ -3,0 +3,0 @@ /** Build base URL */

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

declare type ApiConfig = {
type ApiConfig = {
default_domain: string;
default_app_domain: string;
token_expiration_mins: number;

@@ -14,7 +15,7 @@ token_encoding_algorithm: string;

};
declare type ApplicationConfig = {
type ApplicationConfig = {
kinds: readonly string[];
login_scopes: readonly string[];
};
declare type ImportsConfig = {
type ImportsConfig = {
max_size: number;

@@ -25,9 +26,9 @@ statuses: readonly string[];

};
declare type WebhooksConfig = {
type WebhooksConfig = {
retry_number: number;
};
declare type CliConfig = {
type CliConfig = {
applications: readonly string[];
};
declare type Config = {
type Config = {
api: ApiConfig;

@@ -34,0 +35,0 @@ application: ApplicationConfig;

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

const s=["bundles","coupons","customer_subscriptions","customers","gift_cards","orders","prices","sku_lists","sku_list_items","sku_options","skus","stock_items","tax_categories"],e=["in_progress","pending","completed","interrupted"],t={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:150,requests_max_secs_avg:60,requests_max_num_oauth:15,requests_max_secs_oauth:60,page_max_size:25,page_default_size:10},application:{kinds:["integration","sales_channel","webapp"],login_scopes:["market","stock_location"]},imports:{max_size:2e3,statuses:e,types:s,max_queue_length:10},webhooks:{retry_number:5},cli:{applications:["integration","sales_channel"]}};export default t;
const s=["bundles","coupons","customer_subscriptions","customers","gift_cards","orders","prices","sku_lists","sku_list_items","sku_options","skus","stock_items","tax_categories"],e=["in_progress","pending","completed","interrupted"],t={api:{default_domain:"commercelayer.io",default_app_domain:"commercelayer.app",token_expiration_mins:120,token_encoding_algorithm:"HS512",requests_max_num_burst:50,requests_max_secs_burst:10,requests_max_num_avg:150,requests_max_secs_avg:60,requests_max_num_oauth:15,requests_max_secs_oauth:60,page_max_size:25,page_default_size:10},application:{kinds:["integration","sales_channel","webapp"],login_scopes:["market","stock_location"]},imports:{max_size:2e3,statuses:e,types:s,max_queue_length:10},webhooks:{retry_number:5},cli:{applications:["integration","sales_channel"]}};export default t;
import{CommandHelp as a,Help as c}from"@oclif/core";import{capitalize as r}from"./text";const s=!1;class f extends a{examples(o){return s&&console.log("---------- command.examples"),super.examples(o)}}export default class d extends c{async showHelp(o){return s&&console.log("---------- showHelp"),super.showHelp(o)}async showRootHelp(){return s&&console.log("---------- showRootHelp"),super.showRootHelp()}async showTopicHelp(o){return s&&console.log("---------- showTopicHelp"),super.showTopicHelp(o)}async showCommandHelp(o){s&&console.log("---------- showCommandHelp");const t=o.id,e=t?t.split(":").length:1,n=this.sortedTopics.filter(l=>l.name.startsWith(t+":")&&l.name.split(":").length===e+1),i=this.sortedCommands.filter(l=>l.id.startsWith(t+":")&&l.id.split(":").length===e+1),p=o.description&&this.render(o.description).split(`
`)[0];p&&console.log(r(p)+`
`)[0];p&&console.log(`${r(p)}
`),console.log(this.formatCommand(o)),console.log(""),n.length>0&&(console.log(this.formatTopics(n)),console.log("")),i.length>0&&(console.log(this.formatCommands(i)),console.log(""))}formatRoot(){return s&&console.log("---------- formatRoot"),super.formatRoot()}formatTopic(o){return s&&console.log("---------- formatTopic"),super.formatTopic(o)}formatTopics(o){s&&console.log("---------- formatTopics");const t=o.filter(e=>!e.hidden).map(e=>(e.description=r(e.description),e));return super.formatTopics(t)}formatCommands(o){return s&&console.log("---------- formatCommands"),super.formatCommands(o).split(`
`).map(t=>{let e=0;return t.split(" ").map(n=>(n||"").trim()!==""&&++e===2?r(n):n).join(" ")}).join(`
`)}formatCommand(o){return s&&console.log("---------- formatCommand"),super.formatCommand(o)}getCommandHelpClass(o){return s&&console.log("---------- getCommandHelpClass"),new f(o,this.config,this.opts)}}

@@ -13,3 +13,3 @@ /** Print a formatted object */

/** Print object in CSV format */
declare const printCSV: (obj: Array<object>, flags?: any) => string;
declare const printCSV: (obj: object[], flags?: any) => string;
/** Center a string in the given width space */

@@ -16,0 +16,0 @@ declare const center: (str: string, width: number) => string;

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

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 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};
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),i=(e,r)=>{if(!e||e.length===0)return"";const t=Object.keys(e[0]).filter(n=>["id","type"].includes(n)?r?.fields.includes(n):!0);let l=t.map(n=>n.toUpperCase().replace(/_/g," ")).join(";")+`
`;return e.forEach(n=>{l+=t.map(a=>n[a]).join(";")+`
`}),l},o=(e,r)=>e.padStart(e.length+Math.floor((r-e.length)/2)," ").padEnd(r," "),v=(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),h=e=>e.replace("T"," ").replace("Z","").substring(0,e.lastIndexOf(".")),m=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 i(e,r);if(r.json)return u(e,{unformatted:r.unformatted})}return d(e,{color:t})},s=(e,r)=>c(e.errors||e,r);export{d as printObject,u as printJSON,i as printCSV,o as center,v as maxLength,h as cleanDate,m as localeDate,c as formatOutput,s as formatError};
import { AppAuth } from './application';
import { AuthReturnType } from '@commercelayer/js-auth';
export declare type AccessTokenInfo = {
export type AccessTokenInfo = {
organization: {

@@ -28,3 +28,3 @@ id: string;

};
export declare type CustomToken = {
export type CustomToken = {
accessToken: string;

@@ -31,0 +31,0 @@ info: AccessTokenInfo;

{
"name": "@commercelayer/cli-core",
"version": "2.0.0-beta.2",
"version": "2.0.0",
"main": "lib/cjs/index.js",

@@ -23,20 +23,21 @@ "types": "lib/cjs/index.d.ts",

"devDependencies": {
"@babel/preset-env": "^7.19.4",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@commercelayer/eslint-config-ts": "^0.1.4",
"@size-limit/preset-small-lib": "^6.0.4",
"@types/jest": "^27.5.2",
"@types/jsonwebtoken": "^8.5.9",
"@types/node": "^18.8.3",
"@types/node": "^18.11.9",
"@types/update-notifier": "^5.1.0",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"eslint": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"eslint": "^8.27.0",
"jest": "^27.5.1",
"minimize-js": "^1.3.0",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
"typescript": "^4.9.3"
},
"dependencies": {
"@commercelayer/js-auth": "^2.2.8",
"@oclif/core": "^1.16.5",
"axios": "^0.27.2",
"@commercelayer/js-auth": "^2.3.0",
"@oclif/core": "^1.20.4",
"axios": "^1.1.3",
"chalk": "^4.1.2",

@@ -60,2 +61,3 @@ "jsonwebtoken": "^8.5.1",

"lintspec": "eslint ./specs/ --ext .spec.ts",
"lint:fix": "eslint src --fix",
"build": "rm -rf lib && tsc -b tsconfig.json tsconfig.esm.json --verbose",

@@ -67,5 +69,4 @@ "start": "ts-node src/index.ts",

"analyze": "size-limit --why",
"postbuild": "minimize-js lib",
"preinstall": "npx only-allow pnpm"
"postbuild": "minimize-js lib"
}
}

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

# commercelayer-cli-core
# commercelayer-cli-core

Sorry, the diff of this file is not supported yet

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