contensis-cli 1.0.0-beta.52 → 1.0.0-beta.53
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 -15
- package/README.md +1226 -1226
- package/dist/commands/connect.js +44 -0
- package/dist/commands/connect.js.map +7 -0
- package/dist/commands/create.js +75 -0
- package/dist/commands/create.js.map +7 -0
- package/dist/commands/diff.js +57 -0
- package/dist/commands/diff.js.map +7 -0
- package/dist/commands/get.js +170 -0
- package/dist/commands/get.js.map +7 -0
- package/dist/commands/globalOptions.js +144 -0
- package/dist/commands/globalOptions.js.map +7 -0
- package/dist/commands/import.js +121 -0
- package/dist/commands/import.js.map +7 -0
- package/dist/commands/index.js +89 -0
- package/dist/commands/index.js.map +7 -0
- package/dist/commands/list.js +99 -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 +137 -0
- package/dist/commands/push.js.map +7 -0
- package/dist/commands/release.js +47 -0
- package/dist/commands/release.js.map +7 -0
- package/dist/commands/remove.js +79 -0
- package/dist/commands/remove.js.map +7 -0
- package/dist/commands/set.js +96 -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 +253 -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 +116 -0
- package/dist/providers/CredentialProvider.js.map +7 -0
- package/dist/providers/SessionCacheProvider.js +111 -0
- package/dist/providers/SessionCacheProvider.js.map +7 -0
- package/dist/providers/file-provider.js +117 -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 +1374 -0
- package/dist/services/ContensisCliService.js.map +7 -0
- package/dist/shell.js +278 -0
- package/dist/shell.js.map +7 -0
- package/dist/util/console.printer.js +317 -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 +97 -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 +216 -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 -49
- package/headless-setup.sh +6 -6
- package/package.json +59 -59
- package/src/commands/connect.ts +24 -24
- package/src/commands/create.ts +70 -70
- package/src/commands/diff.ts +41 -41
- package/src/commands/get.ts +214 -214
- package/src/commands/globalOptions.ts +127 -127
- package/src/commands/import.ts +128 -128
- package/src/commands/index.ts +80 -80
- package/src/commands/list.ts +116 -116
- package/src/commands/login.ts +34 -34
- package/src/commands/push.ts +127 -127
- package/src/commands/release.ts +32 -32
- package/src/commands/remove.ts +85 -85
- package/src/commands/set.ts +96 -96
- package/src/index.ts +19 -19
- package/src/localisation/en-GB.ts +289 -289
- package/src/models/AppError.d.ts +40 -40
- package/src/models/Cache.d.ts +25 -25
- package/src/models/JsModules.d.ts +1 -1
- package/src/providers/CredentialProvider.ts +121 -121
- package/src/providers/SessionCacheProvider.ts +101 -101
- package/src/providers/file-provider.ts +76 -76
- package/src/services/ContensisAuthService.ts +70 -70
- package/src/services/ContensisCliService.ts +1745 -1745
- package/src/shell.ts +270 -270
- package/src/util/console.printer.ts +371 -371
- package/src/util/csv.formatter.ts +21 -21
- package/src/util/index.ts +73 -73
- package/src/util/json.formatter.ts +1 -1
- package/src/util/logger.ts +234 -234
- package/src/util/xml.formatter.ts +20 -20
- package/src/version.ts +1 -1
- package/tsconfig.json +22 -22
|
@@ -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").description("connect to a Contensis instance").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, alias }).Connect(alias);
|
|
36
|
+
await (0, import_shell.shell)().restart();
|
|
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';\r\nimport { cliCommand } from '~/services/ContensisCliService';\r\nimport { shell } from '~/shell';\r\nimport { project } from './globalOptions';\r\n\r\nexport const makeConnectCommand = () => {\r\n const connect = new Command()\r\n .command('connect')\r\n .description('connect to a Contensis instance')\r\n .argument('<alias>', 'the Contensis Cloud alias to connect with')\r\n .addOption(project)\r\n .usage('<alias>')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > connect example-dev`\r\n )\r\n .action(async (alias, opts) => {\r\n await cliCommand(['connect', alias], { ...opts, alias }).Connect(alias);\r\n await shell().restart();\r\n });\r\n return connect;\r\n};\r\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,YAAY,iCAAiC,EAC7C,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,EAAE,GAAG,MAAM,MAAM,CAAC,EAAE,QAAQ,KAAK;AACtE,cAAM,oBAAM,EAAE,QAAQ;AAAA,EACxB,CAAC;AACH,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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").description("create command").addHelpText("after", `
|
|
29
|
+
`).showHelpAfterError(true).exitOverride();
|
|
30
|
+
create.command("project").description("create a new project").argument("<projectId>", "the id of the project to create").argument("<name>", "the name of the project to create").argument("[description]", "optional description of the project").option(
|
|
31
|
+
"-l, --language",
|
|
32
|
+
"the default language of the project to create",
|
|
33
|
+
"en-GB"
|
|
34
|
+
).option(
|
|
35
|
+
"-langs, --supported-languages <langs...>",
|
|
36
|
+
"space separated list of other supported languages"
|
|
37
|
+
).usage(
|
|
38
|
+
'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
|
|
39
|
+
).addHelpText("after", `
|
|
40
|
+
`).action(
|
|
41
|
+
async (projectId, name, description = "", opts) => {
|
|
42
|
+
const createProject = {
|
|
43
|
+
id: projectId,
|
|
44
|
+
name,
|
|
45
|
+
description,
|
|
46
|
+
primaryLanguage: opts.language,
|
|
47
|
+
supportedLanguages: opts.supportedLanguages || []
|
|
48
|
+
};
|
|
49
|
+
const project = await (0, import_ContensisCliService.cliCommand)(
|
|
50
|
+
["create", "project", projectId],
|
|
51
|
+
opts
|
|
52
|
+
).CreateProject(createProject);
|
|
53
|
+
if (project)
|
|
54
|
+
await (0, import_shell.shell)().restart();
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
create.command("key").description("create a new api 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(
|
|
58
|
+
"after",
|
|
59
|
+
`
|
|
60
|
+
Example call:
|
|
61
|
+
> create key "my new key" "Created key for demonstration"
|
|
62
|
+
`
|
|
63
|
+
).action(async (name, description, opts) => {
|
|
64
|
+
await (0, import_ContensisCliService.cliCommand)(["create", "key", name], opts).CreateApiKey(
|
|
65
|
+
name,
|
|
66
|
+
description
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
return create;
|
|
70
|
+
};
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
makeCreateCommand
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/create.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\r\nimport { Project } from 'contensis-core-api';\r\nimport { cliCommand } from '~/services/ContensisCliService';\r\nimport { shell } from '~/shell';\r\n\r\nexport const makeCreateCommand = () => {\r\n const create = new Command()\r\n .command('create')\r\n .description('create command')\r\n .addHelpText('after', `\\n`)\r\n .showHelpAfterError(true)\r\n .exitOverride();\r\n\r\n create\r\n .command('project')\r\n .description('create a new project')\r\n .argument('<projectId>', 'the id of the project to create')\r\n .argument('<name>', 'the name of the project to create')\r\n .argument('[description]', 'optional description of the project')\r\n .option(\r\n '-l, --language',\r\n 'the default language of the project to create',\r\n 'en-GB'\r\n )\r\n .option(\r\n '-langs, --supported-languages <langs...>',\r\n 'space separated list of other supported languages'\r\n )\r\n .usage(\r\n 'projectId \"Project name\" [\"Description of project\"] --language en-GB --supported-languages es-ES de-DE nl-NL'\r\n )\r\n .addHelpText('after', `\\n`)\r\n .action(\r\n async (projectId: string, name: string, description = '', opts: any) => {\r\n const createProject: Project = {\r\n id: projectId,\r\n name,\r\n description,\r\n primaryLanguage: opts.language,\r\n supportedLanguages: opts.supportedLanguages || [],\r\n };\r\n\r\n const project = await cliCommand(\r\n ['create', 'project', projectId],\r\n opts\r\n ).CreateProject(createProject);\r\n if (project) await shell().restart();\r\n }\r\n );\r\n create\r\n .command('key')\r\n .description('create a new api key')\r\n .argument('<\"key name\">', 'the name of the key to create')\r\n .argument('[\"description\"]', 'provide a description for the key (optional)')\r\n .usage('<\"key name\"> [\"description\"] (both args in \"double quotes\")')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > create key \"my new key\" \"Created key for demonstration\"\\n`\r\n )\r\n .action(async (name: string, description: string, opts: any) => {\r\n await cliCommand(['create', 'key', name], opts).CreateApiKey(\r\n name,\r\n description\r\n );\r\n });\r\n\r\n return create;\r\n};\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA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}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 diff_exports = {};
|
|
20
|
+
__export(diff_exports, {
|
|
21
|
+
makeDiffCommand: () => makeDiffCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(diff_exports);
|
|
24
|
+
var import_commander = require("commander");
|
|
25
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
+
var import_globalOptions = require("./globalOptions");
|
|
27
|
+
const makeDiffCommand = () => {
|
|
28
|
+
const release = new import_commander.Command().command("diff").description("diff command").addHelpText("after", `
|
|
29
|
+
`).showHelpAfterError(true).exitOverride();
|
|
30
|
+
release.command("models").description("differences with content models").argument(
|
|
31
|
+
"[model-ids...]",
|
|
32
|
+
"ids of any content types or components to diff (optional)"
|
|
33
|
+
).usage("[model-ids...]").addHelpText(
|
|
34
|
+
"after",
|
|
35
|
+
`
|
|
36
|
+
Example call:
|
|
37
|
+
> diff models blogPost
|
|
38
|
+
`
|
|
39
|
+
).action(async (modelIds = [], opts) => {
|
|
40
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
41
|
+
["diff", "models", modelIds.join(" ")],
|
|
42
|
+
opts,
|
|
43
|
+
(0, import_globalOptions.mapContensisOpts)({ modelIds, ...opts })
|
|
44
|
+
).DiffModels(
|
|
45
|
+
{
|
|
46
|
+
...opts
|
|
47
|
+
},
|
|
48
|
+
modelIds
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
return release;
|
|
52
|
+
};
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
makeDiffCommand
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/diff.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\r\nimport { cliCommand } from '~/services/ContensisCliService';\r\nimport { mapContensisOpts } from './globalOptions';\r\n\r\nexport const makeDiffCommand = () => {\r\n const release = new Command()\r\n .command('diff')\r\n .description('diff command')\r\n .addHelpText('after', `\\n`)\r\n .showHelpAfterError(true)\r\n .exitOverride();\r\n\r\n release\r\n .command('models')\r\n .description('differences with content models')\r\n .argument(\r\n '[model-ids...]',\r\n 'ids of any content types or components to diff (optional)'\r\n )\r\n .usage('[model-ids...]')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > diff models blogPost\\n`\r\n )\r\n .action(async (modelIds: string[] = [], opts) => {\r\n await cliCommand(\r\n ['diff', 'models', modelIds.join(' ')],\r\n opts,\r\n mapContensisOpts({ modelIds, ...opts })\r\n ).DiffModels(\r\n {\r\n ...opts,\r\n },\r\n modelIds\r\n );\r\n });\r\n\r\n return release;\r\n};\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,2BAAiC;AAE1B,MAAM,kBAAkB,MAAM;AACnC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,QAAQ,EAChB,YAAY,iCAAiC,EAC7C;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,MAAM,gBAAgB,EACtB;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,WAAqB,CAAC,GAAG,SAAS;AAC/C,cAAM;AAAA,MACJ,CAAC,QAAQ,UAAU,SAAS,KAAK,GAAG,CAAC;AAAA,MACrC;AAAA,UACA,uCAAiB,EAAE,UAAU,GAAG,KAAK,CAAC;AAAA,IACxC,EAAE;AAAA,MACA;AAAA,QACE,GAAG;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
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").addHelpText("after", `
|
|
30
|
+
`).showHelpAfterError(true).exitOverride();
|
|
31
|
+
program.command("version").description("get current Contensis version").addHelpText(
|
|
32
|
+
"after",
|
|
33
|
+
`
|
|
34
|
+
Example call:
|
|
35
|
+
> version
|
|
36
|
+
`
|
|
37
|
+
).action(async (opts) => {
|
|
38
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "version"], opts).PrintContensisVersion();
|
|
39
|
+
});
|
|
40
|
+
program.command("project").description("get a project").argument("[projectId]", "id of the project to get (default: current)").addHelpText(
|
|
41
|
+
"after",
|
|
42
|
+
`
|
|
43
|
+
Example call:
|
|
44
|
+
> get project website
|
|
45
|
+
`
|
|
46
|
+
).action(async (projectId, opts) => {
|
|
47
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "project", projectId], opts).PrintProject(
|
|
48
|
+
projectId
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
program.command("model").description("get a content model").argument("<contentTypeId...>", "ids of the content models to get").addHelpText(
|
|
52
|
+
"after",
|
|
53
|
+
`
|
|
54
|
+
Example call:
|
|
55
|
+
> get model podcast podcastLinks
|
|
56
|
+
`
|
|
57
|
+
).action(async (modelIds, opts) => {
|
|
58
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
59
|
+
["get", "model", modelIds.join(" ")],
|
|
60
|
+
opts
|
|
61
|
+
).PrintContentModels(modelIds);
|
|
62
|
+
});
|
|
63
|
+
program.command("contenttype").description("get a content type").argument("<contentTypeId>", "the API id of the content type to get").addHelpText(
|
|
64
|
+
"after",
|
|
65
|
+
`
|
|
66
|
+
Example call:
|
|
67
|
+
> get contenttype {contentTypeId} -o content-type-backup.json
|
|
68
|
+
`
|
|
69
|
+
).action(async (contentTypeId, opts) => {
|
|
70
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
71
|
+
["get", "contenttype", contentTypeId],
|
|
72
|
+
opts
|
|
73
|
+
).PrintContentType(contentTypeId);
|
|
74
|
+
});
|
|
75
|
+
program.command("component").description("get a component").argument("<componentId>", "the API id of the component to get").addHelpText(
|
|
76
|
+
"after",
|
|
77
|
+
`
|
|
78
|
+
Example call:
|
|
79
|
+
> get component {componentId} -o component-backup.json
|
|
80
|
+
`
|
|
81
|
+
).action(async (componentId, opts) => {
|
|
82
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "component", componentId], opts).PrintComponent(
|
|
83
|
+
componentId
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
program.command("entries").description("get entries").argument(
|
|
87
|
+
"[search phrase]",
|
|
88
|
+
"get entries with the search phrase, use quotes for multiple words"
|
|
89
|
+
).option("-i --id <id...>", "the entry id(s) to get").option(
|
|
90
|
+
"-d, --dependents",
|
|
91
|
+
"find and return any dependencies of all found entries"
|
|
92
|
+
).option(
|
|
93
|
+
"-fi, --fields <fields...>",
|
|
94
|
+
"limit the output fields on returned entries"
|
|
95
|
+
).option(
|
|
96
|
+
"-q, --zenql <zenql>",
|
|
97
|
+
"get entries with a supplied ZenQL statement"
|
|
98
|
+
).addHelpText(
|
|
99
|
+
"after",
|
|
100
|
+
`
|
|
101
|
+
Example call:
|
|
102
|
+
> get entries --zenql "sys.contentTypeId = blog" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv
|
|
103
|
+
`
|
|
104
|
+
).action(async (phrase, opts, cmd) => {
|
|
105
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
106
|
+
["get", "entries"],
|
|
107
|
+
opts,
|
|
108
|
+
(0, import_globalOptions.mapContensisOpts)({ phrase, ...opts })
|
|
109
|
+
).GetEntries({
|
|
110
|
+
withDependents: opts.dependents
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
const block = program.command("block").description("get a block or block version").argument("[blockId]", "the block to get version details for").argument(
|
|
114
|
+
"[branch]",
|
|
115
|
+
"the branch of the block to get version details for",
|
|
116
|
+
"main"
|
|
117
|
+
).argument(
|
|
118
|
+
"[version]",
|
|
119
|
+
"get a specific version of the block pushed to the specified branch"
|
|
120
|
+
).addHelpText(
|
|
121
|
+
"after",
|
|
122
|
+
`
|
|
123
|
+
Example call:
|
|
124
|
+
> get block contensis-website master latest
|
|
125
|
+
`
|
|
126
|
+
).action(async (blockId, branch, version, opts) => {
|
|
127
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "block"], opts).PrintBlockVersions(
|
|
128
|
+
blockId,
|
|
129
|
+
branch,
|
|
130
|
+
version
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
const dataCenter = new import_commander.Argument(
|
|
134
|
+
"[dataCenter]",
|
|
135
|
+
"the datacentre of the block to get logs for"
|
|
136
|
+
).choices(["hq", "london", "manchester"]).default("hq");
|
|
137
|
+
block.command("logs").description("get logs for a block").argument("[blockId]", "the block to get version logs for").argument(
|
|
138
|
+
"[branch]",
|
|
139
|
+
"the branch of the block to get version details for",
|
|
140
|
+
"main"
|
|
141
|
+
).argument(
|
|
142
|
+
"[version]",
|
|
143
|
+
"the version of the block pushed to the branch to get logs for",
|
|
144
|
+
"latest"
|
|
145
|
+
).addArgument(dataCenter).usage("get block logs [blockId] [branch] [version] [dataCenter]").addHelpText(
|
|
146
|
+
"after",
|
|
147
|
+
`
|
|
148
|
+
Example call:
|
|
149
|
+
> get block logs contensis-website master
|
|
150
|
+
> get block logs contensis-website master latest london
|
|
151
|
+
`
|
|
152
|
+
).action(
|
|
153
|
+
async (blockId, branch, version, dataCenter2, opts) => {
|
|
154
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "block", "logs"], opts).PrintBlockLogs(
|
|
155
|
+
blockId,
|
|
156
|
+
branch,
|
|
157
|
+
version,
|
|
158
|
+
dataCenter2
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
return program;
|
|
163
|
+
};
|
|
164
|
+
const get = makeGetCommand();
|
|
165
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
166
|
+
0 && (module.exports = {
|
|
167
|
+
get,
|
|
168
|
+
makeGetCommand
|
|
169
|
+
});
|
|
170
|
+
//# 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';\r\nimport { cliCommand } from '~/services/ContensisCliService';\r\nimport { mapContensisOpts } from './globalOptions';\r\n\r\nexport const makeGetCommand = () => {\r\n const program = new Command()\r\n .command('get')\r\n .addHelpText('after', `\\n`)\r\n .showHelpAfterError(true)\r\n .exitOverride();\r\n\r\n program\r\n .command('version')\r\n .description('get current Contensis version')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > version\r\n`\r\n )\r\n .action(async opts => {\r\n await cliCommand(['get', 'version'], opts).PrintContensisVersion();\r\n });\r\n\r\n program\r\n .command('project')\r\n .description('get a project')\r\n .argument('[projectId]', 'id of the project to get (default: current)')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > get project website\r\n`\r\n )\r\n .action(async (projectId: string, opts) => {\r\n await cliCommand(['get', 'project', projectId], opts).PrintProject(\r\n projectId\r\n );\r\n });\r\n\r\n program\r\n .command('model')\r\n .description('get a content model')\r\n .argument('<contentTypeId...>', 'ids of the content models to get')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > get model podcast podcastLinks\r\n`\r\n )\r\n .action(async (modelIds: string[], opts) => {\r\n await cliCommand(\r\n ['get', 'model', modelIds.join(' ')],\r\n opts\r\n ).PrintContentModels(modelIds);\r\n });\r\n\r\n program\r\n .command('contenttype')\r\n .description('get a content type')\r\n .argument('<contentTypeId>', 'the API id of the content type to get')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > get contenttype {contentTypeId} -o content-type-backup.json\r\n`\r\n )\r\n .action(async (contentTypeId: string, opts) => {\r\n await cliCommand(\r\n ['get', 'contenttype', contentTypeId],\r\n opts\r\n ).PrintContentType(contentTypeId);\r\n });\r\n\r\n program\r\n .command('component')\r\n .description('get a component')\r\n .argument('<componentId>', 'the API id of the component to get')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > get component {componentId} -o component-backup.json\r\n`\r\n )\r\n .action(async (componentId: string, opts) => {\r\n await cliCommand(['get', 'component', componentId], opts).PrintComponent(\r\n componentId\r\n );\r\n });\r\n\r\n program\r\n .command('entries')\r\n .description('get entries')\r\n .argument(\r\n '[search phrase]',\r\n 'get entries with the search phrase, use quotes for multiple words'\r\n )\r\n .option('-i --id <id...>', 'the entry id(s) to get')\r\n .option(\r\n '-d, --dependents',\r\n 'find and return any dependencies of all found entries'\r\n )\r\n .option(\r\n '-fi, --fields <fields...>',\r\n 'limit the output fields on returned entries'\r\n )\r\n .option(\r\n '-q, --zenql <zenql>',\r\n 'get entries with a supplied ZenQL statement'\r\n )\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > get entries --zenql \"sys.contentTypeId = blog\" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv\r\n`\r\n )\r\n .action(async (phrase: string, opts, cmd) => {\r\n // console.log('phrase: ', phrase, '\\nopts:', JSON.stringify(opts, null, 2));\r\n // console.log('opts:', JSON.stringify(opts, null, 2));\r\n await cliCommand(\r\n ['get', 'entries'],\r\n opts,\r\n mapContensisOpts({ phrase, ...opts })\r\n ).GetEntries({\r\n withDependents: opts.dependents,\r\n });\r\n });\r\n\r\n const block = program\r\n .command('block')\r\n .description('get a block or block version')\r\n .argument('[blockId]', 'the block to get version details for')\r\n .argument(\r\n '[branch]',\r\n 'the branch of the block to get version details for',\r\n 'main'\r\n )\r\n .argument(\r\n '[version]',\r\n 'get a specific version of the block pushed to the specified branch'\r\n )\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > get block contensis-website master latest\r\n`\r\n )\r\n .action(async (blockId: string, branch: string, version: string, opts) => {\r\n await cliCommand(['get', 'block'], opts).PrintBlockVersions(\r\n blockId,\r\n branch,\r\n version\r\n );\r\n });\r\n\r\n const dataCenter = new Argument(\r\n '[dataCenter]',\r\n 'the datacentre of the block to get logs for'\r\n )\r\n .choices(['hq', 'london', 'manchester'])\r\n .default('hq');\r\n\r\n block\r\n .command('logs')\r\n .description('get logs for a block')\r\n .argument('[blockId]', 'the block to get version logs for')\r\n .argument(\r\n '[branch]',\r\n 'the branch of the block to get version details for',\r\n 'main'\r\n )\r\n .argument(\r\n '[version]',\r\n 'the version of the block pushed to the branch to get logs for',\r\n 'latest'\r\n )\r\n .addArgument(dataCenter)\r\n .usage('get block logs [blockId] [branch] [version] [dataCenter]')\r\n .addHelpText(\r\n 'after',\r\n `\r\nExample call:\r\n > get block logs contensis-website master\r\n > get block logs contensis-website master latest london\r\n`\r\n )\r\n .action(\r\n async (\r\n blockId: string,\r\n branch: string,\r\n version: string,\r\n dataCenter: 'hq' | 'manchester' | 'london',\r\n opts\r\n ) => {\r\n await cliCommand(['get', 'block', 'logs'], opts).PrintBlockLogs(\r\n blockId,\r\n branch,\r\n version,\r\n dataCenter\r\n );\r\n }\r\n );\r\n\r\n return program;\r\n};\r\n\r\nexport const get = makeGetCommand();\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkC;AAClC,iCAA2B;AAC3B,2BAAiC;AAE1B,MAAM,iBAA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YAAY,sBAAsB,EAClC,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;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC;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,144 @@
|
|
|
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
|
+
entryId: () => entryId,
|
|
28
|
+
fromCms: () => fromCms,
|
|
29
|
+
fromFile: () => fromFile,
|
|
30
|
+
fromProject: () => fromProject,
|
|
31
|
+
mapContensisOpts: () => mapContensisOpts,
|
|
32
|
+
project: () => project,
|
|
33
|
+
zenql: () => zenql
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(globalOptions_exports);
|
|
36
|
+
var import_commander = require("commander");
|
|
37
|
+
var import_util = require("../util");
|
|
38
|
+
const mapContensisOpts = (opts = {}) => ({
|
|
39
|
+
source: opts.sourceAlias || opts.sourceProjectId ? {
|
|
40
|
+
url: opts.sourceAlias ? (0, import_util.url)(opts.sourceAlias, "website").cms : void 0,
|
|
41
|
+
project: opts.sourceProjectId || void 0
|
|
42
|
+
} : void 0,
|
|
43
|
+
models: opts.modelIds,
|
|
44
|
+
query: opts.id || opts.entryIds || opts.phrase || opts.fields ? {
|
|
45
|
+
fields: opts.fields,
|
|
46
|
+
includeIds: opts.id || opts.entryIds,
|
|
47
|
+
searchTerm: opts.phrase
|
|
48
|
+
} : void 0,
|
|
49
|
+
zenQL: opts.zenql,
|
|
50
|
+
transformGuids: !opts.preserveGuids
|
|
51
|
+
});
|
|
52
|
+
const output = new import_commander.Option(
|
|
53
|
+
"-o, --output <output>",
|
|
54
|
+
"save output to a file e.g. --output ./output.txt"
|
|
55
|
+
);
|
|
56
|
+
const format = new import_commander.Option(
|
|
57
|
+
"-f, --format <format>",
|
|
58
|
+
"format output as csv, json, xml or table (default)"
|
|
59
|
+
).choices(["csv", "json", "xml", "table"]);
|
|
60
|
+
const alias = new import_commander.Option(
|
|
61
|
+
"-a, --alias <alias>",
|
|
62
|
+
"the cloud CMS alias to connect your request with"
|
|
63
|
+
);
|
|
64
|
+
const project = new import_commander.Option(
|
|
65
|
+
"-p, --project-id <projectId>",
|
|
66
|
+
"the projectId to make your request with"
|
|
67
|
+
);
|
|
68
|
+
const user = new import_commander.Option(
|
|
69
|
+
"-u, --user <user>",
|
|
70
|
+
"the username to authenticate your request with"
|
|
71
|
+
);
|
|
72
|
+
const password = new import_commander.Option(
|
|
73
|
+
"-pw, --password <password>",
|
|
74
|
+
"the password to use to login with (optional/insecure)"
|
|
75
|
+
);
|
|
76
|
+
const clientId = new import_commander.Option(
|
|
77
|
+
"-id, --client-id <clientId>",
|
|
78
|
+
"the clientId to authenticate your request with"
|
|
79
|
+
);
|
|
80
|
+
const sharedSecret = new import_commander.Option(
|
|
81
|
+
"-s, --shared-secret <sharedSecret>",
|
|
82
|
+
"the shared secret to use when logging in with a client id"
|
|
83
|
+
);
|
|
84
|
+
const zenql = new import_commander.Option(
|
|
85
|
+
"-q, --zenql <zenql>",
|
|
86
|
+
"get entries with a supplied ZenQL statement"
|
|
87
|
+
);
|
|
88
|
+
const entryId = new import_commander.Option("-i --id <id...>", "the entry id(s) to get");
|
|
89
|
+
const fromFile = new import_commander.Option(
|
|
90
|
+
"-file, --from-file <fromFile>",
|
|
91
|
+
"file path to import asset(s) from"
|
|
92
|
+
);
|
|
93
|
+
const fromCms = new import_commander.Option(
|
|
94
|
+
"-source, --source-alias <fromCms>",
|
|
95
|
+
"the cloud CMS alias to import asset(s) from"
|
|
96
|
+
);
|
|
97
|
+
const fromProject = new import_commander.Option(
|
|
98
|
+
"-sp, --source-project-id <fromProject>",
|
|
99
|
+
"the id of the Contensis project to import asset(s) from (Default: [last connected project])"
|
|
100
|
+
);
|
|
101
|
+
const commit = new import_commander.Option(
|
|
102
|
+
"--commit",
|
|
103
|
+
"add this flag only after you have run a preview of the import and agree with the analysis"
|
|
104
|
+
).default(false);
|
|
105
|
+
const addConnectOptions = (program) => program.addOption(alias.hideHelp()).addOption(project.hideHelp());
|
|
106
|
+
const addAuthenticationOptions = (program) => program.addOption(user.hideHelp()).addOption(password.hideHelp()).addOption(clientId.hideHelp()).addOption(sharedSecret.hideHelp());
|
|
107
|
+
const addOutputAndFormatOptions = (program) => program.addOption(output).addOption(format);
|
|
108
|
+
const addImportOptions = (program) => {
|
|
109
|
+
for (const command of program.commands) {
|
|
110
|
+
command.addOption(fromFile).addOption(fromCms).addOption(fromProject);
|
|
111
|
+
}
|
|
112
|
+
return program;
|
|
113
|
+
};
|
|
114
|
+
const addGetEntryOptions = (program) => {
|
|
115
|
+
for (const command of program.commands) {
|
|
116
|
+
command.addOption(entryId).addOption(zenql);
|
|
117
|
+
}
|
|
118
|
+
return program;
|
|
119
|
+
};
|
|
120
|
+
const addGlobalOptions = (program) => {
|
|
121
|
+
for (const command of program.commands) {
|
|
122
|
+
addOutputAndFormatOptions(command);
|
|
123
|
+
addConnectOptions(command);
|
|
124
|
+
addAuthenticationOptions(command);
|
|
125
|
+
}
|
|
126
|
+
return program;
|
|
127
|
+
};
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
addAuthenticationOptions,
|
|
131
|
+
addConnectOptions,
|
|
132
|
+
addGetEntryOptions,
|
|
133
|
+
addGlobalOptions,
|
|
134
|
+
addImportOptions,
|
|
135
|
+
commit,
|
|
136
|
+
entryId,
|
|
137
|
+
fromCms,
|
|
138
|
+
fromFile,
|
|
139
|
+
fromProject,
|
|
140
|
+
mapContensisOpts,
|
|
141
|
+
project,
|
|
142
|
+
zenql
|
|
143
|
+
});
|
|
144
|
+
//# 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';\r\nimport { url } from '~/util';\r\n\r\nexport const mapContensisOpts = (opts: any = {}) => ({\r\n source:\r\n opts.sourceAlias || opts.sourceProjectId\r\n ? {\r\n url: opts.sourceAlias\r\n ? url(opts.sourceAlias, 'website').cms\r\n : (undefined as any),\r\n project: opts.sourceProjectId || (undefined as any),\r\n }\r\n : undefined,\r\n models: opts.modelIds,\r\n query:\r\n opts.id || opts.entryIds || opts.phrase || opts.fields\r\n ? {\r\n fields: opts.fields,\r\n includeIds: opts.id || opts.entryIds,\r\n searchTerm: opts.phrase,\r\n }\r\n : undefined,\r\n zenQL: opts.zenql,\r\n transformGuids: !opts.preserveGuids,\r\n});\r\n\r\n/* Output options */\r\nconst output = new Option(\r\n '-o, --output <output>',\r\n 'save output to a file e.g. --output ./output.txt'\r\n);\r\n\r\nconst format = new Option(\r\n '-f, --format <format>',\r\n 'format output as csv, json, xml or table (default)'\r\n).choices(['csv', 'json', 'xml', 'table']);\r\n\r\n/* Connect options */\r\nconst alias = new Option(\r\n '-a, --alias <alias>',\r\n 'the cloud CMS alias to connect your request with'\r\n);\r\n\r\nexport const project = new Option(\r\n '-p, --project-id <projectId>',\r\n 'the projectId to make your request with'\r\n);\r\n\r\n/* Authentication options */\r\nconst user = new Option(\r\n '-u, --user <user>',\r\n 'the username to authenticate your request with'\r\n);\r\nconst password = new Option(\r\n '-pw, --password <password>',\r\n 'the password to use to login with (optional/insecure)'\r\n);\r\nconst clientId = new Option(\r\n '-id, --client-id <clientId>',\r\n 'the clientId to authenticate your request with'\r\n);\r\nconst sharedSecret = new Option(\r\n '-s, --shared-secret <sharedSecret>',\r\n 'the shared secret to use when logging in with a client id'\r\n);\r\n\r\n/* Entry get options */\r\nexport const zenql = new Option(\r\n '-q, --zenql <zenql>',\r\n 'get entries with a supplied ZenQL statement'\r\n);\r\n\r\nexport const entryId = new Option('-i --id <id...>', 'the entry id(s) to get');\r\n\r\n/* Import options */\r\nexport const fromFile = new Option(\r\n '-file, --from-file <fromFile>',\r\n 'file path to import asset(s) from'\r\n);\r\n\r\nexport const fromCms = new Option(\r\n '-source, --source-alias <fromCms>',\r\n 'the cloud CMS alias to import asset(s) from'\r\n);\r\nexport const fromProject = new Option(\r\n '-sp, --source-project-id <fromProject>',\r\n 'the id of the Contensis project to import asset(s) from (Default: [last connected project])'\r\n);\r\n\r\nexport const commit = new Option(\r\n '--commit',\r\n 'add this flag only after you have run a preview of the import and agree with the analysis'\r\n).default(false);\r\n\r\nexport const addConnectOptions = (program: Command) =>\r\n program.addOption(alias.hideHelp()).addOption(project.hideHelp());\r\n\r\nexport const addAuthenticationOptions = (program: Command) =>\r\n program\r\n .addOption(user.hideHelp())\r\n .addOption(password.hideHelp())\r\n .addOption(clientId.hideHelp())\r\n .addOption(sharedSecret.hideHelp());\r\n\r\nconst addOutputAndFormatOptions = (program: Command) =>\r\n program.addOption(output).addOption(format);\r\n\r\nexport const addImportOptions = (program: Command) => {\r\n for (const command of program.commands) {\r\n command.addOption(fromFile).addOption(fromCms).addOption(fromProject);\r\n }\r\n return program;\r\n};\r\nexport const addGetEntryOptions = (program: Command) => {\r\n for (const command of program.commands) {\r\n command.addOption(entryId).addOption(zenql);\r\n }\r\n return program;\r\n};\r\nexport const addGlobalOptions = (program: Command) => {\r\n for (const command of program.commands) {\r\n addOutputAndFormatOptions(command);\r\n addConnectOptions(command);\r\n addAuthenticationOptions(command);\r\n }\r\n return program;\r\n};\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;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,eAAe,KAAK,kBACrB;AAAA,IACE,KAAK,KAAK,kBACN,iBAAI,KAAK,aAAa,SAAS,EAAE,MAChC;AAAA,IACL,SAAS,KAAK,mBAAoB;AAAA,EACpC,IACA;AAAA,EACN,QAAQ,KAAK;AAAA,EAC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