contensis-cli 1.0.0-beta.53 → 1.0.0-beta.55

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.
Files changed (68) hide show
  1. package/.vscode/launch.json +15 -15
  2. package/README.md +1226 -1226
  3. package/dist/commands/connect.js.map +1 -1
  4. package/dist/commands/create.js.map +1 -1
  5. package/dist/commands/diff.js.map +1 -1
  6. package/dist/commands/get.js.map +1 -1
  7. package/dist/commands/globalOptions.js.map +1 -1
  8. package/dist/commands/import.js.map +1 -1
  9. package/dist/commands/index.js.map +1 -1
  10. package/dist/commands/list.js.map +1 -1
  11. package/dist/commands/login.js.map +1 -1
  12. package/dist/commands/push.js.map +1 -1
  13. package/dist/commands/release.js.map +1 -1
  14. package/dist/commands/remove.js.map +1 -1
  15. package/dist/commands/set.js.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/localisation/en-GB.js.map +1 -1
  18. package/dist/providers/CredentialProvider.js.map +1 -1
  19. package/dist/providers/SessionCacheProvider.js.map +1 -1
  20. package/dist/providers/file-provider.js.map +1 -1
  21. package/dist/services/ContensisAuthService.js.map +1 -1
  22. package/dist/services/ContensisCliService.js +4 -0
  23. package/dist/services/ContensisCliService.js.map +2 -2
  24. package/dist/shell.js.map +1 -1
  25. package/dist/util/console.printer.js +5 -5
  26. package/dist/util/console.printer.js.map +2 -2
  27. package/dist/util/csv.formatter.js.map +1 -1
  28. package/dist/util/index.js.map +1 -1
  29. package/dist/util/json.formatter.js.map +1 -1
  30. package/dist/util/logger.js.map +1 -1
  31. package/dist/util/xml.formatter.js.map +1 -1
  32. package/dist/version.js +1 -1
  33. package/dist/version.js.map +1 -1
  34. package/esbuild.config.js +49 -49
  35. package/headless-setup.sh +6 -6
  36. package/package.json +59 -59
  37. package/src/commands/connect.ts +24 -24
  38. package/src/commands/create.ts +70 -70
  39. package/src/commands/diff.ts +41 -41
  40. package/src/commands/get.ts +214 -214
  41. package/src/commands/globalOptions.ts +127 -127
  42. package/src/commands/import.ts +128 -128
  43. package/src/commands/index.ts +80 -80
  44. package/src/commands/list.ts +116 -116
  45. package/src/commands/login.ts +34 -34
  46. package/src/commands/push.ts +127 -127
  47. package/src/commands/release.ts +32 -32
  48. package/src/commands/remove.ts +85 -85
  49. package/src/commands/set.ts +96 -96
  50. package/src/index.ts +19 -19
  51. package/src/localisation/en-GB.ts +289 -289
  52. package/src/models/AppError.d.ts +40 -40
  53. package/src/models/Cache.d.ts +25 -25
  54. package/src/models/JsModules.d.ts +1 -1
  55. package/src/providers/CredentialProvider.ts +121 -121
  56. package/src/providers/SessionCacheProvider.ts +101 -101
  57. package/src/providers/file-provider.ts +76 -76
  58. package/src/services/ContensisAuthService.ts +70 -70
  59. package/src/services/ContensisCliService.ts +1749 -1745
  60. package/src/shell.ts +270 -270
  61. package/src/util/console.printer.ts +371 -371
  62. package/src/util/csv.formatter.ts +21 -21
  63. package/src/util/index.ts +73 -73
  64. package/src/util/json.formatter.ts +1 -1
  65. package/src/util/logger.ts +234 -234
  66. package/src/util/xml.formatter.ts +20 -20
  67. package/src/version.ts +1 -1
  68. package/tsconfig.json +22 -22
