contensis-cli 1.0.0-beta.53 → 1.0.0-beta.54
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.
- package/.vscode/launch.json +15 -15
- package/README.md +1226 -1226
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/globalOptions.js.map +1 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/set.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/localisation/en-GB.js.map +1 -1
- package/dist/providers/CredentialProvider.js.map +1 -1
- package/dist/providers/SessionCacheProvider.js.map +1 -1
- package/dist/providers/file-provider.js.map +1 -1
- package/dist/services/ContensisAuthService.js.map +1 -1
- package/dist/services/ContensisCliService.js.map +1 -1
- package/dist/shell.js.map +1 -1
- package/dist/util/console.printer.js +5 -5
- package/dist/util/console.printer.js.map +2 -2
- package/dist/util/csv.formatter.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/json.formatter.js.map +1 -1
- package/dist/util/logger.js.map +1 -1
- package/dist/util/xml.formatter.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/esbuild.config.js +49 -49
- package/headless-setup.sh +6 -6
- package/package.json +59 -59
- package/src/commands/connect.ts +24 -24
- package/src/commands/create.ts +70 -70
- package/src/commands/diff.ts +41 -41
- package/src/commands/get.ts +214 -214
- package/src/commands/globalOptions.ts +127 -127
- package/src/commands/import.ts +128 -128
- package/src/commands/index.ts +80 -80
- package/src/commands/list.ts +116 -116
- package/src/commands/login.ts +34 -34
- package/src/commands/push.ts +127 -127
- package/src/commands/release.ts +32 -32
- package/src/commands/remove.ts +85 -85
- package/src/commands/set.ts +96 -96
- package/src/index.ts +19 -19
- package/src/localisation/en-GB.ts +289 -289
- package/src/models/AppError.d.ts +40 -40
- package/src/models/Cache.d.ts +25 -25
- package/src/models/JsModules.d.ts +1 -1
- package/src/providers/CredentialProvider.ts +121 -121
- package/src/providers/SessionCacheProvider.ts +101 -101
- package/src/providers/file-provider.ts +76 -76
- package/src/services/ContensisAuthService.ts +70 -70
- package/src/services/ContensisCliService.ts +1745 -1745
- package/src/shell.ts +270 -270
- package/src/util/console.printer.ts +371 -371
- package/src/util/csv.formatter.ts +21 -21
- package/src/util/index.ts +73 -73
- package/src/util/json.formatter.ts +1 -1
- package/src/util/logger.ts +234 -234
- package/src/util/xml.formatter.ts +20 -20
- package/src/version.ts +1 -1
- package/tsconfig.json +22 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/json.formatter.ts"],
|
|
4
|
-
"sourcesContent": ["export const jsonFormatter = <T>(obj: T) => JSON.stringify(obj, null, 2);\
|
|
4
|
+
"sourcesContent": ["export const jsonFormatter = <T>(obj: T) => JSON.stringify(obj, null, 2);\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,gBAAgB,CAAI,QAAW,KAAK,UAAU,KAAK,MAAM,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/util/logger.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/logger.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-console */\
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport ProgressBar from 'progress';\nimport { tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any) => 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) => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err ? `\\n\\n${JSON.stringify(err, null, 2)}` : ''\n }`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n // if (process.env.DEBUG === 'true') {\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 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 Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else Logger.raw(`${indent}${item}`);\n }\n } else\n for (const [key, value] of Object.entries(content)) {\n if (Array.isArray(value)) {\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(`${indent}${chalk.bold.grey(key)}: ${value}`);\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\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 ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}`);\n });\n //Logger.line();\n return null;\n};\n\nexport const progress = {\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
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,wBAAuB;AACvB,0BAAwB;AACxB,sBAAwB;AACxB,eAA6B;AAatB,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,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AAI,KAAK,OAAO,SAAS,MAAM,KAAK,GAAG;AACpE,QAAI,UAAU;AACZ,aAAO,IAAI,KAAK,OAAO,aAAS,uBAAa,MAAM,IAAI,CAAC,GAAG;AAAA,EAC/D,CAAC;AAED,SAAO;AACT;AAEO,MAAM,WAAW;AAAA,EACtB,QAAQ;AAAA,EACR,MAAM,MAAM,IAAI,gBAAAE,QAAY,IAAI,CAAC;AAAA,EACjC,SAAS,EAAE,OAAO,oBAAwB,KAAK,mBAAuB;AAAA,EACtE,SAAS,IAAI,gBAAAA,QAAY,QAAQ;AAAA,IAC/B,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,OAAO;AAAA,EACT,CAAC;AACH;",
|
|
6
6
|
"names": ["dateFormat", "chalk", "deepCleaner", "ProgressBar"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/xml.formatter.ts"],
|
|
4
|
-
"sourcesContent": ["import xml2js from 'xml2js';\
|
|
4
|
+
"sourcesContent": ["import xml2js from 'xml2js';\nimport cleaner from 'deep-cleaner';\nimport { Logger } from './logger';\n\nexport const xmlFormatter = <T>(entries: T | T[]) => {\n try {\n const cleanedEntries = cleaner(cleaner(entries, ['workflow']));\n\n const builder = new xml2js.Builder({\n cdata: true,\n rootName: 'Items',\n });\n const xml = builder.buildObject({ Entry: cleanedEntries });\n\n return xml;\n } catch (ex) {\n Logger.error(`Problem building XML from entries`, ex);\n return '';\n }\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,0BAAoB;AACpB,oBAAuB;AAEhB,MAAM,eAAe,CAAI,YAAqB;AACnD,MAAI;AACF,UAAM,qBAAiB,oBAAAA,aAAQ,oBAAAA,SAAQ,SAAS,CAAC,UAAU,CAAC,CAAC;AAE7D,UAAM,UAAU,IAAI,cAAAC,QAAO,QAAQ;AAAA,MACjC,OAAO;AAAA,MACP,UAAU;AAAA,IACZ,CAAC;AACD,UAAM,MAAM,QAAQ,YAAY,EAAE,OAAO,eAAe,CAAC;AAEzD,WAAO;AAAA,EACT,SAAS,IAAP;AACA,yBAAO,MAAM,qCAAqC,EAAE;AACpD,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": ["cleaner", "xml2js"]
|
|
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.0.0-beta.
|
|
24
|
+
const LIB_VERSION = "1.0.0-beta.54";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIB_VERSION
|
package/dist/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.54\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/esbuild.config.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
const rimraf = require('rimraf');
|
|
2
|
-
const esbuild = require('esbuild');
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const { globPlugin } = require('esbuild-plugin-glob');
|
|
5
|
-
const { nodeExternalsPlugin } = require('esbuild-node-externals');
|
|
6
|
-
const { replaceTscAliasPaths } = require('tsc-alias');
|
|
7
|
-
|
|
8
|
-
const watch = !!process.argv.includes('--watch');
|
|
9
|
-
const completed = `${chalk.green('[contensis-cli]')} Build successful 👍\n`;
|
|
10
|
-
|
|
11
|
-
console.time(completed);
|
|
12
|
-
console.time(' - rimraf complete');
|
|
13
|
-
|
|
14
|
-
rimraf('./dist', () => {
|
|
15
|
-
console.timeEnd(' - rimraf complete');
|
|
16
|
-
console.time(' - esbuild complete');
|
|
17
|
-
esbuild
|
|
18
|
-
.build({
|
|
19
|
-
entryPoints: ['src/**/*.[jt]s'],
|
|
20
|
-
outdir: 'dist',
|
|
21
|
-
bundle: false,
|
|
22
|
-
minify: false,
|
|
23
|
-
platform: 'node',
|
|
24
|
-
format: 'cjs',
|
|
25
|
-
sourcemap: true,
|
|
26
|
-
target: 'node16',
|
|
27
|
-
plugins: [globPlugin(), nodeExternalsPlugin()],
|
|
28
|
-
watch: watch && {
|
|
29
|
-
onRebuild(error) {
|
|
30
|
-
if (error) console.error('esbuild watch build failed:', error);
|
|
31
|
-
else
|
|
32
|
-
console.log(
|
|
33
|
-
'esbuild watch build succeeded, waiting for changes...'
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
.then(() => {
|
|
39
|
-
console.timeEnd(' - esbuild complete');
|
|
40
|
-
console.time(' - replace alias paths');
|
|
41
|
-
replaceTscAliasPaths();
|
|
42
|
-
console.timeEnd(' - replace alias paths');
|
|
43
|
-
console.timeEnd(completed);
|
|
44
|
-
})
|
|
45
|
-
.catch(error => {
|
|
46
|
-
console.error(error);
|
|
47
|
-
process.exit(1);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
1
|
+
const rimraf = require('rimraf');
|
|
2
|
+
const esbuild = require('esbuild');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const { globPlugin } = require('esbuild-plugin-glob');
|
|
5
|
+
const { nodeExternalsPlugin } = require('esbuild-node-externals');
|
|
6
|
+
const { replaceTscAliasPaths } = require('tsc-alias');
|
|
7
|
+
|
|
8
|
+
const watch = !!process.argv.includes('--watch');
|
|
9
|
+
const completed = `${chalk.green('[contensis-cli]')} Build successful 👍\n`;
|
|
10
|
+
|
|
11
|
+
console.time(completed);
|
|
12
|
+
console.time(' - rimraf complete');
|
|
13
|
+
|
|
14
|
+
rimraf('./dist', () => {
|
|
15
|
+
console.timeEnd(' - rimraf complete');
|
|
16
|
+
console.time(' - esbuild complete');
|
|
17
|
+
esbuild
|
|
18
|
+
.build({
|
|
19
|
+
entryPoints: ['src/**/*.[jt]s'],
|
|
20
|
+
outdir: 'dist',
|
|
21
|
+
bundle: false,
|
|
22
|
+
minify: false,
|
|
23
|
+
platform: 'node',
|
|
24
|
+
format: 'cjs',
|
|
25
|
+
sourcemap: true,
|
|
26
|
+
target: 'node16',
|
|
27
|
+
plugins: [globPlugin(), nodeExternalsPlugin()],
|
|
28
|
+
watch: watch && {
|
|
29
|
+
onRebuild(error) {
|
|
30
|
+
if (error) console.error('esbuild watch build failed:', error);
|
|
31
|
+
else
|
|
32
|
+
console.log(
|
|
33
|
+
'esbuild watch build succeeded, waiting for changes...'
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
.then(() => {
|
|
39
|
+
console.timeEnd(' - esbuild complete');
|
|
40
|
+
console.time(' - replace alias paths');
|
|
41
|
+
replaceTscAliasPaths();
|
|
42
|
+
console.timeEnd(' - replace alias paths');
|
|
43
|
+
console.timeEnd(completed);
|
|
44
|
+
})
|
|
45
|
+
.catch(error => {
|
|
46
|
+
console.error(error);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
});
|
|
49
|
+
});
|
package/headless-setup.sh
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# https://github.com/bitwarden/directory-connector/issues/17#issuecomment-499935581
|
|
3
|
-
sudo apt-get update && sudo apt-get install -y libsecret-1-0 dbus-x11 gnome-keyring
|
|
4
|
-
export $(dbus-launch)
|
|
5
|
-
dbus-launch
|
|
6
|
-
gnome-keyring-daemon --start --daemonize --components=secrets
|
|
7
|
-
echo 'neil' | gnome-keyring-daemon -r -d --unlock
|
|
2
|
+
# https://github.com/bitwarden/directory-connector/issues/17#issuecomment-499935581
|
|
3
|
+
sudo apt-get update && sudo apt-get install -y libsecret-1-0 dbus-x11 gnome-keyring
|
|
4
|
+
export $(dbus-launch)
|
|
5
|
+
dbus-launch
|
|
6
|
+
gnome-keyring-daemon --start --daemonize --components=secrets
|
|
7
|
+
echo 'neil' | gnome-keyring-daemon -r -d --unlock
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "contensis-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
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
|
-
"repository": "https://github.com/contensis/node-cli",
|
|
6
|
-
"homepage": "https://github.com/contensis/node-cli/tree/main/packages/contensis-cli#readme",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"bin": {
|
|
9
|
-
"contensis": "./cli.js",
|
|
10
|
-
"contensis-cli": "./cli.js"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"prestart": "npm run build",
|
|
14
|
-
"start": "npm run cli",
|
|
15
|
-
"dev:shell": "npm run prestart && nodemon --watch dist --inspect=9229 ./dist/shell.js",
|
|
16
|
-
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
17
|
-
"build": "node esbuild.config.js",
|
|
18
|
-
"build:watch": "node esbuild.config.js --watch",
|
|
19
|
-
"cli": "node --inspect=9229 ./cli.js",
|
|
20
|
-
"postinstall": "npx patch-package",
|
|
21
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
-
},
|
|
23
|
-
"author": "Zengenti",
|
|
24
|
-
"license": "ISC",
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"app-root-path": "^3.1.0",
|
|
27
|
-
"chalk": "^4.1.2",
|
|
28
|
-
"commander": "^9.4.1",
|
|
29
|
-
"csv": "^6.1.0",
|
|
30
|
-
"dayjs": "^1.11.6",
|
|
31
|
-
"figlet": "^1.5.2",
|
|
32
|
-
"flat": "^5.0.2",
|
|
33
|
-
"inquirer-command-prompt": "^0.1.0",
|
|
34
|
-
"json2csv": "^5.0.7",
|
|
35
|
-
"jsonpath-mapper": "^1.1.0",
|
|
36
|
-
"keytar": "^7.9.0",
|
|
37
|
-
"lodash": "^4.17.21",
|
|
38
|
-
"migratortron": "^1.0.0-beta.21",
|
|
39
|
-
"node-fetch": "^2.6.7",
|
|
40
|
-
"patch-package": "^6.4.7",
|
|
41
|
-
"xml2js": "^0.4.23"
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@types/figlet": "^1.5.4",
|
|
45
|
-
"@types/flat": "^5.0.2",
|
|
46
|
-
"@types/inquirer": "^8.2.1",
|
|
47
|
-
"@types/json2csv": "^5.0.3",
|
|
48
|
-
"@types/lodash": "^4.14.182",
|
|
49
|
-
"@types/node-fetch": "^2.6.1",
|
|
50
|
-
"@types/xml2js": "^0.4.11",
|
|
51
|
-
"esbuild": "^0.14.43",
|
|
52
|
-
"esbuild-node-externals": "^1.4.1",
|
|
53
|
-
"esbuild-plugin-glob": "^1.1.2",
|
|
54
|
-
"nodemon": "^2.0.18",
|
|
55
|
-
"rimraf": "^3.0.2",
|
|
56
|
-
"tsc-alias": "^1.6.9",
|
|
57
|
-
"typescript": "^4.7.3"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "contensis-cli",
|
|
3
|
+
"version": "1.0.0-beta.54",
|
|
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
|
+
"repository": "https://github.com/contensis/node-cli",
|
|
6
|
+
"homepage": "https://github.com/contensis/node-cli/tree/main/packages/contensis-cli#readme",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"contensis": "./cli.js",
|
|
10
|
+
"contensis-cli": "./cli.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"prestart": "npm run build",
|
|
14
|
+
"start": "npm run cli",
|
|
15
|
+
"dev:shell": "npm run prestart && nodemon --watch dist --inspect=9229 ./dist/shell.js",
|
|
16
|
+
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
17
|
+
"build": "node esbuild.config.js",
|
|
18
|
+
"build:watch": "node esbuild.config.js --watch",
|
|
19
|
+
"cli": "node --inspect=9229 ./cli.js",
|
|
20
|
+
"postinstall": "npx patch-package",
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
+
},
|
|
23
|
+
"author": "Zengenti",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"app-root-path": "^3.1.0",
|
|
27
|
+
"chalk": "^4.1.2",
|
|
28
|
+
"commander": "^9.4.1",
|
|
29
|
+
"csv": "^6.1.0",
|
|
30
|
+
"dayjs": "^1.11.6",
|
|
31
|
+
"figlet": "^1.5.2",
|
|
32
|
+
"flat": "^5.0.2",
|
|
33
|
+
"inquirer-command-prompt": "^0.1.0",
|
|
34
|
+
"json2csv": "^5.0.7",
|
|
35
|
+
"jsonpath-mapper": "^1.1.0",
|
|
36
|
+
"keytar": "^7.9.0",
|
|
37
|
+
"lodash": "^4.17.21",
|
|
38
|
+
"migratortron": "^1.0.0-beta.21",
|
|
39
|
+
"node-fetch": "^2.6.7",
|
|
40
|
+
"patch-package": "^6.4.7",
|
|
41
|
+
"xml2js": "^0.4.23"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/figlet": "^1.5.4",
|
|
45
|
+
"@types/flat": "^5.0.2",
|
|
46
|
+
"@types/inquirer": "^8.2.1",
|
|
47
|
+
"@types/json2csv": "^5.0.3",
|
|
48
|
+
"@types/lodash": "^4.14.182",
|
|
49
|
+
"@types/node-fetch": "^2.6.1",
|
|
50
|
+
"@types/xml2js": "^0.4.11",
|
|
51
|
+
"esbuild": "^0.14.43",
|
|
52
|
+
"esbuild-node-externals": "^1.4.1",
|
|
53
|
+
"esbuild-plugin-glob": "^1.1.2",
|
|
54
|
+
"nodemon": "^2.0.18",
|
|
55
|
+
"rimraf": "^3.0.2",
|
|
56
|
+
"tsc-alias": "^1.6.9",
|
|
57
|
+
"typescript": "^4.7.3"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/commands/connect.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
-
import { shell } from '~/shell';
|
|
4
|
-
import { project } from './globalOptions';
|
|
5
|
-
|
|
6
|
-
export const makeConnectCommand = () => {
|
|
7
|
-
const connect = new Command()
|
|
8
|
-
.command('connect')
|
|
9
|
-
.description('connect to a Contensis instance')
|
|
10
|
-
.argument('<alias>', 'the Contensis Cloud alias to connect with')
|
|
11
|
-
.addOption(project)
|
|
12
|
-
.usage('<alias>')
|
|
13
|
-
.addHelpText(
|
|
14
|
-
'after',
|
|
15
|
-
`
|
|
16
|
-
Example call:
|
|
17
|
-
> connect example-dev`
|
|
18
|
-
)
|
|
19
|
-
.action(async (alias, opts) => {
|
|
20
|
-
await cliCommand(['connect', alias], { ...opts, alias }).Connect(alias);
|
|
21
|
-
await shell().restart();
|
|
22
|
-
});
|
|
23
|
-
return connect;
|
|
24
|
-
};
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
import { shell } from '~/shell';
|
|
4
|
+
import { project } from './globalOptions';
|
|
5
|
+
|
|
6
|
+
export const makeConnectCommand = () => {
|
|
7
|
+
const connect = new Command()
|
|
8
|
+
.command('connect')
|
|
9
|
+
.description('connect to a Contensis instance')
|
|
10
|
+
.argument('<alias>', 'the Contensis Cloud alias to connect with')
|
|
11
|
+
.addOption(project)
|
|
12
|
+
.usage('<alias>')
|
|
13
|
+
.addHelpText(
|
|
14
|
+
'after',
|
|
15
|
+
`
|
|
16
|
+
Example call:
|
|
17
|
+
> connect example-dev`
|
|
18
|
+
)
|
|
19
|
+
.action(async (alias, opts) => {
|
|
20
|
+
await cliCommand(['connect', alias], { ...opts, alias }).Connect(alias);
|
|
21
|
+
await shell().restart();
|
|
22
|
+
});
|
|
23
|
+
return connect;
|
|
24
|
+
};
|
package/src/commands/create.ts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { Project } from 'contensis-core-api';
|
|
3
|
-
import { cliCommand } from '~/services/ContensisCliService';
|
|
4
|
-
import { shell } from '~/shell';
|
|
5
|
-
|
|
6
|
-
export const makeCreateCommand = () => {
|
|
7
|
-
const create = new Command()
|
|
8
|
-
.command('create')
|
|
9
|
-
.description('create command')
|
|
10
|
-
.addHelpText('after', `\n`)
|
|
11
|
-
.showHelpAfterError(true)
|
|
12
|
-
.exitOverride();
|
|
13
|
-
|
|
14
|
-
create
|
|
15
|
-
.command('project')
|
|
16
|
-
.description('create a new project')
|
|
17
|
-
.argument('<projectId>', 'the id of the project to create')
|
|
18
|
-
.argument('<name>', 'the name of the project to create')
|
|
19
|
-
.argument('[description]', 'optional description of the project')
|
|
20
|
-
.option(
|
|
21
|
-
'-l, --language',
|
|
22
|
-
'the default language of the project to create',
|
|
23
|
-
'en-GB'
|
|
24
|
-
)
|
|
25
|
-
.option(
|
|
26
|
-
'-langs, --supported-languages <langs...>',
|
|
27
|
-
'space separated list of other supported languages'
|
|
28
|
-
)
|
|
29
|
-
.usage(
|
|
30
|
-
'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
|
|
31
|
-
)
|
|
32
|
-
.addHelpText('after', `\n`)
|
|
33
|
-
.action(
|
|
34
|
-
async (projectId: string, name: string, description = '', opts: any) => {
|
|
35
|
-
const createProject: Project = {
|
|
36
|
-
id: projectId,
|
|
37
|
-
name,
|
|
38
|
-
description,
|
|
39
|
-
primaryLanguage: opts.language,
|
|
40
|
-
supportedLanguages: opts.supportedLanguages || [],
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const project = await cliCommand(
|
|
44
|
-
['create', 'project', projectId],
|
|
45
|
-
opts
|
|
46
|
-
).CreateProject(createProject);
|
|
47
|
-
if (project) await shell().restart();
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
create
|
|
51
|
-
.command('key')
|
|
52
|
-
.description('create a new api key')
|
|
53
|
-
.argument('<"key name">', 'the name of the key to create')
|
|
54
|
-
.argument('["description"]', 'provide a description for the key (optional)')
|
|
55
|
-
.usage('<"key name"> ["description"] (both args in "double quotes")')
|
|
56
|
-
.addHelpText(
|
|
57
|
-
'after',
|
|
58
|
-
`
|
|
59
|
-
Example call:
|
|
60
|
-
> create key "my new key" "Created key for demonstration"\n`
|
|
61
|
-
)
|
|
62
|
-
.action(async (name: string, description: string, opts: any) => {
|
|
63
|
-
await cliCommand(['create', 'key', name], opts).CreateApiKey(
|
|
64
|
-
name,
|
|
65
|
-
description
|
|
66
|
-
);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return create;
|
|
70
|
-
};
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Project } from 'contensis-core-api';
|
|
3
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
4
|
+
import { shell } from '~/shell';
|
|
5
|
+
|
|
6
|
+
export const makeCreateCommand = () => {
|
|
7
|
+
const create = new Command()
|
|
8
|
+
.command('create')
|
|
9
|
+
.description('create command')
|
|
10
|
+
.addHelpText('after', `\n`)
|
|
11
|
+
.showHelpAfterError(true)
|
|
12
|
+
.exitOverride();
|
|
13
|
+
|
|
14
|
+
create
|
|
15
|
+
.command('project')
|
|
16
|
+
.description('create a new project')
|
|
17
|
+
.argument('<projectId>', 'the id of the project to create')
|
|
18
|
+
.argument('<name>', 'the name of the project to create')
|
|
19
|
+
.argument('[description]', 'optional description of the project')
|
|
20
|
+
.option(
|
|
21
|
+
'-l, --language',
|
|
22
|
+
'the default language of the project to create',
|
|
23
|
+
'en-GB'
|
|
24
|
+
)
|
|
25
|
+
.option(
|
|
26
|
+
'-langs, --supported-languages <langs...>',
|
|
27
|
+
'space separated list of other supported languages'
|
|
28
|
+
)
|
|
29
|
+
.usage(
|
|
30
|
+
'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
|
|
31
|
+
)
|
|
32
|
+
.addHelpText('after', `\n`)
|
|
33
|
+
.action(
|
|
34
|
+
async (projectId: string, name: string, description = '', opts: any) => {
|
|
35
|
+
const createProject: Project = {
|
|
36
|
+
id: projectId,
|
|
37
|
+
name,
|
|
38
|
+
description,
|
|
39
|
+
primaryLanguage: opts.language,
|
|
40
|
+
supportedLanguages: opts.supportedLanguages || [],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const project = await cliCommand(
|
|
44
|
+
['create', 'project', projectId],
|
|
45
|
+
opts
|
|
46
|
+
).CreateProject(createProject);
|
|
47
|
+
if (project) await shell().restart();
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
create
|
|
51
|
+
.command('key')
|
|
52
|
+
.description('create a new api key')
|
|
53
|
+
.argument('<"key name">', 'the name of the key to create')
|
|
54
|
+
.argument('["description"]', 'provide a description for the key (optional)')
|
|
55
|
+
.usage('<"key name"> ["description"] (both args in "double quotes")')
|
|
56
|
+
.addHelpText(
|
|
57
|
+
'after',
|
|
58
|
+
`
|
|
59
|
+
Example call:
|
|
60
|
+
> create key "my new key" "Created key for demonstration"\n`
|
|
61
|
+
)
|
|
62
|
+
.action(async (name: string, description: string, opts: any) => {
|
|
63
|
+
await cliCommand(['create', 'key', name], opts).CreateApiKey(
|
|
64
|
+
name,
|
|
65
|
+
description
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return create;
|
|
70
|
+
};
|
package/src/commands/diff.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
-
import { mapContensisOpts } from './globalOptions';
|
|
4
|
-
|
|
5
|
-
export const makeDiffCommand = () => {
|
|
6
|
-
const release = new Command()
|
|
7
|
-
.command('diff')
|
|
8
|
-
.description('diff command')
|
|
9
|
-
.addHelpText('after', `\n`)
|
|
10
|
-
.showHelpAfterError(true)
|
|
11
|
-
.exitOverride();
|
|
12
|
-
|
|
13
|
-
release
|
|
14
|
-
.command('models')
|
|
15
|
-
.description('differences with content models')
|
|
16
|
-
.argument(
|
|
17
|
-
'[model-ids...]',
|
|
18
|
-
'ids of any content types or components to diff (optional)'
|
|
19
|
-
)
|
|
20
|
-
.usage('[model-ids...]')
|
|
21
|
-
.addHelpText(
|
|
22
|
-
'after',
|
|
23
|
-
`
|
|
24
|
-
Example call:
|
|
25
|
-
> diff models blogPost\n`
|
|
26
|
-
)
|
|
27
|
-
.action(async (modelIds: string[] = [], opts) => {
|
|
28
|
-
await cliCommand(
|
|
29
|
-
['diff', 'models', modelIds.join(' ')],
|
|
30
|
-
opts,
|
|
31
|
-
mapContensisOpts({ modelIds, ...opts })
|
|
32
|
-
).DiffModels(
|
|
33
|
-
{
|
|
34
|
-
...opts,
|
|
35
|
-
},
|
|
36
|
-
modelIds
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return release;
|
|
41
|
-
};
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
import { mapContensisOpts } from './globalOptions';
|
|
4
|
+
|
|
5
|
+
export const makeDiffCommand = () => {
|
|
6
|
+
const release = new Command()
|
|
7
|
+
.command('diff')
|
|
8
|
+
.description('diff command')
|
|
9
|
+
.addHelpText('after', `\n`)
|
|
10
|
+
.showHelpAfterError(true)
|
|
11
|
+
.exitOverride();
|
|
12
|
+
|
|
13
|
+
release
|
|
14
|
+
.command('models')
|
|
15
|
+
.description('differences with content models')
|
|
16
|
+
.argument(
|
|
17
|
+
'[model-ids...]',
|
|
18
|
+
'ids of any content types or components to diff (optional)'
|
|
19
|
+
)
|
|
20
|
+
.usage('[model-ids...]')
|
|
21
|
+
.addHelpText(
|
|
22
|
+
'after',
|
|
23
|
+
`
|
|
24
|
+
Example call:
|
|
25
|
+
> diff models blogPost\n`
|
|
26
|
+
)
|
|
27
|
+
.action(async (modelIds: string[] = [], opts) => {
|
|
28
|
+
await cliCommand(
|
|
29
|
+
['diff', 'models', modelIds.join(' ')],
|
|
30
|
+
opts,
|
|
31
|
+
mapContensisOpts({ modelIds, ...opts })
|
|
32
|
+
).DiffModels(
|
|
33
|
+
{
|
|
34
|
+
...opts,
|
|
35
|
+
},
|
|
36
|
+
modelIds
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return release;
|
|
41
|
+
};
|