@commercelayer/cli-core 4.12.0 → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/lib/index.d.mts +595 -0
  2. package/lib/index.d.ts +595 -0
  3. package/lib/index.js +11 -0
  4. package/lib/index.mjs +11 -0
  5. package/package.json +34 -41
  6. package/lib/cjs/api.d.ts +0 -41
  7. package/lib/cjs/api.js +0 -1
  8. package/lib/cjs/application.d.ts +0 -34
  9. package/lib/cjs/application.js +0 -1
  10. package/lib/cjs/color.d.ts +0 -107
  11. package/lib/cjs/color.js +0 -1
  12. package/lib/cjs/command.d.ts +0 -21
  13. package/lib/cjs/command.js +0 -1
  14. package/lib/cjs/config.d.ts +0 -92
  15. package/lib/cjs/config.js +0 -1
  16. package/lib/cjs/filter.d.ts +0 -10
  17. package/lib/cjs/filter.js +0 -1
  18. package/lib/cjs/help.d.ts +0 -17
  19. package/lib/cjs/help.js +0 -5
  20. package/lib/cjs/index.d.ts +0 -19
  21. package/lib/cjs/index.js +0 -1
  22. package/lib/cjs/inflector.d.ts +0 -26
  23. package/lib/cjs/inflector.js +0 -1
  24. package/lib/cjs/jsonapi.d.ts +0 -2
  25. package/lib/cjs/jsonapi.js +0 -1
  26. package/lib/cjs/output.d.ts +0 -28
  27. package/lib/cjs/output.js +0 -3
  28. package/lib/cjs/raw.d.ts +0 -12
  29. package/lib/cjs/raw.js +0 -1
  30. package/lib/cjs/schema.d.ts +0 -2
  31. package/lib/cjs/schema.js +0 -1
  32. package/lib/cjs/style.d.ts +0 -14
  33. package/lib/cjs/style.js +0 -1
  34. package/lib/cjs/symbol.d.ts +0 -2
  35. package/lib/cjs/symbol.js +0 -1
  36. package/lib/cjs/text.d.ts +0 -6
  37. package/lib/cjs/text.js +0 -1
  38. package/lib/cjs/token.d.ts +0 -58
  39. package/lib/cjs/token.js +0 -1
  40. package/lib/cjs/update.d.ts +0 -7
  41. package/lib/cjs/update.js +0 -4
  42. package/lib/cjs/util.d.ts +0 -9
  43. package/lib/cjs/util.js +0 -2
  44. package/lib/esm/api.d.ts +0 -41
  45. package/lib/esm/api.js +0 -1
  46. package/lib/esm/application.d.ts +0 -34
  47. package/lib/esm/application.js +0 -1
  48. package/lib/esm/color.d.ts +0 -107
  49. package/lib/esm/color.js +0 -1
  50. package/lib/esm/command.d.ts +0 -21
  51. package/lib/esm/command.js +0 -1
  52. package/lib/esm/config.d.ts +0 -92
  53. package/lib/esm/config.js +0 -1
  54. package/lib/esm/filter.d.ts +0 -10
  55. package/lib/esm/filter.js +0 -1
  56. package/lib/esm/help.d.ts +0 -17
  57. package/lib/esm/help.js +0 -5
  58. package/lib/esm/index.d.ts +0 -19
  59. package/lib/esm/index.js +0 -1
  60. package/lib/esm/inflector.d.ts +0 -26
  61. package/lib/esm/inflector.js +0 -1
  62. package/lib/esm/jsonapi.d.ts +0 -2
  63. package/lib/esm/jsonapi.js +0 -1
  64. package/lib/esm/output.d.ts +0 -28
  65. package/lib/esm/output.js +0 -3
  66. package/lib/esm/raw.d.ts +0 -12
  67. package/lib/esm/raw.js +0 -1
  68. package/lib/esm/schema.d.ts +0 -2
  69. package/lib/esm/schema.js +0 -1
  70. package/lib/esm/style.d.ts +0 -14
  71. package/lib/esm/style.js +0 -1
  72. package/lib/esm/symbol.d.ts +0 -2
  73. package/lib/esm/symbol.js +0 -1
  74. package/lib/esm/text.d.ts +0 -6
  75. package/lib/esm/text.js +0 -1
  76. package/lib/esm/token.d.ts +0 -58
  77. package/lib/esm/token.js +0 -1
  78. package/lib/esm/update.d.ts +0 -7
  79. package/lib/esm/update.js +0 -4
  80. package/lib/esm/util.d.ts +0 -9
  81. package/lib/esm/util.js +0 -2
  82. package/lib/tsconfig.esm.tsbuildinfo +0 -1
  83. package/lib/tsconfig.tsbuildinfo +0 -1
