@commercelayer/cli-plugin-imports
Advanced tools
Comparing version 3.1.6 to 3.2.0
@@ -13,2 +13,3 @@ import Command from '../../base'; | ||
csv: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; | ||
delimiter: import("@oclif/core/lib/interfaces").OptionFlag<string>; | ||
blind: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; | ||
@@ -15,0 +16,0 @@ quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; |
@@ -214,2 +214,8 @@ "use strict"; | ||
}), | ||
delimiter: base_1.Flags.enum({ | ||
char: 'D', | ||
description: `the delimiter character used in the CSV input file (one of ',', ';', '|', TAB)`, | ||
options: [',', ';', '|', 'TAB'], | ||
dependsOn: ['csv'], | ||
}), | ||
blind: base_1.Flags.boolean({ | ||
@@ -216,0 +222,0 @@ char: 'b', |
@@ -8,7 +8,7 @@ "use strict"; | ||
const cli_core_1 = require("@commercelayer/cli-core"); | ||
const generateInputsCSV = async (filePath) => { | ||
const generateInputsCSV = async (filePath, delimiter) => { | ||
const inputs = []; | ||
return new Promise((resolve, reject) => { | ||
(0, fs_1.createReadStream)(filePath) | ||
.pipe(csv.parse({ headers: true, ignoreEmpty: true })) | ||
.pipe(csv.parse({ headers: true, ignoreEmpty: true, delimiter })) | ||
.on('error', error => reject(error)) | ||
@@ -34,6 +34,10 @@ .on('data', row => inputs.push(row)) | ||
return Promise.reject(new Error('Unable to find file ' + cli_core_1.clColor.style.path(filePath))); | ||
if (flags?.csv) | ||
return generateInputsCSV(filePath); | ||
if (flags?.csv) { | ||
let delimiter = flags.delimiter; | ||
if (delimiter && (delimiter === 'TAB')) | ||
delimiter = '\t'; | ||
return generateInputsCSV(filePath, delimiter); | ||
} | ||
return generateInputJSON(filePath); | ||
}; | ||
exports.generateInputs = generateInputs; |
@@ -1,1 +0,1 @@ | ||
{"version":"3.1.6","commands":{"imports:create":{"id":"imports:create","description":"create a new import","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:create","import"],"examples":["$ commercelayer imports:create -t stock_items -p <stock_location-id> -i <input-file-path>","$ cl imp:create -t skus -i <input-file-path>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"type":{"name":"type","type":"option","char":"t","description":"the type of resource being imported","required":true,"helpValue":"orders|coupons|skus|sku_lists|...","multiple":false,"options":["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"]},"parent":{"name":"parent","type":"option","char":"p","description":"the id of the parent resource to be associated with imported data","multiple":false},"inputs":{"name":"inputs","type":"option","char":"i","description":"the path of the file containing the data to import","required":true,"multiple":false},"csv":{"name":"csv","type":"boolean","char":"C","description":"accept input file in CSV format","allowNo":false,"dependsOn":["inputs"]},"blind":{"name":"blind","type":"boolean","char":"b","description":"execute in blind mode without showing the progress monitor","allowNo":false,"exclusive":["quiet","silent"]},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"execute command without showing warning messages","allowNo":false,"exclusive":["blind"]}},"args":[{"name":"fake-arg","description":"fake argument","required":false,"hidden":true}],"_globalFlags":{}},"imports:delete":{"id":"imports:delete","description":"delete an existing import","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:delete"],"examples":["$ commercelayer imports:delete <import-id>>","$ cl imp:delete <import-id>>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false}},"args":[{"name":"id","description":"unique id of the import","required":true,"hidden":false}],"_globalFlags":{}},"imports:details":{"id":"imports:details","description":"show the details of an existing import","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:details"],"examples":["$ commercelayer imports:details <import-id>","$ cl imp:details <import-id> -i","$ cl imp:details <import-id> -i -l"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"inputs":{"name":"inputs","type":"boolean","char":"i","description":"show input items associated with the import","allowNo":false},"logs":{"name":"logs","type":"boolean","char":"l","description":"show warning and error logs related to the import process","allowNo":false}},"args":[{"name":"id","description":"unique id of the import","required":true,"hidden":false}],"_globalFlags":{}},"imports:group":{"id":"imports:group","description":"list all the imports related to an import group","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:group"],"examples":["$ commercelayer imports:group <group-id>","$ cl imp:group <group-id>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false}},"args":[{"name":"group_id","description":"unique id of the group import","required":true,"hidden":false}],"_globalFlags":{}},"imports":{"id":"imports","description":"list all the created imports","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":[],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"all":{"name":"all","type":"boolean","char":"A","description":"show all imports instead of first 25 only","allowNo":false,"exclusive":["limit"]},"type":{"name":"type","type":"option","char":"t","description":"the type of resource imported","multiple":false,"options":["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"]},"group":{"name":"group","type":"option","char":"g","description":"the group ID associated to the import in case of multi-chunk imports","multiple":false,"exclusive":["all, limit"]},"status":{"name":"status","type":"option","char":"s","description":"the import job status","multiple":false,"options":["in_progress","pending","completed","interrupted"]},"errors":{"name":"errors","type":"boolean","char":"e","description":"show only imports with errors","allowNo":false},"warnings":{"name":"warnings","type":"boolean","char":"w","description":"show only import with warnings","allowNo":false},"limit":{"name":"limit","type":"option","char":"l","description":"limit number of imports in output","multiple":false,"exclusive":["all"]}},"args":[],"_globalFlags":{}},"imports:list":{"id":"imports:list","description":"list all the created imports","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imports","imp:list"],"examples":["$ commercelayer imports","$ cl imports:list -A","$ cl imp:list"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"all":{"name":"all","type":"boolean","char":"A","description":"show all imports instead of first 25 only","allowNo":false,"exclusive":["limit"]},"type":{"name":"type","type":"option","char":"t","description":"the type of resource imported","multiple":false,"options":["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"]},"group":{"name":"group","type":"option","char":"g","description":"the group ID associated to the import in case of multi-chunk imports","multiple":false,"exclusive":["all, limit"]},"status":{"name":"status","type":"option","char":"s","description":"the import job status","multiple":false,"options":["in_progress","pending","completed","interrupted"]},"errors":{"name":"errors","type":"boolean","char":"e","description":"show only imports with errors","allowNo":false},"warnings":{"name":"warnings","type":"boolean","char":"w","description":"show only import with warnings","allowNo":false},"limit":{"name":"limit","type":"option","char":"l","description":"limit number of imports in output","multiple":false,"exclusive":["all"]}},"args":[{"name":"fake-arg","description":"fake argument","required":false,"hidden":true}],"_globalFlags":{}},"imports:noc":{"id":"imports:noc","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[],"_globalFlags":{}},"imports:types":{"id":"imports:types","description":"show online documentation for supported resources","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:types"],"examples":["$ commercelayer imports:types","$ cl imp:types"],"flags":{},"args":[]}}} | ||
{"version":"3.2.0","commands":{"imports:create":{"id":"imports:create","description":"create a new import","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:create","import"],"examples":["$ commercelayer imports:create -t stock_items -p <stock_location-id> -i <input-file-path>","$ cl imp:create -t skus -i <input-file-path>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"type":{"name":"type","type":"option","char":"t","description":"the type of resource being imported","required":true,"helpValue":"orders|coupons|skus|sku_lists|...","multiple":false,"options":["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"]},"parent":{"name":"parent","type":"option","char":"p","description":"the id of the parent resource to be associated with imported data","multiple":false},"inputs":{"name":"inputs","type":"option","char":"i","description":"the path of the file containing the data to import","required":true,"multiple":false},"csv":{"name":"csv","type":"boolean","char":"C","description":"accept input file in CSV format","allowNo":false,"dependsOn":["inputs"]},"delimiter":{"name":"delimiter","type":"option","char":"D","description":"the delimiter character used in the CSV input file (one of ',', ';', '|', TAB)","helpValue":"(,|;|||TAB)","multiple":false,"options":[",",";","|","TAB"],"dependsOn":["csv"]},"blind":{"name":"blind","type":"boolean","char":"b","description":"execute in blind mode without showing the progress monitor","allowNo":false,"exclusive":["quiet","silent"]},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"execute command without showing warning messages","allowNo":false,"exclusive":["blind"]}},"args":[{"name":"fake-arg","description":"fake argument","required":false,"hidden":true}],"_globalFlags":{}},"imports:delete":{"id":"imports:delete","description":"delete an existing import","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:delete"],"examples":["$ commercelayer imports:delete <import-id>>","$ cl imp:delete <import-id>>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false}},"args":[{"name":"id","description":"unique id of the import","required":true,"hidden":false}],"_globalFlags":{}},"imports:details":{"id":"imports:details","description":"show the details of an existing import","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:details"],"examples":["$ commercelayer imports:details <import-id>","$ cl imp:details <import-id> -i","$ cl imp:details <import-id> -i -l"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"inputs":{"name":"inputs","type":"boolean","char":"i","description":"show input items associated with the import","allowNo":false},"logs":{"name":"logs","type":"boolean","char":"l","description":"show warning and error logs related to the import process","allowNo":false}},"args":[{"name":"id","description":"unique id of the import","required":true,"hidden":false}],"_globalFlags":{}},"imports:group":{"id":"imports:group","description":"list all the imports related to an import group","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:group"],"examples":["$ commercelayer imports:group <group-id>","$ cl imp:group <group-id>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false}},"args":[{"name":"group_id","description":"unique id of the group import","required":true,"hidden":false}],"_globalFlags":{}},"imports":{"id":"imports","description":"list all the created imports","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":[],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"all":{"name":"all","type":"boolean","char":"A","description":"show all imports instead of first 25 only","allowNo":false,"exclusive":["limit"]},"type":{"name":"type","type":"option","char":"t","description":"the type of resource imported","multiple":false,"options":["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"]},"group":{"name":"group","type":"option","char":"g","description":"the group ID associated to the import in case of multi-chunk imports","multiple":false,"exclusive":["all, limit"]},"status":{"name":"status","type":"option","char":"s","description":"the import job status","multiple":false,"options":["in_progress","pending","completed","interrupted"]},"errors":{"name":"errors","type":"boolean","char":"e","description":"show only imports with errors","allowNo":false},"warnings":{"name":"warnings","type":"boolean","char":"w","description":"show only import with warnings","allowNo":false},"limit":{"name":"limit","type":"option","char":"l","description":"limit number of imports in output","multiple":false,"exclusive":["all"]}},"args":[],"_globalFlags":{}},"imports:list":{"id":"imports:list","description":"list all the created imports","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imports","imp:list"],"examples":["$ commercelayer imports","$ cl imports:list -A","$ cl imp:list"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true,"multiple":false},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false,"multiple":false,"dependsOn":["organization"]},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":true,"multiple":false},"all":{"name":"all","type":"boolean","char":"A","description":"show all imports instead of first 25 only","allowNo":false,"exclusive":["limit"]},"type":{"name":"type","type":"option","char":"t","description":"the type of resource imported","multiple":false,"options":["orders","coupons","skus","sku_lists","sku_list_items","prices","stock_items","gift_cards","customers","customer_subscriptions","tax_categories"]},"group":{"name":"group","type":"option","char":"g","description":"the group ID associated to the import in case of multi-chunk imports","multiple":false,"exclusive":["all, limit"]},"status":{"name":"status","type":"option","char":"s","description":"the import job status","multiple":false,"options":["in_progress","pending","completed","interrupted"]},"errors":{"name":"errors","type":"boolean","char":"e","description":"show only imports with errors","allowNo":false},"warnings":{"name":"warnings","type":"boolean","char":"w","description":"show only import with warnings","allowNo":false},"limit":{"name":"limit","type":"option","char":"l","description":"limit number of imports in output","multiple":false,"exclusive":["all"]}},"args":[{"name":"fake-arg","description":"fake argument","required":false,"hidden":true}],"_globalFlags":{}},"imports:noc":{"id":"imports:noc","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[],"_globalFlags":{}},"imports:types":{"id":"imports:types","description":"show online documentation for supported resources","strict":true,"pluginName":"@commercelayer/cli-plugin-imports","pluginAlias":"@commercelayer/cli-plugin-imports","pluginType":"core","aliases":["imp:types"],"examples":["$ commercelayer imports:types","$ cl imp:types"],"flags":{},"args":[]}}} |
{ | ||
"name": "@commercelayer/cli-plugin-imports", | ||
"description": "Commerce Layer CLI Imports plugin", | ||
"version": "3.1.6", | ||
"version": "3.2.0", | ||
"author": "Pierluigi Viti <pierluigi@commercelayer.io>", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/commercelayer/commercelayer-cli-plugin-imports/issues", |
@@ -50,6 +50,8 @@ # cli-plugin-imports | ||
orders|coupons|skus|sku_lists|sku_list_items|prices|stock_items|gift_cards|customers|customer_subscriptions|tax_cate | ||
gories [-p <value>] (-C -i <value>) [-b | -q | ] | ||
gories [-p <value>] [-D ,|;|||TAB (-C -i <value>)] [-b | -q | ] | ||
FLAGS | ||
-C, --csv accept input file in CSV format | ||
-D, --delimiter=(,|;|||TAB) the delimiter character used in the CSV input file (one of ',', ';', | ||
'|', TAB) | ||
-b, --blind execute in blind mode without showing the progress monitor | ||
@@ -223,6 +225,8 @@ -i, --inputs=<value> (required) the path of the file containing the data to import | ||
orders|coupons|skus|sku_lists|sku_list_items|prices|stock_items|gift_cards|customers|customer_subscriptions|tax_cate | ||
gories [-p <value>] (-C -i <value>) [-b | -q | ] | ||
gories [-p <value>] [-D ,|;|||TAB (-C -i <value>)] [-b | -q | ] | ||
FLAGS | ||
-C, --csv accept input file in CSV format | ||
-D, --delimiter=(,|;|||TAB) the delimiter character used in the CSV input file (one of ',', ';', | ||
'|', TAB) | ||
-b, --blind execute in blind mode without showing the progress monitor | ||
@@ -285,6 +289,8 @@ -i, --inputs=<value> (required) the path of the file containing the data to import | ||
orders|coupons|skus|sku_lists|sku_list_items|prices|stock_items|gift_cards|customers|customer_subscriptions|tax_cate | ||
gories [-p <value>] (-C -i <value>) [-b | -q | ] | ||
gories [-p <value>] [-D ,|;|||TAB (-C -i <value>)] [-b | -q | ] | ||
FLAGS | ||
-C, --csv accept input file in CSV format | ||
-D, --delimiter=(,|;|||TAB) the delimiter character used in the CSV input file (one of ',', ';', | ||
'|', TAB) | ||
-b, --blind execute in blind mode without showing the progress monitor | ||
@@ -291,0 +297,0 @@ -i, --inputs=<value> (required) the path of the file containing the data to import |
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
86133
1383
465