contensis-cli 1.0.0-beta.5
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/.vscode/launch.json +15 -0
- package/README.md +631 -0
- package/cli.js +7 -0
- package/dist/commands/connect.js +44 -0
- package/dist/commands/connect.js.map +7 -0
- package/dist/commands/create.js +55 -0
- package/dist/commands/create.js.map +7 -0
- package/dist/commands/get.js +121 -0
- package/dist/commands/get.js.map +7 -0
- package/dist/commands/globalOptions.js +139 -0
- package/dist/commands/globalOptions.js.map +7 -0
- package/dist/commands/import.js +95 -0
- package/dist/commands/import.js.map +7 -0
- package/dist/commands/index.js +81 -0
- package/dist/commands/index.js.map +7 -0
- package/dist/commands/list.js +88 -0
- package/dist/commands/list.js.map +7 -0
- package/dist/commands/login.js +56 -0
- package/dist/commands/login.js.map +7 -0
- package/dist/commands/push.js +133 -0
- package/dist/commands/push.js.map +7 -0
- package/dist/commands/remove.js +77 -0
- package/dist/commands/remove.js.map +7 -0
- package/dist/commands/set.js +55 -0
- package/dist/commands/set.js.map +7 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +7 -0
- package/dist/localisation/en-GB.js +203 -0
- package/dist/localisation/en-GB.js.map +7 -0
- package/dist/models/AppError.d.js +2 -0
- package/dist/models/AppError.d.js.map +7 -0
- package/dist/models/Cache.d.js +2 -0
- package/dist/models/Cache.d.js.map +7 -0
- package/dist/models/JsModules.d.js +2 -0
- package/dist/models/JsModules.d.js.map +7 -0
- package/dist/providers/CredentialProvider.js +87 -0
- package/dist/providers/CredentialProvider.js.map +7 -0
- package/dist/providers/SessionCacheProvider.js +91 -0
- package/dist/providers/SessionCacheProvider.js.map +7 -0
- package/dist/providers/file-provider.js +113 -0
- package/dist/providers/file-provider.js.map +7 -0
- package/dist/services/ContensisAuthService.js +75 -0
- package/dist/services/ContensisAuthService.js.map +7 -0
- package/dist/services/ContensisCliService.js +1110 -0
- package/dist/services/ContensisCliService.js.map +7 -0
- package/dist/shell.js +261 -0
- package/dist/shell.js.map +7 -0
- package/dist/util/console.printer.js +194 -0
- package/dist/util/console.printer.js.map +7 -0
- package/dist/util/csv.formatter.js +50 -0
- package/dist/util/csv.formatter.js.map +7 -0
- package/dist/util/index.js +94 -0
- package/dist/util/index.js.map +7 -0
- package/dist/util/json.formatter.js +29 -0
- package/dist/util/json.formatter.js.map +7 -0
- package/dist/util/logger.js +184 -0
- package/dist/util/logger.js.map +7 -0
- package/dist/util/xml.formatter.js +51 -0
- package/dist/util/xml.formatter.js.map +7 -0
- package/dist/version.js +29 -0
- package/dist/version.js.map +7 -0
- package/esbuild.config.js +49 -0
- package/headless-setup.sh +7 -0
- package/package.json +59 -0
- package/patches/inquirer-command-prompt+0.1.0.patch +27 -0
- package/src/commands/connect.ts +23 -0
- package/src/commands/create.ts +41 -0
- package/src/commands/get.ts +139 -0
- package/src/commands/globalOptions.ts +126 -0
- package/src/commands/import.ts +89 -0
- package/src/commands/index.ts +72 -0
- package/src/commands/list.ts +90 -0
- package/src/commands/login.ts +33 -0
- package/src/commands/push.ts +120 -0
- package/src/commands/remove.ts +77 -0
- package/src/commands/set.ts +40 -0
- package/src/index.ts +19 -0
- package/src/localisation/en-GB.ts +211 -0
- package/src/models/AppError.d.ts +40 -0
- package/src/models/Cache.d.ts +25 -0
- package/src/models/JsModules.d.ts +1 -0
- package/src/providers/CredentialProvider.ts +88 -0
- package/src/providers/SessionCacheProvider.ts +74 -0
- package/src/providers/file-provider.ts +72 -0
- package/src/services/ContensisAuthService.ts +70 -0
- package/src/services/ContensisCliService.ts +1390 -0
- package/src/shell.ts +250 -0
- package/src/util/console.printer.ts +203 -0
- package/src/util/csv.formatter.ts +21 -0
- package/src/util/index.ts +67 -0
- package/src/util/json.formatter.ts +1 -0
- package/src/util/logger.ts +165 -0
- package/src/util/xml.formatter.ts +20 -0
- package/src/version.ts +1 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,44 @@
|
|
|
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 connect_exports = {};
|
|
20
|
+
__export(connect_exports, {
|
|
21
|
+
makeConnectCommand: () => makeConnectCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(connect_exports);
|
|
24
|
+
var import_commander = require("commander");
|
|
25
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
+
var import_shell = require("../shell");
|
|
27
|
+
var import_globalOptions = require("./globalOptions");
|
|
28
|
+
const makeConnectCommand = () => {
|
|
29
|
+
const connect = new import_commander.Command().command("connect").argument("<alias>", "the Contensis Cloud alias to connect with").addOption(import_globalOptions.project).usage("<alias>").addHelpText(
|
|
30
|
+
"after",
|
|
31
|
+
`
|
|
32
|
+
Example call:
|
|
33
|
+
> connect example-dev`
|
|
34
|
+
).action(async (alias, opts) => {
|
|
35
|
+
await (0, import_ContensisCliService.cliCommand)(["connect", alias], opts).Connect(alias);
|
|
36
|
+
await (0, import_shell.shell)().start();
|
|
37
|
+
});
|
|
38
|
+
return connect;
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
makeConnectCommand
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/connect.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\nimport { project } from './globalOptions';\n\nexport const makeConnectCommand = () => {\n const connect = new Command()\n .command('connect')\n .argument('<alias>', 'the Contensis Cloud alias to connect with')\n .addOption(project)\n .usage('<alias>')\n .addHelpText(\n 'after',\n `\nExample call:\n > connect example-dev`\n )\n .action(async (alias, opts) => {\n await cliCommand(['connect', alias], opts).Connect(alias);\n await shell().start();\n });\n return connect;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,mBAAsB;AACtB,2BAAwB;AAEjB,MAAM,qBAAqB,MAAM;AACtC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,SAAS,EACjB,SAAS,WAAW,2CAA2C,EAC/D,UAAU,4BAAO,EACjB,MAAM,SAAS,EACf;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,OAAO,SAAS;AAC7B,cAAM,uCAAW,CAAC,WAAW,KAAK,GAAG,IAAI,EAAE,QAAQ,KAAK;AACxD,cAAM,oBAAM,EAAE,MAAM;AAAA,EACtB,CAAC;AACH,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 create_exports = {};
|
|
20
|
+
__export(create_exports, {
|
|
21
|
+
makeCreateCommand: () => makeCreateCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(create_exports);
|
|
24
|
+
var import_commander = require("commander");
|
|
25
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
+
var import_shell = require("../shell");
|
|
27
|
+
const makeCreateCommand = () => {
|
|
28
|
+
const create = new import_commander.Command().command("create").showHelpAfterError(true).exitOverride();
|
|
29
|
+
create.command("project").argument("<projectId>", "the id of the project to create").usage("<projectId>").action(async (projectId, opts) => {
|
|
30
|
+
const project = await (0, import_ContensisCliService.cliCommand)(
|
|
31
|
+
["create", "project", projectId],
|
|
32
|
+
opts
|
|
33
|
+
).SetProject(projectId);
|
|
34
|
+
if (project)
|
|
35
|
+
await (0, import_shell.shell)().start();
|
|
36
|
+
});
|
|
37
|
+
create.command("key").argument('<"key name">', "the name of the key to create").argument('["description"]', "provide a description for the key (optional)").usage('<"key name"> ["description"] (both args in "double quotes")').addHelpText(
|
|
38
|
+
"after",
|
|
39
|
+
`
|
|
40
|
+
Example call:
|
|
41
|
+
> create key "my new key" "Created key for demonstration"
|
|
42
|
+
`
|
|
43
|
+
).action(async (name, description, opts) => {
|
|
44
|
+
await (0, import_ContensisCliService.cliCommand)(["create", "key", name], opts).CreateApiKey(
|
|
45
|
+
name,
|
|
46
|
+
description
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
return create;
|
|
50
|
+
};
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
makeCreateCommand
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/create.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeCreateCommand = () => {\n const create = new Command()\n .command('create')\n .showHelpAfterError(true)\n .exitOverride();\n\n create\n .command('project')\n .argument('<projectId>', 'the id of the project to create')\n .usage('<projectId>')\n .action(async (projectId: string, opts: any) => {\n const project = await cliCommand(\n ['create', 'project', projectId],\n opts\n ).SetProject(projectId);\n if (project) await shell().start();\n });\n create\n .command('key')\n .argument('<\"key name\">', 'the name of the key to create')\n .argument('[\"description\"]', 'provide a description for the key (optional)')\n .usage('<\"key name\"> [\"description\"] (both args in \"double quotes\")')\n .addHelpText(\n 'after',\n `\nExample call:\n > create key \"my new key\" \"Created key for demonstration\"\\n`\n )\n .action(async (name: string, description: string, opts: any) => {\n await cliCommand(['create', 'key', name], opts).CreateApiKey(\n name,\n description\n );\n });\n\n return create;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,mBAAsB;AAEf,MAAM,oBAAoB,MAAM;AACrC,QAAM,SAAS,IAAI,yBAAQ,EACxB,QAAQ,QAAQ,EAChB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,SACG,QAAQ,SAAS,EACjB,SAAS,eAAe,iCAAiC,EACzD,MAAM,aAAa,EACnB,OAAO,OAAO,WAAmB,SAAc;AAC9C,UAAM,UAAU,UAAM;AAAA,MACpB,CAAC,UAAU,WAAW,SAAS;AAAA,MAC/B;AAAA,IACF,EAAE,WAAW,SAAS;AACtB,QAAI;AAAS,gBAAM,oBAAM,EAAE,MAAM;AAAA,EACnC,CAAC;AACH,SACG,QAAQ,KAAK,EACb,SAAS,gBAAgB,+BAA+B,EACxD,SAAS,mBAAmB,8CAA8C,EAC1E,MAAM,6DAA6D,EACnE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,MAAc,aAAqB,SAAc;AAC9D,cAAM,uCAAW,CAAC,UAAU,OAAO,IAAI,GAAG,IAAI,EAAE;AAAA,MAC9C;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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 get_exports = {};
|
|
20
|
+
__export(get_exports, {
|
|
21
|
+
get: () => get,
|
|
22
|
+
makeGetCommand: () => makeGetCommand
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(get_exports);
|
|
25
|
+
var import_commander = require("commander");
|
|
26
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
27
|
+
var import_globalOptions = require("./globalOptions");
|
|
28
|
+
const makeGetCommand = () => {
|
|
29
|
+
const program = new import_commander.Command().command("get").showHelpAfterError(true).exitOverride();
|
|
30
|
+
program.command("contenttype").argument("<contentTypeId>", "the API id of the content type to get").addHelpText(
|
|
31
|
+
"after",
|
|
32
|
+
`
|
|
33
|
+
Example call:
|
|
34
|
+
> get contenttype {contentTypeId} -o content-type-backup.json
|
|
35
|
+
`
|
|
36
|
+
).action(async (contentTypeId, opts) => {
|
|
37
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "contenttype"], opts).PrintContentType(
|
|
38
|
+
contentTypeId
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
program.command("component").argument("<componentId>", "the API id of the component to get").addHelpText(
|
|
42
|
+
"after",
|
|
43
|
+
`
|
|
44
|
+
Example call:
|
|
45
|
+
> get component {componentId} -o component-backup.json
|
|
46
|
+
`
|
|
47
|
+
).action(async (componentId, opts) => {
|
|
48
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "component"], opts).PrintComponent(componentId);
|
|
49
|
+
});
|
|
50
|
+
program.command("entries").argument(
|
|
51
|
+
"[search phrase]",
|
|
52
|
+
"get entries with the search phrase, use quotes for multiple words"
|
|
53
|
+
).option("-i --id <id...>", "the entry id to get").option(
|
|
54
|
+
"-d, --dependents",
|
|
55
|
+
"find and return any dependencies of all found entries"
|
|
56
|
+
).option(
|
|
57
|
+
"-fi, --fields <fields...>",
|
|
58
|
+
"limit the output fields on returned entries"
|
|
59
|
+
).option(
|
|
60
|
+
"-q, --zenql <zenql>",
|
|
61
|
+
"get entries with a supplied ZenQL statement"
|
|
62
|
+
).addHelpText(
|
|
63
|
+
"after",
|
|
64
|
+
`
|
|
65
|
+
Example call:
|
|
66
|
+
> get entries --zenql "sys.contentTypeId = blog" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv
|
|
67
|
+
`
|
|
68
|
+
).action(async (phrase, opts, cmd) => {
|
|
69
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
70
|
+
["get", "entries"],
|
|
71
|
+
opts,
|
|
72
|
+
(0, import_globalOptions.mapContensisOpts)({ phrase, ...opts })
|
|
73
|
+
).GetEntries({
|
|
74
|
+
withDependents: opts.dependents
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
const block = program.command("block").argument("[blockId]", "the block to get version details for").argument(
|
|
78
|
+
"[branch]",
|
|
79
|
+
"the branch of the block to get version details for",
|
|
80
|
+
"main"
|
|
81
|
+
).argument(
|
|
82
|
+
"[version]",
|
|
83
|
+
"get a specific version of the block pushed to the specified branch"
|
|
84
|
+
).action(async (blockId, branch, version, opts) => {
|
|
85
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "block"], opts).PrintBlockVersions(
|
|
86
|
+
blockId,
|
|
87
|
+
branch,
|
|
88
|
+
version
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
const dataCenter = new import_commander.Argument(
|
|
92
|
+
"[dataCenter]",
|
|
93
|
+
"the datacentre of the block to get logs for"
|
|
94
|
+
).choices(["hq", "london", "manchester"]).default("hq");
|
|
95
|
+
block.command("logs").argument("[blockId]", "the block to get version logs for").argument(
|
|
96
|
+
"[branch]",
|
|
97
|
+
"the branch of the block to get version details for",
|
|
98
|
+
"main"
|
|
99
|
+
).argument(
|
|
100
|
+
"[version]",
|
|
101
|
+
"the version of the block pushed to the branch to get logs for",
|
|
102
|
+
"latest"
|
|
103
|
+
).addArgument(dataCenter).usage("get block logs [blockId] [branch] [version] [dataCenter]").action(
|
|
104
|
+
async (blockId, branch, version, dataCenter2, opts) => {
|
|
105
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "block", "logs"], opts).PrintBlockLogs(
|
|
106
|
+
blockId,
|
|
107
|
+
branch,
|
|
108
|
+
version,
|
|
109
|
+
dataCenter2
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
return program;
|
|
114
|
+
};
|
|
115
|
+
const get = makeGetCommand();
|
|
116
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
117
|
+
0 && (module.exports = {
|
|
118
|
+
get,
|
|
119
|
+
makeGetCommand
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/get.ts"],
|
|
4
|
+
"sourcesContent": ["import { Argument, Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { mapContensisOpts } from './globalOptions';\n\nexport const makeGetCommand = () => {\n const program = new Command()\n .command('get')\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('contenttype')\n .argument('<contentTypeId>', 'the API id of the content type to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get contenttype {contentTypeId} -o content-type-backup.json\n`\n )\n .action(async (contentTypeId: string, opts) => {\n await cliCommand(['get', 'contenttype'], opts).PrintContentType(\n contentTypeId\n );\n });\n program\n .command('component')\n .argument('<componentId>', 'the API id of the component to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get component {componentId} -o component-backup.json\n`\n )\n .action(async (componentId: string, opts) => {\n await cliCommand(['get', 'component'], opts).PrintComponent(componentId);\n });\n program\n .command('entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .option('-i --id <id...>', 'the entry id to get')\n .option(\n '-d, --dependents',\n 'find and return any dependencies of all found entries'\n )\n .option(\n '-fi, --fields <fields...>',\n 'limit the output fields on returned entries'\n )\n .option(\n '-q, --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get entries --zenql \"sys.contentTypeId = blog\" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n // console.log('phrase: ', phrase, '\\nopts:', JSON.stringify(opts, null, 2));\n // console.log('opts:', JSON.stringify(opts, null, 2));\n await cliCommand(\n ['get', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).GetEntries({\n withDependents: opts.dependents,\n });\n });\n\n const block = program\n .command('block')\n .argument('[blockId]', 'the block to get version details for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'main'\n )\n .argument(\n '[version]',\n 'get a specific version of the block pushed to the specified branch'\n )\n .action(async (blockId: string, branch: string, version: string, opts) => {\n await cliCommand(['get', 'block'], opts).PrintBlockVersions(\n blockId,\n branch,\n version\n );\n });\n\n const dataCenter = new Argument(\n '[dataCenter]',\n 'the datacentre of the block to get logs for'\n )\n .choices(['hq', 'london', 'manchester'])\n .default('hq');\n\n block\n .command('logs')\n .argument('[blockId]', 'the block to get version logs for')\n .argument(\n '[branch]',\n 'the branch of the block to get version details for',\n 'main'\n )\n .argument(\n '[version]',\n 'the version of the block pushed to the branch to get logs for',\n 'latest'\n )\n .addArgument(dataCenter)\n .usage('get block logs [blockId] [branch] [version] [dataCenter]')\n .action(\n async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london',\n opts\n ) => {\n await cliCommand(['get', 'block', 'logs'], opts).PrintBlockLogs(\n blockId,\n branch,\n version,\n dataCenter\n );\n }\n );\n\n return program;\n};\n\nexport const get = makeGetCommand();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAC3B,2BAAiC;AAE1B,MAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,KAAK,EACb,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,aAAa,EACrB,SAAS,mBAAmB,uCAAuC,EACnE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,eAAuB,SAAS;AAC7C,cAAM,uCAAW,CAAC,OAAO,aAAa,GAAG,IAAI,EAAE;AAAA,MAC7C;AAAA,IACF;AAAA,EACF,CAAC;AACH,UACG,QAAQ,WAAW,EACnB,SAAS,iBAAiB,oCAAoC,EAC9D;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,aAAqB,SAAS;AAC3C,cAAM,uCAAW,CAAC,OAAO,WAAW,GAAG,IAAI,EAAE,eAAe,WAAW;AAAA,EACzE,CAAC;AACH,UACG,QAAQ,SAAS,EACjB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,mBAAmB,qBAAqB,EAC/C;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,QAAgB,MAAM,QAAQ;AAG3C,cAAM;AAAA,MACJ,CAAC,OAAO,SAAS;AAAA,MACjB;AAAA,UACA,uCAAiB,EAAE,QAAQ,GAAG,KAAK,CAAC;AAAA,IACtC,EAAE,WAAW;AAAA,MACX,gBAAgB,KAAK;AAAA,IACvB,CAAC;AAAA,EACH,CAAC;AAEH,QAAM,QAAQ,QACX,QAAQ,OAAO,EACf,SAAS,aAAa,sCAAsC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,OAAO,SAAiB,QAAgB,SAAiB,SAAS;AACxE,cAAM,uCAAW,CAAC,OAAO,OAAO,GAAG,IAAI,EAAE;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,QAAM,aAAa,IAAI;AAAA,IACrB;AAAA,IACA;AAAA,EACF,EACG,QAAQ,CAAC,MAAM,UAAU,YAAY,CAAC,EACtC,QAAQ,IAAI;AAEf,QACG,QAAQ,MAAM,EACd,SAAS,aAAa,mCAAmC,EACzD;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,YAAY,UAAU,EACtB,MAAM,0DAA0D,EAChE;AAAA,IACC,OACE,SACA,QACA,SACAA,aACA,SACG;AACH,gBAAM,uCAAW,CAAC,OAAO,SAAS,MAAM,GAAG,IAAI,EAAE;AAAA,QAC/C;AAAA,QACA;AAAA,QACA;AAAA,QACAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACT;AAEO,MAAM,MAAM,eAAe;",
|
|
6
|
+
"names": ["dataCenter"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
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 globalOptions_exports = {};
|
|
20
|
+
__export(globalOptions_exports, {
|
|
21
|
+
addAuthenticationOptions: () => addAuthenticationOptions,
|
|
22
|
+
addConnectOptions: () => addConnectOptions,
|
|
23
|
+
addGetEntryOptions: () => addGetEntryOptions,
|
|
24
|
+
addGlobalOptions: () => addGlobalOptions,
|
|
25
|
+
addImportOptions: () => addImportOptions,
|
|
26
|
+
commit: () => commit,
|
|
27
|
+
fromCms: () => fromCms,
|
|
28
|
+
fromFile: () => fromFile,
|
|
29
|
+
fromProject: () => fromProject,
|
|
30
|
+
mapContensisOpts: () => mapContensisOpts,
|
|
31
|
+
project: () => project
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(globalOptions_exports);
|
|
34
|
+
var import_commander = require("commander");
|
|
35
|
+
var import_util = require("../util");
|
|
36
|
+
const mapContensisOpts = (opts = {}) => ({
|
|
37
|
+
source: opts.sourceCms || opts.sourceProjectId ? {
|
|
38
|
+
url: opts.sourceCms ? (0, import_util.url)(opts.sourceCms, "website").cms : void 0,
|
|
39
|
+
project: opts.sourceProjectId || void 0
|
|
40
|
+
} : void 0,
|
|
41
|
+
query: opts.id || opts.phrase || opts.fields ? {
|
|
42
|
+
fields: opts.fields,
|
|
43
|
+
includeIds: opts.id,
|
|
44
|
+
searchTerm: opts.phrase
|
|
45
|
+
} : void 0,
|
|
46
|
+
zenQL: opts.zenql,
|
|
47
|
+
transformGuids: !opts.preserveGuids
|
|
48
|
+
});
|
|
49
|
+
const output = new import_commander.Option(
|
|
50
|
+
"-o, --output <output>",
|
|
51
|
+
"save output to a file e.g. --output ./output.txt"
|
|
52
|
+
);
|
|
53
|
+
const format = new import_commander.Option(
|
|
54
|
+
"-f, --format <format>",
|
|
55
|
+
"format output as csv, json, xml or table (default)"
|
|
56
|
+
).choices(["csv", "json", "xml", "table"]);
|
|
57
|
+
const alias = new import_commander.Option(
|
|
58
|
+
"-a --alias <alias>",
|
|
59
|
+
"the cloud CMS alias to connect your request with"
|
|
60
|
+
);
|
|
61
|
+
const project = new import_commander.Option(
|
|
62
|
+
"-p --project-id <projectId>",
|
|
63
|
+
"the projectId to make your request with"
|
|
64
|
+
);
|
|
65
|
+
const user = new import_commander.Option(
|
|
66
|
+
"-u --user <user>",
|
|
67
|
+
"the username to authenticate your request with"
|
|
68
|
+
);
|
|
69
|
+
const password = new import_commander.Option(
|
|
70
|
+
"-pw --password <password>",
|
|
71
|
+
"the password to use to login with (optional/insecure)"
|
|
72
|
+
);
|
|
73
|
+
const clientId = new import_commander.Option(
|
|
74
|
+
"-id --client-id <clientId>",
|
|
75
|
+
"the clientId to authenticate your request with"
|
|
76
|
+
);
|
|
77
|
+
const sharedSecret = new import_commander.Option(
|
|
78
|
+
"-s --shared-secret <sharedSecret>",
|
|
79
|
+
"the shared secret to use when logging in with a client id"
|
|
80
|
+
);
|
|
81
|
+
const zenql = new import_commander.Option(
|
|
82
|
+
"-q, --zenql <zenql>",
|
|
83
|
+
"get entries with a supplied ZenQL statement"
|
|
84
|
+
);
|
|
85
|
+
const entryId = new import_commander.Option("-i --id <id...>", "the entry id to get");
|
|
86
|
+
const fromFile = new import_commander.Option(
|
|
87
|
+
"-file --from-file <fromFile>",
|
|
88
|
+
"file path to import asset(s) from"
|
|
89
|
+
);
|
|
90
|
+
const fromCms = new import_commander.Option(
|
|
91
|
+
"-source --source-alias <fromCms>",
|
|
92
|
+
"the cloud CMS alias to import asset(s) from"
|
|
93
|
+
);
|
|
94
|
+
const fromProject = new import_commander.Option(
|
|
95
|
+
"-sp --source-project-id <fromProject>",
|
|
96
|
+
"the id of the Contensis project to import asset(s) from (Default: [last connected project])"
|
|
97
|
+
);
|
|
98
|
+
const commit = new import_commander.Option(
|
|
99
|
+
"--commit",
|
|
100
|
+
"omit and only add this flag when you are happy with the preview of the import"
|
|
101
|
+
).default(false);
|
|
102
|
+
const addConnectOptions = (program) => program.addOption(alias.hideHelp()).addOption(project.hideHelp());
|
|
103
|
+
const addAuthenticationOptions = (program) => program.addOption(user.hideHelp()).addOption(password.hideHelp()).addOption(clientId.hideHelp()).addOption(sharedSecret.hideHelp());
|
|
104
|
+
const addOutputAndFormatOptions = (program) => program.addOption(output).addOption(format);
|
|
105
|
+
const addImportOptions = (program) => {
|
|
106
|
+
for (const command of program.commands) {
|
|
107
|
+
command.addOption(fromFile).addOption(fromCms).addOption(fromProject);
|
|
108
|
+
}
|
|
109
|
+
return program;
|
|
110
|
+
};
|
|
111
|
+
const addGetEntryOptions = (program) => {
|
|
112
|
+
for (const command of program.commands) {
|
|
113
|
+
command.addOption(entryId).addOption(zenql);
|
|
114
|
+
}
|
|
115
|
+
return program;
|
|
116
|
+
};
|
|
117
|
+
const addGlobalOptions = (program) => {
|
|
118
|
+
for (const command of program.commands) {
|
|
119
|
+
addOutputAndFormatOptions(command);
|
|
120
|
+
addConnectOptions(command);
|
|
121
|
+
addAuthenticationOptions(command);
|
|
122
|
+
}
|
|
123
|
+
return program;
|
|
124
|
+
};
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
addAuthenticationOptions,
|
|
128
|
+
addConnectOptions,
|
|
129
|
+
addGetEntryOptions,
|
|
130
|
+
addGlobalOptions,
|
|
131
|
+
addImportOptions,
|
|
132
|
+
commit,
|
|
133
|
+
fromCms,
|
|
134
|
+
fromFile,
|
|
135
|
+
fromProject,
|
|
136
|
+
mapContensisOpts,
|
|
137
|
+
project
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=globalOptions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/globalOptions.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { url } from '~/util';\n\nexport const mapContensisOpts = (opts: any = {}) => ({\n source:\n opts.sourceCms || opts.sourceProjectId\n ? {\n url: opts.sourceCms\n ? url(opts.sourceCms, 'website').cms\n : (undefined as any),\n project: opts.sourceProjectId || (undefined as any),\n }\n : undefined,\n query:\n opts.id || opts.phrase || opts.fields\n ? {\n fields: opts.fields,\n includeIds: opts.id,\n searchTerm: opts.phrase,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n});\n\n/* Output options */\nconst output = new Option(\n '-o, --output <output>',\n 'save output to a file e.g. --output ./output.txt'\n);\n\nconst format = new Option(\n '-f, --format <format>',\n 'format output as csv, json, xml or table (default)'\n).choices(['csv', 'json', 'xml', 'table']);\n\n/* Connect options */\nconst alias = new Option(\n '-a --alias <alias>',\n 'the cloud CMS alias to connect your request with'\n);\n\nexport const project = new Option(\n '-p --project-id <projectId>',\n 'the projectId to make your request with'\n);\n\n/* Authentication options */\nconst user = new Option(\n '-u --user <user>',\n 'the username to authenticate your request with'\n);\nconst password = new Option(\n '-pw --password <password>',\n 'the password to use to login with (optional/insecure)'\n);\nconst clientId = new Option(\n '-id --client-id <clientId>',\n 'the clientId to authenticate your request with'\n);\nconst sharedSecret = new Option(\n '-s --shared-secret <sharedSecret>',\n 'the shared secret to use when logging in with a client id'\n);\n\n/* Entry get options */\nconst zenql = new Option(\n '-q, --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n);\n\nconst entryId = new Option('-i --id <id...>', 'the entry id to get');\n\n/* Import options */\nexport const fromFile = new Option(\n '-file --from-file <fromFile>',\n 'file path to import asset(s) from'\n);\n\nexport const fromCms = new Option(\n '-source --source-alias <fromCms>',\n 'the cloud CMS alias to import asset(s) from'\n);\nexport const fromProject = new Option(\n '-sp --source-project-id <fromProject>',\n 'the id of the Contensis project to import asset(s) from (Default: [last connected project])'\n);\n\nexport const commit = new Option(\n '--commit',\n 'omit and only add this flag when you are happy with the preview of the import'\n).default(false);\n\nexport const addConnectOptions = (program: Command) =>\n program.addOption(alias.hideHelp()).addOption(project.hideHelp());\n\nexport const addAuthenticationOptions = (program: Command) =>\n program\n .addOption(user.hideHelp())\n .addOption(password.hideHelp())\n .addOption(clientId.hideHelp())\n .addOption(sharedSecret.hideHelp());\n\nconst addOutputAndFormatOptions = (program: Command) =>\n program.addOption(output).addOption(format);\n\nexport const addImportOptions = (program: Command) => {\n for (const command of program.commands) {\n command.addOption(fromFile).addOption(fromCms).addOption(fromProject);\n }\n return program;\n};\nexport const addGetEntryOptions = (program: Command) => {\n for (const command of program.commands) {\n command.addOption(entryId).addOption(zenql);\n }\n return program;\n};\nexport const addGlobalOptions = (program: Command) => {\n for (const command of program.commands) {\n addOutputAndFormatOptions(command);\n addConnectOptions(command);\n addAuthenticationOptions(command);\n }\n return program;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,kBAAoB;AAEb,MAAM,mBAAmB,CAAC,OAAY,CAAC,OAAO;AAAA,EACnD,QACE,KAAK,aAAa,KAAK,kBACnB;AAAA,IACE,KAAK,KAAK,gBACN,iBAAI,KAAK,WAAW,SAAS,EAAE,MAC9B;AAAA,IACL,SAAS,KAAK,mBAAoB;AAAA,EACpC,IACA;AAAA,EACN,OACE,KAAK,MAAM,KAAK,UAAU,KAAK,SAC3B;AAAA,IACE,QAAQ,KAAK;AAAA,IACb,YAAY,KAAK;AAAA,IACjB,YAAY,KAAK;AAAA,EACnB,IACA;AAAA,EACN,OAAO,KAAK;AAAA,EACZ,gBAAgB,CAAC,KAAK;AACxB;AAGA,MAAM,SAAS,IAAI;AAAA,EACjB;AAAA,EACA;AACF;AAEA,MAAM,SAAS,IAAI;AAAA,EACjB;AAAA,EACA;AACF,EAAE,QAAQ,CAAC,OAAO,QAAQ,OAAO,OAAO,CAAC;AAGzC,MAAM,QAAQ,IAAI;AAAA,EAChB;AAAA,EACA;AACF;AAEO,MAAM,UAAU,IAAI;AAAA,EACzB;AAAA,EACA;AACF;AAGA,MAAM,OAAO,IAAI;AAAA,EACf;AAAA,EACA;AACF;AACA,MAAM,WAAW,IAAI;AAAA,EACnB;AAAA,EACA;AACF;AACA,MAAM,WAAW,IAAI;AAAA,EACnB;AAAA,EACA;AACF;AACA,MAAM,eAAe,IAAI;AAAA,EACvB;AAAA,EACA;AACF;AAGA,MAAM,QAAQ,IAAI;AAAA,EAChB;AAAA,EACA;AACF;AAEA,MAAM,UAAU,IAAI,wBAAO,mBAAmB,qBAAqB;AAG5D,MAAM,WAAW,IAAI;AAAA,EAC1B;AAAA,EACA;AACF;AAEO,MAAM,UAAU,IAAI;AAAA,EACzB;AAAA,EACA;AACF;AACO,MAAM,cAAc,IAAI;AAAA,EAC7B;AAAA,EACA;AACF;AAEO,MAAM,SAAS,IAAI;AAAA,EACxB;AAAA,EACA;AACF,EAAE,QAAQ,KAAK;AAER,MAAM,oBAAoB,CAAC,YAChC,QAAQ,UAAU,MAAM,SAAS,CAAC,EAAE,UAAU,QAAQ,SAAS,CAAC;AAE3D,MAAM,2BAA2B,CAAC,YACvC,QACG,UAAU,KAAK,SAAS,CAAC,EACzB,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,aAAa,SAAS,CAAC;AAEtC,MAAM,4BAA4B,CAAC,YACjC,QAAQ,UAAU,MAAM,EAAE,UAAU,MAAM;AAErC,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,QAAQ,EAAE,UAAU,OAAO,EAAE,UAAU,WAAW;AAAA,EACtE;AACA,SAAO;AACT;AACO,MAAM,qBAAqB,CAAC,YAAqB;AACtD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,OAAO,EAAE,UAAU,KAAK;AAAA,EAC5C;AACA,SAAO;AACT;AACO,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,8BAA0B,OAAO;AACjC,sBAAkB,OAAO;AACzB,6BAAyB,OAAO;AAAA,EAClC;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 import_exports = {};
|
|
20
|
+
__export(import_exports, {
|
|
21
|
+
get: () => get,
|
|
22
|
+
makeImportCommand: () => makeImportCommand
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(import_exports);
|
|
25
|
+
var import_commander = require("commander");
|
|
26
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
27
|
+
var import_globalOptions = require("./globalOptions");
|
|
28
|
+
const makeImportCommand = () => {
|
|
29
|
+
const program = new import_commander.Command().command("import").showHelpAfterError(true).exitOverride();
|
|
30
|
+
program.command("contenttypes").argument(
|
|
31
|
+
"[contentTypeIds]",
|
|
32
|
+
"Optional list of API id(s) of the content type(s) to import"
|
|
33
|
+
).addHelpText(
|
|
34
|
+
"after",
|
|
35
|
+
`
|
|
36
|
+
Example call:
|
|
37
|
+
> import contenttypes {contentTypeIds} --from-file contenttypes-backup.json
|
|
38
|
+
> import contenttypes {contentTypeIds} --source-alias example-dev
|
|
39
|
+
`
|
|
40
|
+
).action(async (contentTypeIds, opts) => {
|
|
41
|
+
await (0, import_ContensisCliService.cliCommand)(["import", "contenttypes"], opts).ImportContentTypes(
|
|
42
|
+
{
|
|
43
|
+
fromFile: opts.fromFile,
|
|
44
|
+
commit: opts.commit
|
|
45
|
+
},
|
|
46
|
+
contentTypeIds
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
program.command("components").argument(
|
|
50
|
+
"[componentIds]",
|
|
51
|
+
"Optional list of API id(s) of the component(s) to import"
|
|
52
|
+
).addHelpText(
|
|
53
|
+
"after",
|
|
54
|
+
`
|
|
55
|
+
Example call:
|
|
56
|
+
> import components {componentIds} --from-file component-backup.json
|
|
57
|
+
> import components {componentIds} --source-alias example-dev
|
|
58
|
+
`
|
|
59
|
+
).action(async (componentIds, opts) => {
|
|
60
|
+
await (0, import_ContensisCliService.cliCommand)(["import", "component"], opts).ImportComponents(
|
|
61
|
+
{
|
|
62
|
+
fromFile: opts.fromFile,
|
|
63
|
+
commit: opts.commit
|
|
64
|
+
},
|
|
65
|
+
componentIds
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
program.command("entries").argument(
|
|
69
|
+
"[search phrase]",
|
|
70
|
+
"get entries with the search phrase, use quotes for multiple words"
|
|
71
|
+
).addOption(import_globalOptions.commit).option(
|
|
72
|
+
"-preserve, --preserve-guids",
|
|
73
|
+
"include this flag when you are importing entries that you have previously exported and wish to update"
|
|
74
|
+
).addHelpText(
|
|
75
|
+
"after",
|
|
76
|
+
`
|
|
77
|
+
Example call:
|
|
78
|
+
> import entries --source-cms example-dev --source-project-id microsite --zenql "sys.contentTypeId = blog"
|
|
79
|
+
`
|
|
80
|
+
).action(async (phrase, opts, cmd) => {
|
|
81
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
82
|
+
["import", "entries"],
|
|
83
|
+
opts,
|
|
84
|
+
(0, import_globalOptions.mapContensisOpts)({ phrase, ...opts })
|
|
85
|
+
).ImportEntries({ commit: opts.commit, fromFile: opts.fromFile });
|
|
86
|
+
});
|
|
87
|
+
return program;
|
|
88
|
+
};
|
|
89
|
+
const get = makeImportCommand();
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
get,
|
|
93
|
+
makeImportCommand
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/import.ts"],
|
|
4
|
+
"sourcesContent": ["import { Argument, Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { url } from '~/util';\nimport { commit, mapContensisOpts } from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('contenttypes')\n .argument(\n '[contentTypeIds]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json\n > import contenttypes {contentTypeIds} --source-alias example-dev\n`\n )\n .action(async (contentTypeIds: string[], opts) => {\n await cliCommand(['import', 'contenttypes'], opts).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .argument(\n '[componentIds]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import components {componentIds} --from-file component-backup.json\n > import components {componentIds} --source-alias example-dev\n`\n )\n .action(async (componentIds: string[], opts) => {\n await cliCommand(['import', 'component'], opts).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n program\n .command('entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(commit)\n .option(\n '-preserve, --preserve-guids',\n 'include this flag when you are importing entries that you have previously exported and wish to update'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).ImportEntries({ commit: opts.commit, fromFile: opts.fromFile });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAE3B,2BAAyC;AAElC,MAAM,oBAAoB,MAAM;AACrC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,QAAQ,EAChB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,cAAc,EACtB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,OAAO,OAAO,gBAA0B,SAAS;AAChD,cAAM,uCAAW,CAAC,UAAU,cAAc,GAAG,IAAI,EAAE;AAAA,MACjD;AAAA,QACE,UAAU,KAAK;AAAA,QACf,QAAQ,KAAK;AAAA,MACf;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,UACG,QAAQ,YAAY,EACpB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,OAAO,OAAO,cAAwB,SAAS;AAC9C,cAAM,uCAAW,CAAC,UAAU,WAAW,GAAG,IAAI,EAAE;AAAA,MAC9C;AAAA,QACE,UAAU,KAAK;AAAA,QACf,QAAQ,KAAK;AAAA,MACf;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,UACG,QAAQ,SAAS,EACjB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,2BAAM,EAChB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,QAAgB,MAAM,QAAQ;AAC3C,cAAM;AAAA,MACJ,CAAC,UAAU,SAAS;AAAA,MACpB;AAAA,UACA,uCAAiB,EAAE,QAAQ,GAAG,KAAK,CAAC;AAAA,IACtC,EAAE,cAAc,EAAE,QAAQ,KAAK,QAAQ,UAAU,KAAK,SAAS,CAAC;AAAA,EAClE,CAAC;AAEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 commands_exports = {};
|
|
20
|
+
__export(commands_exports, {
|
|
21
|
+
default: () => commands_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(commands_exports);
|
|
24
|
+
var import_commander = require("commander");
|
|
25
|
+
var import_logger = require("../util/logger");
|
|
26
|
+
var import_version = require("../version");
|
|
27
|
+
var import_connect = require("./connect");
|
|
28
|
+
var import_create = require("./create");
|
|
29
|
+
var import_get = require("./get");
|
|
30
|
+
var import_globalOptions = require("./globalOptions");
|
|
31
|
+
var import_import = require("./import");
|
|
32
|
+
var import_list = require("./list");
|
|
33
|
+
var import_login = require("./login");
|
|
34
|
+
var import_push = require("./push");
|
|
35
|
+
var import_remove = require("./remove");
|
|
36
|
+
var import_set = require("./set");
|
|
37
|
+
const commands = () => {
|
|
38
|
+
const program = new import_commander.Command().name("contensis").version(import_version.LIB_VERSION).configureOutput({
|
|
39
|
+
writeErr: (str) => {
|
|
40
|
+
return str.toLowerCase().includes("error") ? import_logger.Logger.error(`Command ${str}`) : str.trim() && import_logger.Logger.help(str);
|
|
41
|
+
}
|
|
42
|
+
}).exitOverride().showHelpAfterError(true);
|
|
43
|
+
program.addCommand(
|
|
44
|
+
(0, import_globalOptions.addAuthenticationOptions)((0, import_connect.makeConnectCommand)()).copyInheritedSettings(
|
|
45
|
+
program
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
program.addCommand(
|
|
49
|
+
(0, import_globalOptions.addGlobalOptions)(
|
|
50
|
+
(0, import_globalOptions.addImportOptions)((0, import_create.makeCreateCommand)())
|
|
51
|
+
).copyInheritedSettings(program)
|
|
52
|
+
);
|
|
53
|
+
program.addCommand(
|
|
54
|
+
(0, import_globalOptions.addGlobalOptions)((0, import_get.makeGetCommand)()).copyInheritedSettings(program)
|
|
55
|
+
);
|
|
56
|
+
program.addCommand(
|
|
57
|
+
(0, import_globalOptions.addGlobalOptions)(
|
|
58
|
+
(0, import_globalOptions.addGetEntryOptions)((0, import_globalOptions.addImportOptions)((0, import_import.makeImportCommand)()))
|
|
59
|
+
).copyInheritedSettings(program)
|
|
60
|
+
);
|
|
61
|
+
program.addCommand(
|
|
62
|
+
(0, import_globalOptions.addGlobalOptions)((0, import_list.makeListCommand)()).copyInheritedSettings(program)
|
|
63
|
+
);
|
|
64
|
+
program.addCommand(
|
|
65
|
+
(0, import_globalOptions.addConnectOptions)((0, import_login.makeLoginCommand)()).copyInheritedSettings(program)
|
|
66
|
+
);
|
|
67
|
+
program.addCommand(
|
|
68
|
+
(0, import_globalOptions.addGlobalOptions)((0, import_push.makePushCommand)()).copyInheritedSettings(program)
|
|
69
|
+
);
|
|
70
|
+
program.addCommand(
|
|
71
|
+
(0, import_globalOptions.addGlobalOptions)((0, import_remove.makeRemoveCommand)()).copyInheritedSettings(program)
|
|
72
|
+
);
|
|
73
|
+
program.addCommand(
|
|
74
|
+
(0, import_globalOptions.addConnectOptions)((0, import_set.makeSetCommand)()).copyInheritedSettings(program)
|
|
75
|
+
);
|
|
76
|
+
return program;
|
|
77
|
+
};
|
|
78
|
+
var commands_default = commands;
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {});
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCreateCommand } from './create';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\n addGetEntryOptions,\n addGlobalOptions,\n addImportOptions,\n} from './globalOptions';\nimport { makeImportCommand } from './import';\nimport { makeListCommand } from './list';\nimport { makeLoginCommand } from './login';\nimport { makePushCommand } from './push';\nimport { makeRemoveCommand } from './remove';\nimport { makeSetCommand } from './set';\n\nconst commands = () => {\n const program = new Command()\n .name('contensis')\n .version(LIB_VERSION)\n .configureOutput({\n writeErr: str => {\n return str.toLowerCase().includes('error')\n ? Logger.error(`Command ${str}`)\n : str.trim() && Logger.help(str);\n },\n })\n .exitOverride()\n .showHelpAfterError(true);\n\n program.addCommand(\n addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(\n addImportOptions(makeCreateCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(\n addGetEntryOptions(addImportOptions(makeImportCommand()))\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeListCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeLoginCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makePushCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeRemoveCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(makeSetCommand()).copyInheritedSettings(program)\n );\n\n return program;\n};\n\nexport default commands;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,oBAAuB;AACvB,qBAA4B;AAC5B,qBAAmC;AACnC,oBAAkC;AAClC,iBAA+B;AAC/B,2BAMO;AACP,oBAAkC;AAClC,kBAAgC;AAChC,mBAAiC;AACjC,kBAAgC;AAChC,oBAAkC;AAClC,iBAA+B;AAE/B,MAAM,WAAW,MAAM;AACrB,QAAM,UAAU,IAAI,yBAAQ,EACzB,KAAK,WAAW,EAChB,QAAQ,0BAAW,EACnB,gBAAgB;AAAA,IACf,UAAU,SAAO;AACf,aAAO,IAAI,YAAY,EAAE,SAAS,OAAO,IACrC,qBAAO,MAAM,WAAW,KAAK,IAC7B,IAAI,KAAK,KAAK,qBAAO,KAAK,GAAG;AAAA,IACnC;AAAA,EACF,CAAC,EACA,aAAa,EACb,mBAAmB,IAAI;AAE1B,UAAQ;AAAA,QACN,mDAAyB,mCAAmB,CAAC,EAAE;AAAA,MAC7C;AAAA,IACF;AAAA,EACF;AACA,UAAQ;AAAA,QACN;AAAA,UACE,2CAAiB,iCAAkB,CAAC;AAAA,IACtC,EAAE,sBAAsB,OAAO;AAAA,EACjC;AACA,UAAQ;AAAA,QACN,2CAAiB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAClE;AACA,UAAQ;AAAA,QACN;AAAA,UACE,6CAAmB,2CAAiB,iCAAkB,CAAC,CAAC;AAAA,IAC1D,EAAE,sBAAsB,OAAO;AAAA,EACjC;AACA,UAAQ;AAAA,QACN,2CAAiB,6BAAgB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AACA,UAAQ;AAAA,QACN,4CAAkB,+BAAiB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,2CAAiB,6BAAgB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AACA,UAAQ;AAAA,QACN,2CAAiB,iCAAkB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,4CAAkB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AAEA,SAAO;AACT;AAEA,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|