package/lib/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ var ye=Object.defineProperty;var _=(e,t)=>{for(var r in t)ye(e,r,{get:t[r],enumerable:!0})};var Y={};_(Y,{Operation:()=>P,baseURL:()=>$e,execMode:()=>qe,extractDomain:()=>Ce,humanizeResource:()=>Re,isResourceCacheable:()=>G,liveEnvironment:()=>ze,request:()=>Ee,requestDataFile:()=>K,requestRateLimitDelay:()=>J,requestRaw:()=>L,response:()=>Ie,responseDenormalize:()=>U});var O=["in_progress","pending","completed","interrupted"],xe=["addresses","bundles","coupons","customer_addresses","customer_payment_sources","customer_subscriptions","customers","gift_cards","line_items","line_item_options","orders","price_tiers","prices","shipping_categories","sku_lists","sku_list_items","sku_options","skus","stock_items","tags","tax_categories"],ve=["addresses","authorizations","bundles","captures","coupons","customer_addresses","customer_subscriptions","customers","gift_cards","line_items","orders","payment_methods","price_tiers","prices","refunds","shipments","shipping_categories","shipping_methods","sku_lists","sku_list_items","sku_options","skus","stock_items","tags","tax_categories","transactions","voids"],Te=["bundles","gift_cards","prices","promotions","sku_lists","sku_options","skus","stock_items"],we=["addresses","bundles","customers","coupons","gift_cards","line_items","line_item_options","orders","returns","skus","sku_options","promotions","external_promotions","fixed_amount_promotions","fixed_price_promotions","free_gift_promotions","free_shipping_promotions","percentage_discount_promotions"],y={erl_oauth_limit_live:30,erl_burst_limit_uncachable_live:50,erl_burst_limit_uncachable_test:25,erl_burst_limit_cachable_live:250,erl_burst_limit_cachable_test:125,erl_average_limit_uncachable_live:200,erl_average_limit_uncachable_test:100,erl_average_limit_cachable_live:1e3,erl_average_limit_cachable_test:500},ke={api:{default_domain:"commercelayer.io",default_app_domain:"commercelayer.app",default_stg_domain:"commercelayer.co",token_expiration_mins:60*4,token_encoding_algorithm:"HS512",requests_max_num_burst:y.erl_burst_limit_uncachable_live,requests_max_num_burst_cacheable:y.erl_burst_limit_cachable_live,requests_max_num_burst_test:y.erl_burst_limit_uncachable_test,requests_max_num_burst_test_cacheable:y.erl_burst_limit_cachable_test,requests_max_num_avg:y.erl_average_limit_uncachable_live,requests_max_num_avg_cacheable:y.erl_average_limit_cachable_live,requests_max_num_avg_test:y.erl_average_limit_uncachable_test,requests_max_num_avg_test_cacheable:y.erl_average_limit_cachable_test,requests_max_num_oauth:y.erl_oauth_limit_live,requests_max_secs_burst:10,requests_max_secs_oauth:60,requests_max_secs_avg:60,page_max_size:25,page_default_size:10},application:{kinds:["integration","sales_channel","webapp","user"],login_scopes:["market","stock_location"]},imports:{max_size:1e4,statuses:O,types:xe,max_queue_length:10,attachment_expiration:5},exports:{max_size:1e4,statuses:O,types:ve,max_queue_length:10,attachment_expiration:5},cleanups:{max_size:1e4,statuses:O,types:Te,max_queue_length:10},webhooks:{retry_number:5},cli:{applications:["integration","sales_channel","user"]},doc:{core:"https://docs.commercelayer.io/core/",core_api_reference:"https://docs.commercelayer.io/developers/v/api-reference",core_how_tos:"https://docs.commercelayer.io/core/v/how-tos/",core_raste_limits:"https://docs.commercelayer.io/core/rate-limits",core_filtering_data:"https://docs.commercelayer.io/core/filtering-data#list-of-predicates",metrics:"https://docs.commercelayer.io/metrics/",metrics_api_reference:"https://docs.commercelayer.io/metrics/v/api-reference-m/",provisioning:"https://docs.commercelayer.io/provisioning/",provisioning_api_reference:"https://docs.commercelayer.io/provisioning/v/api-reference-p/",imports_resources:"https://docs.commercelayer.io/api/importing-resources#supported-resources",exports_resources:"https://docs.commercelayer.io/core/exporting-resources#supported-resources",cleanups_resources:"https://docs.commercelayer.io/core/cleaning-resources#supported-resources",webhooks_events:"https://docs.commercelayer.io/api/real-time-webhooks#supported-events",tags_resources:"https://docs.commercelayer.io/core/v/api-reference/tags#taggable-resources"},tags:{max_resource_tags:10,taggable_resources:we,tag_name_max_length:25,tag_name_pattern:/^[0-9A-Za-z_-]{1,25}$/},provisioning:{default_subdomain:"provisioning",scope:"provisioning-api",applications:["user"]}},u=ke;import{readFileSync as Ae}from"fs";var L=async(e,t,r)=>await(await fetch(new URL(`/api/${e.resource}`+(r?`/${r}`:""),e.baseUrl),{method:e.operation,headers:{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json",Authorization:`Bearer ${e.accessToken}`},body:JSON.stringify(t)}).then(i=>{if(i.ok)return i;throw new Error(i.statusText)})).json(),K=e=>{let t,r;try{t=Ae(e,"utf-8")}catch{throw new Error(`Unable to find or open the data file ${A.msg.error(e)}`)}try{r=JSON.parse(t)}catch{throw new Error(`Unable to parse the data file ${A.msg.error(e)}: invalid JSON format`)}return r.data?r:{data:r}},P=(r=>(r.Create="POST",r.Update="PATCH",r))(P||{});var N=(e,t)=>t.find(r=>e.id===r.id&&e.type===r.type),z=(e,t)=>{let r={id:e.id,type:e.type,...e.attributes};return e.relationships&&Object.keys(e.relationships).forEach(s=>{let i=e.relationships[s].data;i?Array.isArray(i)?r[s]=i.map(n=>z(N(n,t),t)):r[s]=z(N(i,t),t):i===null&&(r[s]=null)}),r},U=e=>{let t;e.links&&delete e.links;let r=e.data,s=e.included;return Array.isArray(r)?t=r.map(i=>z(i,s)):t=z(r,s),t};var $e=(e="core",t,r)=>`https://${(e==="core"&&t||e).toLowerCase()}.${r||u.api.default_domain}`,Ce=e=>{if(e)return e.substring(e.indexOf(".")+1)},qe=e=>e===!0||e==="live"?"live":"test",Re=e=>e.replace(/_/g," ");var Se=["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"],G=(e,t)=>Se.includes(e||"")&&(t||"GET").toUpperCase()==="GET",ze=e=>e==="live",J=e=>{let t=e?.environment||"test",r=e?.parallelRequests||1,s=G(e?.resourceType,e?.method),i=s?u.api.requests_max_num_burst_cacheable:u.api.requests_max_num_burst,n=s?u.api.requests_max_num_avg_cacheable:u.api.requests_max_num_avg;t!=="live"&&(i=s?u.api.requests_max_num_burst_test_cacheable:u.api.requests_max_num_burst_test,n=s?u.api.requests_max_num_avg_test_cacheable:u.api.requests_max_num_avg_test);let a=u.api.requests_max_secs_burst/i,m=u.api.requests_max_secs_avg/n,b=r*a,T=r*m,f=e?.totalRequests,c=0;return f?f>i&&(f>n?c=T:c=b):c=Math.max(b,T),c=c*1e3,e?.minimumDelay&&(c=Math.max(e.minimumDelay,c)),e?.securityDelay&&(c+=e.securityDelay),c=Math.ceil(c),c};var Ee={raw:L,readDataFile:K,rateLimitDelay:J},Ie={denormalize:U};var Z={};_(Z,{appKey:()=>Be,appKeyMatch:()=>De,appKeyValid:()=>Me,arrayScope:()=>X,isProvisioningApp:()=>Oe});var Be=()=>Date.now().toString(36),Me=e=>e.key!==void 0&&e.key!=="",De=(e,t)=>{let r=e!==void 0,s=t!==void 0;return!r&&!s||r&&s&&e.key===t.key},X=e=>{if(!e)return[];if(Array.isArray(e))return e;let t=e.replace(/[ ,;]/g,"_").split("_");return Array.isArray(t)?t:[t]},Oe=e=>X(e.scope).includes(u.provisioning.scope)||e.api==="provisioning";var Q={};_(Q,{allFlags:()=>Ke,commandFlags:()=>Le,findLongStringFlag:()=>Ue,fixDashedFlagValue:()=>je,fixValueType:()=>Pe});var Le=(e,t)=>{let r={...e};if(t)for(let s of t)delete r[s];return r},Ke=e=>({...e.flags,...e.baseFlags});var Pe=e=>{let t=e;return t==="null"?t=null:Number(t)==t?t=Number(t):t=t==="true"?!0:t==="false"?!1:t,t},Ue=(e,t)=>{let r=t.startsWith("--")?t:`--${t}`,s,i=e.findIndex(a=>a.startsWith(r)),n=!1;if(i>-1){let a=e[i];if(a.includes("=")){let m=a.split("=");s=m.length===2?m[1]:"",n=!0}else s=e[i+1];return{value:s,index:i,single:n}}else return},je=(e,t,r,s)=>{let i="____",n=t.name||r,a=t.char;if(!n&&!a)return e;let m=n?n.startsWith("--")?n:`--${n}`:void 0,b=a?t.char.startsWith("-")?a:`-${a}`:void 0,T=e.findIndex(k=>b&&k.startsWith(b)||m&&k.startsWith(m));if(T<0)return e;let f=e[T],c="",H="";if(b&&f.startsWith(b))c=f.replace(b,"").trim(),f=b;else if(m&&f.startsWith(m))c=f.replace(m,"").trim(),f=m;else return e;if(c.startsWith("=")?(c=c.slice(1),H=f+"="):c||(c=e[++T]),c.startsWith("-")||c.startsWith(i)){let k=c.startsWith(`${i}`)?c.replace(`${i}`,""):c.replace("-",`${i}-`);if(e[T]=H+k,c.startsWith(i)&&s){let S=n?n.replace("--",""):void 0,B=Object.entries(s.flags).find(([D,be])=>be===c);B&&(!S||S===B[0])&&(s.flags[B[0]]=k);let M=Object.values(s.raw).find(D=>D.type==="flag"&&D.input===c);M&&(!S||S===M.flag)&&(M.input=k)}}return e};var ie={};_(ie,{center:()=>Fe,cleanDate:()=>He,formatError:()=>Ge,formatOutput:()=>se,localeDate:()=>Ne,maxLength:()=>Ve,printCSV:()=>re,printJSON:()=>te,printObject:()=>ee});import{inspect as We}from"util";var ee=(e,t)=>We(e,{showHidden:!1,depth:null,colors:t?.color===void 0?!0:t.color,sorted:t?.sort===void 0?!1:t?.sort,maxArrayLength:1/0,breakLength:t?.width||120}),te=(e,t)=>JSON.stringify(e,null,t?.unformatted?void 0:t?.tabSize||4),re=(e,t)=>{if(!e||e.length===0)return"";let r=Object.keys(e[0]).filter(i=>["id","type"].includes(i)?t?.fields.includes(i):!0),s=r.map(i=>i.toUpperCase().replace(/_/g," ")).join(";")+`
2
+ `;return e.forEach(i=>{s+=r.map(n=>i[n]).join(";")+`
3
+ `}),s},Fe=(e,t)=>e.padStart(e.length+Math.floor((t-e.length)/2)," ").padEnd(t," "),Ve=(e,t)=>e.reduce((r,s)=>{let i=Array.isArray(s[t])?s[t].join():s[t];return Math.max(r,String(i).length)},0),He=e=>e.replace("T"," ").replace("Z","").substring(0,e.lastIndexOf(".")),Ne=e=>e?new Date(Date.parse(e)).toLocaleString():"",se=(e,t,{color:r=!0}={})=>{if(!e)return"";if(typeof e=="string")return e;if(t){if(t.csv)return re(e,t);if(t.json)return te(e,{unformatted:t.unformatted})}return ee(e,{color:r})},Ge=(e,t)=>se(e.errors||e,t);var A={};_(A,{api:()=>gt,bg:()=>mt,black:()=>it,blackBright:()=>nt,blue:()=>tt,blueBright:()=>C,bold:()=>W,cli:()=>ft,cyan:()=>at,cyanBright:()=>$,dim:()=>pt,green:()=>Qe,greenBright:()=>j,grey:()=>ot,hidden:()=>Xe,italic:()=>w,magenta:()=>ct,magentaBright:()=>lt,msg:()=>_t,red:()=>Ze,redBright:()=>ne,reset:()=>Je,style:()=>l,table:()=>ht,type:()=>dt,underline:()=>ut,visible:()=>Ye,white:()=>rt,whiteBright:()=>st,yellow:()=>et,yellowBright:()=>v});import o from"chalk";var Je=o.reset,Ye=o.visible,Xe=o.hidden,Ze=o.red,ne=o.redBright,Qe=o.green,j=o.greenBright,et=o.yellow,v=o.yellowBright,tt=o.blue,C=o.blueBright,rt=o.white,st=o.whiteBright,it=o.black,nt=o.blackBright,ot=o.grey,at=o.cyan,$=o.cyanBright,ct=o.magenta,lt=o.magentaBright,W=o.bold,pt=o.dim,ut=o.underline,w=o.italic,mt={white:o.bgWhite,whiteBright:o.bgWhiteBright,black:o.bgBlack,blackBright:o.bgBlackBright,grey:o.bgGrey,red:o.bgRed,redBright:o.bgRedBright,green:o.bgGreen,greenBright:o.bgGreenBright,yellow:o.bgYellow,yellowBright:o.bgYellowBright,blue:o.bgBlue,blueBright:o.bgBlueBright,magenta:o.bgMagenta,magentaBright:o.bgMagentaBright,cyan:o.bgCyan,cyanBright:o.bgCyanBright},l={organization:v.bold,application:v.bold,slug:v,id:W,token:C,resource:W,attribute:w,trigger:$,kind:$,live:j,test:v,execMode:e=>e==="live"?l.live:l.test,success:j,warning:v,error:ne,arg:w,flag:w,command:w,value:w,alias:$,plugin:C,title:C,path:w,datetime:$,number:v},dt={datetime:l.datetime,number:l.number,path:l.path},gt={organization:l.organization,application:l.application,slug:l.slug,id:l.id,token:l.token,resource:l.resource,attribute:l.attribute,trigger:l.trigger,kind:l.kind,live:l.live,test:l.test},_t={success:l.success,warning:l.warning,error:l.error},ft={arg:l.arg,flag:l.flag,command:l.command,value:l.value,alias:l.alias,plugin:l.plugin},ht={header:v.bold,key:C};var ce={};_(ce,{decodeAccessToken:()=>ae,generateAccessToken:()=>yt,getAccessToken:()=>xt,getTokenEnvironment:()=>wt,isAccessTokenExpiring:()=>Tt,revokeAccessToken:()=>vt});import F from"jsonwebtoken";import{authenticate as oe,revoke as bt}from"@commercelayer/js-auth";var ae=e=>{let t=F.decode(e);if(t===null)throw new Error("Error decoding access token");return t},yt=(e,t,r)=>{let i={...e,exp:Math.floor(Date.now()/1e3)+r*60,rand:Math.random()},n=u.api.token_encoding_algorithm,a=F.sign(i,t,{algorithm:n,noTimestamp:!0}),m=F.verify(a,t,{algorithms:[n]});return{accessToken:a,info:m,expMinutes:r}},xt=async e=>{let t,r=e.scope?Array.isArray(e.scope)?e.scope.map(i=>i.trim()).join(","):e.scope:"",s={clientId:e.clientId,clientSecret:e.clientSecret,slug:e.slug,domain:e.domain,scope:r};if(e.email&&e.password?(s.username=e.email,s.password=e.password,t=await oe("password",s)):t=await oe("client_credentials",s),t){if(t.errors)throw new Error(`Unable to get access token: ${t.errors[0].detail}`)}else throw new Error("Unable to get access token");return t},vt=async(e,t)=>{let r=await bt({...e,token:t});if(r.errors)throw new Error(r.errors[0].detail)},Tt=e=>{let r=Math.floor(Date.now()/1e3),s=Math.floor(new Date(e.expires).getTime()/1e3);return r>=s-30},wt=e=>(typeof e=="string"?ae(e):e).test?"test":"live";var le={};_(le,{checkUpdate:()=>$t});import E from"chalk";import kt from"update-notifier-cjs";var At=1,$t=e=>{let t=kt({pkg:e,updateCheckInterval:36e5*At});t.update&&t.notify({isGlobal:!1,message:`-= ${E.bgWhite.black.bold(` ${e.description} `)} =-
4
+
5
+ New version available: ${E.dim("{currentVersion}")} -> ${E.green("{latestVersion}")}
6
+ Run ${E.cyanBright("commercelayer plugins:update")} to update`})};var pe={};_(pe,{generateGroupUID:()=>Lt,log:()=>Dt,resetConsole:()=>Mt,sleep:()=>Bt,specialFolder:()=>Ot,userAgent:()=>Kt});import{format as Ct,inspect as qt}from"util";import{sep as Rt,dirname as St}from"path";import{homedir as zt}from"os";import{existsSync as Et,mkdirSync as It}from"fs";var Bt=async e=>new Promise(t=>setTimeout(t,e)),Mt=()=>{process.stdout.write("\x1B[?25h\x1B[?7h")},Dt=(e="",...t)=>{e=typeof e=="string"?e:qt(e),process.stdout.write(Ct(e,...t)+`
7
+ `)},Ot=(e,t=!1)=>{let r=["desktop","home"],s=e.toLowerCase().split(/[\\\/]/g)[0];if(r.includes(s)){let n=zt();s==="desktop"&&(n+=`${Rt}Desktop`),e=e.replace(s,n)}let i=St(e);return t&&!Et(i)&&It(i,{recursive:!0}),e},Lt=()=>{let e=Math.trunc(Math.random()*46656),t=Math.trunc(Math.random()*46656),r=("000"+e.toString(36)).slice(-3),s=("000"+t.toString(36)).slice(-3);return r+s},Kt=e=>`${e.name.replace(/@commercelayer\/cli-plugin/,"CLI")}/${e.version}`;import{CommandHelp as Ft,Help as Vt}from"@oclif/core";var me={};_(me,{camelize:()=>Wt,capitalize:()=>R,dasherize:()=>Pt,pluralize:()=>Ut,singularize:()=>jt,symbols:()=>x});var p={uncountableWords:["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"],pluralRules:[[/(m)an$/gi,"$1en"],[/(pe)rson$/gi,"$1ople"],[/(child)$/gi,"$1ren"],[/^(ox)$/gi,"$1en"],[/(ax|test)is$/gi,"$1es"],[/(octop|vir)us$/gi,"$1i"],[/(alias|status)$/gi,"$1es"],[/(bu)s$/gi,"$1ses"],[/(buffal|tomat|potat)o$/gi,"$1oes"],[/([ti])um$/gi,"$1a"],[/sis$/gi,"ses"],[/(?:([^f])fe|([lr])f)$/gi,"$1$2ves"],[/(hive)$/gi,"$1s"],[/([^aeiouy]|qu)y$/gi,"$1ies"],[/(x|ch|ss|sh)$/gi,"$1es"],[/(matr|vert|ind)ix|ex$/gi,"$1ices"],[/([m|l])ouse$/gi,"$1ice"],[/(quiz)$/gi,"$1zes"],[/s$/gi,"s"],[/$/gi,"s"]],singularRules:[[/(m)en$/gi,"$1an"],[/(pe)ople$/gi,"$1rson"],[/(child)ren$/gi,"$1"],[/([ti])a$/gi,"$1um"],[/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/gi,"$1$2sis"],[/(hive)s$/gi,"$1"],[/(tive)s$/gi,"$1"],[/(curve)s$/gi,"$1"],[/([lr])ves$/gi,"$1f"],[/([^fo])ves$/gi,"$1fe"],[/([^aeiouy]|qu)ies$/gi,"$1y"],[/(s)eries$/gi,"$1eries"],[/(m)ovies$/gi,"$1ovie"],[/(x|ch|ss|sh)es$/gi,"$1"],[/([m|l])ice$/gi,"$1ouse"],[/(bus)es$/gi,"$1"],[/(o)es$/gi,"$1"],[/(shoe)s$/gi,"$1"],[/(cris|ax|test)es$/gi,"$1is"],[/(octop|vir)i$/gi,"$1us"],[/(alias|status)es$/gi,"$1"],[/^(ox)en/gi,"$1"],[/(vert|ind)ices$/gi,"$1ex"],[/(matr)ices$/gi,"$1ix"],[/(quiz)zes$/gi,"$1"],[/s$/gi,""]],nonTitlecasedWords:["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"],idSuffix:/(_ids|_id)$/g,underbar:/_/g,spaceOrUnderbar:/[ _]/g,uppercase:/([A-Z])/g,underbarPrefix:/^_/,applyRules:function(e,t,r,s){if(s)e=s;else if(!r.includes(e.toLowerCase())){for(let n=0;n<t.length;n++)if(e.match(t[n][0])){e=e.replace(t[n][0],t[n][1]);break}}return e},pluralize:function(e,t){return p.applyRules(e,p.pluralRules,p.uncountableWords,t)},singularize:function(e,t){return p.applyRules(e,p.singularRules,p.uncountableWords,t)},camelize:function(e,t){let r=e.split("/");for(let s=0;s<r.length;s++){let i=r[s].split("_"),n=t&&s+1===r.length?1:0;for(let a=n;a<i.length;a++)i[a]=i[a].charAt(0).toUpperCase()+i[a].substring(1);r[s]=i.join("")}if(e=r.join("::"),t){let s=e.charAt(0).toLowerCase(),i=e.slice(1);e=s+i}return e},underscore:function(e){let t=e.split("::");for(let r=0;r<t.length;r++)t[r]=t[r].replace(p.uppercase,"_$1"),t[r]=t[r].replace(p.underbarPrefix,"");return e=t.join("/").toLowerCase(),e},humanize:function(e,t){return e=e.toLowerCase(),e=e.replace(p.idSuffix,""),e=e.replace(p.underbar," "),t||(e=p.capitalize(e)),e},capitalize:function(e){return e=e.toLowerCase(),e=e.substring(0,1).toUpperCase()+e.substring(1),e},dasherize:function(e){return e=e.replace(p.spaceOrUnderbar,"-"),e},camel2words:function(e,t){t?(e=p.camelize(e),e=p.underscore(e)):e=e.toLowerCase(),e=e.replace(p.underbar," ");let r=e.split(" ");for(let s=0;s<r.length;s++){let i=r[s].split("-");for(let n=0;n<i.length;n++)p.nonTitlecasedWords.includes(i[n].toLowerCase())||(i[n]=p.capitalize(i[n]));r[s]=i.join("-")}return e=r.join(" "),e=e.substring(0,1).toUpperCase()+e.substring(1),e},demodulize:function(e){let t=e.split("::");return e=t[t.length-1],e},tableize:function(e){return e=p.pluralize(p.underscore(e)),e},classify:function(e){return e=p.singularize(p.camelize(e)),e},foreignKey:function(e,t){return e=p.underscore(p.demodulize(e))+(t?"":"_")+"id",e},ordinalize:function(e){let t=e.split(" ");for(let r=0;r<t.length;r++){let s=parseInt(t[r]);if(Number.isNaN(s)){let i=t[r].substring(t[r].length-2),n=t[r].substring(t[r].length-1),a="th";i!=="11"&&i!=="12"&&i!=="13"&&(n==="1"?a="st":n==="2"?a="nd":n==="3"&&(a="rd")),t[r]+=a}}return e=t.join(" "),e}},q=p;var ue={};_(ue,{symbols:()=>x});var x={check:{small:"\u2714",bkgGreen:"\u2705",squareRoot:"\u221A"},cross:{small:"\u2718",red:"\u274C"},clock:{stopwatch:"\u23F1"},arrow:{down:"\u2193"},selection:{fisheye:"\u25C9"}};x.check.heavy=x.check.small;x.check.whiteHeavy=x.check.bkgGreen;x.cross.heavyBallot=x.cross.small;var R=e=>e&&q.capitalize(e),Pt=e=>e&&(e=e.toLocaleLowerCase(),e.replace(/ _/g,"-")),Ut=(e,t)=>q.pluralize(e,t),jt=(e,t)=>q.singularize(e,t),Wt=(e,t)=>q.camelize(e,t);var h=!1,V=class extends Ft{examples(t){return h&&console.log("---------- command.examples"),super.examples(t)}},I=class extends Vt{async showHelp(t){return h&&console.log("---------- showHelp"),super.showHelp(t)}async showRootHelp(){return h&&console.log("---------- showRootHelp"),super.showRootHelp()}async showTopicHelp(t){return h&&console.log("---------- showTopicHelp"),super.showTopicHelp(t)}async showCommandHelp(t){h&&console.log("---------- showCommandHelp");let r=t.id,s=r?r.split(":").length:1,i=this.sortedTopics.filter(m=>m.name.startsWith(r+":")&&m.name.split(":").length===s+1),n=this.sortedCommands.filter(m=>m.id.startsWith(r+":")&&m.id.split(":").length===s+1),a=t.description&&this.render(t.description).split(`
8
+ `)[0];a&&console.log(`${R(a)}
9
+ `),console.log(this.formatCommand(t)),console.log(""),i.length>0&&(console.log(this.formatTopics(i)),console.log("")),n.length>0&&(console.log(this.formatCommands(n)),console.log(""))}formatRoot(){return h&&console.log("---------- formatRoot"),super.formatRoot()}formatTopic(t){return h&&console.log("---------- formatTopic"),super.formatTopic(t)}formatTopics(t){h&&console.log("---------- formatTopics");let r=t.filter(s=>!s.hidden).map(s=>(s.description=R(s.description),s));return super.formatTopics(r)}formatCommands(t){return h&&console.log("---------- formatCommands"),super.formatCommands(t).split(`
10
+ `).map(r=>{let s=0;return r.split(" ").map(i=>(i||"").trim()!==""&&++s===2?R(i):i).join(" ")}).join(`
11
+ `)}formatCommand(t){return h&&console.log("---------- formatCommand"),super.formatCommand(t)}getCommandHelpClass(t){return h&&console.log("---------- getCommandHelpClass"),new V(t,this.config,this.opts)}};var de={};_(de,{download:()=>Ht});var Ht=async e=>{let r=`https://data.${u.api.default_app_domain}/schemas/`,i=`openapi${e?"_"+e.replace(/\./g,"-"):""}.json`,n=r+i;return await(await fetch(n)).json()};var he={};_(he,{apply:()=>Jt,available:()=>_e,documentation:()=>Gt,filters:()=>fe,list:()=>ge});var Nt=[{predicate:"*_eq",description:"The attribute is equal to the filter value"},{predicate:"*_not_eq",description:"The attribute is not equal to the filter value"},{predicate:"*_matches",description:'The attribute matches the filter value with "LIKE" operator'},{predicate:"*_does_not_match",description:'The attribute does not match the filter value with "LIKE" operator'},{predicate:"*_matches_any",description:'The attribute matches all of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_matches_all",description:'The attribute matches all of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_does_not_match_any",description:'The attribute does not match any of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_does_not_match_all",description:'The attribute matches none of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_lt",description:"The attribute is less than the filter value"},{predicate:"*_lteq",description:"The attribute is less than or equal to the filter value"},{predicate:"*_gt",description:"The attribute is greater than the filter value"},{predicate:"*_gteq",description:"The attribute is greater than or equal to the filter value"},{predicate:"*_present",description:"The attribute is not null and not empty"},{predicate:"*_blank",description:"The attribute is null or empty"},{predicate:"*_null",description:"The attribute is null"},{predicate:"*_not_null",description:"The attribute is not null"},{predicate:"*_in",description:"The attribute matches any of the filter values (comma-separated)"},{predicate:"*_not_in",description:"The attribute matches none of the filter values (comma-separated)"},{predicate:"*_lt_any",description:"The attribute is less than any of the filter values (comma-separated)"},{predicate:"*_lteq_any",description:"The attribute is less than or equal to any of the filter values (comma-separated)"},{predicate:"*_gt_any",description:"The attribute is greater than any of the filter values (comma-separated)"},{predicate:"*_gteq_any",description:"The attribute is greater than or qual to any of the filter values (comma-separated)"},{predicate:"*_lt_all",description:"The attribute is less than all of the filter values (comma-separated)"},{predicate:"*_lteq_all",description:"The attribute is less than or equal to all of the filter values (comma-separated)"},{predicate:"*_gt_all",description:"The attribute is greater than all of the filter values (comma-separated)"},{predicate:"*_gteq_all",description:"The attribute is greater or equal to all of the filter values (comma-separated)"},{predicate:"*_not_eq_all",description:"The attribute is equal to none of the filter values (comma-separated)"},{predicate:"*_start",description:"The attribute starts with the filter value (comma-separated)"},{predicate:"*_not_start",description:"The attribute does not start with the filter value (comma-separated)"},{predicate:"*_start_any",description:"The attribute starts with any of the filter values (comma-separated)"},{predicate:"*_start_all",description:"The attribute starts with all of the filter values (comma-separated)"},{predicate:"*_not_start_any",description:"The attribute does not start with any of the filter values (comma-separated)"},{predicate:"*_not_start_all",description:"The attribute starts with none of the filter values (comma-separated)"},{predicate:"*_end",description:"The attribute ends with the filter value"},{predicate:"*_not_end",description:"The attribute does not end with the filter value"},{predicate:"*_end_any",description:"The attribute ends with any of the filter values (comma-separated)"},{predicate:"*_end_all",description:"The attribute ends with all of the filter values (comma-separated)"},{predicate:"*_not_end_any",description:"The attribute does not end with any of the filter values (comma-separated)"},{predicate:"*_not_end_all",description:"The attribute ends with none of the filter values (comma-separated)"},{predicate:"*_cont",description:"The attribute contains the filter value"},{predicate:"*_not_cont",description:"The attribute does not contains the filter value"},{predicate:"*_cont_any",description:"The attribute contains any of the filter values (comma-separated)"},{predicate:"*_cont_all",description:"The attribute contains all of the filter values (comma-separated)"},{predicate:"*_not_cont_all",description:"The attribute contains none of the filter values (comma-separated)"},{predicate:"*_jcont",description:"The attribute contains a portion of the JSON used as filter value (works with object only)"},{predicate:"*_true",description:"The attribute is true"},{predicate:"*_false",description:"The attribute is false"}],Gt=u.doc.core_filtering_data,ge=()=>fe().map(e=>e.predicate.replace(/^\*/g,"")),_e=e=>{let t=e.startsWith("_")?e:`_${e}`;return ge().some(r=>t.endsWith(r))},Jt=(e,...t)=>{if(!_e(e))throw new Error("Unknown filter: "+e);let r="";for(let s of t)r+=(r.length===0?"":"_or_")+s;return r+=e.startsWith("_")?e:`_${e}`,r},fe=()=>[...Nt];export{Y as clApi,Z as clApplication,A as clColor,Q as clCommand,u as clConfig,he as clFilter,I as clHelp,ie as clOutput,de as clSchema,ue as clSymbol,me as clText,ce as clToken,le as clUpdate,pe as clUtil};
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
1
  {
2
2
  "name": "@commercelayer/cli-core",
3
- "version": "4.12.0",
4
- "main": "lib/cjs/index.js",
5
- "types": "lib/cjs/index.d.ts",
6
- "module": "lib/esm/index.js",
3
+ "version": "5.0.0-beta.1",
4
+ "author": "Pierluigi Viti <pierluigi@commercelayer.io>",
5
+ "license": "MIT",
6
+ "description": "Commerce Layer Javascript CLI core lib",
7
+ "main": "lib/index.js",
8
+ "types": "lib/index.d.ts",
9
+ "module": "lib/index.mjs",
10
+ "exports": {
11
+ "types": "./lib/index.d.ts",
12
+ "require": "./lib/index.js",
13
+ "import": "./lib/index.mjs"
14
+ },
7
15
  "scripts": {
8
16
  "lint": "eslint ./src --ext .ts",
9
17
  "lintspec": "eslint ./specs/ --ext .spec.ts",
10
18
  "lint:fix": "eslint src --fix",
11
- "build": "rm -rf lib && tsc -b tsconfig.json tsconfig.esm.json --verbose",
12
- "start": "ts-node src/index.ts",
13
- "prepare": "npm run build",
19
+ "build": "tsup",
20
+ "start": "tsx src/index.ts",
14
21
  "test": "jest --passWithNoTests",
15
- "test-local": "ts-node test/spot.ts",
16
- "coverage": "jest --coverage",
17
- "size": "size-limit",
18
- "analyze": "size-limit --why",
19
- "postbuild": "minimize-js lib"
22
+ "test-local": "tsx test/spot.ts",
23
+ "coverage": "jest --coverage"
20
24
  },
21
25
  "keywords": [
22
26
  "ecommerce",
23
27
  "jamstack",
24
28
  "commercelayer"
25
29
  ],
26
- "author": "Pierluigi Viti <pierluigi@commercelayer.io>",
27
- "license": "MIT",
28
- "description": "Commerce Layer Javascript CLI core lib",
29
30
  "files": [
30
31
  "lib/**/*"
31
32
  ],
32
33
  "engines": {
33
- "node": "^16.13.0 || >=18.0.0"
34
+ "node": ">=20"
34
35
  },
35
36
  "devDependencies": {
36
- "@babel/preset-env": "^7.23.9",
37
- "@babel/preset-typescript": "^7.23.3",
38
- "@commercelayer/eslint-config-ts": "^1.3.0",
37
+ "@babel/preset-env": "^7.24.4",
38
+ "@babel/preset-typescript": "^7.24.1",
39
+ "@commercelayer/eslint-config-ts": "^1.4.5",
39
40
  "@semantic-release/changelog": "^6.0.3",
40
41
  "@semantic-release/git": "^10.0.1",
41
42
  "@size-limit/preset-small-lib": "^6.0.4",
42
- "@types/jest": "^29.5.11",
43
- "@types/jsonwebtoken": "^9.0.5",
44
- "@types/node": "^20.11.13",
45
- "@typescript-eslint/eslint-plugin": "^6.20.0",
46
- "dotenv": "^16.4.1",
47
- "eslint": "^8.56.0",
43
+ "@types/jest": "^29.5.12",
44
+ "@types/jsonwebtoken": "^9.0.6",
45
+ "@types/node": "^20.12.7",
46
+ "@typescript-eslint/eslint-plugin": "^7.6.0",
47
+ "dotenv": "^16.4.5",
48
+ "eslint": "^8.57.0",
48
49
  "jest": "^29.7.0",
49
- "minimize-js": "^1.4.0",
50
- "oclif": "^4.4.2",
51
- "semantic-release": "^22.0.12",
52
- "ts-node": "^10.9.2",
53
- "typescript": "^5.3.3"
50
+ "oclif": "^4.8.5",
51
+ "semantic-release": "^23.0.8",
52
+ "tsup": "^8.0.2",
53
+ "tsx": "^4.7.2",
54
+ "typescript": "^5.4.5"
54
55
  },
55
56
  "dependencies": {
56
- "@commercelayer/js-auth": "^4.2.0",
57
- "@oclif/core": "^2.15.0",
58
- "axios": "1.6.5",
57
+ "@commercelayer/js-auth": "^6.0.0",
58
+ "@oclif/core": "^3.26.3",
59
59
  "chalk": "^4.1.2",
60
60
  "jsonwebtoken": "^9.0.2",
61
61
  "update-notifier-cjs": "^5.1.6"
@@ -63,12 +63,5 @@
63
63
  "repository": "github:commercelayer/commercelayer-cli-core",
64
64
  "publishConfig": {
65
65
  "access": "public"
66
- },
67
- "size-limit": [
68
- {
69
- "path": "lib",
70
- "limit": "350 kB",
71
- "webpack": false
72
- }
73
- ]
66
+ }
74
67
  }
package/lib/cjs/api.d.ts DELETED
@@ -1,41 +0,0 @@
1
- import type { Method } from 'axios';
2
- import { rawRequest, readDataFile, Operation } from './raw';
3
- import { denormalize } from './jsonapi';
4
- type ApiMode = 'test' | 'live';
5
- type ApiType = 'core' | 'provisioning' | 'metrics';
6
- export type { ApiMode, ApiType };
7
- /** Build base URL */
8
- declare const baseURL: (slug?: string, domain?: string, provisioning?: boolean) => string;
9
- /** Extract domain name from URL */
10
- declare const extractDomain: (baseUrl: string) => string | undefined;
11
- /** Decode API execution mode */
12
- declare const execMode: (liveFlag: string | boolean | undefined) => ApiMode;
13
- declare const humanizeResource: (type: string) => string;
14
- export { baseURL, extractDomain, execMode, humanizeResource };
15
- export declare const isResourceCacheable: (resource?: string, method?: Method) => boolean;
16
- export type DelayOptions = {
17
- environment?: ApiMode;
18
- parallelRequests?: number;
19
- totalRequests?: number;
20
- minimumDelay?: number;
21
- securityDelay?: number;
22
- resourceType?: string;
23
- method?: Method;
24
- };
25
- export declare const liveEnvironment: (env: ApiMode) => boolean;
26
- export declare const requestRateLimitDelay: (options?: DelayOptions) => number;
27
- export { rawRequest as requestRaw, readDataFile as requestDataFile, Operation };
28
- export { denormalize as responseDenormalize };
29
- export declare const request: {
30
- raw: (config: {
31
- baseUrl: string;
32
- resource: string;
33
- accessToken: string;
34
- operation: Operation;
35
- }, data: any, id?: string | undefined) => Promise<any>;
36
- readDataFile: (file: string) => any;
37
- rateLimitDelay: (options?: DelayOptions) => number;
38
- };
39
- export declare const response: {
40
- denormalize: (response: any) => any;
41
- };
package/lib/cjs/api.js DELETED
@@ -1 +0,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.response=exports.request=exports.responseDenormalize=exports.Operation=exports.requestDataFile=exports.requestRaw=exports.requestRateLimitDelay=exports.liveEnvironment=exports.isResourceCacheable=exports.humanizeResource=exports.execMode=exports.extractDomain=exports.baseURL=void 0;const config_1=__importDefault(require("./config")),raw_1=require("./raw");Object.defineProperty(exports,"requestRaw",{enumerable:!0,get:function(){return raw_1.rawRequest}}),Object.defineProperty(exports,"requestDataFile",{enumerable:!0,get:function(){return raw_1.readDataFile}}),Object.defineProperty(exports,"Operation",{enumerable:!0,get:function(){return raw_1.Operation}});const jsonapi_1=require("./jsonapi");Object.defineProperty(exports,"responseDenormalize",{enumerable:!0,get:function(){return jsonapi_1.denormalize}});const baseURL=(e,r,a)=>`https://${(a?"provisioning":e||"").toLowerCase()}.${r||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,r)=>CACHEABLE_RESOURCES.includes(e||"")&&(r||"get").toLowerCase()==="get";exports.isResourceCacheable=isResourceCacheable;const liveEnvironment=e=>e==="live";exports.liveEnvironment=liveEnvironment;const requestRateLimitDelay=e=>{const r=e?.environment||"test",a=e?.parallelRequests||1,s=(0,exports.isResourceCacheable)(e?.resourceType,e?.method);let u=s?config_1.default.api.requests_max_num_burst_cacheable:config_1.default.api.requests_max_num_burst,i=s?config_1.default.api.requests_max_num_avg_cacheable:config_1.default.api.requests_max_num_avg;r!=="live"&&(u=s?config_1.default.api.requests_max_num_burst_test_cacheable:config_1.default.api.requests_max_num_burst_test,i=s?config_1.default.api.requests_max_num_avg_test_cacheable:config_1.default.api.requests_max_num_avg_test);const c=config_1.default.api.requests_max_secs_burst/u,_=config_1.default.api.requests_max_secs_avg/i,o=a*c,l=a*_,n=e?.totalRequests;let t=0;return n?n>u&&(n>i?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,exports.request={raw:raw_1.rawRequest,readDataFile:raw_1.readDataFile,rateLimitDelay:exports.requestRateLimitDelay},exports.response={denormalize:jsonapi_1.denormalize};
@@ -1,34 +0,0 @@
1
- import type { ApiMode, ApiType } from "./api";
2
- import type { AuthScope } from "./token";
3
- interface AppKey {
4
- key: string;
5
- mode: ApiMode;
6
- id?: string;
7
- alias?: string;
8
- }
9
- interface AppAuth {
10
- slug?: string;
11
- domain?: string;
12
- clientId: string;
13
- clientSecret?: string;
14
- scope?: AuthScope;
15
- email?: string;
16
- password?: string;
17
- api?: ApiType;
18
- }
19
- interface AppInfo extends AppKey, AppAuth {
20
- organization?: string;
21
- kind: string;
22
- name: string;
23
- baseUrl?: string;
24
- }
25
- export type { AppKey, AppAuth, AppInfo };
26
- /** Build application key */
27
- declare const appKey: () => string;
28
- /** Check application key */
29
- declare const appKeyValid: (appKey: AppKey) => boolean;
30
- /** Check if two application keys are equal */
31
- declare const appKeyMatch: (app1?: AppKey, app2?: AppKey) => boolean;
32
- declare const arrayScope: (scope?: AuthScope) => string[];
33
- declare const isProvisioningApp: (app: AppAuth) => boolean;
34
- export { appKey, appKeyValid, appKeyMatch, arrayScope, isProvisioningApp };
@@ -1 +0,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.isProvisioningApp=exports.arrayScope=exports.appKeyMatch=exports.appKeyValid=exports.appKey=void 0;const config_1=__importDefault(require("./config")),appKey=()=>Date.now().toString(36);exports.appKey=appKey;const appKeyValid=e=>e.key!==void 0&&e.key!=="";exports.appKeyValid=appKeyValid;const appKeyMatch=(e,r)=>{const t=e!==void 0,o=r!==void 0;return!t&&!o||t&&o&&e.key===r.key};exports.appKeyMatch=appKeyMatch;const arrayScope=e=>e?Array.isArray(e)?e:[e]:[];exports.arrayScope=arrayScope;const isProvisioningApp=e=>arrayScope(e.scope).includes(config_1.default.provisioning.scope)||e.api==="provisioning";exports.isProvisioningApp=isProvisioningApp;
@@ -1,107 +0,0 @@
1
- import chalk from 'chalk';
2
- import type { ApiMode } from './api';
3
- export declare const reset: chalk.Chalk;
4
- export declare const visible: chalk.Chalk;
5
- export declare const hidden: chalk.Chalk;
6
- export declare const red: chalk.Chalk;
7
- export declare const redBright: chalk.Chalk;
8
- export declare const green: chalk.Chalk;
9
- export declare const greenBright: chalk.Chalk;
10
- export declare const yellow: chalk.Chalk;
11
- export declare const yellowBright: chalk.Chalk;
12
- export declare const blue: chalk.Chalk;
13
- export declare const blueBright: chalk.Chalk;
14
- export declare const white: chalk.Chalk;
15
- export declare const whiteBright: chalk.Chalk;
16
- export declare const black: chalk.Chalk;
17
- export declare const blackBright: chalk.Chalk;
18
- export declare const grey: chalk.Chalk;
19
- export declare const cyan: chalk.Chalk;
20
- export declare const cyanBright: chalk.Chalk;
21
- export declare const magenta: chalk.Chalk;
22
- export declare const magentaBright: chalk.Chalk;
23
- export declare const bold: chalk.Chalk;
24
- export declare const dim: chalk.Chalk;
25
- export declare const underline: chalk.Chalk;
26
- export declare const italic: chalk.Chalk;
27
- export declare const bg: {
28
- white: chalk.Chalk;
29
- whiteBright: chalk.Chalk;
30
- black: chalk.Chalk;
31
- blackBright: chalk.Chalk;
32
- grey: chalk.Chalk;
33
- red: chalk.Chalk;
34
- redBright: chalk.Chalk;
35
- green: chalk.Chalk;
36
- greenBright: chalk.Chalk;
37
- yellow: chalk.Chalk;
38
- yellowBright: chalk.Chalk;
39
- blue: chalk.Chalk;
40
- blueBright: chalk.Chalk;
41
- magenta: chalk.Chalk;
42
- magentaBright: chalk.Chalk;
43
- cyan: chalk.Chalk;
44
- cyanBright: chalk.Chalk;
45
- };
46
- export declare const style: {
47
- organization: chalk.Chalk;
48
- application: chalk.Chalk;
49
- slug: chalk.Chalk;
50
- id: chalk.Chalk;
51
- token: chalk.Chalk;
52
- resource: chalk.Chalk;
53
- attribute: chalk.Chalk;
54
- trigger: chalk.Chalk;
55
- kind: chalk.Chalk;
56
- live: chalk.Chalk;
57
- test: chalk.Chalk;
58
- execMode: (mode: ApiMode) => chalk.Chalk;
59
- success: chalk.Chalk;
60
- warning: chalk.Chalk;
61
- error: chalk.Chalk;
62
- arg: chalk.Chalk;
63
- flag: chalk.Chalk;
64
- command: chalk.Chalk;
65
- value: chalk.Chalk;
66
- alias: chalk.Chalk;
67
- plugin: chalk.Chalk;
68
- title: chalk.Chalk;
69
- path: chalk.Chalk;
70
- datetime: chalk.Chalk;
71
- number: chalk.Chalk;
72
- };
73
- export declare const type: {
74
- datetime: chalk.Chalk;
75
- number: chalk.Chalk;
76
- path: chalk.Chalk;
77
- };
78
- export declare const api: {
79
- organization: chalk.Chalk;
80
- application: chalk.Chalk;
81
- slug: chalk.Chalk;
82
- id: chalk.Chalk;
83
- token: chalk.Chalk;
84
- resource: chalk.Chalk;
85
- attribute: chalk.Chalk;
86
- trigger: chalk.Chalk;
87
- kind: chalk.Chalk;
88
- live: chalk.Chalk;
89
- test: chalk.Chalk;
90
- };
91
- export declare const msg: {
92
- success: chalk.Chalk;
93
- warning: chalk.Chalk;
94
- error: chalk.Chalk;
95
- };
96
- export declare const cli: {
97
- arg: chalk.Chalk;
98
- flag: chalk.Chalk;
99
- command: chalk.Chalk;
100
- value: chalk.Chalk;
101
- alias: chalk.Chalk;
102
- plugin: chalk.Chalk;
103
- };
104
- export declare const table: {
105
- header: chalk.Chalk;
106
- key: chalk.Chalk;
107
- };
package/lib/cjs/color.js DELETED
@@ -1 +0,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,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};
@@ -1,21 +0,0 @@
1
- /** Copy command flags excluding a subset */
2
- declare const commandFlags: <T extends object>(flags: T, exclude?: string[]) => T;
3
- export { commandFlags };
4
- export type KeyVal = Record<string, string | number | boolean | undefined | null>;
5
- export type KeyValString = Record<string, string>;
6
- export type KeyValArray = Record<string, string[]>;
7
- export type KeyValRel = Record<string, {
8
- readonly type: string;
9
- readonly id: string;
10
- }>;
11
- export type KeyValObj = Record<string, any>;
12
- export type KeyValSort = Record<string, 'asc' | 'desc'>;
13
- export type ResAttributes = KeyValObj;
14
- declare const fixValueType: (val: string) => string | number | boolean | null | undefined;
15
- declare const findLongStringFlag: (args: string[], name: string) => {
16
- value: string;
17
- index: number;
18
- single: boolean;
19
- } | undefined;
20
- declare const fixDashedFlagValue: (argv: string[], flag: any, name?: string, parsed?: any) => string[];
21
- export { fixValueType, findLongStringFlag, fixDashedFlagValue };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.fixDashedFlagValue=exports.findLongStringFlag=exports.fixValueType=exports.commandFlags=void 0;const commandFlags=(t,e)=>{const o=Object.assign({},t);if(e)for(const n of e)delete o[n];return o};exports.commandFlags=commandFlags;const fixValueType=t=>{let e=t;return e==="null"?e=null:Number(e)==e?e=Number(e):e=e==="true"?!0:e==="false"?!1:e,e};exports.fixValueType=fixValueType;const findLongStringFlag=(t,e)=>{const o=e.startsWith("--")?e:`--${e}`;let n;const i=t.findIndex(r=>r.startsWith(o));let l=!1;if(i>-1){const r=t[i];if(r.includes("=")){const a=r.split("=");n=a.length===2?a[1]:"",l=!0}else n=t[i+1];return{value:n,index:i,single:l}}else return};exports.findLongStringFlag=findLongStringFlag;const fixDashedFlagValue=(t,e,o,n)=>{const i="____",l=e.name||o,r=e.char;if(!l&&!r)return t;const a=l?l.startsWith("--")?l:`--${l}`:void 0,c=r?e.char.startsWith("-")?r:`-${r}`:void 0;let d=t.findIndex(u=>c&&u.startsWith(c)||a&&u.startsWith(a));if(d<0)return t;let f=t[d],s="",F="";if(c&&f.startsWith(c))s=f.replace(c,"").trim(),f=c;else if(a&&f.startsWith(a))s=f.replace(a,"").trim(),f=a;else return t;if(s.startsWith("=")?(s=s.slice(1),F=f+"="):s||(s=t[++d]),s.startsWith("-")||s.startsWith(i)){const u=s.startsWith(`${i}`)?s.replace(`${i}`,""):s.replace("-",`${i}-`);if(t[d]=F+u,s.startsWith(i)&&n){const p=l?l.replace("--",""):void 0,h=Object.entries(n.flags).find(([g,W])=>W===s);h&&(!p||p===h[0])&&(n.flags[h[0]]=u);const x=Object.values(n.raw).find(g=>g.type==="flag"&&g.input===s);x&&(!p||p===x.flag)&&(x.input=u)}}return t};exports.fixDashedFlagValue=fixDashedFlagValue;
@@ -1,92 +0,0 @@
1
- type ApiConfig = {
2
- default_domain: string;
3
- default_app_domain: string;
4
- default_stg_domain: string;
5
- token_expiration_mins: number;
6
- token_encoding_algorithm: string;
7
- requests_max_num_burst: number;
8
- requests_max_num_burst_cacheable: number;
9
- requests_max_num_burst_test: number;
10
- requests_max_num_burst_test_cacheable: number;
11
- requests_max_secs_burst: number;
12
- requests_max_num_avg: number;
13
- requests_max_num_avg_cacheable: number;
14
- requests_max_num_avg_test: number;
15
- requests_max_num_avg_test_cacheable: number;
16
- requests_max_secs_avg: number;
17
- requests_max_num_oauth: number;
18
- requests_max_secs_oauth: number;
19
- page_max_size: number;
20
- page_default_size: number;
21
- };
22
- type ApplicationConfig = {
23
- kinds: readonly string[];
24
- login_scopes: readonly string[];
25
- };
26
- type ImportsConfig = {
27
- max_size: number;
28
- statuses: readonly string[];
29
- types: readonly string[];
30
- max_queue_length: number;
31
- attachment_expiration: number;
32
- };
33
- type ExportsConfig = {
34
- max_size: number;
35
- statuses: readonly string[];
36
- types: readonly string[];
37
- max_queue_length: number;
38
- attachment_expiration: number;
39
- };
40
- type CleanupsConfig = {
41
- max_size: number;
42
- statuses: readonly string[];
43
- types: readonly string[];
44
- max_queue_length: number;
45
- };
46
- type WebhooksConfig = {
47
- retry_number: number;
48
- };
49
- type CliConfig = {
50
- applications: readonly string[];
51
- };
52
- type DocConfig = {
53
- core: string;
54
- core_api_reference: string;
55
- core_how_tos: string;
56
- core_raste_limits: string;
57
- core_filtering_data: string;
58
- metrics: string;
59
- metrics_api_reference: string;
60
- provisioning: string;
61
- provisioning_api_reference: string;
62
- imports_resources: string;
63
- exports_resources: string;
64
- cleanups_resources: string;
65
- webhooks_events: string;
66
- tags_resources: string;
67
- };
68
- type TagsConfig = {
69
- max_resource_tags: number;
70
- taggable_resources: readonly string[];
71
- tag_name_max_length: number;
72
- tag_name_pattern: RegExp;
73
- };
74
- type ProvisioningConfig = {
75
- default_subdomain: string;
76
- scope: string;
77
- applications: readonly string[];
78
- };
79
- type Config = {
80
- api: ApiConfig;
81
- application: ApplicationConfig;
82
- imports: ImportsConfig;
83
- exports: ExportsConfig;
84
- cleanups: CleanupsConfig;
85
- webhooks: WebhooksConfig;
86
- cli: CliConfig;
87
- doc: DocConfig;
88
- tags: TagsConfig;
89
- provisioning: ProvisioningConfig;
90
- };
91
- declare const config: Config;
92
- export default config;
package/lib/cjs/config.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const JOB_STATUSES=["in_progress","pending","completed","interrupted"],IMPORT_RESOURCE_TYPES=["addresses","bundles","coupons","customer_addresses","customer_payment_sources","customer_subscriptions","customers","gift_cards","line_items","line_item_options","orders","price_tiers","prices","shipping_categories","sku_lists","sku_list_items","sku_options","skus","stock_items","tags","tax_categories"],EXPORT_RESOURCE_TYPES=["addresses","authorizations","bundles","captures","coupons","customer_addresses","customer_subscriptions","customers","gift_cards","line_items","orders","payment_methods","price_tiers","prices","refunds","shipments","shipping_categories","shipping_methods","sku_lists","sku_list_items","sku_options","skus","stock_items","tags","tax_categories","transactions","voids"],CLEANUP_RESOURCE_TYPES=["bundles","gift_cards","prices","promotions","sku_lists","sku_options","skus","stock_items"],TAG_RESOURCE_TYPES=["addresses","bundles","customers","coupons","gift_cards","line_items","line_item_options","orders","returns","skus","sku_options","promotions","external_promotions","fixed_amount_promotions","fixed_price_promotions","free_gift_promotions","free_shipping_promotions","percentage_discount_promotions"],RATE_LIMIT={erl_oauth_limit_live:30,erl_burst_limit_uncachable_live:50,erl_burst_limit_uncachable_test:25,erl_burst_limit_cachable_live:250,erl_burst_limit_cachable_test:125,erl_average_limit_uncachable_live:200,erl_average_limit_uncachable_test:100,erl_average_limit_cachable_live:1e3,erl_average_limit_cachable_test:500},config={api:{default_domain:"commercelayer.io",default_app_domain:"commercelayer.app",default_stg_domain:"commercelayer.co",token_expiration_mins:60*4,token_encoding_algorithm:"HS512",requests_max_num_burst:RATE_LIMIT.erl_burst_limit_uncachable_live,requests_max_num_burst_cacheable:RATE_LIMIT.erl_burst_limit_cachable_live,requests_max_num_burst_test:RATE_LIMIT.erl_burst_limit_uncachable_test,requests_max_num_burst_test_cacheable:RATE_LIMIT.erl_burst_limit_cachable_test,requests_max_num_avg:RATE_LIMIT.erl_average_limit_uncachable_live,requests_max_num_avg_cacheable:RATE_LIMIT.erl_average_limit_cachable_live,requests_max_num_avg_test:RATE_LIMIT.erl_average_limit_uncachable_test,requests_max_num_avg_test_cacheable:RATE_LIMIT.erl_average_limit_cachable_test,requests_max_num_oauth:RATE_LIMIT.erl_oauth_limit_live,requests_max_secs_burst:10,requests_max_secs_oauth:60,requests_max_secs_avg:60,page_max_size:25,page_default_size:10},application:{kinds:["integration","sales_channel","webapp","user"],login_scopes:["market","stock_location"]},imports:{max_size:5e3,statuses:JOB_STATUSES,types:IMPORT_RESOURCE_TYPES,max_queue_length:10,attachment_expiration:5},exports:{max_size:1e4,statuses:JOB_STATUSES,types:EXPORT_RESOURCE_TYPES,max_queue_length:10,attachment_expiration:5},cleanups:{max_size:1e4,statuses:JOB_STATUSES,types:CLEANUP_RESOURCE_TYPES,max_queue_length:10},webhooks:{retry_number:5},cli:{applications:["integration","sales_channel","user"]},doc:{core:"https://docs.commercelayer.io/core/",core_api_reference:"https://docs.commercelayer.io/developers/v/api-reference",core_how_tos:"https://docs.commercelayer.io/core/v/how-tos/",core_raste_limits:"https://docs.commercelayer.io/core/rate-limits",core_filtering_data:"https://docs.commercelayer.io/core/filtering-data#list-of-predicates",metrics:"https://docs.commercelayer.io/metrics/",metrics_api_reference:"https://docs.commercelayer.io/metrics/v/api-reference-m/",provisioning:"https://docs.commercelayer.io/provisioning/",provisioning_api_reference:"https://docs.commercelayer.io/provisioning/v/api-reference-p/",imports_resources:"https://docs.commercelayer.io/api/importing-resources#supported-resources",exports_resources:"https://docs.commercelayer.io/core/exporting-resources#supported-resources",cleanups_resources:"https://docs.commercelayer.io/core/cleaning-resources#supported-resources",webhooks_events:"https://docs.commercelayer.io/api/real-time-webhooks#supported-events",tags_resources:"https://docs.commercelayer.io/core/v/api-reference/tags#taggable-resources"},tags:{max_resource_tags:10,taggable_resources:TAG_RESOURCE_TYPES,tag_name_max_length:25,tag_name_pattern:/^[0-9A-Za-z_-]{1,25}$/},provisioning:{default_subdomain:"provisioning",scope:"provisioning-api",applications:["user"]}};exports.default=config;
@@ -1,10 +0,0 @@
1
- declare const documentation: string;
2
- interface Filter extends Record<string, unknown> {
3
- predicate: string;
4
- description: string;
5
- }
6
- declare const filterList: () => string[];
7
- declare const filterAvailable: (filter: string) => boolean;
8
- declare const applyFilter: (predicate: string, ...fields: string[]) => string;
9
- declare const filters: () => Filter[];
10
- export { type Filter, documentation, filterAvailable as available, filterList as list, applyFilter as apply, filters };
package/lib/cjs/filter.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.filters=exports.apply=exports.list=exports.available=exports.documentation=void 0;const config_1=__importDefault(require("./config")),FILTERS=[{predicate:"*_eq",description:"The attribute is equal to the filter value"},{predicate:"*_not_eq",description:"The attribute is not equal to the filter value"},{predicate:"*_matches",description:'The attribute matches the filter value with "LIKE" operator'},{predicate:"*_does_not_match",description:'The attribute does not match the filter value with "LIKE" operator'},{predicate:"*_matches_any",description:'The attribute matches all of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_matches_all",description:'The attribute matches all of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_does_not_match_any",description:'The attribute does not match any of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_does_not_match_all",description:'The attribute matches none of the filter values (comma-separated) with "LIKE" operator'},{predicate:"*_lt",description:"The attribute is less than the filter value"},{predicate:"*_lteq",description:"The attribute is less than or equal to the filter value"},{predicate:"*_gt",description:"The attribute is greater than the filter value"},{predicate:"*_gteq",description:"The attribute is greater than or equal to the filter value"},{predicate:"*_present",description:"The attribute is not null and not empty"},{predicate:"*_blank",description:"The attribute is null or empty"},{predicate:"*_null",description:"The attribute is null"},{predicate:"*_not_null",description:"The attribute is not null"},{predicate:"*_in",description:"The attribute matches any of the filter values (comma-separated)"},{predicate:"*_not_in",description:"The attribute matches none of the filter values (comma-separated)"},{predicate:"*_lt_any",description:"The attribute is less than any of the filter values (comma-separated)"},{predicate:"*_lteq_any",description:"The attribute is less than or equal to any of the filter values (comma-separated)"},{predicate:"*_gt_any",description:"The attribute is greater than any of the filter values (comma-separated)"},{predicate:"*_gteq_any",description:"The attribute is greater than or qual to any of the filter values (comma-separated)"},{predicate:"*_lt_all",description:"The attribute is less than all of the filter values (comma-separated)"},{predicate:"*_lteq_all",description:"The attribute is less than or equal to all of the filter values (comma-separated)"},{predicate:"*_gt_all",description:"The attribute is greater than all of the filter values (comma-separated)"},{predicate:"*_gteq_all",description:"The attribute is greater or equal to all of the filter values (comma-separated)"},{predicate:"*_not_eq_all",description:"The attribute is equal to none of the filter values (comma-separated)"},{predicate:"*_start",description:"The attribute starts with the filter value (comma-separated)"},{predicate:"*_not_start",description:"The attribute does not start with the filter value (comma-separated)"},{predicate:"*_start_any",description:"The attribute starts with any of the filter values (comma-separated)"},{predicate:"*_start_all",description:"The attribute starts with all of the filter values (comma-separated)"},{predicate:"*_not_start_any",description:"The attribute does not start with any of the filter values (comma-separated)"},{predicate:"*_not_start_all",description:"The attribute starts with none of the filter values (comma-separated)"},{predicate:"*_end",description:"The attribute ends with the filter value"},{predicate:"*_not_end",description:"The attribute does not end with the filter value"},{predicate:"*_end_any",description:"The attribute ends with any of the filter values (comma-separated)"},{predicate:"*_end_all",description:"The attribute ends with all of the filter values (comma-separated)"},{predicate:"*_not_end_any",description:"The attribute does not end with any of the filter values (comma-separated)"},{predicate:"*_not_end_all",description:"The attribute ends with none of the filter values (comma-separated)"},{predicate:"*_cont",description:"The attribute contains the filter value"},{predicate:"*_not_cont",description:"The attribute does not contains the filter value"},{predicate:"*_cont_any",description:"The attribute contains any of the filter values (comma-separated)"},{predicate:"*_cont_all",description:"The attribute contains all of the filter values (comma-separated)"},{predicate:"*_not_cont_all",description:"The attribute contains none of the filter values (comma-separated)"},{predicate:"*_jcont",description:"The attribute contains a portion of the JSON used as filter value (works with object only)"},{predicate:"*_true",description:"The attribute is true"},{predicate:"*_false",description:"The attribute is false"}],documentation=config_1.default.doc.core_filtering_data;exports.documentation=documentation;const filterList=()=>filters().map(t=>t.predicate.replace(/^\*/g,""));exports.list=filterList;const filterAvailable=t=>{const a=t.startsWith("_")?t:`_${t}`;return filterList().some(e=>a.endsWith(e))};exports.available=filterAvailable;const applyFilter=(t,...a)=>{if(!filterAvailable(t))throw new Error("Unknown filter: "+t);let e="";for(const i of a)e+=(e.length===0?"":"_or_")+i;return e+=t.startsWith("_")?t:`_${t}`,e};exports.apply=applyFilter;const filters=()=>[...FILTERS];exports.filters=filters;
package/lib/cjs/help.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { type Command, CommandHelp, Help, type Interfaces } from '@oclif/core';
2
- declare class CLICommandHelp extends CommandHelp {
3
- examples(examples: Command.Example[] | undefined | string): string | undefined;
4
- }
5
- export default class CLIBaseHelp extends Help {
6
- showHelp(args: string[]): Promise<void>;
7
- showRootHelp(): Promise<void>;
8
- showTopicHelp(topic: Interfaces.Topic): Promise<void>;
9
- showCommandHelp(command: Command.Cached): Promise<void>;
10
- formatRoot(): string;
11
- formatTopic(topic: Interfaces.Topic): string;
12
- formatTopics(topics: Interfaces.Topic[]): string;
13
- formatCommands(commands: Command.Cached[]): string;
14
- formatCommand(command: Command.Cached): string;
15
- getCommandHelpClass(command: Command.Cached): CLICommandHelp;
16
- }
17
- export {};
package/lib/cjs/help.js DELETED
@@ -1,5 +0,0 @@
1
- "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(`
2
- `)[0];r&&console.log(`${(0,text_1.capitalize)(r)}
3
- `),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(`
4
- `).map(s=>{let e=0;return s.split(" ").map(t=>(t||"").trim()!==""&&++e===2?(0,text_1.capitalize)(t):t).join(" ")}).join(`
5
- `)}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;
@@ -1,19 +0,0 @@
1
- export * as clApi from './api';
2
- export * as clApplication from './application';
3
- export { default as clConfig } from './config';
4
- export * as clCommand from './command';
5
- export * as clOutput from './output';
6
- export * as clColor from './color';
7
- export * as clToken from './token';
8
- export * as clUpdate from './update';
9
- export * as clUtil from './util';
10
- export { default as clHelp } from './help';
11
- export * as clSchema from './schema';
12
- export * as clText from './text';
13
- export * as clSymbol from './symbol';
14
- export * as clFilter from './filter';
15
- /** Types **/
16
- export type { ApiMode, ApiType } from './api';
17
- export type { AppKey, AppAuth, AppInfo } from './application';
18
- export type { AccessTokenInfo, AccessToken, CustomToken, AuthScope } from './token';
19
- export type { KeyVal, KeyValString, KeyValArray, KeyValObj, KeyValRel, KeyValSort, ResAttributes } from './command';
package/lib/cjs/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var l=Object.getOwnPropertyDescriptor(t,r);(!l||("get"in l?!t.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,l)}: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.clFilter=exports.clSymbol=exports.clText=exports.clSchema=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}}),exports.clSchema=__importStar(require("./schema")),exports.clText=__importStar(require("./text")),exports.clSymbol=__importStar(require("./symbol")),exports.clFilter=__importStar(require("./filter"));