contensis-cli 1.1.2-beta.13 → 1.1.2-beta.15

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/version.js CHANGED
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  LIB_VERSION: () => LIB_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const LIB_VERSION = "1.1.2-beta.13";
24
+ const LIB_VERSION = "1.1.2-beta.15";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  LIB_VERSION
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["export const LIB_VERSION = \"1.1.2-beta.13\";\n"],
4
+ "sourcesContent": ["export const LIB_VERSION = \"1.1.2-beta.15\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contensis-cli",
3
- "version": "1.1.2-beta.13",
3
+ "version": "1.1.2-beta.15",
4
4
  "description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
5
5
  "repository": "https://github.com/contensis/cli",
6
6
  "homepage": "https://github.com/contensis/cli/tree/main/packages/contensis-cli#readme",
@@ -18,7 +18,8 @@
18
18
  "build:watch": "node esbuild.config.js --watch",
19
19
  "cli": "node --inspect=9229 ./cli.js",
20
20
  "postinstall": "npx patch-package",
21
- "test": "echo \"Error: no test specified\" && exit 1"
21
+ "test": "echo \"Error: no test specified\" && exit 1",
22
+ "package-lock": "npm i --package-lock-only --workspaces false"
22
23
  },
23
24
  "author": "Zengenti",
24
25
  "license": "ISC",
@@ -39,7 +40,7 @@
39
40
  "jsonpath-mapper": "^1.1.0",
40
41
  "keytar": "^7.9.0",
41
42
  "lodash": "^4.17.21",
42
- "migratortron": "^1.0.0-beta.47",
43
+ "migratortron": "^1.0.0-beta.48",
43
44
  "nanospinner": "^1.1.0",
44
45
  "node-fetch": "^2.6.7",
45
46
  "parse-git-config": "^3.0.0",
@@ -4,7 +4,6 @@ import { cliCommand } from '~/services/ContensisCliService';
4
4
  import {
5
5
  commit,
6
6
  concurrency,
7
- delivery,
8
7
  entryId,
9
8
  ignoreErrors,
10
9
  mapContensisOpts,
@@ -37,9 +36,16 @@ export const makeCopyCommand = () => {
37
36
  .addOption(concurrency)
38
37
  .addOption(ignoreErrors)
39
38
  .addOption(outputEntries)
40
- .addOption(delivery)
39
+ .option(
40
+ '--search <phrase>',
41
+ 'get entries with the search phrase, use quotes for multiple words'
42
+ )
41
43
  .addOption(entryId)
42
44
  .addOption(zenql)
45
+ .option(
46
+ '-s --save-entries',
47
+ "save the entries we're migrating instead of the migration preview when using --output option"
48
+ )
43
49
  .usage('<contentTypeId> <fieldId> <destinationId> (all arguments required)')
44
50
  .addHelpText(
45
51
  'after',
@@ -71,6 +77,7 @@ Example call:
71
77
  commit: opts.commit,
72
78
  fromFile: opts.fromFile,
73
79
  logOutput: opts.outputEntries,
80
+ saveEntries: opts.saveEntries,
74
81
  });
75
82
  }
76
83
  );
@@ -5,6 +5,7 @@ import {
5
5
  addGlobalOptions,
6
6
  assetTypes,
7
7
  contentTypes,
8
+ delivery,
8
9
  entryId,
9
10
  mapContensisOpts,
10
11
  zenql,
@@ -184,7 +185,8 @@ Example call:
184
185
  '-ob --order-by <orderBy...>',
185
186
  'field name(s) to order the results by (prefix "-" for descending)'
186
187
  )
187
- );
188
+ )
189
+ .addOption(delivery);
188
190
 
189
191
  sharedGetEntryOptions(
190
192
  program
@@ -204,13 +206,13 @@ Example call:
204
206
  > get assets --zenql "sys.contentTypeId = blog" --fields sys.id sys.properties.filePath sys.properties.filename
205
207
  `
206
208
  )
207
- .action(async (phrase: string, opts) => {
209
+ .action(async (search: string, opts) => {
208
210
  // Maintaining a separate command for assets vs entries
209
211
  // allows us to offer up more options when dealing with just assets
210
212
  await cliCommand(
211
213
  ['get', 'assets'],
212
214
  opts,
213
- mapContensisOpts({ dataFormat: 'asset', phrase, ...opts })
215
+ mapContensisOpts({ dataFormat: 'asset', search, ...opts })
214
216
  ).GetEntries({});
215
217
  });
216
218
 
@@ -244,13 +246,11 @@ Example call:
244
246
  > get entries --content-type blog --fields entryTitle sys.version.modified --order-by -sys.version.modified
245
247
  `
246
248
  )
