contensis-cli 1.6.1-beta.8 → 1.7.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/LICENSE +674 -0
  3. package/dist/index.js +58362 -11
  4. package/dist/index.js.map +4 -4
  5. package/dist/shell.js +58100 -52
  6. package/dist/shell.js.map +4 -4
  7. package/docs/copy_field_templates.md +112 -0
  8. package/esbuild.config.js +8 -13
  9. package/package.json +3 -3
  10. package/src/commands/create.ts +48 -0
  11. package/src/commands/dev.ts +6 -0
  12. package/src/commands/push.ts +38 -6
  13. package/src/commands/set.ts +70 -1
  14. package/src/factories/RequestHandlerFactory.ts +6 -3
  15. package/src/localisation/en-GB.ts +12 -0
  16. package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +3 -0
  17. package/src/models/CliService.d.ts +5 -1
  18. package/src/providers/GitHubCliModuleProvider.ts +8 -8
  19. package/src/services/ContensisCliService.ts +189 -7
  20. package/src/shell.ts +6 -1
  21. package/src/util/logger.ts +3 -4
  22. package/src/util/os.ts +5 -3
  23. package/src/version.ts +1 -1
  24. package/dist/commands/connect.js +0 -44
  25. package/dist/commands/connect.js.map +0 -7
  26. package/dist/commands/copy.js +0 -78
  27. package/dist/commands/copy.js.map +0 -7
  28. package/dist/commands/create.js +0 -170
  29. package/dist/commands/create.js.map +0 -7
  30. package/dist/commands/dev.js +0 -81
  31. package/dist/commands/dev.js.map +0 -7
  32. package/dist/commands/diff.js +0 -57
  33. package/dist/commands/diff.js.map +0 -7
  34. package/dist/commands/execute.js +0 -103
  35. package/dist/commands/execute.js.map +0 -7
  36. package/dist/commands/get.js +0 -330
  37. package/dist/commands/get.js.map +0 -7
  38. package/dist/commands/globalOptions.js +0 -252
  39. package/dist/commands/globalOptions.js.map +0 -7
  40. package/dist/commands/import.js +0 -256
  41. package/dist/commands/import.js.map +0 -7
  42. package/dist/commands/index.js +0 -107
  43. package/dist/commands/index.js.map +0 -7
  44. package/dist/commands/list.js +0 -195
  45. package/dist/commands/list.js.map +0 -7
  46. package/dist/commands/login.js +0 -55
  47. package/dist/commands/login.js.map +0 -7
  48. package/dist/commands/push.js +0 -234
  49. package/dist/commands/push.js.map +0 -7
  50. package/dist/commands/remove.js +0 -193
  51. package/dist/commands/remove.js.map +0 -7
  52. package/dist/commands/set.js +0 -180
  53. package/dist/commands/set.js.map +0 -7
  54. package/dist/commands/update.js +0 -70
  55. package/dist/commands/update.js.map +0 -7
  56. package/dist/factories/RequestHandlerFactory.js +0 -227
  57. package/dist/factories/RequestHandlerFactory.js.map +0 -7
  58. package/dist/localisation/en-GB.js +0 -559
  59. package/dist/localisation/en-GB.js.map +0 -7
  60. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +0 -56
  61. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +0 -7
  62. package/dist/mappers/DevInit-to-CIWorkflow.js +0 -409
  63. package/dist/mappers/DevInit-to-CIWorkflow.js.map +0 -7
  64. package/dist/mappers/DevInit-to-RolePermissions.js +0 -56
  65. package/dist/mappers/DevInit-to-RolePermissions.js.map +0 -7
  66. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +0 -168
  67. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +0 -7
  68. package/dist/mappers/MixedFileData.js +0 -83
  69. package/dist/mappers/MixedFileData.js.map +0 -7
  70. package/dist/models/AppError.d.js +0 -2
  71. package/dist/models/AppError.d.js.map +0 -7
  72. package/dist/models/Cache.d.js +0 -2
  73. package/dist/models/Cache.d.js.map +0 -7
  74. package/dist/models/CliService.d.js +0 -17
  75. package/dist/models/CliService.d.js.map +0 -7
  76. package/dist/models/DevService.d.js +0 -17
  77. package/dist/models/DevService.d.js.map +0 -7
  78. package/dist/models/JsModules.d.js +0 -2
  79. package/dist/models/JsModules.d.js.map +0 -7
  80. package/dist/providers/CredentialProvider.js +0 -126
  81. package/dist/providers/CredentialProvider.js.map +0 -7
  82. package/dist/providers/GitHubCliModuleProvider.js +0 -115
  83. package/dist/providers/GitHubCliModuleProvider.js.map +0 -7
  84. package/dist/providers/HttpProvider.js +0 -73
  85. package/dist/providers/HttpProvider.js.map +0 -7
  86. package/dist/providers/ManifestProvider.js +0 -50
  87. package/dist/providers/ManifestProvider.js.map +0 -7
  88. package/dist/providers/SessionCacheProvider.js +0 -132
  89. package/dist/providers/SessionCacheProvider.js.map +0 -7
  90. package/dist/providers/file-provider.js +0 -177
  91. package/dist/providers/file-provider.js.map +0 -7
  92. package/dist/services/ContensisAuthService.js +0 -88
  93. package/dist/services/ContensisAuthService.js.map +0 -7
  94. package/dist/services/ContensisCliService.js +0 -2661
  95. package/dist/services/ContensisCliService.js.map +0 -7
  96. package/dist/services/ContensisDevService.js +0 -435
  97. package/dist/services/ContensisDevService.js.map +0 -7
  98. package/dist/services/ContensisRoleService.js +0 -112
  99. package/dist/services/ContensisRoleService.js.map +0 -7
  100. package/dist/util/api-ids.js +0 -110
  101. package/dist/util/api-ids.js.map +0 -7
  102. package/dist/util/assert.js +0 -62
  103. package/dist/util/assert.js.map +0 -7
  104. package/dist/util/console.printer.js +0 -461
  105. package/dist/util/console.printer.js.map +0 -7
  106. package/dist/util/csv.formatter.js +0 -118
  107. package/dist/util/csv.formatter.js.map +0 -7
  108. package/dist/util/debug.js +0 -29
  109. package/dist/util/debug.js.map +0 -7
  110. package/dist/util/diff.js +0 -118
  111. package/dist/util/diff.js.map +0 -7
  112. package/dist/util/dotenv.js +0 -56
  113. package/dist/util/dotenv.js.map +0 -7
  114. package/dist/util/error.js +0 -36
  115. package/dist/util/error.js.map +0 -7
  116. package/dist/util/fetch.js +0 -69
  117. package/dist/util/fetch.js.map +0 -7
  118. package/dist/util/find.js +0 -39
  119. package/dist/util/find.js.map +0 -7
  120. package/dist/util/git.js +0 -145
  121. package/dist/util/git.js.map +0 -7
  122. package/dist/util/gitignore.js +0 -61
  123. package/dist/util/gitignore.js.map +0 -7
  124. package/dist/util/html.formatter.js +0 -70
  125. package/dist/util/html.formatter.js.map +0 -7
  126. package/dist/util/index.js +0 -68
  127. package/dist/util/index.js.map +0 -7
  128. package/dist/util/json.formatter.js +0 -66
  129. package/dist/util/json.formatter.js.map +0 -7
  130. package/dist/util/logger.js +0 -304
  131. package/dist/util/logger.js.map +0 -7
  132. package/dist/util/os.js +0 -46
  133. package/dist/util/os.js.map +0 -7
  134. package/dist/util/timers.js +0 -49
  135. package/dist/util/timers.js.map +0 -7
  136. package/dist/util/xml.formatter.js +0 -62
  137. package/dist/util/xml.formatter.js.map +0 -7
  138. package/dist/util/yaml.js +0 -44
  139. package/dist/util/yaml.js.map +0 -7
  140. package/dist/version.js +0 -29
  141. package/dist/version.js.map +0 -7
