contensis-cli 1.0.0-beta.17 → 1.0.0-beta.19
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/index.js +4 -0
- package/dist/commands/index.js.map +2 -2
- package/dist/commands/push.js +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/release.js +46 -0
- package/dist/commands/release.js.map +7 -0
- package/dist/localisation/en-GB.js +5 -1
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/providers/CredentialProvider.js +28 -4
- package/dist/providers/CredentialProvider.js.map +3 -3
- package/dist/services/ContensisCliService.js +36 -6
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/shell.js +2 -1
- 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/index.ts +4 -0
- package/src/commands/push.ts +1 -1
- package/src/commands/release.ts +29 -0
- package/src/localisation/en-GB.ts +10 -1
- package/src/providers/CredentialProvider.ts +29 -3
- package/src/services/ContensisCliService.ts +42 -7
- package/src/shell.ts +2 -1
- package/src/version.ts +1 -1
package/dist/commands/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var import_import = require("./import");
|
|
|
32
32
|
var import_list = require("./list");
|
|
33
33
|
var import_login = require("./login");
|
|
34
34
|
var import_push = require("./push");
|
|
35
|
+
var import_release = require("./release");
|
|
35
36
|
var import_remove = require("./remove");
|
|
36
37
|
var import_set = require("./set");
|
|
37
38
|
const commands = () => {
|
|
@@ -67,6 +68,9 @@ const commands = () => {
|
|
|
67
68
|
program.addCommand(
|
|
68
69
|
(0, import_globalOptions.addGlobalOptions)((0, import_push.makePushCommand)()).copyInheritedSettings(program)
|
|
69
70
|
);
|
|
71
|
+
program.addCommand(
|
|
72
|
+
(0, import_globalOptions.addGlobalOptions)((0, import_release.makeReleaseCommand)()).copyInheritedSettings(program)
|
|
73
|
+
);
|
|
70
74
|
program.addCommand(
|
|
71
75
|
(0, import_globalOptions.addGlobalOptions)((0, import_remove.makeRemoveCommand)()).copyInheritedSettings(program)
|
|
72
76
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCreateCommand } from './create';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\n addGetEntryOptions,\n addGlobalOptions,\n addImportOptions,\n} from './globalOptions';\nimport { makeImportCommand } from './import';\nimport { makeListCommand } from './list';\nimport { makeLoginCommand } from './login';\nimport { makePushCommand } from './push';\nimport { makeRemoveCommand } from './remove';\nimport { makeSetCommand } from './set';\n\nconst commands = () => {\n const program = new Command()\n .name('contensis')\n .version(LIB_VERSION)\n .configureOutput({\n writeErr: str => {\n return str.toLowerCase().includes('error')\n ? Logger.error(`Command ${str}`)\n : str.trim() && Logger.help(str);\n },\n })\n .exitOverride()\n .showHelpAfterError(true);\n\n program.addCommand(\n addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(\n addImportOptions(makeCreateCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(\n addGetEntryOptions(addImportOptions(makeImportCommand()))\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeListCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeLoginCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makePushCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeSetCommand()).copyInheritedSettings(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;AAAA,QACN,2CAAiB,iCAAkB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,4CAAkB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AAEA,SAAO;AACT;AAEA,IAAO,mBAAQ;",
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCreateCommand } from './create';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\n addGetEntryOptions,\n addGlobalOptions,\n addImportOptions,\n} from './globalOptions';\nimport { makeImportCommand } from './import';\nimport { makeListCommand } from './list';\nimport { makeLoginCommand } from './login';\nimport { makePushCommand } from './push';\nimport { makeReleaseCommand } from './release';\nimport { makeRemoveCommand } from './remove';\nimport { makeSetCommand } from './set';\n\nconst commands = () => {\n const program = new Command()\n .name('contensis')\n .version(LIB_VERSION)\n .configureOutput({\n writeErr: str => {\n return str.toLowerCase().includes('error')\n ? Logger.error(`Command ${str}`)\n : str.trim() && Logger.help(str);\n },\n })\n .exitOverride()\n .showHelpAfterError(true);\n\n program.addCommand(\n addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(\n addImportOptions(makeCreateCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(\n addGetEntryOptions(addImportOptions(makeImportCommand()))\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeListCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeLoginCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makePushCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeReleaseCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeSetCommand()).copyInheritedSettings(program)\n );\n\n return program;\n};\n\nexport default commands;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,oBAAuB;AACvB,qBAA4B;AAC5B,qBAAmC;AACnC,oBAAkC;AAClC,iBAA+B;AAC/B,2BAMO;AACP,oBAAkC;AAClC,kBAAgC;AAChC,mBAAiC;AACjC,kBAAgC;AAChC,qBAAmC;AACnC,oBAAkC;AAClC,iBAA+B;AAE/B,MAAM,WAAW,MAAM;AACrB,QAAM,UAAU,IAAI,yBAAQ,EACzB,KAAK,WAAW,EAChB,QAAQ,0BAAW,EACnB,gBAAgB;AAAA,IACf,UAAU,SAAO;AACf,aAAO,IAAI,YAAY,EAAE,SAAS,OAAO,IACrC,qBAAO,MAAM,WAAW,KAAK,IAC7B,IAAI,KAAK,KAAK,qBAAO,KAAK,GAAG;AAAA,IACnC;AAAA,EACF,CAAC,EACA,aAAa,EACb,mBAAmB,IAAI;AAE1B,UAAQ;AAAA,QACN,mDAAyB,mCAAmB,CAAC,EAAE;AAAA,MAC7C;AAAA,IACF;AAAA,EACF;AACA,UAAQ;AAAA,QACN;AAAA,UACE,2CAAiB,iCAAkB,CAAC;AAAA,IACtC,EAAE,sBAAsB,OAAO;AAAA,EACjC;AACA,UAAQ;AAAA,QACN,2CAAiB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAClE;AACA,UAAQ;AAAA,QACN;AAAA,UACE,6CAAmB,2CAAiB,iCAAkB,CAAC,CAAC;AAAA,IAC1D,EAAE,sBAAsB,OAAO;AAAA,EACjC;AACA,UAAQ;AAAA,QACN,2CAAiB,6BAAgB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AACA,UAAQ;AAAA,QACN,4CAAkB,+BAAiB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,2CAAiB,6BAAgB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AACA,UAAQ;AAAA,QACN,2CAAiB,mCAAmB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACtE;AACA,UAAQ;AAAA,QACN,2CAAiB,iCAAkB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,4CAAkB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AAEA,SAAO;AACT;AAEA,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/push.js
CHANGED
|
@@ -64,7 +64,7 @@ const makePushCommand = () => {
|
|
|
64
64
|
"after",
|
|
65
65
|
`
|
|
66
66
|
Example call:
|
|
67
|
-
> push block contensis-app ghcr.io/contensis/contensis-app/build-4359 master --release
|
|
67
|
+
> push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release
|
|
68
68
|
`
|
|
69
69
|
).action(async (blockId, imageUri, branch, opts) => {
|
|
70
70
|
const cli = (0, import_ContensisCliService.cliCommand)(["push", "block", blockId], opts);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/push.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport mapJson from 'jsonpath-mapper';\nimport { PushBlockParams } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\n\nexport const makePushCommand = () => {\n const push = new Command()\n .command('push')\n .showHelpAfterError(true)\n .exitOverride();\n\n push\n .command('block')\n .argument('<block-id>', 'the name of the block to push to')\n .argument(\n '<image uri:tag>',\n 'the uri and tag of the container image to push as a block (tag default: latest)'\n )\n .argument('[branch]', 'the branch we are pushing to')\n .option(\n '-r, --release',\n 'whether to release the pushed block version',\n false\n )\n .option(\n '-cid, --commit-id <commitId>',\n 'the id of the source git commit for the supplied image uri'\n )\n .option(\n '-cmsg, --commit-message <commitMessage>',\n 'the git commit message for the supplied commit id'\n )\n .option(\n '-cdt, --commit-datetime <commitDateTime>',\n 'the timestamp of the source git commit for the supplied image uri'\n )\n .option(\n '-author, --author-email <authorEmail>',\n 'the git email address of the author of the source git commit'\n )\n .option(\n '-committer, --committer-email <committerEmail>',\n 'the git email address of the commiter of the source git commit'\n )\n .option(\n '-repo, --repository-url <repositoryUrl>',\n 'the url of the source repository for the supplied image uri'\n )\n .option(\n '-pr, --provider <sourceProvider>',\n 'the url of the source repository for the supplied image uri'\n )\n .usage('<block-id> <image uri> [branch] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push block contensis-app ghcr.io/contensis/contensis-app/build-4359 master --release\\n`\n )\n .action(async (blockId: string, imageUri: string, branch: string, opts) => {\n const cli = cliCommand(['push', 'block', blockId], opts);\n const mapSourceVars = {\n blockId,\n imageUri,\n branch,\n ...opts,\n ...process.env,\n };\n\n const blockRequest = mapJson(mapSourceVars, {\n autoRelease: { $path: 'release', $default: () => false },\n id: ['blockId'],\n image: () => {\n const lastIndexOfColon = imageUri.lastIndexOf(':');\n return {\n uri: imageUri.slice(0, lastIndexOfColon),\n tag: imageUri.slice(lastIndexOfColon + 1) || 'latest',\n };\n },\n projectId: () => cli.env.currentProject || '',\n source: {\n provider: {\n $path: ['provider'],\n $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {\n if (provider) return provider;\n if (GITHUB_ACTIONS) return 'Github';\n else if (GITLAB_CI) return 'GitlabSelfHosted';\n },\n },\n repositoryUrl: {\n $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],\n $formatting: (url: string, { GITHUB_ACTIONS }) => {\n if (GITHUB_ACTIONS) url = `https://github.com/${url}`;\n\n if (url && !url.endsWith('.git')) return `${url}.git`;\n return url;\n },\n },\n branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],\n commit: {\n id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],\n message: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}\n dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}\n authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}\n committerEmail: [\n 'committerEmail',\n 'GITLAB_USER_EMAIL',\n 'GITHUB_TRIGGERING_ACTOR',\n ], // ${{ github.event.head_commit.committer.email }}\n },\n },\n }) as PushBlockParams;\n\n await cli.PushBlock(blockRequest);\n\n // console.log(process.env);\n });\n\n return push;\n};\n"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport mapJson from 'jsonpath-mapper';\nimport { PushBlockParams } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\n\nexport const makePushCommand = () => {\n const push = new Command()\n .command('push')\n .showHelpAfterError(true)\n .exitOverride();\n\n push\n .command('block')\n .argument('<block-id>', 'the name of the block to push to')\n .argument(\n '<image uri:tag>',\n 'the uri and tag of the container image to push as a block (tag default: latest)'\n )\n .argument('[branch]', 'the branch we are pushing to')\n .option(\n '-r, --release',\n 'whether to release the pushed block version',\n false\n )\n .option(\n '-cid, --commit-id <commitId>',\n 'the id of the source git commit for the supplied image uri'\n )\n .option(\n '-cmsg, --commit-message <commitMessage>',\n 'the git commit message for the supplied commit id'\n )\n .option(\n '-cdt, --commit-datetime <commitDateTime>',\n 'the timestamp of the source git commit for the supplied image uri'\n )\n .option(\n '-author, --author-email <authorEmail>',\n 'the git email address of the author of the source git commit'\n )\n .option(\n '-committer, --committer-email <committerEmail>',\n 'the git email address of the commiter of the source git commit'\n )\n .option(\n '-repo, --repository-url <repositoryUrl>',\n 'the url of the source repository for the supplied image uri'\n )\n .option(\n '-pr, --provider <sourceProvider>',\n 'the url of the source repository for the supplied image uri'\n )\n .usage('<block-id> <image uri> [branch] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\\n`\n )\n .action(async (blockId: string, imageUri: string, branch: string, opts) => {\n const cli = cliCommand(['push', 'block', blockId], opts);\n const mapSourceVars = {\n blockId,\n imageUri,\n branch,\n ...opts,\n ...process.env,\n };\n\n const blockRequest = mapJson(mapSourceVars, {\n autoRelease: { $path: 'release', $default: () => false },\n id: ['blockId'],\n image: () => {\n const lastIndexOfColon = imageUri.lastIndexOf(':');\n return {\n uri: imageUri.slice(0, lastIndexOfColon),\n tag: imageUri.slice(lastIndexOfColon + 1) || 'latest',\n };\n },\n projectId: () => cli.env.currentProject || '',\n source: {\n provider: {\n $path: ['provider'],\n $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {\n if (provider) return provider;\n if (GITHUB_ACTIONS) return 'Github';\n else if (GITLAB_CI) return 'GitlabSelfHosted';\n },\n },\n repositoryUrl: {\n $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],\n $formatting: (url: string, { GITHUB_ACTIONS }) => {\n if (GITHUB_ACTIONS) url = `https://github.com/${url}`;\n\n if (url && !url.endsWith('.git')) return `${url}.git`;\n return url;\n },\n },\n branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],\n commit: {\n id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],\n message: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}\n dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}\n authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}\n committerEmail: [\n 'committerEmail',\n 'GITLAB_USER_EMAIL',\n 'GITHUB_TRIGGERING_ACTOR',\n ], // ${{ github.event.head_commit.committer.email }}\n },\n },\n }) as PushBlockParams;\n\n await cli.PushBlock(blockRequest);\n\n //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,KAAK,SAAS,MAAM,mBAAmB,CAAC,KAAK;AAAA,QAC/C;AAAA,MACF;AAAA,MACA,WAAW,MAAM,IAAI,IAAI,kBAAkB;AAAA,MAC3C,QAAQ;AAAA,QACN,UAAU;AAAA,UACR,OAAO,CAAC,UAAU;AAAA,UAClB,SAAS,CAAC,UAAkB,EAAE,gBAAgB,UAAU,MAAM;AAC5D,gBAAI;AAAU,qBAAO;AACrB,gBAAI;AAAgB,qBAAO;AAAA,qBAClB;AAAW,qBAAO;AAAA,UAC7B;AAAA,QACF;AAAA,QACA,eAAe;AAAA,UACb,OAAO,CAAC,iBAAiB,kBAAkB,mBAAmB;AAAA,UAC9D,aAAa,CAAC,KAAa,EAAE,eAAe,MAAM;AAChD,gBAAI;AAAgB,oBAAM,sBAAsB;AAEhD,gBAAI,OAAO,CAAC,IAAI,SAAS,MAAM;AAAG,qBAAO,GAAG;AAC5C,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,QACA,QAAQ,CAAC,UAAU,sBAAsB,iBAAiB;AAAA,QAC1D,QAAQ;AAAA,UACN,IAAI,CAAC,YAAY,uBAAuB,YAAY;AAAA,UACpD,SAAS,CAAC,iBAAiB,mBAAmB;AAAA,UAC9C,UAAU,CAAC,kBAAkB,qBAAqB;AAAA,UAClD,aAAa,CAAC,eAAe,qBAAqB,cAAc;AAAA,UAChE,gBAAgB;AAAA,YACd;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,IAAI,UAAU,YAAY;AAAA,EAGlC,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": ["mapJson"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var release_exports = {};
|
|
20
|
+
__export(release_exports, {
|
|
21
|
+
makeReleaseCommand: () => makeReleaseCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(release_exports);
|
|
24
|
+
var import_commander = require("commander");
|
|
25
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
+
const makeReleaseCommand = () => {
|
|
27
|
+
const release = new import_commander.Command().command("release").showHelpAfterError(true).exitOverride();
|
|
28
|
+
release.command("block").argument("<block-id>", "the name of the block to release").argument("<version>", "the block version to release").usage("<block-id> <version>").addHelpText(
|
|
29
|
+
"after",
|
|
30
|
+
`
|
|
31
|
+
Example call:
|
|
32
|
+
> release block contensis-app 3
|
|
33
|
+
`
|
|
34
|
+
).action(async (blockId, version, opts) => {
|
|
35
|
+
await (0, import_ContensisCliService.cliCommand)(["release", "block", blockId], opts).ReleaseBlock(
|
|
36
|
+
blockId,
|
|
37
|
+
version
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
return release;
|
|
41
|
+
};
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
makeReleaseCommand
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=release.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/release.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\n\nexport const makeReleaseCommand = () => {\n const release = new Command()\n .command('release')\n .showHelpAfterError(true)\n .exitOverride();\n\n release\n .command('block')\n .argument('<block-id>', 'the name of the block to release')\n .argument('<version>', 'the block version to release')\n .usage('<block-id> <version>')\n .addHelpText(\n 'after',\n `\nExample call:\n > release block contensis-app 3\\n`\n )\n .action(async (blockId: string, version: string, opts) => {\n await cliCommand(['release', 'block', blockId], opts).ReleaseBlock(\n blockId,\n version\n );\n });\n\n return release;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAEpB,MAAM,qBAAqB,MAAM;AACtC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,SAAS,EACjB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,OAAO,EACf,SAAS,cAAc,kCAAkC,EACzD,SAAS,aAAa,8BAA8B,EACpD,MAAM,sBAAsB,EAC5B;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,SAAiB,SAAiB,SAAS;AACxD,cAAM,uCAAW,CAAC,WAAW,SAAS,OAAO,GAAG,IAAI,EAAE;AAAA,MACpD;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -179,12 +179,16 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
|
|
|
179
179
|
return import_logger.Logger.infoText(status);
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
get: (env) => `[${env}] Block
|
|
182
|
+
get: (id, env, projectId) => `[${env}] Block ${id} in project ${projectId}:`,
|
|
183
183
|
list: (env, projectId) => `[${env}] Blocks in project ${projectId}:`,
|
|
184
184
|
noList: (env, projectId) => `[${env}] Cannot retrieve blocks in project ${projectId}`,
|
|
185
|
+
getLogs: (id, branch, env, projectId) => `[${env}] Requesting logs from block "${id}" in branch ${branch} in project ${projectId}`,
|
|
186
|
+
failedGetLogs: (id, env, projectId) => `[${env}] Unable to fetch block logs for "${id}" in project ${projectId}`,
|
|
185
187
|
tryPush: (id, branch, env, projectId) => `[${env}] Request to push block "${id}" in branch ${branch} in project ${projectId}`,
|
|
186
188
|
pushed: (id, branch, env, projectId) => `[${env}] Pushed block "${id}" in branch ${branch} in project ${projectId}`,
|
|
187
189
|
failedPush: (id, env, projectId) => `[${env}] Unable to push block "${id}" in project ${projectId}`,
|
|
190
|
+
released: (id, env, projectId) => `[${env}] Released block "${id}" in project ${projectId}`,
|
|
191
|
+
failedRelease: (id, env, projectId) => `[${env}] Unable to release block "${id}" in project ${projectId}`,
|
|
188
192
|
deleted: (id, env, projectId) => `[${env}] Deleted block "${id}" in project ${projectId}`,
|
|
189
193
|
failedDelete: (id, env, projectId) => `[${env}] Unable to delete block "${id}" in project ${projectId}`
|
|
190
194
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/localisation/en-GB.ts"],
|
|
4
|
-
"sourcesContent": ["import { BlockRunningStatus, MigrateStatus } from 'migratortron';\nimport { Logger } from '~/util/logger';\n\nexport const LogMessages = {\n app: {\n contensis: () => 'Contensis',\n quit: () => `Goodbye \uD83D\uDC4B\\n`,\n startup: () =>\n `\u00A9 2001-${new Date().getFullYear()} Zengenti \uD83C\uDDEC\uD83C\uDDE7. \\n - Creators of Contensis and purveyors of other fine software\\n\\n\uD83D\uDC4B Welcome to the contensis-cli\\n`,\n help: () =>\n 'Press [CTRL]+[C] or type \"quit\" to return to your system shell\\nPress [TAB] for suggestions\\n',\n suggestions: () =>\n `\\n${Logger.errorText('>>')} Press [TAB] for suggestions\\n`,\n autocomplete: () => `\\n${Logger.errorText('>>')} Available commands:`,\n unknownError: () => `Something went wrong...`,\n fileOutput: (format = 'json', path?: string) =>\n `Output ${format} file: ${Logger.infoText(path)}\\n`,\n noFileOutput: () => `No output written\\n`,\n },\n command: {\n notKnown: (command: string) => `${command} is not known`,\n },\n envs: {\n found: (num: number) =>\n `environments store found containing ${num} environment${\n num === 1 ? '' : 's'\n }`,\n tip: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n connect: {\n command: {\n name: () => 'connect',\n example: () => `Example call:\\n > connect example-dev`,\n },\n args: {\n alias: {\n name: () => '<alias>',\n description: () => 'the Contensis Cloud alias to connect with',\n },\n },\n noEnv: () => `Cannot connect - no environment alias specified`,\n unreachable: (url: string, status: number) =>\n `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,\n connected: (env: string) => `Current environment set to \"${env}\"`,\n help: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n projects: () => `Available projects:`,\n noProjects: () => `Cannot retrieve projects list`,\n tip: () =>\n `Introduce yourself with \"login {username}\" or \"login {clientId} -s {secret}\" or by passing credentials as options with your command`,\n },\n login: {\n command: {\n name: () => 'login',\n usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,\n example: () =>\n `Example call:\\n > login myuserid\\n -- or --\\n > login {clientId} -s {sharedSecret}`,\n },\n args: {\n user: {\n name: () => '<user/clientId>',\n description: () => 'the username to login with',\n },\n password: {\n name: () => '[password]',\n description: () =>\n 'the password to use to login with (optional/insecure)',\n },\n secret: {\n name: () => '-s --sharedSecret <sharedSecret>',\n description: () =>\n 'the shared secret to use when logging in with a client id',\n },\n },\n passwordPrompt: (env?: string, userId?: string) =>\n userId\n ? `Enter password for ${userId}@${env}:`\n : `Please enter a password`,\n failed: (env: string, userId: string) =>\n `Unable to login to ${env} as ${userId}`,\n success: (env: string, userId: string) =>\n `User ${userId} connected to ${env} successfully\\n`,\n insecurePassword: () =>\n `Could not connect to local keystore - your password could be stored unencrypted!`,\n noEnv: () => `No environment set, use \"contensis connect {alias}\" first`,\n noUserId: () => `No user id specified`,\n },\n projects: {\n list: () => `Available projects:`,\n noList: () => `Cannot retrieve projects list`,\n set: (projectId: string) => `Current project is set to \"${projectId}\"`,\n failedSet: (projectId: string) => `Project \"${projectId}\" not found`,\n tip: () =>\n `You need to set your current working project with \"set project {projectId}\"`,\n },\n contenttypes: {\n list: (projectId: string) => `Content types in \"${projectId}\":`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve content types list`,\n get: (projectId: string, contentTypeId: string) =>\n `[${projectId}] Content type \"${contentTypeId}\"`,\n failedGet: (projectId: string, contentTypeId: string) =>\n `[${projectId}] Unable to get content type \"${contentTypeId}\"`,\n created: (projectId: string, componentId: string, status?: string) =>\n `[${projectId}] Content type ${status}d \"${componentId}\"`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} content type \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete content type \"${id}\"`,\n },\n components: {\n list: (projectId: string) => `Components in \"${projectId}\":`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve components list`,\n get: (projectId: string, componentId: string) =>\n `[${projectId}] Component \"${componentId}\"`,\n failedGet: (projectId: string, componentId: string) =>\n `[${projectId}] Unable to get component \"${componentId}\"`,\n created: (projectId: string, componentId: string, status?: string) =>\n `[${projectId}] Component ${status}d \"${componentId}\"`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} component \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete component \"${id}\"`,\n },\n version: {\n set: (env: string, versionStatus: string) =>\n `[${env}] Content version status set to \"${versionStatus}\"`,\n invalid: (versionStatus: string) =>\n `Content version status \"${versionStatus}\" is not valid, allowed values are \"published\" or \"latest\".`,\n noEnv: () =>\n `No Contensis environment set, connect to your Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n entries: {\n migrateStatus: (status: MigrateStatus) => {\n switch (status) {\n case 'no change':\n return Logger.successText;\n case 'create':\n case 'two-pass':\n case 'update':\n case 'delete':\n return Logger.warningText;\n case 'error':\n case 'not found':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} entry \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete entry \"${id}\"`,\n notFound: (id: string) => `Entry \"${id}\" not found`,\n commitTip: () => ` Add --commit flag to commit the previewed changes`,\n },\n keys: {\n list: (env: string) => `[${env}] API keys:`,\n noList: (env: string) => `[${env}] Cannot retrieve API`,\n created: (env: string, name: string) =>\n `[${env}] Created API key \"${name}\"`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create API key \"${name}\"`,\n removed: (env: string, id: string) => `[${env}] Deleted API key \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete API key \"${id}\"`,\n },\n blocks: {\n runningStatus: (status: BlockRunningStatus | 'broken') => {\n switch (status) {\n case 'available':\n return Logger.successText(status);\n case 'pending':\n case 'starting':\n case 'stopped':\n return Logger.warningText(status);\n case 'degraded':\n case 'faulted':\n case 'broken':\n return Logger.errorText(status);\n default:\n return Logger.infoText(status);\n }\n },\n get: (env: string) => `[${env}] Block versions:`,\n list: (env: string, projectId?: string) =>\n `[${env}] Blocks in project ${projectId}:`,\n noList: (env: string, projectId?: string) =>\n `[${env}] Cannot retrieve blocks in project ${projectId}`,\n tryPush: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Request to push block \"${id}\" in branch ${branch} in project ${projectId}`,\n pushed: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Pushed block \"${id}\" in branch ${branch} in project ${projectId}`,\n failedPush: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to push block \"${id}\" in project ${projectId}`,\n deleted: (id: string, env: string, projectId?: string) =>\n `[${env}] Deleted block \"${id}\" in project ${projectId}`,\n failedDelete: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to delete block \"${id}\" in project ${projectId}`,\n },\n webhooks: {\n list: (env: string) => `[${env}] Webhook subscriptions:`,\n noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,\n created: (env: string, name: string) =>\n `[${env}] Created Webhook subscription \"${name}\"`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create Webhook subscription \"${name}\"`,\n deleted: (env: string, id: string) =>\n `[${env}] Deleted Webhook subscription \"${id}\"`,\n failedDelete: (env: string, id: string) =>\n `[${env}] Unable to delete Webhook subscription \"${id}\"`,\n },\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AAEhB,MAAM,cAAc;AAAA,EACzB,KAAK;AAAA,IACH,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA;AAAA,IACZ,SAAS,MACP,aAAU,IAAI,KAAK,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,IACnC,MAAM,MACJ;AAAA,IACF,aAAa,MACX;AAAA,EAAK,qBAAO,UAAU,IAAI;AAAA;AAAA,IAC5B,cAAc,MAAM;AAAA,EAAK,qBAAO,UAAU,IAAI;AAAA,IAC9C,cAAc,MAAM;AAAA,IACpB,YAAY,CAAC,SAAS,QAAQ,SAC5B,UAAU,gBAAgB,qBAAO,SAAS,IAAI;AAAA;AAAA,IAChD,cAAc,MAAM;AAAA;AAAA,EACtB;AAAA,EACA,SAAS;AAAA,IACP,UAAU,CAAC,YAAoB,GAAG;AAAA,EACpC;AAAA,EACA,MAAM;AAAA,IACJ,OAAO,CAAC,QACN,uCAAuC,kBACrC,QAAQ,IAAI,KAAK;AAAA,IAErB,KAAK,MACH;AAAA,EACJ;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AA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,IAAI,QAAQ,SAAS,YAAY,wBAAwB;AAAA,IAC3D,cAAc,CAAC,KAAa,OAC1B,IAAI,gCAAgC;AAAA,IACtC,UAAU,CAAC,OAAe,UAAU;AAAA,IACpC,WAAW,MAAM;AAAA,EACnB;AAAA,EACA,MAAM;AAAA,IACJ,MAAM,CAAC,QAAgB,IAAI;AAAA,IAC3B,QAAQ,CAAC,QAAgB,IAAI;AAAA,IAC7B,SAAS,CAAC,KAAa,SACrB,IAAI,yBAAyB;AAAA,IAC/B,cAAc,CAAC,KAAa,SAC1B,IAAI,kCAAkC;AAAA,IACxC,SAAS,CAAC,KAAa,OAAe,IAAI,yBAAyB;AAAA,IACnE,cAAc,CAAC,KAAa,OAC1B,IAAI,kCAAkC;AAAA,EAC1C;AAAA,EACA,QAAQ;AAAA,IACN,eAAe,CAAC,WAA0C;AACxD,cAAQ;AAAA,aACD;AACH,iBAAO,qBAAO,YAAY,MAAM;AAAA,aAC7B;AAAA,aACA;AAAA,aACA;AACH,iBAAO,qBAAO,YAAY,MAAM;AAAA,aAC7B;AAAA,aACA;AAAA,aACA;AACH,iBAAO,qBAAO,UAAU,MAAM;AAAA;AAE9B,iBAAO,qBAAO,SAAS,MAAM;AAAA;AAAA,IAEnC;AAAA,IACA,KAAK,CAAC,
|
|
4
|
+
"sourcesContent": ["import { BlockRunningStatus, MigrateStatus } from 'migratortron';\nimport { Logger } from '~/util/logger';\n\nexport const LogMessages = {\n app: {\n contensis: () => 'Contensis',\n quit: () => `Goodbye \uD83D\uDC4B\\n`,\n startup: () =>\n `\u00A9 2001-${new Date().getFullYear()} Zengenti \uD83C\uDDEC\uD83C\uDDE7. \\n - Creators of Contensis and purveyors of other fine software\\n\\n\uD83D\uDC4B Welcome to the contensis-cli\\n`,\n help: () =>\n 'Press [CTRL]+[C] or type \"quit\" to return to your system shell\\nPress [TAB] for suggestions\\n',\n suggestions: () =>\n `\\n${Logger.errorText('>>')} Press [TAB] for suggestions\\n`,\n autocomplete: () => `\\n${Logger.errorText('>>')} Available commands:`,\n unknownError: () => `Something went wrong...`,\n fileOutput: (format = 'json', path?: string) =>\n `Output ${format} file: ${Logger.infoText(path)}\\n`,\n noFileOutput: () => `No output written\\n`,\n },\n command: {\n notKnown: (command: string) => `${command} is not known`,\n },\n envs: {\n found: (num: number) =>\n `environments store found containing ${num} environment${\n num === 1 ? '' : 's'\n }`,\n tip: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n connect: {\n command: {\n name: () => 'connect',\n example: () => `Example call:\\n > connect example-dev`,\n },\n args: {\n alias: {\n name: () => '<alias>',\n description: () => 'the Contensis Cloud alias to connect with',\n },\n },\n noEnv: () => `Cannot connect - no environment alias specified`,\n unreachable: (url: string, status: number) =>\n `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,\n connected: (env: string) => `Current environment set to \"${env}\"`,\n help: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n projects: () => `Available projects:`,\n noProjects: () => `Cannot retrieve projects list`,\n tip: () =>\n `Introduce yourself with \"login {username}\" or \"login {clientId} -s {secret}\" or by passing credentials as options with your command`,\n },\n login: {\n command: {\n name: () => 'login',\n usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,\n example: () =>\n `Example call:\\n > login myuserid\\n -- or --\\n > login {clientId} -s {sharedSecret}`,\n },\n args: {\n user: {\n name: () => '<user/clientId>',\n description: () => 'the username to login with',\n },\n password: {\n name: () => '[password]',\n description: () =>\n 'the password to use to login with (optional/insecure)',\n },\n secret: {\n name: () => '-s --sharedSecret <sharedSecret>',\n description: () =>\n 'the shared secret to use when logging in with a client id',\n },\n },\n passwordPrompt: (env?: string, userId?: string) =>\n userId\n ? `Enter password for ${userId}@${env}:`\n : `Please enter a password`,\n failed: (env: string, userId: string) =>\n `Unable to login to ${env} as ${userId}`,\n success: (env: string, userId: string) =>\n `User ${userId} connected to ${env} successfully\\n`,\n insecurePassword: () =>\n `Could not connect to local keystore - your password could be stored unencrypted!`,\n noEnv: () => `No environment set, use \"contensis connect {alias}\" first`,\n noUserId: () => `No user id specified`,\n },\n projects: {\n list: () => `Available projects:`,\n noList: () => `Cannot retrieve projects list`,\n set: (projectId: string) => `Current project is set to \"${projectId}\"`,\n failedSet: (projectId: string) => `Project \"${projectId}\" not found`,\n tip: () =>\n `You need to set your current working project with \"set project {projectId}\"`,\n },\n contenttypes: {\n list: (projectId: string) => `Content types in \"${projectId}\":`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve content types list`,\n get: (projectId: string, contentTypeId: string) =>\n `[${projectId}] Content type \"${contentTypeId}\"`,\n failedGet: (projectId: string, contentTypeId: string) =>\n `[${projectId}] Unable to get content type \"${contentTypeId}\"`,\n created: (projectId: string, componentId: string, status?: string) =>\n `[${projectId}] Content type ${status}d \"${componentId}\"`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} content type \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete content type \"${id}\"`,\n },\n components: {\n list: (projectId: string) => `Components in \"${projectId}\":`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve components list`,\n get: (projectId: string, componentId: string) =>\n `[${projectId}] Component \"${componentId}\"`,\n failedGet: (projectId: string, componentId: string) =>\n `[${projectId}] Unable to get component \"${componentId}\"`,\n created: (projectId: string, componentId: string, status?: string) =>\n `[${projectId}] Component ${status}d \"${componentId}\"`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} component \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete component \"${id}\"`,\n },\n version: {\n set: (env: string, versionStatus: string) =>\n `[${env}] Content version status set to \"${versionStatus}\"`,\n invalid: (versionStatus: string) =>\n `Content version status \"${versionStatus}\" is not valid, allowed values are \"published\" or \"latest\".`,\n noEnv: () =>\n `No Contensis environment set, connect to your Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n entries: {\n migrateStatus: (status: MigrateStatus) => {\n switch (status) {\n case 'no change':\n return Logger.successText;\n case 'create':\n case 'two-pass':\n case 'update':\n case 'delete':\n return Logger.warningText;\n case 'error':\n case 'not found':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} entry \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete entry \"${id}\"`,\n notFound: (id: string) => `Entry \"${id}\" not found`,\n commitTip: () => ` Add --commit flag to commit the previewed changes`,\n },\n keys: {\n list: (env: string) => `[${env}] API keys:`,\n noList: (env: string) => `[${env}] Cannot retrieve API`,\n created: (env: string, name: string) =>\n `[${env}] Created API key \"${name}\"`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create API key \"${name}\"`,\n removed: (env: string, id: string) => `[${env}] Deleted API key \"${id}\"`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete API key \"${id}\"`,\n },\n blocks: {\n runningStatus: (status: BlockRunningStatus | 'broken') => {\n switch (status) {\n case 'available':\n return Logger.successText(status);\n case 'pending':\n case 'starting':\n case 'stopped':\n return Logger.warningText(status);\n case 'degraded':\n case 'faulted':\n case 'broken':\n return Logger.errorText(status);\n default:\n return Logger.infoText(status);\n }\n },\n get: (id: string, env: string, projectId?: string) =>\n `[${env}] Block ${id} in project ${projectId}:`,\n list: (env: string, projectId?: string) =>\n `[${env}] Blocks in project ${projectId}:`,\n noList: (env: string, projectId?: string) =>\n `[${env}] Cannot retrieve blocks in project ${projectId}`,\n getLogs: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Requesting logs from block \"${id}\" in branch ${branch} in project ${projectId}`,\n failedGetLogs: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to fetch block logs for \"${id}\" in project ${projectId}`,\n tryPush: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Request to push block \"${id}\" in branch ${branch} in project ${projectId}`,\n pushed: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Pushed block \"${id}\" in branch ${branch} in project ${projectId}`,\n failedPush: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to push block \"${id}\" in project ${projectId}`,\n released: (id: string, env: string, projectId?: string) =>\n `[${env}] Released block \"${id}\" in project ${projectId}`,\n failedRelease: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to release block \"${id}\" in project ${projectId}`,\n deleted: (id: string, env: string, projectId?: string) =>\n `[${env}] Deleted block \"${id}\" in project ${projectId}`,\n failedDelete: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to delete block \"${id}\" in project ${projectId}`,\n },\n webhooks: {\n list: (env: string) => `[${env}] Webhook subscriptions:`,\n noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,\n created: (env: string, name: string) =>\n `[${env}] Created Webhook subscription \"${name}\"`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create Webhook subscription \"${name}\"`,\n deleted: (env: string, id: string) =>\n `[${env}] Deleted Webhook subscription \"${id}\"`,\n failedDelete: (env: string, id: string) =>\n `[${env}] Unable to delete Webhook subscription \"${id}\"`,\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AAEhB,MAAM,cAAc;AAAA,EACzB,KAAK;AAAA,IACH,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA;AAAA,IACZ,SAAS,MACP,aAAU,IAAI,KAAK,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,IACnC,MAAM,MACJ;AAAA,IACF,aAAa,MACX;AAAA,EAAK,qBAAO,UAAU,IAAI;AAAA;AAAA,IAC5B,cAAc,MAAM;AAAA,EAAK,qBAAO,UAAU,IAAI;AAAA,IAC9C,cAAc,MAAM;AAAA,IACpB,YAAY,CAAC,SAAS,QAAQ,SAC5B,UAAU,gBAAgB,qBAAO,SAAS,IAAI;AAAA;AAAA,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jD,IAAI,oCAAoC,iBAAiB,qBAAqB;AAAA,IAChF,eAAe,CAAC,IAAY,KAAa,cACvC,IAAI,wCAAwC,kBAAkB;AAAA,IAChE,SAAS,CAAC,IAAY,QAAgB,KAAa,cACjD,IAAI,+BAA+B,iBAAiB,qBAAqB;AAAA,IAC3E,QAAQ,CAAC,IAAY,QAAgB,KAAa,cAChD,IAAI,sBAAsB,iBAAiB,qBAAqB;AAAA,IAClE,YAAY,CAAC,IAAY,KAAa,cACpC,IAAI,8BAA8B,kBAAkB;AAAA,IACtD,UAAU,CAAC,IAAY,KAAa,cAClC,IAAI,wBAAwB,kBAAkB;AAAA,IAChD,eAAe,CAAC,IAAY,KAAa,cACvC,IAAI,iCAAiC,kBAAkB;AAAA,IACzD,SAAS,CAAC,IAAY,KAAa,cACjC,IAAI,uBAAuB,kBAAkB;AAAA,IAC/C,cAAc,CAAC,IAAY,KAAa,cACtC,IAAI,gCAAgC,kBAAkB;AAAA,EAC1D;AAAA,EACA,UAAU;AAAA,IACR,MAAM,CAAC,QAAgB,IAAI;AAAA,IAC3B,QAAQ,CAAC,QAAgB,IAAI;AAAA,IAC7B,SAAS,CAAC,KAAa,SACrB,IAAI,sCAAsC;AAAA,IAC5C,cAAc,CAAC,KAAa,SAC1B,IAAI,+CAA+C;AAAA,IACrD,SAAS,CAAC,KAAa,OACrB,IAAI,sCAAsC;AAAA,IAC5C,cAAc,CAAC,KAAa,OAC1B,IAAI,+CAA+C;AAAA,EACvD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -27,12 +27,12 @@ __export(CredentialProvider_exports, {
|
|
|
27
27
|
default: () => CredentialProvider_default
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(CredentialProvider_exports);
|
|
30
|
-
var import_keytar = __toESM(require("keytar"));
|
|
31
30
|
var import_await_to_js = __toESM(require("await-to-js"));
|
|
32
31
|
var import_logger = require("../util/logger");
|
|
33
32
|
const SERVICE_NAME = "contensis-cli";
|
|
34
33
|
class CredentialProvider {
|
|
35
34
|
serviceId;
|
|
35
|
+
keytar;
|
|
36
36
|
userId = "";
|
|
37
37
|
passwordFallback;
|
|
38
38
|
current = null;
|
|
@@ -42,9 +42,33 @@ class CredentialProvider {
|
|
|
42
42
|
this.userId = userId;
|
|
43
43
|
this.passwordFallback = passwordFallback;
|
|
44
44
|
}
|
|
45
|
+
Import = async () => {
|
|
46
|
+
try {
|
|
47
|
+
this.keytar = (await import("keytar")).default;
|
|
48
|
+
} catch (ex) {
|
|
49
|
+
this.keytar = {
|
|
50
|
+
findCredentials: async () => {
|
|
51
|
+
throw ex;
|
|
52
|
+
},
|
|
53
|
+
getPassword: async () => {
|
|
54
|
+
throw ex;
|
|
55
|
+
},
|
|
56
|
+
findPassword: async () => {
|
|
57
|
+
throw ex;
|
|
58
|
+
},
|
|
59
|
+
setPassword: async () => {
|
|
60
|
+
throw ex;
|
|
61
|
+
},
|
|
62
|
+
deletePassword: async () => {
|
|
63
|
+
throw ex;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
};
|
|
45
68
|
Init = async () => {
|
|
69
|
+
await this.Import();
|
|
46
70
|
const [err, stored] = await (0, import_await_to_js.default)(
|
|
47
|
-
|
|
71
|
+
this.keytar.findCredentials(this.serviceId)
|
|
48
72
|
);
|
|
49
73
|
if (err && this.passwordFallback) {
|
|
50
74
|
this.current = {
|
|
@@ -69,7 +93,7 @@ class CredentialProvider {
|
|
|
69
93
|
};
|
|
70
94
|
Save = async (password) => {
|
|
71
95
|
const [err] = await (0, import_await_to_js.default)(
|
|
72
|
-
|
|
96
|
+
this.keytar.setPassword(this.serviceId, this.userId, password)
|
|
73
97
|
);
|
|
74
98
|
return err && !this.passwordFallback ? err : true;
|
|
75
99
|
};
|
|
@@ -79,7 +103,7 @@ class CredentialProvider {
|
|
|
79
103
|
return true;
|
|
80
104
|
} else {
|
|
81
105
|
const [err] = await (0, import_await_to_js.default)(
|
|
82
|
-
|
|
106
|
+
this.keytar.deletePassword(this.serviceId, this.userId)
|
|
83
107
|
);
|
|
84
108
|
import_logger.Logger.warning(`${this.serviceId} - invalid credentials removed`);
|
|
85
109
|
return err || true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/providers/CredentialProvider.ts"],
|
|
4
|
-
"sourcesContent": ["import keytar from 'keytar';\nimport to from 'await-to-js';\nimport { Logger } from '~/util/logger';\n\nconst SERVICE_NAME = 'contensis-cli';\n\ninterface Remarks {\n secure: boolean;\n}\n\nclass CredentialProvider {\n private serviceId: string;\n private userId: string = '';\n private passwordFallback?: string;\n\n current: {\n account: string;\n password: string;\n } | null = null;\n remarks: Remarks = { secure: false };\n\n constructor(\n { userId, alias }: { userId: string; alias?: string },\n passwordFallback?: string\n ) {\n this.serviceId =\n typeof alias !== 'undefined' ? `${SERVICE_NAME}_${alias}` : SERVICE_NAME;\n this.userId = userId;\n this.passwordFallback = passwordFallback;\n }\n\n Init = async (): Promise<[Error, CredentialProvider]> => {\n const [err, stored] = (await to(\n keytar.findCredentials(this.serviceId)\n )) as [\n Error,\n {\n account: string;\n password: string;\n }[]\n ];\n if (err && this.passwordFallback) {\n this.current = {\n account: this.userId,\n password: this.passwordFallback,\n };\n }\n if (!err) {\n this.remarks = { secure: true };\n this.current =\n stored?.find(\n u => u?.account?.toLowerCase() === this.userId.toLowerCase()\n ) || null;\n\n if (!this.current && this.passwordFallback) {\n await this.Save(this.passwordFallback);\n return await this.Init();\n }\n }\n return [err, this];\n };\n\n Save = async (password: string) => {\n const [err] = await to(\n keytar.setPassword(this.serviceId, this.userId, password)\n );\n\n // if (!err) Logger.info(`${this.serviceId} - credentials saved`);\n return err && !this.passwordFallback ? err : true;\n };\n\n Delete = async () => {\n if (this.passwordFallback) {\n this.passwordFallback = undefined;\n return true;\n } else {\n const [err] = await to(\n keytar.deletePassword(this.serviceId, this.userId)\n );\n\n Logger.warning(`${this.serviceId} - invalid credentials removed`);\n return err || true;\n }\n };\n\n // GetPassword = async () => {\n // const [err, password] = await to(\n // keytar.getPassword(this.serviceId, this.userId)\n // );\n\n // return err || password;\n // };\n}\n\nexport default CredentialProvider;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["to"
|
|
4
|
+
"sourcesContent": ["import keytar from 'keytar';\nimport to from 'await-to-js';\nimport { Logger } from '~/util/logger';\n\nconst SERVICE_NAME = 'contensis-cli';\n\ninterface Remarks {\n secure: boolean;\n}\n\nclass CredentialProvider {\n private serviceId: string;\n private keytar!: typeof keytar;\n private userId: string = '';\n private passwordFallback?: string;\n\n current: {\n account: string;\n password: string;\n } | null = null;\n remarks: Remarks = { secure: false };\n\n constructor(\n { userId, alias }: { userId: string; alias?: string },\n passwordFallback?: string\n ) {\n this.serviceId =\n typeof alias !== 'undefined' ? `${SERVICE_NAME}_${alias}` : SERVICE_NAME;\n this.userId = userId;\n this.passwordFallback = passwordFallback;\n }\n\n Import = async () => {\n try {\n this.keytar = (await import('keytar')).default;\n } catch (ex) {\n this.keytar = {\n findCredentials: async () => {\n throw ex;\n },\n getPassword: async () => {\n throw ex;\n },\n findPassword: async () => {\n throw ex;\n },\n setPassword: async () => {\n throw ex;\n },\n deletePassword: async () => {\n throw ex;\n },\n };\n }\n };\n\n Init = async (): Promise<[Error, CredentialProvider]> => {\n await this.Import();\n const [err, stored] = (await to(\n this.keytar.findCredentials(this.serviceId)\n )) as [\n Error,\n {\n account: string;\n password: string;\n }[]\n ];\n if (err && this.passwordFallback) {\n this.current = {\n account: this.userId,\n password: this.passwordFallback,\n };\n }\n if (!err) {\n this.remarks = { secure: true };\n this.current =\n stored?.find(\n u => u?.account?.toLowerCase() === this.userId.toLowerCase()\n ) || null;\n\n if (!this.current && this.passwordFallback) {\n await this.Save(this.passwordFallback);\n return await this.Init();\n }\n }\n return [err, this];\n };\n\n Save = async (password: string) => {\n const [err] = await to(\n this.keytar.setPassword(this.serviceId, this.userId, password)\n );\n\n // if (!err) Logger.info(`${this.serviceId} - credentials saved`);\n return err && !this.passwordFallback ? err : true;\n };\n\n Delete = async () => {\n if (this.passwordFallback) {\n this.passwordFallback = undefined;\n return true;\n } else {\n const [err] = await to(\n this.keytar.deletePassword(this.serviceId, this.userId)\n );\n\n Logger.warning(`${this.serviceId} - invalid credentials removed`);\n return err || true;\n }\n };\n\n // GetPassword = async () => {\n // const [err, password] = await to(\n // keytar.getPassword(this.serviceId, this.userId)\n // );\n\n // return err || password;\n // };\n}\n\nexport default CredentialProvider;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAe;AACf,oBAAuB;AAEvB,MAAM,eAAe;AAMrB,MAAM,mBAAmB;AAAA,EACf;AAAA,EACA;AAAA,EACA,SAAiB;AAAA,EACjB;AAAA,EAER,UAGW;AAAA,EACX,UAAmB,EAAE,QAAQ,MAAM;AAAA,EAEnC,YACE,EAAE,QAAQ,MAAM,GAChB,kBACA;AACA,SAAK,YACH,OAAO,UAAU,cAAc,GAAG,gBAAgB,UAAU;AAC9D,SAAK,SAAS;AACd,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEA,SAAS,YAAY;AACnB,QAAI;AACF,WAAK,UAAU,MAAM,OAAO,WAAW;AAAA,IACzC,SAAS,IAAP;AACA,WAAK,SAAS;AAAA,QACZ,iBAAiB,YAAY;AAC3B,gBAAM;AAAA,QACR;AAAA,QACA,aAAa,YAAY;AACvB,gBAAM;AAAA,QACR;AAAA,QACA,cAAc,YAAY;AACxB,gBAAM;AAAA,QACR;AAAA,QACA,aAAa,YAAY;AACvB,gBAAM;AAAA,QACR;AAAA,QACA,gBAAgB,YAAY;AAC1B,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAO,YAAkD;AACvD,UAAM,KAAK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|
|
916
916
|
};
|
|
917
917
|
PrintBlocks = async () => {
|
|
918
|
-
const { currentEnv, log, messages } = this;
|
|
918
|
+
const { currentEnv, env, log, messages } = this;
|
|
919
919
|
if (!this.contensis)
|
|
920
920
|
await this.ConnectContensis();
|
|
921
921
|
if (this.contensis) {
|
|
922
922
|
const [err, blocks] = await this.contensis.blocks.GetBlocks();
|
|
923
923
|
if (Array.isArray(blocks)) {
|
|
924
924
|
this.HandleFormattingAndOutput(blocks, () => {
|
|
925
|
-
log.success(messages.blocks.list(currentEnv));
|
|
925
|
+
log.success(messages.blocks.list(currentEnv, env.currentProject));
|
|
926
926
|
for (const {
|
|
927
927
|
id,
|
|
928
928
|
description,
|
|
@@ -960,7 +960,7 @@ Exiting contensis-cli with exit code: ${exitCode}
|
|
|
960
960
|
if (blocks) {
|
|
961
961
|
this.HandleFormattingAndOutput(blocks, () => {
|
|
962
962
|
log.success(
|
|
963
|
-
messages.blocks.get(
|
|
963
|
+
messages.blocks.get(blockId, currentEnv, env.currentProject)
|
|
964
964
|
);
|
|
965
965
|
for (const block of blocks)
|
|
966
966
|
(0, import_console.printBlockVersion)(
|
|
@@ -1018,11 +1018,40 @@ Exiting contensis-cli with exit code: ${exitCode}
|
|
|
1018
1018
|
);
|
|
1019
1019
|
}
|
|
1020
1020
|
};
|
|
1021
|
+
ReleaseBlock = async (blockId, version) => {
|
|
1022
|
+
const { currentEnv, env, log, messages } = this;
|
|
1023
|
+
if (!this.contensis)
|
|
1024
|
+
await this.ConnectContensis();
|
|
1025
|
+
if (this.contensis) {
|
|
1026
|
+
const [err, blockVersion] = await this.contensis.blocks.BlockAction(
|
|
1027
|
+
blockId,
|
|
1028
|
+
"release",
|
|
1029
|
+
version
|
|
1030
|
+
);
|
|
1031
|
+
if (blockVersion) {
|
|
1032
|
+
this.HandleFormattingAndOutput(blockVersion, () => {
|
|
1033
|
+
log.success(
|
|
1034
|
+
messages.blocks.released(blockId, currentEnv, env.currentProject)
|
|
1035
|
+
);
|
|
1036
|
+
(0, import_console.printBlockVersion)(this, blockVersion);
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
if (err) {
|
|
1040
|
+
log.error(
|
|
1041
|
+
messages.blocks.failedRelease(blockId, currentEnv, env.currentProject)
|
|
1042
|
+
);
|
|
1043
|
+
log.error((0, import_json.jsonFormatter)(err));
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1021
1047
|
PrintBlockLogs = async (blockId, branch, version, dataCenter) => {
|
|
1022
|
-
const { currentEnv, log, messages } = this;
|
|
1048
|
+
const { currentEnv, env, log, messages } = this;
|
|
1023
1049
|
if (!this.contensis)
|
|
1024
1050
|
await this.ConnectContensis();
|
|
1025
1051
|
if (this.contensis) {
|
|
1052
|
+
log.success(
|
|
1053
|
+
messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)
|
|
1054
|
+
);
|
|
1026
1055
|
const [err, blockLogs] = await this.contensis.blocks.GetBlockLogs({
|
|
1027
1056
|
blockId,
|
|
1028
1057
|
branchId: branch,
|
|
@@ -1031,7 +1060,6 @@ Exiting contensis-cli with exit code: ${exitCode}
|
|
|
1031
1060
|
});
|
|
1032
1061
|
if (blockLogs) {
|
|
1033
1062
|
this.HandleFormattingAndOutput(blockLogs, () => {
|
|
1034
|
-
log.success(messages.blocks.list(currentEnv));
|
|
1035
1063
|
console.log(
|
|
1036
1064
|
` - ${blockId} ${branch} ${Number(version) ? `v${version}` : version} [${dataCenter}]`
|
|
1037
1065
|
);
|
|
@@ -1041,7 +1069,9 @@ Exiting contensis-cli with exit code: ${exitCode}
|
|
|
1041
1069
|
});
|
|
1042
1070
|
}
|
|
1043
1071
|
if (err) {
|
|
1044
|
-
log.error(
|
|
1072
|
+
log.error(
|
|
1073
|
+
messages.blocks.failedGetLogs(blockId, currentEnv, env.currentProject)
|
|
1074
|
+
);
|
|
1045
1075
|
log.error((0, import_json.jsonFormatter)(err));
|
|
1046
1076
|
}
|
|
1047
1077
|
}
|
|
@@ -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\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 log.warning(messages.login.insecurePassword());\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, 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));\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(`${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 messages.blocks.tryPush(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\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 console.log(jsonFormatter(blockVersion));\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 PrintBlockLogs = async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london'\n ) => {\n const { currentEnv, log, messages } = this;\n if (!this.contensis) await this.ConnectContensis();\n if (this.contensis) {\n // Retrieve block logs\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 log.success(messages.blocks.list(currentEnv));\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(messages.blocks.noList(currentEnv));\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 (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 } else {\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 };\n}\n\nexport const cliCommand = (\n commandArgs: string[],\n outputOpts: OutputOptions & IConnectOptions = {},\n contensisOpts: Partial<MigrateRequest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,QAAQ,SAAS,IAAI,WAAW,QAAQ,MAAM,CAAC;AAAA,MACrD,OAAO;AACL,YAAI,KAAK,SAAS,IAAI,aAAa,CAAC;AAAA,MACtC;AAAA,IACF,OAAO;AACL,UAAI,CAAC,QAAQ;AAEX,cAAM,GAAG;AAAA,MACX,WAAW,WAAW,OAAO;AAC3B,YAAI,IAAI,EAAE;AACV,YAAI,IAAI,IAAI,aAAS,yBAAa,GAAG,CAAC,CAAC;AAAA,MACzC,WAAW,WAAW,OAAO;AAC3B,YAAI,IAAI,EAAE;AACV,YAAI,IAAI,IAAI,aAAS,yBAAa,GAAG,CAAC,CAAC;AAAA,MACzC,WAAW,WAAW,QAAQ;AAC5B,YAAI,IAAI,EAAE;AACV,YAAI,IAAI,IAAI,aAAS,2BAAc,GAAG,CAAC,CAAC;AAAA,MAC1C;AACA,UAAI,IAAI,EAAE;AAAA,IACZ;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\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 log.warning(messages.login.insecurePassword());\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 messages.blocks.tryPush(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\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 console.log(jsonFormatter(blockVersion));\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 (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 } else {\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 };\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;AA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AAI,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
|
@@ -164,6 +164,7 @@ class ContensisShell {
|
|
|
164
164
|
"list webhooks",
|
|
165
165
|
"create key",
|
|
166
166
|
"push block",
|
|
167
|
+
"release block",
|
|
167
168
|
"remove key",
|
|
168
169
|
"remove entry",
|
|
169
170
|
"remove contenttypes",
|
|
@@ -189,7 +190,7 @@ class ContensisShell {
|
|
|
189
190
|
return true;
|
|
190
191
|
}
|
|
191
192
|
},
|
|
192
|
-
prefix: `${(env == null ? void 0 : env.currentProject) || "contensis"}`,
|
|
193
|
+
prefix: `${(env == null ? void 0 : env.currentProject) || log.infoText("contensis")}`,
|
|
193
194
|
short: true
|
|
194
195
|
}
|
|
195
196
|
]).then(async (answers) => {
|
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(__dirname, '../'),\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 '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 || '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,WAAW,KAAK;AAAA,QAClC,OAAO;AAAA,QACP,WAAW,CAAC,MAAM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S;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;AAAA,
|
|
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(__dirname, '../'),\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;AA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M,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.19";
|
|
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.19\";\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.19",
|
|
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.15",
|
|
39
39
|
"node-fetch": "^2.6.7",
|
|
40
40
|
"patch-package": "^6.4.7",
|
|
41
41
|
"xml2js": "^0.4.23"
|
package/src/commands/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { makeImportCommand } from './import';
|
|
|
15
15
|
import { makeListCommand } from './list';
|
|
16
16
|
import { makeLoginCommand } from './login';
|
|
17
17
|
import { makePushCommand } from './push';
|
|
18
|
+
import { makeReleaseCommand } from './release';
|
|
18
19
|
import { makeRemoveCommand } from './remove';
|
|
19
20
|
import { makeSetCommand } from './set';
|
|
20
21
|
|
|
@@ -59,6 +60,9 @@ const commands = () => {
|
|
|
59
60
|
program.addCommand(
|
|
60
61
|
addGlobalOptions(makePushCommand()).copyInheritedSettings(program)
|
|
61
62
|
);
|
|
63
|
+
program.addCommand(
|
|
64
|
+
addGlobalOptions(makeReleaseCommand()).copyInheritedSettings(program)
|
|
65
|
+
);
|
|
62
66
|
program.addCommand(
|
|
63
67
|
addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)
|
|
64
68
|
);
|
package/src/commands/push.ts
CHANGED
|
@@ -55,7 +55,7 @@ export const makePushCommand = () => {
|
|
|
55
55
|
'after',
|
|
56
56
|
`
|
|
57
57
|
Example call:
|
|
58
|
-
> push block contensis-app ghcr.io/contensis/contensis-app/build-4359 master --release\n`
|
|
58
|
+
> push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\n`
|
|
59
59
|
)
|
|
60
60
|
.action(async (blockId: string, imageUri: string, branch: string, opts) => {
|
|
61
61
|
const cli = cliCommand(['push', 'block', blockId], opts);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
|
|
4
|
+
export const makeReleaseCommand = () => {
|
|
5
|
+
const release = new Command()
|
|
6
|
+
.command('release')
|
|
7
|
+
.showHelpAfterError(true)
|
|
8
|
+
.exitOverride();
|
|
9
|
+
|
|
10
|
+
release
|
|
11
|
+
.command('block')
|
|
12
|
+
.argument('<block-id>', 'the name of the block to release')
|
|
13
|
+
.argument('<version>', 'the block version to release')
|
|
14
|
+
.usage('<block-id> <version>')
|
|
15
|
+
.addHelpText(
|
|
16
|
+
'after',
|
|
17
|
+
`
|
|
18
|
+
Example call:
|
|
19
|
+
> release block contensis-app 3\n`
|
|
20
|
+
)
|
|
21
|
+
.action(async (blockId: string, version: string, opts) => {
|
|
22
|
+
await cliCommand(['release', 'block', blockId], opts).ReleaseBlock(
|
|
23
|
+
blockId,
|
|
24
|
+
version
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return release;
|
|
29
|
+
};
|
|
@@ -184,17 +184,26 @@ export const LogMessages = {
|
|
|
184
184
|
return Logger.infoText(status);
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
|
-
get: (env: string) =>
|
|
187
|
+
get: (id: string, env: string, projectId?: string) =>
|
|
188
|
+
`[${env}] Block ${id} in project ${projectId}:`,
|
|
188
189
|
list: (env: string, projectId?: string) =>
|
|
189
190
|
`[${env}] Blocks in project ${projectId}:`,
|
|
190
191
|
noList: (env: string, projectId?: string) =>
|
|
191
192
|
`[${env}] Cannot retrieve blocks in project ${projectId}`,
|
|
193
|
+
getLogs: (id: string, branch: string, env: string, projectId?: string) =>
|
|
194
|
+
`[${env}] Requesting logs from block "${id}" in branch ${branch} in project ${projectId}`,
|
|
195
|
+
failedGetLogs: (id: string, env: string, projectId?: string) =>
|
|
196
|
+
`[${env}] Unable to fetch block logs for "${id}" in project ${projectId}`,
|
|
192
197
|
tryPush: (id: string, branch: string, env: string, projectId?: string) =>
|
|
193
198
|
`[${env}] Request to push block "${id}" in branch ${branch} in project ${projectId}`,
|
|
194
199
|
pushed: (id: string, branch: string, env: string, projectId?: string) =>
|
|
195
200
|
`[${env}] Pushed block "${id}" in branch ${branch} in project ${projectId}`,
|
|
196
201
|
failedPush: (id: string, env: string, projectId?: string) =>
|
|
197
202
|
`[${env}] Unable to push block "${id}" in project ${projectId}`,
|
|
203
|
+
released: (id: string, env: string, projectId?: string) =>
|
|
204
|
+
`[${env}] Released block "${id}" in project ${projectId}`,
|
|
205
|
+
failedRelease: (id: string, env: string, projectId?: string) =>
|
|
206
|
+
`[${env}] Unable to release block "${id}" in project ${projectId}`,
|
|
198
207
|
deleted: (id: string, env: string, projectId?: string) =>
|
|
199
208
|
`[${env}] Deleted block "${id}" in project ${projectId}`,
|
|
200
209
|
failedDelete: (id: string, env: string, projectId?: string) =>
|
|
@@ -10,6 +10,7 @@ interface Remarks {
|
|
|
10
10
|
|
|
11
11
|
class CredentialProvider {
|
|
12
12
|
private serviceId: string;
|
|
13
|
+
private keytar!: typeof keytar;
|
|
13
14
|
private userId: string = '';
|
|
14
15
|
private passwordFallback?: string;
|
|
15
16
|
|
|
@@ -29,9 +30,34 @@ class CredentialProvider {
|
|
|
29
30
|
this.passwordFallback = passwordFallback;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
Import = async () => {
|
|
34
|
+
try {
|
|
35
|
+
this.keytar = (await import('keytar')).default;
|
|
36
|
+
} catch (ex) {
|
|
37
|
+
this.keytar = {
|
|
38
|
+
findCredentials: async () => {
|
|
39
|
+
throw ex;
|
|
40
|
+
},
|
|
41
|
+
getPassword: async () => {
|
|
42
|
+
throw ex;
|
|
43
|
+
},
|
|
44
|
+
findPassword: async () => {
|
|
45
|
+
throw ex;
|
|
46
|
+
},
|
|
47
|
+
setPassword: async () => {
|
|
48
|
+
throw ex;
|
|
49
|
+
},
|
|
50
|
+
deletePassword: async () => {
|
|
51
|
+
throw ex;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
32
57
|
Init = async (): Promise<[Error, CredentialProvider]> => {
|
|
58
|
+
await this.Import();
|
|
33
59
|
const [err, stored] = (await to(
|
|
34
|
-
keytar.findCredentials(this.serviceId)
|
|
60
|
+
this.keytar.findCredentials(this.serviceId)
|
|
35
61
|
)) as [
|
|
36
62
|
Error,
|
|
37
63
|
{
|
|
@@ -62,7 +88,7 @@ class CredentialProvider {
|
|
|
62
88
|
|
|
63
89
|
Save = async (password: string) => {
|
|
64
90
|
const [err] = await to(
|
|
65
|
-
keytar.setPassword(this.serviceId, this.userId, password)
|
|
91
|
+
this.keytar.setPassword(this.serviceId, this.userId, password)
|
|
66
92
|
);
|
|
67
93
|
|
|
68
94
|
// if (!err) Logger.info(`${this.serviceId} - credentials saved`);
|
|
@@ -75,7 +101,7 @@ class CredentialProvider {
|
|
|
75
101
|
return true;
|
|
76
102
|
} else {
|
|
77
103
|
const [err] = await to(
|
|
78
|
-
keytar.deletePassword(this.serviceId, this.userId)
|
|
104
|
+
this.keytar.deletePassword(this.serviceId, this.userId)
|
|
79
105
|
);
|
|
80
106
|
|
|
81
107
|
Logger.warning(`${this.serviceId} - invalid credentials removed`);
|
|
@@ -1147,7 +1147,7 @@ class ContensisCli {
|
|
|
1147
1147
|
};
|
|
1148
1148
|
|
|
1149
1149
|
PrintBlocks = async () => {
|
|
1150
|
-
const { currentEnv, log, messages } = this;
|
|
1150
|
+
const { currentEnv, env, log, messages } = this;
|
|
1151
1151
|
if (!this.contensis) await this.ConnectContensis();
|
|
1152
1152
|
if (this.contensis) {
|
|
1153
1153
|
// Retrieve blocks list for env
|
|
@@ -1156,7 +1156,7 @@ class ContensisCli {
|
|
|
1156
1156
|
if (Array.isArray(blocks)) {
|
|
1157
1157
|
this.HandleFormattingAndOutput(blocks, () => {
|
|
1158
1158
|
// print the blocks to console
|
|
1159
|
-
log.success(messages.blocks.list(currentEnv));
|
|
1159
|
+
log.success(messages.blocks.list(currentEnv, env.currentProject));
|
|
1160
1160
|
for (const {
|
|
1161
1161
|
id,
|
|
1162
1162
|
description,
|
|
@@ -1210,7 +1210,7 @@ class ContensisCli {
|
|
|
1210
1210
|
this.HandleFormattingAndOutput(blocks, () => {
|
|
1211
1211
|
// print the version detail to console
|
|
1212
1212
|
log.success(
|
|
1213
|
-
messages.blocks.get(
|
|
1213
|
+
messages.blocks.get(blockId, currentEnv, env.currentProject)
|
|
1214
1214
|
);
|
|
1215
1215
|
for (const block of blocks)
|
|
1216
1216
|
printBlockVersion(
|
|
@@ -1277,16 +1277,50 @@ class ContensisCli {
|
|
|
1277
1277
|
}
|
|
1278
1278
|
};
|
|
1279
1279
|
|
|
1280
|
+
ReleaseBlock = async (blockId: string, version: string) => {
|
|
1281
|
+
const { currentEnv, env, log, messages } = this;
|
|
1282
|
+
if (!this.contensis) await this.ConnectContensis();
|
|
1283
|
+
if (this.contensis) {
|
|
1284
|
+
// Retrieve block version
|
|
1285
|
+
const [err, blockVersion] = await this.contensis.blocks.BlockAction(
|
|
1286
|
+
blockId,
|
|
1287
|
+
'release',
|
|
1288
|
+
version
|
|
1289
|
+
);
|
|
1290
|
+
|
|
1291
|
+
if (blockVersion) {
|
|
1292
|
+
this.HandleFormattingAndOutput(blockVersion, () => {
|
|
1293
|
+
// print the version detail to console
|
|
1294
|
+
log.success(
|
|
1295
|
+
messages.blocks.released(blockId, currentEnv, env.currentProject)
|
|
1296
|
+
);
|
|
1297
|
+
printBlockVersion(this, blockVersion);
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (err) {
|
|
1302
|
+
log.error(
|
|
1303
|
+
messages.blocks.failedRelease(blockId, currentEnv, env.currentProject)
|
|
1304
|
+
);
|
|
1305
|
+
log.error(jsonFormatter(err));
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1280
1310
|
PrintBlockLogs = async (
|
|
1281
1311
|
blockId: string,
|
|
1282
1312
|
branch: string,
|
|
1283
1313
|
version: string,
|
|
1284
1314
|
dataCenter: 'hq' | 'manchester' | 'london'
|
|
1285
1315
|
) => {
|
|
1286
|
-
const { currentEnv, log, messages } = this;
|
|
1316
|
+
const { currentEnv, env, log, messages } = this;
|
|
1287
1317
|
if (!this.contensis) await this.ConnectContensis();
|
|
1288
1318
|
if (this.contensis) {
|
|
1289
1319
|
// Retrieve block logs
|
|
1320
|
+
log.success(
|
|
1321
|
+
messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)
|
|
1322
|
+
);
|
|
1323
|
+
|
|
1290
1324
|
const [err, blockLogs] = await this.contensis.blocks.GetBlockLogs({
|
|
1291
1325
|
blockId,
|
|
1292
1326
|
branchId: branch,
|
|
@@ -1296,8 +1330,7 @@ class ContensisCli {
|
|
|
1296
1330
|
|
|
1297
1331
|
if (blockLogs) {
|
|
1298
1332
|
this.HandleFormattingAndOutput(blockLogs, () => {
|
|
1299
|
-
// print the
|
|
1300
|
-
log.success(messages.blocks.list(currentEnv));
|
|
1333
|
+
// print the logs to console
|
|
1301
1334
|
console.log(
|
|
1302
1335
|
` - ${blockId} ${branch} ${
|
|
1303
1336
|
Number(version) ? `v${version}` : version
|
|
@@ -1310,7 +1343,9 @@ class ContensisCli {
|
|
|
1310
1343
|
}
|
|
1311
1344
|
|
|
1312
1345
|
if (err) {
|
|
1313
|
-
log.error(
|
|
1346
|
+
log.error(
|
|
1347
|
+
messages.blocks.failedGetLogs(blockId, currentEnv, env.currentProject)
|
|
1348
|
+
);
|
|
1314
1349
|
log.error(jsonFormatter(err));
|
|
1315
1350
|
}
|
|
1316
1351
|
}
|
package/src/shell.ts
CHANGED
|
@@ -151,6 +151,7 @@ class ContensisShell {
|
|
|
151
151
|
'list webhooks',
|
|
152
152
|
'create key',
|
|
153
153
|
'push block',
|
|
154
|
+
'release block',
|
|
154
155
|
'remove key',
|
|
155
156
|
'remove entry',
|
|
156
157
|
'remove contenttypes',
|
|
@@ -176,7 +177,7 @@ class ContensisShell {
|
|
|
176
177
|
return true;
|
|
177
178
|
}
|
|
178
179
|
},
|
|
179
|
-
prefix: `${env?.currentProject || 'contensis'}`,
|
|
180
|
+
prefix: `${env?.currentProject || log.infoText('contensis')}`,
|
|
180
181
|
short: true,
|
|
181
182
|
},
|
|
182
183
|
])
|
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.19";
|