contensis-cli 1.6.1-beta.2 → 1.6.1-beta.20

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 (144) hide show
  1. package/dist/index.js +58301 -11
  2. package/dist/index.js.map +4 -4
  3. package/dist/shell.js +58040 -52
  4. package/dist/shell.js.map +4 -4
  5. package/esbuild.config.js +8 -13
  6. package/package.json +3 -2
  7. package/src/commands/create.ts +48 -0
  8. package/src/commands/dev.ts +12 -2
  9. package/src/commands/globalOptions.ts +5 -3
  10. package/src/commands/import.ts +46 -5
  11. package/src/commands/push.ts +8 -1
  12. package/src/commands/set.ts +69 -1
  13. package/src/factories/RequestHandlerFactory.ts +19 -8
  14. package/src/localisation/en-GB.ts +22 -4
  15. package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +25 -17
  16. package/src/models/CliService.d.ts +5 -1
  17. package/src/providers/GitHubCliModuleProvider.ts +8 -8
  18. package/src/providers/HttpProvider.ts +2 -2
  19. package/src/providers/file-provider.ts +3 -0
  20. package/src/services/ContensisCliService.ts +265 -23
  21. package/src/services/ContensisDevService.ts +99 -35
  22. package/src/shell.ts +7 -1
  23. package/src/util/console.printer.ts +52 -0
  24. package/src/util/logger.ts +3 -4
  25. package/src/util/os.ts +5 -3
  26. package/src/version.ts +1 -1
  27. package/dist/commands/connect.js +0 -44
  28. package/dist/commands/connect.js.map +0 -7
  29. package/dist/commands/copy.js +0 -78
  30. package/dist/commands/copy.js.map +0 -7
  31. package/dist/commands/create.js +0 -170
  32. package/dist/commands/create.js.map +0 -7
  33. package/dist/commands/dev.js +0 -78
  34. package/dist/commands/dev.js.map +0 -7
  35. package/dist/commands/diff.js +0 -57
  36. package/dist/commands/diff.js.map +0 -7
  37. package/dist/commands/execute.js +0 -103
  38. package/dist/commands/execute.js.map +0 -7
  39. package/dist/commands/get.js +0 -330
  40. package/dist/commands/get.js.map +0 -7
  41. package/dist/commands/globalOptions.js +0 -252
  42. package/dist/commands/globalOptions.js.map +0 -7
  43. package/dist/commands/import.js +0 -229
  44. package/dist/commands/import.js.map +0 -7
  45. package/dist/commands/index.js +0 -107
  46. package/dist/commands/index.js.map +0 -7
  47. package/dist/commands/list.js +0 -195
  48. package/dist/commands/list.js.map +0 -7
  49. package/dist/commands/login.js +0 -55
  50. package/dist/commands/login.js.map +0 -7
  51. package/dist/commands/push.js +0 -229
  52. package/dist/commands/push.js.map +0 -7
  53. package/dist/commands/remove.js +0 -193
  54. package/dist/commands/remove.js.map +0 -7
  55. package/dist/commands/set.js +0 -180
  56. package/dist/commands/set.js.map +0 -7
  57. package/dist/commands/update.js +0 -70
  58. package/dist/commands/update.js.map +0 -7
  59. package/dist/factories/RequestHandlerFactory.js +0 -221
  60. package/dist/factories/RequestHandlerFactory.js.map +0 -7
  61. package/dist/localisation/en-GB.js +0 -552
  62. package/dist/localisation/en-GB.js.map +0 -7
  63. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +0 -56
  64. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +0 -7
  65. package/dist/mappers/DevInit-to-CIWorkflow.js +0 -409
  66. package/dist/mappers/DevInit-to-CIWorkflow.js.map +0 -7
  67. package/dist/mappers/DevInit-to-RolePermissions.js +0 -56
  68. package/dist/mappers/DevInit-to-RolePermissions.js.map +0 -7
  69. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +0 -161
  70. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +0 -7
  71. package/dist/mappers/MixedFileData.js +0 -83
  72. package/dist/mappers/MixedFileData.js.map +0 -7
  73. package/dist/models/AppError.d.js +0 -2
  74. package/dist/models/AppError.d.js.map +0 -7
  75. package/dist/models/Cache.d.js +0 -2
  76. package/dist/models/Cache.d.js.map +0 -7
  77. package/dist/models/CliService.d.js +0 -17
  78. package/dist/models/CliService.d.js.map +0 -7
  79. package/dist/models/DevService.d.js +0 -17
  80. package/dist/models/DevService.d.js.map +0 -7
  81. package/dist/models/JsModules.d.js +0 -2
  82. package/dist/models/JsModules.d.js.map +0 -7
  83. package/dist/providers/CredentialProvider.js +0 -126
  84. package/dist/providers/CredentialProvider.js.map +0 -7
  85. package/dist/providers/GitHubCliModuleProvider.js +0 -115
  86. package/dist/providers/GitHubCliModuleProvider.js.map +0 -7
  87. package/dist/providers/HttpProvider.js +0 -73
  88. package/dist/providers/HttpProvider.js.map +0 -7
  89. package/dist/providers/ManifestProvider.js +0 -50
  90. package/dist/providers/ManifestProvider.js.map +0 -7
  91. package/dist/providers/SessionCacheProvider.js +0 -132
  92. package/dist/providers/SessionCacheProvider.js.map +0 -7
  93. package/dist/providers/file-provider.js +0 -174
  94. package/dist/providers/file-provider.js.map +0 -7
  95. package/dist/services/ContensisAuthService.js +0 -88
  96. package/dist/services/ContensisAuthService.js.map +0 -7
  97. package/dist/services/ContensisCliService.js +0 -2598
  98. package/dist/services/ContensisCliService.js.map +0 -7
  99. package/dist/services/ContensisDevService.js +0 -387
  100. package/dist/services/ContensisDevService.js.map +0 -7
  101. package/dist/services/ContensisRoleService.js +0 -112
  102. package/dist/services/ContensisRoleService.js.map +0 -7
  103. package/dist/util/api-ids.js +0 -110
  104. package/dist/util/api-ids.js.map +0 -7
  105. package/dist/util/assert.js +0 -62
  106. package/dist/util/assert.js.map +0 -7
  107. package/dist/util/console.printer.js +0 -425
  108. package/dist/util/console.printer.js.map +0 -7
  109. package/dist/util/csv.formatter.js +0 -118
  110. package/dist/util/csv.formatter.js.map +0 -7
  111. package/dist/util/debug.js +0 -29
  112. package/dist/util/debug.js.map +0 -7
  113. package/dist/util/diff.js +0 -118
  114. package/dist/util/diff.js.map +0 -7
  115. package/dist/util/dotenv.js +0 -56
  116. package/dist/util/dotenv.js.map +0 -7
  117. package/dist/util/error.js +0 -36
  118. package/dist/util/error.js.map +0 -7
  119. package/dist/util/fetch.js +0 -69
  120. package/dist/util/fetch.js.map +0 -7
  121. package/dist/util/find.js +0 -39
  122. package/dist/util/find.js.map +0 -7
  123. package/dist/util/git.js +0 -145
  124. package/dist/util/git.js.map +0 -7
  125. package/dist/util/gitignore.js +0 -61
  126. package/dist/util/gitignore.js.map +0 -7
  127. package/dist/util/html.formatter.js +0 -70
  128. package/dist/util/html.formatter.js.map +0 -7
  129. package/dist/util/index.js +0 -68
  130. package/dist/util/index.js.map +0 -7
  131. package/dist/util/json.formatter.js +0 -66
  132. package/dist/util/json.formatter.js.map +0 -7
  133. package/dist/util/logger.js +0 -304
  134. package/dist/util/logger.js.map +0 -7
  135. package/dist/util/os.js +0 -46
  136. package/dist/util/os.js.map +0 -7
  137. package/dist/util/timers.js +0 -49
  138. package/dist/util/timers.js.map +0 -7
  139. package/dist/util/xml.formatter.js +0 -62
  140. package/dist/util/xml.formatter.js.map +0 -7
  141. package/dist/util/yaml.js +0 -44
  142. package/dist/util/yaml.js.map +0 -7
  143. package/dist/version.js +0 -29
  144. package/dist/version.js.map +0 -7
