contensis-cli 1.1.2-beta.9 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0](https://github.com/contensis/cli/compare/contensis-cli-v1.1.1...contensis-cli-v1.2.0) (2024-05-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * add `save-entries` option in `copy field` to save the built entries to json file specified in `output` option ([283a6cd](https://github.com/contensis/cli/commit/283a6cd439df1d51a86a1d1e6bd9cf3edaae5f6f))
9
+ * add `search` option in `copy field` ([45bc264](https://github.com/contensis/cli/commit/45bc264f73c3be2fcfd9c1ed66f1b8f2f4cb20ea))
10
+ * added `delivery-api` option in `get entries` ([d2028bf](https://github.com/contensis/cli/commit/d2028bfeef3a8334f0c6d5c5f0a4c4c617b5e768))
11
+ * added `RequestHandlerFactory` to manage request handler release binary install/update before returning a request handler invocation method in `dev requests` command. Update implementation to supply args instead of writing yaml to launch request handler. ([1898a2a](https://github.com/contensis/cli/commit/1898a2a6a83dedbe17fc7725795b0fd1dac198d3))
12
+ * new command `copy field` ([1f27c2d](https://github.com/contensis/cli/commit/1f27c2d009072a9708272929feca4f79b72ecee0))
13
+ * prompt to override a running block and set a local uri with `dev requests`, ability to run a specific request handler version with `--release` option ([a39ebbd](https://github.com/contensis/cli/commit/a39ebbd0ad449d42398db38992fbbc298f552de5))
14
+ * templating improvements with `copy field` command, new arguments to copy just entry ids, or copy from zenql. Initial support for getting entries via delivery api ([caa4eab](https://github.com/contensis/cli/commit/caa4eab906f24a1bab280267eb32d254fd44ffe8))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * `import contenttypes` and `import components` implementation when specifiying a source-cms, fix corrupted console output on both `remove` commands ([e4b6afa](https://github.com/contensis/cli/commit/e4b6afaf2417ef61d9eee1d545e82685bc3b8747))
20
+ * after extensive testing copy field template variables ([186ece2](https://github.com/contensis/cli/commit/186ece2b9bd5594ead103b4aaa673390df7a9314))
21
+ * ensure downloaded request handler script has execute permission ([cb6b9c7](https://github.com/contensis/cli/commit/cb6b9c760e55ef72b31342129edbb575ce47f7b7))
22
+ * improve output logging when finding block versions using `get block` command ([6f3f003](https://github.com/contensis/cli/commit/6f3f0030f0c0fe09830d27d1b91ab9a421cf3a8e))
23
+ * language option in `create project` command incorrectly read as boolean and needs to be a string ([2bb5c90](https://github.com/contensis/cli/commit/2bb5c902055acff285666a081c80ba71f62b8c8e))
24
+ * sanitise `--fields` input ensuring they are valid api ids ([fefcb34](https://github.com/contensis/cli/commit/fefcb3415cdc1cbdf89148a88f18e26e8838d2ff))
25
+ * update migration package version for latest fixes ([964cdb0](https://github.com/contensis/cli/commit/964cdb0447856a6bae87a4285ffa4c7af5268fc2))
26
+
27
+
28
+ ### Performance Improvements
29
+
30
+ * improve response times when using `import entries` with very large workloads ([28c2535](https://github.com/contensis/cli/commit/28c2535f2fe09593c47b0d6f38c523a44a587555))
31
+ * request block versions concurrently before launching local request handler with `dev requests` ([18135b6](https://github.com/contensis/cli/commit/18135b635284f3714f82581cb755cb9b1a1edeec))
32
+
3
33
  ## [1.1.1](https://github.com/contensis/cli/compare/contensis-cli-v1.1.0...contensis-cli-v1.1.1) (2023-12-08)
4
34
 
5
35
 
package/cli.js CHANGED
@@ -1,8 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  // console.log(process.argv);
3
3
 
4
+ /**
5
+ * Activate additional console output
6
+ */
4
7
  // process.env.debug = 'true';
5
8
 
9
+ /**
10
+ * Polyfills to load before the CLI
11
+ */
12
+ if (!globalThis.crypto) {
13
+ // Versions of Node < 20 do not have crypto attached to global by default
14
+ // and this is required by @contensis/html-canvas package
15
+ const crypto = require('node:crypto');
16
+ globalThis.crypto = crypto.webcrypto;
17
+ }
18
+
19
+ /**
20
+ * Run cli command or launch shell
21
+ */
6
22
  if (process.argv.length > 2)
7
23
  // run cli if args provided
8
24
  require('./dist');
@@ -33,7 +33,13 @@ const makeCopyCommand = () => {
33
33
  ).argument("<fieldId>", "the id of the field to copy from").argument("<destinationId>", "the id of the field to copy to").option(
34
34
  "-t --template <template>",
35
35
  "apply a liquidjs template (surrounded by double quotes) to modify the copied field content"
36
- ).addOption(import_globalOptions.commit).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.outputEntries).usage("<contentTypeId> <fieldId> <destinationId> (all arguments required)").addHelpText(
36
+ ).addOption(import_globalOptions.commit).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.outputEntries).option(
37
+ "--search <phrase>",
38
+ "get entries with the search phrase, use quotes for multiple words"
39
+ ).addOption(import_globalOptions.entryId).addOption(import_globalOptions.zenql).option(
40
+ "-s --save-entries",
41
+ "save the entries we're migrating instead of the migration preview when using --output option"
42
+ ).usage("<contentTypeId> <fieldId> <destinationId> (all arguments required)").addHelpText(
37
43
  "after",
38
44
  `
39
45
  Example call:
@@ -43,6 +49,7 @@ Example call:
43
49
  `
44
50
  ).action(
45
51
  async (contentTypeId, fieldId, destinationId, opts) => {
52
+ const { template, ...restOpts } = opts;
46
53
  const copyField = {
47
54
  contentTypeId,
48
55
  fieldId,
@@ -52,11 +59,12 @@ Example call:
52
59
  return await (0, import_ContensisCliService.cliCommand)(
53
60
  ["copy", "project", contentTypeId, fieldId, destinationId],
54
61
  opts,
55
- (0, import_globalOptions.mapContensisOpts)({ copyField })
62
+ (0, import_globalOptions.mapContensisOpts)({ copyField, ...restOpts })
56
63
  ).CopyEntryField({
57
64
  commit: opts.commit,
58
65
  fromFile: opts.fromFile,
59
- logOutput: opts.outputEntries
66
+ logOutput: opts.outputEntries,
67
+ saveEntries: opts.saveEntries
60
68
  });
61
69
  }
62
70
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/copy.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport { CopyField } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\n ignoreErrors,\n mapContensisOpts,\n outputEntries,\n} from './globalOptions';\n\nexport const makeCopyCommand = () => {\n const copy = new Command()\n .command('copy')\n .description('copy command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n copy\n .command('field')\n .description('copy the contents of one content type field to another')\n .argument(\n '<contentTypeId>',\n 'the api id of the content type containing the fields to copy'\n )\n .argument('<fieldId>', 'the id of the field to copy from')\n .argument('<destinationId>', 'the id of the field to copy to')\n .option(\n '-t --template <template>',\n 'apply a liquidjs template (surrounded by double quotes) to modify the copied field content'\n )\n .addOption(commit)\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .addOption(outputEntries)\n .usage('<contentTypeId> <fieldId> <destinationId> (all arguments required)')\n .addHelpText(\n 'after',\n `\nExample call:\n > copy field blog authorName contributors\\n\n > copy field blog description kicker --template \"<h2>{{ source_value }}</h2>\"\\n`\n )\n .action(\n async (\n contentTypeId: string,\n fieldId: string,\n destinationId: string,\n opts: any\n ) => {\n const copyField: CopyField = {\n contentTypeId,\n fieldId,\n destinationId,\n template: opts.template,\n };\n\n return await cliCommand(\n ['copy', 'project', contentTypeId, fieldId, destinationId],\n opts,\n mapContensisOpts({ copyField })\n ).CopyEntryField({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n });\n }\n );\n\n return copy;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,2BAMO;AAEA,MAAM,kBAAkB,MAAM;AACnC,QAAM,OAAO,IAAI,yBAAQ,EACtB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,OACG,QAAQ,OAAO,EACf,YAAY,wDAAwD,EACpE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,SAAS,aAAa,kCAAkC,EACxD,SAAS,mBAAmB,gCAAgC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,2BAAM,EAChB,UAAU,gCAAW,EACrB,UAAU,iCAAY,EACtB,UAAU,kCAAa,EACvB,MAAM,oEAAoE,EAC1E;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC;AAAA,IACC,OACE,eACA,SACA,eACA,SACG;AACH,YAAM,YAAuB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,MACjB;AAEA,aAAO,UAAM;AAAA,QACX,CAAC,QAAQ,WAAW,eAAe,SAAS,aAAa;AAAA,QACzD;AAAA,YACA,uCAAiB,EAAE,UAAU,CAAC;AAAA,MAChC,EAAE,eAAe;AAAA,QACf,QAAQ,KAAK;AAAA,QACb,UAAU,KAAK;AAAA,QACf,WAAW,KAAK;AAAA,MAClB,CAAC;AAAA,IACH;AAAA,EACF;AAEF,SAAO;AACT;",
4
+ "sourcesContent": ["import { Command } from 'commander';\nimport { CopyField } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\n entryId,\n ignoreErrors,\n mapContensisOpts,\n outputEntries,\n zenql,\n} from './globalOptions';\n\nexport const makeCopyCommand = () => {\n const copy = new Command()\n .command('copy')\n .description('copy command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n copy\n .command('field')\n .description('copy the contents of one content type field to another')\n .argument(\n '<contentTypeId>',\n 'the api id of the content type containing the fields to copy'\n )\n .argument('<fieldId>', 'the id of the field to copy from')\n .argument('<destinationId>', 'the id of the field to copy to')\n .option(\n '-t --template <template>',\n 'apply a liquidjs template (surrounded by double quotes) to modify the copied field content'\n )\n .addOption(commit)\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .addOption(outputEntries)\n .option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(entryId)\n .addOption(zenql)\n .option(\n '-s --save-entries',\n \"save the entries we're migrating instead of the migration preview when using --output option\"\n )\n .usage('<contentTypeId> <fieldId> <destinationId> (all arguments required)')\n .addHelpText(\n 'after',\n `\nExample call:\n > copy field blog authorName contributors\\n\n > copy field blog description kicker --template \"<h2>{{ source_value }}</h2>\"\\n`\n )\n .action(\n async (\n contentTypeId: string,\n fieldId: string,\n destinationId: string,\n opts: any\n ) => {\n const { template, ...restOpts } = opts;\n const copyField: CopyField = {\n contentTypeId,\n fieldId,\n destinationId,\n template: opts.template,\n };\n\n return await cliCommand(\n ['copy', 'project', contentTypeId, fieldId, destinationId],\n opts,\n mapContensisOpts({ copyField, ...restOpts })\n ).CopyEntryField({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n saveEntries: opts.saveEntries,\n });\n }\n );\n\n return copy;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,2BAQO;AAEA,MAAM,kBAAkB,MAAM;AACnC,QAAM,OAAO,IAAI,yBAAQ,EACtB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,OACG,QAAQ,OAAO,EACf,YAAY,wDAAwD,EACpE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,SAAS,aAAa,kCAAkC,EACxD,SAAS,mBAAmB,gCAAgC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,2BAAM,EAChB,UAAU,gCAAW,EACrB,UAAU,iCAAY,EACtB,UAAU,kCAAa,EACvB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,4BAAO,EACjB,UAAU,0BAAK,EACf;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,MAAM,oEAAoE,EAC1E;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC;AAAA,IACC,OACE,eACA,SACA,eACA,SACG;AACH,YAAM,EAAE,aAAa,SAAS,IAAI;AAClC,YAAM,YAAuB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,MACjB;AAEA,aAAO,UAAM;AAAA,QACX,CAAC,QAAQ,WAAW,eAAe,SAAS,aAAa;AAAA,QACzD;AAAA,YACA,uCAAiB,EAAE,WAAW,GAAG,SAAS,CAAC;AAAA,MAC7C,EAAE,eAAe;AAAA,QACf,QAAQ,KAAK;AAAA,QACb,UAAU,KAAK;AAAA,QACf,WAAW,KAAK;AAAA,QAChB,aAAa,KAAK;AAAA,MACpB,CAAC;AAAA,IACH;AAAA,EACF;AAEF,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -28,7 +28,7 @@ const makeCreateCommand = () => {
28
28
  const create = new import_commander.Command().command("create").description("create command").addHelpText("after", `
29
29
  `).showHelpAfterError(true).exitOverride();
30
30
  create.command("project").description("create a new project").argument("<projectId>", "the id of the project to create").argument("<name>", "the name of the project to create").argument("[description]", "optional description of the project").option(
31
- "-l --language",
31
+ "-l --language <language>",
32
32
  "the default language of the project to create",
33
33
  "en-GB"
34
34
  ).option(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/create.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport { Project } from 'contensis-core-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeCreateCommand = () => {\n const create = new Command()\n .command('create')\n .description('create command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n create\n .command('project')\n .description('create a new project')\n .argument('<projectId>', 'the id of the project to create')\n .argument('<name>', 'the name of the project to create')\n .argument('[description]', 'optional description of the project')\n .option(\n '-l --language',\n 'the default language of the project to create',\n 'en-GB'\n )\n .option(\n '-langs --supported-languages <langs...>',\n 'space separated list of other supported languages'\n )\n .usage(\n 'projectId \"Project name\" [\"Description of project\"] --language en-GB --supported-languages es-ES de-DE nl-NL'\n )\n .addHelpText('after', `\\n`)\n .action(\n async (projectId: string, name: string, description = '', opts: any) => {\n const createProject: Project = {\n id: projectId,\n name,\n description,\n primaryLanguage: opts.language,\n supportedLanguages: opts.supportedLanguages || [],\n };\n\n const project = await cliCommand(\n ['create', 'project', projectId],\n opts\n ).CreateProject(createProject);\n if (project) await shell().restart();\n }\n );\n\n create\n .command('key')\n .description('create a new api key')\n .argument('<\"key name\">', 'the name of the key to create')\n .argument('[\"description\"]', 'provide a description for the key (optional)')\n .usage('<\"key name\"> [\"description\"] (both args in \"double quotes\")')\n .addHelpText(\n 'after',\n `\nExample call:\n > create key \"my new key\" \"Created key for demonstration\"\\n`\n )\n .action(async (name: string, description: string, opts: any) => {\n await cliCommand(['create', 'key', name], opts).CreateApiKey(\n name,\n description\n );\n });\n\n create\n .command('role')\n .description('create a new role')\n .argument('<\"Role name\">', 'the name of the role to create')\n .argument('[\"Role description\">', 'the description of the role')\n .option('--disabled', 'do not enable the created role', false)\n .addHelpText(\n 'after',\n `\nExample call:\n > create role \"My role\" \"This role is for testing\" --disabled \\n`\n )\n .action(async (roleName: string, description: string, opts) => {\n await cliCommand(['create', 'role', roleName], opts).CreateRole({\n name: roleName,\n description,\n enabled: !opts.disabled,\n assignments: { apiKeys: [], groups: [], users: [] },\n permissions: { contentTypes: [], entries: [] },\n });\n });\n\n return create;\n};\n"],
4
+ "sourcesContent": ["import { Command } from 'commander';\nimport { Project } from 'contensis-core-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeCreateCommand = () => {\n const create = new Command()\n .command('create')\n .description('create command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n create\n .command('project')\n .description('create a new project')\n .argument('<projectId>', 'the id of the project to create')\n .argument('<name>', 'the name of the project to create')\n .argument('[description]', 'optional description of the project')\n .option(\n '-l --language <language>',\n 'the default language of the project to create',\n 'en-GB'\n )\n .option(\n '-langs --supported-languages <langs...>',\n 'space separated list of other supported languages'\n )\n .usage(\n 'projectId \"Project name\" [\"Description of project\"] --language en-GB --supported-languages es-ES de-DE nl-NL'\n )\n .addHelpText('after', `\\n`)\n .action(\n async (projectId: string, name: string, description = '', opts: any) => {\n const createProject: Project = {\n id: projectId,\n name,\n description,\n primaryLanguage: opts.language,\n supportedLanguages: opts.supportedLanguages || [],\n };\n\n const project = await cliCommand(\n ['create', 'project', projectId],\n opts\n ).CreateProject(createProject);\n if (project) await shell().restart();\n }\n );\n\n create\n .command('key')\n .description('create a new api key')\n .argument('<\"key name\">', 'the name of the key to create')\n .argument('[\"description\"]', 'provide a description for the key (optional)')\n .usage('<\"key name\"> [\"description\"] (both args in \"double quotes\")')\n .addHelpText(\n 'after',\n `\nExample call:\n > create key \"my new key\" \"Created key for demonstration\"\\n`\n )\n .action(async (name: string, description: string, opts: any) => {\n await cliCommand(['create', 'key', name], opts).CreateApiKey(\n name,\n description\n );\n });\n\n create\n .command('role')\n .description('create a new role')\n .argument('<\"Role name\">', 'the name of the role to create')\n .argument('[\"Role description\">', 'the description of the role')\n .option('--disabled', 'do not enable the created role', false)\n .addHelpText(\n 'after',\n `\nExample call:\n > create role \"My role\" \"This role is for testing\" --disabled \\n`\n )\n .action(async (roleName: string, description: string, opts) => {\n await cliCommand(['create', 'role', roleName], opts).CreateRole({\n name: roleName,\n description,\n enabled: !opts.disabled,\n assignments: { apiKeys: [], groups: [], users: [] },\n permissions: { contentTypes: [], entries: [] },\n });\n });\n\n return create;\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,mBAAsB;AAEf,MAAM,oBAAoB,MAAM;AACrC,QAAM,SAAS,IAAI,yBA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;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,UAAkB,aAAqB,SAAS;AAC7D,cAAM,uCAAW,CAAC,UAAU,QAAQ,QAAQ,GAAG,IAAI,EAAE,WAAW;AAAA,MAC9D,MAAM;AAAA,MACN;AAAA,MACA,SAAS,CAAC,KAAK;AAAA,MACf,aAAa,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,MAClD,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,CAAC,EAAE;AAAA,IAC/C,CAAC;AAAA,EACH,CAAC;AAEH,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -138,7 +138,7 @@ Example call:
138
138
  "-ob --order-by <orderBy...>",
139
139
  'field name(s) to order the results by (prefix "-" for descending)'
140
140
  )
141
- );
141
+ ).addOption(import_globalOptions.delivery);
142
142
  sharedGetEntryOptions(
143
143
  program.command("assets").description("get asset entries").argument(
144
144
  "[search phrase]",
@@ -150,11 +150,11 @@ Example call:
150
150
  Example call:
151
151
  > get assets --zenql "sys.contentTypeId = blog" --fields sys.id sys.properties.filePath sys.properties.filename
152
152
  `
153
- ).action(async (phrase, opts) => {
153
+ ).action(async (search, opts) => {
154
154
  await (0, import_ContensisCliService.cliCommand)(
155
155
  ["get", "assets"],
156
156
  opts,
157
- (0, import_globalOptions.mapContensisOpts)({ dataFormat: "asset", phrase, ...opts })
157
+ (0, import_globalOptions.mapContensisOpts)({ dataFormat: "asset", search, ...opts })
158
158
  ).GetEntries({});
159
159
  });
160
160
  sharedGetEntryOptions(
@@ -177,11 +177,11 @@ Example call:
177
177
  > get entries --zenql "sys.contentTypeId = blog" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv
178
178
  > get entries --content-type blog --fields entryTitle sys.version.modified --order-by -sys.version.modified
179
179
  `
180
- ).action(async (phrase, opts, cmd) => {
180
+ ).action(async (search, opts, cmd) => {
181
181
  await (0, import_ContensisCliService.cliCommand)(
182
182
  ["get", "entries"],
183
183
  opts,
184
- (0, import_globalOptions.mapContensisOpts)({ phrase, ...opts })
184
+ (0, import_globalOptions.mapContensisOpts)({ search, ...opts })
185
185
  ).GetEntries({
186
186
  withDependents: opts.dependents
187
187
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/get.ts"],
4
- "sourcesContent": ["import { Argument, Command, Option } from 'commander';\nimport { merge } from 'lodash';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n addGlobalOptions,\n assetTypes,\n contentTypes,\n entryId,\n mapContensisOpts,\n zenql,\n} from './globalOptions';\n\nexport const makeGetCommand = () => {\n const program = new Command()\n .command('get')\n .description('get command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('version')\n .description('get current Contensis version')\n .addHelpText(\n 'after',\n `\nExample call:\n > version\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'version'], opts).PrintContensisVersion();\n });\n\n program\n .command('token')\n .description('show a bearer token for the currently logged in user')\n .addHelpText(\n 'after',\n `\nExample call:\n > get token\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'token'], opts).PrintBearerToken();\n });\n\n program\n .command('project')\n .description('get a project')\n .argument('[projectId]', 'id of the project to get (default: current)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get project website\n`\n )\n .action(async (projectId: string, opts) => {\n await cliCommand(['get', 'project', projectId], opts).PrintProject(\n projectId\n );\n });\n\n program\n .command('role')\n .description('get a role')\n .argument('<roleNameOrId>', 'id or name of the role to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get role \"entry admin\"\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['get', 'role', roleNameOrId], opts).PrintRole(\n roleNameOrId\n );\n });\n\n program\n .command('webhook')\n .description('get a webhook')\n .argument('<webhookNameOrId...>', 'id or name of the webhook(s) to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get webhook \"Slack notification\"\n`\n )\n .action(async (webhookNameOrId: string[], opts) => {\n await cliCommand(\n ['get', 'webhook', webhookNameOrId.join(' ')],\n opts\n ).PrintWebhookSubscriptions(webhookNameOrId);\n });\n\n program\n .command('workflow')\n .description('get a workflow')\n .argument('<workflowNameOrId>', 'id or name of the workflow to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get workflow \"Approval workflow\"\n`\n )\n .action(async (workflowNameOrId: string, opts) => {\n await cliCommand(\n ['get', 'workflow', workflowNameOrId],\n opts\n ).PrintWorkflow(workflowNameOrId);\n });\n\n program\n .command('model')\n .description('get a content model')\n .argument('<contentTypeId...>', 'ids of the content models to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get model podcast podcastLinks\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['get', 'model', modelIds.join(' ')],\n opts\n ).PrintContentModels(modelIds);\n });\n\n program\n .command('contenttype')\n .description('get a content type')\n .argument('<contentTypeId>', 'the API id of the content type to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get contenttype {contentTypeId} -o content-type-backup.json\n`\n )\n .action(async (contentTypeId: string, opts) => {\n await cliCommand(\n ['get', 'contenttype', contentTypeId],\n opts\n ).PrintContentType(contentTypeId);\n });\n\n program\n .command('component')\n .description('get a component')\n .argument('<componentId>', 'the API id of the component to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get component {componentId} -o component-backup.json\n`\n )\n .action(async (componentId: string, opts) => {\n await cliCommand(['get', 'component', componentId], opts).PrintComponent(\n componentId\n );\n });\n\n const sharedGetEntryOptions = (command: Command) =>\n command\n .addOption(entryId)\n .addOption(zenql)\n .addOption(\n new Option(\n '-fi --fields <fields...>',\n 'limit the output fields on returned entries'\n )\n )\n .addOption(\n new Option(\n '-ob --order-by <orderBy...>',\n 'field name(s) to order the results by (prefix \"-\" for descending)'\n )\n );\n\n sharedGetEntryOptions(\n program\n .command('assets')\n .description('get asset entries')\n .argument(\n '[search phrase]',\n 'get assets with the search phrase, use quotes for multiple words'\n )\n .addOption(assetTypes)\n )\n .option('-l --paths <paths...>', 'get assets under the given path(s)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get assets --zenql \"sys.contentTypeId = blog\" --fields sys.id sys.properties.filePath sys.properties.filename\n`\n )\n .action(async (phrase: string, opts) => {\n // Maintaining a separate command for assets vs entries\n // allows us to offer up more options when dealing with just assets\n await cliCommand(\n ['get', 'assets'],\n opts,\n mapContensisOpts({ dataFormat: 'asset', phrase, ...opts })\n ).GetEntries({});\n });\n\n sharedGetEntryOptions(\n program\n .command('entries')\n .description('get entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(contentTypes)\n .option(\n '-d --dependents',\n 'find and return any dependencies of all found entries'\n )\n )\n .addOption(\n new Option(\n '--data-format <dataFormat>',\n 'find and return entries of a specific data format'\n )\n .choices(['entry', 'asset', 'webpage'])\n .default('entry')\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get entries --zenql \"sys.contentTypeId = blog\" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv\n > get entries --content-type blog --fields entryTitle sys.version.modified --order-by -sys.version.modified\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n // console.log('phrase: ', phrase, '\\nopts:', JSON.stringify(opts, null, 2));\n // console.log('opts:', JSON.stringify(opts, null, 2));\n await cliCommand(\n ['get', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).GetEntries({\n withDependents: opts.dependents,\n });\n });\n\n program\n .command('nodes')\n .description('get nodes')\n .argument('[root]', 'get node(s) from the specified path e.g. /blog', '/')\n .option(\n '-d --depth <depth>',\n 'get nodes with children to a specified depth',\n '1'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get nodes /blog --depth 1\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(['get', 'nodes'], opts, mapContensisOpts(opts)).GetNodes(\n root,\n opts.depth\n );\n });\n\n const block = program\n .command('block')\n .description('get a block or block version')\n .argument('[blockId]', 'the block to get version details for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'default'\n )\n .argument(\n '[version]',\n 'get a specific version of the block pushed to the specified branch'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get block contensis-website\n > get block contensis-website develop latest\n > get block contensis-website feature-branch 3\n`\n )\n .action(async (blockId: string, branch: string, version: string, opts) => {\n await cliCommand(['get', 'block', blockId], opts).PrintBlockVersions(\n blockId,\n branch,\n version\n );\n });\n\n block\n .command('logs')\n .description('get logs for a block')\n .argument('[blockId]', 'the block to get version logs for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'default'\n )\n .argument(\n '[version]',\n 'the version of the block pushed to the branch to get logs for',\n 'latest'\n )\n .addArgument(\n new Argument(\n '[dataCenter]',\n 'the datacentre of the block to get logs for'\n )\n .choices(['hq', 'london', 'manchester', 'all'])\n .default('all')\n )\n .option('-t --follow', 'follow block logs in near realtime', false)\n .usage('get block logs [blockId] [branch] [version] [dataCenter]')\n .addHelpText(\n 'after',\n `\nExample call:\n > get block logs contensis-website default\n > get block logs contensis-website master latest london --follow\n`\n )\n .action(\n async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london' | 'all',\n opts\n ) => {\n const parentOpts = block.opts() || {};\n await cliCommand(\n ['get', 'block', 'logs'],\n merge(opts, parentOpts)\n ).PrintBlockLogs(\n blockId,\n branch,\n version,\n dataCenter === 'all' ? undefined : dataCenter,\n opts.follow as boolean\n );\n }\n );\n\n // Add global opts for inner sub-commands\n addGlobalOptions(block);\n\n return program;\n};\n\nexport const get = makeGetCommand();\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C;AAC1C,oBAAsB;AACtB,iCAA2B;AAC3B,2BAOO;AAEA,MAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,Y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MACxB,EAAE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,eAAe,QAAQ,SAAY;AAAA,QACnC,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAGF,6CAAiB,KAAK;AAEtB,SAAO;AACT;AAEO,MAAM,MAAM,eAAe;",
4
+ "sourcesContent": ["import { Argument, Command, Option } from 'commander';\nimport { merge } from 'lodash';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n addGlobalOptions,\n assetTypes,\n contentTypes,\n delivery,\n entryId,\n mapContensisOpts,\n zenql,\n} from './globalOptions';\n\nexport const makeGetCommand = () => {\n const program = new Command()\n .command('get')\n .description('get command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('version')\n .description('get current Contensis version')\n .addHelpText(\n 'after',\n `\nExample call:\n > version\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'version'], opts).PrintContensisVersion();\n });\n\n program\n .command('token')\n .description('show a bearer token for the currently logged in user')\n .addHelpText(\n 'after',\n `\nExample call:\n > get token\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'token'], opts).PrintBearerToken();\n });\n\n program\n .command('project')\n .description('get a project')\n .argument('[projectId]', 'id of the project to get (default: current)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get project website\n`\n )\n .action(async (projectId: string, opts) => {\n await cliCommand(['get', 'project', projectId], opts).PrintProject(\n projectId\n );\n });\n\n program\n .command('role')\n .description('get a role')\n .argument('<roleNameOrId>', 'id or name of the role to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get role \"entry admin\"\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['get', 'role', roleNameOrId], opts).PrintRole(\n roleNameOrId\n );\n });\n\n program\n .command('webhook')\n .description('get a webhook')\n .argument('<webhookNameOrId...>', 'id or name of the webhook(s) to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get webhook \"Slack notification\"\n`\n )\n .action(async (webhookNameOrId: string[], opts) => {\n await cliCommand(\n ['get', 'webhook', webhookNameOrId.join(' ')],\n opts\n ).PrintWebhookSubscriptions(webhookNameOrId);\n });\n\n program\n .command('workflow')\n .description('get a workflow')\n .argument('<workflowNameOrId>', 'id or name of the workflow to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get workflow \"Approval workflow\"\n`\n )\n .action(async (workflowNameOrId: string, opts) => {\n await cliCommand(\n ['get', 'workflow', workflowNameOrId],\n opts\n ).PrintWorkflow(workflowNameOrId);\n });\n\n program\n .command('model')\n .description('get a content model')\n .argument('<contentTypeId...>', 'ids of the content models to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get model podcast podcastLinks\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['get', 'model', modelIds.join(' ')],\n opts\n ).PrintContentModels(modelIds);\n });\n\n program\n .command('contenttype')\n .description('get a content type')\n .argument('<contentTypeId>', 'the API id of the content type to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get contenttype {contentTypeId} -o content-type-backup.json\n`\n )\n .action(async (contentTypeId: string, opts) => {\n await cliCommand(\n ['get', 'contenttype', contentTypeId],\n opts\n ).PrintContentType(contentTypeId);\n });\n\n program\n .command('component')\n .description('get a component')\n .argument('<componentId>', 'the API id of the component to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get component {componentId} -o component-backup.json\n`\n )\n .action(async (componentId: string, opts) => {\n await cliCommand(['get', 'component', componentId], opts).PrintComponent(\n componentId\n );\n });\n\n const sharedGetEntryOptions = (command: Command) =>\n command\n .addOption(entryId)\n .addOption(zenql)\n .addOption(\n new Option(\n '-fi --fields <fields...>',\n 'limit the output fields on returned entries'\n )\n )\n .addOption(\n new Option(\n '-ob --order-by <orderBy...>',\n 'field name(s) to order the results by (prefix \"-\" for descending)'\n )\n )\n .addOption(delivery);\n\n sharedGetEntryOptions(\n program\n .command('assets')\n .description('get asset entries')\n .argument(\n '[search phrase]',\n 'get assets with the search phrase, use quotes for multiple words'\n )\n .addOption(assetTypes)\n )\n .option('-l --paths <paths...>', 'get assets under the given path(s)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get assets --zenql \"sys.contentTypeId = blog\" --fields sys.id sys.properties.filePath sys.properties.filename\n`\n )\n .action(async (search: string, opts) => {\n // Maintaining a separate command for assets vs entries\n // allows us to offer up more options when dealing with just assets\n await cliCommand(\n ['get', 'assets'],\n opts,\n mapContensisOpts({ dataFormat: 'asset', search, ...opts })\n ).GetEntries({});\n });\n\n sharedGetEntryOptions(\n program\n .command('entries')\n .description('get entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(contentTypes)\n .option(\n '-d --dependents',\n 'find and return any dependencies of all found entries'\n )\n )\n .addOption(\n new Option(\n '--data-format <dataFormat>',\n 'find and return entries of a specific data format'\n )\n .choices(['entry', 'asset', 'webpage'])\n .default('entry')\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get entries --zenql \"sys.contentTypeId = blog\" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv\n > get entries --content-type blog --fields entryTitle sys.version.modified --order-by -sys.version.modified\n`\n )\n .action(async (search: string, opts, cmd) => {\n await cliCommand(\n ['get', 'entries'],\n opts,\n mapContensisOpts({ search, ...opts })\n ).GetEntries({\n withDependents: opts.dependents,\n });\n });\n\n program\n .command('nodes')\n .description('get nodes')\n .argument('[root]', 'get node(s) from the specified path e.g. /blog', '/')\n .option(\n '-d --depth <depth>',\n 'get nodes with children to a specified depth',\n '1'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get nodes /blog --depth 1\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(['get', 'nodes'], opts, mapContensisOpts(opts)).GetNodes(\n root,\n opts.depth\n );\n });\n\n const block = program\n .command('block')\n .description('get a block or block version')\n .argument('[blockId]', 'the block to get version details for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'default'\n )\n .argument(\n '[version]',\n 'get a specific version of the block pushed to the specified branch'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get block contensis-website\n > get block contensis-website develop latest\n > get block contensis-website feature-branch 3\n`\n )\n .action(async (blockId: string, branch: string, version: string, opts) => {\n await cliCommand(['get', 'block', blockId], opts).PrintBlockVersions(\n blockId,\n branch,\n version\n );\n });\n\n block\n .command('logs')\n .description('get logs for a block')\n .argument('[blockId]', 'the block to get version logs for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'default'\n )\n .argument(\n '[version]',\n 'the version of the block pushed to the branch to get logs for',\n 'latest'\n )\n .addArgument(\n new Argument(\n '[dataCenter]',\n 'the datacentre of the block to get logs for'\n )\n .choices(['hq', 'london', 'manchester', 'all'])\n .default('all')\n )\n .option('-t --follow', 'follow block logs in near realtime', false)\n .usage('get block logs [blockId] [branch] [version] [dataCenter]')\n .addHelpText(\n 'after',\n `\nExample call:\n > get block logs contensis-website default\n > get block logs contensis-website master latest london --follow\n`\n )\n .action(\n async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london' | 'all',\n opts\n ) => {\n const parentOpts = block.opts() || {};\n await cliCommand(\n ['get', 'block', 'logs'],\n merge(opts, parentOpts)\n ).PrintBlockLogs(\n blockId,\n branch,\n version,\n dataCenter === 'all' ? undefined : dataCenter,\n opts.follow as boolean\n );\n }\n );\n\n // Add global opts for inner sub-commands\n addGlobalOptions(block);\n\n return program;\n};\n\nexport const get = makeGetCommand();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C;AAC1C,oBAAsB;AACtB,iCAA2B;AAC3B,2BAQO;AAEA,MAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,SAAS,EACjB,YAAY,+BAA+B,EAC3C;AA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;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAGF,6CAAiB,KAAK;AAEtB,SAAO;AACT;AAEO,MAAM,MAAM,eAAe;",
6
6
  "names": []
7
7
  }
@@ -26,6 +26,7 @@ __export(globalOptions_exports, {
26
26
  commit: () => commit,
27
27
  concurrency: () => concurrency,
28
28
  contentTypes: () => contentTypes,
29
+ delivery: () => delivery,
29
30
  entryId: () => entryId,
30
31
  fromCms: () => fromCms,
31
32
  fromFile: () => fromFile,
@@ -35,6 +36,7 @@ __export(globalOptions_exports, {
35
36
  mapContensisOpts: () => mapContensisOpts,
36
37
  outputEntries: () => outputEntries,
37
38
  project: () => project,
39
+ search: () => search,
38
40
  zenql: () => zenql
39
41
  });
40
42
  module.exports = __toCommonJS(globalOptions_exports);
@@ -47,7 +49,7 @@ const mapContensisOpts = (opts = {}) => ({
47
49
  } : void 0,
48
50
  models: opts.modelIds,
49
51
  copyField: opts.copyField,
50
- query: opts.id || opts.entryIds || opts.phrase || opts.fields || opts.orderBy || opts.paths || opts.assetType || opts.contentType || opts.dataFormat ? {
52
+ query: opts.id || opts.entryIds || opts.search || opts.fields || opts.orderBy || opts.paths || opts.assetType || opts.contentType || opts.dataFormat || opts.deliveryApi ? {
51
53
  assetTypes: opts.assetType,
52
54
  contentTypeIds: opts.contentType,
53
55
  dataFormats: opts.dataFormat ? [opts.dataFormat] : void 0,
@@ -55,7 +57,8 @@ const mapContensisOpts = (opts = {}) => ({
55
57
  includeIds: opts.id || opts.entryIds,
56
58
  includePaths: opts.paths,
57
59
  orderBy: opts.orderBy,
58
- searchTerm: opts.phrase
60
+ searchTerm: opts.search,
61
+ useDelivery: opts.deliveryApi
59
62
  } : void 0,
60
63
  zenQL: opts.zenql,
61
64
  transformGuids: !opts.preserveGuids,
@@ -94,6 +97,14 @@ const sharedSecret = new import_commander.Option(
94
97
  "-s --shared-secret <sharedSecret>",
95
98
  "the shared secret to use when logging in with a client id"
96
99
  );
100
+ const delivery = new import_commander.Option(
101
+ "-delivery --delivery-api",
102
+ "use delivery api to get the entries"
103
+ );
104
+ const search = new import_commander.Option(
105
+ "--search <phrase>",
106
+ "get entries with the search phrase, use quotes for multiple words"
107
+ );
97
108
  const zenql = new import_commander.Option(
98
109
  "-q --zenql <zenql>",
99
110
  "get entries with a supplied ZenQL statement"
@@ -163,6 +174,7 @@ const addGlobalOptions = (program) => {
163
174
  commit,
164
175
  concurrency,
165
176
  contentTypes,
177
+ delivery,
166
178
  entryId,
167
179
  fromCms,
168
180
  fromFile,
@@ -172,6 +184,7 @@ const addGlobalOptions = (program) => {
172
184
  mapContensisOpts,
173
185
  outputEntries,
174
186
  project,
187
+ search,
175
188
  zenql
176
189
  });
177
190
  //# sourceMappingURL=globalOptions.js.map
@@ -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 { MigrateRequest } from 'migratortron';\nimport { url } from '~/util';\n\n// Map various input options into a request to be processed\n// by Migratortron / Contensis import library\nexport const mapContensisOpts = (opts: any = {}): MigrateRequest => ({\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 copyField: opts.copyField,\n // convert various cli options into MigrateRequest.query format\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 ignoreErrors: opts.ignoreErrors,\n concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,\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 ignoreErrors = new Option(\n '-ignore --ignore-errors',\n 'commit the import ignoring any reported errors'\n).default(false);\n\nexport const outputEntries = 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\nexport const concurrency = new Option(\n '-conc --concurrency <concurrency>',\n 'the number of entries to load in parallel'\n).default(2);\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAEhC,kBAAoB;AAIb,MAAM,mBAAmB,CAAC,OAAY,CAAC,OAAuB;AAAA,EACnE,QACE,KAAK,eAAe,KAAK,kBACrB;AAAA,IACE,KAAK,KAAK,kBACN,iBAAI,KAAK,aAAa,SAAS,EAAE,MAChC;AAAA,IACL,SAAS,KAAK,mBAAoB;AAAA,EACpC,IACA;AAAA,EACN,QAAQ,KAAK;AAAA,EACb,WAAW,KAAK;AAAA,EAEhB,OACE,KAAK,MACL,KAAK,YACL,KAAK,UACL,KAAK,UACL,KAAK,WACL,KAAK,SACL,KAAK,aACL,KAAK,eACL,KAAK,aACD;AAAA,IACE,YAAY,KAAK;AAAA,IACjB,gBAAgB,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QAAQ,KAAK;AAER,MAAM,eAAe,IAAI;AAAA,EAC9B;AAAA,EACA;AACF,EAAE,QAAQ,KAAK;AAER,MAAM,gBAAgB,IAAI;AAAA,EAC/B;AAAA,EACA;AACF,EACG,QAAQ,CAAC,UAAU,WAAW,KAAK,CAAC,EACpC,QAAQ,QAAQ;AAEZ,MAAM,cAAc,IAAI;AAAA,EAC7B;AAAA,EACA;AACF,EAAE,QAAQ,CAAC;AAEJ,MAAM,oBAAoB,CAAC,YAChC,QAAQ,UAAU,MAAM,SAAS,CAAC,EAAE,UAAU,QAAQ,SAAS,CAAC;AAE3D,MAAM,2BAA2B,CAAC,YACvC,QACG,UAAU,KAAK,SAAS,CAAC,EACzB,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,aAAa,SAAS,CAAC;AAEtC,MAAM,4BAA4B,CAAC,YACjC,QAAQ,UAAU,MAAM,EAAE,UAAU,MAAM;AAErC,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,OAAO,EAAE,UAAU,WAAW,EAAE,UAAU,QAAQ;AAAA,EACtE;AACA,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,YAC9B,QACG,UAAU,OAAO,EACjB,UAAU,KAAK,EACf,UAAU,YAAY,EACtB,UAAU,UAAU;AAElB,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,8BAA0B,OAAO;AACjC,sBAAkB,OAAO;AACzB,6BAAyB,OAAO;AAAA,EAClC;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import { Command, Option } from 'commander';\nimport { MigrateRequest } from 'migratortron';\nimport { url } from '~/util';\n\n// Map various input options into a request to be processed\n// by Migratortron / Contensis import library\nexport const mapContensisOpts = (opts: any = {}): MigrateRequest => ({\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 copyField: opts.copyField,\n // convert various cli options into MigrateRequest.query format\n query:\n opts.id ||\n opts.entryIds ||\n opts.search ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat ||\n opts.deliveryApi\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.search,\n useDelivery: opts.deliveryApi,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n ignoreErrors: opts.ignoreErrors,\n concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,\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 delivery = new Option(\n '-delivery --delivery-api',\n 'use delivery api to get the entries'\n);\n export const search = new Option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\n );\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 ignoreErrors = new Option(\n '-ignore --ignore-errors',\n 'commit the import ignoring any reported errors'\n).default(false);\n\nexport const outputEntries = 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\nexport const concurrency = new Option(\n '-conc --concurrency <concurrency>',\n 'the number of entries to load in parallel'\n).default(2);\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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S,CAAC,EAC7B,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,aAAa,SAAS,CAAC;AAEtC,MAAM,4BAA4B,CAAC,YACjC,QAAQ,UAAU,MAAM,EAAE,UAAU,MAAM;AAErC,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,OAAO,EAAE,UAAU,WAAW,EAAE,UAAU,QAAQ;AAAA,EACtE;AACA,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,YAC9B,QACG,UAAU,OAAO,EACjB,UAAU,KAAK,EACf,UAAU,YAAY,EACtB,UAAU,UAAU;AAElB,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,8BAA0B,OAAO;AACjC,sBAAkB,OAAO;AACzB,6BAAyB,OAAO;AAAA,EAClC;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -106,11 +106,11 @@ Example call:
106
106
  > import entries --source-cms example-dev --source-project-id microsite --zenql "sys.contentTypeId = blog"
107
107
  > import entries --from-file myImportData.json --preserve-guids
108
108
  `
109
- ).action(async (phrase, opts, cmd) => {
109
+ ).action(async (search, opts, cmd) => {
110
110
  await (0, import_ContensisCliService.cliCommand)(
111
111
  ["import", "entries"],
112
112
  opts,
113
- (0, import_globalOptions.mapContensisOpts)({ phrase, ...opts })
113
+ (0, import_globalOptions.mapContensisOpts)({ search, ...opts })
114
114
  ).ImportEntries({
115
115
  commit: opts.commit,
116
116
  fromFile: opts.fromFile,
@@ -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 {\n commit,\n concurrency,\n getEntryOptions,\n ignoreErrors,\n mapContensisOpts,\n outputEntries,\n} 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(concurrency)\n .addOption(outputEntries)\n .addOption(ignoreErrors)\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import entries --from-file myImportData.json --preserve-guids\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 .argument('[root]', 'import nodes from the specified path e.g. /blog', '/')\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing nodes that you have previously exported and wish to update'\n )\n .addOption(ignoreErrors)\n .addOption(commit)\n .addOption(\n new Option(\n '-od --output-detail <outputDetail>',\n 'how much detail to output from the import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .option(\n '-ol --output-limit <outputLimit>',\n 'expand or limit the number of records output to the console',\n '200'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes /blog --source-alias example-alias --source-project-id example-project\n > import nodes --from-file site-backup.json --preserve-guids\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ paths: root.split(' '), ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n logLimit: Number(opts.outputLimit),\n });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
4
+ "sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\n getEntryOptions,\n ignoreErrors,\n mapContensisOpts,\n outputEntries,\n} 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(concurrency)\n .addOption(outputEntries)\n .addOption(ignoreErrors)\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import entries --from-file myImportData.json --preserve-guids\n`\n )\n .action(async (search: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ search, ...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 .argument('[root]', 'import nodes from the specified path e.g. /blog', '/')\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing nodes that you have previously exported and wish to update'\n )\n .addOption(ignoreErrors)\n .addOption(commit)\n .addOption(\n new Option(\n '-od --output-detail <outputDetail>',\n 'how much detail to output from the import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .option(\n '-ol --output-limit <outputLimit>',\n 'expand or limit the number of records output to the console',\n '200'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes /blog --source-alias example-alias --source-project-id example-project\n > import nodes --from-file site-backup.json --preserve-guids\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ paths: root.split(' '), ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n logLimit: Number(opts.outputLimit),\n });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,2BAOO;AAEA,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,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AEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
6
6
  "names": []
7
7
  }
@@ -168,16 +168,16 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
168
168
  get: (projectId, id) => `[${projectId}] Content type ${import_logger.Logger.highlightText(id)}`,
169
169
  failedGet: (projectId, id) => `[${projectId}] Unable to get content type ${import_logger.Logger.highlightText(id)}`,
170
170
  created: (projectId, id, status) => `[${projectId}] Content type ${status}d ${import_logger.Logger.highlightText(id)}`,
171
- removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} content type ${import_logger.Logger.highlightText(id)}`,
172
- failedRemove: (env, id) => `[${env}] Unable to delete content type ${import_logger.Logger.highlightText(id)}`
171
+ removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} content type(s) ${import_logger.Logger.highlightText(id)}`,
172
+ failedRemove: (env, id) => `[${env}] Unable to delete content type(s) ${import_logger.Logger.highlightText(id)}`
173
173
  },
174
174
  components: {
175
175
  list: (projectId) => `Components in ${import_logger.Logger.highlightText(projectId)}:`,
176
176
  get: (projectId, id) => `[${projectId}] Component ${import_logger.Logger.highlightText(id)}`,
177
177
  failedGet: (projectId, id) => `[${projectId}] Unable to get component ${import_logger.Logger.highlightText(id)}`,
178
178
  created: (projectId, id, status) => `[${projectId}] Component ${status}d ${import_logger.Logger.highlightText(id)}`,
179
- removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} component ${import_logger.Logger.highlightText(id)}`,
180
- failedRemove: (env, id) => `[${env}] Unable to delete component ${import_logger.Logger.highlightText(id)}`
179
+ removed: (env, id, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} component(s) ${import_logger.Logger.highlightText(id)}`,
180
+ failedRemove: (env, id) => `[${env}] Unable to delete component(s) ${import_logger.Logger.highlightText(id)}`
181
181
  },
182
182
  version: {
183
183
  set: (env, versionStatus) => `[${env}] Content version status set to "${versionStatus}"`,