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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) 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.map +1 -1
  23. package/dist/shell.js.map +1 -1
  24. package/dist/util/console.printer.js +5 -5
  25. package/dist/util/console.printer.js.map +2 -2
  26. package/dist/util/csv.formatter.js.map +1 -1
  27. package/dist/util/index.js.map +1 -1
  28. package/dist/util/json.formatter.js.map +1 -1
  29. package/dist/util/logger.js.map +1 -1
  30. package/dist/util/xml.formatter.js.map +1 -1
  31. package/dist/version.js +1 -1
  32. package/dist/version.js.map +1 -1
  33. package/esbuild.config.js +49 -49
  34. package/headless-setup.sh +6 -6
  35. package/package.json +59 -59
  36. package/src/commands/connect.ts +24 -24
  37. package/src/commands/create.ts +70 -70
  38. package/src/commands/diff.ts +41 -41
  39. package/src/commands/get.ts +214 -214
  40. package/src/commands/globalOptions.ts +127 -127
  41. package/src/commands/import.ts +128 -128
  42. package/src/commands/index.ts +80 -80
  43. package/src/commands/list.ts +116 -116
  44. package/src/commands/login.ts +34 -34
  45. package/src/commands/push.ts +127 -127
  46. package/src/commands/release.ts +32 -32
  47. package/src/commands/remove.ts +85 -85
  48. package/src/commands/set.ts +96 -96
  49. package/src/index.ts +19 -19
  50. package/src/localisation/en-GB.ts +289 -289
  51. package/src/models/AppError.d.ts +40 -40
  52. package/src/models/Cache.d.ts +25 -25
  53. package/src/models/JsModules.d.ts +1 -1
  54. package/src/providers/CredentialProvider.ts +121 -121
  55. package/src/providers/SessionCacheProvider.ts +101 -101
  56. package/src/providers/file-provider.ts +76 -76
  57. package/src/services/ContensisAuthService.ts +70 -70
  58. package/src/services/ContensisCliService.ts +1745 -1745
  59. package/src/shell.ts +270 -270
  60. package/src/util/console.printer.ts +371 -371
  61. package/src/util/csv.formatter.ts +21 -21
  62. package/src/util/index.ts +73 -73
  63. package/src/util/json.formatter.ts +1 -1
  64. package/src/util/logger.ts +234 -234
  65. package/src/util/xml.formatter.ts +20 -20
  66. package/src/version.ts +1 -1
  67. package/tsconfig.json +22 -22