247
- .action(async (phrase: string, opts, cmd) => {
248
- // console.log('phrase: ', phrase, '\nopts:', JSON.stringify(opts, null, 2));
249
- // console.log('opts:', JSON.stringify(opts, null, 2));
249
+ .action(async (search: string, opts, cmd) => {
250
250
  await cliCommand(
251
251
  ['get', 'entries'],
252
252
  opts,
253
- mapContensisOpts({ phrase, ...opts })
253
+ mapContensisOpts({ search, ...opts })
254
254
  ).GetEntries({
255
255
  withDependents: opts.dependents,
256
256
  });
@@ -20,7 +20,7 @@ export const mapContensisOpts = (opts: any = {}): MigrateRequest => ({
20
20
  query:
21
21
  opts.id ||
22
22
  opts.entryIds ||
23
- opts.phrase ||
23
+ opts.search ||
24
24
  opts.fields ||
25
25
  opts.orderBy ||
26
26
  opts.paths ||
@@ -36,7 +36,7 @@ export const mapContensisOpts = (opts: any = {}): MigrateRequest => ({
36
36
  includeIds: opts.id || opts.entryIds,
37
37
  includePaths: opts.paths,
38
38
  orderBy: opts.orderBy,
39
- searchTerm: opts.phrase,
39
+ searchTerm: opts.search,
40
40
  useDelivery: opts.deliveryApi,
41
41
  }
42
42
  : undefined,
@@ -91,7 +91,10 @@ export const delivery = new Option(
91
91
  '-delivery --delivery-api',
92
92
  'use delivery api to get the entries'
93
93
  );
94
-
94
+ export const search = new Option(
95
+ '--search <phrase>',
96
+ 'get entries with the search phrase, use quotes for multiple words'
97
+ );
95
98
  export const zenql = new Option(
96
99
  '-q --zenql <zenql>',
97
100
  'get entries with a supplied ZenQL statement'
@@ -126,11 +126,11 @@ Example call:
126
126
  > import entries --from-file myImportData.json --preserve-guids
127
127
  `
128
128
  )
129
- .action(async (phrase: string, opts, cmd) => {
129
+ .action(async (search: string, opts, cmd) => {
130
130
  await cliCommand(
131
131
  ['import', 'entries'],
132
132
  opts,
133
- mapContensisOpts({ phrase, ...opts })
133
+ mapContensisOpts({ search, ...opts })
134
134
  ).ImportEntries({
135
135
  commit: opts.commit,
136
136
  fromFile: opts.fromFile,
@@ -1815,10 +1815,12 @@ class ContensisCli {
1815
1815
  commit,
1816
1816
  fromFile,
1817
1817
  logOutput,
1818
+ saveEntries,
1818
1819
  }: {
1819
1820
  commit: boolean;
1820
1821
  fromFile: string;
1821
1822
  logOutput: string;
1823
+ saveEntries: boolean;
1822
1824
  }) => {
1823
1825
  const { currentEnv, currentProject, log, messages } = this;
1824
1826
 
@@ -1841,8 +1843,13 @@ class ContensisCli {
1841
1843
  );
1842
1844
 
1843
1845
  if (err) logError(err);
1844
- if (result)
1845
- await this.HandleFormattingAndOutput(result, () => {
1846
+ if (result) {
1847
+ const output = saveEntries
1848
+ ? contensis.content.copy.targets[currentProject].migrateEntries?.map(
1849
+ me => me.finalEntry
1850
+ )
1851
+ : result;
1852
+ await this.HandleFormattingAndOutput(output, () => {
1846
1853
  // print the migrateResult to console
1847
1854
  printEntriesMigrateResult(this, result, {
1848
1855
  showAll: logOutput === 'all',
@@ -1850,6 +1857,7 @@ class ContensisCli {
1850
1857
  showChanged: logOutput === 'changes',
1851
1858
  });
1852
1859
  });
1860
+ }
1853
1861
 
1854
1862
  if (
1855
1863
  result &&
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.1.2-beta.13";
1
+ export const LIB_VERSION = "1.1.2-beta.15";