@@ -1,85 +1,85 @@
1
- import { Command } from 'commander';
2
- import { cliCommand } from '~/services/ContensisCliService';
3
- import { shell } from '~/shell';
4
- import { commit, mapContensisOpts, zenql } from './globalOptions';
5
-
6
- export const makeRemoveCommand = () => {
7
- const remove = new Command()
8
- .command('remove')
9
- .description('remove command')
10
- .addHelpText('after', `\n`)
11
- .showHelpAfterError(true)
12
- .exitOverride();
13
-
14
- remove
15
- .command('project')
16
- .description('remove an entire project')
17
- .argument('<projectId>', 'the project id to delete')
18
- .usage('<projectId>')
19
- .addHelpText('after', `\n`)
20
- .action(async (projectId, opts) => {
21
- const project = await cliCommand(
22
- ['remove', 'project', projectId],
23
- opts
24
- ).SetProject(projectId);
25
- if (project) await shell().restart();
26
- });
27
-
28
- remove
29
- .command('key')
30
- .description('remove api key')
31
- .argument('<id>', 'the id of the API key to delete')
32
- .usage('<id>')
33
- .addHelpText(
34
- 'after',
35
- `
36
- Example call:
37
- > remove key 4ceb9575-28d3-4d5b-a77b-5e5221e603dd
38
- `
39
- )
40
- .action(async (id, opts) => {
41
- await cliCommand(['remove', 'key', id], opts).RemoveApiKey(id);
42
- });
43
-
44
- remove
45
- .command('components')
46
- .description('delete components')
47
- .argument('<id...>', 'the id(s) of the components to delete')
48
- .addOption(commit)
49
- .usage('<id> [--commit]')
50
- .addHelpText(
51
- 'after',
52
- `
53
- Example call:
54
- > remove components addressComponent
55
- `
56
- )
57
- .action(async (id: string[], opts) => {
58
- await cliCommand(
59
- ['remove', 'components', id.join(' ')],
60
- opts
61
- ).RemoveComponents(id, opts.commit);
62
- });
63
-
64
- remove
65
- .command('contenttypes')
66
- .description('delete content types')
67
- .argument('<id...>', 'the id(s) of the content types to delete')
68
- .addOption(commit)
69
- .usage('<id> [--commit]')
70
- .addHelpText(
71
- 'after',
72
- `
73
- Example call:
74
- > remove contenttypes blogPost
75
- `
76
- )
77
- .action(async (id: string[], opts) => {
78
- await cliCommand(
79
- ['remove', 'contenttypes', id.join(' ')],
80
- opts
81
- ).RemoveContentTypes(id, opts.commit);
82
- });
83
-
84
- return remove;
85
- };
1
+ import { Command } from 'commander';
2
+ import { cliCommand } from '~/services/ContensisCliService';
3
+ import { shell } from '~/shell';
4
+ import { commit, mapContensisOpts, zenql } from './globalOptions';
5
+
6
+ export const makeRemoveCommand = () => {
7
+ const remove = new Command()
8
+ .command('remove')
9
+ .description('remove command')
10
+ .addHelpText('after', `\n`)
11
+ .showHelpAfterError(true)
12
+ .exitOverride();
13
+
14
+ remove
15
+ .command('project')
16
+ .description('remove an entire project')
17
+ .argument('<projectId>', 'the project id to delete')
18
+ .usage('<projectId>')
19
+ .addHelpText('after', `\n`)
20
+ .action(async (projectId, opts) => {
21
+ const project = await cliCommand(
22
+ ['remove', 'project', projectId],
23
+ opts
24
+ ).SetProject(projectId);
25
+ if (project) await shell().restart();
26
+ });
27
+
28
+ remove
29
+ .command('key')
30
+ .description('remove api key')
31
+ .argument('<id>', 'the id of the API key to delete')
32
+ .usage('<id>')
33
+ .addHelpText(
34
+ 'after',
35
+ `
36
+ Example call:
37
+ > remove key 4ceb9575-28d3-4d5b-a77b-5e5221e603dd
38
+ `
39
+ )
40
+ .action(async (id, opts) => {
41
+ await cliCommand(['remove', 'key', id], opts).RemoveApiKey(id);
42
+ });
43
+
44
+ remove
45
+ .command('components')
46
+ .description('delete components')
47
+ .argument('<id...>', 'the id(s) of the components to delete')
48
+ .addOption(commit)
49
+ .usage('<id> [--commit]')
50
+ .addHelpText(
51
+ 'after',
52
+ `
53
+ Example call:
54
+ > remove components addressComponent
55
+ `
56
+ )
57
+ .action(async (id: string[], opts) => {
58
+ await cliCommand(
59
+ ['remove', 'components', id.join(' ')],
60
+ opts
61
+ ).RemoveComponents(id, opts.commit);
62
+ });
63
+
64
+ remove
65
+ .command('contenttypes')
66
+ .description('delete content types')
67
+ .argument('<id...>', 'the id(s) of the content types to delete')
68
+ .addOption(commit)
69
+ .usage('<id> [--commit]')
70
+ .addHelpText(
71
+ 'after',
72
+ `
73
+ Example call:
74
+ > remove contenttypes blogPost
75
+ `
76
+ )
77
+ .action(async (id: string[], opts) => {
78
+ await cliCommand(
79
+ ['remove', 'contenttypes', id.join(' ')],
80
+ opts
81
+ ).RemoveContentTypes(id, opts.commit);
82
+ });
83
+
84
+ return remove;
85
+ };
@@ -1,96 +1,96 @@
1
- import { Argument, Command } from 'commander';
2
- import { cliCommand } from '~/services/ContensisCliService';
3
- import { shell } from '~/shell';
4
-
5
- export const makeSetCommand = () => {
6
- const set = new Command()
7
- .command('set')
8
- .description('set command')
9
- .addHelpText('after', `\n`)
10
- .showHelpAfterError(true)
11
- .exitOverride();
12
-
13
- const project = set
14
- .command('project')
15
- .description('set current working project')
16
- .argument('<projectId>', 'the project id to work with')
17
- .usage('<projectId>')
18
- .addHelpText(
19
- 'after',
20
- `
21
- Example call:
22
- > set project website\n`
23
- )
24
- .action(async projectId => {
25
- const nextProjectId = cliCommand([
26
- 'set',
27
- 'project',
28
- projectId,
29
- ]).SetProject(projectId);
30
- if (nextProjectId) await shell().restart();
31
- });
32
-
33
- project
34
- .command('name')
35
- .description('update project name')
36
- .argument('<"Project name">', 'update the current project name')
37
- .usage('<"Project name">')
38
- .addHelpText(
39
- 'after',
40
- `
41
- Example call:
42
- > set project name "Project name"\n`
43
- )
44
- .action(async (name: string, opts) => {
45
- const success = await cliCommand(
46
- ['set', 'project', 'name'],
47
- opts
48
- ).UpdateProject({
49
- name,
50
- });
51
- if (success) await shell().restart();
52
- });
53
-
54
- project
55
- .command('description')
56
- .description('update project description')
57
- .argument(
58
- '<"Project description">',
59
- 'update the current project description'
60
- )
61
- .usage('<"Project description">')
62
- .addHelpText(
63
- 'after',
64
- `
65
- Example call:
66
- > set project description "Description of project"\n`
67
- )
68
- .action(async (description: string, opts) => {
69
- const success = await cliCommand(
70
- ['set', 'project', 'description'],
71
- opts
72
- ).UpdateProject({
73
- description,
74
- });
75
- if (success) await shell().restart();
76
- });
77
-
78
- set
79
- .command('version')
80
- .description('set content version')
81
- .addArgument(
82
- new Argument('<versionStatus>', 'content version status')
83
- .choices(['latest', 'published'])
84
- .default('latest')
85
- )
86
- .usage('<latest/published>')
87
- .addHelpText('after', `\n`)
88
- .action(async versionStatus => {
89
- const success = cliCommand(['set', 'version', versionStatus]).SetVersion(
90
- versionStatus
91
- );
92
- if (success) await shell().restart();
93
- });
94
-
95
- return set;
96
- };
1
+ import { Argument, Command } from 'commander';
2
+ import { cliCommand } from '~/services/ContensisCliService';
3
+ import { shell } from '~/shell';
4
+
5
+ export const makeSetCommand = () => {
6
+ const set = new Command()
7
+ .command('set')
8
+ .description('set command')
9
+ .addHelpText('after', `\n`)
10
+ .showHelpAfterError(true)
11
+ .exitOverride();
12
+
13
+ const project = set
14
+ .command('project')
15
+ .description('set current working project')
16
+ .argument('<projectId>', 'the project id to work with')
17
+ .usage('<projectId>')
18
+ .addHelpText(
19
+ 'after',
20
+ `
21
+ Example call:
22
+ > set project website\n`
23
+ )
24
+ .action(async projectId => {
25
+ const nextProjectId = cliCommand([
26
+ 'set',
27
+ 'project',
28
+ projectId,
29
+ ]).SetProject(projectId);
30
+ if (nextProjectId) await shell().restart();
31
+ });
32
+
33
+ project
34
+ .command('name')
35
+ .description('update project name')
36
+ .argument('<"Project name">', 'update the current project name')
37
+ .usage('<"Project name">')
38
+ .addHelpText(
39
+ 'after',
40
+ `
41
+ Example call:
42
+ > set project name "Project name"\n`
43
+ )
44
+ .action(async (name: string, opts) => {
45
+ const success = await cliCommand(
46
+ ['set', 'project', 'name'],
47
+ opts
48
+ ).UpdateProject({
49
+ name,
50
+ });
51
+ if (success) await shell().restart();
52
+ });
53
+
54
+ project
55
+ .command('description')
56
+ .description('update project description')
57
+ .argument(
58
+ '<"Project description">',
59
+ 'update the current project description'
60
+ )
61
+ .usage('<"Project description">')
62
+ .addHelpText(
63
+ 'after',
64
+ `
65
+ Example call:
66
+ > set project description "Description of project"\n`
67
+ )
68
+ .action(async (description: string, opts) => {
69
+ const success = await cliCommand(
70
+ ['set', 'project', 'description'],
71
+ opts
72
+ ).UpdateProject({
73
+ description,
74
+ });
75
+ if (success) await shell().restart();
76
+ });
77
+
78
+ set
79
+ .command('version')
80
+ .description('set content version')
81
+ .addArgument(
82
+ new Argument('<versionStatus>', 'content version status')
83
+ .choices(['latest', 'published'])
84
+ .default('latest')
85
+ )
86
+ .usage('<latest/published>')
87
+ .addHelpText('after', `\n`)
88
+ .action(async versionStatus => {
89
+ const success = cliCommand(['set', 'version', versionStatus]).SetVersion(
90
+ versionStatus
91
+ );
92
+ if (success) await shell().restart();
93
+ });
94
+
95
+ return set;
96
+ };
package/src/index.ts CHANGED
@@ -1,19 +1,19 @@
1
- import commands from './commands';
2
- import { logError } from './util/logger';
3
- import ContensisCli from './services/ContensisCliService';
4
- import { jsonFormatter } from './util/json.formatter';
5
- // new ContensisCli(process.argv).DoCommandTasksAsync();
6
-
7
- // This is the CLI part of the app
8
- const program = commands();
9
- program
10
- .parseAsync(process.argv)
11
- .then(() => {
12
- ContensisCli.quit();
13
- })
14
- .catch((err: any) => {
15
- if (!err.name?.includes('CommanderError'))
16
- logError(err, `CLI ${err.toString()}`);
17
- ContensisCli.quit(err);
18
- });
19
- //.exitOverride(() => console.log('exit override!!!'));
1
+ import commands from './commands';
2
+ import { logError } from './util/logger';
3
+ import ContensisCli from './services/ContensisCliService';
4
+ import { jsonFormatter } from './util/json.formatter';
5
+ // new ContensisCli(process.argv).DoCommandTasksAsync();
6
+
7
+ // This is the CLI part of the app
8
+ const program = commands();
9
+ program
10
+ .parseAsync(process.argv)
11
+ .then(() => {
12
+ ContensisCli.quit();
13
+ })
14
+ .catch((err: any) => {
15
+ if (!err.name?.includes('CommanderError'))
16
+ logError(err, `CLI ${err.toString()}`);
17
+ ContensisCli.quit(err);
18
+ });
19
+ //.exitOverride(() => console.log('exit override!!!'));