@@ -1,128 +1,128 @@
1
- import { Argument, Command } from 'commander';
2
- import { cliCommand } from '~/services/ContensisCliService';
3
- import { url } from '~/util';
4
- import { commit, mapContensisOpts } from './globalOptions';
5
-
6
- export const makeImportCommand = () => {
7
- const program = new Command()
8
- .command('import')
9
- .description('import command')
10
- .addHelpText('after', `\n`)
11
- .showHelpAfterError(true)
12
- .exitOverride();
13
-
14
- program
15
- .command('models')
16
- .description('import complete content models')
17
- .argument('[modelIds...]', 'ids of the content models to import (optional)')
18
- .addOption(commit)
19
- .addHelpText(
20
- 'after',
21
- `
22
- Example call:
23
- > import models blogPost --from-file contentmodels-backup.json
24
- > import models --source-alias example-dev
25
- `
26
- )
27
- .action(async (modelIds: string[], opts) => {
28
- await cliCommand(
29
- ['import', 'models', modelIds.join(' ')],
30
- opts,
31
- mapContensisOpts({ modelIds, ...opts })
32
- ).ImportContentModels({
33
- fromFile: opts.fromFile,
34
- commit: opts.commit,
35
- });
36
- });
37
-
38
- program
39
- .command('contenttypes')
40
- .description('import content types')
41
- .argument(
42
- '[contentTypeIds...]',
43
- 'Optional list of API id(s) of the content type(s) to import'
44
- )
45
- .addOption(commit)
46
- .addHelpText(
47
- 'after',
48
- `
49
- Example call:
50
- > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json
51
- > import contenttypes {contentTypeIds} --source-alias example-dev
52
- `
53
- )
54
- .action(async (contentTypeIds: string[], opts) => {
55
- await cliCommand(
56
- ['import', 'contenttypes'],
57
- opts,
58
- mapContensisOpts({ contentTypeIds, ...opts })
59
- ).ImportContentTypes(
60
- {
61
- fromFile: opts.fromFile,
62
- commit: opts.commit,
63
- },
64
- contentTypeIds
65
- );
66
- });
67
-
68
- program
69
- .command('components')
70
- .description('import components')
71
- .argument(
72
- '[componentIds...]',
73
- 'Optional list of API id(s) of the component(s) to import'
74
- )
75
- .addOption(commit)
76
- .addHelpText(
77
- 'after',
78
- `
79
- Example call:
80
- > import components {componentIds} --from-file component-backup.json
81
- > import components {componentIds} --source-alias example-dev
82
- `
83
- )
84
- .action(async (componentIds: string[], opts) => {
85
- await cliCommand(
86
- ['import', 'component'],
87
- opts,
88
- mapContensisOpts({ componentIds, ...opts })
89
- ).ImportComponents(
90
- {
91
- fromFile: opts.fromFile,
92
- commit: opts.commit,
93
- },
94
- componentIds
95
- );
96
- });
97
-
98
- program
99
- .command('entries')
100
- .description('import entries')
101
- .argument(
102
- '[search phrase]',
103
- 'get entries with the search phrase, use quotes for multiple words'
104
- )
105
- .addOption(commit)
106
- .option(
107
- '-preserve, --preserve-guids',
108
- 'include this flag when you are importing entries that you have previously exported and wish to update'
109
- )
110
- .addHelpText(
111
- 'after',
112
- `
113
- Example call:
114
- > import entries --source-cms example-dev --source-project-id microsite --zenql "sys.contentTypeId = blog"
115
- `
116
- )
117
- .action(async (phrase: string, opts, cmd) => {
118
- await cliCommand(
119
- ['import', 'entries'],
120
- opts,
121
- mapContensisOpts({ phrase, ...opts })
122
- ).ImportEntries({ commit: opts.commit, fromFile: opts.fromFile });
123
- });
124
-
125
- return program;
126
- };
127
-
128
- export const get = makeImportCommand();
1
+ import { Argument, Command } from 'commander';
2
+ import { cliCommand } from '~/services/ContensisCliService';
3
+ import { url } from '~/util';
4
+ import { commit, mapContensisOpts } from './globalOptions';
5
+
6
+ export const makeImportCommand = () => {
7
+ const program = new Command()
8
+ .command('import')
9
+ .description('import command')
10
+ .addHelpText('after', `\n`)
11
+ .showHelpAfterError(true)
12
+ .exitOverride();
13
+
14
+ program
15
+ .command('models')
16
+ .description('import complete content models')
17
+ .argument('[modelIds...]', 'ids of the content models to import (optional)')
18
+ .addOption(commit)
19
+ .addHelpText(
20
+ 'after',
21
+ `
22
+ Example call:
23
+ > import models blogPost --from-file contentmodels-backup.json
24
+ > import models --source-alias example-dev
25
+ `
26
+ )
27
+ .action(async (modelIds: string[], opts) => {
28
+ await cliCommand(
29
+ ['import', 'models', modelIds.join(' ')],
30
+ opts,
31
+ mapContensisOpts({ modelIds, ...opts })
32
+ ).ImportContentModels({
33
+ fromFile: opts.fromFile,
34
+ commit: opts.commit,
35
+ });
36
+ });
37
+
38
+ program
39
+ .command('contenttypes')
40
+ .description('import content types')
41
+ .argument(
42
+ '[contentTypeIds...]',
43
+ 'Optional list of API id(s) of the content type(s) to import'
44
+ )
45
+ .addOption(commit)
46
+ .addHelpText(
47
+ 'after',
48
+ `
49
+ Example call:
50
+ > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json
51
+ > import contenttypes {contentTypeIds} --source-alias example-dev
52
+ `
53
+ )
54
+ .action(async (contentTypeIds: string[], opts) => {
55
+ await cliCommand(
56
+ ['import', 'contenttypes'],
57
+ opts,
58
+ mapContensisOpts({ contentTypeIds, ...opts })
59
+ ).ImportContentTypes(
60
+ {
61
+ fromFile: opts.fromFile,
62
+ commit: opts.commit,
63
+ },
64
+ contentTypeIds
65
+ );
66
+ });
67
+
68
+ program
69
+ .command('components')
70
+ .description('import components')
71
+ .argument(
72
+ '[componentIds...]',
73
+ 'Optional list of API id(s) of the component(s) to import'
74
+ )
75
+ .addOption(commit)
76
+ .addHelpText(
77
+ 'after',
78
+ `
79
+ Example call:
80
+ > import components {componentIds} --from-file component-backup.json
81
+ > import components {componentIds} --source-alias example-dev
82
+ `
83
+ )
84
+ .action(async (componentIds: string[], opts) => {
85
+ await cliCommand(
86
+ ['import', 'component'],
87
+ opts,
88
+ mapContensisOpts({ componentIds, ...opts })
89
+ ).ImportComponents(
90
+ {
91
+ fromFile: opts.fromFile,
92
+ commit: opts.commit,
93
+ },
94
+ componentIds
95
+ );
96
+ });
97
+
98
+ program
99
+ .command('entries')
100
+ .description('import entries')
101
+ .argument(
102
+ '[search phrase]',
103
+ 'get entries with the search phrase, use quotes for multiple words'
104
+ )
105
+ .addOption(commit)
106
+ .option(
107
+ '-preserve, --preserve-guids',
108
+ 'include this flag when you are importing entries that you have previously exported and wish to update'
109
+ )
110
+ .addHelpText(
111
+ 'after',
112
+ `
113
+ Example call:
114
+ > import entries --source-cms example-dev --source-project-id microsite --zenql "sys.contentTypeId = blog"
115
+ `
116
+ )
117
+ .action(async (phrase: string, opts, cmd) => {
118
+ await cliCommand(
119
+ ['import', 'entries'],
120
+ opts,
121
+ mapContensisOpts({ phrase, ...opts })
122
+ ).ImportEntries({ commit: opts.commit, fromFile: opts.fromFile });
123
+ });
124
+
125
+ return program;
126
+ };
127
+
128
+ export const get = makeImportCommand();
@@ -1,80 +1,80 @@
1
- import { Command } from 'commander';
2
- import { Logger } from '~/util/logger';
3
- import { LIB_VERSION } from '~/version';
4
- import { makeConnectCommand } from './connect';
5
- import { makeCreateCommand } from './create';
6
- import { makeDiffCommand } from './diff';
7
- import { makeGetCommand } from './get';
8
- import {
9
- addAuthenticationOptions,
10
- addConnectOptions,
11
- addGetEntryOptions,
12
- addGlobalOptions,
13
- addImportOptions,
14
- } from './globalOptions';
15
- import { makeImportCommand } from './import';
16
- import { makeListCommand } from './list';
17
- import { makeLoginCommand } from './login';
18
- import { makePushCommand } from './push';
19
- import { makeReleaseCommand } from './release';
20
- import { makeRemoveCommand } from './remove';
21
- import { makeSetCommand } from './set';
22
-
23
- const commands = () => {
24
- const program = new Command()
25
- .name('contensis')
26
- .version(LIB_VERSION)
27
- .configureOutput({
28
- writeErr: str => {
29
- return str.toLowerCase().includes('error')
30
- ? Logger.error(`Command ${str}`)
31
- : str.trim() && Logger.help(str);
32
- },
33
- })
34
- .exitOverride()
35
- .showHelpAfterError(true);
36
-
37
- program.addCommand(
38
- addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(
39
- program
40
- )
41
- );
42
- program.addCommand(
43
- addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)
44
- );
45
- program.addCommand(
46
- addGlobalOptions(
47
- addGetEntryOptions(addImportOptions(makeDiffCommand()))
48
- ).copyInheritedSettings(program)
49
- );
50
- program.addCommand(
51
- addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)
52
- );
53
- program.addCommand(
54
- addGlobalOptions(
55
- addGetEntryOptions(addImportOptions(makeImportCommand()))
56
- ).copyInheritedSettings(program)
57
- );
58
- program.addCommand(
59
- addGlobalOptions(makeListCommand()).copyInheritedSettings(program)
60
- );
61
- program.addCommand(
62
- addConnectOptions(makeLoginCommand()).copyInheritedSettings(program)
63
- );
64
- program.addCommand(
65
- addGlobalOptions(makePushCommand()).copyInheritedSettings(program)
66
- );
67
- program.addCommand(
68
- addGlobalOptions(makeReleaseCommand()).copyInheritedSettings(program)
69
- );
70
- program.addCommand(
71
- addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)
72
- );
73
- program.addCommand(
74
- addConnectOptions(makeSetCommand()).copyInheritedSettings(program)
75
- );
76
-
77
- return program;
78
- };
79
-
80
- export default commands;
1
+ import { Command } from 'commander';
2
+ import { Logger } from '~/util/logger';
3
+ import { LIB_VERSION } from '~/version';
4
+ import { makeConnectCommand } from './connect';
5
+ import { makeCreateCommand } from './create';
6
+ import { makeDiffCommand } from './diff';
7
+ import { makeGetCommand } from './get';
8
+ import {
9
+ addAuthenticationOptions,
10
+ addConnectOptions,
11
+ addGetEntryOptions,
12
+ addGlobalOptions,
13
+ addImportOptions,
14
+ } from './globalOptions';
15
+ import { makeImportCommand } from './import';
16
+ import { makeListCommand } from './list';
17
+ import { makeLoginCommand } from './login';
18
+ import { makePushCommand } from './push';
19
+ import { makeReleaseCommand } from './release';
20
+ import { makeRemoveCommand } from './remove';
21
+ import { makeSetCommand } from './set';
22
+
23
+ const commands = () => {
24
+ const program = new Command()
25
+ .name('contensis')
26
+ .version(LIB_VERSION)
27
+ .configureOutput({
28
+ writeErr: str => {
29
+ return str.toLowerCase().includes('error')
30
+ ? Logger.error(`Command ${str}`)
31
+ : str.trim() && Logger.help(str);
32
+ },
33
+ })
34
+ .exitOverride()
35
+ .showHelpAfterError(true);
36
+
37
+ program.addCommand(
38
+ addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(
39
+ program
40
+ )
41
+ );
42
+ program.addCommand(
43
+ addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)
44
+ );
45
+ program.addCommand(
46
+ addGlobalOptions(
47
+ addGetEntryOptions(addImportOptions(makeDiffCommand()))
48
+ ).copyInheritedSettings(program)
49
+ );
50
+ program.addCommand(
51
+ addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)
52
+ );
53
+ program.addCommand(
54
+ addGlobalOptions(
55
+ addGetEntryOptions(addImportOptions(makeImportCommand()))
56
+ ).copyInheritedSettings(program)
57
+ );
58
+ program.addCommand(
59
+ addGlobalOptions(makeListCommand()).copyInheritedSettings(program)
60
+ );
61
+ program.addCommand(
62
+ addConnectOptions(makeLoginCommand()).copyInheritedSettings(program)
63
+ );
64
+ program.addCommand(
65
+ addGlobalOptions(makePushCommand()).copyInheritedSettings(program)
66
+ );
67
+ program.addCommand(
68
+ addGlobalOptions(makeReleaseCommand()).copyInheritedSettings(program)
69
+ );
70
+ program.addCommand(
71
+ addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)
72
+ );
73
+ program.addCommand(
74
+ addConnectOptions(makeSetCommand()).copyInheritedSettings(program)
75
+ );
76
+
77
+ return program;
78
+ };
79
+
80
+ export default commands;
@@ -1,116 +1,116 @@
1
- import { Command } from 'commander';
2
- import { cliCommand } from '~/services/ContensisCliService';
3
-
4
- export const makeListCommand = () => {
5
- const list = new Command()
6
- .command('list')
7
- .description('list command')
8
- .addHelpText('after', `\n`)
9
- .showHelpAfterError(true)
10
- .exitOverride();
11
-
12
- list
13
- .command('envs')
14
- .description('List all previously connected environments')
15
- .addHelpText(
16
- 'after',
17
- `
18
- Example call:
19
- > list envs
20
- `
21
- )
22
- .action(opts => {
23
- cliCommand(['list', 'envs'], opts).PrintEnvironments();
24
- });
25
-
26
- list
27
- .command('projects')
28
- .description('print list of projects')
29
- .action(async opts => {
30
- await cliCommand(['list', 'projects'], opts).PrintProjects();
31
- });
32
-
33
- list
34
- .command('models')
35
- .description('print list of content models')
36
- .addHelpText(
37
- 'after',
38
- `
39
- Example call:
40
- > list models
41
- `
42
- )
43
- .action(async opts => {
44
- await cliCommand(['list', 'models'], opts).PrintContentModels();
45
- });
46
-
47
- list
48
- .command('contenttypes')
49
- .description('print list of content types')
50
- .addHelpText(
51
- 'after',
52
- `
53
- Example call:
54
- > list contenttypes -o ./output.json -f json
55
- `
56
- )
57
- .action(async opts => {
58
- await cliCommand(['list', 'contenttypes'], opts).PrintContentTypes();
59
- });
60
-
61
- list
62
- .command('components')
63
- .description('print list of components')
64
- .addHelpText(
65
- 'after',
66
- `
67
- Example call:
68
- > list components -o ./output.json -f json
69
- `
70
- )
71
- .action(async opts => {
72
- await cliCommand(['list', 'components'], opts).PrintComponents();
73
- });
74
-
75
- list
76
- .command('blocks')
77
- .description('print list of content blocks')
78
- .addHelpText(
79
- 'after',
80
- `
81
- Example call:
82
- > list blocks
83
- `
84
- )
85
- .action(async opts => {
86
- await cliCommand(['list', 'blocks'], opts).PrintBlocks();
87
- });
88
-
89
- list
90
- .command('keys')
91
- .description('print list of API keys')
92
- .addHelpText(
93
- 'after',
94
- `
95
- Example call:
96
- > list keys
97
- `
98
- )
99
- .action(async opts => {
100
- await cliCommand(['list', 'keys'], opts).PrintApiKeys();
101
- });
102
-
103
- list
104
- .command('webhooks')
105
- .description('print list of webhooks')
106
- .argument('[name]', 'find webhooks matching the supplied name')
107
- .option('-i --id <id...>', 'the subscription id(s) to get')
108
- .addHelpText('after', `\n`)
109
- .action(async (name?: string, { id, ...opts }: any = {}) => {
110
- await cliCommand(['list', 'webhooks'], opts).PrintWebhookSubscriptions(
111
- id,
112
- name
113
- );
114
- });
115
- return list;
116
- };
1
+ import { Command } from 'commander';
2
+ import { cliCommand } from '~/services/ContensisCliService';
3
+
4
+ export const makeListCommand = () => {
5
+ const list = new Command()
6
+ .command('list')
7
+ .description('list command')
8
+ .addHelpText('after', `\n`)
9
+ .showHelpAfterError(true)
10
+ .exitOverride();
11
+
12
+ list
13
+ .command('envs')
14
+ .description('List all previously connected environments')
15
+ .addHelpText(
16
+ 'after',
17
+ `
18
+ Example call:
19
+ > list envs
20
+ `
21
+ )
22
+ .action(opts => {
23
+ cliCommand(['list', 'envs'], opts).PrintEnvironments();
24
+ });
25
+
26
+ list
27
+ .command('projects')
28
+ .description('print list of projects')
29
+ .action(async opts => {
30
+ await cliCommand(['list', 'projects'], opts).PrintProjects();
31
+ });
32
+
33
+ list
34
+ .command('models')
35
+ .description('print list of content models')
36
+ .addHelpText(
37
+ 'after',
38
+ `
39
+ Example call:
40
+ > list models
41
+ `
42
+ )
43
+ .action(async opts => {
44
+ await cliCommand(['list', 'models'], opts).PrintContentModels();
45
+ });
46
+
47
+ list
48
+ .command('contenttypes')
49
+ .description('print list of content types')
50
+ .addHelpText(
51
+ 'after',
52
+ `
53
+ Example call:
54
+ > list contenttypes -o ./output.json -f json
55
+ `
56
+ )
57
+ .action(async opts => {
58
+ await cliCommand(['list', 'contenttypes'], opts).PrintContentTypes();
59
+ });
60
+
61
+ list
62
+ .command('components')
63
+ .description('print list of components')
64
+ .addHelpText(
65
+ 'after',
66
+ `
67
+ Example call:
68
+ > list components -o ./output.json -f json
69
+ `
70
+ )
71
+ .action(async opts => {
72
+ await cliCommand(['list', 'components'], opts).PrintComponents();
73
+ });
74
+
75
+ list
76
+ .command('blocks')
77
+ .description('print list of content blocks')
78
+ .addHelpText(
79
+ 'after',
80
+ `
81
+ Example call:
82
+ > list blocks
83
+ `
84
+ )
85
+ .action(async opts => {
86
+ await cliCommand(['list', 'blocks'], opts).PrintBlocks();
87
+ });
88
+
89
+ list
90
+ .command('keys')
91
+ .description('print list of API keys')
92
+ .addHelpText(
93
+ 'after',
94
+ `
95
+ Example call:
96
+ > list keys
97
+ `
98
+ )
99
+ .action(async opts => {
100
+ await cliCommand(['list', 'keys'], opts).PrintApiKeys();
101
+ });
102
+
103
+ list
104
+ .command('webhooks')
105
+ .description('print list of webhooks')
106
+ .argument('[name]', 'find webhooks matching the supplied name')
107
+ .option('-i --id <id...>', 'the subscription id(s) to get')
108
+ .addHelpText('after', `\n`)
109
+ .action(async (name?: string, { id, ...opts }: any = {}) => {
110
+ await cliCommand(['list', 'webhooks'], opts).PrintWebhookSubscriptions(
111
+ id,
112
+ name
113
+ );
114
+ });
115
+ return list;
116
+ };