@@ -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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AC,EAAE,sBAAsB,OAAO;AAAA,EACrE;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": ";;;;;;;;;;;;;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ACC,OAAO,OAAO,OAAO,SAAS;AAC7B,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,229 +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
- "-cid --commit-id <commitId>",
138
- "the id of the source git commit for the supplied image uri"
139
- ).option(
140
- "-cmsg --commit-message <commitMessage>",
141
- "the git commit message for the supplied commit id"
142
- ).option(
143
- "-cdt --commit-datetime <commitDateTime>",
144
- "the timestamp of the source git commit for the supplied image uri"
145
- ).option(
146
- "-author --author-email <authorEmail>",
147
- "the git email address of the author of the source git commit"
148
- ).option(
149
- "-committer --committer-email <committerEmail>",
150
- "the git email address of the commiter of the source git commit"
151
- ).option(
152
- "-repo --repository-url <repositoryUrl>",
153
- "the url of the source repository for the supplied image uri"
154
- ).option(
155
- "-pr --provider <sourceProvider>",
156
- "the source repository provider of the supplied image uri"
157
- ).usage("<block-id> <image uri> [branch] [options]").addHelpText(
158
- "after",
159
- `
160
- Example call:
161
- > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release
162
- `
163
- ).action(async (blockId, imageUri, branch, opts) => {
164
- const cli = (0, import_ContensisCliService.cliCommand)(["push", "block", blockId], opts);
165
- const mapSourceVars = {
166
- blockId,
167
- imageUri,
168
- branch,
169
- ...opts,
170
- ...process.env
171
- };
172
- const blockRequest = (0, import_jsonpath_mapper.default)(mapSourceVars, {
173
- release: { $path: "release", $default: () => false },
174
- id: ["blockId"],
175
- image: () => {
176
- const lastIndexOfColon = imageUri.lastIndexOf(":");
177
- return {
178
- uri: imageUri.slice(0, lastIndexOfColon),
179
- tag: imageUri.slice(lastIndexOfColon + 1) || "latest"
180
- };
181
- },
182
- projectId: () => cli.env.currentProject || "",
183
- source: {
184
- provider: {
185
- $path: ["provider"],
186
- $return: (provider, { GITHUB_ACTIONS, GITLAB_CI }) => {
187
- if (provider) return provider;
188
- if (GITHUB_ACTIONS) return "Github";
189
- else if (GITLAB_CI) return "GitlabSelfHosted";
190
- }
191
- },
192
- repositoryUrl: {
193
- $path: ["repositoryUrl", "CI_PROJECT_URL", "GITHUB_REPOSITORY"],
194
- $formatting: (url, { GITHUB_ACTIONS }) => {
195
- if (GITHUB_ACTIONS) url = `https://github.com/${url}`;
196
- if (url && !url.endsWith(".git")) return `${url}.git`;
197
- return url;
198
- }
199
- },
200
- branch: ["branch", "CI_COMMIT_REF_NAME", "GITHUB_REF_NAME"],
201
- commit: {
202
- id: ["commitId", "CI_COMMIT_SHORT_SHA", "GITHUB_SHA"],
203
- message: {
204
- $path: ["commitMessage", "CI_COMMIT_MESSAGE"],
205
- // ${{ github.event.head_commit.message }}
206
- $formatting: (msg) => msg == null ? void 0 : msg.replace(/\\n/g, " ").replace(/\\n/g, " ").trim()
207
- },
208
- dateTime: ["commitDatetime", "CI_COMMIT_TIMESTAMP"],
209
- // ${{ github.event.head_commit.timestamp }}
210
- authorEmail: ["authorEmail", "GITLAB_USER_EMAIL", "GITHUB_ACTOR"],
211
- // ${{ github.event.head_commit.author.email }}
212
- committerEmail: [
213
- "committerEmail",
214
- "GITLAB_USER_EMAIL",
215
- "GITHUB_TRIGGERING_ACTOR"
216
- ]
217
- // ${{ github.event.head_commit.committer.email }}
218
- }
219
- }
220
- });
221
- await cli.PushBlock(blockRequest);
222
- });
223
- return push;
224
- };
225
- // Annotate the CommonJS export names for ESM import in node:
226
- 0 && (module.exports = {
227
- makePushCommand
228
- });
229
- //# sourceMappingURL=push.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/push.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport mapJson from 'jsonpath-mapper';\nimport { generateGuid, PushBlockParams } from 'migratortron';\nimport path from 'path';\nimport { Asset } from 'contensis-delivery-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n mapContensisOpts,\n noPublish,\n outputDetail,\n saveEntries,\n} from './globalOptions';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { cwdPath } from '~/providers/file-provider';\n\nexport const makePushCommand = () => {\n const push = new Command()\n .command('push')\n .description('push command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n push\n .command('asset')\n .description('push an asset')\n .argument('<content-type-id>', 'the content type id of the asset to push')\n .argument(\n '<title>',\n 'the title of the asset as it appears in the cms (use quotes)'\n )\n .argument(\n '[description]',\n 'the description or altText of the asset (use quotes)'\n )\n .option(\n '-from --from-file <fromFile>',\n 'the local file path of the source asset'\n )\n .option('-url --from-url <fromUrl>', 'the full url of the source asset')\n .option(\n '-to --target-file-path <targetFilePath>',\n 'the file path in the cms project to push the asset to e.g. \"/asset-library/\"'\n )\n .option(\n '-name --target-file-name <targetFileName>',\n 'set the file name in the cms project'\n )\n .option('-i --id <id>', 'push the asset with a specific guid')\n .addOption(commit)\n .addOption(noPublish)\n .addOption(outputDetail)\n .addOption(saveEntries)\n .usage('<content-type-id> <title> [description] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push asset pdf \"Example file\" \"An example of a PDF asset\" --from-file example.pdf --target-file-path /asset-library/pdf/\\n`\n )\n .action(\n async (\n contentTypeId: string,\n title: string,\n description: string,\n opts\n ) => {\n const cli = cliCommand(\n ['push', 'asset', contentTypeId, title, description],\n opts,\n mapContensisOpts({ preserveGuids: true, ...opts, id: undefined })\n );\n const mapSourceVars = {\n contentTypeId,\n title,\n description,\n ...opts,\n };\n\n const assetEntry: Asset = mapJson(mapSourceVars, {\n entryTitle: 'title',\n title: 'title',\n entryDescription: 'description',\n description: 'description',\n altText: ({ contentTypeId, description }) =>\n contentTypeId === 'image' ? description : undefined,\n sys: {\n dataFormat: () => 'asset',\n contentTypeId: 'contentTypeId',\n id: 'id',\n isPublished: () => true, // can be overridden by !opts.publish\n properties: {\n filename: {\n $path: ['targetFileName', 'fromFile', 'fromUrl'],\n $formatting: (nameOrPath: string) => {\n return path.basename(nameOrPath);\n },\n },\n filePath: {\n $path: 'targetFilePath',\n $default: (_, { fromFile, fromUrl }) => {\n const toPosixPath = (windowsPath: string) =>\n windowsPath.replace(/^(\\w):|\\\\+/g, '/$1');\n\n return path.dirname(\n toPosixPath(fromFile || fromUrl.split(':/')[1])\n );\n },\n },\n },\n uri: {\n $path: ['fromFile', 'fromUrl'],\n $formatting: (from: string) =>\n from?.startsWith('http') ? from : cwdPath(from),\n },\n },\n });\n\n if (!assetEntry.sys.id)\n assetEntry.sys.id = generateGuid(\n cli.currentEnv,\n cli.currentProject,\n `${assetEntry.sys.contentTypeId}-${assetEntry.sys.properties.filePath.replaceAll('/', '').toLowerCase()}-${assetEntry.sys.properties.filename.toLowerCase()}`\n );\n\n console.log(jsonFormatter(assetEntry));\n\n await cli.ImportEntries({\n commit: opts.commit,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n data: [assetEntry],\n });\n }\n );\n\n push\n .command('block')\n .description('push a block')\n .argument('<block-id>', 'the name of the block to push to')\n .argument(\n '<image uri:tag>',\n 'the uri and tag of the container image to push as a block (tag default: latest)'\n )\n .argument('[branch]', 'the branch we are pushing to')\n .option(\n '-r --release',\n 'whether to release the pushed block version',\n false\n )\n .option(\n '-cid --commit-id <commitId>',\n 'the id of the source git commit for the supplied image uri'\n )\n .option(\n '-cmsg --commit-message <commitMessage>',\n 'the git commit message for the supplied commit id'\n )\n .option(\n '-cdt --commit-datetime <commitDateTime>',\n 'the timestamp of the source git commit for the supplied image uri'\n )\n .option(\n '-author --author-email <authorEmail>',\n 'the git email address of the author of the source git commit'\n )\n .option(\n '-committer --committer-email <committerEmail>',\n 'the git email address of the commiter of the source git commit'\n )\n .option(\n '-repo --repository-url <repositoryUrl>',\n 'the url of the source repository for the supplied image uri'\n )\n .option(\n '-pr --provider <sourceProvider>',\n 'the source repository provider of the supplied image uri'\n )\n .usage('<block-id> <image uri> [branch] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\\n`\n )\n .action(async (blockId: string, imageUri: string, branch: string, opts) => {\n const cli = cliCommand(['push', 'block', blockId], opts);\n const mapSourceVars = {\n blockId,\n imageUri,\n branch,\n ...opts,\n ...process.env,\n };\n\n const blockRequest = mapJson(mapSourceVars, {\n release: { $path: 'release', $default: () => false },\n id: ['blockId'],\n image: () => {\n const lastIndexOfColon = imageUri.lastIndexOf(':');\n return {\n uri: imageUri.slice(0, lastIndexOfColon),\n tag: imageUri.slice(lastIndexOfColon + 1) || 'latest',\n };\n },\n projectId: () => cli.env.currentProject || '',\n source: {\n provider: {\n $path: ['provider'],\n $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {\n if (provider) return provider;\n if (GITHUB_ACTIONS) return 'Github';\n else if (GITLAB_CI) return 'GitlabSelfHosted';\n },\n },\n repositoryUrl: {\n $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],\n $formatting: (url: string, { GITHUB_ACTIONS }) => {\n if (GITHUB_ACTIONS) url = `https://github.com/${url}`;\n\n if (url && !url.endsWith('.git')) return `${url}.git`;\n return url;\n },\n },\n branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],\n commit: {\n id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],\n message: {\n $path: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}\n $formatting: (msg?: string) =>\n msg?.replace(/\\\\n/g, ' ').replace(/\\\\n/g, ' ').trim(),\n },\n dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}\n authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}\n committerEmail: [\n 'committerEmail',\n 'GITLAB_USER_EMAIL',\n 'GITHUB_TRIGGERING_ACTOR',\n ], // ${{ github.event.head_commit.committer.email }}\n },\n },\n }) as PushBlockParams;\n\n await cli.PushBlock(blockRequest);\n\n // console.log(process.env);\n });\n\n return push;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,6BAAoB;AACpB,0BAA8C;AAC9C,kBAAiB;AAEjB,iCAA2B;AAC3B,2BAMO;AACP,kBAA8B;AAC9B,2BAAwB;AAEjB,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,eAAe,EAC3B,SAAS,qBAAqB,0CAA0C,EACxE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,6BAA6B,kCAAkC,EACtE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,gBAAgB,qCAAqC,EAC5D,UAAU,2BAAM,EAChB,UAAU,8BAAS,EACnB,UAAU,iCAAY,EACtB,UAAU,gCAAW,EACrB,MAAM,mDAAmD,EACzD;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC;AAAA,IACC,OACE,eACA,OACA,aACA,SACG;AACH,YAAM,UAAM;AAAA,QACV,CAAC,QAAQ,SAAS,eAAe,OAAO,WAAW;AAAA,QACnD;AAAA,YACA,uCAAiB,EAAE,eAAe,MAAM,GAAG,MAAM,IAAI,OAAU,CAAC;AAAA,MAClE;AACA,YAAM,gBAAgB;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL;AAEA,YAAM,iBAAoB,uBAAAA,SAAQ,eAA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