contensis-cli 1.0.0-beta.35 → 1.0.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/get.js +9 -0
- package/dist/commands/get.js.map +2 -2
- package/dist/services/ContensisCliService.js +86 -78
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/shell.js +1 -0
- package/dist/shell.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/get.ts +14 -0
- package/src/services/ContensisCliService.ts +93 -69
- package/src/shell.ts +1 -0
- package/src/version.ts +1 -1
package/dist/commands/get.js
CHANGED
|
@@ -27,6 +27,15 @@ var import_ContensisCliService = require("../services/ContensisCliService");
|
|
|
27
27
|
var import_globalOptions = require("./globalOptions");
|
|
28
28
|
const makeGetCommand = () => {
|
|
29
29
|
const program = new import_commander.Command().command("get").showHelpAfterError(true).exitOverride();
|
|
30
|
+
program.command("version").description("Get current Contensis version").addHelpText(
|
|
31
|
+
"after",
|
|
32
|
+
`
|
|
33
|
+
Example call:
|
|
34
|
+
> version
|
|
35
|
+
`
|
|
36
|
+
).action(async (opts) => {
|
|
37
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "version"], opts).PrintContensisVersion();
|
|
38
|
+
});
|
|
30
39
|
program.command("contenttype").argument("<contentTypeId>", "the API id of the content type to get").addHelpText(
|
|
31
40
|
"after",
|
|
32
41
|
`
|
package/dist/commands/get.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/get.ts"],
|
|
4
|
-
"sourcesContent": ["import { Argument, Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { mapContensisOpts } from './globalOptions';\n\nexport const makeGetCommand = () => {\n const program = new Command()\n .command('get')\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('contenttype')\n .argument('<contentTypeId>', 'the API id of the content type to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get contenttype {contentTypeId} -o content-type-backup.json\n`\n )\n .action(async (contentTypeId: string, opts) => {\n await cliCommand(['get', 'contenttype'], opts).PrintContentType(\n contentTypeId\n );\n });\n program\n .command('component')\n .argument('<componentId>', 'the API id of the component to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get component {componentId} -o component-backup.json\n`\n )\n .action(async (componentId: string, opts) => {\n await cliCommand(['get', 'component'], opts).PrintComponent(componentId);\n });\n program\n .command('entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .option('-i --id <id...>', 'the entry id to get')\n .option(\n '-d, --dependents',\n 'find and return any dependencies of all found entries'\n )\n .option(\n '-fi, --fields <fields...>',\n 'limit the output fields on returned entries'\n )\n .option(\n '-q, --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get entries --zenql \"sys.contentTypeId = blog\" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n // console.log('phrase: ', phrase, '\\nopts:', JSON.stringify(opts, null, 2));\n // console.log('opts:', JSON.stringify(opts, null, 2));\n await cliCommand(\n ['get', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).GetEntries({\n withDependents: opts.dependents,\n });\n });\n\n const block = program\n .command('block')\n .argument('[blockId]', 'the block to get version details for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'main'\n )\n .argument(\n '[version]',\n 'get a specific version of the block pushed to the specified branch'\n )\n .action(async (blockId: string, branch: string, version: string, opts) => {\n await cliCommand(['get', 'block'], opts).PrintBlockVersions(\n blockId,\n branch,\n version\n );\n });\n\n const dataCenter = new Argument(\n '[dataCenter]',\n 'the datacentre of the block to get logs for'\n )\n .choices(['hq', 'london', 'manchester'])\n .default('hq');\n\n block\n .command('logs')\n .argument('[blockId]', 'the block to get version logs for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'main'\n )\n .argument(\n '[version]',\n 'the version of the block pushed to the branch to get logs for',\n 'latest'\n )\n .addArgument(dataCenter)\n .usage('get block logs [blockId] [branch] [version] [dataCenter]')\n .action(\n async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london',\n opts\n ) => {\n await cliCommand(['get', 'block', 'logs'], opts).PrintBlockLogs(\n blockId,\n branch,\n version,\n dataCenter\n );\n }\n );\n\n return program;\n};\n\nexport const get = makeGetCommand();\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAC3B,2BAAiC;AAE1B,MAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,KAAK,EACb,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,aAAa,EACrB,SAAS,mBAAmB,uCAAuC,EACnE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,eAAuB,SAAS;AAC7C,cAAM,uCAAW,CAAC,OAAO,aAAa,GAAG,IAAI,EAAE;AAAA,MAC7C;AAAA,IACF;AAAA,EACF,CAAC;AACH,UACG,QAAQ,WAAW,EACnB,SAAS,iBAAiB,oCAAoC,EAC9D;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,aAAqB,SAAS;AAC3C,cAAM,uCAAW,CAAC,OAAO,WAAW,GAAG,IAAI,EAAE,eAAe,WAAW;AAAA,EACzE,CAAC;AACH,UACG,QAAQ,SAAS,EACjB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,mBAAmB,qBAAqB,EAC/C;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,QAAgB,MAAM,QAAQ;AAG3C,cAAM;AAAA,MACJ,CAAC,OAAO,SAAS;AAAA,MACjB;AAAA,UACA,uCAAiB,EAAE,QAAQ,GAAG,KAAK,CAAC;AAAA,IACtC,EAAE,WAAW;AAAA,MACX,gBAAgB,KAAK;AAAA,IACvB,CAAC;AAAA,EACH,CAAC;AAEH,QAAM,QAAQ,QACX,QAAQ,OAAO,EACf,SAAS,aAAa,sCAAsC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,OAAO,SAAiB,QAAgB,SAAiB,SAAS;AACxE,cAAM,uCAAW,CAAC,OAAO,OAAO,GAAG,IAAI,EAAE;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,QAAM,aAAa,IAAI;AAAA,IACrB;AAAA,IACA;AAAA,EACF,EACG,QAAQ,CAAC,MAAM,UAAU,YAAY,CAAC,EACtC,QAAQ,IAAI;AAEf,QACG,QAAQ,MAAM,EACd,SAAS,aAAa,mCAAmC,EACzD;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,YAAY,UAAU,EACtB,MAAM,0DAA0D,EAChE;AAAA,IACC,OACE,SACA,QACA,SACAA,aACA,SACG;AACH,gBAAM,uCAAW,CAAC,OAAO,SAAS,MAAM,GAAG,IAAI,EAAE;AAAA,QAC/C;AAAA,QACA;AAAA,QACA;AAAA,QACAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACT;AAEO,MAAM,MAAM,eAAe;",
|
|
4
|
+
"sourcesContent": ["import { Argument, Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { mapContensisOpts } from './globalOptions';\n\nexport const makeGetCommand = () => {\n const program = new Command()\n .command('get')\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('version')\n .description('Get current Contensis version')\n .addHelpText(\n 'after',\n `\nExample call:\n > version\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'version'], opts).PrintContensisVersion();\n });\n\n program\n .command('contenttype')\n .argument('<contentTypeId>', 'the API id of the content type to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get contenttype {contentTypeId} -o content-type-backup.json\n`\n )\n .action(async (contentTypeId: string, opts) => {\n await cliCommand(['get', 'contenttype'], opts).PrintContentType(\n contentTypeId\n );\n });\n program\n .command('component')\n .argument('<componentId>', 'the API id of the component to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get component {componentId} -o component-backup.json\n`\n )\n .action(async (componentId: string, opts) => {\n await cliCommand(['get', 'component'], opts).PrintComponent(componentId);\n });\n program\n .command('entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .option('-i --id <id...>', 'the entry id to get')\n .option(\n '-d, --dependents',\n 'find and return any dependencies of all found entries'\n )\n .option(\n '-fi, --fields <fields...>',\n 'limit the output fields on returned entries'\n )\n .option(\n '-q, --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get entries --zenql \"sys.contentTypeId = blog\" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n // console.log('phrase: ', phrase, '\\nopts:', JSON.stringify(opts, null, 2));\n // console.log('opts:', JSON.stringify(opts, null, 2));\n await cliCommand(\n ['get', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).GetEntries({\n withDependents: opts.dependents,\n });\n });\n\n const block = program\n .command('block')\n .argument('[blockId]', 'the block to get version details for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'main'\n )\n .argument(\n '[version]',\n 'get a specific version of the block pushed to the specified branch'\n )\n .action(async (blockId: string, branch: string, version: string, opts) => {\n await cliCommand(['get', 'block'], opts).PrintBlockVersions(\n blockId,\n branch,\n version\n );\n });\n\n const dataCenter = new Argument(\n '[dataCenter]',\n 'the datacentre of the block to get logs for'\n )\n .choices(['hq', 'london', 'manchester'])\n .default('hq');\n\n block\n .command('logs')\n .argument('[blockId]', 'the block to get version logs for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'main'\n )\n .argument(\n '[version]',\n 'the version of the block pushed to the branch to get logs for',\n 'latest'\n )\n .addArgument(dataCenter)\n .usage('get block logs [blockId] [branch] [version] [dataCenter]')\n .action(\n async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london',\n opts\n ) => {\n await cliCommand(['get', 'block', 'logs'], opts).PrintBlockLogs(\n blockId,\n branch,\n version,\n dataCenter\n );\n }\n );\n\n return program;\n};\n\nexport const get = makeGetCommand();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAC3B,2BAAiC;AAE1B,MAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,KAAK,EACb,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,SAAS,EACjB,YAAY,+BAA+B,EAC3C;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAM,SAAQ;AACpB,cAAM,uCAAW,CAAC,OAAO,SAAS,GAAG,IAAI,EAAE,sBAAsB;AAAA,EACnE,CAAC;AAEH,UACG,QAAQ,aAAa,EACrB,SAAS,mBAAmB,uCAAuC,EACnE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,eAAuB,SAAS;AAC7C,cAAM,uCAAW,CAAC,OAAO,aAAa,GAAG,IAAI,E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mCAAmC,EACzD;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,YAAY,UAAU,EACtB,MAAM,0DAA0D,EAChE;AAAA,IACC,OACE,SACA,QACA,SACAA,aACA,SACG;AACH,gBAAM,uCAAW,CAAC,OAAO,SAAS,MAAM,GAAG,IAAI,EAAE;AAAA,QAC/C;AAAA,QACA;AAAA,QACA;AAAA,QACAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACT;AAEO,MAAM,MAAM,eAAe;",
|
|
6
6
|
"names": ["dataCenter"]
|
|
7
7
|
}
|
|
@@ -181,40 +181,43 @@ class ContensisCli {
|
|
|
181
181
|
};
|
|
182
182
|
ConnectContensis = async ({ commit = false } = {}) => {
|
|
183
183
|
var _a, _b, _c;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const cachedPassword = (_a = credentials == null ? void 0 : credentials.current) == null ? void 0 : _a.password;
|
|
193
|
-
if (cachedPassword) {
|
|
194
|
-
this.contensis = new import_migratortron.ContensisMigrationService(
|
|
195
|
-
{
|
|
196
|
-
...contensisOpts,
|
|
197
|
-
source: {
|
|
198
|
-
url: ((_b = this.urls) == null ? void 0 : _b.cms) || "",
|
|
199
|
-
username: !isGuidId ? userId : void 0,
|
|
200
|
-
password: !isGuidId ? cachedPassword : void 0,
|
|
201
|
-
clientId: isGuidId ? userId : void 0,
|
|
202
|
-
sharedSecret: isGuidId ? cachedPassword : void 0,
|
|
203
|
-
project: (env == null ? void 0 : env.currentProject) || "",
|
|
204
|
-
assetHostname: (_c = this.urls) == null ? void 0 : _c.previewWeb
|
|
205
|
-
},
|
|
206
|
-
concurrency: typeof contensisOpts.concurrency !== "undefined" ? contensisOpts.concurrency : 3,
|
|
207
|
-
outputProgress: true
|
|
208
|
-
},
|
|
209
|
-
!commit
|
|
184
|
+
if (!this.contensis) {
|
|
185
|
+
const { contensisOpts, currentEnv, env, log, messages } = this;
|
|
186
|
+
const userId = env == null ? void 0 : env.lastUserId;
|
|
187
|
+
const isGuidId = userId && (0, import_util.isUuid)(userId);
|
|
188
|
+
if (currentEnv && userId) {
|
|
189
|
+
const credentials = await this.GetCredentials(
|
|
190
|
+
userId,
|
|
191
|
+
env.passwordFallback
|
|
210
192
|
);
|
|
193
|
+
const cachedPassword = (_a = credentials == null ? void 0 : credentials.current) == null ? void 0 : _a.password;
|
|
194
|
+
if (cachedPassword) {
|
|
195
|
+
this.contensis = new import_migratortron.ContensisMigrationService(
|
|
196
|
+
{
|
|
197
|
+
...contensisOpts,
|
|
198
|
+
source: {
|
|
199
|
+
url: ((_b = this.urls) == null ? void 0 : _b.cms) || "",
|
|
200
|
+
username: !isGuidId ? userId : void 0,
|
|
201
|
+
password: !isGuidId ? cachedPassword : void 0,
|
|
202
|
+
clientId: isGuidId ? userId : void 0,
|
|
203
|
+
sharedSecret: isGuidId ? cachedPassword : void 0,
|
|
204
|
+
project: (env == null ? void 0 : env.currentProject) || "",
|
|
205
|
+
assetHostname: (_c = this.urls) == null ? void 0 : _c.previewWeb
|
|
206
|
+
},
|
|
207
|
+
concurrency: typeof contensisOpts.concurrency !== "undefined" ? contensisOpts.concurrency : 3,
|
|
208
|
+
outputProgress: true
|
|
209
|
+
},
|
|
210
|
+
!commit
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
if (!currentEnv)
|
|
215
|
+
log.help(messages.connect.help());
|
|
216
|
+
if (!userId)
|
|
217
|
+
log.help(messages.connect.tip());
|
|
211
218
|
}
|
|
212
|
-
} else {
|
|
213
|
-
if (!currentEnv)
|
|
214
|
-
log.help(messages.connect.help());
|
|
215
|
-
if (!userId)
|
|
216
|
-
log.help(messages.connect.tip());
|
|
217
219
|
}
|
|
220
|
+
return this.contensis;
|
|
218
221
|
};
|
|
219
222
|
ConnectContensisImport = async ({
|
|
220
223
|
commit,
|
|
@@ -406,13 +409,31 @@ class ContensisCli {
|
|
|
406
409
|
import_logger.Logger.error(messages.login.noUserId());
|
|
407
410
|
}
|
|
408
411
|
};
|
|
412
|
+
PrintContensisVersion = async () => {
|
|
413
|
+
const { log, messages } = this;
|
|
414
|
+
const contensis = await this.ConnectContensis();
|
|
415
|
+
if (contensis) {
|
|
416
|
+
const [projectsErr, projects] = await (0, import_await_to_js.default)(
|
|
417
|
+
contensis.projects.GetSourceProjects()
|
|
418
|
+
);
|
|
419
|
+
if (Array.isArray(projects)) {
|
|
420
|
+
this.HandleFormattingAndOutput(
|
|
421
|
+
contensis.contensisVersion,
|
|
422
|
+
() => log.raw(log.highlightText(contensis.contensisVersion))
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
if (projectsErr) {
|
|
426
|
+
log.error(messages.projects.noList());
|
|
427
|
+
log.error(projectsErr.message);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
};
|
|
409
431
|
PrintProjects = async () => {
|
|
410
432
|
const { currentProject, log, messages, session } = this;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
if (this.contensis) {
|
|
433
|
+
const contensis = await this.ConnectContensis();
|
|
434
|
+
if (contensis) {
|
|
414
435
|
const [projectsErr, projects] = await (0, import_await_to_js.default)(
|
|
415
|
-
|
|
436
|
+
contensis.projects.GetSourceProjects()
|
|
416
437
|
);
|
|
417
438
|
if (Array.isArray(projects)) {
|
|
418
439
|
const nextCurrentProject = currentProject && currentProject !== "null" ? currentProject : projects.some((p) => p.id === "website") ? "website" : void 0;
|
|
@@ -479,11 +500,10 @@ class ContensisCli {
|
|
|
479
500
|
};
|
|
480
501
|
HydrateContensis = async () => {
|
|
481
502
|
const { log } = this;
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
if (this.contensis) {
|
|
503
|
+
const contensis = await this.ConnectContensis();
|
|
504
|
+
if (contensis) {
|
|
485
505
|
const [contensisErr, models] = await (0, import_await_to_js.default)(
|
|
486
|
-
|
|
506
|
+
contensis.models.HydrateContensisRepositories()
|
|
487
507
|
);
|
|
488
508
|
if (contensisErr) {
|
|
489
509
|
log.error(contensisErr.message);
|
|
@@ -493,10 +513,9 @@ class ContensisCli {
|
|
|
493
513
|
};
|
|
494
514
|
PrintApiKeys = async () => {
|
|
495
515
|
const { currentEnv, log, messages } = this;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const [keysErr, apiKeys] = await this.contensis.apiKeys.GetKeys();
|
|
516
|
+
const contensis = await this.ConnectContensis();
|
|
517
|
+
if (contensis) {
|
|
518
|
+
const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();
|
|
500
519
|
if (Array.isArray(apiKeys)) {
|
|
501
520
|
log.success(messages.keys.list(currentEnv));
|
|
502
521
|
this.HandleFormattingAndOutput(apiKeys, () => {
|
|
@@ -524,13 +543,9 @@ class ContensisCli {
|
|
|
524
543
|
};
|
|
525
544
|
CreateApiKey = async (name, description) => {
|
|
526
545
|
const { currentEnv, log, messages } = this;
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
const [err, key] = await this.contensis.apiKeys.CreateKey(
|
|
531
|
-
name,
|
|
532
|
-
description
|
|
533
|
-
);
|
|
546
|
+
const contensis = await this.ConnectContensis();
|
|
547
|
+
if (contensis) {
|
|
548
|
+
const [err, key] = await contensis.apiKeys.CreateKey(name, description);
|
|
534
549
|
if (key) {
|
|
535
550
|
log.success(messages.keys.created(currentEnv, name));
|
|
536
551
|
console.log(
|
|
@@ -547,10 +562,9 @@ class ContensisCli {
|
|
|
547
562
|
};
|
|
548
563
|
RemoveApiKey = async (id) => {
|
|
549
564
|
const { currentEnv, log, messages } = this;
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
const [err, key] = await this.contensis.apiKeys.RemoveKey(id);
|
|
565
|
+
const contensis = await this.ConnectContensis({ commit: true });
|
|
566
|
+
if (contensis) {
|
|
567
|
+
const [err, key] = await contensis.apiKeys.RemoveKey(id);
|
|
554
568
|
if (!err) {
|
|
555
569
|
log.success(messages.keys.removed(currentEnv, id));
|
|
556
570
|
console.log("");
|
|
@@ -879,10 +893,9 @@ class ContensisCli {
|
|
|
879
893
|
};
|
|
880
894
|
PrintWebhookSubscriptions = async (subscriptionIds, name) => {
|
|
881
895
|
const { currentEnv, log, messages } = this;
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
const [webhooksErr, webhooks] = await this.contensis.subscriptions.webhooks.GetSubscriptions();
|
|
896
|
+
const contensis = await this.ConnectContensis();
|
|
897
|
+
if (contensis) {
|
|
898
|
+
const [webhooksErr, webhooks] = await contensis.subscriptions.webhooks.GetSubscriptions();
|
|
886
899
|
const filteredResults = typeof name === "string" ? webhooks.filter(
|
|
887
900
|
(w) => {
|
|
888
901
|
var _a;
|
|
@@ -917,10 +930,9 @@ class ContensisCli {
|
|
|
917
930
|
};
|
|
918
931
|
PrintBlocks = async () => {
|
|
919
932
|
const { currentEnv, env, log, messages } = this;
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
const [err, blocks] = await this.contensis.blocks.GetBlocks();
|
|
933
|
+
const contensis = await this.ConnectContensis();
|
|
934
|
+
if (contensis) {
|
|
935
|
+
const [err, blocks] = await contensis.blocks.GetBlocks();
|
|
924
936
|
if (Array.isArray(blocks)) {
|
|
925
937
|
this.HandleFormattingAndOutput(blocks, () => {
|
|
926
938
|
log.success(messages.blocks.list(currentEnv, env.currentProject));
|
|
@@ -950,10 +962,9 @@ class ContensisCli {
|
|
|
950
962
|
};
|
|
951
963
|
PrintBlockVersions = async (blockId, branch, version) => {
|
|
952
964
|
const { currentEnv, env, log, messages } = this;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
const [err, blocks] = await this.contensis.blocks.GetBlockVersions(
|
|
965
|
+
const contensis = await this.ConnectContensis();
|
|
966
|
+
if (contensis) {
|
|
967
|
+
const [err, blocks] = await contensis.blocks.GetBlockVersions(
|
|
957
968
|
blockId,
|
|
958
969
|
branch,
|
|
959
970
|
version
|
|
@@ -993,10 +1004,9 @@ class ContensisCli {
|
|
|
993
1004
|
)
|
|
994
1005
|
);
|
|
995
1006
|
console.log((0, import_json.jsonFormatter)(block));
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
const [err, blockVersion] = await this.contensis.blocks.PushBlockVersion(
|
|
1007
|
+
const contensis = await this.ConnectContensis();
|
|
1008
|
+
if (contensis) {
|
|
1009
|
+
const [err, blockVersion] = await contensis.blocks.PushBlockVersion(
|
|
1000
1010
|
block
|
|
1001
1011
|
);
|
|
1002
1012
|
if (!err) {
|
|
@@ -1022,10 +1032,9 @@ class ContensisCli {
|
|
|
1022
1032
|
};
|
|
1023
1033
|
ReleaseBlock = async (blockId, version) => {
|
|
1024
1034
|
const { currentEnv, env, log, messages } = this;
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
const [err, blockVersion] = await this.contensis.blocks.BlockAction(
|
|
1035
|
+
const contensis = await this.ConnectContensis();
|
|
1036
|
+
if (contensis) {
|
|
1037
|
+
const [err, blockVersion] = await contensis.blocks.BlockAction(
|
|
1029
1038
|
blockId,
|
|
1030
1039
|
"release",
|
|
1031
1040
|
version
|
|
@@ -1048,13 +1057,12 @@ class ContensisCli {
|
|
|
1048
1057
|
};
|
|
1049
1058
|
PrintBlockLogs = async (blockId, branch, version, dataCenter) => {
|
|
1050
1059
|
const { currentEnv, env, log, messages } = this;
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
if (this.contensis) {
|
|
1060
|
+
const contensis = await this.ConnectContensis();
|
|
1061
|
+
if (contensis) {
|
|
1054
1062
|
log.success(
|
|
1055
1063
|
messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)
|
|
1056
1064
|
);
|
|
1057
|
-
const [err, blockLogs] = await
|
|
1065
|
+
const [err, blockLogs] = await contensis.blocks.GetBlockLogs({
|
|
1058
1066
|
blockId,
|
|
1059
1067
|
branchId: branch,
|
|
1060
1068
|
version,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/services/ContensisCliService.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'fs';\nimport path from 'path';\nimport fetch from 'node-fetch';\nimport inquirer from 'inquirer';\nimport to from 'await-to-js';\nimport { Component, ContentType } from 'contensis-core-api';\nimport { isPassword, isSharedSecret, isUuid, url } from '~/util';\nimport SessionCacheProvider from '../providers/SessionCacheProvider';\nimport ContensisAuthService from './ContensisAuthService';\nimport CredentialProvider from '~/providers/CredentialProvider';\nimport { logError, Logger } from '~/util/logger';\nimport { LogMessages } from '~/localisation/en-GB';\nimport {\n ContensisMigrationService,\n MigrateRequest,\n PushBlockParams,\n SourceCms,\n logEntriesTable,\n} from 'migratortron';\nimport { Entry } from 'contensis-management-api/lib/models';\n\nimport { csvFormatter } from '~/util/csv.formatter';\nimport { xmlFormatter } from '~/util/xml.formatter';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { printBlockVersion, printMigrateResult } from '~/util/console.printer';\nimport { readJsonFile } from '~/providers/file-provider';\n\ntype OutputFormat = 'json' | 'csv' | 'xml';\n\ntype OutputOptions = {\n format?: OutputFormat;\n output?: string;\n};\n\ninterface IConnectOptions extends IAuthOptions {\n alias?: string;\n projectId?: string;\n}\n\ninterface IAuthOptions {\n user?: string;\n password?: string;\n clientId?: string;\n sharedSecret?: string;\n}\n\ninterface IImportOptions {\n sourceEnv?: string;\n sourceProjectId?: string;\n}\n\nlet insecurePasswordWarningShown = false;\n\nclass ContensisCli {\n static quit = (error?: Error) => {\n process.removeAllListeners('exit');\n const exitCode = error ? 1 : 0;\n\n // console.info(`\\nExiting contensis-cli with exit code: ${exitCode}\\n`);\n process.exit(exitCode);\n };\n\n private command: CliCommand;\n private format?: OutputFormat;\n private output?: string;\n private session: SessionCacheProvider;\n\n contensis?: ContensisMigrationService;\n contensisOpts: Partial<MigrateRequest>;\n contentTypes?: ContentType[];\n components?: Component[];\n currentProject: string;\n\n sourceEnv?: string;\n targetEnv?: string;\n urls:\n | {\n api: string;\n cms: string;\n liveWeb: string;\n previewWeb: string;\n iisWeb: string;\n iisPreviewWeb: string;\n }\n | undefined;\n log = Logger;\n messages = LogMessages;\n\n verb: string;\n noun: string;\n thirdArg: string;\n\n get cache() {\n return this.session.Get();\n }\n get currentEnv() {\n return this.cache.currentEnvironment || '';\n }\n\n set currentEnv(currentEnvironment: string) {\n this.session.Update({ currentEnvironment });\n }\n\n get env() {\n const currentEnvironment = this.currentEnv;\n const environments = this.cache.environments || {};\n\n if (!currentEnvironment) return {} as EnvironmentCache;\n else if (!!environments[currentEnvironment])\n return environments[currentEnvironment];\n else {\n return {\n history: [],\n lastUserId: '',\n projects: [],\n versionStatus: 'latest',\n } as EnvironmentCache;\n }\n }\n\n constructor(\n args: string[],\n outputOpts?: OutputOptions & IConnectOptions & IImportOptions,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n // console.log('args: ', JSON.stringify(args, null, 2));\n\n const [exe, script, verb = '', noun = '', ...restArgs] = args;\n this.verb = verb?.toLowerCase();\n this.noun = noun?.toLowerCase();\n this.thirdArg = restArgs?.[0];\n\n const commandText = `${this.verb} ${this.noun} ${\n restArgs ? restArgs.join(' ') : ''\n }`.trim();\n\n this.session = new SessionCacheProvider();\n\n this.contensisOpts = contensisOpts;\n this.format = outputOpts?.format;\n this.output =\n outputOpts?.output && path.join(process.cwd(), outputOpts.output);\n\n const currentEnvironment = outputOpts?.alias || this.currentEnv;\n const environments = this.cache.environments || {};\n this.currentEnv = currentEnvironment;\n\n const env = this.env;\n\n if (outputOpts?.projectId) env.currentProject = outputOpts.projectId;\n if (outputOpts?.user) env.lastUserId = outputOpts.user;\n // setting this in env means passwordFallback is written to environments.json\n if (outputOpts?.password) env.passwordFallback = outputOpts.password;\n if (outputOpts?.clientId) env.lastUserId = outputOpts.clientId;\n if (outputOpts?.sharedSecret)\n env.passwordFallback = outputOpts.sharedSecret;\n\n this.currentProject = env?.currentProject || 'null';\n this.sourceEnv = outputOpts?.sourceEnv || currentEnvironment;\n\n if (currentEnvironment) {\n this.urls = url(currentEnvironment, env?.currentProject || 'website');\n }\n\n this.command = {\n commandText,\n createdDate: new Date().toISOString(),\n createdUserId: env?.lastUserId,\n };\n\n if (currentEnvironment) {\n env.history = [this.command];\n if (commandText) {\n environments[currentEnvironment] = env;\n this.session.Update({\n currentEnvironment,\n environments,\n history: [commandText],\n });\n }\n }\n }\n\n PrintEnvironments = () => {\n const { log, messages } = this;\n const { currentEnvironment, environments = {} } = this.cache;\n const envKeys = Object.keys(environments);\n log.success(messages.envs.found(envKeys.length));\n this.HandleFormattingAndOutput(envKeys, () => {\n // print the envKeys to console\n for (const env of envKeys) {\n console.log(` - ${currentEnvironment === env ? '* ' : ''}${env}`);\n }\n });\n if (envKeys.length === 0 || !currentEnvironment) {\n log.help(messages.envs.tip());\n }\n };\n\n Connect = async (environment: string) => {\n const { log, messages, session } = this;\n\n if (environment) {\n this.currentEnv = environment;\n this.urls = url(environment, 'website');\n\n const [fetchErr, response] = await to(fetch(this.urls.cms));\n if (response && response?.status < 400) {\n log.success(messages.connect.connected(environment));\n session.UpdateEnv(this.env, environment);\n\n if (this.env?.lastUserId) {\n // await this.ConnectContensis();\n await this.PrintProjects();\n } else {\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n } else {\n // Cannot reach environment - status X\n log.error(\n messages.connect.unreachable(this.urls.cms, response?.status || 0)\n );\n }\n } else {\n // No environment alias specified\n log.error(messages.connect.noEnv());\n }\n };\n\n ConnectContensis = async ({ commit = false } = {}) => {\n const { contensisOpts, currentEnv, env, log, messages } = this;\n const userId = env?.lastUserId;\n const isGuidId = userId && isUuid(userId);\n\n if (currentEnv && userId) {\n const credentials = await this.GetCredentials(\n userId,\n env.passwordFallback\n );\n\n const cachedPassword = credentials?.current?.password;\n\n if (cachedPassword) {\n this.contensis = new ContensisMigrationService(\n {\n ...contensisOpts,\n source: {\n url: this.urls?.cms || '',\n username: !isGuidId ? userId : undefined,\n password: !isGuidId ? cachedPassword : undefined,\n clientId: isGuidId ? userId : undefined,\n sharedSecret: isGuidId ? cachedPassword : undefined,\n project: env?.currentProject || '',\n assetHostname: this.urls?.previewWeb,\n },\n concurrency:\n typeof contensisOpts.concurrency !== 'undefined'\n ? contensisOpts.concurrency\n : 3,\n outputProgress: true,\n },\n !commit\n );\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!userId) log.help(messages.connect.tip());\n }\n };\n\n ConnectContensisImport = async ({\n commit,\n source,\n fileData,\n fileDataType,\n }: {\n commit: boolean;\n source: 'contensis' | 'file' | 'input';\n fileData?: any[] | string;\n fileDataType?: 'entries' | 'contentTypes' | 'components';\n }) => {\n const { contensisOpts, currentEnv, env, log, messages, sourceEnv } = this;\n const environments = this.cache.environments || {};\n const sourceEnvironment = environments[sourceEnv || ''] || {};\n const sourceCms =\n ('source' in contensisOpts && contensisOpts.source) ||\n ({} as Partial<SourceCms>);\n const sourceUserId =\n sourceCms.clientId || sourceCms.username || sourceEnvironment.lastUserId;\n const sourceProjectId =\n sourceCms.project || sourceEnvironment.currentProject || 'website';\n const isSourceGuidId = sourceUserId && isUuid(sourceUserId);\n const sourceUrls = url(sourceEnv || '', sourceProjectId);\n\n const sourcePassword =\n sourceCms.sharedSecret ||\n sourceCms.password ||\n sourceEnvironment.passwordFallback;\n\n const targetUserId = env?.lastUserId;\n const isTargetGuidId = targetUserId && isUuid(targetUserId);\n\n if (sourceUserId && currentEnv && targetUserId) {\n const sourceCredentials = await this.GetCredentials(\n sourceUserId,\n sourcePassword,\n sourceEnv\n );\n\n const cachedSourcePassword = sourceCredentials?.current?.password;\n\n const targetCredentials = await this.GetCredentials(\n targetUserId,\n env.passwordFallback\n );\n\n const cachedTargetPassword = targetCredentials?.current?.password;\n\n if (cachedSourcePassword && cachedTargetPassword) {\n if (source === 'file' || source === 'input') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n ...(fileDataType ? { [fileDataType]: fileData } : {}),\n },\n !commit\n );\n }\n if (source === 'contensis') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n source: {\n url: sourceUrls.cms || '',\n username: !isSourceGuidId ? sourceUserId : undefined,\n password: !isSourceGuidId ? cachedSourcePassword : undefined,\n clientId: isSourceGuidId ? sourceUserId : undefined,\n sharedSecret: isSourceGuidId ? cachedSourcePassword : undefined,\n project: sourceProjectId,\n assetHostname: sourceUrls.previewWeb,\n },\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n },\n !commit\n );\n }\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!targetUserId) log.help(messages.connect.tip());\n }\n };\n\n GetCredentials = async (\n userId: string,\n password?: string,\n currentEnv = this.currentEnv\n ): Promise<CredentialProvider | undefined> => {\n const { env, log, messages } = this;\n if (userId) {\n const [credentialError, credentials] = await new CredentialProvider(\n { userId, alias: currentEnv },\n password\n ).Init();\n\n if (credentialError && !credentials.current) {\n // Log problem with Credential Provider\n log.error(credentialError as any);\n return;\n }\n\n if (credentials.remarks.secure !== true) {\n if (!insecurePasswordWarningShown) {\n log.warning(messages.login.insecurePassword());\n insecurePasswordWarningShown = true;\n }\n } else {\n env.passwordFallback = undefined;\n this.session.UpdateEnv(env, currentEnv);\n }\n return credentials;\n }\n };\n\n Login = async (\n userId: string,\n {\n password = isPassword(this.env.passwordFallback),\n promptPassword = true,\n sharedSecret = isSharedSecret(this.env.passwordFallback),\n silent = false,\n attempt = 1,\n }: {\n password?: string;\n promptPassword?: boolean;\n sharedSecret?: string;\n silent?: boolean;\n attempt?: number;\n } = {}\n ): Promise<string | undefined> => {\n let inputPassword = password || sharedSecret;\n const { log, messages } = this;\n\n if (userId) {\n const { currentEnv, env } = this;\n\n if (currentEnv) {\n const credentials = await this.GetCredentials(userId, inputPassword);\n\n if (credentials) {\n const cachedPassword = isPassword(credentials.current?.password);\n const cachedSecret = isSharedSecret(credentials.current?.password);\n\n if (!cachedPassword && !cachedSecret && promptPassword) {\n // Password prompt\n ({ inputPassword } = await inquirer.prompt([\n {\n type: 'password',\n message: messages.login.passwordPrompt(currentEnv, userId),\n name: 'inputPassword',\n mask: '*',\n prefix: undefined,\n },\n ]));\n }\n\n if (inputPassword || cachedPassword || cachedSecret) {\n const authService = new ContensisAuthService({\n username: userId,\n password: inputPassword || cachedPassword,\n projectId: env?.currentProject || 'website',\n rootUrl: this.urls?.cms || '',\n clientId: userId,\n clientSecret: sharedSecret || cachedSecret,\n });\n\n const [authError, bearerToken] = await to(\n authService.BearerToken()\n );\n\n // Login successful\n if (bearerToken) {\n // Set env vars\n env.authToken = bearerToken;\n env.lastUserId = userId;\n env.passwordFallback =\n credentials.remarks.secure !== true\n ? credentials.current?.password\n : undefined;\n // Persist env before finding projects or doing anything else\n this.session.UpdateEnv(env);\n\n if (!silent) {\n Logger.success(messages.login.success(currentEnv, userId));\n await this.PrintProjects();\n }\n if (inputPassword) await credentials.Save(inputPassword);\n if (sharedSecret) await credentials.Save(sharedSecret);\n } else if (authError) {\n Logger.error(authError.toString());\n // Clear env vars\n env.authToken = '';\n env.lastUserId = '';\n env.passwordFallback = undefined;\n // Persist env to remove cleared values\n this.session.UpdateEnv(env);\n\n // If the auth error was raised using a cached password\n if (\n (cachedPassword || cachedSecret) &&\n credentials.remarks.secure\n ) {\n // Remove any bad stored credential and trigger login prompt again\n await credentials.Delete();\n return await this.Login(userId, { password, sharedSecret });\n } else {\n throw new Error(messages.login.failed(currentEnv, userId));\n }\n }\n\n return env.authToken;\n } else {\n Logger.error(messages.login.passwordPrompt());\n if (attempt < 2)\n return await this.Login(userId, { attempt: attempt + 1 });\n }\n }\n } else {\n // No environment set, use `contensis connect {alias}` first\n Logger.error(messages.login.noEnv());\n }\n } else {\n // No user id specified\n Logger.error(messages.login.noUserId());\n }\n };\n\n PrintProjects = async () => {\n const { currentProject, log, messages, session } = this;\n if (!this.contensis) await this.ConnectContensis();\n\n if (this.contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n this.contensis.projects.GetSourceProjects()\n );\n\n if (Array.isArray(projects)) {\n // save these projects in cache\n const nextCurrentProject =\n currentProject && currentProject !== 'null'\n ? currentProject\n : projects.some(p => p.id === 'website')\n ? 'website'\n : undefined;\n\n session.UpdateEnv({\n projects: projects.map(p => p.id),\n currentProject: nextCurrentProject,\n });\n\n log.success(messages.projects.list());\n this.HandleFormattingAndOutput(projects, () => {\n // print the projects to console\n for (const project of projects) {\n console.log(\n ` - ${nextCurrentProject === project.id ? '* ' : ''}[${\n project.primaryLanguage\n }] ${project.id}`\n );\n }\n });\n\n if (!this.SetProject(nextCurrentProject))\n log.warning(messages.projects.tip());\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n SetProject = (projectId = 'website') => {\n const { env, log, messages, session } = this;\n let nextProjectId: string | undefined;\n if (env?.projects.length > 0 && env?.lastUserId) {\n nextProjectId = env.projects.find(\n p => p.toLowerCase() === projectId.toLowerCase()\n );\n if (nextProjectId) {\n env.currentProject = nextProjectId;\n session.UpdateEnv(env);\n log.success(messages.projects.set(projectId));\n } else {\n log.error(messages.projects.failedSet(projectId));\n }\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n return nextProjectId;\n };\n\n SetVersion = (versionStatus: 'latest' | 'published') => {\n const { env, log, messages, session } = this;\n if (!['latest', 'published'].includes(versionStatus)) {\n log.error(messages.version.invalid(versionStatus));\n return false;\n }\n if (!env) {\n log.help(messages.version.noEnv());\n return false;\n }\n if (env?.projects.length > 0 && env?.lastUserId) {\n session.UpdateEnv({ versionStatus });\n log.success(messages.version.set(this.currentEnv, versionStatus));\n return true;\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n return false;\n }\n };\n\n HydrateContensis = async () => {\n const { log } = this;\n if (!this.contensis) await this.ConnectContensis();\n\n if (this.contensis) {\n // Retrieve content types list for env\n const [contensisErr, models] = await to(\n this.contensis.models.HydrateContensisRepositories()\n );\n\n if (contensisErr) {\n log.error(contensisErr.message);\n return contensisErr;\n }\n }\n };\n\n PrintApiKeys = async () => {\n const { currentEnv, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n\n if (this.contensis) {\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await this.contensis.apiKeys.GetKeys();\n\n if (Array.isArray(apiKeys)) {\n log.success(messages.keys.list(currentEnv));\n this.HandleFormattingAndOutput(apiKeys, () => {\n // print the keys to console\n for (const {\n id,\n sharedSecret,\n name,\n description,\n dateModified,\n modifiedBy,\n } of apiKeys) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${dateModified.toString().substring(0, 10)} ${modifiedBy}]`\n );\n console.log(` ${id}`);\n console.log(` ${sharedSecret}`);\n }\n });\n }\n\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n }\n }\n };\n\n CreateApiKey = async (name: string, description?: string) => {\n const { currentEnv, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n\n if (this.contensis) {\n const [err, key] = await this.contensis.apiKeys.CreateKey(\n name,\n description\n );\n\n if (key) {\n log.success(messages.keys.created(currentEnv, name));\n\n // print the key details to console\n console.log(\n ` - ${key.name}${\n key.description ? ` (${key.description})` : ''\n } [${key.dateModified.toString().substring(0, 10)} ${key.modifiedBy}]`\n );\n console.log(` - id: ${key.id}`);\n console.log(` - sharedSecret: ${key.sharedSecret}`);\n }\n console.log('');\n\n if (err) {\n log.error(messages.keys.failedCreate(currentEnv, name), err);\n }\n }\n };\n\n RemoveApiKey = async (id: string) => {\n const { currentEnv, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis({ commit: true });\n\n if (this.contensis) {\n const [err, key] = await this.contensis.apiKeys.RemoveKey(id);\n\n if (!err) {\n log.success(messages.keys.removed(currentEnv, id));\n console.log('');\n } else {\n log.error(messages.keys.failedRemove(currentEnv, id), err);\n }\n }\n };\n\n GetContentTypes = async () => {\n const { currentProject, log, messages } = this;\n let err;\n if (!this.contensis) err = await this.HydrateContensis();\n\n if (err) log.error(messages.contenttypes.noList(currentProject));\n if (this.contensis) {\n this.contentTypes = this.contensis.models.contentTypes();\n this.components = this.contensis.models.components();\n } else {\n log.warning(messages.contenttypes.noList(currentProject));\n }\n };\n\n PrintContentTypes = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n log.success(messages.contenttypes.list(currentProject));\n this.HandleFormattingAndOutput(contentTypes, () => {\n // print the content types to console\n for (const contentType of contentTypes) {\n const fieldsLength = contentType.fields?.length || 0;\n console.log(\n ` - ${contentType.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintContentType = async (contentTypeId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n const contentType = contentTypes.find(\n c => c.id.toLowerCase() === contentTypeId.toLowerCase()\n );\n if (contentType) {\n log.success(\n messages.contenttypes.get(currentProject, contentType.id)\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, log.object);\n } else {\n log.error(\n messages.contenttypes.failedGet(currentProject, contentTypeId)\n );\n }\n }\n }\n };\n\n RemoveContentTypes = async (contentTypeIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n if (!this.contensis)\n await this.ConnectContensisImport({\n source: 'input',\n commit,\n });\n if (this.contensis) {\n const [err, result] = await this.contensis.DeleteContentTypes(\n contentTypeIds\n );\n\n if (err) {\n log.error(\n messages.contenttypes.failedRemove(\n currentProject,\n contentTypeIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.contenttypes.removed(\n currentProject,\n contentTypeIds.join('\", \"'),\n !this.contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.object(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportContentTypes = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n contentTypeIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<ContentType[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n await this.ConnectContensisImport({\n commit,\n source: fromFile ? 'file' : 'contensis',\n });\n\n if (this.contensis) {\n // Pass each content type to the target repo\n for (const contentType of fileData) {\n // Fix invalid data\n contentType.projectId = currentProject;\n delete contentType.uuid;\n\n const [err, created, createStatus] =\n await this.contensis.models.targetRepos[\n currentProject\n ].repo.UpsertContentType(false, contentType);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.contenttypes.created(\n currentProject,\n contentType.id,\n createStatus\n )\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, () => {});\n }\n }\n }\n };\n\n PrintComponents = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve components list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n log.success(messages.components.list(currentProject));\n\n this.HandleFormattingAndOutput(components, () => {\n // print the components to console\n for (const component of components) {\n const fieldsLength = component.fields?.length || 0;\n console.log(\n ` - ${component.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintComponent = async (componentId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n const component = components.find(\n c => c.id.toLowerCase() === componentId.toLowerCase()\n );\n if (component) {\n log.success(messages.components.get(currentProject, component.id));\n // print the component to console\n this.HandleFormattingAndOutput(component, log.object);\n } else {\n log.error(messages.components.failedGet(currentProject, componentId));\n }\n }\n }\n };\n\n RemoveComponents = async (componentIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n if (!this.contensis)\n await this.ConnectContensisImport({\n source: 'input',\n commit,\n });\n if (this.contensis) {\n const [err, result] = await this.contensis.DeleteContentTypes(\n undefined,\n componentIds\n );\n\n if (err) {\n log.error(\n messages.components.failedRemove(\n currentProject,\n componentIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.components.removed(\n currentProject,\n componentIds.join('\", \"'),\n !this.contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.info(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportComponents = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n componentIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<Component[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n await this.ConnectContensisImport({\n commit,\n source: fromFile ? 'file' : 'contensis',\n });\n\n if (this.contensis) {\n // Pass each component to the target repo\n for (const component of fileData) {\n // Fix invalid data\n component.projectId = currentProject;\n delete component.uuid;\n\n const [err, created, createStatus] =\n await this.contensis.models.targetRepos[\n currentProject\n ].repo.UpsertComponent(false, component);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.components.created(\n currentProject,\n component.id,\n createStatus\n )\n );\n // print the component to console\n this.HandleFormattingAndOutput(component, () => {});\n }\n }\n }\n };\n\n RemoveEntry = async (id: string, commit = false) => {\n const { currentEnv, log, messages } = this;\n if (!this.contensis)\n await this.ConnectContensisImport({\n source: 'input',\n commit,\n });\n\n if (this.contensis) {\n if (this.contensis.isPreview) {\n console.log(log.successText(` -- PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING DELETE *** `));\n }\n const [err, result] = await this.contensis.DeleteEntries();\n if (result)\n this.HandleFormattingAndOutput(result, () => {\n // print the migrateResult to console\n printMigrateResult(this, result, { action: 'delete' });\n });\n if (\n !err &&\n ((!commit &&\n Object.values(result.entriesToMigrate)?.[0].totalCount > 0) ||\n (commit && result.migrateResult?.deleted))\n ) {\n log.success(messages.entries.removed(currentEnv, id, commit));\n if (!commit) log.help(messages.entries.commitTip());\n } else {\n log.error(messages.entries.failedRemove(currentEnv, id), err);\n if (!Object.values(result.entriesToMigrate)?.[0].totalCount)\n log.help(messages.entries.notFound(id));\n }\n }\n };\n\n GetEntries = async ({\n withDependents = false,\n }: {\n withDependents?: boolean;\n }) => {\n const { currentProject, log, messages } = this;\n await this.ConnectContensis();\n\n if (this.contensis) {\n log.line();\n const entries = await this.contensis.GetEntries({ withDependents });\n this.HandleFormattingAndOutput(entries, () =>\n // print the entries to console\n logEntriesTable(\n entries,\n currentProject,\n this.contensis?.payload.query?.fields\n )\n );\n } else {\n log.warning(messages.contenttypes.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n ImportEntries = async ({\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n }) => {\n const { currentProject, log, messages } = this;\n\n const fileData = fromFile ? readJsonFile<Entry[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n await this.ConnectContensisImport({\n commit,\n source: fromFile ? 'file' : 'contensis',\n fileData,\n fileDataType: 'entries',\n });\n\n if (this.contensis) {\n log.line();\n if (this.contensis.isPreview) {\n console.log(log.successText(` -- IMPORT PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING IMPORT *** `));\n }\n\n const [migrateErr, migrateResult] = await this.contensis.MigrateEntries();\n\n if (migrateErr) logError(migrateErr);\n else\n this.HandleFormattingAndOutput(migrateResult, () => {\n // print the migrateResult to console\n printMigrateResult(this, migrateResult);\n });\n } else {\n log.warning(messages.contenttypes.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n PrintWebhookSubscriptions = async (\n subscriptionIds?: string[],\n name?: string\n ) => {\n const { currentEnv, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n if (this.contensis) {\n // Retrieve webhooks list for env\n const [webhooksErr, webhooks] =\n await this.contensis.subscriptions.webhooks.GetSubscriptions();\n\n const filteredResults =\n typeof name === 'string'\n ? webhooks.filter(w =>\n w.name?.toLowerCase().includes(name.toLowerCase())\n )\n : Array.isArray(subscriptionIds)\n ? webhooks.filter(w => subscriptionIds?.some(id => id === w.id))\n : webhooks;\n\n if (Array.isArray(filteredResults)) {\n this.HandleFormattingAndOutput(filteredResults, () => {\n // print the keys to console\n log.success(messages.webhooks.list(currentEnv));\n for (const {\n id,\n description,\n method,\n name,\n version,\n url,\n } of filteredResults) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${version.modified.toString().substring(0, 10)} ${\n version.modifiedBy\n }]`\n );\n console.log(` ${id}`);\n console.log(` [${method}] ${url}`);\n }\n console.log('');\n });\n }\n\n if (webhooksErr) {\n log.error(messages.webhooks.noList(currentEnv));\n log.error(jsonFormatter(webhooksErr));\n }\n }\n };\n\n PrintBlocks = async () => {\n const { currentEnv, env, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n if (this.contensis) {\n // Retrieve blocks list for env\n const [err, blocks] = await this.contensis.blocks.GetBlocks();\n\n if (Array.isArray(blocks)) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the blocks to console\n log.success(messages.blocks.list(currentEnv, env.currentProject));\n for (const {\n id,\n description,\n branches,\n liveVersion,\n madeLive,\n versionsSinceLive,\n } of blocks) {\n console.log(\n ` - ${id}${description ? ` (${description})` : ''}${\n madeLive\n ? ` [${madeLive.toString().substring(0, 10)} v${liveVersion}]`\n : ''\n }${\n versionsSinceLive\n ? log.warningText(` +${versionsSinceLive}`)\n : ''\n }`\n );\n for (const branch of branches)\n console.log(\n log.infoText(` [${branch.id}]: ${branch.status}`)\n );\n }\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockVersions = async (\n blockId: string,\n branch: string,\n version: string\n ) => {\n const { currentEnv, env, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n if (this.contensis) {\n // Retrieve block version\n const [err, blocks] = await this.contensis.blocks.GetBlockVersions(\n blockId,\n branch,\n version\n );\n\n if (blocks) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the version detail to console\n log.success(\n messages.blocks.get(blockId, currentEnv, env.currentProject)\n );\n for (const block of blocks)\n printBlockVersion(\n this,\n block,\n !version\n ? {\n showImage: false,\n showSource: true,\n showStaticPaths: false,\n showStatus: false,\n }\n : undefined\n );\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv, env.currentProject));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PushBlock = async (block: PushBlockParams) => {\n const { currentEnv, env, log, messages } = this;\n\n // Output request to console\n log.info(\n messages.blocks.tryPush(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n console.log(jsonFormatter(block));\n\n if (!this.contensis) await this.ConnectContensis();\n if (this.contensis) {\n // Push new block version\n const [err, blockVersion] = await this.contensis.blocks.PushBlockVersion(\n block\n );\n if (!err) {\n log.success(\n messages.blocks.pushed(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n }\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n printBlockVersion(this, blockVersion);\n });\n }\n if (err)\n throw new Error(\n messages.blocks.failedPush(block.id, currentEnv, env.currentProject)\n );\n }\n };\n\n ReleaseBlock = async (blockId: string, version: string) => {\n const { currentEnv, env, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n if (this.contensis) {\n // Retrieve block version\n const [err, blockVersion] = await this.contensis.blocks.BlockAction(\n blockId,\n 'release',\n version\n );\n\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n log.success(\n messages.blocks.released(blockId, currentEnv, env.currentProject)\n );\n printBlockVersion(this, blockVersion);\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedRelease(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockLogs = async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london'\n ) => {\n const { currentEnv, env, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n if (this.contensis) {\n // Retrieve block logs\n log.success(\n messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)\n );\n\n const [err, blockLogs] = await this.contensis.blocks.GetBlockLogs({\n blockId,\n branchId: branch,\n version,\n dataCenter,\n });\n\n if (blockLogs) {\n this.HandleFormattingAndOutput(blockLogs, () => {\n // print the logs to console\n console.log(\n ` - ${blockId} ${branch} ${\n Number(version) ? `v${version}` : version\n } [${dataCenter}]`\n );\n log.line();\n console.log(log.infoText(blockLogs));\n log.line();\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedGetLogs(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n HandleFormattingAndOutput = <T>(obj: T, logFn: (obj: T) => void) => {\n const { format, log, messages, output } = this;\n if (!format) {\n // print the object to console\n logFn(obj);\n } else if (format === 'csv') {\n log.raw('');\n log.raw(log.infoText(csvFormatter(obj)));\n } else if (format === 'xml') {\n log.raw('');\n log.raw(log.infoText(xmlFormatter(obj)));\n } else if (format === 'json') {\n log.raw('');\n log.raw(log.infoText(jsonFormatter(obj)));\n }\n log.raw('');\n\n if (output) {\n let writeString = '';\n if (format === 'csv') {\n writeString = csvFormatter(obj as any);\n } else if (format === 'xml') {\n writeString = xmlFormatter(obj as any);\n } else writeString = jsonFormatter(obj);\n // write output to file\n if (writeString) {\n fs.writeFileSync(output, writeString);\n log.success(messages.app.fileOutput(format, output));\n } else {\n log.info(messages.app.noFileOutput());\n }\n }\n };\n}\n\nexport const cliCommand = (\n commandArgs: string[],\n outputOpts: OutputOptions & IConnectOptions = {},\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisCli(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\nexport default ContensisCli;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,kBAAiB;AACjB,wBAAkB;AAClB,sBAAqB;AACrB,yBAAe;AAEf,kBAAwD;AACxD,kCAAiC;AACjC,kCAAiC;AACjC,gCAA+B;AAC/B,oBAAiC;AACjC,mBAA4B;AAC5B,0BAMO;AAGP,iBAA6B;AAC7B,iBAA6B;AAC7B,kBAA8B;AAC9B,qBAAsD;AACtD,2BAA6B;AA0B7B,IAAI,+BAA+B;AAEnC,MAAM,aAAa;AAAA,EACjB,OAAO,OAAO,CAAC,UAAkB;AAC/B,YAAQ,mBAAmB,MAAM;AACjC,UAAM,WAAW,QAAQ,IAAI;AAG7B,YAAQ,KAAK,QAAQ;AAAA,EACvB;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER;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AAC3B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,yBAAa,GAAG,CAAC,CAAC;AAAA,IACzC,WAAW,WAAW,QAAQ;AAC5B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,2BAAc,GAAG,CAAC,CAAC;AAAA,IAC1C;AACA,QAAI,IAAI,EAAE;AAEV,QAAI,QAAQ;AACV,UAAI,cAAc;AAClB,UAAI,WAAW,OAAO;AACpB,0BAAc,yBAAa,GAAU;AAAA,MACvC,WAAW,WAAW,OAAO;AAC3B,0BAAc,yBAAa,GAAU;AAAA,MACvC;AAAO,0BAAc,2BAAc,GAAG;AAEtC,UAAI,aAAa;AACf,kBAAAC,QAAG,cAAc,QAAQ,WAAW;AACpC,YAAI,QAAQ,SAAS,IAAI,WAAW,QAAQ,MAAM,CAAC;AAAA,MACrD,OAAO;AACL,YAAI,KAAK,SAAS,IAAI,aAAa,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,aAAa,CACxB,aACA,aAA8C,CAAC,GAC/C,gBAAyC,CAAC,MACvC;AACH,SAAO,IAAI,aAAa,CAAC,IAAI,IAAI,GAAG,WAAW,GAAG,YAAY,aAAa;AAC7E;AACA,IAAO,8BAAQ;",
|
|
4
|
+
"sourcesContent": ["import fs from 'fs';\nimport path from 'path';\nimport fetch from 'node-fetch';\nimport inquirer from 'inquirer';\nimport to from 'await-to-js';\nimport { Component, ContentType } from 'contensis-core-api';\nimport { isPassword, isSharedSecret, isUuid, url } from '~/util';\nimport SessionCacheProvider from '../providers/SessionCacheProvider';\nimport ContensisAuthService from './ContensisAuthService';\nimport CredentialProvider from '~/providers/CredentialProvider';\nimport { logError, Logger } from '~/util/logger';\nimport { LogMessages } from '~/localisation/en-GB';\nimport {\n ContensisMigrationService,\n MigrateRequest,\n PushBlockParams,\n SourceCms,\n logEntriesTable,\n} from 'migratortron';\nimport { Entry } from 'contensis-management-api/lib/models';\n\nimport { csvFormatter } from '~/util/csv.formatter';\nimport { xmlFormatter } from '~/util/xml.formatter';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { printBlockVersion, printMigrateResult } from '~/util/console.printer';\nimport { readJsonFile } from '~/providers/file-provider';\n\ntype OutputFormat = 'json' | 'csv' | 'xml';\n\ntype OutputOptions = {\n format?: OutputFormat;\n output?: string;\n};\n\ninterface IConnectOptions extends IAuthOptions {\n alias?: string;\n projectId?: string;\n}\n\ninterface IAuthOptions {\n user?: string;\n password?: string;\n clientId?: string;\n sharedSecret?: string;\n}\n\ninterface IImportOptions {\n sourceEnv?: string;\n sourceProjectId?: string;\n}\n\nlet insecurePasswordWarningShown = false;\n\nclass ContensisCli {\n static quit = (error?: Error) => {\n process.removeAllListeners('exit');\n const exitCode = error ? 1 : 0;\n\n // console.info(`\\nExiting contensis-cli with exit code: ${exitCode}\\n`);\n process.exit(exitCode);\n };\n\n private command: CliCommand;\n private format?: OutputFormat;\n private output?: string;\n private session: SessionCacheProvider;\n\n contensis?: ContensisMigrationService;\n contensisOpts: Partial<MigrateRequest>;\n contentTypes?: ContentType[];\n components?: Component[];\n currentProject: string;\n\n sourceEnv?: string;\n targetEnv?: string;\n urls:\n | {\n api: string;\n cms: string;\n liveWeb: string;\n previewWeb: string;\n iisWeb: string;\n iisPreviewWeb: string;\n }\n | undefined;\n log = Logger;\n messages = LogMessages;\n\n verb: string;\n noun: string;\n thirdArg: string;\n\n get cache() {\n return this.session.Get();\n }\n get currentEnv() {\n return this.cache.currentEnvironment || '';\n }\n\n set currentEnv(currentEnvironment: string) {\n this.session.Update({ currentEnvironment });\n }\n\n get env() {\n const currentEnvironment = this.currentEnv;\n const environments = this.cache.environments || {};\n\n if (!currentEnvironment) return {} as EnvironmentCache;\n else if (!!environments[currentEnvironment])\n return environments[currentEnvironment];\n else {\n return {\n history: [],\n lastUserId: '',\n projects: [],\n versionStatus: 'latest',\n } as EnvironmentCache;\n }\n }\n\n constructor(\n args: string[],\n outputOpts?: OutputOptions & IConnectOptions & IImportOptions,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n // console.log('args: ', JSON.stringify(args, null, 2));\n\n const [exe, script, verb = '', noun = '', ...restArgs] = args;\n this.verb = verb?.toLowerCase();\n this.noun = noun?.toLowerCase();\n this.thirdArg = restArgs?.[0];\n\n const commandText = `${this.verb} ${this.noun} ${\n restArgs ? restArgs.join(' ') : ''\n }`.trim();\n\n this.session = new SessionCacheProvider();\n\n this.contensisOpts = contensisOpts;\n this.format = outputOpts?.format;\n this.output =\n outputOpts?.output && path.join(process.cwd(), outputOpts.output);\n\n const currentEnvironment = outputOpts?.alias || this.currentEnv;\n const environments = this.cache.environments || {};\n this.currentEnv = currentEnvironment;\n\n const env = this.env;\n\n if (outputOpts?.projectId) env.currentProject = outputOpts.projectId;\n if (outputOpts?.user) env.lastUserId = outputOpts.user;\n // setting this in env means passwordFallback is written to environments.json\n if (outputOpts?.password) env.passwordFallback = outputOpts.password;\n if (outputOpts?.clientId) env.lastUserId = outputOpts.clientId;\n if (outputOpts?.sharedSecret)\n env.passwordFallback = outputOpts.sharedSecret;\n\n this.currentProject = env?.currentProject || 'null';\n this.sourceEnv = outputOpts?.sourceEnv || currentEnvironment;\n\n if (currentEnvironment) {\n this.urls = url(currentEnvironment, env?.currentProject || 'website');\n }\n\n this.command = {\n commandText,\n createdDate: new Date().toISOString(),\n createdUserId: env?.lastUserId,\n };\n\n if (currentEnvironment) {\n env.history = [this.command];\n if (commandText) {\n environments[currentEnvironment] = env;\n this.session.Update({\n currentEnvironment,\n environments,\n history: [commandText],\n });\n }\n }\n }\n\n PrintEnvironments = () => {\n const { log, messages } = this;\n const { currentEnvironment, environments = {} } = this.cache;\n const envKeys = Object.keys(environments);\n log.success(messages.envs.found(envKeys.length));\n this.HandleFormattingAndOutput(envKeys, () => {\n // print the envKeys to console\n for (const env of envKeys) {\n console.log(` - ${currentEnvironment === env ? '* ' : ''}${env}`);\n }\n });\n if (envKeys.length === 0 || !currentEnvironment) {\n log.help(messages.envs.tip());\n }\n };\n\n Connect = async (environment: string) => {\n const { log, messages, session } = this;\n\n if (environment) {\n this.currentEnv = environment;\n this.urls = url(environment, 'website');\n\n const [fetchErr, response] = await to(fetch(this.urls.cms));\n if (response && response?.status < 400) {\n log.success(messages.connect.connected(environment));\n session.UpdateEnv(this.env, environment);\n\n if (this.env?.lastUserId) {\n // await this.ConnectContensis();\n await this.PrintProjects();\n } else {\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n } else {\n // Cannot reach environment - status X\n log.error(\n messages.connect.unreachable(this.urls.cms, response?.status || 0)\n );\n }\n } else {\n // No environment alias specified\n log.error(messages.connect.noEnv());\n }\n };\n\n ConnectContensis = async ({ commit = false } = {}) => {\n if (!this.contensis) {\n const { contensisOpts, currentEnv, env, log, messages } = this;\n const userId = env?.lastUserId;\n const isGuidId = userId && isUuid(userId);\n\n if (currentEnv && userId) {\n const credentials = await this.GetCredentials(\n userId,\n env.passwordFallback\n );\n\n const cachedPassword = credentials?.current?.password;\n\n if (cachedPassword) {\n this.contensis = new ContensisMigrationService(\n {\n ...contensisOpts,\n source: {\n url: this.urls?.cms || '',\n username: !isGuidId ? userId : undefined,\n password: !isGuidId ? cachedPassword : undefined,\n clientId: isGuidId ? userId : undefined,\n sharedSecret: isGuidId ? cachedPassword : undefined,\n project: env?.currentProject || '',\n assetHostname: this.urls?.previewWeb,\n },\n concurrency:\n typeof contensisOpts.concurrency !== 'undefined'\n ? contensisOpts.concurrency\n : 3,\n outputProgress: true,\n },\n !commit\n );\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!userId) log.help(messages.connect.tip());\n }\n }\n return this.contensis;\n };\n\n ConnectContensisImport = async ({\n commit,\n source,\n fileData,\n fileDataType,\n }: {\n commit: boolean;\n source: 'contensis' | 'file' | 'input';\n fileData?: any[] | string;\n fileDataType?: 'entries' | 'contentTypes' | 'components';\n }) => {\n const { contensisOpts, currentEnv, env, log, messages, sourceEnv } = this;\n const environments = this.cache.environments || {};\n const sourceEnvironment = environments[sourceEnv || ''] || {};\n const sourceCms =\n ('source' in contensisOpts && contensisOpts.source) ||\n ({} as Partial<SourceCms>);\n const sourceUserId =\n sourceCms.clientId || sourceCms.username || sourceEnvironment.lastUserId;\n const sourceProjectId =\n sourceCms.project || sourceEnvironment.currentProject || 'website';\n const isSourceGuidId = sourceUserId && isUuid(sourceUserId);\n const sourceUrls = url(sourceEnv || '', sourceProjectId);\n\n const sourcePassword =\n sourceCms.sharedSecret ||\n sourceCms.password ||\n sourceEnvironment.passwordFallback;\n\n const targetUserId = env?.lastUserId;\n const isTargetGuidId = targetUserId && isUuid(targetUserId);\n\n if (sourceUserId && currentEnv && targetUserId) {\n const sourceCredentials = await this.GetCredentials(\n sourceUserId,\n sourcePassword,\n sourceEnv\n );\n\n const cachedSourcePassword = sourceCredentials?.current?.password;\n\n const targetCredentials = await this.GetCredentials(\n targetUserId,\n env.passwordFallback\n );\n\n const cachedTargetPassword = targetCredentials?.current?.password;\n\n if (cachedSourcePassword && cachedTargetPassword) {\n if (source === 'file' || source === 'input') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n ...(fileDataType ? { [fileDataType]: fileData } : {}),\n },\n !commit\n );\n }\n if (source === 'contensis') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n source: {\n url: sourceUrls.cms || '',\n username: !isSourceGuidId ? sourceUserId : undefined,\n password: !isSourceGuidId ? cachedSourcePassword : undefined,\n clientId: isSourceGuidId ? sourceUserId : undefined,\n sharedSecret: isSourceGuidId ? cachedSourcePassword : undefined,\n project: sourceProjectId,\n assetHostname: sourceUrls.previewWeb,\n },\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n },\n !commit\n );\n }\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!targetUserId) log.help(messages.connect.tip());\n }\n };\n\n GetCredentials = async (\n userId: string,\n password?: string,\n currentEnv = this.currentEnv\n ): Promise<CredentialProvider | undefined> => {\n const { env, log, messages } = this;\n if (userId) {\n const [credentialError, credentials] = await new CredentialProvider(\n { userId, alias: currentEnv },\n password\n ).Init();\n\n if (credentialError && !credentials.current) {\n // Log problem with Credential Provider\n log.error(credentialError as any);\n return;\n }\n\n if (credentials.remarks.secure !== true) {\n if (!insecurePasswordWarningShown) {\n log.warning(messages.login.insecurePassword());\n insecurePasswordWarningShown = true;\n }\n } else {\n env.passwordFallback = undefined;\n this.session.UpdateEnv(env, currentEnv);\n }\n return credentials;\n }\n };\n\n Login = async (\n userId: string,\n {\n password = isPassword(this.env.passwordFallback),\n promptPassword = true,\n sharedSecret = isSharedSecret(this.env.passwordFallback),\n silent = false,\n attempt = 1,\n }: {\n password?: string;\n promptPassword?: boolean;\n sharedSecret?: string;\n silent?: boolean;\n attempt?: number;\n } = {}\n ): Promise<string | undefined> => {\n let inputPassword = password || sharedSecret;\n const { log, messages } = this;\n\n if (userId) {\n const { currentEnv, env } = this;\n\n if (currentEnv) {\n const credentials = await this.GetCredentials(userId, inputPassword);\n\n if (credentials) {\n const cachedPassword = isPassword(credentials.current?.password);\n const cachedSecret = isSharedSecret(credentials.current?.password);\n\n if (!cachedPassword && !cachedSecret && promptPassword) {\n // Password prompt\n ({ inputPassword } = await inquirer.prompt([\n {\n type: 'password',\n message: messages.login.passwordPrompt(currentEnv, userId),\n name: 'inputPassword',\n mask: '*',\n prefix: undefined,\n },\n ]));\n }\n\n if (inputPassword || cachedPassword || cachedSecret) {\n const authService = new ContensisAuthService({\n username: userId,\n password: inputPassword || cachedPassword,\n projectId: env?.currentProject || 'website',\n rootUrl: this.urls?.cms || '',\n clientId: userId,\n clientSecret: sharedSecret || cachedSecret,\n });\n\n const [authError, bearerToken] = await to(\n authService.BearerToken()\n );\n\n // Login successful\n if (bearerToken) {\n // Set env vars\n env.authToken = bearerToken;\n env.lastUserId = userId;\n env.passwordFallback =\n credentials.remarks.secure !== true\n ? credentials.current?.password\n : undefined;\n // Persist env before finding projects or doing anything else\n this.session.UpdateEnv(env);\n\n if (!silent) {\n Logger.success(messages.login.success(currentEnv, userId));\n await this.PrintProjects();\n }\n if (inputPassword) await credentials.Save(inputPassword);\n if (sharedSecret) await credentials.Save(sharedSecret);\n } else if (authError) {\n Logger.error(authError.toString());\n // Clear env vars\n env.authToken = '';\n env.lastUserId = '';\n env.passwordFallback = undefined;\n // Persist env to remove cleared values\n this.session.UpdateEnv(env);\n\n // If the auth error was raised using a cached password\n if (\n (cachedPassword || cachedSecret) &&\n credentials.remarks.secure\n ) {\n // Remove any bad stored credential and trigger login prompt again\n await credentials.Delete();\n return await this.Login(userId, { password, sharedSecret });\n } else {\n throw new Error(messages.login.failed(currentEnv, userId));\n }\n }\n\n return env.authToken;\n } else {\n Logger.error(messages.login.passwordPrompt());\n if (attempt < 2)\n return await this.Login(userId, { attempt: attempt + 1 });\n }\n }\n } else {\n // No environment set, use `contensis connect {alias}` first\n Logger.error(messages.login.noEnv());\n }\n } else {\n // No user id specified\n Logger.error(messages.login.noUserId());\n }\n };\n\n PrintContensisVersion = async () => {\n const { log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n if (Array.isArray(projects)) {\n // Print contensis version to console\n this.HandleFormattingAndOutput(contensis.contensisVersion, () =>\n log.raw(log.highlightText(contensis.contensisVersion))\n );\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n PrintProjects = async () => {\n const { currentProject, log, messages, session } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n if (Array.isArray(projects)) {\n // save these projects in cache\n const nextCurrentProject =\n currentProject && currentProject !== 'null'\n ? currentProject\n : projects.some(p => p.id === 'website')\n ? 'website'\n : undefined;\n\n session.UpdateEnv({\n projects: projects.map(p => p.id),\n currentProject: nextCurrentProject,\n });\n\n log.success(messages.projects.list());\n this.HandleFormattingAndOutput(projects, () => {\n // print the projects to console\n for (const project of projects) {\n console.log(\n ` - ${nextCurrentProject === project.id ? '* ' : ''}[${\n project.primaryLanguage\n }] ${project.id}`\n );\n }\n });\n\n if (!this.SetProject(nextCurrentProject))\n log.warning(messages.projects.tip());\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n SetProject = (projectId = 'website') => {\n const { env, log, messages, session } = this;\n let nextProjectId: string | undefined;\n if (env?.projects.length > 0 && env?.lastUserId) {\n nextProjectId = env.projects.find(\n p => p.toLowerCase() === projectId.toLowerCase()\n );\n if (nextProjectId) {\n env.currentProject = nextProjectId;\n session.UpdateEnv(env);\n log.success(messages.projects.set(projectId));\n } else {\n log.error(messages.projects.failedSet(projectId));\n }\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n return nextProjectId;\n };\n\n SetVersion = (versionStatus: 'latest' | 'published') => {\n const { env, log, messages, session } = this;\n if (!['latest', 'published'].includes(versionStatus)) {\n log.error(messages.version.invalid(versionStatus));\n return false;\n }\n if (!env) {\n log.help(messages.version.noEnv());\n return false;\n }\n if (env?.projects.length > 0 && env?.lastUserId) {\n session.UpdateEnv({ versionStatus });\n log.success(messages.version.set(this.currentEnv, versionStatus));\n return true;\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n return false;\n }\n };\n\n HydrateContensis = async () => {\n const { log } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve content types list for env\n const [contensisErr, models] = await to(\n contensis.models.HydrateContensisRepositories()\n );\n\n if (contensisErr) {\n log.error(contensisErr.message);\n return contensisErr;\n }\n }\n };\n\n PrintApiKeys = async () => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();\n\n if (Array.isArray(apiKeys)) {\n log.success(messages.keys.list(currentEnv));\n this.HandleFormattingAndOutput(apiKeys, () => {\n // print the keys to console\n for (const {\n id,\n sharedSecret,\n name,\n description,\n dateModified,\n modifiedBy,\n } of apiKeys) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${dateModified.toString().substring(0, 10)} ${modifiedBy}]`\n );\n console.log(` ${id}`);\n console.log(` ${sharedSecret}`);\n }\n });\n }\n\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n }\n }\n };\n\n CreateApiKey = async (name: string, description?: string) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n const [err, key] = await contensis.apiKeys.CreateKey(name, description);\n\n if (key) {\n log.success(messages.keys.created(currentEnv, name));\n\n // print the key details to console\n console.log(\n ` - ${key.name}${\n key.description ? ` (${key.description})` : ''\n } [${key.dateModified.toString().substring(0, 10)} ${key.modifiedBy}]`\n );\n console.log(` - id: ${key.id}`);\n console.log(` - sharedSecret: ${key.sharedSecret}`);\n }\n console.log('');\n\n if (err) {\n log.error(messages.keys.failedCreate(currentEnv, name), err);\n }\n }\n };\n\n RemoveApiKey = async (id: string) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis({ commit: true });\n\n if (contensis) {\n const [err, key] = await contensis.apiKeys.RemoveKey(id);\n\n if (!err) {\n log.success(messages.keys.removed(currentEnv, id));\n console.log('');\n } else {\n log.error(messages.keys.failedRemove(currentEnv, id), err);\n }\n }\n };\n\n GetContentTypes = async () => {\n const { currentProject, log, messages } = this;\n let err;\n if (!this.contensis) err = await this.HydrateContensis();\n\n if (err) log.error(messages.contenttypes.noList(currentProject));\n if (this.contensis) {\n this.contentTypes = this.contensis.models.contentTypes();\n this.components = this.contensis.models.components();\n } else {\n log.warning(messages.contenttypes.noList(currentProject));\n }\n };\n\n PrintContentTypes = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n log.success(messages.contenttypes.list(currentProject));\n this.HandleFormattingAndOutput(contentTypes, () => {\n // print the content types to console\n for (const contentType of contentTypes) {\n const fieldsLength = contentType.fields?.length || 0;\n console.log(\n ` - ${contentType.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintContentType = async (contentTypeId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n const contentType = contentTypes.find(\n c => c.id.toLowerCase() === contentTypeId.toLowerCase()\n );\n if (contentType) {\n log.success(\n messages.contenttypes.get(currentProject, contentType.id)\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, log.object);\n } else {\n log.error(\n messages.contenttypes.failedGet(currentProject, contentTypeId)\n );\n }\n }\n }\n };\n\n RemoveContentTypes = async (contentTypeIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n if (!this.contensis)\n await this.ConnectContensisImport({\n source: 'input',\n commit,\n });\n if (this.contensis) {\n const [err, result] = await this.contensis.DeleteContentTypes(\n contentTypeIds\n );\n\n if (err) {\n log.error(\n messages.contenttypes.failedRemove(\n currentProject,\n contentTypeIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.contenttypes.removed(\n currentProject,\n contentTypeIds.join('\", \"'),\n !this.contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.object(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportContentTypes = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n contentTypeIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<ContentType[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n await this.ConnectContensisImport({\n commit,\n source: fromFile ? 'file' : 'contensis',\n });\n\n if (this.contensis) {\n // Pass each content type to the target repo\n for (const contentType of fileData) {\n // Fix invalid data\n contentType.projectId = currentProject;\n delete contentType.uuid;\n\n const [err, created, createStatus] =\n await this.contensis.models.targetRepos[\n currentProject\n ].repo.UpsertContentType(false, contentType);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.contenttypes.created(\n currentProject,\n contentType.id,\n createStatus\n )\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, () => {});\n }\n }\n }\n };\n\n PrintComponents = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve components list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n log.success(messages.components.list(currentProject));\n\n this.HandleFormattingAndOutput(components, () => {\n // print the components to console\n for (const component of components) {\n const fieldsLength = component.fields?.length || 0;\n console.log(\n ` - ${component.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintComponent = async (componentId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n const component = components.find(\n c => c.id.toLowerCase() === componentId.toLowerCase()\n );\n if (component) {\n log.success(messages.components.get(currentProject, component.id));\n // print the component to console\n this.HandleFormattingAndOutput(component, log.object);\n } else {\n log.error(messages.components.failedGet(currentProject, componentId));\n }\n }\n }\n };\n\n RemoveComponents = async (componentIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n if (!this.contensis)\n await this.ConnectContensisImport({\n source: 'input',\n commit,\n });\n if (this.contensis) {\n const [err, result] = await this.contensis.DeleteContentTypes(\n undefined,\n componentIds\n );\n\n if (err) {\n log.error(\n messages.components.failedRemove(\n currentProject,\n componentIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.components.removed(\n currentProject,\n componentIds.join('\", \"'),\n !this.contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.info(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportComponents = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n componentIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<Component[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n await this.ConnectContensisImport({\n commit,\n source: fromFile ? 'file' : 'contensis',\n });\n\n if (this.contensis) {\n // Pass each component to the target repo\n for (const component of fileData) {\n // Fix invalid data\n component.projectId = currentProject;\n delete component.uuid;\n\n const [err, created, createStatus] =\n await this.contensis.models.targetRepos[\n currentProject\n ].repo.UpsertComponent(false, component);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.components.created(\n currentProject,\n component.id,\n createStatus\n )\n );\n // print the component to console\n this.HandleFormattingAndOutput(component, () => {});\n }\n }\n }\n };\n\n RemoveEntry = async (id: string, commit = false) => {\n const { currentEnv, log, messages } = this;\n if (!this.contensis)\n await this.ConnectContensisImport({\n source: 'input',\n commit,\n });\n\n if (this.contensis) {\n if (this.contensis.isPreview) {\n console.log(log.successText(` -- PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING DELETE *** `));\n }\n const [err, result] = await this.contensis.DeleteEntries();\n if (result)\n this.HandleFormattingAndOutput(result, () => {\n // print the migrateResult to console\n printMigrateResult(this, result, { action: 'delete' });\n });\n if (\n !err &&\n ((!commit &&\n Object.values(result.entriesToMigrate)?.[0].totalCount > 0) ||\n (commit && result.migrateResult?.deleted))\n ) {\n log.success(messages.entries.removed(currentEnv, id, commit));\n if (!commit) log.help(messages.entries.commitTip());\n } else {\n log.error(messages.entries.failedRemove(currentEnv, id), err);\n if (!Object.values(result.entriesToMigrate)?.[0].totalCount)\n log.help(messages.entries.notFound(id));\n }\n }\n };\n\n GetEntries = async ({\n withDependents = false,\n }: {\n withDependents?: boolean;\n }) => {\n const { currentProject, log, messages } = this;\n await this.ConnectContensis();\n\n if (this.contensis) {\n log.line();\n const entries = await this.contensis.GetEntries({ withDependents });\n this.HandleFormattingAndOutput(entries, () =>\n // print the entries to console\n logEntriesTable(\n entries,\n currentProject,\n this.contensis?.payload.query?.fields\n )\n );\n } else {\n log.warning(messages.contenttypes.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n ImportEntries = async ({\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n }) => {\n const { currentProject, log, messages } = this;\n\n const fileData = fromFile ? readJsonFile<Entry[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n await this.ConnectContensisImport({\n commit,\n source: fromFile ? 'file' : 'contensis',\n fileData,\n fileDataType: 'entries',\n });\n\n if (this.contensis) {\n log.line();\n if (this.contensis.isPreview) {\n console.log(log.successText(` -- IMPORT PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING IMPORT *** `));\n }\n\n const [migrateErr, migrateResult] = await this.contensis.MigrateEntries();\n\n if (migrateErr) logError(migrateErr);\n else\n this.HandleFormattingAndOutput(migrateResult, () => {\n // print the migrateResult to console\n printMigrateResult(this, migrateResult);\n });\n } else {\n log.warning(messages.contenttypes.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n PrintWebhookSubscriptions = async (\n subscriptionIds?: string[],\n name?: string\n ) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve webhooks list for env\n const [webhooksErr, webhooks] =\n await contensis.subscriptions.webhooks.GetSubscriptions();\n\n const filteredResults =\n typeof name === 'string'\n ? webhooks.filter(w =>\n w.name?.toLowerCase().includes(name.toLowerCase())\n )\n : Array.isArray(subscriptionIds)\n ? webhooks.filter(w => subscriptionIds?.some(id => id === w.id))\n : webhooks;\n\n if (Array.isArray(filteredResults)) {\n this.HandleFormattingAndOutput(filteredResults, () => {\n // print the keys to console\n log.success(messages.webhooks.list(currentEnv));\n for (const {\n id,\n description,\n method,\n name,\n version,\n url,\n } of filteredResults) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${version.modified.toString().substring(0, 10)} ${\n version.modifiedBy\n }]`\n );\n console.log(` ${id}`);\n console.log(` [${method}] ${url}`);\n }\n console.log('');\n });\n }\n\n if (webhooksErr) {\n log.error(messages.webhooks.noList(currentEnv));\n log.error(jsonFormatter(webhooksErr));\n }\n }\n };\n\n PrintBlocks = async () => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve blocks list for env\n const [err, blocks] = await contensis.blocks.GetBlocks();\n\n if (Array.isArray(blocks)) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the blocks to console\n log.success(messages.blocks.list(currentEnv, env.currentProject));\n for (const {\n id,\n description,\n branches,\n liveVersion,\n madeLive,\n versionsSinceLive,\n } of blocks) {\n console.log(\n ` - ${id}${description ? ` (${description})` : ''}${\n madeLive\n ? ` [${madeLive.toString().substring(0, 10)} v${liveVersion}]`\n : ''\n }${\n versionsSinceLive\n ? log.warningText(` +${versionsSinceLive}`)\n : ''\n }`\n );\n for (const branch of branches)\n console.log(\n log.infoText(` [${branch.id}]: ${branch.status}`)\n );\n }\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockVersions = async (\n blockId: string,\n branch: string,\n version: string\n ) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block version\n const [err, blocks] = await contensis.blocks.GetBlockVersions(\n blockId,\n branch,\n version\n );\n\n if (blocks) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the version detail to console\n log.success(\n messages.blocks.get(blockId, currentEnv, env.currentProject)\n );\n for (const block of blocks)\n printBlockVersion(\n this,\n block,\n !version\n ? {\n showImage: false,\n showSource: true,\n showStaticPaths: false,\n showStatus: false,\n }\n : undefined\n );\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv, env.currentProject));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PushBlock = async (block: PushBlockParams) => {\n const { currentEnv, env, log, messages } = this;\n\n // Output request to console\n log.info(\n messages.blocks.tryPush(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n console.log(jsonFormatter(block));\n\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Push new block version\n const [err, blockVersion] = await contensis.blocks.PushBlockVersion(\n block\n );\n if (!err) {\n log.success(\n messages.blocks.pushed(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n }\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n printBlockVersion(this, blockVersion);\n });\n }\n if (err)\n throw new Error(\n messages.blocks.failedPush(block.id, currentEnv, env.currentProject)\n );\n }\n };\n\n ReleaseBlock = async (blockId: string, version: string) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block version\n const [err, blockVersion] = await contensis.blocks.BlockAction(\n blockId,\n 'release',\n version\n );\n\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n log.success(\n messages.blocks.released(blockId, currentEnv, env.currentProject)\n );\n printBlockVersion(this, blockVersion);\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedRelease(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockLogs = async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london'\n ) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block logs\n log.success(\n messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)\n );\n\n const [err, blockLogs] = await contensis.blocks.GetBlockLogs({\n blockId,\n branchId: branch,\n version,\n dataCenter,\n });\n\n if (blockLogs) {\n this.HandleFormattingAndOutput(blockLogs, () => {\n // print the logs to console\n console.log(\n ` - ${blockId} ${branch} ${\n Number(version) ? `v${version}` : version\n } [${dataCenter}]`\n );\n log.line();\n console.log(log.infoText(blockLogs));\n log.line();\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedGetLogs(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n HandleFormattingAndOutput = <T>(obj: T, logFn: (obj: T) => void) => {\n const { format, log, messages, output } = this;\n if (!format) {\n // print the object to console\n logFn(obj);\n } else if (format === 'csv') {\n log.raw('');\n log.raw(log.infoText(csvFormatter(obj)));\n } else if (format === 'xml') {\n log.raw('');\n log.raw(log.infoText(xmlFormatter(obj)));\n } else if (format === 'json') {\n log.raw('');\n log.raw(log.infoText(jsonFormatter(obj)));\n }\n log.raw('');\n\n if (output) {\n let writeString = '';\n if (format === 'csv') {\n writeString = csvFormatter(obj as any);\n } else if (format === 'xml') {\n writeString = xmlFormatter(obj as any);\n } else writeString = jsonFormatter(obj);\n // write output to file\n if (writeString) {\n fs.writeFileSync(output, writeString);\n log.success(messages.app.fileOutput(format, output));\n } else {\n log.info(messages.app.noFileOutput());\n }\n }\n };\n}\n\nexport const cliCommand = (\n commandArgs: string[],\n outputOpts: OutputOptions & IConnectOptions = {},\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisCli(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\nexport default ContensisCli;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,kBAAiB;AACjB,wBAAkB;AAClB,sBAAqB;AACrB,yBAAe;AAEf,kBAAwD;AACxD,kCAAiC;AACjC,kCAAiC;AACjC,gCAA+B;AAC/B,oBAAiC;AACjC,mBAA4B;AAC5B,0BAMO;AAGP,iBAA6B;AAC7B,iBAA6B;AAC7B,kBAA8B;AAC9B,qBAAsD;AACtD,2BAA6B;AA0B7B,IAAI,+BAA+B;AAEnC,MAAM,aAAa;AAAA,EACjB,OAAO,OAAO,CAAC,UAAkB;AAC/B,YAAQ,mBAAmB,MAAM;AACjC,UAAM,WAAW,QAAQ,IAAI;AAG7B,YAAQ,KAAK,QAAQ;AAAA,EACvB;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAUA,MAAM;AAAA,EACN,WAAW;AAAA,EAEX;AAAA,EACA;AAAA,EACA;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,QAAQ,IAAI;AAAA,EAC1B;AAAA,EACA,IAAI,aAAa;AACf,WAAO,KAAK,MAAM,sBAAsB;AAAA,EAC1C;AAAA,EAEA,IAAI,WAAW,oBAA4B;AACzC,SAAK,QAAQ,OAAO,EAAE,mBAAmB,CAAC;AAAA,EAC5C;AAAA,EAEA,IAAI,MAAM;AAC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QAAQ;AAC5B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,2BAAc,GAAG,CAAC,CAAC;AAAA,IAC1C;AACA,QAAI,IAAI,EAAE;AAEV,QAAI,QAAQ;AACV,UAAI,cAAc;AAClB,UAAI,WAAW,OAAO;AACpB,0BAAc,yBAAa,GAAU;AAAA,MACvC,WAAW,WAAW,OAAO;AAC3B,0BAAc,yBAAa,GAAU;AAAA,MACvC;AAAO,0BAAc,2BAAc,GAAG;AAEtC,UAAI,aAAa;AACf,kBAAAC,QAAG,cAAc,QAAQ,WAAW;AACpC,YAAI,QAAQ,SAAS,IAAI,WAAW,QAAQ,MAAM,CAAC;AAAA,MACrD,OAAO;AACL,YAAI,KAAK,SAAS,IAAI,aAAa,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,aAAa,CACxB,aACA,aAA8C,CAAC,GAC/C,gBAAyC,CAAC,MACvC;AACH,SAAO,IAAI,aAAa,CAAC,IAAI,IAAI,GAAG,WAAW,GAAG,YAAY,aAAa;AAC7E;AACA,IAAO,8BAAQ;",
|
|
6
6
|
"names": ["SessionCacheProvider", "path", "to", "fetch", "CredentialProvider", "inquirer", "ContensisAuthService", "name", "url", "fs"]
|
|
7
7
|
}
|
package/dist/shell.js
CHANGED
package/dist/shell.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/shell.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport figlet from 'figlet';\nimport inquirer from 'inquirer';\nimport inquirerPrompt from 'inquirer-command-prompt';\nimport commands from './commands';\nimport { LogMessages } from './localisation/en-GB';\nimport { logError, Logger } from './util/logger';\nimport CredentialProvider from './providers/CredentialProvider';\nimport ContensisCli, { cliCommand } from './services/ContensisCliService';\nimport { Logging } from './util';\n\nclass ContensisShell {\n private currentEnvironment!: string;\n private emptyInputCounter: number = 0;\n private env!: EnvironmentCache;\n private firstStart = true;\n private userId: string = '';\n private log = Logger;\n private messages = LogMessages;\n\n private refreshEnvironment = () => {\n // Reload any persisted changes from the disk cache\n const {\n cache: { currentEnvironment = '', environments = {} },\n } = new ContensisCli([]);\n // console.log(`refreshing env w/${currentEnvironment}`);\n this.currentEnvironment = currentEnvironment;\n this.env = environments[currentEnvironment];\n\n // Reload logging here to support changing language\n Logging('en-GB').then(({ messages, Log }) => {\n this.log = Log;\n this.messages = messages;\n });\n };\n\n constructor() {\n this.refreshEnvironment();\n inquirerPrompt.setConfig({\n history: {\n save: true,\n folder: path.join(process.cwd(), '../'),\n limit: 100,\n blacklist: ['quit'],\n },\n });\n // inquirer.registerPrompt('command', inquirerPrompt);\n\n const { log, messages } = this;\n\n figlet.text(\n messages.app.contensis(),\n {\n font: 'Block',\n horizontalLayout: 'default',\n verticalLayout: 'default',\n width: process.stdout.columns,\n whitespaceBreak: true,\n },\n (err, data) => {\n if (err) {\n log.error(messages.app.unknownError());\n console.dir(err);\n return;\n }\n console.log(log.successText(data));\n console.log(log.infoText(messages.app.startup()));\n console.log(log.helpText(messages.app.help()));\n\n this.start().catch(ex => log.error(ex));\n }\n );\n }\n\n restart = async () => {\n this.firstStart = false;\n this.log.line(); // add a line so we can see where the shell has been restarted\n await this.start();\n };\n\n start = async () => {\n this.refreshEnvironment();\n this.userId = '';\n const { currentEnvironment, env, log, messages } = this;\n\n if (env?.lastUserId) {\n const [credsErr, credentials] = await new CredentialProvider(\n {\n userId: env.lastUserId,\n alias: currentEnvironment,\n },\n env.passwordFallback\n ).Init();\n if (credsErr && !credentials.current) {\n log.error(credsErr.message);\n }\n if (credentials.current) {\n if (this.firstStart) {\n const token = await cliCommand(['login', env.lastUserId]).Login(\n env.lastUserId,\n {\n promptPassword: false,\n silent: true,\n }\n );\n if (token) {\n this.userId = env.lastUserId;\n if (!env.currentProject) log.warning(messages.projects.tip());\n }\n this.firstStart = false;\n this.refreshEnvironment();\n } else {\n this.userId = env.lastUserId;\n }\n }\n }\n await this.contensisPrompt();\n };\n\n contensisPrompt = async (): Promise<any> => {\n const { currentEnvironment, env, log, messages, userId } = this;\n\n const availableCommands = [\n {\n filter: (str: string) => {\n return str.replace(/ \\[.*$/, '');\n },\n },\n 'connect',\n 'list envs',\n 'quit',\n ];\n\n if (currentEnvironment)\n availableCommands.push('login', 'list projects', 'set project');\n if (userId)\n availableCommands.push(\n 'get block',\n 'get block logs',\n 'get contenttype',\n 'get component',\n 'get entries',\n 'import contenttypes',\n 'import components',\n 'import entries',\n 'list blocks',\n 'list contenttypes',\n 'list components',\n 'list models',\n 'list keys',\n 'list webhooks',\n 'create key',\n 'push block',\n 'release block',\n 'remove key',\n 'remove entry',\n 'remove contenttypes',\n 'remove components'\n );\n\n const prompt = inquirer.createPromptModule();\n prompt.registerPrompt('command', inquirerPrompt);\n return prompt([\n {\n type: 'command',\n name: 'cmd',\n autoCompletion: availableCommands,\n autocompletePrompt: log.infoText(messages.app.autocomplete()),\n message: `${userId ? `${userId}@` : ''}${currentEnvironment || ''}>`,\n context: 0,\n validate: (val: string) => {\n if (!val) this.emptyInputCounter++;\n if (this.emptyInputCounter > 1)\n console.log(this.log.infoText(this.messages.app.suggestions()));\n if (val) {\n this.emptyInputCounter = 0;\n return true;\n }\n },\n prefix: `${env?.currentProject || log.infoText('contensis')}`,\n short: true,\n },\n ])\n .then(async (answers: { cmd: string }) => {\n if (answers.cmd === 'quit') {\n this.quit();\n } else {\n try {\n if (answers.cmd) {\n const program = commands();\n await program.parseAsync(\n answers.cmd\n .match(/\"[^\"]+\"|[^\\s]+/g)\n ?.map(e => e.replace(/\"(.+)\"/, '$1')),\n {\n from: 'user',\n }\n );\n }\n } catch (ex: any) {\n const str = ex.toString();\n if (!str.includes('CommanderError'))\n logError(ex, `Shell ${ex.toString()}`);\n } finally {\n return this.contensisPrompt();\n }\n }\n })\n .catch((err: Error) => {\n log.error(err.message);\n this.quit();\n });\n };\n\n quit = (error?: Error) => {\n const { log, messages } = this;\n process.removeAllListeners('exit');\n\n if (error) {\n log.error(error.message);\n process.exit(1);\n } else {\n log.success(messages.app.quit());\n process.exitCode = 0;\n process.exit(0);\n }\n };\n}\n\nlet globalShell: ContensisShell;\n\nexport const shell = () => {\n // Return a benign function for shell().restart() when used in cli context\n // as some commands need to restart the shell to show an updated prompt\n // after successful connect / login / set project\n if (typeof process.argv?.[2] !== 'undefined') return { restart() {} } as any;\n if (!globalShell) globalShell = new ContensisShell();\n return globalShell;\n};\n\nprocess.on('uncaughtException', function (err) {\n // Handle the error safely\n console.log(err);\n});\n\nprocess.on('SIGINT', () => {\n console.log('catching SIGINT');\n shell().quit();\n});\n\nprocess.on('SIGTERM', () => {\n console.log('catching SIGTERM');\n shell().quit();\n});\n\nprocess.stdin.on('data', key => {\n if ((key as any) == '\\u0003') {\n console.log('');\n Logger.info(`[CTRL]+[C] detected, exiting shell...`);\n shell().quit();\n }\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,oBAAmB;AACnB,sBAAqB;AACrB,qCAA2B;AAC3B,sBAAqB;AACrB,mBAA4B;AAC5B,oBAAiC;AACjC,gCAA+B;AAC/B,iCAAyC;AACzC,kBAAwB;AAExB,MAAM,eAAe;AAAA,EACX;AAAA,EACA,oBAA4B;AAAA,EAC5B;AAAA,EACA,aAAa;AAAA,EACb,SAAiB;AAAA,EACjB,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,qBAAqB,MAAM;AAEjC,UAAM;AAAA,MACJ,OAAO,EAAE,qBAAqB,IAAI,eAAe,CAAC,EAAE;AAAA,IACtD,IAAI,IAAI,2BAAAA,QAAa,CAAC,CAAC;AAEvB,SAAK,qBAAqB;AAC1B,SAAK,MAAM,aAAa;AAGxB,6BAAQ,OAAO,EAAE,KAAK,CAAC,EAAE,UAAU,IAAI,MAAM;AAC3C,WAAK,MAAM;AACX,WAAK,WAAW;AAAA,IAClB,CA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W,+BAAAJ,OAAc;AAC/C,WAAO,OAAO;AAAA,MACZ;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,gBAAgB;AAAA,QAChB,oBAAoB,IAAI,SAAS,SAAS,IAAI,aAAa,CAAC;AAAA,QAC5D,SAAS,GAAG,SAAS,GAAG,YAAY,KAAK,sBAAsB;AAAA,QAC/D,SAAS;AAAA,QACT,UAAU,CAAC,QAAgB;AACzB,cAAI,CAAC;AAAK,iBAAK;AACf,cAAI,KAAK,oBAAoB;AAC3B,oBAAQ,IAAI,KAAK,IAAI,SAAS,KAAK,SAAS,IAAI,YAAY,CAAC,CAAC;AAChE,cAAI,KAAK;AACP,iBAAK,oBAAoB;AACzB,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,QACA,QAAQ,IAAG,2BAAK,mBAAkB,IAAI,SAAS,WAAW;AAAA,QAC1D,OAAO;AAAA,MACT;AAAA,IACF,CAAC,EACE,KAAK,OAAO,YAA6B;
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport figlet from 'figlet';\nimport inquirer from 'inquirer';\nimport inquirerPrompt from 'inquirer-command-prompt';\nimport commands from './commands';\nimport { LogMessages } from './localisation/en-GB';\nimport { logError, Logger } from './util/logger';\nimport CredentialProvider from './providers/CredentialProvider';\nimport ContensisCli, { cliCommand } from './services/ContensisCliService';\nimport { Logging } from './util';\n\nclass ContensisShell {\n private currentEnvironment!: string;\n private emptyInputCounter: number = 0;\n private env!: EnvironmentCache;\n private firstStart = true;\n private userId: string = '';\n private log = Logger;\n private messages = LogMessages;\n\n private refreshEnvironment = () => {\n // Reload any persisted changes from the disk cache\n const {\n cache: { currentEnvironment = '', environments = {} },\n } = new ContensisCli([]);\n // console.log(`refreshing env w/${currentEnvironment}`);\n this.currentEnvironment = currentEnvironment;\n this.env = environments[currentEnvironment];\n\n // Reload logging here to support changing language\n Logging('en-GB').then(({ messages, Log }) => {\n this.log = Log;\n this.messages = messages;\n });\n };\n\n constructor() {\n this.refreshEnvironment();\n inquirerPrompt.setConfig({\n history: {\n save: true,\n folder: path.join(process.cwd(), '../'),\n limit: 100,\n blacklist: ['quit'],\n },\n });\n // inquirer.registerPrompt('command', inquirerPrompt);\n\n const { log, messages } = this;\n\n figlet.text(\n messages.app.contensis(),\n {\n font: 'Block',\n horizontalLayout: 'default',\n verticalLayout: 'default',\n width: process.stdout.columns,\n whitespaceBreak: true,\n },\n (err, data) => {\n if (err) {\n log.error(messages.app.unknownError());\n console.dir(err);\n return;\n }\n console.log(log.successText(data));\n console.log(log.infoText(messages.app.startup()));\n console.log(log.helpText(messages.app.help()));\n\n this.start().catch(ex => log.error(ex));\n }\n );\n }\n\n restart = async () => {\n this.firstStart = false;\n this.log.line(); // add a line so we can see where the shell has been restarted\n await this.start();\n };\n\n start = async () => {\n this.refreshEnvironment();\n this.userId = '';\n const { currentEnvironment, env, log, messages } = this;\n\n if (env?.lastUserId) {\n const [credsErr, credentials] = await new CredentialProvider(\n {\n userId: env.lastUserId,\n alias: currentEnvironment,\n },\n env.passwordFallback\n ).Init();\n if (credsErr && !credentials.current) {\n log.error(credsErr.message);\n }\n if (credentials.current) {\n if (this.firstStart) {\n const token = await cliCommand(['login', env.lastUserId]).Login(\n env.lastUserId,\n {\n promptPassword: false,\n silent: true,\n }\n );\n if (token) {\n this.userId = env.lastUserId;\n if (!env.currentProject) log.warning(messages.projects.tip());\n }\n this.firstStart = false;\n this.refreshEnvironment();\n } else {\n this.userId = env.lastUserId;\n }\n }\n }\n await this.contensisPrompt();\n };\n\n contensisPrompt = async (): Promise<any> => {\n const { currentEnvironment, env, log, messages, userId } = this;\n\n const availableCommands = [\n {\n filter: (str: string) => {\n return str.replace(/ \\[.*$/, '');\n },\n },\n 'connect',\n 'list envs',\n 'quit',\n ];\n\n if (currentEnvironment)\n availableCommands.push('login', 'list projects', 'set project');\n if (userId)\n availableCommands.push(\n 'get block',\n 'get block logs',\n 'get contenttype',\n 'get component',\n 'get entries',\n 'get version',\n 'import contenttypes',\n 'import components',\n 'import entries',\n 'list blocks',\n 'list contenttypes',\n 'list components',\n 'list models',\n 'list keys',\n 'list webhooks',\n 'create key',\n 'push block',\n 'release block',\n 'remove key',\n 'remove entry',\n 'remove contenttypes',\n 'remove components'\n );\n\n const prompt = inquirer.createPromptModule();\n prompt.registerPrompt('command', inquirerPrompt);\n return prompt([\n {\n type: 'command',\n name: 'cmd',\n autoCompletion: availableCommands,\n autocompletePrompt: log.infoText(messages.app.autocomplete()),\n message: `${userId ? `${userId}@` : ''}${currentEnvironment || ''}>`,\n context: 0,\n validate: (val: string) => {\n if (!val) this.emptyInputCounter++;\n if (this.emptyInputCounter > 1)\n console.log(this.log.infoText(this.messages.app.suggestions()));\n if (val) {\n this.emptyInputCounter = 0;\n return true;\n }\n },\n prefix: `${env?.currentProject || log.infoText('contensis')}`,\n short: true,\n },\n ])\n .then(async (answers: { cmd: string }) => {\n if (answers.cmd === 'quit') {\n this.quit();\n } else {\n try {\n if (answers.cmd) {\n const program = commands();\n await program.parseAsync(\n answers.cmd\n .match(/\"[^\"]+\"|[^\\s]+/g)\n ?.map(e => e.replace(/\"(.+)\"/, '$1')),\n {\n from: 'user',\n }\n );\n }\n } catch (ex: any) {\n const str = ex.toString();\n if (!str.includes('CommanderError'))\n logError(ex, `Shell ${ex.toString()}`);\n } finally {\n return this.contensisPrompt();\n }\n }\n })\n .catch((err: Error) => {\n log.error(err.message);\n this.quit();\n });\n };\n\n quit = (error?: Error) => {\n const { log, messages } = this;\n process.removeAllListeners('exit');\n\n if (error) {\n log.error(error.message);\n process.exit(1);\n } else {\n log.success(messages.app.quit());\n process.exitCode = 0;\n process.exit(0);\n }\n };\n}\n\nlet globalShell: ContensisShell;\n\nexport const shell = () => {\n // Return a benign function for shell().restart() when used in cli context\n // as some commands need to restart the shell to show an updated prompt\n // after successful connect / login / set project\n if (typeof process.argv?.[2] !== 'undefined') return { restart() {} } as any;\n if (!globalShell) globalShell = new ContensisShell();\n return globalShell;\n};\n\nprocess.on('uncaughtException', function (err) {\n // Handle the error safely\n console.log(err);\n});\n\nprocess.on('SIGINT', () => {\n console.log('catching SIGINT');\n shell().quit();\n});\n\nprocess.on('SIGTERM', () => {\n console.log('catching SIGTERM');\n shell().quit();\n});\n\nprocess.stdin.on('data', key => {\n if ((key as any) == '\\u0003') {\n console.log('');\n Logger.info(`[CTRL]+[C] detected, exiting shell...`);\n shell().quit();\n }\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,oBAAmB;AACnB,sBAAqB;AACrB,qCAA2B;AAC3B,sBAAqB;AACrB,mBAA4B;AAC5B,oBAAiC;AACjC,gCAA+B;AAC/B,iCAAyC;AACzC,kBAAwB;AAExB,MAAM,eAAe;AAAA,EACX;AAAA,EACA,oBAA4B;AAAA,EAC5B;AAAA,EACA,aAAa;AAAA,EACb,SAAiB;AAAA,EACjB,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,qBAAqB,MAAM;AAEjC,UAAM;AAAA,MACJ,OAAO,EAAE,qBAAqB,IAAI,eAAe,CAAC,EAAE;AAAA,IACtD,IAAI,IAAI,2BAAAA,QAAa,CAAC,CAAC;AAEvB,SAAK,qBAAqB;AAC1B,SAAK,MAAM,aAAa;AAGxB,6BAAQ,OAAO,EAAE,KAAK,CAAC,EAAE,UAAU,IAAI,MAAM;AAC3C,WAAK,MAAM;AACX,WAAK,WAAW;AAAA,IAClB,CAAC;AAAA,EACH;AAAA,EAEA,cAAc;AACZ,SAAK,mBAAmB;AACxB,mCAAAC,QAAe,UAAU;AAAA,MACvB,SAAS;AAAA,QACP,MAAM;AAAA,QACN,QAAQ,YAAAC,QAAK,KAAK,QAAQ,IAAI,GAAG,KAAK;AAAA,QACtC,OAAO;AAAA,QACP,WAAW,CAAC,MAAM;AAAA,MACpB;AAAA,IACF,CAAC;AAGD,UAAM,EAAE,KAAK,SAAS,IAAI;AAE1B,kBAAAC,QAAO;AAA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,EACF;AACF;AAEA,IAAI;AAEG,MAAM,QAAQ,MAAM;AAxO3B;AA4OE,MAAI,SAAO,aAAQ,SAAR,mBAAe,QAAO;AAAa,WAAO,EAAE,UAAU;AAAA,IAAC,EAAE;AACpE,MAAI,CAAC;AAAa,kBAAc,IAAI,eAAe;AACnD,SAAO;AACT;AAEA,QAAQ,GAAG,qBAAqB,SAAU,KAAK;AAE7C,UAAQ,IAAI,GAAG;AACjB,CAAC;AAED,QAAQ,GAAG,UAAU,MAAM;AACzB,UAAQ,IAAI,iBAAiB;AAC7B,QAAM,EAAE,KAAK;AACf,CAAC;AAED,QAAQ,GAAG,WAAW,MAAM;AAC1B,UAAQ,IAAI,kBAAkB;AAC9B,QAAM,EAAE,KAAK;AACf,CAAC;AAED,QAAQ,MAAM,GAAG,QAAQ,SAAO;AAC9B,MAAK,OAAe,KAAU;AAC5B,YAAQ,IAAI,EAAE;AACd,yBAAO,KAAK,uCAAuC;AACnD,UAAM,EAAE,KAAK;AAAA,EACf;AACF,CAAC;",
|
|
6
6
|
"names": ["ContensisCli", "inquirerPrompt", "path", "figlet", "CredentialProvider", "inquirer", "commands"]
|
|
7
7
|
}
|
package/dist/version.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
LIB_VERSION: () => LIB_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const LIB_VERSION = "1.0.0-beta.
|
|
24
|
+
const LIB_VERSION = "1.0.0-beta.36";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIB_VERSION
|
package/dist/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.36\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.36",
|
|
4
4
|
"description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
|
|
5
5
|
"repository": "https://github.com/contensis/node-cli",
|
|
6
6
|
"homepage": "https://github.com/contensis/node-cli/tree/main/packages/contensis-cli#readme",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"jsonpath-mapper": "^1.1.0",
|
|
36
36
|
"keytar": "^7.9.0",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
|
-
"migratortron": "^1.0.0-beta.
|
|
38
|
+
"migratortron": "^1.0.0-beta.16",
|
|
39
39
|
"node-fetch": "^2.6.7",
|
|
40
40
|
"patch-package": "^6.4.7",
|
|
41
41
|
"xml2js": "^0.4.23"
|
package/src/commands/get.ts
CHANGED
|
@@ -8,6 +8,20 @@ export const makeGetCommand = () => {
|
|
|
8
8
|
.showHelpAfterError(true)
|
|
9
9
|
.exitOverride();
|
|
10
10
|
|
|
11
|
+
program
|
|
12
|
+
.command('version')
|
|
13
|
+
.description('Get current Contensis version')
|
|
14
|
+
.addHelpText(
|
|
15
|
+
'after',
|
|
16
|
+
`
|
|
17
|
+
Example call:
|
|
18
|
+
> version
|
|
19
|
+
`
|
|
20
|
+
)
|
|
21
|
+
.action(async opts => {
|
|
22
|
+
await cliCommand(['get', 'version'], opts).PrintContensisVersion();
|
|
23
|
+
});
|
|
24
|
+
|
|
11
25
|
program
|
|
12
26
|
.command('contenttype')
|
|
13
27
|
.argument('<contentTypeId>', 'the API id of the content type to get')
|
|
@@ -229,44 +229,47 @@ class ContensisCli {
|
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
ConnectContensis = async ({ commit = false } = {}) => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
if (!this.contensis) {
|
|
233
|
+
const { contensisOpts, currentEnv, env, log, messages } = this;
|
|
234
|
+
const userId = env?.lastUserId;
|
|
235
|
+
const isGuidId = userId && isUuid(userId);
|
|
236
|
+
|
|
237
|
+
if (currentEnv && userId) {
|
|
238
|
+
const credentials = await this.GetCredentials(
|
|
239
|
+
userId,
|
|
240
|
+
env.passwordFallback
|
|
241
|
+
);
|
|
235
242
|
|
|
236
|
-
|
|
237
|
-
const credentials = await this.GetCredentials(
|
|
238
|
-
userId,
|
|
239
|
-
env.passwordFallback
|
|
240
|
-
);
|
|
243
|
+
const cachedPassword = credentials?.current?.password;
|
|
241
244
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
245
|
+
if (cachedPassword) {
|
|
246
|
+
this.contensis = new ContensisMigrationService(
|
|
247
|
+
{
|
|
248
|
+
...contensisOpts,
|
|
249
|
+
source: {
|
|
250
|
+
url: this.urls?.cms || '',
|
|
251
|
+
username: !isGuidId ? userId : undefined,
|
|
252
|
+
password: !isGuidId ? cachedPassword : undefined,
|
|
253
|
+
clientId: isGuidId ? userId : undefined,
|
|
254
|
+
sharedSecret: isGuidId ? cachedPassword : undefined,
|
|
255
|
+
project: env?.currentProject || '',
|
|
256
|
+
assetHostname: this.urls?.previewWeb,
|
|
257
|
+
},
|
|
258
|
+
concurrency:
|
|
259
|
+
typeof contensisOpts.concurrency !== 'undefined'
|
|
260
|
+
? contensisOpts.concurrency
|
|
261
|
+
: 3,
|
|
262
|
+
outputProgress: true,
|
|
256
263
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
!commit
|
|
264
|
-
);
|
|
264
|
+
!commit
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
if (!currentEnv) log.help(messages.connect.help());
|
|
269
|
+
if (!userId) log.help(messages.connect.tip());
|
|
265
270
|
}
|
|
266
|
-
} else {
|
|
267
|
-
if (!currentEnv) log.help(messages.connect.help());
|
|
268
|
-
if (!userId) log.help(messages.connect.tip());
|
|
269
271
|
}
|
|
272
|
+
return this.contensis;
|
|
270
273
|
};
|
|
271
274
|
|
|
272
275
|
ConnectContensisImport = async ({
|
|
@@ -517,14 +520,38 @@ class ContensisCli {
|
|
|
517
520
|
}
|
|
518
521
|
};
|
|
519
522
|
|
|
523
|
+
PrintContensisVersion = async () => {
|
|
524
|
+
const { log, messages } = this;
|
|
525
|
+
const contensis = await this.ConnectContensis();
|
|
526
|
+
|
|
527
|
+
if (contensis) {
|
|
528
|
+
// Retrieve projects list for env
|
|
529
|
+
const [projectsErr, projects] = await to(
|
|
530
|
+
contensis.projects.GetSourceProjects()
|
|
531
|
+
);
|
|
532
|
+
|
|
533
|
+
if (Array.isArray(projects)) {
|
|
534
|
+
// Print contensis version to console
|
|
535
|
+
this.HandleFormattingAndOutput(contensis.contensisVersion, () =>
|
|
536
|
+
log.raw(log.highlightText(contensis.contensisVersion))
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (projectsErr) {
|
|
541
|
+
log.error(messages.projects.noList());
|
|
542
|
+
log.error(projectsErr.message);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
520
547
|
PrintProjects = async () => {
|
|
521
548
|
const { currentProject, log, messages, session } = this;
|
|
522
|
-
|
|
549
|
+
const contensis = await this.ConnectContensis();
|
|
523
550
|
|
|
524
|
-
if (
|
|
551
|
+
if (contensis) {
|
|
525
552
|
// Retrieve projects list for env
|
|
526
553
|
const [projectsErr, projects] = await to(
|
|
527
|
-
|
|
554
|
+
contensis.projects.GetSourceProjects()
|
|
528
555
|
);
|
|
529
556
|
|
|
530
557
|
if (Array.isArray(projects)) {
|
|
@@ -610,12 +637,12 @@ class ContensisCli {
|
|
|
610
637
|
|
|
611
638
|
HydrateContensis = async () => {
|
|
612
639
|
const { log } = this;
|
|
613
|
-
|
|
640
|
+
const contensis = await this.ConnectContensis();
|
|
614
641
|
|
|
615
|
-
if (
|
|
642
|
+
if (contensis) {
|
|
616
643
|
// Retrieve content types list for env
|
|
617
644
|
const [contensisErr, models] = await to(
|
|
618
|
-
|
|
645
|
+
contensis.models.HydrateContensisRepositories()
|
|
619
646
|
);
|
|
620
647
|
|
|
621
648
|
if (contensisErr) {
|
|
@@ -627,11 +654,11 @@ class ContensisCli {
|
|
|
627
654
|
|
|
628
655
|
PrintApiKeys = async () => {
|
|
629
656
|
const { currentEnv, log, messages } = this;
|
|
630
|
-
|
|
657
|
+
const contensis = await this.ConnectContensis();
|
|
631
658
|
|
|
632
|
-
if (
|
|
659
|
+
if (contensis) {
|
|
633
660
|
// Retrieve keys list for env
|
|
634
|
-
const [keysErr, apiKeys] = await
|
|
661
|
+
const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();
|
|
635
662
|
|
|
636
663
|
if (Array.isArray(apiKeys)) {
|
|
637
664
|
log.success(messages.keys.list(currentEnv));
|
|
@@ -665,13 +692,10 @@ class ContensisCli {
|
|
|
665
692
|
|
|
666
693
|
CreateApiKey = async (name: string, description?: string) => {
|
|
667
694
|
const { currentEnv, log, messages } = this;
|
|
668
|
-
|
|
695
|
+
const contensis = await this.ConnectContensis();
|
|
669
696
|
|
|
670
|
-
if (
|
|
671
|
-
const [err, key] = await
|
|
672
|
-
name,
|
|
673
|
-
description
|
|
674
|
-
);
|
|
697
|
+
if (contensis) {
|
|
698
|
+
const [err, key] = await contensis.apiKeys.CreateKey(name, description);
|
|
675
699
|
|
|
676
700
|
if (key) {
|
|
677
701
|
log.success(messages.keys.created(currentEnv, name));
|
|
@@ -695,10 +719,10 @@ class ContensisCli {
|
|
|
695
719
|
|
|
696
720
|
RemoveApiKey = async (id: string) => {
|
|
697
721
|
const { currentEnv, log, messages } = this;
|
|
698
|
-
|
|
722
|
+
const contensis = await this.ConnectContensis({ commit: true });
|
|
699
723
|
|
|
700
|
-
if (
|
|
701
|
-
const [err, key] = await
|
|
724
|
+
if (contensis) {
|
|
725
|
+
const [err, key] = await contensis.apiKeys.RemoveKey(id);
|
|
702
726
|
|
|
703
727
|
if (!err) {
|
|
704
728
|
log.success(messages.keys.removed(currentEnv, id));
|
|
@@ -1103,11 +1127,11 @@ class ContensisCli {
|
|
|
1103
1127
|
name?: string
|
|
1104
1128
|
) => {
|
|
1105
1129
|
const { currentEnv, log, messages } = this;
|
|
1106
|
-
|
|
1107
|
-
if (
|
|
1130
|
+
const contensis = await this.ConnectContensis();
|
|
1131
|
+
if (contensis) {
|
|
1108
1132
|
// Retrieve webhooks list for env
|
|
1109
1133
|
const [webhooksErr, webhooks] =
|
|
1110
|
-
await
|
|
1134
|
+
await contensis.subscriptions.webhooks.GetSubscriptions();
|
|
1111
1135
|
|
|
1112
1136
|
const filteredResults =
|
|
1113
1137
|
typeof name === 'string'
|
|
@@ -1153,10 +1177,10 @@ class ContensisCli {
|
|
|
1153
1177
|
|
|
1154
1178
|
PrintBlocks = async () => {
|
|
1155
1179
|
const { currentEnv, env, log, messages } = this;
|
|
1156
|
-
|
|
1157
|
-
if (
|
|
1180
|
+
const contensis = await this.ConnectContensis();
|
|
1181
|
+
if (contensis) {
|
|
1158
1182
|
// Retrieve blocks list for env
|
|
1159
|
-
const [err, blocks] = await
|
|
1183
|
+
const [err, blocks] = await contensis.blocks.GetBlocks();
|
|
1160
1184
|
|
|
1161
1185
|
if (Array.isArray(blocks)) {
|
|
1162
1186
|
this.HandleFormattingAndOutput(blocks, () => {
|
|
@@ -1202,10 +1226,10 @@ class ContensisCli {
|
|
|
1202
1226
|
version: string
|
|
1203
1227
|
) => {
|
|
1204
1228
|
const { currentEnv, env, log, messages } = this;
|
|
1205
|
-
|
|
1206
|
-
if (
|
|
1229
|
+
const contensis = await this.ConnectContensis();
|
|
1230
|
+
if (contensis) {
|
|
1207
1231
|
// Retrieve block version
|
|
1208
|
-
const [err, blocks] = await
|
|
1232
|
+
const [err, blocks] = await contensis.blocks.GetBlockVersions(
|
|
1209
1233
|
blockId,
|
|
1210
1234
|
branch,
|
|
1211
1235
|
version
|
|
@@ -1254,10 +1278,10 @@ class ContensisCli {
|
|
|
1254
1278
|
);
|
|
1255
1279
|
console.log(jsonFormatter(block));
|
|
1256
1280
|
|
|
1257
|
-
|
|
1258
|
-
if (
|
|
1281
|
+
const contensis = await this.ConnectContensis();
|
|
1282
|
+
if (contensis) {
|
|
1259
1283
|
// Push new block version
|
|
1260
|
-
const [err, blockVersion] = await
|
|
1284
|
+
const [err, blockVersion] = await contensis.blocks.PushBlockVersion(
|
|
1261
1285
|
block
|
|
1262
1286
|
);
|
|
1263
1287
|
if (!err) {
|
|
@@ -1285,10 +1309,10 @@ class ContensisCli {
|
|
|
1285
1309
|
|
|
1286
1310
|
ReleaseBlock = async (blockId: string, version: string) => {
|
|
1287
1311
|
const { currentEnv, env, log, messages } = this;
|
|
1288
|
-
|
|
1289
|
-
if (
|
|
1312
|
+
const contensis = await this.ConnectContensis();
|
|
1313
|
+
if (contensis) {
|
|
1290
1314
|
// Retrieve block version
|
|
1291
|
-
const [err, blockVersion] = await
|
|
1315
|
+
const [err, blockVersion] = await contensis.blocks.BlockAction(
|
|
1292
1316
|
blockId,
|
|
1293
1317
|
'release',
|
|
1294
1318
|
version
|
|
@@ -1320,14 +1344,14 @@ class ContensisCli {
|
|
|
1320
1344
|
dataCenter: 'hq' | 'manchester' | 'london'
|
|
1321
1345
|
) => {
|
|
1322
1346
|
const { currentEnv, env, log, messages } = this;
|
|
1323
|
-
|
|
1324
|
-
if (
|
|
1347
|
+
const contensis = await this.ConnectContensis();
|
|
1348
|
+
if (contensis) {
|
|
1325
1349
|
// Retrieve block logs
|
|
1326
1350
|
log.success(
|
|
1327
1351
|
messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)
|
|
1328
1352
|
);
|
|
1329
1353
|
|
|
1330
|
-
const [err, blockLogs] = await
|
|
1354
|
+
const [err, blockLogs] = await contensis.blocks.GetBlockLogs({
|
|
1331
1355
|
blockId,
|
|
1332
1356
|
branchId: branch,
|
|
1333
1357
|
version,
|
package/src/shell.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.0-beta.
|
|
1
|
+
export const LIB_VERSION = "1.0.0-beta.36";
|