contensis-cli 1.3.1-beta.0 → 1.3.1-beta.10
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/README.md +78 -6
- package/dist/commands/copy.js +2 -2
- package/dist/commands/copy.js.map +2 -2
- package/dist/commands/create.js +1 -2
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/globalOptions.js +16 -4
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +1 -1
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/index.js +4 -2
- package/dist/commands/index.js.map +2 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js +1 -2
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/push.js +102 -10
- package/dist/commands/push.js.map +3 -3
- package/dist/commands/remove.js +15 -4
- package/dist/commands/remove.js.map +2 -2
- package/dist/commands/set.js +2 -4
- package/dist/commands/set.js.map +1 -1
- package/dist/commands/update.js +70 -0
- package/dist/commands/update.js.map +7 -0
- package/dist/factories/RequestHandlerFactory.js +12 -5
- package/dist/factories/RequestHandlerFactory.js.map +2 -2
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/localisation/en-GB.js +19 -2
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +1 -1
- package/dist/mappers/DevInit-to-CIWorkflow.js +11 -6
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +1 -1
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +4 -2
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +1 -1
- package/dist/models/CliService.d.js.map +1 -1
- package/dist/providers/CredentialProvider.js +11 -4
- package/dist/providers/CredentialProvider.js.map +2 -2
- package/dist/providers/GitHubCliModuleProvider.js +8 -10
- package/dist/providers/GitHubCliModuleProvider.js.map +1 -1
- package/dist/providers/HttpProvider.js +5 -4
- package/dist/providers/HttpProvider.js.map +1 -1
- package/dist/providers/ManifestProvider.js +1 -4
- package/dist/providers/ManifestProvider.js.map +1 -1
- package/dist/providers/SessionCacheProvider.js +26 -8
- package/dist/providers/SessionCacheProvider.js.map +2 -2
- package/dist/providers/file-provider.js +13 -11
- package/dist/providers/file-provider.js.map +1 -1
- package/dist/services/ContensisAuthService.js +1 -2
- package/dist/services/ContensisAuthService.js.map +1 -1
- package/dist/services/ContensisCliService.js +194 -127
- package/dist/services/ContensisCliService.js.map +3 -3
- package/dist/services/ContensisDevService.js +15 -18
- package/dist/services/ContensisDevService.js.map +2 -2
- package/dist/services/ContensisRoleService.js +8 -10
- package/dist/services/ContensisRoleService.js.map +1 -1
- package/dist/shell.js +31 -15
- package/dist/shell.js.map +2 -2
- package/dist/util/api-ids.js.map +1 -1
- package/dist/util/console.printer.js +15 -17
- package/dist/util/console.printer.js.map +2 -2
- package/dist/util/csv.formatter.js +8 -15
- package/dist/util/csv.formatter.js.map +2 -2
- package/dist/util/diff.js +6 -4
- package/dist/util/diff.js.map +1 -1
- package/dist/util/dotenv.js +1 -2
- package/dist/util/dotenv.js.map +1 -1
- package/dist/util/error.js.map +1 -1
- package/dist/util/fetch.js +4 -0
- package/dist/util/fetch.js.map +1 -1
- package/dist/util/git.js +8 -8
- package/dist/util/git.js.map +1 -1
- package/dist/util/gitignore.js +4 -0
- package/dist/util/gitignore.js.map +1 -1
- package/dist/util/html.formatter.js +70 -0
- package/dist/util/html.formatter.js.map +7 -0
- package/dist/util/index.js +5 -1
- package/dist/util/index.js.map +2 -2
- package/dist/util/json.formatter.js +6 -4
- package/dist/util/json.formatter.js.map +1 -1
- package/dist/util/logger.js +47 -53
- package/dist/util/logger.js.map +2 -2
- package/dist/util/os.js +4 -0
- package/dist/util/os.js.map +1 -1
- package/dist/util/xml.formatter.js +4 -0
- package/dist/util/xml.formatter.js.map +1 -1
- package/dist/util/yaml.js +1 -2
- package/dist/util/yaml.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/esbuild.config.js +12 -16
- package/package.json +31 -32
- package/src/commands/copy.ts +3 -1
- package/src/commands/globalOptions.ts +10 -3
- package/src/commands/import.ts +2 -0
- package/src/commands/index.ts +4 -0
- package/src/commands/push.ts +125 -1
- package/src/commands/remove.ts +20 -0
- package/src/commands/update.ts +84 -0
- package/src/factories/RequestHandlerFactory.ts +1 -1
- package/src/localisation/en-GB.ts +16 -1
- package/src/models/CliService.d.ts +1 -1
- package/src/providers/CredentialProvider.ts +2 -2
- package/src/providers/SessionCacheProvider.ts +26 -2
- package/src/services/ContensisCliService.ts +187 -49
- package/src/services/ContensisDevService.ts +2 -2
- package/src/shell.ts +20 -9
- package/src/util/console.printer.ts +23 -19
- package/src/util/csv.formatter.ts +1 -1
- package/src/util/html.formatter.ts +52 -0
- package/src/util/index.ts +1 -1
- package/src/util/logger.ts +17 -16
- package/src/version.ts +1 -1
- package/tsconfig.json +1 -1
package/dist/commands/push.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -29,10 +33,99 @@ __export(push_exports, {
|
|
|
29
33
|
module.exports = __toCommonJS(push_exports);
|
|
30
34
|
var import_commander = require("commander");
|
|
31
35
|
var import_jsonpath_mapper = __toESM(require("jsonpath-mapper"));
|
|
36
|
+
var import_migratortron = require("migratortron");
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
32
38
|
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
39
|
+
var import_globalOptions = require("./globalOptions");
|
|
40
|
+
var import_json = require("../util/json.formatter");
|
|
41
|
+
var import_file_provider = require("../providers/file-provider");
|
|
33
42
|
const makePushCommand = () => {
|
|
34
43
|
const push = new import_commander.Command().command("push").description("push command").addHelpText("after", `
|
|
35
44
|
`).showHelpAfterError(true).exitOverride();
|
|
45
|
+
push.command("asset").description("push an asset").argument("<content-type-id>", "the content type id of the asset to push").argument(
|
|
46
|
+
"<title>",
|
|
47
|
+
"the title of the asset as it appears in the cms (use quotes)"
|
|
48
|
+
).argument(
|
|
49
|
+
"[description]",
|
|
50
|
+
"the description or altText of the asset (use quotes)"
|
|
51
|
+
).option(
|
|
52
|
+
"-from --from-file <fromFile>",
|
|
53
|
+
"the local file path of the source asset"
|
|
54
|
+
).option("-url --from-url <fromUrl>", "the full url of the source asset").option(
|
|
55
|
+
"-to --target-file-path <targetFilePath>",
|
|
56
|
+
'the file path in the cms project to push the asset to e.g. "/asset-library/"'
|
|
57
|
+
).option(
|
|
58
|
+
"-name --target-file-name <targetFileName>",
|
|
59
|
+
"set the file name in the cms project"
|
|
60
|
+
).option("-i --id <id>", "push the asset with a specific guid").addOption(import_globalOptions.commit).addOption(import_globalOptions.noPublish).addOption(import_globalOptions.outputDetail).addOption(import_globalOptions.saveEntries).usage("<content-type-id> <title> [description] [options]").addHelpText(
|
|
61
|
+
"after",
|
|
62
|
+
`
|
|
63
|
+
Example call:
|
|
64
|
+
> push asset pdf "Example file" "An example of a PDF asset" --from-file example.pdf --target-file-path /asset-library/pdf/
|
|
65
|
+
`
|
|
66
|
+
).action(
|
|
67
|
+
async (contentTypeId, title, description, opts) => {
|
|
68
|
+
const cli = (0, import_ContensisCliService.cliCommand)(
|
|
69
|
+
["push", "asset", contentTypeId, title, description],
|
|
70
|
+
opts,
|
|
71
|
+
(0, import_globalOptions.mapContensisOpts)({ preserveGuids: true, ...opts, id: void 0 })
|
|
72
|
+
);
|
|
73
|
+
const mapSourceVars = {
|
|
74
|
+
contentTypeId,
|
|
75
|
+
title,
|
|
76
|
+
description,
|
|
77
|
+
...opts
|
|
78
|
+
};
|
|
79
|
+
const assetEntry = (0, import_jsonpath_mapper.default)(mapSourceVars, {
|
|
80
|
+
entryTitle: "title",
|
|
81
|
+
title: "title",
|
|
82
|
+
entryDescription: "description",
|
|
83
|
+
description: "description",
|
|
84
|
+
altText: ({ contentTypeId: contentTypeId2, description: description2 }) => contentTypeId2 === "image" ? description2 : void 0,
|
|
85
|
+
sys: {
|
|
86
|
+
dataFormat: () => "asset",
|
|
87
|
+
contentTypeId: "contentTypeId",
|
|
88
|
+
id: "id",
|
|
89
|
+
isPublished: () => true,
|
|
90
|
+
// can be overridden by !opts.publish
|
|
91
|
+
properties: {
|
|
92
|
+
filename: {
|
|
93
|
+
$path: ["targetFileName", "fromFile", "fromUrl"],
|
|
94
|
+
$formatting: (nameOrPath) => {
|
|
95
|
+
return import_path.default.basename(nameOrPath);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
filePath: {
|
|
99
|
+
$path: "targetFilePath",
|
|
100
|
+
$default: (_, { fromFile, fromUrl }) => {
|
|
101
|
+
const toPosixPath = (windowsPath) => windowsPath.replace(/^(\w):|\\+/g, "/$1");
|
|
102
|
+
return import_path.default.dirname(
|
|
103
|
+
toPosixPath(fromFile || fromUrl.split(":/")[1])
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
uri: {
|
|
109
|
+
$path: ["fromFile", "fromUrl"],
|
|
110
|
+
$formatting: (from) => (from == null ? void 0 : from.startsWith("http")) ? from : (0, import_file_provider.cwdPath)(from)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (!assetEntry.sys.id)
|
|
115
|
+
assetEntry.sys.id = (0, import_migratortron.generateGuid)(
|
|
116
|
+
cli.currentEnv,
|
|
117
|
+
cli.currentProject,
|
|
118
|
+
`${assetEntry.sys.contentTypeId}-${assetEntry.sys.properties.filePath.replaceAll("/", "").toLowerCase()}-${assetEntry.sys.properties.filename.toLowerCase()}`
|
|
119
|
+
);
|
|
120
|
+
console.log((0, import_json.jsonFormatter)(assetEntry));
|
|
121
|
+
await cli.ImportEntries({
|
|
122
|
+
commit: opts.commit,
|
|
123
|
+
logOutput: opts.outputDetail,
|
|
124
|
+
saveEntries: opts.saveEntries,
|
|
125
|
+
data: [assetEntry]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
);
|
|
36
129
|
push.command("block").description("push a block").argument("<block-id>", "the name of the block to push to").argument(
|
|
37
130
|
"<image uri:tag>",
|
|
38
131
|
"the uri and tag of the container image to push as a block (tag default: latest)"
|
|
@@ -91,21 +184,16 @@ Example call:
|
|
|
91
184
|
provider: {
|
|
92
185
|
$path: ["provider"],
|
|
93
186
|
$return: (provider, { GITHUB_ACTIONS, GITLAB_CI }) => {
|
|
94
|
-
if (provider)
|
|
95
|
-
|
|
96
|
-
if (
|
|
97
|
-
return "Github";
|
|
98
|
-
else if (GITLAB_CI)
|
|
99
|
-
return "GitlabSelfHosted";
|
|
187
|
+
if (provider) return provider;
|
|
188
|
+
if (GITHUB_ACTIONS) return "Github";
|
|
189
|
+
else if (GITLAB_CI) return "GitlabSelfHosted";
|
|
100
190
|
}
|
|
101
191
|
},
|
|
102
192
|
repositoryUrl: {
|
|
103
193
|
$path: ["repositoryUrl", "CI_PROJECT_URL", "GITHUB_REPOSITORY"],
|
|
104
194
|
$formatting: (url, { GITHUB_ACTIONS }) => {
|
|
105
|
-
if (GITHUB_ACTIONS)
|
|
106
|
-
|
|
107
|
-
if (url && !url.endsWith(".git"))
|
|
108
|
-
return `${url}.git`;
|
|
195
|
+
if (GITHUB_ACTIONS) url = `https://github.com/${url}`;
|
|
196
|
+
if (url && !url.endsWith(".git")) return `${url}.git`;
|
|
109
197
|
return url;
|
|
110
198
|
}
|
|
111
199
|
},
|
|
@@ -114,15 +202,19 @@ Example call:
|
|
|
114
202
|
id: ["commitId", "CI_COMMIT_SHORT_SHA", "GITHUB_SHA"],
|
|
115
203
|
message: {
|
|
116
204
|
$path: ["commitMessage", "CI_COMMIT_MESSAGE"],
|
|
205
|
+
// ${{ github.event.head_commit.message }}
|
|
117
206
|
$formatting: (msg) => msg == null ? void 0 : msg.replace(/\\n/g, " ").replace(/\\n/g, " ").trim()
|
|
118
207
|
},
|
|
119
208
|
dateTime: ["commitDatetime", "CI_COMMIT_TIMESTAMP"],
|
|
209
|
+
// ${{ github.event.head_commit.timestamp }}
|
|
120
210
|
authorEmail: ["authorEmail", "GITLAB_USER_EMAIL", "GITHUB_ACTOR"],
|
|
211
|
+
// ${{ github.event.head_commit.author.email }}
|
|
121
212
|
committerEmail: [
|
|
122
213
|
"committerEmail",
|
|
123
214
|
"GITLAB_USER_EMAIL",
|
|
124
215
|
"GITHUB_TRIGGERING_ACTOR"
|
|
125
216
|
]
|
|
217
|
+
// ${{ github.event.head_commit.committer.email }}
|
|
126
218
|
}
|
|
127
219
|
}
|
|
128
220
|
});
|
|
@@ -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 .description('push command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n push\n .command('block')\n .description('push a block')\n .argument('<block-id>', 'the name of the block to push to')\n .argument(\n '<image uri:tag>',\n 'the uri and tag of the container image to push as a block (tag default: latest)'\n )\n .argument('[branch]', 'the branch we are pushing to')\n .option(\n '-r --release',\n 'whether to release the pushed block version',\n false\n )\n .option(\n '-cid --commit-id <commitId>',\n 'the id of the source git commit for the supplied image uri'\n )\n .option(\n '-cmsg --commit-message <commitMessage>',\n 'the git commit message for the supplied commit id'\n )\n .option(\n '-cdt --commit-datetime <commitDateTime>',\n 'the timestamp of the source git commit for the supplied image uri'\n )\n .option(\n '-author --author-email <authorEmail>',\n 'the git email address of the author of the source git commit'\n )\n .option(\n '-committer --committer-email <committerEmail>',\n 'the git email address of the commiter of the source git commit'\n )\n .option(\n '-repo --repository-url <repositoryUrl>',\n 'the url of the source repository for the supplied image uri'\n )\n .option(\n '-pr --provider <sourceProvider>',\n 'the source repository provider of the supplied image uri'\n )\n .usage('<block-id> <image uri> [branch] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\\n`\n )\n .action(async (blockId: string, imageUri: string, branch: string, opts) => {\n const cli = cliCommand(['push', 'block', blockId], opts);\n const mapSourceVars = {\n blockId,\n imageUri,\n branch,\n ...opts,\n ...process.env,\n };\n\n const blockRequest = mapJson(mapSourceVars, {\n release: { $path: 'release', $default: () => false },\n id: ['blockId'],\n image: () => {\n const lastIndexOfColon = imageUri.lastIndexOf(':');\n return {\n uri: imageUri.slice(0, lastIndexOfColon),\n tag: imageUri.slice(lastIndexOfColon + 1) || 'latest',\n };\n },\n projectId: () => cli.env.currentProject || '',\n source: {\n provider: {\n $path: ['provider'],\n $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {\n if (provider) return provider;\n if (GITHUB_ACTIONS) return 'Github';\n else if (GITLAB_CI) return 'GitlabSelfHosted';\n },\n },\n repositoryUrl: {\n $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],\n $formatting: (url: string, { GITHUB_ACTIONS }) => {\n if (GITHUB_ACTIONS) url = `https://github.com/${url}`;\n\n if (url && !url.endsWith('.git')) return `${url}.git`;\n return url;\n },\n },\n branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],\n commit: {\n id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],\n message: {\n $path: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}\n $formatting: (msg?: string) =>\n msg?.replace(/\\\\n/g, ' ').replace(/\\\\n/g, ' ').trim(),\n },\n dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}\n authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}\n committerEmail: [\n 'committerEmail',\n 'GITLAB_USER_EMAIL',\n 'GITHUB_TRIGGERING_ACTOR',\n ], // ${{ github.event.head_commit.committer.email }}\n },\n },\n }) as PushBlockParams;\n\n await cli.PushBlock(blockRequest);\n\n // console.log(process.env);\n });\n\n return push;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["mapJson"]
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport mapJson from 'jsonpath-mapper';\nimport { generateGuid, PushBlockParams } from 'migratortron';\nimport path from 'path';\nimport { Asset } from 'contensis-delivery-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n mapContensisOpts,\n noPublish,\n outputDetail,\n saveEntries,\n} from './globalOptions';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { cwdPath } from '~/providers/file-provider';\n\nexport const makePushCommand = () => {\n const push = new Command()\n .command('push')\n .description('push command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n push\n .command('asset')\n .description('push an asset')\n .argument('<content-type-id>', 'the content type id of the asset to push')\n .argument(\n '<title>',\n 'the title of the asset as it appears in the cms (use quotes)'\n )\n .argument(\n '[description]',\n 'the description or altText of the asset (use quotes)'\n )\n .option(\n '-from --from-file <fromFile>',\n 'the local file path of the source asset'\n )\n .option('-url --from-url <fromUrl>', 'the full url of the source asset')\n .option(\n '-to --target-file-path <targetFilePath>',\n 'the file path in the cms project to push the asset to e.g. \"/asset-library/\"'\n )\n .option(\n '-name --target-file-name <targetFileName>',\n 'set the file name in the cms project'\n )\n .option('-i --id <id>', 'push the asset with a specific guid')\n .addOption(commit)\n .addOption(noPublish)\n .addOption(outputDetail)\n .addOption(saveEntries)\n .usage('<content-type-id> <title> [description] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push asset pdf \"Example file\" \"An example of a PDF asset\" --from-file example.pdf --target-file-path /asset-library/pdf/\\n`\n )\n .action(\n async (\n contentTypeId: string,\n title: string,\n description: string,\n opts\n ) => {\n const cli = cliCommand(\n ['push', 'asset', contentTypeId, title, description],\n opts,\n mapContensisOpts({ preserveGuids: true, ...opts, id: undefined })\n );\n const mapSourceVars = {\n contentTypeId,\n title,\n description,\n ...opts,\n };\n\n const assetEntry: Asset = mapJson(mapSourceVars, {\n entryTitle: 'title',\n title: 'title',\n entryDescription: 'description',\n description: 'description',\n altText: ({ contentTypeId, description }) =>\n contentTypeId === 'image' ? description : undefined,\n sys: {\n dataFormat: () => 'asset',\n contentTypeId: 'contentTypeId',\n id: 'id',\n isPublished: () => true, // can be overridden by !opts.publish\n properties: {\n filename: {\n $path: ['targetFileName', 'fromFile', 'fromUrl'],\n $formatting: (nameOrPath: string) => {\n return path.basename(nameOrPath);\n },\n },\n filePath: {\n $path: 'targetFilePath',\n $default: (_, { fromFile, fromUrl }) => {\n const toPosixPath = (windowsPath: string) =>\n windowsPath.replace(/^(\\w):|\\\\+/g, '/$1');\n\n return path.dirname(\n toPosixPath(fromFile || fromUrl.split(':/')[1])\n );\n },\n },\n },\n uri: {\n $path: ['fromFile', 'fromUrl'],\n $formatting: (from: string) =>\n from?.startsWith('http') ? from : cwdPath(from),\n },\n },\n });\n\n if (!assetEntry.sys.id)\n assetEntry.sys.id = generateGuid(\n cli.currentEnv,\n cli.currentProject,\n `${assetEntry.sys.contentTypeId}-${assetEntry.sys.properties.filePath.replaceAll('/', '').toLowerCase()}-${assetEntry.sys.properties.filename.toLowerCase()}`\n );\n\n console.log(jsonFormatter(assetEntry));\n\n await cli.ImportEntries({\n commit: opts.commit,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n data: [assetEntry],\n });\n }\n );\n\n push\n .command('block')\n .description('push a block')\n .argument('<block-id>', 'the name of the block to push to')\n .argument(\n '<image uri:tag>',\n 'the uri and tag of the container image to push as a block (tag default: latest)'\n )\n .argument('[branch]', 'the branch we are pushing to')\n .option(\n '-r --release',\n 'whether to release the pushed block version',\n false\n )\n .option(\n '-cid --commit-id <commitId>',\n 'the id of the source git commit for the supplied image uri'\n )\n .option(\n '-cmsg --commit-message <commitMessage>',\n 'the git commit message for the supplied commit id'\n )\n .option(\n '-cdt --commit-datetime <commitDateTime>',\n 'the timestamp of the source git commit for the supplied image uri'\n )\n .option(\n '-author --author-email <authorEmail>',\n 'the git email address of the author of the source git commit'\n )\n .option(\n '-committer --committer-email <committerEmail>',\n 'the git email address of the commiter of the source git commit'\n )\n .option(\n '-repo --repository-url <repositoryUrl>',\n 'the url of the source repository for the supplied image uri'\n )\n .option(\n '-pr --provider <sourceProvider>',\n 'the source repository provider of the supplied image uri'\n )\n .usage('<block-id> <image uri> [branch] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\\n`\n )\n .action(async (blockId: string, imageUri: string, branch: string, opts) => {\n const cli = cliCommand(['push', 'block', blockId], opts);\n const mapSourceVars = {\n blockId,\n imageUri,\n branch,\n ...opts,\n ...process.env,\n };\n\n const blockRequest = mapJson(mapSourceVars, {\n release: { $path: 'release', $default: () => false },\n id: ['blockId'],\n image: () => {\n const lastIndexOfColon = imageUri.lastIndexOf(':');\n return {\n uri: imageUri.slice(0, lastIndexOfColon),\n tag: imageUri.slice(lastIndexOfColon + 1) || 'latest',\n };\n },\n projectId: () => cli.env.currentProject || '',\n source: {\n provider: {\n $path: ['provider'],\n $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {\n if (provider) return provider;\n if (GITHUB_ACTIONS) return 'Github';\n else if (GITLAB_CI) return 'GitlabSelfHosted';\n },\n },\n repositoryUrl: {\n $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],\n $formatting: (url: string, { GITHUB_ACTIONS }) => {\n if (GITHUB_ACTIONS) url = `https://github.com/${url}`;\n\n if (url && !url.endsWith('.git')) return `${url}.git`;\n return url;\n },\n },\n branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],\n commit: {\n id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],\n message: {\n $path: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}\n $formatting: (msg?: string) =>\n msg?.replace(/\\\\n/g, ' ').replace(/\\\\n/g, ' ').trim(),\n },\n dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}\n authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}\n committerEmail: [\n 'committerEmail',\n 'GITLAB_USER_EMAIL',\n 'GITHUB_TRIGGERING_ACTOR',\n ], // ${{ github.event.head_commit.committer.email }}\n },\n },\n }) as PushBlockParams;\n\n await cli.PushBlock(blockRequest);\n\n // console.log(process.env);\n });\n\n return push;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,6BAAoB;AACpB,0BAA8C;AAC9C,kBAAiB;AAEjB,iCAA2B;AAC3B,2BAMO;AACP,kBAA8B;AAC9B,2BAAwB;AAEjB,MAAM,kBAAkB,MAAM;AACnC,QAAM,OAAO,IAAI,yBAAQ,EACtB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,OACG,QAAQ,OAAO,EACf,YAAY,eAAe,EAC3B,SAAS,qBAAqB,0C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D,QAAQ;AAAA,UACN,IAAI,CAAC,YAAY,uBAAuB,YAAY;AAAA,UACpD,SAAS;AAAA,YACP,OAAO,CAAC,iBAAiB,mBAAmB;AAAA;AAAA,YAC5C,aAAa,CAAC,QACZ,2BAAK,QAAQ,QAAQ,KAAK,QAAQ,QAAQ,KAAK;AAAA,UACnD;AAAA,UACA,UAAU,CAAC,kBAAkB,qBAAqB;AAAA;AAAA,UAClD,aAAa,CAAC,eAAe,qBAAqB,cAAc;AAAA;AAAA,UAChE,gBAAgB;AAAA,YACd;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,IAAI,UAAU,YAAY;AAAA,EAGlC,CAAC;AAEH,SAAO;AACT;",
|
|
6
|
+
"names": ["mapJson", "contentTypeId", "description", "path"]
|
|
7
7
|
}
|
package/dist/commands/remove.js
CHANGED
|
@@ -29,14 +29,26 @@ var import_globalOptions = require("./globalOptions");
|
|
|
29
29
|
const makeRemoveCommand = () => {
|
|
30
30
|
const remove = new import_commander.Command().command("remove").description("remove command").addHelpText("after", `
|
|
31
31
|
`).showHelpAfterError(true).exitOverride();
|
|
32
|
+
remove.command("env").description("Remove a previously connected environment from the CLI").argument("<alias>", "the Contensis Cloud alias to remove").usage("<alias>").addHelpText(
|
|
33
|
+
"after",
|
|
34
|
+
`
|
|
35
|
+
Example call:
|
|
36
|
+
> remove env ludlow-uni-dev
|
|
37
|
+
`
|
|
38
|
+
).action(async (alias, opts) => {
|
|
39
|
+
const currentEnvironment = await (0, import_ContensisCliService.cliCommand)(
|
|
40
|
+
["remove", "env", alias],
|
|
41
|
+
opts
|
|
42
|
+
).RemoveEnvironment(alias);
|
|
43
|
+
if (!currentEnvironment) await (0, import_shell.shell)().restart();
|
|
44
|
+
});
|
|
32
45
|
remove.command("project").description("remove an entire project").argument("<projectId>", "the project id to delete").usage("<projectId>").addHelpText("after", `
|
|
33
46
|
`).action(async (projectId, opts) => {
|
|
34
47
|
const project = await (0, import_ContensisCliService.cliCommand)(
|
|
35
48
|
["remove", "project", projectId],
|
|
36
49
|
opts
|
|
37
50
|
).SetProject(projectId);
|
|
38
|
-
if (project)
|
|
39
|
-
await (0, import_shell.shell)().restart();
|
|
51
|
+
if (project) await (0, import_shell.shell)().restart();
|
|
40
52
|
});
|
|
41
53
|
remove.command("key").description("remove api key").argument("<id>", "the id of the API key to delete").usage("<id>").addHelpText(
|
|
42
54
|
"after",
|
|
@@ -94,8 +106,7 @@ Example call:
|
|
|
94
106
|
`
|
|
95
107
|
).action(async (entryIds, opts) => {
|
|
96
108
|
const removeAll = (entryIds == null ? void 0 : entryIds[0]) === "***";
|
|
97
|
-
if ((entryIds == null ? void 0 : entryIds[0]) && !entryIds[0].replace(/\*/g, ""))
|
|
98
|
-
entryIds.pop();
|
|
109
|
+
if ((entryIds == null ? void 0 : entryIds[0]) && !entryIds[0].replace(/\*/g, "")) entryIds.pop();
|
|
99
110
|
const hasArgs = !!((entryIds == null ? void 0 : entryIds.length) || opts.zenql || removeAll);
|
|
100
111
|
if (!hasArgs) {
|
|
101
112
|
import_logger.Logger.help(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/remove.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\nimport { Logger } from '~/util/logger';\nimport { commit, mapContensisOpts, zenql } from './globalOptions';\n\nexport const makeRemoveCommand = () => {\n const remove = new Command()\n .command('remove')\n .description('remove command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n remove\n .command('project')\n .description('remove an entire project')\n .argument('<projectId>', 'the project id to delete')\n .usage('<projectId>')\n .addHelpText('after', `\\n`)\n .action(async (projectId, opts) => {\n const project = await cliCommand(\n ['remove', 'project', projectId],\n opts\n ).SetProject(projectId);\n if (project) await shell().restart();\n });\n\n remove\n .command('key')\n .description('remove api key')\n .argument('<id>', 'the id of the API key to delete')\n .usage('<id>')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove key 4ceb9575-28d3-4d5b-a77b-5e5221e603dd\n`\n )\n .action(async (id, opts) => {\n await cliCommand(['remove', 'key', id], opts).RemoveApiKey(id);\n });\n\n remove\n .command('role')\n .description('remove a role')\n .argument('<\"Role name\" or id>', 'the existing role name or id to delete')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove role \"My role\"\\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['remove', 'role', roleNameOrId], opts).RemoveRole(\n roleNameOrId\n );\n });\n\n remove\n .command('components')\n .description('delete components')\n .argument('<id...>', 'the id(s) of the components to delete')\n .addOption(commit)\n .usage('<id> [--commit]')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove components addressComponent\n`\n )\n .action(async (id: string[], opts) => {\n await cliCommand(\n ['remove', 'components', id.join(' ')],\n opts\n ).RemoveComponents(id, opts.commit);\n });\n\n remove\n .command('contenttypes')\n .description('delete content types')\n .argument('<id...>', 'the id(s) of the content types to delete')\n .addOption(commit)\n .usage('<id> [--commit]')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove contenttypes blogPost\n`\n )\n .action(async (id: string[], opts) => {\n await cliCommand(\n ['remove', 'contenttypes', id.join(' ')],\n opts\n ).RemoveContentTypes(id, opts.commit);\n });\n\n const removeEntries = remove\n .command('entries')\n .description('delete entries')\n .argument(\n '[ids...]',\n 'the entry id(s) to delete ...or add *** if you wish to delete all entries in all content types'\n )\n .addOption(zenql)\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > remove entries a1c25591-8c9b-50e2-96d8-f6c774fcf023 8df914cc-1da1-59d6-86e0-8ea4ebd99aaa\n > remove entries --zenql \"sys.contentTypeId = test\"\n`\n )\n .action(async (entryIds: string[], opts) => {\n const removeAll = entryIds?.[0] === '***';\n\n // Remove all asterisks from args\n if (entryIds?.[0] && !entryIds[0].replace(/\\*/g, '')) entryIds.pop();\n\n const hasArgs = !!(entryIds?.length || opts.zenql || removeAll);\n if (!hasArgs) {\n Logger.help(\n `Not enough arguments supplied\\n\\n${removeEntries.helpInformation()}`\n );\n } else {\n await cliCommand(\n ['remove', 'entries', entryIds.join(' ')],\n opts,\n mapContensisOpts({ entryIds, ...opts })\n ).RemoveEntries(opts.commit);\n }\n });\n\n remove\n .command('nodes')\n .description('delete nodes from the site view tree')\n .argument('<root>', 'remove nodes from the specified path e.g. /blog or /')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > remove nodes /blog\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(\n ['remove', 'nodes', root],\n opts,\n mapContensisOpts({ paths: root.split(' '), ...opts })\n ).RemoveNodes(opts.commit);\n });\n\n return remove;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,mBAAsB;AACtB,oBAAuB;AACvB,2BAAgD;AAEzC,MAAM,oBAAoB,MAAM;AACrC,QAAM,SAAS,IAAI,yBAAQ,EACxB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,SACG,QAAQ,SAAS,EACjB,YAAY,0BAA0B,EACtC,SAAS,eAAe,0BAA0B,EAClD,MAAM,aAAa,EACnB,YAAY,SAAS;AAAA,CAAI,EACzB,OAAO,OAAO,WAAW,SAAS;AACjC,UAAM,UAAU,UAAM;AAAA,MACpB,CAAC,UAAU,WAAW,SAAS;AAAA,MAC/B;AAAA,IACF,EAAE,WAAW,SAAS;AACtB,QAAI
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\nimport { Logger } from '~/util/logger';\nimport { commit, mapContensisOpts, zenql } from './globalOptions';\n\nexport const makeRemoveCommand = () => {\n const remove = new Command()\n .command('remove')\n .description('remove command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n remove\n .command('env')\n .description('Remove a previously connected environment from the CLI')\n .argument('<alias>', 'the Contensis Cloud alias to remove')\n .usage('<alias>')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove env ludlow-uni-dev\n`\n )\n .action(async (alias: string, opts) => {\n const currentEnvironment = await cliCommand(\n ['remove', 'env', alias],\n opts\n ).RemoveEnvironment(alias);\n if (!currentEnvironment) await shell().restart();\n });\n\n remove\n .command('project')\n .description('remove an entire project')\n .argument('<projectId>', 'the project id to delete')\n .usage('<projectId>')\n .addHelpText('after', `\\n`)\n .action(async (projectId, opts) => {\n const project = await cliCommand(\n ['remove', 'project', projectId],\n opts\n ).SetProject(projectId);\n if (project) await shell().restart();\n });\n\n remove\n .command('key')\n .description('remove api key')\n .argument('<id>', 'the id of the API key to delete')\n .usage('<id>')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove key 4ceb9575-28d3-4d5b-a77b-5e5221e603dd\n`\n )\n .action(async (id, opts) => {\n await cliCommand(['remove', 'key', id], opts).RemoveApiKey(id);\n });\n\n remove\n .command('role')\n .description('remove a role')\n .argument('<\"Role name\" or id>', 'the existing role name or id to delete')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove role \"My role\"\\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['remove', 'role', roleNameOrId], opts).RemoveRole(\n roleNameOrId\n );\n });\n\n remove\n .command('components')\n .description('delete components')\n .argument('<id...>', 'the id(s) of the components to delete')\n .addOption(commit)\n .usage('<id> [--commit]')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove components addressComponent\n`\n )\n .action(async (id: string[], opts) => {\n await cliCommand(\n ['remove', 'components', id.join(' ')],\n opts\n ).RemoveComponents(id, opts.commit);\n });\n\n remove\n .command('contenttypes')\n .description('delete content types')\n .argument('<id...>', 'the id(s) of the content types to delete')\n .addOption(commit)\n .usage('<id> [--commit]')\n .addHelpText(\n 'after',\n `\nExample call:\n > remove contenttypes blogPost\n`\n )\n .action(async (id: string[], opts) => {\n await cliCommand(\n ['remove', 'contenttypes', id.join(' ')],\n opts\n ).RemoveContentTypes(id, opts.commit);\n });\n\n const removeEntries = remove\n .command('entries')\n .description('delete entries')\n .argument(\n '[ids...]',\n 'the entry id(s) to delete ...or add *** if you wish to delete all entries in all content types'\n )\n .addOption(zenql)\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > remove entries a1c25591-8c9b-50e2-96d8-f6c774fcf023 8df914cc-1da1-59d6-86e0-8ea4ebd99aaa\n > remove entries --zenql \"sys.contentTypeId = test\"\n`\n )\n .action(async (entryIds: string[], opts) => {\n const removeAll = entryIds?.[0] === '***';\n\n // Remove all asterisks from args\n if (entryIds?.[0] && !entryIds[0].replace(/\\*/g, '')) entryIds.pop();\n\n const hasArgs = !!(entryIds?.length || opts.zenql || removeAll);\n if (!hasArgs) {\n Logger.help(\n `Not enough arguments supplied\\n\\n${removeEntries.helpInformation()}`\n );\n } else {\n await cliCommand(\n ['remove', 'entries', entryIds.join(' ')],\n opts,\n mapContensisOpts({ entryIds, ...opts })\n ).RemoveEntries(opts.commit);\n }\n });\n\n remove\n .command('nodes')\n .description('delete nodes from the site view tree')\n .argument('<root>', 'remove nodes from the specified path e.g. /blog or /')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > remove nodes /blog\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(\n ['remove', 'nodes', root],\n opts,\n mapContensisOpts({ paths: root.split(' '), ...opts })\n ).RemoveNodes(opts.commit);\n });\n\n return remove;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,mBAAsB;AACtB,oBAAuB;AACvB,2BAAgD;AAEzC,MAAM,oBAAoB,MAAM;AACrC,Q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AAAA;AAAA,EAAoC,cAAc,gBAAgB,CAAC;AAAA,MACrE;AAAA,IACF,OAAO;AACL,gBAAM;AAAA,QACJ,CAAC,UAAU,WAAW,SAAS,KAAK,GAAG,CAAC;AAAA,QACxC;AAAA,YACA,uCAAiB,EAAE,UAAU,GAAG,KAAK,CAAC;AAAA,MACxC,EAAE,cAAc,KAAK,MAAM;AAAA,IAC7B;AAAA,EACF,CAAC;AAEH,SACG,QAAQ,OAAO,EACf,YAAY,sCAAsC,EAClD,SAAS,UAAU,sDAAsD,EACzE,UAAU,2BAAM,EAChB;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,MAAc,SAAS;AACpC,cAAM;AAAA,MACJ,CAAC,UAAU,SAAS,IAAI;AAAA,MACxB;AAAA,UACA,uCAAiB,EAAE,OAAO,KAAK,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC;AAAA,IACtD,EAAE,YAAY,KAAK,MAAM;AAAA,EAC3B,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/set.js
CHANGED
|
@@ -39,8 +39,7 @@ Example call:
|
|
|
39
39
|
"project",
|
|
40
40
|
projectId
|
|
41
41
|
]).SetProject(projectId);
|
|
42
|
-
if (nextProjectId)
|
|
43
|
-
await (0, import_shell.shell)().restart();
|
|
42
|
+
if (nextProjectId) await (0, import_shell.shell)().restart();
|
|
44
43
|
});
|
|
45
44
|
project.command("name").description("update project name").argument('<"Project name">', "update the current project name").usage('<"Project name">').addHelpText(
|
|
46
45
|
"after",
|
|
@@ -170,8 +169,7 @@ Example call:
|
|
|
170
169
|
const success = (0, import_ContensisCliService.cliCommand)(["set", "version", versionStatus]).SetVersion(
|
|
171
170
|
versionStatus
|
|
172
171
|
);
|
|
173
|
-
if (success)
|
|
174
|
-
await (0, import_shell.shell)().restart();
|
|
172
|
+
if (success) await (0, import_shell.shell)().restart();
|
|
175
173
|
});
|
|
176
174
|
return set;
|
|
177
175
|
};
|
package/dist/commands/set.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/set.ts"],
|
|
4
4
|
"sourcesContent": ["import { Argument, Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeSetCommand = () => {\n const set = new Command()\n .command('set')\n .description('set command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n const project = set\n .command('project')\n .description('set current working project')\n .argument('<projectId>', 'the project id to work with')\n .usage('<projectId>')\n .addHelpText(\n 'after',\n `\nExample call:\n > set project website\\n`\n )\n .action(async projectId => {\n const nextProjectId = cliCommand([\n 'set',\n 'project',\n projectId,\n ]).SetProject(projectId);\n if (nextProjectId) await shell().restart();\n });\n\n project\n .command('name')\n .description('update project name')\n .argument('<\"Project name\">', 'update the current project name')\n .usage('<\"Project name\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set project name \"Project name\"\\n`\n )\n .action(async (name: string, opts) => {\n await cliCommand(['set', 'project', 'name'], opts).UpdateProject({\n name,\n });\n });\n\n project\n .command('description')\n .description('update project description')\n .argument(\n '<\"Project description\">',\n 'update the current project description'\n )\n .usage('<\"Project description\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set project description \"Description of project\"\\n`\n )\n .action(async (description: string, opts) => {\n await cliCommand(['set', 'project', 'description'], opts).UpdateProject({\n description,\n });\n });\n\n const role = set.command('role').description('update a role');\n\n role\n .command('name')\n .description('update role name')\n .argument('<\"Role name\">', 'update the existing role name')\n .argument('<\"New name\">', 'the new name for the role')\n .usage('<\"Role name\"> <\"New name\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set role name \"Existing name\" \"New role name\"\\n`\n )\n .action(async (roleNameOrId: string, newName: string, opts) => {\n await cliCommand(['set', 'role', 'name'], opts).UpdateRole(roleNameOrId, {\n name: newName,\n });\n });\n\n role\n .command('description')\n .description('update role description')\n .argument('<\"Role name\" or id>', 'the existing role name or id to update')\n .argument('<\"New description\">', 'the new description for the role')\n .usage('<\"Role name\"> <\"New description\">')\n .addHelpText(\n 'after',\n `\nExample call:\n > set role description \"Existing role\" \"New role description\"\\n`\n )\n .action(async (roleNameOrId: string, description: string, opts) => {\n await cliCommand(['set', 'role', 'description'], opts).UpdateRole(\n roleNameOrId,\n {\n description,\n }\n );\n });\n\n role\n .command('enabled')\n .description('enable or disable a role')\n .argument('<\"Role name\" or id>', 'the existing role name or id to update')\n .usage('<\"Role name\"> --disabled')\n .option('--disabled', 'disable the role', false)\n .addHelpText(\n 'after',\n `\nExample call:\n > set role enabled \"Existing role\"\\n\n > set role enabled \"Other role\" --disabled\\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(\n ['set', 'role', opts.disabled ? 'disabled' : 'enabled'],\n opts\n ).UpdateRole(roleNameOrId, {\n enabled: !opts.disabled,\n });\n });\n\n role\n .command('assignments')\n .description('assign users, groups or keys to a role')\n .argument('<\"Role name\" or id>', 'the role name or id to update')\n .option(\n '-users --assign-users [assign-users...]',\n 'the user id(s) to assign'\n )\n .option(\n '-groups --assign-groups [assign-groups...]',\n 'the groups name(s) to assign'\n )\n .option('-keys --assign-keys [assign-keys...]', 'the key name(s) to assign')\n .addHelpText(\n 'after',\n `\nExample call:\n > set role assignments \"My role\" --assign-users admin \\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['set', 'role', 'assignments'], opts).UpdateRole(\n roleNameOrId,\n {\n assignments: {\n apiKeys: opts.assignKeys || undefined,\n groups: opts.assignGroups || undefined,\n users: opts.assignUsers || undefined,\n },\n }\n );\n });\n\n role\n .command('permissions')\n .description('add entry permissions to a role')\n .argument('<\"Role name\" or id>', 'the role name or id to update')\n .option(\n '-contenttypes --content-type-ids [content-type-id...]',\n 'any content type ids to add permissions for'\n )\n .option(\n '--entry-actions [entry-actions...]',\n 'the entry actions to add to the role permissions'\n )\n .option(\n '--entry-languages [entry-languages...]',\n 'the entry languages to add to the role permissions'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > set role permissions \"My role\" --content-type-id blogs -- \\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['set', 'role', 'permissions'], opts).UpdateRole(\n roleNameOrId,\n {\n permissions: {\n entries: opts.contentTypeIds?.map((id: string) => ({\n id,\n actions: opts.entryActions || [],\n languages: opts.entryLanguages || [],\n })),\n },\n }\n );\n });\n\n set\n .command('version')\n .description('set content version')\n .addArgument(\n new Argument('<versionStatus>', 'content version status')\n .choices(['latest', 'published'])\n .default('latest')\n )\n .usage('<latest/published>')\n .addHelpText('after', `\\n`)\n .action(async versionStatus => {\n const success = cliCommand(['set', 'version', versionStatus]).SetVersion(\n versionStatus\n );\n if (success) await shell().restart();\n });\n\n return set;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAC3B,mBAAsB;AAEf,MAAM,iBAAiB,MAAM;AAClC,QAAM,MAAM,IAAI,yBAAQ,EACrB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,QAAM,UAAU,IACb,QAAQ,SAAS,EACjB,YAAY,6BAA6B,EACzC,SAAS,eAAe,6BAA6B,EACrD,MAAM,aAAa,EACnB;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAM,cAAa;AACzB,UAAM,oBAAgB,uCAAW;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,EAAE,WAAW,SAAS;AACvB,QAAI
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAC3B,mBAAsB;AAEf,MAAM,iBAAiB,MAAM;A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AM,EAAE,QAAQ;AAAA,EACrC,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 update_exports = {};
|
|
20
|
+
__export(update_exports, {
|
|
21
|
+
makeUpdateCommand: () => makeUpdateCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(update_exports);
|
|
24
|
+
var import_commander = require("commander");
|
|
25
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
+
var import_globalOptions = require("./globalOptions");
|
|
27
|
+
const makeUpdateCommand = () => {
|
|
28
|
+
const update = new import_commander.Command().command("update").description("update command").addHelpText("after", `
|
|
29
|
+
`).showHelpAfterError(true).exitOverride();
|
|
30
|
+
update.command("field").description("find and replace within entry fields").argument("<fieldId>", "the id of the field to update").argument(
|
|
31
|
+
"<find>",
|
|
32
|
+
"the string to find within each entry/field (surround a phrase in double quotes)"
|
|
33
|
+
).argument(
|
|
34
|
+
"<replace>",
|
|
35
|
+
"the string to replace with (surround a phrase in double quotes)"
|
|
36
|
+
).addOption(import_globalOptions.commit).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.outputDetail.default("changes")).addOption(import_globalOptions.noCache).addOption(import_globalOptions.noPublish).option(
|
|
37
|
+
"--search <phrase>",
|
|
38
|
+
"get entries with the search phrase, use quotes for multiple words"
|
|
39
|
+
).addOption(import_globalOptions.entryId).addOption(import_globalOptions.zenql).addOption(import_globalOptions.latest).addOption(import_globalOptions.versionStatus).addOption(import_globalOptions.saveEntries).usage("<fieldId> <find> <replace> (all arguments required)").addHelpText(
|
|
40
|
+
"after",
|
|
41
|
+
`
|
|
42
|
+
Example call:
|
|
43
|
+
> update field authorName "Emma Smith" "Emma Davies" --zenql "sys.contentTypeId=blog"
|
|
44
|
+
`
|
|
45
|
+
).action(
|
|
46
|
+
async (fieldId, find, replace, opts) => {
|
|
47
|
+
const updateField = {
|
|
48
|
+
fieldId,
|
|
49
|
+
find,
|
|
50
|
+
replace
|
|
51
|
+
};
|
|
52
|
+
return await (0, import_ContensisCliService.cliCommand)(
|
|
53
|
+
["update", "field", fieldId, find, replace],
|
|
54
|
+
opts,
|
|
55
|
+
(0, import_globalOptions.mapContensisOpts)({ updateField, ...opts })
|
|
56
|
+
).UpdateEntryField({
|
|
57
|
+
commit: opts.commit,
|
|
58
|
+
fromFile: opts.fromFile,
|
|
59
|
+
logOutput: opts.outputDetail,
|
|
60
|
+
saveEntries: opts.saveEntries
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
return update;
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
makeUpdateCommand
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/update.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { UpdateField } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\n entryId,\n ignoreErrors,\n latest,\n mapContensisOpts,\n noCache,\n noPublish,\n outputDetail,\n saveEntries,\n versionStatus,\n zenql,\n} from './globalOptions';\n\nexport const makeUpdateCommand = () => {\n const update = new Command()\n .command('update')\n .description('update command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n update\n .command('field')\n .description('find and replace within entry fields')\n .argument('<fieldId>', 'the id of the field to update')\n .argument(\n '<find>',\n 'the string to find within each entry/field (surround a phrase in double quotes)'\n )\n .argument(\n '<replace>',\n 'the string to replace with (surround a phrase in double quotes)'\n )\n .addOption(commit)\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .addOption(outputDetail.default('changes'))\n .addOption(noCache)\n .addOption(noPublish)\n .option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(entryId)\n .addOption(zenql)\n .addOption(latest)\n .addOption(versionStatus)\n .addOption(saveEntries)\n .usage('<fieldId> <find> <replace> (all arguments required)')\n .addHelpText(\n 'after',\n `\nExample call:\n > update field authorName \"Emma Smith\" \"Emma Davies\" --zenql \"sys.contentTypeId=blog\"\\n`\n )\n .action(\n async (fieldId: string, find: string, replace: string, opts: any) => {\n const updateField: UpdateField = {\n fieldId,\n find,\n replace,\n };\n\n return await cliCommand(\n ['update', 'field', fieldId, find, replace],\n opts,\n mapContensisOpts({ updateField, ...opts })\n ).UpdateEntryField({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n });\n }\n );\n\n return update;\n};\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,2BAaO;AAEA,MAAM,oBAAoB,MAAM;AACrC,QAAM,SAAS,IAAI,yBAAQ,EACxB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,SACG,QAAQ,OAAO,EACf,YAAY,sCAAsC,EAClD,SAAS,aAAa,+BAA+B,EACrD;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,2BAAM,EAChB,UAAU,gCAAW,EACrB,UAAU,iCAAY,EACtB,UAAU,kCAAa,QAAQ,SAAS,CAAC,EACzC,UAAU,4BAAO,EACjB,UAAU,8BAAS,EACnB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,4BAAO,EACjB,UAAU,0BAAK,EACf,UAAU,2BAAM,EAChB,UAAU,kCAAa,EACvB,UAAU,gCAAW,EACrB,MAAM,qDAAqD,EAC3D;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC;AAAA,IACC,OAAO,SAAiB,MAAc,SAAiB,SAAc;AACnE,YAAM,cAA2B;AAAA,QAC/B;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,aAAO,UAAM;AAAA,QACX,CAAC,UAAU,SAAS,SAAS,MAAM,OAAO;AAAA,QAC1C;AAAA,YACA,uCAAiB,EAAE,aAAa,GAAG,KAAK,CAAC;AAAA,MAC3C,EAAE,iBAAiB;AAAA,QACjB,QAAQ,KAAK;AAAA,QACb,UAAU,KAAK;AAAA,QACf,WAAW,KAAK;AAAA,QAChB,aAAa,KAAK;AAAA,MACpB,CAAC;AAAA,IACH;AAAA,EACF;AAEF,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -43,11 +47,13 @@ class RequestHandlerFactory {
|
|
|
43
47
|
log = import_logger.Logger;
|
|
44
48
|
messages = import_en_GB.LogMessages;
|
|
45
49
|
manifest = new import_ManifestProvider.default();
|
|
50
|
+
// Load cli-manifest.json
|
|
46
51
|
basePath = import_path.default.join(import_file_provider.appRootDir);
|
|
47
52
|
name = "request-handler-localdevelopment";
|
|
48
53
|
cmd = "Zengenti.Contensis.RequestHandler.LocalDevelopment";
|
|
49
54
|
prerelease;
|
|
50
55
|
version;
|
|
56
|
+
// pass in a specific release version to run
|
|
51
57
|
get exePath() {
|
|
52
58
|
return import_path.default.join(this.basePath, `${this.name}-${this.moduleInfo.version}`);
|
|
53
59
|
}
|
|
@@ -61,6 +67,8 @@ class RequestHandlerFactory {
|
|
|
61
67
|
this.prerelease = prerelease;
|
|
62
68
|
this.version = version;
|
|
63
69
|
}
|
|
70
|
+
// Use the factory to create a request handler instance
|
|
71
|
+
// handling the download and updating of the external binary
|
|
64
72
|
async Create() {
|
|
65
73
|
const { moduleInfo, version } = this;
|
|
66
74
|
const downloadImmediately = !(moduleInfo == null ? void 0 : moduleInfo.version) || (moduleInfo == null ? void 0 : moduleInfo.version) === "*" || this.version;
|
|
@@ -69,8 +77,7 @@ class RequestHandlerFactory {
|
|
|
69
77
|
await this.CheckUpdate({ verbose: true, version });
|
|
70
78
|
}
|
|
71
79
|
await this.ApplyUpdate();
|
|
72
|
-
if (!downloadImmediately)
|
|
73
|
-
this.CheckUpdate();
|
|
80
|
+
if (!downloadImmediately) this.CheckUpdate();
|
|
74
81
|
return this.CreateInvoke(this);
|
|
75
82
|
}
|
|
76
83
|
CreateInvoke(self = this) {
|
|
@@ -110,8 +117,7 @@ class RequestHandlerFactory {
|
|
|
110
117
|
});
|
|
111
118
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
112
119
|
while (true) {
|
|
113
|
-
if (!isRunning)
|
|
114
|
-
return;
|
|
120
|
+
if (!isRunning) return;
|
|
115
121
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
116
122
|
}
|
|
117
123
|
};
|
|
@@ -153,6 +159,7 @@ ${release.html_url}`
|
|
|
153
159
|
await github.DownloadRelease(release, {
|
|
154
160
|
cmd,
|
|
155
161
|
path: downloadPath,
|
|
162
|
+
// Map NodeJS os platform to release asset name
|
|
156
163
|
platforms: [
|
|
157
164
|
["win32", "win-x64"],
|
|
158
165
|
["darwin", "osx-x64"],
|
|
@@ -188,7 +195,7 @@ ${release.html_url}`
|
|
|
188
195
|
async ApplyUpdate() {
|
|
189
196
|
const { manifest, messages, moduleInfo } = this;
|
|
190
197
|
if (moduleInfo.install && moduleInfo.version !== moduleInfo.install) {
|
|
191
|
-
|
|
198
|
+
const { apply } = moduleInfo.version === "*" ? { apply: true } : await import_inquirer.default.prompt({
|
|
192
199
|
name: "apply",
|
|
193
200
|
type: "confirm",
|
|
194
201
|
message: messages.devrequests.install.applyUpdate(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/factories/RequestHandlerFactory.ts"],
|
|
4
|
-
"sourcesContent": ["import { spawn } from 'child_process';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\nimport path from 'path';\nimport { LogMessages } from '~/localisation/en-GB';\nimport GitHubCliModuleProvider from '~/providers/GitHubCliModuleProvider';\n\nimport ManifestProvider from '~/providers/ManifestProvider';\nimport { appRootDir, checkDir, joinPath } from '~/providers/file-provider';\nimport { isDebug } from '~/util/debug';\nimport { Logger } from '~/util/logger';\n\nexport class RequestHandlerFactory {\n debug = isDebug();\n log = Logger;\n messages = LogMessages;\n manifest = new ManifestProvider(); // Load cli-manifest.json\n\n basePath = path.join(appRootDir);\n name = 'request-handler-localdevelopment';\n cmd = 'Zengenti.Contensis.RequestHandler.LocalDevelopment';\n\n prerelease;\n version; // pass in a specific release version to run\n\n get exePath() {\n return path.join(this.basePath, `${this.name}-${this.moduleInfo.version}`);\n }\n\n get moduleInfo() {\n return (\n this.manifest.getModule(this.name) || {\n github: 'contensis/request-handler-localdevelopment',\n version: '*',\n }\n );\n }\n\n constructor(version?: string, prerelease = false) {\n this.prerelease = prerelease;\n this.version = version;\n }\n\n // Use the factory to create a request handler instance\n // handling the download and updating of the external binary\n async Create() {\n const { moduleInfo, version } = this;\n const downloadImmediately =\n !moduleInfo?.version || moduleInfo?.version === '*' || this.version;\n\n if (downloadImmediately) {\n // Create cli-manifest.json\n this.manifest.writeModule(this.name, this.moduleInfo);\n\n // Download for first time use (await)\n await this.CheckUpdate({ verbose: true, version });\n }\n\n // Apply any downloaded/pending update so we launch that version\n await this.ApplyUpdate();\n\n // Fire an async update check and continue working in the background (do not await)\n if (!downloadImmediately) this.CheckUpdate();\n\n // Return a RequestHandler ready to invoke\n return this.CreateInvoke(this);\n }\n\n CreateInvoke(self = this) {\n // Hoist the vars we need from `this` as we lose scope\n // when the function is returned from the Create() method\n const { debug, log, messages, cmd, exePath } = self;\n\n // Invoke request handler method\n return async (args: string[]) => {\n const child = spawn(joinPath(exePath, cmd), args, { stdio: 'inherit' });\n\n if (args?.length && debug)\n log.warning(\n `Spawning process with supplied args: ${JSON.stringify(\n child.spawnargs,\n null,\n 2\n )}`\n );\n\n let isRunning = false;\n\n // Log child output through event listeners\n child?.stdout?.on('data', data => {\n isRunning = true;\n log.raw(data);\n });\n\n child?.stderr?.on('data', data => {\n log.error(data);\n });\n\n child.on('spawn', () => {\n isRunning = true;\n log.help(messages.devrequests.spawn());\n });\n\n child.on('exit', code => {\n isRunning = false;\n\n log[code === 0 ? 'success' : 'warning'](\n messages.devrequests.exited(code)\n );\n });\n\n child.on('error', error => {\n isRunning = false;\n log.error(messages.devrequests.errored(error));\n });\n\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n // keep the method running until we can return\n while (true === true) {\n if (!isRunning) return;\n await new Promise(resolve => setTimeout(resolve, 1000));\n }\n };\n }\n\n async CheckUpdate({\n verbose = false,\n version,\n }: { verbose?: boolean; version?: string } = {}) {\n const { cmd, debug, log, manifest, messages, moduleInfo } = this;\n\n const github = new GitHubCliModuleProvider(moduleInfo.github);\n\n // Find latest version\n const release = await github.FindLatestRelease(version);\n\n if (verbose || debug)\n if (release)\n log.info(\n `${messages.devrequests.install.download(\n moduleInfo.github,\n release.tag_name\n )}\\n${release.html_url}`\n );\n else\n log.warning(messages.devrequests.install.notFound(moduleInfo.github));\n\n const downloadSpecificRelease =\n version && !checkDir('c') && release?.tag_name;\n\n // Should we download an update?\n if (\n (release?.tag_name &&\n ![moduleInfo.version, moduleInfo.install].includes(release.tag_name)) ||\n downloadSpecificRelease\n ) {\n // Download platform-specific release asset\n const downloadPath = path.join(\n this.basePath,\n `${this.name}-${release.tag_name}`\n );\n\n // add spinner while downloading\n const spinner = createSpinner(\n messages.devrequests.install.downloading(\n moduleInfo.github,\n release.tag_name\n )\n );\n if (verbose || debug) {\n spinner.start();\n }\n try {\n await github.DownloadRelease(release, {\n cmd,\n path: downloadPath,\n // Map NodeJS os platform to release asset name\n platforms: [\n ['win32', 'win-x64'],\n ['darwin', 'osx-x64'],\n ['linux', 'linux-x64'],\n ],\n });\n } catch (ex: any) {\n spinner.error();\n log.error(\n messages.devrequests.install.downloadFail(\n moduleInfo.github,\n release.tag_name\n ),\n ex\n );\n } finally {\n if (verbose || debug)\n spinner.success({\n text: messages.devrequests.install.downloaded(\n moduleInfo.github,\n release.tag_name\n ),\n });\n\n if (!version) {\n // Update module info with downloaded release\n this.moduleInfo.install = release.tag_name;\n // Write module info update to manifest so it installs on next invoke\n manifest.writeModule(this.name, this.moduleInfo);\n } else {\n // Set module version in memory so the request handler\n // will be invoked with this version this time only\n this.moduleInfo.version = release.tag_name;\n }\n }\n }\n }\n\n async ApplyUpdate() {\n const { manifest, messages, moduleInfo } = this;\n\n if (moduleInfo.install && moduleInfo.version !== moduleInfo.install) {\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { spawn } from 'child_process';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\nimport path from 'path';\nimport { LogMessages } from '~/localisation/en-GB';\nimport GitHubCliModuleProvider from '~/providers/GitHubCliModuleProvider';\n\nimport ManifestProvider from '~/providers/ManifestProvider';\nimport { appRootDir, checkDir, joinPath } from '~/providers/file-provider';\nimport { isDebug } from '~/util/debug';\nimport { Logger } from '~/util/logger';\n\nexport class RequestHandlerFactory {\n debug = isDebug();\n log = Logger;\n messages = LogMessages;\n manifest = new ManifestProvider(); // Load cli-manifest.json\n\n basePath = path.join(appRootDir);\n name = 'request-handler-localdevelopment';\n cmd = 'Zengenti.Contensis.RequestHandler.LocalDevelopment';\n\n prerelease;\n version; // pass in a specific release version to run\n\n get exePath() {\n return path.join(this.basePath, `${this.name}-${this.moduleInfo.version}`);\n }\n\n get moduleInfo() {\n return (\n this.manifest.getModule(this.name) || {\n github: 'contensis/request-handler-localdevelopment',\n version: '*',\n }\n );\n }\n\n constructor(version?: string, prerelease = false) {\n this.prerelease = prerelease;\n this.version = version;\n }\n\n // Use the factory to create a request handler instance\n // handling the download and updating of the external binary\n async Create() {\n const { moduleInfo, version } = this;\n const downloadImmediately =\n !moduleInfo?.version || moduleInfo?.version === '*' || this.version;\n\n if (downloadImmediately) {\n // Create cli-manifest.json\n this.manifest.writeModule(this.name, this.moduleInfo);\n\n // Download for first time use (await)\n await this.CheckUpdate({ verbose: true, version });\n }\n\n // Apply any downloaded/pending update so we launch that version\n await this.ApplyUpdate();\n\n // Fire an async update check and continue working in the background (do not await)\n if (!downloadImmediately) this.CheckUpdate();\n\n // Return a RequestHandler ready to invoke\n return this.CreateInvoke(this);\n }\n\n CreateInvoke(self = this) {\n // Hoist the vars we need from `this` as we lose scope\n // when the function is returned from the Create() method\n const { debug, log, messages, cmd, exePath } = self;\n\n // Invoke request handler method\n return async (args: string[]) => {\n const child = spawn(joinPath(exePath, cmd), args, { stdio: 'inherit' });\n\n if (args?.length && debug)\n log.warning(\n `Spawning process with supplied args: ${JSON.stringify(\n child.spawnargs,\n null,\n 2\n )}`\n );\n\n let isRunning = false;\n\n // Log child output through event listeners\n child?.stdout?.on('data', data => {\n isRunning = true;\n log.raw(data);\n });\n\n child?.stderr?.on('data', data => {\n log.error(data);\n });\n\n child.on('spawn', () => {\n isRunning = true;\n log.help(messages.devrequests.spawn());\n });\n\n child.on('exit', code => {\n isRunning = false;\n\n log[code === 0 ? 'success' : 'warning'](\n messages.devrequests.exited(code)\n );\n });\n\n child.on('error', error => {\n isRunning = false;\n log.error(messages.devrequests.errored(error));\n });\n\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n // keep the method running until we can return\n while (true === true) {\n if (!isRunning) return;\n await new Promise(resolve => setTimeout(resolve, 1000));\n }\n };\n }\n\n async CheckUpdate({\n verbose = false,\n version,\n }: { verbose?: boolean; version?: string } = {}) {\n const { cmd, debug, log, manifest, messages, moduleInfo } = this;\n\n const github = new GitHubCliModuleProvider(moduleInfo.github);\n\n // Find latest version\n const release = await github.FindLatestRelease(version);\n\n if (verbose || debug)\n if (release)\n log.info(\n `${messages.devrequests.install.download(\n moduleInfo.github,\n release.tag_name\n )}\\n${release.html_url}`\n );\n else\n log.warning(messages.devrequests.install.notFound(moduleInfo.github));\n\n const downloadSpecificRelease =\n version && !checkDir('c') && release?.tag_name;\n\n // Should we download an update?\n if (\n (release?.tag_name &&\n ![moduleInfo.version, moduleInfo.install].includes(release.tag_name)) ||\n downloadSpecificRelease\n ) {\n // Download platform-specific release asset\n const downloadPath = path.join(\n this.basePath,\n `${this.name}-${release.tag_name}`\n );\n\n // add spinner while downloading\n const spinner = createSpinner(\n messages.devrequests.install.downloading(\n moduleInfo.github,\n release.tag_name\n )\n );\n if (verbose || debug) {\n spinner.start();\n }\n try {\n await github.DownloadRelease(release, {\n cmd,\n path: downloadPath,\n // Map NodeJS os platform to release asset name\n platforms: [\n ['win32', 'win-x64'],\n ['darwin', 'osx-x64'],\n ['linux', 'linux-x64'],\n ],\n });\n } catch (ex: any) {\n spinner.error();\n log.error(\n messages.devrequests.install.downloadFail(\n moduleInfo.github,\n release.tag_name\n ),\n ex\n );\n } finally {\n if (verbose || debug)\n spinner.success({\n text: messages.devrequests.install.downloaded(\n moduleInfo.github,\n release.tag_name\n ),\n });\n\n if (!version) {\n // Update module info with downloaded release\n this.moduleInfo.install = release.tag_name;\n // Write module info update to manifest so it installs on next invoke\n manifest.writeModule(this.name, this.moduleInfo);\n } else {\n // Set module version in memory so the request handler\n // will be invoked with this version this time only\n this.moduleInfo.version = release.tag_name;\n }\n }\n }\n }\n\n async ApplyUpdate() {\n const { manifest, messages, moduleInfo } = this;\n\n if (moduleInfo.install && moduleInfo.version !== moduleInfo.install) {\n const { apply } =\n moduleInfo.version === '*'\n ? { apply: true }\n : await inquirer.prompt({\n name: 'apply',\n type: 'confirm',\n message: messages.devrequests.install.applyUpdate(\n moduleInfo.install,\n moduleInfo.version\n ),\n default: 'Y',\n });\n\n if (apply) {\n moduleInfo.version = moduleInfo.install;\n delete moduleInfo.install;\n manifest.writeModule(this.name, this.moduleInfo);\n\n // TODO: clean up user folder by deleting old version(s)}\n }\n }\n }\n}\n\nexport const createRequestHandler = (version?: string) =>\n new RequestHandlerFactory(version).Create();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAsB;AACtB,sBAAqB;AACrB,yBAA8B;AAC9B,kBAAiB;AACjB,mBAA4B;AAC5B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AQ;AAAA,QACpC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,cAAc;AAClB,UAAM,EAAE,UAAU,UAAU,WAAW,IAAI;AAE3C,QAAI,WAAW,WAAW,WAAW,YAAY,WAAW,SAAS;AACnE,YAAM,EAAE,MAAM,IACZ,WAAW,YAAY,MACnB,EAAE,OAAO,KAAK,IACd,MAAM,gBAAAE,QAAS,OAAO;AAAA,QACpB,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS,SAAS,YAAY,QAAQ;AAAA,UACpC,WAAW;AAAA,UACX,WAAW;AAAA,QACb;AAAA,QACA,SAAS;AAAA,MACX,CAAC;AAEP,UAAI,OAAO;AACT,mBAAW,UAAU,WAAW;AAChC,eAAO,WAAW;AAClB,iBAAS,YAAY,KAAK,MAAM,KAAK,UAAU;AAAA,MAGjD;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,uBAAuB,CAAC,YACnC,IAAI,sBAAsB,OAAO,EAAE,OAAO;",
|
|
6
6
|
"names": ["ManifestProvider", "path", "GitHubCliModuleProvider", "inquirer"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
14
|
return to;
|
|
15
15
|
};
|
|
16
16
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17
21
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
22
|
mod
|
|
19
23
|
));
|
package/dist/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["import commands from './commands';\nimport { logError } from './util/logger';\nimport ContensisCli from './services/ContensisCliService';\n\n// This is the CLI part of the app\nconst program = commands();\nprogram\n .parseAsync(process.argv)\n .then(() => {\n ContensisCli.quit();\n })\n .catch((err: any) => {\n if (err && !err.name?.includes('CommanderError'))\n logError(err, `CLI ${err.toString()}`);\n ContensisCli.quit(err);\n });\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,sBAAqB;AACrB,oBAAyB;AACzB,iCAAyB;AAGzB,MAAM,cAAU,gBAAAA,SAAS;AACzB,QACG,WAAW,QAAQ,IAAI,EACvB,KAAK,MAAM;AACV,6BAAAC,QAAa,KAAK;AACpB,CAAC,EACA,MAAM,CAAC,QAAa;AAXvB;AAYI,MAAI,OAAO,GAAC,SAAI,SAAJ,mBAAU,SAAS;AAC7B,gCAAS,KAAK,OAAO,IAAI,SAAS,CAAC,EAAE;AACvC,6BAAAA,QAAa,KAAK,GAAG;AACvB,CAAC;",
|
|
6
6
|
"names": ["commands", "ContensisCli"]
|
|
7
7
|
}
|