contensis-cli 1.2.2-beta.11 → 1.2.2-beta.12

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.
@@ -125,7 +125,7 @@ ${Logger.standardText(content)}`;
125
125
  static mixed = (contentArray) => console.log(`${Logger.getPrefix()} ${contentArray.join(" ")}`);
126
126
  static line = () => Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);
127
127
  static object = (content) => {
128
- var _a, _b, _c, _d, _e, _f;
128
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
129
129
  for (const [key, value] of Object.entries(content || {})) {
130
130
  if (value && typeof value === "object") {
131
131
  Logger.raw(` ${import_chalk.default.bold.grey(key)}:`);
@@ -137,15 +137,17 @@ ${Logger.standardText(content)}`;
137
137
  (_c = field.validations.allowedFieldTypes) == null ? void 0 : _c.fields
138
138
  ) ? `composer[${field.validations.allowedFieldTypes.fields.map((f) => f.id).join(" | ")}]` : field.dataFormat}${field.dataFormat === "entry" ? `, ${field.validations.allowedContentTypes.contentTypes.join(
139
139
  " | "
140
- )}` : ""}>` : ""}${((_d = field.validations.maxLength) == null ? void 0 : _d.value) ? `(${field.validations.maxLength.value})` : ""}`
140
+ )}` : ""}${field.dataFormat === "contenttype" ? `[${(_d = field.validations) == null ? void 0 : _d.allowedDataFormats.dataFormats.join(
141
+ " | "
142
+ )}], ${(((_f = (_e = field.validations) == null ? void 0 : _e.allowedIds) == null ? void 0 : _f.ids) || ["*"]).join(" | ")}` : ""}>` : ""}${((_g = field.validations.maxLength) == null ? void 0 : _g.value) ? `(${field.validations.maxLength.value})` : ""}`
141
143
  )}`
142
144
  );
143
145
  }
