contensis-cli 1.0.12-beta.1 → 1.0.12-beta.3
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/dist/commands/globalOptions.js +1 -9
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +11 -4
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/index.js +2 -2
- package/dist/commands/index.js.map +2 -2
- package/dist/services/ContensisCliService.js +15 -41
- package/dist/services/ContensisCliService.js.map +3 -3
- package/dist/shell.js +2 -0
- package/dist/shell.js.map +2 -2
- package/dist/util/console.printer.js +106 -10
- package/dist/util/console.printer.js.map +3 -3
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/globalOptions.ts +1 -7
- package/src/commands/import.ts +18 -8
- package/src/commands/index.ts +2 -3
- package/src/services/ContensisCliService.ts +21 -52
- package/src/shell.ts +2 -0
- package/src/util/console.printer.ts +166 -11
- package/src/version.ts +1 -1
|
@@ -20,7 +20,6 @@ var globalOptions_exports = {};
|
|
|
20
20
|
__export(globalOptions_exports, {
|
|
21
21
|
addAuthenticationOptions: () => addAuthenticationOptions,
|
|
22
22
|
addConnectOptions: () => addConnectOptions,
|
|
23
|
-
addGetEntryOptions: () => addGetEntryOptions,
|
|
24
23
|
addGlobalOptions: () => addGlobalOptions,
|
|
25
24
|
addImportOptions: () => addImportOptions,
|
|
26
25
|
assetTypes: () => assetTypes,
|
|
@@ -123,17 +122,11 @@ const addAuthenticationOptions = (program) => program.addOption(user.hideHelp())
|
|
|
123
122
|
const addOutputAndFormatOptions = (program) => program.addOption(output).addOption(format);
|
|
124
123
|
const addImportOptions = (program) => {
|
|
125
124
|
for (const command of program.commands) {
|
|
126
|
-
command.addOption(
|
|
125
|
+
command.addOption(fromCms).addOption(fromProject).addOption(fromFile);
|
|
127
126
|
}
|
|
128
127
|
return program;
|
|
129
128
|
};
|
|
130
129
|
const getEntryOptions = (command) => command.addOption(entryId).addOption(zenql).addOption(contentTypes).addOption(assetTypes);
|
|
131
|
-
const addGetEntryOptions = (program) => {
|
|
132
|
-
for (const command of program.commands) {
|
|
133
|
-
getEntryOptions(command);
|
|
134
|
-
}
|
|
135
|
-
return program;
|
|
136
|
-
};
|
|
137
130
|
const addGlobalOptions = (program) => {
|
|
138
131
|
for (const command of program.commands) {
|
|
139
132
|
addOutputAndFormatOptions(command);
|
|
@@ -146,7 +139,6 @@ const addGlobalOptions = (program) => {
|
|
|
146
139
|
0 && (module.exports = {
|
|
147
140
|
addAuthenticationOptions,
|
|
148
141
|
addConnectOptions,
|
|
149
|
-
addGetEntryOptions,
|
|
150
142
|
addGlobalOptions,
|
|
151
143
|
addImportOptions,
|
|
152
144
|
assetTypes,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/globalOptions.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { url } from '~/util';\n\nexport const mapContensisOpts = (opts: any = {}) => ({\n source:\n opts.sourceAlias || opts.sourceProjectId\n ? {\n url: opts.sourceAlias\n ? url(opts.sourceAlias, 'website').cms\n : (undefined as any),\n project: opts.sourceProjectId || (undefined as any),\n }\n : undefined,\n models: opts.modelIds,\n query:\n opts.id ||\n opts.entryIds ||\n opts.phrase ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat\n ? {\n assetTypes: opts.assetType,\n contentTypeIds: opts.contentType,\n dataFormats: opts.dataFormat ? [opts.dataFormat] : undefined,\n fields: opts.fields,\n includeIds: opts.id || opts.entryIds,\n includePaths: opts.paths,\n orderBy: opts.orderBy,\n searchTerm: opts.phrase,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n});\n\n/* Output options */\nconst output = new Option(\n '-o --output <output>',\n 'save output to a file e.g. --output ./output.txt'\n);\n\nconst format = new Option(\n '-f --format <format>',\n 'format output as csv, json, xml or table (default)'\n).choices(['csv', 'json', 'xml', 'table']);\n\n/* Connect options */\nconst alias = new Option(\n '-a --alias <alias>',\n 'the cloud CMS alias to connect your request with'\n);\n\nexport const project = new Option(\n '-p --project-id <projectId>',\n 'the projectId to make your request with'\n);\n\n/* Authentication options */\nconst user = new Option(\n '-u --user <user>',\n 'the username to authenticate your request with'\n);\nconst password = new Option(\n '-pw --password <password>',\n 'the password to use to login with (optional/insecure)'\n);\nconst clientId = new Option(\n '-id --client-id <clientId>',\n 'the clientId to authenticate your request with'\n);\nconst sharedSecret = new Option(\n '-s --shared-secret <sharedSecret>',\n 'the shared secret to use when logging in with a client id'\n);\n\n/* Entry get options */\nexport const zenql = new Option(\n '-q --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n);\n\nexport const entryId = new Option('-i --id <id...>', 'the entry id(s) to get');\nexport const contentTypes = new Option(\n '-c --content-type <contentType...>',\n 'get entries of these content type(s)'\n);\nexport const assetTypes = new Option(\n '-at --asset-type <assetType...>',\n 'get assets of given content type(s) e.g. image word pdf'\n);\n\n/* Import options */\nexport const fromFile = new Option(\n '-file --from-file <fromFile>',\n 'file path to import asset(s) from'\n);\n\nexport const fromCms = new Option(\n '-source --source-alias <fromCms>',\n 'the cloud CMS alias to import asset(s) from'\n);\nexport const fromProject = new Option(\n '-sp --source-project-id <fromProject>',\n 'the id of the Contensis project to import asset(s) from (Default: [last connected project])'\n);\n\nexport const commit = new Option(\n '--commit',\n 'add this flag only after you have run a preview of the import and agree with the analysis'\n).default(false);\n\nexport const addConnectOptions = (program: Command) =>\n program.addOption(alias.hideHelp()).addOption(project.hideHelp());\n\nexport const addAuthenticationOptions = (program: Command) =>\n program\n .addOption(user.hideHelp())\n .addOption(password.hideHelp())\n .addOption(clientId.hideHelp())\n .addOption(sharedSecret.hideHelp());\n\nconst addOutputAndFormatOptions = (program: Command) =>\n program.addOption(output).addOption(format);\n\nexport const addImportOptions = (program: Command) => {\n for (const command of program.commands) {\n command.addOption(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { url } from '~/util';\n\nexport const mapContensisOpts = (opts: any = {}) => ({\n source:\n opts.sourceAlias || opts.sourceProjectId\n ? {\n url: opts.sourceAlias\n ? url(opts.sourceAlias, 'website').cms\n : (undefined as any),\n project: opts.sourceProjectId || (undefined as any),\n }\n : undefined,\n models: opts.modelIds,\n query:\n opts.id ||\n opts.entryIds ||\n opts.phrase ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat\n ? {\n assetTypes: opts.assetType,\n contentTypeIds: opts.contentType,\n dataFormats: opts.dataFormat ? [opts.dataFormat] : undefined,\n fields: opts.fields,\n includeIds: opts.id || opts.entryIds,\n includePaths: opts.paths,\n orderBy: opts.orderBy,\n searchTerm: opts.phrase,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n});\n\n/* Output options */\nconst output = new Option(\n '-o --output <output>',\n 'save output to a file e.g. --output ./output.txt'\n);\n\nconst format = new Option(\n '-f --format <format>',\n 'format output as csv, json, xml or table (default)'\n).choices(['csv', 'json', 'xml', 'table']);\n\n/* Connect options */\nconst alias = new Option(\n '-a --alias <alias>',\n 'the cloud CMS alias to connect your request with'\n);\n\nexport const project = new Option(\n '-p --project-id <projectId>',\n 'the projectId to make your request with'\n);\n\n/* Authentication options */\nconst user = new Option(\n '-u --user <user>',\n 'the username to authenticate your request with'\n);\nconst password = new Option(\n '-pw --password <password>',\n 'the password to use to login with (optional/insecure)'\n);\nconst clientId = new Option(\n '-id --client-id <clientId>',\n 'the clientId to authenticate your request with'\n);\nconst sharedSecret = new Option(\n '-s --shared-secret <sharedSecret>',\n 'the shared secret to use when logging in with a client id'\n);\n\n/* Entry get options */\nexport const zenql = new Option(\n '-q --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n);\n\nexport const entryId = new Option('-i --id <id...>', 'the entry id(s) to get');\nexport const contentTypes = new Option(\n '-c --content-type <contentType...>',\n 'get entries of these content type(s)'\n);\nexport const assetTypes = new Option(\n '-at --asset-type <assetType...>',\n 'get assets of given content type(s) e.g. image word pdf'\n);\n\n/* Import options */\nexport const fromFile = new Option(\n '-file --from-file <fromFile>',\n 'file path to import asset(s) from'\n);\n\nexport const fromCms = new Option(\n '-source --source-alias <fromCms>',\n 'the cloud CMS alias to import asset(s) from'\n);\nexport const fromProject = new Option(\n '-sp --source-project-id <fromProject>',\n 'the id of the Contensis project to import asset(s) from (Default: [last connected project])'\n);\n\nexport const commit = new Option(\n '--commit',\n 'add this flag only after you have run a preview of the import and agree with the analysis'\n).default(false);\n\nexport const addConnectOptions = (program: Command) =>\n program.addOption(alias.hideHelp()).addOption(project.hideHelp());\n\nexport const addAuthenticationOptions = (program: Command) =>\n program\n .addOption(user.hideHelp())\n .addOption(password.hideHelp())\n .addOption(clientId.hideHelp())\n .addOption(sharedSecret.hideHelp());\n\nconst addOutputAndFormatOptions = (program: Command) =>\n program.addOption(output).addOption(format);\n\nexport const addImportOptions = (program: Command) => {\n for (const command of program.commands) {\n command.addOption(fromCms).addOption(fromProject).addOption(fromFile);\n }\n return program;\n};\n\nexport const getEntryOptions = (command: Command) =>\n command\n .addOption(entryId)\n .addOption(zenql)\n .addOption(contentTypes)\n .addOption(assetTypes);\n\nexport const addGlobalOptions = (program: Command) => {\n for (const command of program.commands) {\n addOutputAndFormatOptions(command);\n addConnectOptions(command);\n addAuthenticationOptions(command);\n }\n return program;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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93
|
});
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
94
|
+
(0, import_globalOptions.getEntryOptions)(
|
|
95
|
+
program.command("entries").description("import entries").argument(
|
|
96
|
+
"[search phrase]",
|
|
97
|
+
"get entries with the search phrase, use quotes for multiple words"
|
|
98
|
+
)
|
|
97
99
|
).addOption(import_globalOptions.commit).option(
|
|
98
100
|
"-preserve --preserve-guids",
|
|
99
101
|
"include this flag when you are importing entries that you have previously exported and wish to update"
|
|
@@ -119,7 +121,12 @@ Example call:
|
|
|
119
121
|
logOutput: opts.outputEntries
|
|
120
122
|
});
|
|
121
123
|
});
|
|
122
|
-
program.command("nodes").description("import nodes").addOption(import_globalOptions.commit).
|
|
124
|
+
program.command("nodes").description("import nodes").addOption(import_globalOptions.commit).addOption(
|
|
125
|
+
new import_commander.Option(
|
|
126
|
+
"-on --output-nodes <outputNodes>",
|
|
127
|
+
"how much detail to output from the nodes import"
|
|
128
|
+
).choices(["errors", "changes", "all"]).default("errors")
|
|
129
|
+
).addHelpText(
|
|
123
130
|
"after",
|
|
124
131
|
`
|
|
125
132
|
Example call:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/import.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { commit, mapContensisOpts } from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json\n > import contenttypes {contentTypeIds} --source-alias example-dev\n`\n )\n .action(async (contentTypeIds: string[], opts) => {\n await cliCommand(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import components {componentIds} --from-file component-backup.json\n > import components {componentIds} --source-alias example-dev\n`\n )\n .action(async (componentIds: string[], opts) => {\n await cliCommand(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n program\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { commit, getEntryOptions, mapContensisOpts } from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json\n > import contenttypes {contentTypeIds} --source-alias example-dev\n`\n )\n .action(async (contentTypeIds: string[], opts) => {\n await cliCommand(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import components {componentIds} --from-file component-backup.json\n > import components {componentIds} --source-alias example-dev\n`\n )\n .action(async (componentIds: string[], opts) => {\n await cliCommand(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n getEntryOptions(\n program\n .command('entries')\n .description('import entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n )\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing entries that you have previously exported and wish to update'\n )\n .addOption(\n new Option(\n '-oe --output-entries <outputEntries>',\n 'which details of the entries included in the import to output'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n });\n });\n\n // TODO: add options to import one an array of nodes? nodeIds: string[]\n program\n .command('nodes')\n .description('import nodes')\n .addOption(commit)\n .addOption(\n new Option(\n '-on --output-nodes <outputNodes>',\n 'how much detail to output from the nodes import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes --from-file component-backup.json\n > import nodes --source-alias example-alias --source-project-id example-project\n`\n )\n .action(async opts => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputNodes,\n });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,2BAA0D;AAEnD,MAAM,oBAAoB,MAAM;AACrC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,QAAQ,EAChB,YAAY,gCAAgC,EAC5C,SAAS,iBAAiB,gDAAgD,EAC1E,UAAU,2BAAM,EAChB;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,OAAO,OAAO,UAAoB,SAAS;AAC1C,cAAM;AAAA,MACJ,CAAC,UAAU,UAAU,SAAS,KAAK,GAAG,CAAC;AAAA,MACvC;AAAA,UACA,uCAAiB,EAAE,UAAU,GAAG,KAAK,CAAC;AAAA,IACxC,EAAE,oBAAoB;AAAA,MACpB,UAAU,KAAK;AAAA,MACf,QAAQ,KAA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A,EAIF,EACC,OAAO,OAAO,QAAgB,MAAM,QAAQ;AAC3C,cAAM;AAAA,MACJ,CAAC,UAAU,SAAS;AAAA,MACpB;AAAA,UACA,uCAAiB,EAAE,QAAQ,GAAG,KAAK,CAAC;AAAA,IACtC,EAAE,cAAc;AAAA,MACd,QAAQ,KAAK;AAAA,MACb,UAAU,KAAK;AAAA,MACf,WAAW,KAAK;AAAA,IAClB,CAAC;AAAA,EACH,CAAC;AAGH,UACG,QAAQ,OAAO,EACf,YAAY,cAAc,EAC1B,UAAU,2BAAM,EAChB;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF,EACG,QAAQ,CAAC,UAAU,WAAW,KAAK,CAAC,EACpC,QAAQ,QAAQ;AAAA,EACrB,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,OAAO,OAAM,SAAQ;AACpB,cAAM;AAAA,MACJ,CAAC,UAAU,OAAO;AAAA,MAClB;AAAA,UACA,uCAAiB,EAAE,GAAG,KAAK,CAAC;AAAA,IAC9B,EAAE,YAAY;AAAA,MACZ,QAAQ,KAAK;AAAA,MACb,UAAU,KAAK;AAAA,MACf,WAAW,KAAK;AAAA,IAClB,CAAC;AAAA,EACH,CAAC;AAEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/index.js
CHANGED
|
@@ -67,7 +67,7 @@ const commands = () => {
|
|
|
67
67
|
);
|
|
68
68
|
program.addCommand(
|
|
69
69
|
(0, import_globalOptions.addGlobalOptions)(
|
|
70
|
-
(0, import_globalOptions.
|
|
70
|
+
(0, import_globalOptions.addImportOptions)((0, import_diff.makeDiffCommand)())
|
|
71
71
|
).copyInheritedSettings(program)
|
|
72
72
|
);
|
|
73
73
|
program.addCommand(
|
|
@@ -75,7 +75,7 @@ const commands = () => {
|
|
|
75
75
|
);
|
|
76
76
|
program.addCommand(
|
|
77
77
|
(0, import_globalOptions.addGlobalOptions)(
|
|
78
|
-
(0, import_globalOptions.
|
|
78
|
+
(0, import_globalOptions.addImportOptions)((0, import_import.makeImportCommand)())
|
|
79
79
|
).copyInheritedSettings(program)
|
|
80
80
|
);
|
|
81
81
|
program.addCommand(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCreateCommand } from './create';\nimport { makeDevCommand } from './dev';\nimport { makeDiffCommand } from './diff';\nimport { makeExecuteCommand } from './execute';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,oBAAuB;AACvB,qBAA4B;AAC5B,qBAAmC;AACnC,oBAAkC;AAClC,iBAA+B;AAC/B,kBAAgC;AAChC,qBAAmC;AACnC,iBAA+B;AAC/B,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCreateCommand } from './create';\nimport { makeDevCommand } from './dev';\nimport { makeDiffCommand } from './diff';\nimport { makeExecuteCommand } from './execute';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\n addGlobalOptions,\n addImportOptions,\n} from './globalOptions';\nimport { makeImportCommand } from './import';\nimport { makeListCommand } from './list';\nimport { makeLoginCommand } from './login';\nimport { makePushCommand } from './push';\nimport { makeRemoveCommand } from './remove';\nimport { makeSetCommand } from './set';\n\nconst commands = () => {\n const program = new Command()\n .name('contensis')\n .version(LIB_VERSION)\n .configureOutput({\n writeErr: str => {\n return str.toLowerCase().includes('error')\n ? Logger.error(`Command ${str}`)\n : str.trim() && Logger.help(str);\n },\n })\n .addHelpText(\n 'after',\n Logger.helpText`\n>> Each command has its own help - for example:\n > login --help\\n > get --help\n`\n )\n .exitOverride()\n .showHelpAfterError(true);\n\n program.addCommand(\n addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(\n addAuthenticationOptions(makeDevCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeExecuteCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(\n addImportOptions(makeDiffCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(\n addImportOptions(makeImportCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeListCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeLoginCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makePushCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeSetCommand()).copyInheritedSettings(program)\n );\n\n return program;\n};\n\nexport default commands;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,oBAAuB;AACvB,qBAA4B;AAC5B,qBAAmC;AACnC,oBAAkC;AAClC,iBAA+B;AAC/B,kBAAgC;AAChC,qBAAmC;AACnC,iBAA+B;AAC/B,2BAKO;AACP,oBAAkC;AAClC,kBAAgC;AAChC,mBAAiC;AACjC,kBAAgC;AAChC,oBAAkC;AAClC,iBAA+B;AAE/B,MAAM,WAAW,MAAM;AACrB,QAAM,UAAU,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AC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,4CAAkB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AAEA,SAAO;AACT;AAEA,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -688,9 +688,7 @@ class ContensisCli {
|
|
|
688
688
|
` ${import_chalk.default.bold.grey(
|
|
689
689
|
"contentTypes"
|
|
690
690
|
)}: ${permissions.contentTypes.map(
|
|
691
|
-
(p) => `${p.id} [${p.actions.join(",")}] ${p.languages.join(
|
|
692
|
-
" "
|
|
693
|
-
)}`
|
|
691
|
+
(p) => `${p.id} [${p.actions.join(",")}] ${p.languages.join(" ")}`
|
|
694
692
|
).join(", ")}`
|
|
695
693
|
);
|
|
696
694
|
}
|
|
@@ -1240,9 +1238,9 @@ Components:`));
|
|
|
1240
1238
|
const [err, result] = await contensis.DeleteEntries();
|
|
1241
1239
|
if (result)
|
|
1242
1240
|
this.HandleFormattingAndOutput(result, () => {
|
|
1243
|
-
(0, import_console.
|
|
1241
|
+
(0, import_console.printEntriesMigrateResult)(this, result, {
|
|
1244
1242
|
action: "delete",
|
|
1245
|
-
|
|
1243
|
+
showAll: true
|
|
1246
1244
|
});
|
|
1247
1245
|
});
|
|
1248
1246
|
if (!err && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && ((_a = result.migrateResult) == null ? void 0 : _a.deleted))) {
|
|
@@ -1270,11 +1268,11 @@ Components:`));
|
|
|
1270
1268
|
entries,
|
|
1271
1269
|
() => {
|
|
1272
1270
|
var _a;
|
|
1273
|
-
return (0, import_migratortron.
|
|
1271
|
+
return (0, import_migratortron.logEntitiesTable)({
|
|
1274
1272
|
entries,
|
|
1275
|
-
currentProject,
|
|
1276
|
-
(_a = contensis.payload.query) == null ? void 0 : _a.fields
|
|
1277
|
-
);
|
|
1273
|
+
projectId: currentProject,
|
|
1274
|
+
fields: (_a = contensis.payload.query) == null ? void 0 : _a.fields
|
|
1275
|
+
});
|
|
1278
1276
|
}
|
|
1279
1277
|
);
|
|
1280
1278
|
} else {
|
|
@@ -1306,9 +1304,9 @@ Components:`));
|
|
|
1306
1304
|
(0, import_logger.logError)(err);
|
|
1307
1305
|
else
|
|
1308
1306
|
this.HandleFormattingAndOutput(result, () => {
|
|
1309
|
-
(0, import_console.
|
|
1310
|
-
|
|
1311
|
-
|
|
1307
|
+
(0, import_console.printEntriesMigrateResult)(this, result, {
|
|
1308
|
+
showAll: logOutput === "all",
|
|
1309
|
+
showChanged: logOutput === "changes"
|
|
1312
1310
|
});
|
|
1313
1311
|
});
|
|
1314
1312
|
if (!err && !((_a = result.errors) == null ? void 0 : _a.length) && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && (((_b = result.migrateResult) == null ? void 0 : _b.created) || ((_c = result.migrateResult) == null ? void 0 : _c.updated)))) {
|
|
@@ -1347,32 +1345,8 @@ Components:`));
|
|
|
1347
1345
|
}
|
|
1348
1346
|
const root = contensis.content.sourceRepo.nodes.tree;
|
|
1349
1347
|
log.success(messages.nodes.get(currentProject, rootPath, depth));
|
|
1350
|
-
const outputNode = (node, spaces) => `${node.entry ? log.highlightText("e") : log.infoText("-")}${node.isCanonical ? log.highlightText("c") : log.infoText("-")}${node.includeInMenu ? log.highlightText("m") : log.infoText("-")}${spaces}${node.isCanonical ? log.boldText(`/${node.slug}`) : `/${node.slug}`}${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ""}${node.childCount ? ` +${node.childCount}` : ``} ${log.infoText(node.displayName)}`;
|
|
1351
1348
|
this.HandleFormattingAndOutput(root, () => {
|
|
1352
|
-
|
|
1353
|
-
log.raw("");
|
|
1354
|
-
log.info(
|
|
1355
|
-
`${log.highlightText("e")} = has entry; ${log.highlightText(
|
|
1356
|
-
"c"
|
|
1357
|
-
)} = canonical; ${log.highlightText("m")} = include in menu`
|
|
1358
|
-
);
|
|
1359
|
-
log.line();
|
|
1360
|
-
const outputChildren = (root2, depth2 = 2) => {
|
|
1361
|
-
let str = "";
|
|
1362
|
-
for (const node of root2 == null ? void 0 : root2.children) {
|
|
1363
|
-
str += `${outputNode(node, Array(depth2 + 1).join(" "))}
|
|
1364
|
-
`;
|
|
1365
|
-
if ("children" in node)
|
|
1366
|
-
str += outputChildren(node, depth2 + 1);
|
|
1367
|
-
}
|
|
1368
|
-
return str;
|
|
1369
|
-
};
|
|
1370
|
-
const children = outputChildren(root);
|
|
1371
|
-
log.limits(
|
|
1372
|
-
`${outputNode(root, " ")}${children ? `
|
|
1373
|
-
${children}` : ""}`,
|
|
1374
|
-
100
|
|
1375
|
-
);
|
|
1349
|
+
(0, import_console.printNodeTreeOutput)(this, root);
|
|
1376
1350
|
});
|
|
1377
1351
|
} else {
|
|
1378
1352
|
log.warning(messages.models.noList(currentProject));
|
|
@@ -1403,9 +1377,9 @@ ${children}` : ""}`,
|
|
|
1403
1377
|
(0, import_logger.logError)(err);
|
|
1404
1378
|
else
|
|
1405
1379
|
this.HandleFormattingAndOutput(result, () => {
|
|
1406
|
-
(0, import_console.
|
|
1407
|
-
|
|
1408
|
-
|
|
1380
|
+
(0, import_console.printNodesMigrateResult)(this, result, {
|
|
1381
|
+
showAll: logOutput === "all",
|
|
1382
|
+
showChanged: logOutput === "changes"
|
|
1409
1383
|
});
|
|
1410
1384
|
});
|
|
1411
1385
|
const nodesTotalCount = result == null ? void 0 : result.nodesToMigrate[currentProject].totalCount;
|
|
@@ -1428,7 +1402,7 @@ ${children}` : ""}`,
|
|
|
1428
1402
|
}
|
|
1429
1403
|
} else {
|
|
1430
1404
|
if (noChange) {
|
|
1431
|
-
log.help(messages.nodes.noChange(currentEnv)
|
|
1405
|
+
log.help(messages.nodes.noChange(currentEnv));
|
|
1432
1406
|
} else {
|
|
1433
1407
|
log.error(messages.nodes.failedImport(currentEnv), err);
|
|
1434
1408
|
if (!nodesTotalCount)
|