contensis-cli 1.6.1-beta.2 → 1.6.1-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +58301 -11
- package/dist/index.js.map +4 -4
- package/dist/shell.js +58040 -52
- package/dist/shell.js.map +4 -4
- package/esbuild.config.js +8 -13
- package/package.json +3 -2
- package/src/commands/create.ts +48 -0
- package/src/commands/dev.ts +12 -2
- package/src/commands/globalOptions.ts +5 -3
- package/src/commands/import.ts +46 -5
- package/src/commands/push.ts +8 -1
- package/src/commands/set.ts +69 -1
- package/src/factories/RequestHandlerFactory.ts +19 -8
- package/src/localisation/en-GB.ts +22 -4
- package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +25 -17
- package/src/models/CliService.d.ts +5 -1
- package/src/providers/GitHubCliModuleProvider.ts +8 -8
- package/src/providers/HttpProvider.ts +2 -2
- package/src/providers/file-provider.ts +3 -0
- package/src/services/ContensisCliService.ts +265 -23
- package/src/services/ContensisDevService.ts +99 -35
- package/src/shell.ts +7 -1
- package/src/util/console.printer.ts +52 -0
- package/src/util/logger.ts +3 -4
- package/src/util/os.ts +5 -3
- package/src/version.ts +1 -1
- package/dist/commands/connect.js +0 -44
- package/dist/commands/connect.js.map +0 -7
- package/dist/commands/copy.js +0 -78
- package/dist/commands/copy.js.map +0 -7
- package/dist/commands/create.js +0 -170
- package/dist/commands/create.js.map +0 -7
- package/dist/commands/dev.js +0 -78
- package/dist/commands/dev.js.map +0 -7
- package/dist/commands/diff.js +0 -57
- package/dist/commands/diff.js.map +0 -7
- package/dist/commands/execute.js +0 -103
- package/dist/commands/execute.js.map +0 -7
- package/dist/commands/get.js +0 -330
- package/dist/commands/get.js.map +0 -7
- package/dist/commands/globalOptions.js +0 -252
- package/dist/commands/globalOptions.js.map +0 -7
- package/dist/commands/import.js +0 -229
- package/dist/commands/import.js.map +0 -7
- package/dist/commands/index.js +0 -107
- package/dist/commands/index.js.map +0 -7
- package/dist/commands/list.js +0 -195
- package/dist/commands/list.js.map +0 -7
- package/dist/commands/login.js +0 -55
- package/dist/commands/login.js.map +0 -7
- package/dist/commands/push.js +0 -229
- package/dist/commands/push.js.map +0 -7
- package/dist/commands/remove.js +0 -193
- package/dist/commands/remove.js.map +0 -7
- package/dist/commands/set.js +0 -180
- package/dist/commands/set.js.map +0 -7
- package/dist/commands/update.js +0 -70
- package/dist/commands/update.js.map +0 -7
- package/dist/factories/RequestHandlerFactory.js +0 -221
- package/dist/factories/RequestHandlerFactory.js.map +0 -7
- package/dist/localisation/en-GB.js +0 -552
- package/dist/localisation/en-GB.js.map +0 -7
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +0 -56
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +0 -7
- package/dist/mappers/DevInit-to-CIWorkflow.js +0 -409
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +0 -7
- package/dist/mappers/DevInit-to-RolePermissions.js +0 -56
- package/dist/mappers/DevInit-to-RolePermissions.js.map +0 -7
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +0 -161
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +0 -7
- package/dist/mappers/MixedFileData.js +0 -83
- package/dist/mappers/MixedFileData.js.map +0 -7
- package/dist/models/AppError.d.js +0 -2
- package/dist/models/AppError.d.js.map +0 -7
- package/dist/models/Cache.d.js +0 -2
- package/dist/models/Cache.d.js.map +0 -7
- package/dist/models/CliService.d.js +0 -17
- package/dist/models/CliService.d.js.map +0 -7
- package/dist/models/DevService.d.js +0 -17
- package/dist/models/DevService.d.js.map +0 -7
- package/dist/models/JsModules.d.js +0 -2
- package/dist/models/JsModules.d.js.map +0 -7
- package/dist/providers/CredentialProvider.js +0 -126
- package/dist/providers/CredentialProvider.js.map +0 -7
- package/dist/providers/GitHubCliModuleProvider.js +0 -115
- package/dist/providers/GitHubCliModuleProvider.js.map +0 -7
- package/dist/providers/HttpProvider.js +0 -73
- package/dist/providers/HttpProvider.js.map +0 -7
- package/dist/providers/ManifestProvider.js +0 -50
- package/dist/providers/ManifestProvider.js.map +0 -7
- package/dist/providers/SessionCacheProvider.js +0 -132
- package/dist/providers/SessionCacheProvider.js.map +0 -7
- package/dist/providers/file-provider.js +0 -174
- package/dist/providers/file-provider.js.map +0 -7
- package/dist/services/ContensisAuthService.js +0 -88
- package/dist/services/ContensisAuthService.js.map +0 -7
- package/dist/services/ContensisCliService.js +0 -2598
- package/dist/services/ContensisCliService.js.map +0 -7
- package/dist/services/ContensisDevService.js +0 -387
- package/dist/services/ContensisDevService.js.map +0 -7
- package/dist/services/ContensisRoleService.js +0 -112
- package/dist/services/ContensisRoleService.js.map +0 -7
- package/dist/util/api-ids.js +0 -110
- package/dist/util/api-ids.js.map +0 -7
- package/dist/util/assert.js +0 -62
- package/dist/util/assert.js.map +0 -7
- package/dist/util/console.printer.js +0 -425
- package/dist/util/console.printer.js.map +0 -7
- package/dist/util/csv.formatter.js +0 -118
- package/dist/util/csv.formatter.js.map +0 -7
- package/dist/util/debug.js +0 -29
- package/dist/util/debug.js.map +0 -7
- package/dist/util/diff.js +0 -118
- package/dist/util/diff.js.map +0 -7
- package/dist/util/dotenv.js +0 -56
- package/dist/util/dotenv.js.map +0 -7
- package/dist/util/error.js +0 -36
- package/dist/util/error.js.map +0 -7
- package/dist/util/fetch.js +0 -69
- package/dist/util/fetch.js.map +0 -7
- package/dist/util/find.js +0 -39
- package/dist/util/find.js.map +0 -7
- package/dist/util/git.js +0 -145
- package/dist/util/git.js.map +0 -7
- package/dist/util/gitignore.js +0 -61
- package/dist/util/gitignore.js.map +0 -7
- package/dist/util/html.formatter.js +0 -70
- package/dist/util/html.formatter.js.map +0 -7
- package/dist/util/index.js +0 -68
- package/dist/util/index.js.map +0 -7
- package/dist/util/json.formatter.js +0 -66
- package/dist/util/json.formatter.js.map +0 -7
- package/dist/util/logger.js +0 -304
- package/dist/util/logger.js.map +0 -7
- package/dist/util/os.js +0 -46
- package/dist/util/os.js.map +0 -7
- package/dist/util/timers.js +0 -49
- package/dist/util/timers.js.map +0 -7
- package/dist/util/xml.formatter.js +0 -62
- package/dist/util/xml.formatter.js.map +0 -7
- package/dist/util/yaml.js +0 -44
- package/dist/util/yaml.js.map +0 -7
- package/dist/version.js +0 -29
- package/dist/version.js.map +0 -7
package/dist/commands/remove.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var remove_exports = {};
|
|
20
|
-
__export(remove_exports, {
|
|
21
|
-
makeRemoveCommand: () => makeRemoveCommand
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(remove_exports);
|
|
24
|
-
var import_commander = require("commander");
|
|
25
|
-
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
-
var import_shell = require("../shell");
|
|
27
|
-
var import_logger = require("../util/logger");
|
|
28
|
-
var import_globalOptions = require("./globalOptions");
|
|
29
|
-
const makeRemoveCommand = () => {
|
|
30
|
-
const remove = new import_commander.Command().command("remove").description("remove command").addHelpText("after", `
|
|
31
|
-
`).showHelpAfterError(true).enablePositionalOptions().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
|
-
});
|
|
45
|
-
remove.command("project").description("remove an entire project").argument("<projectId>", "the project id to delete").usage("<projectId>").addHelpText("after", `
|
|
46
|
-
`).action(async (projectId, opts) => {
|
|
47
|
-
const project = await (0, import_ContensisCliService.cliCommand)(
|
|
48
|
-
["remove", "project", projectId],
|
|
49
|
-
opts
|
|
50
|
-
).SetProject(projectId);
|
|
51
|
-
if (project) await (0, import_shell.shell)().restart();
|
|
52
|
-
});
|
|
53
|
-
remove.command("key").description("remove api key").argument("<id>", "the id of the API key to delete").usage("<id>").addHelpText(
|
|
54
|
-
"after",
|
|
55
|
-
`
|
|
56
|
-
Example call:
|
|
57
|
-
> remove key 4ceb9575-28d3-4d5b-a77b-5e5221e603dd
|
|
58
|
-
`
|
|
59
|
-
).action(async (id, opts) => {
|
|
60
|
-
await (0, import_ContensisCliService.cliCommand)(["remove", "key", id], opts).RemoveApiKey(id);
|
|
61
|
-
});
|
|
62
|
-
remove.command("role").description("remove a role").argument('<"Role name" or id>', "the existing role name or id to delete").addHelpText(
|
|
63
|
-
"after",
|
|
64
|
-
`
|
|
65
|
-
Example call:
|
|
66
|
-
> remove role "My role"
|
|
67
|
-
`
|
|
68
|
-
).action(async (roleNameOrId, opts) => {
|
|
69
|
-
await (0, import_ContensisCliService.cliCommand)(["remove", "role", roleNameOrId], opts).RemoveRole(
|
|
70
|
-
roleNameOrId
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
remove.command("components").description("delete components").argument("<id...>", "the id(s) of the components to delete").addOption(import_globalOptions.commit).usage("<id> [--commit]").addHelpText(
|
|
74
|
-
"after",
|
|
75
|
-
`
|
|
76
|
-
Example call:
|
|
77
|
-
> remove components addressComponent
|
|
78
|
-
`
|
|
79
|
-
).action(async (id, opts) => {
|
|
80
|
-
await (0, import_ContensisCliService.cliCommand)(
|
|
81
|
-
["remove", "components", id.join(" ")],
|
|
82
|
-
opts
|
|
83
|
-
).RemoveComponents(id, opts.commit);
|
|
84
|
-
});
|
|
85
|
-
remove.command("contenttypes").description("delete content types").argument("<id...>", "the id(s) of the content types to delete").addOption(import_globalOptions.commit).usage("<id> [--commit]").addHelpText(
|
|
86
|
-
"after",
|
|
87
|
-
`
|
|
88
|
-
Example call:
|
|
89
|
-
> remove contenttypes blogPost
|
|
90
|
-
`
|
|
91
|
-
).action(async (id, opts) => {
|
|
92
|
-
await (0, import_ContensisCliService.cliCommand)(
|
|
93
|
-
["remove", "contenttypes", id.join(" ")],
|
|
94
|
-
opts
|
|
95
|
-
).RemoveContentTypes(id, opts.commit);
|
|
96
|
-
});
|
|
97
|
-
const removeEntries = remove.command("entries").description("delete entries").argument(
|
|
98
|
-
"[ids...]",
|
|
99
|
-
"the entry id(s) to delete ...or add *** if you wish to delete all entries in all content types"
|
|
100
|
-
).addOption(import_globalOptions.zenql).addOption(import_globalOptions.commit).addHelpText(
|
|
101
|
-
"after",
|
|
102
|
-
`
|
|
103
|
-
Example call:
|
|
104
|
-
> remove entries a1c25591-8c9b-50e2-96d8-f6c774fcf023 8df914cc-1da1-59d6-86e0-8ea4ebd99aaa
|
|
105
|
-
> remove entries --zenql "sys.contentTypeId = test"
|
|
106
|
-
`
|
|
107
|
-
).action(async (entryIds, opts) => {
|
|
108
|
-
const removeAll = (entryIds == null ? void 0 : entryIds[0]) === "***";
|
|
109
|
-
if ((entryIds == null ? void 0 : entryIds[0]) && !entryIds[0].replace(/\*/g, "")) entryIds.pop();
|
|
110
|
-
const hasArgs = !!((entryIds == null ? void 0 : entryIds.length) || opts.zenql || removeAll);
|
|
111
|
-
if (!hasArgs) {
|
|
112
|
-
import_logger.Logger.help(
|
|
113
|
-
`Not enough arguments supplied
|
|
114
|
-
|
|
115
|
-
${removeEntries.helpInformation()}`
|
|
116
|
-
);
|
|
117
|
-
} else {
|
|
118
|
-
await (0, import_ContensisCliService.cliCommand)(
|
|
119
|
-
["remove", "entries", entryIds.join(" ")],
|
|
120
|
-
opts,
|
|
121
|
-
(0, import_globalOptions.mapContensisOpts)({ entryIds, ...opts })
|
|
122
|
-
).RemoveEntries(opts.commit);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
remove.command("nodes").description("delete nodes from the site view tree").argument("<root>", "remove nodes from the specified path e.g. /blog or /").addOption(import_globalOptions.commit).addHelpText(
|
|
126
|
-
"after",
|
|
127
|
-
`
|
|
128
|
-
Example call:
|
|
129
|
-
> remove nodes /blog
|
|
130
|
-
`
|
|
131
|
-
).action(async (root, opts) => {
|
|
132
|
-
await (0, import_ContensisCliService.cliCommand)(
|
|
133
|
-
["remove", "nodes", root],
|
|
134
|
-
opts,
|
|
135
|
-
(0, import_globalOptions.mapContensisOpts)({ paths: root.split(" "), ...opts })
|
|
136
|
-
).RemoveNodes(opts.commit);
|
|
137
|
-
});
|
|
138
|
-
remove.command("taggroup").description("delete an unused tag group").argument("<groupId>", "id of the tag group to remove").addOption(import_globalOptions.commit).addHelpText(
|
|
139
|
-
"after",
|
|
140
|
-
`
|
|
141
|
-
Example call:
|
|
142
|
-
> remove taggroup example
|
|
143
|
-
`
|
|
144
|
-
).action(async (groupId, opts) => {
|
|
145
|
-
await (0, import_ContensisCliService.cliCommand)(["remove", "taggroup", groupId], opts).RemoveTagGroup(
|
|
146
|
-
groupId,
|
|
147
|
-
opts.commit
|
|
148
|
-
);
|
|
149
|
-
});
|
|
150
|
-
const tags = remove.command("tags").description("delete unused tags").passThroughOptions().argument("[ids...]", "id(s) of the tag(s) to remove").option("--all", "delete all tags").addOption(import_globalOptions.commit).addHelpText(
|
|
151
|
-
"after",
|
|
152
|
-
`
|
|
153
|
-
Example call:
|
|
154
|
-
> remove tags d4267b35-0d25-41ae-bce9-eeb490c793f4 90a11d09-3727-45c2-a0df-86f1865828ab
|
|
155
|
-
> remove tags --all
|
|
156
|
-
|
|
157
|
-
`
|
|
158
|
-
).action(async (ids, opts, cmd) => {
|
|
159
|
-
if ((!ids || !ids.length) && !opts.all)
|
|
160
|
-
cmd.error("Missing one of the required options");
|
|
161
|
-
await (0, import_ContensisCliService.cliCommand)(["remove", "tags", ...ids], opts).RemoveTags(
|
|
162
|
-
{ ids: ids.length ? ids : void 0 },
|
|
163
|
-
opts.commit
|
|
164
|
-
);
|
|
165
|
-
});
|
|
166
|
-
tags.command("in").description("delete unused tags in a specific tag group").showHelpAfterError(true).argument("<groupId>", "id of the tag group containing tags").option("--all", "delete all tags in this group").option("--label <label>", "delete tags that match this label").option(
|
|
167
|
-
"-l --language <language>",
|
|
168
|
-
"delete tags by a label in a specific language"
|
|
169
|
-
).addOption(import_globalOptions.commit).addHelpText(
|
|
170
|
-
"after",
|
|
171
|
-
`
|
|
172
|
-
Example call:
|
|
173
|
-
> remove tags in example --label Test
|
|
174
|
-
> remove tags in example --all
|
|
175
|
-
|
|
176
|
-
`
|
|
177
|
-
).action(async (groupId, opts, cmd) => {
|
|
178
|
-
const parentOptions = cmd.optsWithGlobals();
|
|
179
|
-
if (!parentOptions.all && !opts.label)
|
|
180
|
-
cmd.error("Missing one of the required options");
|
|
181
|
-
await (0, import_ContensisCliService.cliCommand)(["remove", "tags", "in", groupId], opts).RemoveTags(
|
|
182
|
-
{ groupId, ...opts, ...parentOptions },
|
|
183
|
-
parentOptions.commit
|
|
184
|
-
);
|
|
185
|
-
});
|
|
186
|
-
(0, import_globalOptions.addGlobalOptions)(tags);
|
|
187
|
-
return remove;
|
|
188
|
-
};
|
|
189
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
190
|
-
0 && (module.exports = {
|
|
191
|
-
makeRemoveCommand
|
|
192
|
-
});
|
|
193
|
-
//# sourceMappingURL=remove.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 {\n addGlobalOptions,\n commit,\n mapContensisOpts,\n zenql,\n} 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 .enablePositionalOptions()\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 remove\n .command('taggroup')\n .description('delete an unused tag group')\n .argument('<groupId>', 'id of the tag group to remove')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\n Example call:\n > remove taggroup example\n `\n )\n .action(async (groupId: string, opts) => {\n await cliCommand(['remove', 'taggroup', groupId], opts).RemoveTagGroup(\n groupId,\n opts.commit\n );\n });\n\n const tags = remove\n .command('tags')\n .description('delete unused tags')\n .passThroughOptions()\n .argument('[ids...]', 'id(s) of the tag(s) to remove')\n .option('--all', 'delete all tags')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\n Example call:\n > remove tags d4267b35-0d25-41ae-bce9-eeb490c793f4 90a11d09-3727-45c2-a0df-86f1865828ab\n > remove tags --all\n\n `\n )\n .action(async (ids: string[], opts, cmd: Command) => {\n if ((!ids || !ids.length) && !opts.all)\n cmd.error('Missing one of the required options');\n\n await cliCommand(['remove', 'tags', ...ids], opts).RemoveTags(\n { ids: ids.length ? ids : undefined },\n opts.commit\n );\n });\n\n tags\n .command('in')\n .description('delete unused tags in a specific tag group')\n .showHelpAfterError(true)\n .argument('<groupId>', 'id of the tag group containing tags')\n .option('--all', 'delete all tags in this group')\n .option('--label <label>', 'delete tags that match this label')\n .option(\n '-l --language <language>',\n 'delete tags by a label in a specific language'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\n Example call:\n > remove tags in example --label Test\n > remove tags in example --all\n\n `\n )\n .action(async (groupId: string, opts, cmd: Command) => {\n // workaround for opts.commit being always false\n // read the (shared) options that were parsed by the parent cmd\n // https://github.com/tj/commander.js/issues/476#issuecomment-1675757628\n const parentOptions = cmd.optsWithGlobals();\n\n if (!parentOptions.all && !opts.label)\n cmd.error('Missing one of the required options');\n\n await cliCommand(['remove', 'tags', 'in', groupId], opts).RemoveTags(\n { groupId, ...opts, ...parentOptions },\n parentOptions.commit\n );\n });\n\n // Add global opts for inner sub-commands\n addGlobalOptions(tags);\n\n return remove;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,mBAAsB;AACtB,oBAAuB;AACvB,2BAKO;AAEA,MAAM,oBAAoB,MAAM;AACrC,QAAM,SAAS,IAAI,yBAAQ,EACxB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,wBAAwB,EACxB,aAAa;AAEhB,SACG,QAAQ,KAAK,EACb,YAAY,wDAAwD,EACpE,SAAS,WAAW,qCAAqC,EACzD,MAAM,SAAS,EACf;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,OAAe,SAAS;AACrC,UAAM,qBAAqB,UAAM;AAAA,MAC/B,CAAC,UAAU,OAAO,KAAK;AAAA,MACvB;AAAA,IACF,EAAE,kBAAkB,KAAK;AACzB,QAAI,CAAC,mBAAoB,WAAM,oBAAM,EAAE,QAAQ;AAAA,EACjD,CAAC;AAEH,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,QAAS,WAAM,oBAAM,EAAE,QAAQ;AAAA,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AAI;AAErB,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/commands/set.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var set_exports = {};
|
|
20
|
-
__export(set_exports, {
|
|
21
|
-
makeSetCommand: () => makeSetCommand
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(set_exports);
|
|
24
|
-
var import_commander = require("commander");
|
|
25
|
-
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
-
var import_shell = require("../shell");
|
|
27
|
-
const makeSetCommand = () => {
|
|
28
|
-
const set = new import_commander.Command().command("set").description("set command").addHelpText("after", `
|
|
29
|
-
`).showHelpAfterError(true).exitOverride();
|
|
30
|
-
const project = set.command("project").description("set current working project").argument("<projectId>", "the project id to work with").usage("<projectId>").addHelpText(
|
|
31
|
-
"after",
|
|
32
|
-
`
|
|
33
|
-
Example call:
|
|
34
|
-
> set project website
|
|
35
|
-
`
|
|
36
|
-
).action(async (projectId) => {
|
|
37
|
-
const nextProjectId = (0, import_ContensisCliService.cliCommand)([
|
|
38
|
-
"set",
|
|
39
|
-
"project",
|
|
40
|
-
projectId
|
|
41
|
-
]).SetProject(projectId);
|
|
42
|
-
if (nextProjectId) await (0, import_shell.shell)().restart();
|
|
43
|
-
});
|
|
44
|
-
project.command("name").description("update project name").argument('<"Project name">', "update the current project name").usage('<"Project name">').addHelpText(
|
|
45
|
-
"after",
|
|
46
|
-
`
|
|
47
|
-
Example call:
|
|
48
|
-
> set project name "Project name"
|
|
49
|
-
`
|
|
50
|
-
).action(async (name, opts) => {
|
|
51
|
-
await (0, import_ContensisCliService.cliCommand)(["set", "project", "name"], opts).UpdateProject({
|
|
52
|
-
name
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
project.command("description").description("update project description").argument(
|
|
56
|
-
'<"Project description">',
|
|
57
|
-
"update the current project description"
|
|
58
|
-
).usage('<"Project description">').addHelpText(
|
|
59
|
-
"after",
|
|
60
|
-
`
|
|
61
|
-
Example call:
|
|
62
|
-
> set project description "Description of project"
|
|
63
|
-
`
|
|
64
|
-
).action(async (description, opts) => {
|
|
65
|
-
await (0, import_ContensisCliService.cliCommand)(["set", "project", "description"], opts).UpdateProject({
|
|
66
|
-
description
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
const role = set.command("role").description("update a role");
|
|
70
|
-
role.command("name").description("update role name").argument('<"Role name">', "update the existing role name").argument('<"New name">', "the new name for the role").usage('<"Role name"> <"New name">').addHelpText(
|
|
71
|
-
"after",
|
|
72
|
-
`
|
|
73
|
-
Example call:
|
|
74
|
-
> set role name "Existing name" "New role name"
|
|
75
|
-
`
|
|
76
|
-
).action(async (roleNameOrId, newName, opts) => {
|
|
77
|
-
await (0, import_ContensisCliService.cliCommand)(["set", "role", "name"], opts).UpdateRole(roleNameOrId, {
|
|
78
|
-
name: newName
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
role.command("description").description("update role description").argument('<"Role name" or id>', "the existing role name or id to update").argument('<"New description">', "the new description for the role").usage('<"Role name"> <"New description">').addHelpText(
|
|
82
|
-
"after",
|
|
83
|
-
`
|
|
84
|
-
Example call:
|
|
85
|
-
> set role description "Existing role" "New role description"
|
|
86
|
-
`
|
|
87
|
-
).action(async (roleNameOrId, description, opts) => {
|
|
88
|
-
await (0, import_ContensisCliService.cliCommand)(["set", "role", "description"], opts).UpdateRole(
|
|
89
|
-
roleNameOrId,
|
|
90
|
-
{
|
|
91
|
-
description
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
role.command("enabled").description("enable or disable a role").argument('<"Role name" or id>', "the existing role name or id to update").usage('<"Role name"> --disabled').option("--disabled", "disable the role", false).addHelpText(
|
|
96
|
-
"after",
|
|
97
|
-
`
|
|
98
|
-
Example call:
|
|
99
|
-
> set role enabled "Existing role"
|
|
100
|
-
|
|
101
|
-
> set role enabled "Other role" --disabled
|
|
102
|
-
`
|
|
103
|
-
).action(async (roleNameOrId, opts) => {
|
|
104
|
-
await (0, import_ContensisCliService.cliCommand)(
|
|
105
|
-
["set", "role", opts.disabled ? "disabled" : "enabled"],
|
|
106
|
-
opts
|
|
107
|
-
).UpdateRole(roleNameOrId, {
|
|
108
|
-
enabled: !opts.disabled
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
role.command("assignments").description("assign users, groups or keys to a role").argument('<"Role name" or id>', "the role name or id to update").option(
|
|
112
|
-
"-users --assign-users [assign-users...]",
|
|
113
|
-
"the user id(s) to assign"
|
|
114
|
-
).option(
|
|
115
|
-
"-groups --assign-groups [assign-groups...]",
|
|
116
|
-
"the groups name(s) to assign"
|
|
117
|
-
).option("-keys --assign-keys [assign-keys...]", "the key name(s) to assign").addHelpText(
|
|
118
|
-
"after",
|
|
119
|
-
`
|
|
120
|
-
Example call:
|
|
121
|
-
> set role assignments "My role" --assign-users admin
|
|
122
|
-
`
|
|
123
|
-
).action(async (roleNameOrId, opts) => {
|
|
124
|
-
await (0, import_ContensisCliService.cliCommand)(["set", "role", "assignments"], opts).UpdateRole(
|
|
125
|
-
roleNameOrId,
|
|
126
|
-
{
|
|
127
|
-
assignments: {
|
|
128
|
-
apiKeys: opts.assignKeys || void 0,
|
|
129
|
-
groups: opts.assignGroups || void 0,
|
|
130
|
-
users: opts.assignUsers || void 0
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
role.command("permissions").description("add entry permissions to a role").argument('<"Role name" or id>', "the role name or id to update").option(
|
|
136
|
-
"-contenttypes --content-type-ids [content-type-id...]",
|
|
137
|
-
"any content type ids to add permissions for"
|
|
138
|
-
).option(
|
|
139
|
-
"--entry-actions [entry-actions...]",
|
|
140
|
-
"the entry actions to add to the role permissions"
|
|
141
|
-
).option(
|
|
142
|
-
"--entry-languages [entry-languages...]",
|
|
143
|
-
"the entry languages to add to the role permissions"
|
|
144
|
-
).addHelpText(
|
|
145
|
-
"after",
|
|
146
|
-
`
|
|
147
|
-
Example call:
|
|
148
|
-
> set role permissions "My role" --content-type-id blogs --
|
|
149
|
-
`
|
|
150
|
-
).action(async (roleNameOrId, opts) => {
|
|
151
|
-
var _a;
|
|
152
|
-
await (0, import_ContensisCliService.cliCommand)(["set", "role", "permissions"], opts).UpdateRole(
|
|
153
|
-
roleNameOrId,
|
|
154
|
-
{
|
|
155
|
-
permissions: {
|
|
156
|
-
entries: (_a = opts.contentTypeIds) == null ? void 0 : _a.map((id) => ({
|
|
157
|
-
id,
|
|
158
|
-
actions: opts.entryActions || [],
|
|
159
|
-
languages: opts.entryLanguages || []
|
|
160
|
-
}))
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
});
|
|
165
|
-
set.command("version").description("set content version").addArgument(
|
|
166
|
-
new import_commander.Argument("<versionStatus>", "content version status").choices(["latest", "published"]).default("latest")
|
|
167
|
-
).usage("<latest/published>").addHelpText("after", `
|
|
168
|
-
`).action(async (versionStatus) => {
|
|
169
|
-
const success = (0, import_ContensisCliService.cliCommand)(["set", "version", versionStatus]).SetVersion(
|
|
170
|
-
versionStatus
|
|
171
|
-
);
|
|
172
|
-
if (success) await (0, import_shell.shell)().restart();
|
|
173
|
-
});
|
|
174
|
-
return set;
|
|
175
|
-
};
|
|
176
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
-
0 && (module.exports = {
|
|
178
|
-
makeSetCommand
|
|
179
|
-
});
|
|
180
|
-
//# sourceMappingURL=set.js.map
|
package/dist/commands/set.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/set.ts"],
|
|
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,IAC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AAA,IACF;AAAA,EACF,CAAC;AAEH,OACG,QAAQ,aAAa,EACrB,YAAY,iCAAiC,EAC7C,SAAS,uBAAuB,+BAA+B,EAC/D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,cAAsB,SAAS;AA1LlD;AA2LM,cAAM,uCAAW,CAAC,OAAO,QAAQ,aAAa,GAAG,IAAI,EAAE;AAAA,MACrD;AAAA,MACA;AAAA,QACE,aAAa;AAAA,UACX,UAAS,UAAK,mBAAL,mBAAqB,IAAI,CAAC,QAAgB;AAAA,YACjD;AAAA,YACA,SAAS,KAAK,gBAAgB,CAAC;AAAA,YAC/B,WAAW,KAAK,kBAAkB,CAAC;AAAA,UACrC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAEH,MACG,QAAQ,SAAS,EACjB,YAAY,qBAAqB,EACjC;AAAA,IACC,IAAI,0BAAS,mBAAmB,wBAAwB,EACrD,QAAQ,CAAC,UAAU,WAAW,CAAC,EAC/B,QAAQ,QAAQ;AAAA,EACrB,EACC,MAAM,oBAAoB,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,OAAO,OAAM,kBAAiB;AAC7B,UAAM,cAAU,uCAAW,CAAC,OAAO,WAAW,aAAa,CAAC,EAAE;AAAA,MAC5D;AAAA,IACF;AACA,QAAI,QAAS,WAAM,oBAAM,EAAE,QAAQ;AAAA,EACrC,CAAC;AAEH,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/commands/update.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var 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
|
|
@@ -1,7 +0,0 @@
|
|
|
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,+B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