144
146
  } else if (key === "groups" && Array.isArray(value)) {
145
147
  for (const group of value || []) {
146
- const description = Object.keys(group.description).length && ((_e = Object.values(group.description)) == null ? void 0 : _e[0]);
148
+ const description = Object.keys(group.description).length && ((_h = Object.values(group.description)) == null ? void 0 : _h[0]);
147
149
  Logger.raw(
148
- ` ${import_chalk.default.bold(group.id)}${description ? `: ${import_chalk.default.grey((_f = Object.values(group.description)) == null ? void 0 : _f[0])}` : ""}`
150
+ ` ${import_chalk.default.bold(group.id)}${description ? `: ${import_chalk.default.grey((_i = Object.values(group.description)) == null ? void 0 : _i[0])}` : ""}`
149
151
  );
150
152
  }
151
153
  } else {
@@ -167,7 +169,9 @@ ${Logger.standardText(content)}`;
167
169
  else
168
170
  Logger.objectRecurse(item, depth + 1, `${indent} `);
169
171
  else
170
- Logger.raw(`${indent}${import_chalk.default.grey(`[`)}${item.join(", ")}${import_chalk.default.grey(`]`)}`);
172
+ Logger.raw(
173
+ `${indent}${import_chalk.default.grey(`[`)}${item.join(", ")}${import_chalk.default.grey(`]`)}`
174
+ );
171
175
  } else
172
176
  Logger.raw(`${indent}${item}`);
173
177
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/util/logger.ts"],
4
- "sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport {\n ansiEscapeCodes,\n first,\n partition,\n strlen,\n} from 'printable-characters';\n// import ProgressBar from 'progress';\nimport { isSysError, tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any, newline?: string) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth?: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err, newline = '\\n') => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err\n ? `\\n\\n${Logger.infoText(\n isSysError(err) ? err.toString() : JSON.stringify(err, null, 2)\n )}`\n : ''\n }`\n )}${newline}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.warningText(\n `${Logger.isUserTerminal ? '\u26A0\uFE0F ' : '[WARN]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n // }\n };\n static success: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.successText(\n `${Logger.isUserTerminal ? '\u2705' : '[OK]'} ${content}`\n )}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static info: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgCyan(' \u2139 ') : '[INFO]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static help: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${chalk.blue(\n `${Logger.isUserTerminal ? '\u23E9' : '[HELP]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static standard: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? '\u25FB\uFE0F' : '[STD]'\n } \\n${Logger.standardText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n progress.current.interrupt(message);\n };\n static debug: LogMethod = content => {\n if (['true', '1'].includes(process.env.debug || '')) {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgGrey(' \u2699 ') : '[DEBUG]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n }\n };\n static json: LogJsonDepthMethod = (content, depth = 9) =>\n console.dir(deepCleaner(content), { colors: true, depth });\n static mixed: LogArrayMethod = contentArray =>\n console.log(`${Logger.getPrefix()} ${contentArray.join(' ')}`);\n static line = () =>\n Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);\n\n static object: LogJsonMethod = content => {\n for (const [key, value] of Object.entries(content || {})) {\n if (value && typeof value === 'object') {\n Logger.raw(` ${chalk.bold.grey(key)}:`);\n if (key === 'fields' && Array.isArray(value)) {\n for (const field of value || []) {\n Logger.raw(\n ` ${chalk.bold(field.id)}${\n field.id === content.entryTitleField\n ? '**'\n : field.validations.minCount?.value ||\n typeof field.validations.required?.message !== 'undefined'\n ? '*'\n : ''\n }: ${chalk.grey(\n `${field.dataType}${\n field.dataFormat\n ? `<${\n Array.isArray(\n field.validations.allowedFieldTypes?.fields\n )\n ? `composer[${field.validations.allowedFieldTypes.fields\n .map((f: any) => f.id)\n .join(' | ')}]`\n : field.dataFormat\n }${\n field.dataFormat === 'entry'\n ? `, ${field.validations.allowedContentTypes.contentTypes.join(\n ' | '\n )}`\n : ''\n }>`\n : ''\n }${\n field.validations.maxLength?.value\n ? `(${field.validations.maxLength.value})`\n : ''\n }`\n )}`\n );\n }\n } else if (key === 'groups' && Array.isArray(value)) {\n for (const group of value || []) {\n const description =\n Object.keys(group.description).length &&\n Object.values(group.description)?.[0];\n Logger.raw(\n ` ${chalk.bold(group.id)}${\n description\n ? `: ${chalk.grey(Object.values(group.description)?.[0])}`\n : ''\n }`\n );\n }\n } else {\n Logger.objectRecurse(value, 3, ' ');\n // for (const [innerkey, innervalue] of Object.entries(value)) {\n // if (innervalue && typeof innervalue === 'object') {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}:`);\n // console.table(innervalue);\n // } else if (\n // typeof innervalue !== 'undefined' &&\n // innervalue !== null\n // ) {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}: ${innervalue}`);\n // }\n // }\n }\n } else if (typeof value !== 'undefined' && value !== null) {\n const valueText =\n key === 'id' && typeof value === 'string'\n ? Logger.highlightText(value)\n : value;\n Logger.raw(` ${chalk.bold.grey(key)}: ${valueText}`);\n }\n }\n };\n\n static objectRecurse: LogJsonMethod = (content, depth = 3, indent = '') => {\n if (Array.isArray(content)) {\n for (const item of content) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n if (item.length)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n else Logger.raw(`${indent}${chalk.grey(`[`)}${item.join(', ')}${chalk.grey(`]`)}`);\n } else Logger.raw(`${indent}${item}`);\n }\n } else {\n let pos = 0;\n for (const [key, value] of Object.entries(content)) {\n const thisIndent =\n pos === 0 ? `${indent.substring(0, indent.length - 2)}- ` : indent;\n if (Array.isArray(value)) {\n if (value.length) Logger.raw(`${thisIndent}${chalk.bold.grey(key)}:`);\n for (const item of value) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else {\n Logger.raw(`${indent} ${item}`);\n }\n }\n } else if (value && typeof value === 'object') {\n Logger.raw(`${indent}${chalk.bold.grey(key)}:`);\n\n Logger.objectRecurse(value, depth + 1, `${indent} `);\n // console.table(value);\n } else if (typeof value !== 'undefined' && value !== null) {\n Logger.raw(`${thisIndent}${chalk.bold.grey(key)}: ${value}`);\n }\n pos++;\n }\n }\n };\n static raw: LogMethod = (content: string) => {\n if (progress.active) progress.current.interrupt(content);\n else console.log(content);\n };\n\n static limits = (\n content: string,\n displayLength = 30,\n consoleWidth = process.stdout.columns,\n logMethod: Function = console.info\n ) => {\n if (consoleWidth) {\n const contentArray = content.endsWith('\\n')\n ? content.split('\\n').slice(0, -1)\n : content.split('\\n');\n const contentLines = contentArray.slice(\n 0,\n consoleWidth ? displayLength : undefined\n );\n for (const line of contentLines)\n logMethod(\n line\n .split('~n')\n .map(l =>\n consoleWidth && strlen(l) > consoleWidth\n ? first(l, consoleWidth)\n : l\n )\n .join('\\n')\n );\n } else {\n logMethod(content.replace(ansiEscapeCodes, '').replaceAll('~n', '\\n'));\n }\n\n const tableArray = content.split('\\n');\n if (consoleWidth && tableArray.length > displayLength)\n console.info(\n `\\n`,\n `- and ${tableArray.length - displayLength} more...\\n`\n );\n };\n}\n\nexport const logError: LogErrorFunc = (\n err = new Error('Undefined error'),\n msg,\n level = 'error'\n) => {\n Logger[level](msg || err.message || err?.data?.message || err.Message);\n (Array.isArray(err) ? err : [err]).map((error: AppError) => {\n if (typeof error === 'string') {\n Logger.raw(`${Logger.infoText(error)}\\n`);\n return;\n }\n if ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}\\n`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}\\n`);\n });\n //Logger.line();\n return null;\n};\n\nexport const addNewLines = (\n message = '',\n newLineSeparater = '\\n',\n atPosition = process.stdout.columns\n) => {\n if (message === '' || atPosition === 0) {\n return '';\n }\n\n let result = '';\n let lengthCounter = 0;\n\n // Partition the message string into an array of\n // [nonPrintable, printable][]\n const partitioned = partition(message);\n const addSeparater = () => {\n // If line length counter has exceeded the console width\n // add a new line separater and reset the line length counter\n if (lengthCounter >= atPosition) {\n result += newLineSeparater;\n lengthCounter = 0;\n }\n };\n\n // Loop through the partitioned message parts\n for (const [nonPrintable, printable] of partitioned) {\n // Convert string to array as this will provide accurate\n // lengths and splicing methods with all unicode chars\n const textParts = Array.from(printable);\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // In the first iteration append the non printable unicode chars\n // to the beginning of the spliced text\n result += nonPrintable + text.join('');\n // Keep a count of the current line length\n // as one line of output could span multiple \"partitions\"\n lengthCounter += text.length;\n addSeparater();\n\n // Handle any remaining text in this \"partition\"\n while (textParts.length) {\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // Append the spliced text to the result\n result += text.join('');\n // Increase line length counter\n lengthCounter += text.length;\n addSeparater();\n }\n }\n return result;\n};\n\nexport const progress = {\n current: { interrupt: (x: string) => {} },\n active: false,\n // done: () => new ProgressBar('', 0),\n // colours: { green: '\\u001b[42m \\u001b[0m', red: '\\u001b[41m \\u001b[0m' },\n // current: new ProgressBar(`:bar`, {\n // complete: '=',\n // incomplete: ' ',\n // width: 20,\n // total: 100,\n // }),\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,wBAAuB;AACvB,0BAAwB;AACxB,kCAKO;AAEP,eAAyC;AAalC,MAAM,OAAO;AAAA,EAClB,OAAO,iBAAiB,CAAC,CAAC,QAAQ,OAAO;AAAA,EACzC,OAAO,YAAY,MAAM;AACvB,WAAO,OAAO,iBACV,OAAO,SAAS,OAAO,IACvB,QAAI,kBAAAA,SAAW,IAAI,KAAK,GAAG,gBAAgB;AAAA,EACjD;AAAA,EACA,OAAO,YAAY,aAAAC,QAAM,KAAK;AAAA,EAC9B,OAAO,cAAc,aAAAA,QAAM,QAAQ,QAAQ;AAAA,EAC3C,OAAO,cAAc,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC1C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,gBAAgB,aAAAA,QAAM;AAAA,EAC7B,OAAO,WAAW,aAAAA,QAAM,QAAQ,MAAM;AAAA,EACtC,OAAO,eAAe,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC3C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,WAAsB,aAAW;AACtC,UAAM,UAAU,GAAG,OAAO,UAAU,MAAM,OAAO;AAAA,M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iBA,MAAK;AACtB,mBAAa;AAAA,IACf;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,WAAW;AAAA,EACtB,SAAS,EAAE,WAAW,CAAC,MAAc;AAAA,EAAC,EAAE;AAAA,EACxC,QAAQ;AASV;",
4
+ "sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport {\n ansiEscapeCodes,\n first,\n partition,\n strlen,\n} from 'printable-characters';\n// import ProgressBar from 'progress';\nimport { isSysError, tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any, newline?: string) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth?: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err, newline = '\\n') => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err\n ? `\\n\\n${Logger.infoText(\n isSysError(err) ? err.toString() : JSON.stringify(err, null, 2)\n )}`\n : ''\n }`\n )}${newline}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.warningText(\n `${Logger.isUserTerminal ? '\u26A0\uFE0F ' : '[WARN]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n // }\n };\n static success: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.successText(\n `${Logger.isUserTerminal ? '\u2705' : '[OK]'} ${content}`\n )}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static info: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgCyan(' \u2139 ') : '[INFO]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static help: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${chalk.blue(\n `${Logger.isUserTerminal ? '\u23E9' : '[HELP]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static standard: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? '\u25FB\uFE0F' : '[STD]'\n } \\n${Logger.standardText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n progress.current.interrupt(message);\n };\n static debug: LogMethod = content => {\n if (['true', '1'].includes(process.env.debug || '')) {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgGrey(' \u2699 ') : '[DEBUG]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n }\n };\n static json: LogJsonDepthMethod = (content, depth = 9) =>\n console.dir(deepCleaner(content), { colors: true, depth });\n static mixed: LogArrayMethod = contentArray =>\n console.log(`${Logger.getPrefix()} ${contentArray.join(' ')}`);\n static line = () =>\n Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);\n\n static object: LogJsonMethod = content => {\n for (const [key, value] of Object.entries(content || {})) {\n if (value && typeof value === 'object') {\n Logger.raw(` ${chalk.bold.grey(key)}:`);\n if (key === 'fields' && Array.isArray(value)) {\n for (const field of value || []) {\n Logger.raw(\n ` ${chalk.bold(field.id)}${\n field.id === content.entryTitleField\n ? '**'\n : field.validations.minCount?.value ||\n typeof field.validations.required?.message !== 'undefined'\n ? '*'\n : ''\n }: ${chalk.grey(\n `${field.dataType}${\n field.dataFormat\n ? `<${\n Array.isArray(\n field.validations.allowedFieldTypes?.fields\n )\n ? `composer[${field.validations.allowedFieldTypes.fields\n .map((f: any) => f.id)\n .join(' | ')}]`\n : field.dataFormat\n }${\n field.dataFormat === 'entry'\n ? `, ${field.validations.allowedContentTypes.contentTypes.join(\n ' | '\n )}`\n : ''\n }${\n field.dataFormat === 'contenttype'\n ? `[${field.validations?.allowedDataFormats.dataFormats.join(\n ' | '\n )}], ${(\n field.validations?.allowedIds?.ids || ['*']\n ).join(' | ')}`\n : ''\n }>`\n : ''\n }${\n field.validations.maxLength?.value\n ? `(${field.validations.maxLength.value})`\n : ''\n }`\n )}`\n );\n }\n } else if (key === 'groups' && Array.isArray(value)) {\n for (const group of value || []) {\n const description =\n Object.keys(group.description).length &&\n Object.values(group.description)?.[0];\n Logger.raw(\n ` ${chalk.bold(group.id)}${\n description\n ? `: ${chalk.grey(Object.values(group.description)?.[0])}`\n : ''\n }`\n );\n }\n } else {\n Logger.objectRecurse(value, 3, ' ');\n // for (const [innerkey, innervalue] of Object.entries(value)) {\n // if (innervalue && typeof innervalue === 'object') {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}:`);\n // console.table(innervalue);\n // } else if (\n // typeof innervalue !== 'undefined' &&\n // innervalue !== null\n // ) {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}: ${innervalue}`);\n // }\n // }\n }\n } else if (typeof value !== 'undefined' && value !== null) {\n const valueText =\n key === 'id' && typeof value === 'string'\n ? Logger.highlightText(value)\n : value;\n Logger.raw(` ${chalk.bold.grey(key)}: ${valueText}`);\n }\n }\n };\n\n static objectRecurse: LogJsonMethod = (content, depth = 3, indent = '') => {\n if (Array.isArray(content)) {\n for (const item of content) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n if (item.length)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n else\n Logger.raw(\n `${indent}${chalk.grey(`[`)}${item.join(', ')}${chalk.grey(`]`)}`\n );\n } else Logger.raw(`${indent}${item}`);\n }\n } else {\n let pos = 0;\n for (const [key, value] of Object.entries(content)) {\n const thisIndent =\n pos === 0 ? `${indent.substring(0, indent.length - 2)}- ` : indent;\n if (Array.isArray(value)) {\n if (value.length) Logger.raw(`${thisIndent}${chalk.bold.grey(key)}:`);\n for (const item of value) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else {\n Logger.raw(`${indent} ${item}`);\n }\n }\n } else if (value && typeof value === 'object') {\n Logger.raw(`${indent}${chalk.bold.grey(key)}:`);\n\n Logger.objectRecurse(value, depth + 1, `${indent} `);\n // console.table(value);\n } else if (typeof value !== 'undefined' && value !== null) {\n Logger.raw(`${thisIndent}${chalk.bold.grey(key)}: ${value}`);\n }\n pos++;\n }\n }\n };\n static raw: LogMethod = (content: string) => {\n if (progress.active) progress.current.interrupt(content);\n else console.log(content);\n };\n\n static limits = (\n content: string,\n displayLength = 30,\n consoleWidth = process.stdout.columns,\n logMethod: Function = console.info\n ) => {\n if (consoleWidth) {\n const contentArray = content.endsWith('\\n')\n ? content.split('\\n').slice(0, -1)\n : content.split('\\n');\n const contentLines = contentArray.slice(\n 0,\n consoleWidth ? displayLength : undefined\n );\n for (const line of contentLines)\n logMethod(\n line\n .split('~n')\n .map(l =>\n consoleWidth && strlen(l) > consoleWidth\n ? first(l, consoleWidth)\n : l\n )\n .join('\\n')\n );\n } else {\n logMethod(content.replace(ansiEscapeCodes, '').replaceAll('~n', '\\n'));\n }\n\n const tableArray = content.split('\\n');\n if (consoleWidth && tableArray.length > displayLength)\n console.info(\n `\\n`,\n `- and ${tableArray.length - displayLength} more...\\n`\n );\n };\n}\n\nexport const logError: LogErrorFunc = (\n err = new Error('Undefined error'),\n msg,\n level = 'error'\n) => {\n Logger[level](msg || err.message || err?.data?.message || err.Message);\n (Array.isArray(err) ? err : [err]).map((error: AppError) => {\n if (typeof error === 'string') {\n Logger.raw(`${Logger.infoText(error)}\\n`);\n return;\n }\n if ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}\\n`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}\\n`);\n });\n //Logger.line();\n return null;\n};\n\nexport const addNewLines = (\n message = '',\n newLineSeparater = '\\n',\n atPosition = process.stdout.columns\n) => {\n if (message === '' || atPosition === 0) {\n return '';\n }\n\n let result = '';\n let lengthCounter = 0;\n\n // Partition the message string into an array of\n // [nonPrintable, printable][]\n const partitioned = partition(message);\n const addSeparater = () => {\n // If line length counter has exceeded the console width\n // add a new line separater and reset the line length counter\n if (lengthCounter >= atPosition) {\n result += newLineSeparater;\n lengthCounter = 0;\n }\n };\n\n // Loop through the partitioned message parts\n for (const [nonPrintable, printable] of partitioned) {\n // Convert string to array as this will provide accurate\n // lengths and splicing methods with all unicode chars\n const textParts = Array.from(printable);\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // In the first iteration append the non printable unicode chars\n // to the beginning of the spliced text\n result += nonPrintable + text.join('');\n // Keep a count of the current line length\n // as one line of output could span multiple \"partitions\"\n lengthCounter += text.length;\n addSeparater();\n\n // Handle any remaining text in this \"partition\"\n while (textParts.length) {\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // Append the spliced text to the result\n result += text.join('');\n // Increase line length counter\n lengthCounter += text.length;\n addSeparater();\n }\n }\n return result;\n};\n\nexport const progress = {\n current: { interrupt: (x: string) => {} },\n active: false,\n // done: () => new ProgressBar('', 0),\n // colours: { green: '\\u001b[42m \\u001b[0m', red: '\\u001b[41m \\u001b[0m' },\n // current: new ProgressBar(`:bar`, {\n // complete: '=',\n // incomplete: ' ',\n // width: 20,\n // total: 100,\n // }),\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,wBAAuB;AACvB,0BAAwB;AACxB,kCAKO;AAEP,eAAyC;AAalC,MAAM,OAAO;AAAA,EAClB,OAAO,iBAAiB,CAAC,CAAC,QAAQ,OAAO;AAAA,EACzC,OAAO,YAAY,MAAM;AACvB,WAAO,OAAO,iBACV,OAAO,SAAS,OAAO,IACvB,QAAI,kBAAAA,SAAW,IAAI,KAAK,GAAG,gBAAgB;AAAA,EACjD;AAAA,EACA,OAAO,YAAY,aAAAC,QAAM,KAAK;AAAA,EAC9B,OAAO,cAAc,aAAAA,QAAM,QAAQ,QAAQ;AAAA,EAC3C,OAAO,cAAc,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC1C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,gBAAgB,aAAAA,QAAM;AAAA,EAC7B,OAAO,WAAW,aAAAA,QAAM,QAAQ,MAAM;AAAA,EACtC,OAAO,eAAe,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC3C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,WAAsB,aAAW;AACtC,UAAM,UAAU,GAAG,OAAO,UAAU,MAAM,OAAO;AAAA,MAC/C;AAAA,IACF,KAAK;AACL,YAAQ,IAAI,OAAO;AAAA,EACrB;AAAA,EACA,OAAO,QAAwB,CAAC,SAAS,KAAK,UAAU,SAAS;AAC/D,UAAM,UAAU,GAAG,OAAO,UAAU,KAAK,OAAO;AAAA,MAC9C,GAAG,OAAO,iBAAiB,WAAM,aAAa,UAC5C,MACI;AAAA;AAAA,EAAO,OAAO;AAAA,YACZ,qBAAW,GAAG,IAAI,I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B,SAAS,EAAE,WAAW,CAAC,MAAc;AAAA,EAAC,EAAE;AAAA,EACxC,QAAQ;AASV;",
6
6
  "names": ["dateFormat", "chalk", "deepCleaner", "text"]
7
7
  }
package/dist/version.js CHANGED
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  LIB_VERSION: () => LIB_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const LIB_VERSION = "1.2.2-beta.11";
24
+ const LIB_VERSION = "1.2.2-beta.12";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  LIB_VERSION
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["export const LIB_VERSION = \"1.2.2-beta.11\";\n"],
4
+ "sourcesContent": ["export const LIB_VERSION = \"1.2.2-beta.12\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contensis-cli",
3
- "version": "1.2.2-beta.11",
3
+ "version": "1.2.2-beta.12",
4
4
  "description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
5
5
  "repository": "https://github.com/contensis/cli",
6
6
  "homepage": "https://github.com/contensis/cli/tree/main/packages/contensis-cli#readme",
@@ -7,9 +7,11 @@ import {
7
7
  contentTypes,
8
8
  delivery,
9
9
  entryId,
10
+ exportOption,
10
11
  latest,
11
12
  mapContensisOpts,
12
13
  noCache,
14
+ requiredBy,
13
15
  versionStatus,
14
16
  zenql,
15
17
  } from './globalOptions';
@@ -67,6 +69,38 @@ Example call:
67
69
  );
68
70
  });
69
71
 
72
+ program
73
+ .command('proxy')
74
+ .description('get a proxy')
75
+ .argument('<proxyId>', 'id of the proxy to get')
76
+ .addHelpText(
77
+ 'after',
78
+ `
79
+ Example call:
80
+ > get proxy b8b6958f-6ae2-41d5-876a-abc86755fd7b
81
+ `
82
+ )
83
+ .action(async (proxyId: string, opts) => {
84
+ await cliCommand(['get', 'proxy', proxyId], opts).PrintProxies(proxyId);
85
+ });
86
+
87
+ program
88
+ .command('renderer')
89
+ .description('get a renderer')
90
+ .argument('<rendererId>', 'id of the renderer to get')
91
+ .addHelpText(
92
+ 'after',
93
+ `
94
+ Example call:
95
+ > get renderer contensis-website
96
+ `
97
+ )
98
+ .action(async (rendererId: string, opts) => {
99
+ await cliCommand(['get', 'renderer', rendererId], opts).PrintRenderers(
100
+ rendererId
101
+ );
102
+ });
103
+
70
104
  program
71
105
  .command('role')
72
106
  .description('get a role')
@@ -124,11 +158,8 @@ Example call:
124
158
  .command('model')
125
159
  .description('get a content model')
126
160
  .argument('<contentTypeId...>', 'ids of the content models to get')
127
- .option('--required-by', 'shows the id(s) that created each dependency')
128
- .option(
129
- '--export',
130
- 'export the raw resources that make up the content model(s) (used with --output)'
131
- )
161
+ .addOption(requiredBy)
162
+ .addOption(exportOption)
132
163
  .addOption(noCache)
133
164
  .addHelpText(
134
165
  'after',
@@ -90,6 +90,16 @@ const sharedSecret = new Option(
90
90
  'the shared secret to use when logging in with a client id'
91
91
  );
92
92
 
93
+ /* Model get options */
94
+ export const requiredBy = new Option(
95
+ '--required-by',
96
+ 'shows the id(s) that created each dependency'
97
+ );
98
+ export const exportOption = new Option(
99
+ '--export',
100
+ 'export the raw resources that make up the content model(s) (used with --output)'
101
+ );
102
+
93
103
  /* Entry get options */
94
104
  export const delivery = new Option(
95
105
  '-delivery --delivery-api',
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import { cliCommand } from '~/services/ContensisCliService';
3
- import { mapContensisOpts, noCache } from './globalOptions';
3
+ import { exportOption, mapContensisOpts, noCache } from './globalOptions';
4
4
 
5
5
  export const makeListCommand = () => {
6
6
  const list = new Command()
@@ -41,6 +41,7 @@ Example call:
41
41
  list
42
42
  .command('models')
43
43
  .description('print list of content models')
44
+ .addOption(exportOption)
44
45
  .addOption(noCache)
45
46
  .addHelpText(
46
47
  'after',
@@ -54,7 +55,7 @@ Example call:
54
55
  ['list', 'models'],
55
56
  opts,
56
57
  mapContensisOpts(opts)
57
- ).PrintContentModels();
58
+ ).PrintContentModels([], opts);
58
59
  });
59
60
 
60
61
  list
@@ -1260,38 +1260,45 @@ class ContensisCli {
1260
1260
  );
1261
1261
  log.raw('');
1262
1262
  if (models?.length) {
1263
- await this.HandleFormattingAndOutput(exportResources, () => {
1264
- // print the content models to console
1265
- for (const model of models) {
1266
- const components = model.components?.length || 0;
1267
- const contentTypes = model.contentTypes?.length || 0;
1268
- const dependencies =
1269
- (model.dependencies?.components?.length || 0) +
1270
- (model.dependencies?.contentTypes?.length || 0);
1271
- const dependencyOf =
1272
- (model.dependencyOf?.components?.length || 0) +
1273
- (model.dependencyOf?.contentTypes?.length || 0);
1274
-
1275
- const hasAny =
1276
- components + contentTypes + dependencies + dependencyOf;
1277
- log.raw(
1278
- ` - ${log.highlightText(log.boldText(model.id))} ${
1279
- hasAny
1280
- ? log.infoText(
1281
- `{ ${components ? `components: ${components}, ` : ''}${
1282
- contentTypes ? `contentTypes: ${contentTypes}, ` : ''
1283
- }${
1284
- dependencies ? `references: ${dependencies}, ` : ''
1285
- }${
1286
- dependencyOf ? `required by: ${dependencyOf}` : ''
1287
- } }`
1288
- )
1289
- : ''
1290
- }`
1291
- );
1263
+ await this.HandleFormattingAndOutput(
1264
+ opts.export ? exportResources : models,
1265
+ () => {
1266
+ // print the content models to console
1267
+ for (const model of models) {
1268
+ const components = model.components?.length || 0;
1269
+ const contentTypes = model.contentTypes?.length || 0;
1270
+ const dependencies =
1271
+ (model.dependencies?.components?.length || 0) +
1272
+ (model.dependencies?.contentTypes?.length || 0);
1273
+ const dependencyOf =
1274
+ (model.dependencyOf?.components?.length || 0) +
1275
+ (model.dependencyOf?.contentTypes?.length || 0);
1276
+
1277
+ const hasAny =
1278
+ components + contentTypes + dependencies + dependencyOf;
1279
+ log.raw(
1280
+ ` - ${log.highlightText(log.boldText(model.id))} ${
1281
+ hasAny
1282
+ ? log.infoText(
1283
+ `{ ${
1284
+ components ? `components: ${components}, ` : ''
1285
+ }${
1286
+ contentTypes
1287
+ ? `contentTypes: ${contentTypes}, `
1288
+ : ''
1289
+ }${
1290
+ dependencies ? `references: ${dependencies}, ` : ''
1291
+ }${
1292
+ dependencyOf ? `required by: ${dependencyOf}` : ''
1293
+ } }`
1294
+ )
1295
+ : ''
1296
+ }`
1297
+ );
1298
+ }
1299
+ log.raw('');
1292
1300
  }
1293
- log.raw('');
1294
- });
1301
+ );
1295
1302
  }
1296
1303
  }
1297
1304
  }
@@ -140,6 +140,14 @@ export class Logger {
140
140
  ' | '
141
141
  )}`
142
142
  : ''
143
+ }${
144
+ field.dataFormat === 'contenttype'
145
+ ? `[${field.validations?.allowedDataFormats.dataFormats.join(
146
+ ' | '
147
+ )}], ${(
148
+ field.validations?.allowedIds?.ids || ['*']
149
+ ).join(' | ')}`
150
+ : ''
143
151
  }>`
144
152
  : ''
145
153
  }${
@@ -195,7 +203,10 @@ export class Logger {
195
203
  if (item.length)
196
204
  Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));
197
205
  else Logger.objectRecurse(item, depth + 1, `${indent} `);
198
- else Logger.raw(`${indent}${chalk.grey(`[`)}${item.join(', ')}${chalk.grey(`]`)}`);
206
+ else
207
+ Logger.raw(
208
+ `${indent}${chalk.grey(`[`)}${item.join(', ')}${chalk.grey(`]`)}`
209
+ );
199
210
  } else Logger.raw(`${indent}${item}`);
200
211
  }
201
212
  } else {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.2.2-beta.11";
1
+ export const LIB_VERSION = "1.2.2-beta.12";