@@ -1,107 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var commands_exports = {};
20
- __export(commands_exports, {
21
- default: () => commands_default
22
- });
23
- module.exports = __toCommonJS(commands_exports);
24
- var import_commander = require("commander");
25
- var import_logger = require("../util/logger");
26
- var import_version = require("../version");
27
- var import_connect = require("./connect");
28
- var import_copy = require("./copy");
29
- var import_create = require("./create");
30
- var import_dev = require("./dev");
31
- var import_diff = require("./diff");
32
- var import_execute = require("./execute");
33
- var import_get = require("./get");
34
- var import_globalOptions = require("./globalOptions");
35
- var import_import = require("./import");
36
- var import_list = require("./list");
37
- var import_login = require("./login");
38
- var import_push = require("./push");
39
- var import_remove = require("./remove");
40
- var import_set = require("./set");
41
- var import_update = require("./update");
42
- const commands = () => {
43
- const program = new import_commander.Command().name("contensis").version(import_version.LIB_VERSION).configureOutput({
44
- writeErr: (str) => {
45
- return str.toLowerCase().includes("error") ? import_logger.Logger.error(`Command ${str}`) : str.trim() && import_logger.Logger.help(str);
46
- }
47
- }).addHelpText(
48
- "after",
49
- import_logger.Logger.helpText`
50
- >> Each command has its own help - for example:
51
- > login --help\n > get --help
52
- `
53
- ).exitOverride().showHelpAfterError(true);
54
- program.addCommand(
55
- (0, import_globalOptions.addAuthenticationOptions)((0, import_connect.makeConnectCommand)()).copyInheritedSettings(
56
- program
57
- )
58
- );
59
- program.addCommand(
60
- (0, import_globalOptions.addGlobalOptions)((0, import_create.makeCreateCommand)()).copyInheritedSettings(program)
61
- );
62
- program.addCommand(
63
- (0, import_globalOptions.addGlobalOptions)((0, import_copy.makeCopyCommand)()).copyInheritedSettings(program)
64
- );
65
- program.addCommand(
66
- (0, import_globalOptions.addConnectOptions)(
67
- (0, import_globalOptions.addAuthenticationOptions)((0, import_dev.makeDevCommand)())
68
- ).copyInheritedSettings(program)
69
- );
70
- program.addCommand(
71
- (0, import_globalOptions.addGlobalOptions)((0, import_globalOptions.addImportOptions)((0, import_diff.makeDiffCommand)())).copyInheritedSettings(
72
- program
73
- )
74
- );
75
- program.addCommand(
76
- (0, import_globalOptions.addGlobalOptions)((0, import_execute.makeExecuteCommand)()).copyInheritedSettings(program)
77
- );
78
- program.addCommand(
79
- (0, import_globalOptions.addGlobalOptions)((0, import_get.makeGetCommand)()).copyInheritedSettings(program)
80
- );
81
- program.addCommand(
82
- (0, import_globalOptions.addGlobalOptions)(
83
- (0, import_globalOptions.addImportOptions)((0, import_import.makeImportCommand)())
84
- ).copyInheritedSettings(program)
85
- );
86
- program.addCommand(
87
- (0, import_globalOptions.addGlobalOptions)((0, import_list.makeListCommand)()).copyInheritedSettings(program)
88
- );
89
- program.addCommand(
90
- (0, import_globalOptions.addConnectOptions)((0, import_login.makeLoginCommand)()).copyInheritedSettings(program)
91
- );
92
- program.addCommand(
93
- (0, import_globalOptions.addGlobalOptions)((0, import_push.makePushCommand)()).copyInheritedSettings(program)
94
- );
95
- program.addCommand(
96
- (0, import_globalOptions.addGlobalOptions)((0, import_remove.makeRemoveCommand)()).copyInheritedSettings(program)
97
- );
98
- program.addCommand(
99
- (0, import_globalOptions.addConnectOptions)((0, import_set.makeSetCommand)()).copyInheritedSettings(program)
100
- );
101
- program.addCommand(
102
- (0, import_globalOptions.addGlobalOptions)((0, import_update.makeUpdateCommand)()).copyInheritedSettings(program)
103
- );
104
- return program;
105
- };
106
- var commands_default = commands;
107
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/index.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCopyCommand } from './copy';\nimport { makeCreateCommand } from './create';\nimport { makeDevCommand } from './dev';\nimport { makeDiffCommand } from './diff';\nimport { makeExecuteCommand } from './execute';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\n addGlobalOptions,\n addImportOptions,\n} from './globalOptions';\nimport { makeImportCommand } from './import';\nimport { makeListCommand } from './list';\nimport { makeLoginCommand } from './login';\nimport { makePushCommand } from './push';\nimport { makeRemoveCommand } from './remove';\nimport { makeSetCommand } from './set';\nimport { makeUpdateCommand } from './update';\n\nconst commands = () => {\n const program = new Command()\n .name('contensis')\n .version(LIB_VERSION)\n .configureOutput({\n writeErr: str => {\n return str.toLowerCase().includes('error')\n ? Logger.error(`Command ${str}`)\n : str.trim() && Logger.help(str);\n },\n })\n .addHelpText(\n 'after',\n Logger.helpText`\n>> Each command has its own help - for example:\n > login --help\\n > get --help\n`\n )\n .exitOverride()\n .showHelpAfterError(true);\n\n program.addCommand(\n addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeCopyCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(\n addAuthenticationOptions(makeDevCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(addImportOptions(makeDiffCommand())).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(makeExecuteCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(\n addImportOptions(makeImportCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeListCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeLoginCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makePushCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeSetCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeUpdateCommand()).copyInheritedSettings(program)\n );\n\n return program;\n};\n\nexport default commands;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,oBAAuB;AACvB,qBAA4B;AAC5B,qBAAmC;AACnC,kBAAgC;AAChC,oBAAkC;AAClC,iBAA+B;AAC/B,kBAAgC;AAChC,qBAAmC;AACnC,iBAA+B;AAC/B,2BAKO;AACP,oBAAkC;AAClC,kBAAgC;AAChC,mBAAiC;AACjC,kBAAgC;AAChC,oBAAkC;AAClC,iBAA+B;AAC/B,oBAAkC;AAEl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;AACA,UAAQ;AAAA,QACN,2CAAiB,6BAAgB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AACA,UAAQ;AAAA,QACN,2CAAiB,iCAAkB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,4CAAkB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AACA,UAAQ;AAAA,QACN,2CAAiB,iCAAkB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AAEA,SAAO;AACT;AAEA,IAAO,mBAAQ;",
6
- "names": []
7
- }
@@ -1,195 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var list_exports = {};
20
- __export(list_exports, {
21
- makeListCommand: () => makeListCommand
22
- });
23
- module.exports = __toCommonJS(list_exports);
24
- var import_commander = require("commander");
25
- var import_ContensisCliService = require("../services/ContensisCliService");
26
- var import_globalOptions = require("./globalOptions");
27
- const makeListCommand = () => {
28
- const list = new import_commander.Command().command("list").description("list command").addHelpText("after", `
29
- `).showHelpAfterError(true).enablePositionalOptions().exitOverride();
30
- list.command("envs").description("List all previously connected environments").addHelpText(
31
- "after",
32
- `
33
- Example call:
34
- > list envs
35
- `
36
- ).action(async (opts) => {
37
- await (0, import_ContensisCliService.cliCommand)(["list", "envs"], opts).PrintEnvironments();
38
- });
39
- list.command("projects").description("print list of projects").addHelpText(
40
- "after",
41
- `
42
- Example call:
43
- > list projects
44
- `
45
- ).action(async (opts) => {
46
- await (0, import_ContensisCliService.cliCommand)(["list", "projects"], opts).PrintProjects();
47
- });
48
- list.command("models").description("print list of content models").addOption(import_globalOptions.exportOption).addOption(import_globalOptions.noCache).addHelpText(
49
- "after",
50
- `
51
- Example call:
52
- > list models
53
- `
54
- ).action(async (opts) => {
55
- await (0, import_ContensisCliService.cliCommand)(
56
- ["list", "models"],
57
- opts,
58
- (0, import_globalOptions.mapContensisOpts)(opts)
59
- ).PrintContentModels([], opts);
60
- });
61
- list.command("contenttypes").description("print list of content types").addHelpText(
62
- "after",
63
- `
64
- Example call:
65
- > list contenttypes -o ./output.json -f json
66
- `
67
- ).action(async (opts) => {
68
- await (0, import_ContensisCliService.cliCommand)(["list", "contenttypes"], opts).PrintContentTypes();
69
- });
70
- list.command("components").description("print list of components").addHelpText(
71
- "after",
72
- `
73
- Example call:
74
- > list components -o ./output.json -f json
75
- `
76
- ).action(async (opts) => {
77
- await (0, import_ContensisCliService.cliCommand)(["list", "components"], opts).PrintComponents();
78
- });
79
- list.command("blocks").description("print list of content blocks").addHelpText(
80
- "after",
81
- `
82
- Example call:
83
- > list blocks
84
- `
85
- ).action(async (opts) => {
86
- await (0, import_ContensisCliService.cliCommand)(["list", "blocks"], opts).PrintBlocks();
87
- });
88
- list.command("keys").description("print list of API keys").addHelpText(
89
- "after",
90
- `
91
- Example call:
92
- > list keys
93
- `
94
- ).action(async (opts) => {
95
- await (0, import_ContensisCliService.cliCommand)(["list", "keys"], opts).PrintApiKeys();
96
- });
97
- list.command("proxies").description("print list of proxies").addHelpText(
98
- "after",
99
- `
100
- Example call:
101
- > list proxies
102
- `
103
- ).action(async (opts) => {
104
- await (0, import_ContensisCliService.cliCommand)(["list", "proxies"], opts).PrintProxies();
105
- });
106
- list.command("renderers").description("print list of renderers").addHelpText(
107
- "after",
108
- `
109
- Example call:
110
- > list renderers
111
- `
112
- ).action(async (opts) => {
113
- await (0, import_ContensisCliService.cliCommand)(["list", "renderers"], opts).PrintRenderers();
114
- });
115
- list.command("roles").description("print list of roles").addHelpText(
116
- "after",
117
- `
118
- Example call:
119
- > list roles
120
- `
121
- ).action(async (opts) => {
122
- await (0, import_ContensisCliService.cliCommand)(["list", "roles"], opts).PrintRoles();
123
- });
124
- const tags = list.command("tags").description("print list of tags").argument("[label]", "filter by tags that match this label").passThroughOptions().option("-in --group <groupId>", "id of the tag group containing tags").option("-i --id <ids...>", "limit output to the supplied tag id(s)").option("-l --language <language>", "find tags in the supplied language").option("-d --dependents", "find and return tag groups for all found tags").addHelpText(
125
- "after",
126
- `
127
- Example call:
128
- > list tags
129
- `
130
- ).action(async (label, opts) => {
131
- var _a, _b;
132
- await (0, import_ContensisCliService.cliCommand)(["list", "tags"], { ...opts, label }).PrintTags(
133
- {
134
- id: ((_a = opts.id) == null ? void 0 : _a.length) === 1 ? opts.id[0] : void 0,
135
- ids: ((_b = opts.id) == null ? void 0 : _b.length) > 1 ? opts.id : void 0,
136
- groupId: opts.group,
137
- label,
138
- language: opts.language
139
- },
140
- opts.dependents
141
- );
142
- });
143
- tags.command("in").description("print list of tags in a group").argument("<groupId>", "id of the tag group containing tags").option("--label <label>", "filter by tags that match this label").option(
144
- "-l --language <language>",
145
- "find tags by a label in a specific language"
146
- ).addHelpText(
147
- "after",
148
- `
149
- Example call:
150
- > list tags in example
151
- `
152
- ).action(async (groupId, opts, cmd) => {
153
- const parentOptions = cmd.optsWithGlobals();
154
- await (0, import_ContensisCliService.cliCommand)(["list", "tags", "in"], {
155
- ...opts,
156
- ...parentOptions,
157
- groupId
158
- }).PrintTags({
159
- ...opts,
160
- ...parentOptions,
161
- groupId
162
- });
163
- });
164
- list.command("taggroups").description("print list of tag groups").argument("[query]", "filter tag groups").addHelpText(
165
- "after",
166
- `
167
- Example call:
168
- > list taggroups
169
- `
170
- ).action(async (query, opts) => {
171
- await (0, import_ContensisCliService.cliCommand)(["list", "taggroups"], opts).PrintTagGroups(query);
172
- });
173
- list.command("webhooks").description("print list of webhooks").argument("[name]", "find webhooks matching the supplied name").option("-i --id <id...>", "the subscription id(s) to get").addHelpText("after", `
174
- `).action(async (name, { id, ...opts } = {}) => {
175
- await (0, import_ContensisCliService.cliCommand)(["list", "webhooks"], opts).PrintWebhookSubscriptions(
176
- name ? [name] : id
177
- );
178
- });
179
- list.command("workflows").description("print list of workflow definitions").addHelpText(
180
- "after",
181
- `
182
- Example call:
183
- > list workflows
184
- `
185
- ).action(async (opts) => {
186
- await (0, import_ContensisCliService.cliCommand)(["list", "workflows"], opts).PrintWorkflows();
187
- });
188
- (0, import_globalOptions.addGlobalOptions)(tags);
189
- return list;
190
- };
191
- // Annotate the CommonJS export names for ESM import in node:
192
- 0 && (module.exports = {
193
- makeListCommand
194
- });
195
- //# sourceMappingURL=list.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/list.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n addGlobalOptions,\n exportOption,\n mapContensisOpts,\n noCache,\n} from './globalOptions';\n\nexport const makeListCommand = () => {\n const list = new Command()\n .command('list')\n .description('list command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .enablePositionalOptions()\n .exitOverride();\n\n list\n .command('envs')\n .description('List all previously connected environments')\n .addHelpText(\n 'after',\n `\nExample call:\n > list envs\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'envs'], opts).PrintEnvironments();\n });\n\n list\n .command('projects')\n .description('print list of projects')\n .addHelpText(\n 'after',\n `\nExample call:\n > list projects\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'projects'], opts).PrintProjects();\n });\n\n list\n .command('models')\n .description('print list of content models')\n .addOption(exportOption)\n .addOption(noCache)\n .addHelpText(\n 'after',\n `\nExample call:\n > list models\n`\n )\n .action(async opts => {\n await cliCommand(\n ['list', 'models'],\n opts,\n mapContensisOpts(opts)\n ).PrintContentModels([], opts);\n });\n\n list\n .command('contenttypes')\n .description('print list of content types')\n .addHelpText(\n 'after',\n `\nExample call:\n > list contenttypes -o ./output.json -f json\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'contenttypes'], opts).PrintContentTypes();\n });\n\n list\n .command('components')\n .description('print list of components')\n .addHelpText(\n 'after',\n `\nExample call:\n > list components -o ./output.json -f json\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'components'], opts).PrintComponents();\n });\n\n list\n .command('blocks')\n .description('print list of content blocks')\n .addHelpText(\n 'after',\n `\nExample call:\n > list blocks\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'blocks'], opts).PrintBlocks();\n });\n\n list\n .command('keys')\n .description('print list of API keys')\n .addHelpText(\n 'after',\n `\nExample call:\n > list keys\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'keys'], opts).PrintApiKeys();\n });\n\n list\n .command('proxies')\n .description('print list of proxies')\n .addHelpText(\n 'after',\n `\nExample call:\n > list proxies\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'proxies'], opts).PrintProxies();\n });\n\n list\n .command('renderers')\n .description('print list of renderers')\n .addHelpText(\n 'after',\n `\nExample call:\n > list renderers\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'renderers'], opts).PrintRenderers();\n });\n\n list\n .command('roles')\n .description('print list of roles')\n .addHelpText(\n 'after',\n `\nExample call:\n > list roles\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'roles'], opts).PrintRoles();\n });\n\n const tags = list\n .command('tags')\n .description('print list of tags')\n .argument('[label]', 'filter by tags that match this label')\n .passThroughOptions()\n .option('-in --group <groupId>', 'id of the tag group containing tags')\n .option('-i --id <ids...>', 'limit output to the supplied tag id(s)')\n .option('-l --language <language>', 'find tags in the supplied language')\n .option('-d --dependents', 'find and return tag groups for all found tags')\n .addHelpText(\n 'after',\n `\n Example call:\n > list tags\n `\n )\n .action(async (label, opts) => {\n await cliCommand(['list', 'tags'], { ...opts, label }).PrintTags(\n {\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n groupId: opts.group,\n label,\n language: opts.language,\n },\n opts.dependents\n );\n });\n\n tags\n .command('in')\n .description('print list of tags in a group')\n .argument('<groupId>', 'id of the tag group containing tags')\n .option('--label <label>', 'filter by tags that match this label')\n .option(\n '-l --language <language>',\n 'find tags by a label in a specific language'\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > list tags in example\n `\n )\n .action(async (groupId: string, opts, cmd) => {\n // workaround for shared options being always unavailable\n // read the (shared) options that were parsed by the parent cmd\n // https://github.com/tj/commander.js/issues/476#issuecomment-1675757628\n const parentOptions = cmd.optsWithGlobals();\n\n await cliCommand(['list', 'tags', 'in'], {\n ...opts,\n ...parentOptions,\n groupId,\n }).PrintTags({\n ...opts,\n ...parentOptions,\n groupId,\n });\n });\n\n list\n .command('taggroups')\n .description('print list of tag groups')\n .argument('[query]', 'filter tag groups')\n .addHelpText(\n 'after',\n `\n Example call:\n > list taggroups\n `\n )\n .action(async (query, opts) => {\n await cliCommand(['list', 'taggroups'], opts).PrintTagGroups(query);\n });\n\n list\n .command('webhooks')\n .description('print list of webhooks')\n .argument('[name]', 'find webhooks matching the supplied name')\n .option('-i --id <id...>', 'the subscription id(s) to get')\n .addHelpText('after', `\\n`)\n .action(async (name?: string, { id, ...opts }: any = {}) => {\n await cliCommand(['list', 'webhooks'], opts).PrintWebhookSubscriptions(\n name ? [name] : id\n );\n });\n\n list\n .command('workflows')\n .description('print list of workflow definitions')\n .addHelpText(\n 'after',\n `\nExample call:\n > list workflows\n`\n )\n .action(async opts => {\n await cliCommand(['list', 'workflows'], opts).PrintWorkflows();\n });\n\n // Add global opts for inner sub-commands\n addGlobalOptions(tags);\n\n return list;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA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cAAM,uCAAW,CAAC,QAAQ,WAAW,GAAG,IAAI,EAAE,eAAe,KAAK;AAAA,EACpE,CAAC;AAEH,OACG,QAAQ,UAAU,EAClB,YAAY,wBAAwB,EACpC,SAAS,UAAU,0CAA0C,EAC7D,OAAO,mBAAmB,+BAA+B,EACzD,YAAY,SAAS;AAAA,CAAI,EACzB,OAAO,OAAO,MAAe,EAAE,IAAI,GAAG,KAAK,IAAS,CAAC,MAAM;AAC1D,cAAM,uCAAW,CAAC,QAAQ,UAAU,GAAG,IAAI,EAAE;AAAA,MAC3C,OAAO,CAAC,IAAI,IAAI;AAAA,IAClB;AAAA,EACF,CAAC;AAEH,OACG,QAAQ,WAAW,EACnB,YAAY,oCAAoC,EAChD;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAM,SAAQ;AACpB,cAAM,uCAAW,CAAC,QAAQ,WAAW,GAAG,IAAI,EAAE,eAAe;AAAA,EAC/D,CAAC;AAGH,6CAAiB,IAAI;AAErB,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var login_exports = {};
20
- __export(login_exports, {
21
- makeLoginCommand: () => makeLoginCommand
22
- });
23
- module.exports = __toCommonJS(login_exports);
24
- var import_commander = require("commander");
25
- var import_ContensisCliService = require("../services/ContensisCliService");
26
- var import_shell = require("../shell");
27
- const makeLoginCommand = () => {
28
- const login = new import_commander.Command().command("login").description("login to a connected Contensis instance").argument("<user/clientId>", "the username to login with").argument(
29
- "[password]",
30
- "the password to use to login with (optional/insecure)"
31
- ).option(
32
- "-s --shared-secret <sharedSecret>",
33
- "the shared secret to use when logging in with a client id"
34
- ).usage("<user/clientId> [password] [-s <sharedSecret>]").addHelpText(
35
- "after",
36
- `
37
- Example call:
38
- > login myuserid
39
- -- or --
40
- > login {clientId} -s {sharedSecret}
41
- `
42
- ).action(async (user, password, opts) => {
43
- const token = await (0, import_ContensisCliService.cliCommand)(["login", user]).Login(user, {
44
- password,
45
- sharedSecret: opts.sharedSecret
46
- });
47
- if (token) await (0, import_shell.shell)().restart();
48
- });
49
- return login;
50
- };
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- makeLoginCommand
54
- });
55
- //# sourceMappingURL=login.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/login.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeLoginCommand = () => {\n const login = new Command()\n .command('login')\n .description('login to a connected Contensis instance')\n .argument('<user/clientId>', 'the username to login with')\n .argument(\n '[password]',\n 'the password to use to login with (optional/insecure)'\n )\n .option(\n '-s --shared-secret <sharedSecret>',\n 'the shared secret to use when logging in with a client id'\n )\n .usage('<user/clientId> [password] [-s <sharedSecret>]')\n .addHelpText(\n 'after',\n `\nExample call:\n > login myuserid\\n -- or --\\n > login {clientId} -s {sharedSecret}\n`\n )\n .action(async (user, password, opts) => {\n const token = await cliCommand(['login', user]).Login(user, {\n password,\n sharedSecret: opts.sharedSecret,\n });\n if (token) await shell().restart();\n });\n return login;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,mBAAsB;AAEf,MAAM,mBAAmB,MAAM;AACpC,QAAM,QAAQ,IAAI,yBAAQ,EACvB,QAAQ,OAAO,EACf,YAAY,yCAAyC,EACrD,SAAS,mBAAmB,4BAA4B,EACxD;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,MAAM,gDAAgD,EACtD;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,MAAM,UAAU,SAAS;AACtC,UAAM,QAAQ,UAAM,uCAAW,CAAC,SAAS,IAAI,CAAC,EAAE,MAAM,MAAM;AAAA,MAC1D;AAAA,MACA,cAAc,KAAK;AAAA,IACrB,CAAC;AACD,QAAI,MAAO,WAAM,oBAAM,EAAE,QAAQ;AAAA,EACnC,CAAC;AACH,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,234 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var push_exports = {};
30
- __export(push_exports, {
31
- makePushCommand: () => makePushCommand
32
- });
33
- module.exports = __toCommonJS(push_exports);
34
- var import_commander = require("commander");
35
- var import_jsonpath_mapper = __toESM(require("jsonpath-mapper"));
36
- var import_migratortron = require("migratortron");
37
- var import_path = __toESM(require("path"));
38
- var import_ContensisCliService = require("../services/ContensisCliService");
39
- var import_globalOptions = require("./globalOptions");
40
- var import_json = require("../util/json.formatter");
41
- var import_file_provider = require("../providers/file-provider");
42
- const makePushCommand = () => {
43
- const push = new import_commander.Command().command("push").description("push command").addHelpText("after", `
44
- `).showHelpAfterError(true).exitOverride();
45
- push.command("asset").description("push an asset").argument("<content-type-id>", "the content type id of the asset to push").argument(
46
- "<title>",
47
- "the title of the asset as it appears in the cms (use quotes)"
48
- ).argument(
49
- "[description]",
50
- "the description or altText of the asset (use quotes)"
51
- ).option(
52
- "-from --from-file <fromFile>",
53
- "the local file path of the source asset"
54
- ).option("-url --from-url <fromUrl>", "the full url of the source asset").option(
55
- "-to --target-file-path <targetFilePath>",
56
- 'the file path in the cms project to push the asset to e.g. "/asset-library/"'
57
- ).option(
58
- "-name --target-file-name <targetFileName>",
59
- "set the file name in the cms project"
60
- ).option("-i --id <id>", "push the asset with a specific guid").addOption(import_globalOptions.commit).addOption(import_globalOptions.noPublish).addOption(import_globalOptions.outputDetail).addOption(import_globalOptions.saveEntries).usage("<content-type-id> <title> [description] [options]").addHelpText(
61
- "after",
62
- `
63
- Example call:
64
- > push asset pdf "Example file" "An example of a PDF asset" --from-file example.pdf --target-file-path /asset-library/pdf/
65
- `
66
- ).action(
67
- async (contentTypeId, title, description, opts) => {
68
- const cli = (0, import_ContensisCliService.cliCommand)(
69
- ["push", "asset", contentTypeId, title, description],
70
- opts,
71
- (0, import_globalOptions.mapContensisOpts)({ preserveGuids: true, ...opts, id: void 0 })
72
- );
73
- const mapSourceVars = {
74
- contentTypeId,
75
- title,
76
- description,
77
- ...opts
78
- };
79
- const assetEntry = (0, import_jsonpath_mapper.default)(mapSourceVars, {
80
- entryTitle: "title",
81
- title: "title",
82
- entryDescription: "description",
83
- description: "description",
84
- altText: ({ contentTypeId: contentTypeId2, description: description2 }) => contentTypeId2 === "image" ? description2 : void 0,
85
- sys: {
86
- dataFormat: () => "asset",
87
- contentTypeId: "contentTypeId",
88
- id: "id",
89
- isPublished: () => true,
90
- // can be overridden by !opts.publish
91
- properties: {
92
- filename: {
93
- $path: ["targetFileName", "fromFile", "fromUrl"],
94
- $formatting: (nameOrPath) => {
95
- return import_path.default.basename(nameOrPath);
96
- }
97
- },
98
- filePath: {
99
- $path: "targetFilePath",
100
- $default: (_, { fromFile, fromUrl }) => {
101
- const toPosixPath = (windowsPath) => windowsPath.replace(/^(\w):|\\+/g, "/$1");
102
- return import_path.default.dirname(
103
- toPosixPath(fromFile || fromUrl.split(":/")[1])
104
- );
105
- }
106
- }
107
- },
108
- uri: {
109
- $path: ["fromFile", "fromUrl"],
110
- $formatting: (from) => (from == null ? void 0 : from.startsWith("http")) ? from : (0, import_file_provider.cwdPath)(from)
111
- }
112
- }
113
- });
114
- if (!assetEntry.sys.id)
115
- assetEntry.sys.id = (0, import_migratortron.generateGuid)(
116
- cli.currentEnv,
117
- cli.currentProject,
118
- `${assetEntry.sys.contentTypeId}-${assetEntry.sys.properties.filePath.replaceAll("/", "").toLowerCase()}-${assetEntry.sys.properties.filename.toLowerCase()}`
119
- );
120
- console.log((0, import_json.jsonFormatter)(assetEntry));
121
- await cli.ImportEntries({
122
- commit: opts.commit,
123
- logOutput: opts.outputDetail,
124
- saveEntries: opts.saveEntries,
125
- data: [assetEntry]
126
- });
127
- }
128
- );
129
- push.command("block").description("push a block").argument("<block-id>", "the name of the block to push to").argument(
130
- "<image uri:tag>",
131
- "the uri and tag of the container image to push as a block (tag default: latest)"
132
- ).argument("[branch]", "the branch we are pushing to").option(
133
- "-r --release",
134
- "whether to release the pushed block version",
135
- false
136
- ).option(
137
- "--make-live",
138
- "whether to make the pushed block version live immediately",
139
- false
140
- ).option(
141
- "-cid --commit-id <commitId>",
142
- "the id of the source git commit for the supplied image uri"
143
- ).option(
144
- "-cmsg --commit-message <commitMessage>",
145
- "the git commit message for the supplied commit id"
146
- ).option(
147
- "-cdt --commit-datetime <commitDateTime>",
148
- "the timestamp of the source git commit for the supplied image uri"
149
- ).option(
150
- "-author --author-email <authorEmail>",
151
- "the git email address of the author of the source git commit"
152
- ).option(
153
- "-committer --committer-email <committerEmail>",
154
- "the git email address of the commiter of the source git commit"
155
- ).option(
156
- "-repo --repository-url <repositoryUrl>",
157
- "the url of the source repository for the supplied image uri"
158
- ).option(
159
- "-pr --provider <sourceProvider>",
160
- "the source repository provider of the supplied image uri"
161
- ).usage("<block-id> <image uri> [branch] [options]").addHelpText(
162
- "after",
163
- `
164
- Example call:
165
- > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release
166
- `
167
- ).action(async (blockId, imageUri, branch, opts) => {
168
- const cli = (0, import_ContensisCliService.cliCommand)(["push", "block", blockId], opts);
169
- const mapSourceVars = {
170
- blockId,
171
- imageUri,
172
- branch,
173
- ...opts,
174
- ...process.env
175
- };
176
- const blockRequest = (0, import_jsonpath_mapper.default)(mapSourceVars, {
177
- release: { $path: "release", $default: () => false },
178
- makeLive: { $path: "makeLive", $default: () => false },
179
- id: ["blockId"],
180
- image: () => {
181
- const lastIndexOfColon = imageUri.lastIndexOf(":");
182
- return {
183
- uri: imageUri.slice(0, lastIndexOfColon),
184
- tag: imageUri.slice(lastIndexOfColon + 1) || "latest"
185
- };
186
- },
187
- projectId: () => cli.env.currentProject || "",
188
- source: {
189
- provider: {
190
- $path: ["provider"],
191
- $return: (provider, { GITHUB_ACTIONS, GITLAB_CI }) => {
192
- if (provider) return provider;
193
- if (GITHUB_ACTIONS) return "Github";
194
- else if (GITLAB_CI) return "GitlabSelfHosted";
195
- }
196
- },
197
- repositoryUrl: {
198
- $path: ["repositoryUrl", "CI_PROJECT_URL", "GITHUB_REPOSITORY"],
199
- $formatting: (url, { GITHUB_ACTIONS }) => {
200
- if (GITHUB_ACTIONS) url = `https://github.com/${url}`;
201
- if (url && !url.endsWith(".git")) return `${url}.git`;
202
- return url;
203
- }
204
- },
205
- branch: ["branch", "CI_COMMIT_REF_NAME", "GITHUB_REF_NAME"],
206
- commit: {
207
- id: ["commitId", "CI_COMMIT_SHORT_SHA", "GITHUB_SHA"],
208
- message: {
209
- $path: ["commitMessage", "CI_COMMIT_MESSAGE"],
210
- // ${{ github.event.head_commit.message }}
211
- $formatting: (msg) => msg == null ? void 0 : msg.replace(/\\n/g, " ").replace(/\\n/g, " ").trim()
212
- },
213
- dateTime: ["commitDatetime", "CI_COMMIT_TIMESTAMP"],
214
- // ${{ github.event.head_commit.timestamp }}
215
- authorEmail: ["authorEmail", "GITLAB_USER_EMAIL", "GITHUB_ACTOR"],
216
- // ${{ github.event.head_commit.author.email }}
217
- committerEmail: [
218
- "committerEmail",
219
- "GITLAB_USER_EMAIL",
220
- "GITHUB_TRIGGERING_ACTOR"
221
- ]
222
- // ${{ github.event.head_commit.committer.email }}
223
- }
224
- }
225
- });
226
- await cli.PushBlock(blockRequest);
227
- });
228
- return push;
229
- };
230
- // Annotate the CommonJS export names for ESM import in node:
231
- 0 && (module.exports = {
232
- makePushCommand
233
- });
234
- //# sourceMappingURL=push.js.map