contensis-cli 1.1.2-beta.1 → 1.1.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/copy.js +70 -0
- package/dist/commands/copy.js.map +7 -0
- package/dist/commands/create.js.map +2 -2
- package/dist/commands/dev.js +11 -4
- package/dist/commands/dev.js.map +2 -2
- package/dist/commands/get.js +1 -0
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/globalOptions.js +24 -3
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +1 -6
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/index.js +7 -3
- package/dist/commands/index.js.map +2 -2
- package/dist/factories/RequestHandlerFactory.js +24 -13
- package/dist/factories/RequestHandlerFactory.js.map +2 -2
- package/dist/localisation/en-GB.js +3 -1
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +128 -88
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +3 -3
- package/dist/providers/GitHubCliModuleProvider.js +14 -4
- package/dist/providers/GitHubCliModuleProvider.js.map +2 -2
- package/dist/providers/file-provider.js +3 -0
- package/dist/providers/file-provider.js.map +2 -2
- package/dist/services/ContensisCliService.js +61 -0
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/services/ContensisDevService.js +30 -5
- package/dist/services/ContensisDevService.js.map +3 -3
- package/dist/shell.js +1 -0
- package/dist/shell.js.map +2 -2
- package/dist/util/api-ids.js +110 -0
- package/dist/util/api-ids.js.map +7 -0
- package/dist/util/console.printer.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -3
- package/src/commands/copy.ts +79 -0
- package/src/commands/create.ts +0 -1
- package/src/commands/dev.ts +14 -6
- package/src/commands/get.ts +12 -11
- package/src/commands/globalOptions.ts +25 -2
- package/src/commands/import.ts +4 -8
- package/src/commands/index.ts +7 -3
- package/src/factories/RequestHandlerFactory.ts +38 -17
- package/src/localisation/en-GB.ts +3 -2
- package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +147 -92
- package/src/providers/GitHubCliModuleProvider.ts +19 -6
- package/src/providers/file-provider.ts +4 -0
- package/src/services/ContensisCliService.ts +82 -0
- package/src/services/ContensisDevService.ts +37 -6
- package/src/shell.ts +2 -1
- package/src/util/api-ids.ts +111 -0
- package/src/util/console.printer.ts +2 -1
- package/src/version.ts +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var copy_exports = {};
|
|
20
|
+
__export(copy_exports, {
|
|
21
|
+
makeCopyCommand: () => makeCopyCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(copy_exports);
|
|
24
|
+
var import_commander = require("commander");
|
|
25
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
+
var import_globalOptions = require("./globalOptions");
|
|
27
|
+
const makeCopyCommand = () => {
|
|
28
|
+
const copy = new import_commander.Command().command("copy").description("copy command").addHelpText("after", `
|
|
29
|
+
`).showHelpAfterError(true).exitOverride();
|
|
30
|
+
copy.command("field").description("copy the contents of one content type field to another").argument(
|
|
31
|
+
"<contentTypeId>",
|
|
32
|
+
"the api id of the content type containing the fields to copy"
|
|
33
|
+
).argument("<fieldId>", "the id of the field to copy from").argument("<destinationId>", "the id of the field to copy to").option(
|
|
34
|
+
"-t --template <template>",
|
|
35
|
+
"apply a liquidjs template (surrounded by double quotes) to modify the copied field content"
|
|
36
|
+
).addOption(import_globalOptions.commit).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.outputEntries).addOption(import_globalOptions.delivery).addOption(import_globalOptions.entryId).addOption(import_globalOptions.zenql).usage("<contentTypeId> <fieldId> <destinationId> (all arguments required)").addHelpText(
|
|
37
|
+
"after",
|
|
38
|
+
`
|
|
39
|
+
Example call:
|
|
40
|
+
> copy field blog authorName contributors
|
|
41
|
+
|
|
42
|
+
> copy field blog description kicker --template "<h2>{{ source_value }}</h2>"
|
|
43
|
+
`
|
|
44
|
+
).action(
|
|
45
|
+
async (contentTypeId, fieldId, destinationId, opts) => {
|
|
46
|
+
const { template, ...restOpts } = opts;
|
|
47
|
+
const copyField = {
|
|
48
|
+
contentTypeId,
|
|
49
|
+
fieldId,
|
|
50
|
+
destinationId,
|
|
51
|
+
template: opts.template
|
|
52
|
+
};
|
|
53
|
+
return await (0, import_ContensisCliService.cliCommand)(
|
|
54
|
+
["copy", "project", contentTypeId, fieldId, destinationId],
|
|
55
|
+
opts,
|
|
56
|
+
(0, import_globalOptions.mapContensisOpts)({ copyField, ...restOpts })
|
|
57
|
+
).CopyEntryField({
|
|
58
|
+
commit: opts.commit,
|
|
59
|
+
fromFile: opts.fromFile,
|
|
60
|
+
logOutput: opts.outputEntries
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
return copy;
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
makeCopyCommand
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=copy.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/copy.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { CopyField } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\n delivery,\n entryId,\n ignoreErrors,\n mapContensisOpts,\n outputEntries,\n zenql,\n} from './globalOptions';\n\nexport const makeCopyCommand = () => {\n const copy = new Command()\n .command('copy')\n .description('copy command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n copy\n .command('field')\n .description('copy the contents of one content type field to another')\n .argument(\n '<contentTypeId>',\n 'the api id of the content type containing the fields to copy'\n )\n .argument('<fieldId>', 'the id of the field to copy from')\n .argument('<destinationId>', 'the id of the field to copy to')\n .option(\n '-t --template <template>',\n 'apply a liquidjs template (surrounded by double quotes) to modify the copied field content'\n )\n .addOption(commit)\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .addOption(outputEntries)\n .addOption(delivery)\n .addOption(entryId)\n .addOption(zenql)\n .usage('<contentTypeId> <fieldId> <destinationId> (all arguments required)')\n .addHelpText(\n 'after',\n `\nExample call:\n > copy field blog authorName contributors\\n\n > copy field blog description kicker --template \"<h2>{{ source_value }}</h2>\"\\n`\n )\n .action(\n async (\n contentTypeId: string,\n fieldId: string,\n destinationId: string,\n opts: any\n ) => {\n const { template, ...restOpts } = opts;\n const copyField: CopyField = {\n contentTypeId,\n fieldId,\n destinationId,\n template: opts.template,\n };\n\n return await cliCommand(\n ['copy', 'project', contentTypeId, fieldId, destinationId],\n opts,\n mapContensisOpts({ copyField, ...restOpts })\n ).CopyEntryField({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n });\n }\n );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|
|
3
3
|
"sources": ["../../src/commands/create.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { Project } from 'contensis-core-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,mBAAsB;
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { Project } from 'contensis-core-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeCreateCommand = () => {\n const create = new Command()\n .command('create')\n .description('create command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n create\n .command('project')\n .description('create a new project')\n .argument('<projectId>', 'the id of the project to create')\n .argument('<name>', 'the name of the project to create')\n .argument('[description]', 'optional description of the project')\n .option(\n '-l --language',\n 'the default language of the project to create',\n 'en-GB'\n )\n .option(\n '-langs --supported-languages <langs...>',\n 'space separated list of other supported languages'\n )\n .usage(\n 'projectId \"Project name\" [\"Description of project\"] --language en-GB --supported-languages es-ES de-DE nl-NL'\n )\n .addHelpText('after', `\\n`)\n .action(\n async (projectId: string, name: string, description = '', opts: any) => {\n const createProject: Project = {\n id: projectId,\n name,\n description,\n primaryLanguage: opts.language,\n supportedLanguages: opts.supportedLanguages || [],\n };\n\n const project = await cliCommand(\n ['create', 'project', projectId],\n opts\n ).CreateProject(createProject);\n if (project) await shell().restart();\n }\n );\n\n create\n .command('key')\n .description('create a new api 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 create\n .command('role')\n .description('create a new role')\n .argument('<\"Role name\">', 'the name of the role to create')\n .argument('[\"Role description\">', 'the description of the role')\n .option('--disabled', 'do not enable the created role', false)\n .addHelpText(\n 'after',\n `\nExample call:\n > create role \"My role\" \"This role is for testing\" --disabled \\n`\n )\n .action(async (roleName: string, description: string, opts) => {\n await cliCommand(['create', 'role', roleName], opts).CreateRole({\n name: roleName,\n description,\n enabled: !opts.disabled,\n assignments: { apiKeys: [], groups: [], users: [] },\n permissions: { contentTypes: [], entries: [] },\n });\n });\n\n return create;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,mBAAsB;AAEf,MAAM,oBAAoB,MAAM;AACrC,QAAM,SAAS,IAAI,yBAAQ,EACxB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,SACG,QAAQ,SAAS,EACjB,YAAY,sBAAsB,EAClC,SAAS,eAAe,iCAAiC,EACzD,SAAS,UAAU,mCAAmC,EACtD,SAAS,iBAAiB,qCAAqC,EAC/D;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,EACF,EACC,YAAY,SAAS;AAAA,CAAI,EACzB;AAAA,IACC,OAAO,WAAmB,MAAc,cAAc,IAAI,SAAc;AACtE,YAAM,gBAAyB;AAAA,QAC7B,IAAI;AAAA,QACJ;AAAA,QACA;AAAA,QACA,iBAAiB,KAAK;AAAA,QACtB,oBAAoB,KAAK,sBAAsB,CAAC;AAAA,MAClD;AAEA,YAAM,UAAU,UAAM;AAAA,QACpB,CAAC,UAAU,WAAW,SAAS;AAAA,QAC/B;AAAA,MACF,EAAE,cAAc,aAAa;AAC7B,UAAI;AAAS,kBAAM,oBAAM,EAAE,QAAQ;AAAA,IACrC;AAAA,EACF;AAEF,SACG,QAAQ,KAAK,EACb,YAAY,sBAAsB,EAClC,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,SACG,QAAQ,MAAM,EACd,YAAY,mBAAmB,EAC/B,SAAS,iBAAiB,gCAAgC,EAC1D,SAAS,wBAAwB,6BAA6B,EAC9D,OAAO,cAAc,kCAAkC,KAAK,EAC5D;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,UAAkB,aAAqB,SAAS;AAC7D,cAAM,uCAAW,CAAC,UAAU,QAAQ,QAAQ,GAAG,IAAI,EAAE,WAAW;AAAA,MAC9D,MAAM;AAAA,MACN;AAAA,MACA,SAAS,CAAC,KAAK;AAAA,MACf,aAAa,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,MAClD,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,CAAC,EAAE;AAAA,IAC/C,CAAC;AAAA,EACH,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/dev.js
CHANGED
|
@@ -50,17 +50,24 @@ Example call:
|
|
|
50
50
|
{ ...opts, dryRun: opts.dryRun }
|
|
51
51
|
);
|
|
52
52
|
});
|
|
53
|
-
dev.command("requests").description("launch request handler for local development").argument(
|
|
53
|
+
dev.command("requests").description("launch request handler for local development").argument(
|
|
54
|
+
"[block-id...]",
|
|
55
|
+
"id of block to develop locally and the local uri to pass requests for this block onto"
|
|
56
|
+
).option("--args <args...>", "override or add additional args").option(
|
|
57
|
+
"--release <release>",
|
|
58
|
+
"launch a specific release version of the request handler"
|
|
59
|
+
).usage("[block-id] [local-uri]").addHelpText(
|
|
54
60
|
"after",
|
|
55
61
|
`
|
|
56
62
|
Example call:
|
|
57
63
|
> dev requests test-block-one
|
|
64
|
+
> dev requests my-website http://localhost:8080
|
|
58
65
|
`
|
|
59
|
-
).action(async (
|
|
66
|
+
).action(async (blockId = [], opts) => {
|
|
60
67
|
await (0, import_ContensisDevService.devCommand)(
|
|
61
|
-
["dev", "requests",
|
|
68
|
+
["dev", "requests", blockId.join(" ")],
|
|
62
69
|
opts
|
|
63
|
-
).ExecRequestHandler(
|
|
70
|
+
).ExecRequestHandler(blockId, opts == null ? void 0 : opts.args, opts.release);
|
|
64
71
|
});
|
|
65
72
|
return dev;
|
|
66
73
|
};
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/dev.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { devCommand } from '~/services/ContensisDevService';\n\nexport const makeDevCommand = () => {\n const dev = new Command()\n .command('dev')\n .description('dev command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n dev\n .command('init')\n .description(\n 'initialise a git clone directory to connect and deploy to Contensis'\n )\n .argument(\n '[projectHome]',\n 'the path of the folder to initialise',\n process.cwd()\n )\n .option(\n '--url <url>',\n 'override the git url or add one to initialise a non-git folder'\n )\n .option(\n '-d --dry-run',\n 'perform a dry run of the project initialisation where no changes are made'\n )\n // .option(\n // '--commit',\n // 'commit change (will eventually be deprecated in favour of --dry-run)',\n // true\n // )\n .addHelpText(\n 'after',\n `\nExample call:\n > dev init\\n`\n )\n .action(async (projectHome: string, opts) => {\n // TODO: add opts for overriding project name and git url\n await devCommand(['dev', 'init', projectHome], opts).DevelopmentInit(\n projectHome,\n { ...opts, dryRun: opts.dryRun }\n );\n });\n\n dev\n .command('requests')\n .description('launch request handler for local development')\n .argument('[block-
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAEpB,MAAM,iBAAiB,MAAM;AAClC,QAAM,MAAM,IAAI,yBAAQ,EACrB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,MACG,QAAQ,MAAM,EACd;AAAA,IACC;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,QAAQ,IAAI;AAAA,EACd,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EAMC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,aAAqB,SAAS;AAE3C,cAAM,uCAAW,CAAC,OAAO,QAAQ,WAAW,GAAG,IAAI,EAAE;AAAA,MACnD;AAAA,MACA,EAAE,GAAG,MAAM,QAAQ,KAAK,OAAO;AAAA,IACjC;AAAA,EACF,CAAC;AAEH,MACG,QAAQ,UAAU,EAClB,YAAY,8CAA8C,EAC1D,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { devCommand } from '~/services/ContensisDevService';\n\nexport const makeDevCommand = () => {\n const dev = new Command()\n .command('dev')\n .description('dev command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n dev\n .command('init')\n .description(\n 'initialise a git clone directory to connect and deploy to Contensis'\n )\n .argument(\n '[projectHome]',\n 'the path of the folder to initialise',\n process.cwd()\n )\n .option(\n '--url <url>',\n 'override the git url or add one to initialise a non-git folder'\n )\n .option(\n '-d --dry-run',\n 'perform a dry run of the project initialisation where no changes are made'\n )\n // .option(\n // '--commit',\n // 'commit change (will eventually be deprecated in favour of --dry-run)',\n // true\n // )\n .addHelpText(\n 'after',\n `\nExample call:\n > dev init\\n`\n )\n .action(async (projectHome: string, opts) => {\n // TODO: add opts for overriding project name and git url\n await devCommand(['dev', 'init', projectHome], opts).DevelopmentInit(\n projectHome,\n { ...opts, dryRun: opts.dryRun }\n );\n });\n\n dev\n .command('requests')\n .description('launch request handler for local development')\n .argument(\n '[block-id...]',\n 'id of block to develop locally and the local uri to pass requests for this block onto'\n )\n .option('--args <args...>', 'override or add additional args')\n .option(\n '--release <release>',\n 'launch a specific release version of the request handler'\n )\n .usage('[block-id] [local-uri]')\n .addHelpText(\n 'after',\n `\nExample call:\n > dev requests test-block-one\n > dev requests my-website http://localhost:8080\\n`\n )\n .action(async (blockId: string[] = [], opts) => {\n await devCommand(\n ['dev', 'requests', blockId.join(' ')],\n opts\n ).ExecRequestHandler(blockId, opts?.args, opts.release);\n });\n\n return dev;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAEpB,MAAM,iBAAiB,MAAM;AAClC,QAAM,MAAM,IAAI,yBAAQ,EACrB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,MACG,QAAQ,MAAM,EACd;AAAA,IACC;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,QAAQ,IAAI;AAAA,EACd,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EAMC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,aAAqB,SAAS;AAE3C,cAAM,uCAAW,CAAC,OAAO,QAAQ,WAAW,GAAG,IAAI,EAAE;AAAA,MACnD;AAAA,MACA,EAAE,GAAG,MAAM,QAAQ,KAAK,OAAO;AAAA,IACjC;AAAA,EACF,CAAC;AAEH,MACG,QAAQ,UAAU,EAClB,YAAY,8CAA8C,EAC1D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,oBAAoB,iCAAiC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,MAAM,wBAAwB,EAC9B;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,UAAoB,CAAC,GAAG,SAAS;AAC9C,cAAM;AAAA,MACJ,CAAC,OAAO,YAAY,QAAQ,KAAK,GAAG,CAAC;AAAA,MACrC;AAAA,IACF,EAAE,mBAAmB,SAAS,6BAAM,MAAM,KAAK,OAAO;AAAA,EACxD,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/get.js
CHANGED
|
@@ -215,6 +215,7 @@ Example call:
|
|
|
215
215
|
Example call:
|
|
216
216
|
> get block contensis-website
|
|
217
217
|
> get block contensis-website develop latest
|
|
218
|
+
> get block contensis-website feature-branch 3
|
|
218
219
|
`
|
|
219
220
|
).action(async (blockId, branch, version, opts) => {
|
|
220
221
|
await (0, import_ContensisCliService.cliCommand)(["get", "block", blockId], opts).PrintBlockVersions(
|
package/dist/commands/get.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/get.ts"],
|
|
4
|
-
"sourcesContent": ["import { Argument, Command, Option } from 'commander';\nimport { merge } from 'lodash';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n addGlobalOptions,\n assetTypes,\n contentTypes,\n entryId,\n mapContensisOpts,\n zenql,\n} from './globalOptions';\n\nexport const makeGetCommand = () => {\n const program = new Command()\n .command('get')\n .description('get command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('version')\n .description('get current Contensis version')\n .addHelpText(\n 'after',\n `\nExample call:\n > version\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'version'], opts).PrintContensisVersion();\n });\n\n program\n .command('token')\n .description('show a bearer token for the currently logged in user')\n .addHelpText(\n 'after',\n `\nExample call:\n > get token\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'token'], opts).PrintBearerToken();\n });\n\n program\n .command('project')\n .description('get a project')\n .argument('[projectId]', 'id of the project to get (default: current)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get project website\n`\n )\n .action(async (projectId: string, opts) => {\n await cliCommand(['get', 'project', projectId], opts).PrintProject(\n projectId\n );\n });\n\n program\n .command('role')\n .description('get a role')\n .argument('<roleNameOrId>', 'id or name of the role to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get role \"entry admin\"\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['get', 'role', roleNameOrId], opts).PrintRole(\n roleNameOrId\n );\n });\n\n program\n .command('webhook')\n .description('get a webhook')\n .argument('<webhookNameOrId...>', 'id or name of the webhook(s) to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get webhook \"Slack notification\"\n`\n )\n .action(async (webhookNameOrId: string[], opts) => {\n await cliCommand(\n ['get', 'webhook', webhookNameOrId.join(' ')],\n opts\n ).PrintWebhookSubscriptions(webhookNameOrId);\n });\n\n program\n .command('workflow')\n .description('get a workflow')\n .argument('<workflowNameOrId>', 'id or name of the workflow to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get workflow \"Approval workflow\"\n`\n )\n .action(async (workflowNameOrId: string, opts) => {\n await cliCommand(\n ['get', 'workflow', workflowNameOrId],\n opts\n ).PrintWorkflow(workflowNameOrId);\n });\n\n program\n .command('model')\n .description('get a content model')\n .argument('<contentTypeId...>', 'ids of the content models to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get model podcast podcastLinks\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['get', 'model', modelIds.join(' ')],\n opts\n ).PrintContentModels(modelIds);\n });\n\n program\n .command('contenttype')\n .description('get a content type')\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(\n ['get', 'contenttype', contentTypeId],\n opts\n ).PrintContentType(contentTypeId);\n });\n\n program\n .command('component')\n .description('get a 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', componentId], opts).PrintComponent(\n componentId\n );\n });\n\n const sharedGetEntryOptions = (command: Command) =>\n command\n .addOption(entryId)\n .addOption(zenql)\n .addOption(\n new Option(\n '-fi --fields <fields...>',\n 'limit the output fields on returned entries'\n )\n )\n .addOption(\n new Option(\n '-ob --order-by <orderBy...>',\n 'field name(s) to order the results by (prefix \"-\" for descending)'\n )\n );\n\n sharedGetEntryOptions(\n program\n .command('assets')\n .description('get asset entries')\n .argument(\n '[search phrase]',\n 'get assets with the search phrase, use quotes for multiple words'\n )\n .addOption(assetTypes)\n )\n .option('-l --paths <paths...>', 'get assets under the given path(s)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get assets --zenql \"sys.contentTypeId = blog\" --fields sys.id sys.properties.filePath sys.properties.filename\n`\n )\n .action(async (phrase: string, opts) => {\n // Maintaining a separate command for assets vs entries\n // allows us to offer up more options when dealing with just assets\n await cliCommand(\n ['get', 'assets'],\n opts,\n mapContensisOpts({ dataFormat: 'asset', phrase, ...opts })\n ).GetEntries({});\n });\n\n sharedGetEntryOptions(\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C;AAC1C,oBAAsB;AACtB,iCAA2B;AAC3B,2BAOO;AAEA,MAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,KAAK,EACb,YA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jB,UAAU,0BAAK,EACf;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEJ;AAAA,IACE,QACG,QAAQ,QAAQ,EAChB,YAAY,mBAAmB,EAC/B;AAAA,MACC;AAAA,MACA;AAAA,IACF,EACC,UAAU,+BAAU;AAAA,EACzB,EACG,OAAO,yBAAyB,oCAAoC,EACpE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,QAAgB,SAAS;AAGtC,cAAM;AAAA,MACJ,CAAC,OAAO,QAAQ;AAAA,MAChB;AAAA,UACA,uCAAiB,EAAE,YAAY,SAAS,QAAQ,GAAG,KAAK,CAAC;AAAA,IAC3D,EAAE,WAAW,CAAC,CAAC;AAAA,EACjB,CAAC;AAEH;AAAA,
|
|
4
|
+
"sourcesContent": ["import { Argument, Command, Option } from 'commander';\nimport { merge } from 'lodash';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n addGlobalOptions,\n assetTypes,\n contentTypes,\n entryId,\n mapContensisOpts,\n zenql,\n} from './globalOptions';\n\nexport const makeGetCommand = () => {\n const program = new Command()\n .command('get')\n .description('get command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('version')\n .description('get current Contensis version')\n .addHelpText(\n 'after',\n `\nExample call:\n > version\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'version'], opts).PrintContensisVersion();\n });\n\n program\n .command('token')\n .description('show a bearer token for the currently logged in user')\n .addHelpText(\n 'after',\n `\nExample call:\n > get token\n`\n )\n .action(async opts => {\n await cliCommand(['get', 'token'], opts).PrintBearerToken();\n });\n\n program\n .command('project')\n .description('get a project')\n .argument('[projectId]', 'id of the project to get (default: current)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get project website\n`\n )\n .action(async (projectId: string, opts) => {\n await cliCommand(['get', 'project', projectId], opts).PrintProject(\n projectId\n );\n });\n\n program\n .command('role')\n .description('get a role')\n .argument('<roleNameOrId>', 'id or name of the role to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get role \"entry admin\"\n`\n )\n .action(async (roleNameOrId: string, opts) => {\n await cliCommand(['get', 'role', roleNameOrId], opts).PrintRole(\n roleNameOrId\n );\n });\n\n program\n .command('webhook')\n .description('get a webhook')\n .argument('<webhookNameOrId...>', 'id or name of the webhook(s) to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get webhook \"Slack notification\"\n`\n )\n .action(async (webhookNameOrId: string[], opts) => {\n await cliCommand(\n ['get', 'webhook', webhookNameOrId.join(' ')],\n opts\n ).PrintWebhookSubscriptions(webhookNameOrId);\n });\n\n program\n .command('workflow')\n .description('get a workflow')\n .argument('<workflowNameOrId>', 'id or name of the workflow to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get workflow \"Approval workflow\"\n`\n )\n .action(async (workflowNameOrId: string, opts) => {\n await cliCommand(\n ['get', 'workflow', workflowNameOrId],\n opts\n ).PrintWorkflow(workflowNameOrId);\n });\n\n program\n .command('model')\n .description('get a content model')\n .argument('<contentTypeId...>', 'ids of the content models to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get model podcast podcastLinks\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['get', 'model', modelIds.join(' ')],\n opts\n ).PrintContentModels(modelIds);\n });\n\n program\n .command('contenttype')\n .description('get a content type')\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(\n ['get', 'contenttype', contentTypeId],\n opts\n ).PrintContentType(contentTypeId);\n });\n\n program\n .command('component')\n .description('get a 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', componentId], opts).PrintComponent(\n componentId\n );\n });\n\n const sharedGetEntryOptions = (command: Command) =>\n command\n .addOption(entryId)\n .addOption(zenql)\n .addOption(\n new Option(\n '-fi --fields <fields...>',\n 'limit the output fields on returned entries'\n )\n )\n .addOption(\n new Option(\n '-ob --order-by <orderBy...>',\n 'field name(s) to order the results by (prefix \"-\" for descending)'\n )\n );\n\n sharedGetEntryOptions(\n program\n .command('assets')\n .description('get asset entries')\n .argument(\n '[search phrase]',\n 'get assets with the search phrase, use quotes for multiple words'\n )\n .addOption(assetTypes)\n )\n .option('-l --paths <paths...>', 'get assets under the given path(s)')\n .addHelpText(\n 'after',\n `\nExample call:\n > get assets --zenql \"sys.contentTypeId = blog\" --fields sys.id sys.properties.filePath sys.properties.filename\n`\n )\n .action(async (phrase: string, opts) => {\n // Maintaining a separate command for assets vs entries\n // allows us to offer up more options when dealing with just assets\n await cliCommand(\n ['get', 'assets'],\n opts,\n mapContensisOpts({ dataFormat: 'asset', phrase, ...opts })\n ).GetEntries({});\n });\n\n sharedGetEntryOptions(\n program\n .command('entries')\n .description('get entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(contentTypes)\n .option(\n '-d --dependents',\n 'find and return any dependencies of all found entries'\n )\n )\n .addOption(\n new Option(\n '--data-format <dataFormat>',\n 'find and return entries of a specific data format'\n )\n .choices(['entry', 'asset', 'webpage'])\n .default('entry')\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 > get entries --content-type blog --fields entryTitle sys.version.modified --order-by -sys.version.modified\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 program\n .command('nodes')\n .description('get nodes')\n .argument('[root]', 'get node(s) from the specified path e.g. /blog', '/')\n .option(\n '-d --depth <depth>',\n 'get nodes with children to a specified depth',\n '1'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get nodes /blog --depth 1\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(['get', 'nodes'], opts, mapContensisOpts(opts)).GetNodes(\n root,\n opts.depth\n );\n });\n\n const block = program\n .command('block')\n .description('get a block or block version')\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 'default'\n )\n .argument(\n '[version]',\n 'get a specific version of the block pushed to the specified branch'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > get block contensis-website\n > get block contensis-website develop latest\n > get block contensis-website feature-branch 3\n`\n )\n .action(async (blockId: string, branch: string, version: string, opts) => {\n await cliCommand(['get', 'block', blockId], opts).PrintBlockVersions(\n blockId,\n branch,\n version\n );\n });\n\n block\n .command('logs')\n .description('get logs for a block')\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 'default'\n )\n .argument(\n '[version]',\n 'the version of the block pushed to the branch to get logs for',\n 'latest'\n )\n .addArgument(\n new Argument(\n '[dataCenter]',\n 'the datacentre of the block to get logs for'\n )\n .choices(['hq', 'london', 'manchester', 'all'])\n .default('all')\n )\n .option('-t --follow', 'follow block logs in near realtime', false)\n .usage('get block logs [blockId] [branch] [version] [dataCenter]')\n .addHelpText(\n 'after',\n `\nExample call:\n > get block logs contensis-website default\n > get block logs contensis-website master latest london --follow\n`\n )\n .action(\n async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london' | 'all',\n opts\n ) => {\n const parentOpts = block.opts() || {};\n await cliCommand(\n ['get', 'block', 'logs'],\n merge(opts, parentOpts)\n ).PrintBlockLogs(\n blockId,\n branch,\n version,\n dataCenter === 'all' ? undefined : dataCenter,\n opts.follow as boolean\n );\n }\n );\n\n // Add global opts for inner sub-commands\n addGlobalOptions(block);\n\n return program;\n};\n\nexport const get = makeGetCommand();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C;AAC1C,oBAAsB;AACtB,iCAA2B;AAC3B,2BAOO;AAEA,MAAM,iBAAiB,MAAM;AAClC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,SAAS,EACjB,YAAY,+BAA+B,EAC3C;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAM,SAAQ;AACpB,cAAM,uCAAW,CAAC,OAAO,SAAS,GAAG,IAAI,EAAE,sBAAsB;AAAA,EACnE,CAAC;AAEH,UACG,QAAQ,OAAO,EACf,YAAY,sDAAsD,EAClE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAM,SAAQ;AACpB,cAAM,uCAAW,CAAC,OAAO,OAAO,GAAG,IAAI,EAAE,iBAAiB;AAAA,EAC5D,CAAC;AAEH,UACG,QAAQ,SAAS,EACjB,YAAY,eAAe,EAC3B,SAAS,eAAe,6CAA6C,EACrE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,WAAmB,SAAS;AACzC,cAAM,uCAAW,CAAC,OAAO,WAAW,SAAS,GAAG,IAAI,EAAE;AAAA,MACpD;AAAA,IACF;AAAA,EACF,CAAC;AAEH,UACG,QAAQ,MAAM,EACd,YAAY,YAAY,EACxB,SAAS,kBAAkB,+BAA+B,EAC1D;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAA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AAQ,CAAC,MAAM,UAAU,cAAc,KAAK,CAAC,EAC7C,QAAQ,KAAK;AAAA,EAClB,EACC,OAAO,eAAe,sCAAsC,KAAK,EACjE,MAAM,0DAA0D,EAChE;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC;AAAA,IACC,OACE,SACA,QACA,SACA,YACA,SACG;AACH,YAAM,aAAa,MAAM,KAAK,KAAK,CAAC;AACpC,gBAAM;AAAA,QACJ,CAAC,OAAO,SAAS,MAAM;AAAA,YACvB,qBAAM,MAAM,UAAU;AAAA,MACxB,EAAE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,eAAe,QAAQ,SAAY;AAAA,QACnC,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAGF,6CAAiB,KAAK;AAEtB,SAAO;AACT;AAEO,MAAM,MAAM,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -24,7 +24,9 @@ __export(globalOptions_exports, {
|
|
|
24
24
|
addImportOptions: () => addImportOptions,
|
|
25
25
|
assetTypes: () => assetTypes,
|
|
26
26
|
commit: () => commit,
|
|
27
|
+
concurrency: () => concurrency,
|
|
27
28
|
contentTypes: () => contentTypes,
|
|
29
|
+
delivery: () => delivery,
|
|
28
30
|
entryId: () => entryId,
|
|
29
31
|
fromCms: () => fromCms,
|
|
30
32
|
fromFile: () => fromFile,
|
|
@@ -32,6 +34,7 @@ __export(globalOptions_exports, {
|
|
|
32
34
|
getEntryOptions: () => getEntryOptions,
|
|
33
35
|
ignoreErrors: () => ignoreErrors,
|
|
34
36
|
mapContensisOpts: () => mapContensisOpts,
|
|
37
|
+
outputEntries: () => outputEntries,
|
|
35
38
|
project: () => project,
|
|
36
39
|
zenql: () => zenql
|
|
37
40
|
});
|
|
@@ -44,7 +47,8 @@ const mapContensisOpts = (opts = {}) => ({
|
|
|
44
47
|
project: opts.sourceProjectId || void 0
|
|
45
48
|
} : void 0,
|
|
46
49
|
models: opts.modelIds,
|
|
47
|
-
|
|
50
|
+
copyField: opts.copyField,
|
|
51
|
+
query: opts.id || opts.entryIds || opts.phrase || opts.fields || opts.orderBy || opts.paths || opts.assetType || opts.contentType || opts.dataFormat || opts.deliveryApi ? {
|
|
48
52
|
assetTypes: opts.assetType,
|
|
49
53
|
contentTypeIds: opts.contentType,
|
|
50
54
|
dataFormats: opts.dataFormat ? [opts.dataFormat] : void 0,
|
|
@@ -52,11 +56,13 @@ const mapContensisOpts = (opts = {}) => ({
|
|
|
52
56
|
includeIds: opts.id || opts.entryIds,
|
|
53
57
|
includePaths: opts.paths,
|
|
54
58
|
orderBy: opts.orderBy,
|
|
55
|
-
searchTerm: opts.phrase
|
|
59
|
+
searchTerm: opts.phrase,
|
|
60
|
+
useDelivery: opts.deliveryApi
|
|
56
61
|
} : void 0,
|
|
57
62
|
zenQL: opts.zenql,
|
|
58
63
|
transformGuids: !opts.preserveGuids,
|
|
59
|
-
ignoreErrors: opts.ignoreErrors
|
|
64
|
+
ignoreErrors: opts.ignoreErrors,
|
|
65
|
+
concurrency: opts.concurrency ? Number(opts.concurrency) : void 0
|
|
60
66
|
});
|
|
61
67
|
const output = new import_commander.Option(
|
|
62
68
|
"-o --output <output>",
|
|
@@ -90,6 +96,10 @@ const sharedSecret = new import_commander.Option(
|
|
|
90
96
|
"-s --shared-secret <sharedSecret>",
|
|
91
97
|
"the shared secret to use when logging in with a client id"
|
|
92
98
|
);
|
|
99
|
+
const delivery = new import_commander.Option(
|
|
100
|
+
"-delivery --delivery-api",
|
|
101
|
+
"use delivery api to get the entries"
|
|
102
|
+
);
|
|
93
103
|
const zenql = new import_commander.Option(
|
|
94
104
|
"-q --zenql <zenql>",
|
|
95
105
|
"get entries with a supplied ZenQL statement"
|
|
@@ -123,6 +133,14 @@ const ignoreErrors = new import_commander.Option(
|
|
|
123
133
|
"-ignore --ignore-errors",
|
|
124
134
|
"commit the import ignoring any reported errors"
|
|
125
135
|
).default(false);
|
|
136
|
+
const outputEntries = new import_commander.Option(
|
|
137
|
+
"-oe --output-entries <outputEntries>",
|
|
138
|
+
"which details of the entries included in the import to output"
|
|
139
|
+
).choices(["errors", "changes", "all"]).default("errors");
|
|
140
|
+
const concurrency = new import_commander.Option(
|
|
141
|
+
"-conc --concurrency <concurrency>",
|
|
142
|
+
"the number of entries to load in parallel"
|
|
143
|
+
).default(2);
|
|
126
144
|
const addConnectOptions = (program) => program.addOption(alias.hideHelp()).addOption(project.hideHelp());
|
|
127
145
|
const addAuthenticationOptions = (program) => program.addOption(user.hideHelp()).addOption(password.hideHelp()).addOption(clientId.hideHelp()).addOption(sharedSecret.hideHelp());
|
|
128
146
|
const addOutputAndFormatOptions = (program) => program.addOption(output).addOption(format);
|
|
@@ -149,7 +167,9 @@ const addGlobalOptions = (program) => {
|
|
|
149
167
|
addImportOptions,
|
|
150
168
|
assetTypes,
|
|
151
169
|
commit,
|
|
170
|
+
concurrency,
|
|
152
171
|
contentTypes,
|
|
172
|
+
delivery,
|
|
153
173
|
entryId,
|
|
154
174
|
fromCms,
|
|
155
175
|
fromFile,
|
|
@@ -157,6 +177,7 @@ const addGlobalOptions = (program) => {
|
|
|
157
177
|
getEntryOptions,
|
|
158
178
|
ignoreErrors,
|
|
159
179
|
mapContensisOpts,
|
|
180
|
+
outputEntries,
|
|
160
181
|
project,
|
|
161
182
|
zenql
|
|
162
183
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/globalOptions.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { url } from '~/util';\n\n// Map various input options into a request to be processed\n// by Migratortron / Contensis import library\nexport const mapContensisOpts = (opts: any = {}) => ({\n source:\n opts.sourceAlias || opts.sourceProjectId\n ? {\n url: opts.sourceAlias\n ? url(opts.sourceAlias, 'website').cms\n : (undefined as any),\n project: opts.sourceProjectId || (undefined as any),\n }\n : undefined,\n models: opts.modelIds,\n query:\n opts.id ||\n opts.entryIds ||\n opts.phrase ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat\n ? {\n assetTypes: opts.assetType,\n contentTypeIds: opts.contentType,\n dataFormats: opts.dataFormat ? [opts.dataFormat] : undefined,\n fields: opts.fields,\n includeIds: opts.id || opts.entryIds,\n includePaths: opts.paths,\n orderBy: opts.orderBy,\n searchTerm: opts.phrase,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n ignoreErrors: opts.ignoreErrors,\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 */\nexport const zenql = new Option(\n '-q --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n);\n\nexport const entryId = new Option('-i --id <id...>', 'the entry id(s) to get');\nexport const contentTypes = new Option(\n '-c --content-type <contentType...>',\n 'get entries of these content type(s)'\n);\nexport const assetTypes = new Option(\n '-at --asset-type <assetType...>',\n 'get assets of given content type(s) e.g. image word pdf'\n);\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 'add this flag only after you have run a preview of the import and agree with the analysis'\n).default(false);\n\nexport const ignoreErrors = new Option(\n '-ignore --ignore-errors',\n 'commit the import ignoring any reported errors'\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(fromCms).addOption(fromProject).addOption(fromFile);\n }\n return program;\n};\n\nexport const getEntryOptions = (command: Command) =>\n command\n .addOption(entryId)\n .addOption(zenql)\n .addOption(contentTypes)\n .addOption(assetTypes);\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;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { MigrateRequest } from 'migratortron';\nimport { url } from '~/util';\n\n// Map various input options into a request to be processed\n// by Migratortron / Contensis import library\nexport const mapContensisOpts = (opts: any = {}): MigrateRequest => ({\n source:\n opts.sourceAlias || opts.sourceProjectId\n ? {\n url: opts.sourceAlias\n ? url(opts.sourceAlias, 'website').cms\n : (undefined as any),\n project: opts.sourceProjectId || (undefined as any),\n }\n : undefined,\n models: opts.modelIds,\n copyField: opts.copyField,\n // convert various cli options into MigrateRequest.query format\n query:\n opts.id ||\n opts.entryIds ||\n opts.phrase ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat ||\n opts.deliveryApi\n ? {\n assetTypes: opts.assetType,\n contentTypeIds: opts.contentType,\n dataFormats: opts.dataFormat ? [opts.dataFormat] : undefined,\n fields: opts.fields,\n includeIds: opts.id || opts.entryIds,\n includePaths: opts.paths,\n orderBy: opts.orderBy,\n searchTerm: opts.phrase,\n useDelivery: opts.deliveryApi,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n ignoreErrors: opts.ignoreErrors,\n concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,\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 */\nexport const delivery = new Option(\n '-delivery --delivery-api',\n 'use delivery api to get the entries'\n);\n\nexport const zenql = new Option(\n '-q --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n);\n\nexport const entryId = new Option('-i --id <id...>', 'the entry id(s) to get');\nexport const contentTypes = new Option(\n '-c --content-type <contentType...>',\n 'get entries of these content type(s)'\n);\nexport const assetTypes = new Option(\n '-at --asset-type <assetType...>',\n 'get assets of given content type(s) e.g. image word pdf'\n);\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 'add this flag only after you have run a preview of the import and agree with the analysis'\n).default(false);\n\nexport const ignoreErrors = new Option(\n '-ignore --ignore-errors',\n 'commit the import ignoring any reported errors'\n).default(false);\n\nexport const outputEntries = new Option(\n '-oe --output-entries <outputEntries>',\n 'which details of the entries included in the import to output'\n)\n .choices(['errors', 'changes', 'all'])\n .default('errors');\n\nexport const concurrency = new Option(\n '-conc --concurrency <concurrency>',\n 'the number of entries to load in parallel'\n).default(2);\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(fromCms).addOption(fromProject).addOption(fromFile);\n }\n return program;\n};\n\nexport const getEntryOptions = (command: Command) =>\n command\n .addOption(entryId)\n .addOption(zenql)\n .addOption(contentTypes)\n .addOption(assetTypes);\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;AA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C,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,OAAO,EAAE,UAAU,WAAW,EAAE,UAAU,QAAQ;AAAA,EACtE;AACA,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,YAC9B,QACG,UAAU,OAAO,EACjB,UAAU,KAAK,EACf,UAAU,YAAY,EACtB,UAAU,UAAU;AAElB,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,8BAA0B,OAAO;AACjC,sBAAkB,OAAO;AACzB,6BAAyB,OAAO;AAAA,EAClC;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/import.js
CHANGED
|
@@ -99,12 +99,7 @@ Example call:
|
|
|
99
99
|
).addOption(import_globalOptions.commit).option(
|
|
100
100
|
"-preserve --preserve-guids",
|
|
101
101
|
"include this flag when you are importing entries that you have previously exported and wish to update"
|
|
102
|
-
).addOption(
|
|
103
|
-
new import_commander.Option(
|
|
104
|
-
"-oe --output-entries <outputEntries>",
|
|
105
|
-
"which details of the entries included in the import to output"
|
|
106
|
-
).choices(["errors", "changes", "all"]).default("errors")
|
|
107
|
-
).addOption(import_globalOptions.ignoreErrors).addHelpText(
|
|
102
|
+
).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.outputEntries).addOption(import_globalOptions.ignoreErrors).addHelpText(
|
|
108
103
|
"after",
|
|
109
104
|
`
|
|
110
105
|
Example call:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/import.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n getEntryOptions,\n ignoreErrors,\n mapContensisOpts,\n} from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\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(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\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(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n getEntryOptions(\n program\n .command('entries')\n .description('import entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\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 .addOption(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\n getEntryOptions,\n ignoreErrors,\n mapContensisOpts,\n outputEntries,\n} from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\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(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\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(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n getEntryOptions(\n program\n .command('entries')\n .description('import entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\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 .addOption(concurrency)\n .addOption(outputEntries)\n .addOption(ignoreErrors)\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import entries --from-file myImportData.json --preserve-guids\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n });\n });\n\n // TODO: add options to import one an array of nodes? nodeIds: string[]\n program\n .command('nodes')\n .description('import nodes')\n .argument('[root]', 'import nodes from the specified path e.g. /blog', '/')\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing nodes that you have previously exported and wish to update'\n )\n .addOption(ignoreErrors)\n .addOption(commit)\n .addOption(\n new Option(\n '-od --output-detail <outputDetail>',\n 'how much detail to output from the import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .option(\n '-ol --output-limit <outputLimit>',\n 'expand or limit the number of records output to the console',\n '200'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes /blog --source-alias example-alias --source-project-id example-project\n > import nodes --from-file site-backup.json --preserve-guids\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ paths: root.split(' '), ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n logLimit: Number(opts.outputLimit),\n });\n });\n\n return program;\n};\n\nexport const get = makeImport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ACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,OAAO,OAAO,MAAc,SAAS;AACpC,cAAM;AAAA,MACJ,CAAC,UAAU,OAAO;AAAA,MAClB;AAAA,UACA,uCAAiB,EAAE,OAAO,KAAK,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC;AAAA,IACtD,EAAE,YAAY;AAAA,MACZ,QAAQ,KAAK;AAAA,MACb,UAAU,KAAK;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,UAAU,OAAO,KAAK,WAAW;AAAA,IACnC,CAAC;AAAA,EACH,CAAC;AAEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/index.js
CHANGED
|
@@ -25,6 +25,7 @@ var import_commander = require("commander");
|
|
|
25
25
|
var import_logger = require("../util/logger");
|
|
26
26
|
var import_version = require("../version");
|
|
27
27
|
var import_connect = require("./connect");
|
|
28
|
+
var import_copy = require("./copy");
|
|
28
29
|
var import_create = require("./create");
|
|
29
30
|
var import_dev = require("./dev");
|
|
30
31
|
var import_diff = require("./diff");
|
|
@@ -57,6 +58,9 @@ const commands = () => {
|
|
|
57
58
|
program.addCommand(
|
|
58
59
|
(0, import_globalOptions.addGlobalOptions)((0, import_create.makeCreateCommand)()).copyInheritedSettings(program)
|
|
59
60
|
);
|
|
61
|
+
program.addCommand(
|
|
62
|
+
(0, import_globalOptions.addGlobalOptions)((0, import_copy.makeCopyCommand)()).copyInheritedSettings(program)
|
|
63
|
+
);
|
|
60
64
|
program.addCommand(
|
|
61
65
|
(0, import_globalOptions.addConnectOptions)(
|
|
62
66
|
(0, import_globalOptions.addAuthenticationOptions)((0, import_dev.makeDevCommand)())
|
|
@@ -66,9 +70,9 @@ const commands = () => {
|
|
|
66
70
|
(0, import_globalOptions.addGlobalOptions)((0, import_execute.makeExecuteCommand)()).copyInheritedSettings(program)
|
|
67
71
|
);
|
|
68
72
|
program.addCommand(
|
|
69
|
-
(0, import_globalOptions.addGlobalOptions)(
|
|
70
|
-
|
|
71
|
-
)
|
|
73
|
+
(0, import_globalOptions.addGlobalOptions)((0, import_globalOptions.addImportOptions)((0, import_diff.makeDiffCommand)())).copyInheritedSettings(
|
|
74
|
+
program
|
|
75
|
+
)
|
|
72
76
|
);
|
|
73
77
|
program.addCommand(
|
|
74
78
|
(0, import_globalOptions.addGlobalOptions)((0, import_get.makeGetCommand)()).copyInheritedSettings(program)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCreateCommand } from './create';\nimport { makeDevCommand } from './dev';\nimport { makeDiffCommand } from './diff';\nimport { makeExecuteCommand } from './execute';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\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 .addHelpText(\n 'after',\n Logger.helpText`\n>> Each command has its own help - for example:\n > login --help\\n > get --help\n`\n )\n .exitOverride()\n .showHelpAfterError(true);\n\n program.addCommand(\n addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(\n addAuthenticationOptions(makeDevCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeExecuteCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,oBAAuB;AACvB,qBAA4B;AAC5B,qBAAmC;AACnC,oBAAkC;AAClC,iBAA+B;AAC/B,kBAAgC;AAChC,qBAAmC;AACnC,iBAA+B;AAC/B,2BAKO;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,IACC;AAAA,IACA,qBAAO;AAAA;AAAA;AAAA;AAAA,EAIT,EACC,aAAa,EACb,mBAAmB,IAAI;AAE1B,UAAQ;AAAA,QACN,mDAAyB,mCAAmB,CAAC,EAAE;AAAA,MAC7C;AAAA,IACF;AAAA,EACF;AACA,UAAQ;AAAA,QACN,2CAAiB,iCAAkB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN;AAAA,UACE,mDAAyB,2BAAe,CAAC;AAAA,IAC3C,EAAE,sBAAsB,OAAO;AAAA,EACjC;AACA,UAAQ;AAAA,QACN,2CAAiB,mCAAmB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACtE;AACA,UAAQ;AAAA,QACN
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { Logger } from '~/util/logger';\nimport { LIB_VERSION } from '~/version';\nimport { makeConnectCommand } from './connect';\nimport { makeCopyCommand } from './copy';\nimport { makeCreateCommand } from './create';\nimport { makeDevCommand } from './dev';\nimport { makeDiffCommand } from './diff';\nimport { makeExecuteCommand } from './execute';\nimport { makeGetCommand } from './get';\nimport {\n addAuthenticationOptions,\n addConnectOptions,\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 .addHelpText(\n 'after',\n Logger.helpText`\n>> Each command has its own help - for example:\n > login --help\\n > get --help\n`\n )\n .exitOverride()\n .showHelpAfterError(true);\n\n program.addCommand(\n addAuthenticationOptions(makeConnectCommand()).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(makeCreateCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeCopyCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addConnectOptions(\n addAuthenticationOptions(makeDevCommand())\n ).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(makeExecuteCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(addImportOptions(makeDiffCommand())).copyInheritedSettings(\n program\n )\n );\n program.addCommand(\n addGlobalOptions(makeGetCommand()).copyInheritedSettings(program)\n );\n program.addCommand(\n addGlobalOptions(\n 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,kBAAgC;AAChC,oBAAkC;AAClC,iBAA+B;AAC/B,kBAAgC;AAChC,qBAAmC;AACnC,iBAA+B;AAC/B,2BAKO;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,IACC;AAAA,IACA,qBAAO;AAAA;AAAA;AAAA;AAAA,EAIT,EACC,aAAa,EACb,mBAAmB,IAAI;AAE1B,UAAQ;AAAA,QACN,mDAAyB,mCAAmB,CAAC,EAAE;AAAA,MAC7C;AAAA,IACF;AAAA,EACF;AACA,UAAQ;AAAA,QACN,2CAAiB,iCAAkB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACrE;AACA,UAAQ;AAAA,QACN,2CAAiB,6BAAgB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACnE;AACA,UAAQ;AAAA,QACN;AAAA,UACE,mDAAyB,2BAAe,CAAC;AAAA,IAC3C,EAAE,sBAAsB,OAAO;AAAA,EACjC;AACA,UAAQ;AAAA,QACN,2CAAiB,mCAAmB,CAAC,EAAE,sBAAsB,OAAO;AAAA,EACtE;AACA,UAAQ;AAAA,QACN,2CAAiB,2CAAiB,6BAAgB,CAAC,CAAC,EAAE;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACA,UAAQ;AAAA,QACN,2CAAiB,2BAAe,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAClE;AACA,UAAQ;AAAA,QACN;AAAA,UACE,2CAAiB,iCAAkB,CAAC;AAAA,IACtC,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -47,6 +47,7 @@ class RequestHandlerFactory {
|
|
|
47
47
|
name = "request-handler-localdevelopment";
|
|
48
48
|
cmd = "Zengenti.Contensis.RequestHandler.LocalDevelopment";
|
|
49
49
|
prerelease;
|
|
50
|
+
version;
|
|
50
51
|
get exePath() {
|
|
51
52
|
return import_path.default.join(this.basePath, `${this.name}-${this.moduleInfo.version}`);
|
|
52
53
|
}
|
|
@@ -56,18 +57,19 @@ class RequestHandlerFactory {
|
|
|
56
57
|
version: "*"
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
constructor(prerelease = false) {
|
|
60
|
+
constructor(version, prerelease = false) {
|
|
60
61
|
this.prerelease = prerelease;
|
|
62
|
+
this.version = version;
|
|
61
63
|
}
|
|
62
64
|
async Create() {
|
|
63
|
-
const { moduleInfo } = this;
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
65
|
+
const { moduleInfo, version } = this;
|
|
66
|
+
const downloadImmediately = !(moduleInfo == null ? void 0 : moduleInfo.version) || (moduleInfo == null ? void 0 : moduleInfo.version) === "*" || this.version;
|
|
67
|
+
if (downloadImmediately) {
|
|
66
68
|
this.manifest.writeModule(this.name, this.moduleInfo);
|
|
67
|
-
await this.CheckUpdate({ verbose: true });
|
|
69
|
+
await this.CheckUpdate({ verbose: true, version });
|
|
68
70
|
}
|
|
69
71
|
await this.ApplyUpdate();
|
|
70
|
-
if (!
|
|
72
|
+
if (!downloadImmediately)
|
|
71
73
|
this.CheckUpdate();
|
|
72
74
|
return this.CreateInvoke(this);
|
|
73
75
|
}
|
|
@@ -114,10 +116,13 @@ class RequestHandlerFactory {
|
|
|
114
116
|
}
|
|
115
117
|
};
|
|
116
118
|
}
|
|
117
|
-
async CheckUpdate({
|
|
118
|
-
|
|
119
|
+
async CheckUpdate({
|
|
120
|
+
verbose = false,
|
|
121
|
+
version
|
|
122
|
+
} = {}) {
|
|
123
|
+
const { cmd, debug, log, manifest, messages, moduleInfo } = this;
|
|
119
124
|
const github = new import_GitHubCliModuleProvider.default(moduleInfo.github);
|
|
120
|
-
const release = await github.FindLatestRelease();
|
|
125
|
+
const release = await github.FindLatestRelease(version);
|
|
121
126
|
if (verbose || debug)
|
|
122
127
|
if (release)
|
|
123
128
|
log.info(
|
|
@@ -129,7 +134,8 @@ ${release.html_url}`
|
|
|
129
134
|
);
|
|
130
135
|
else
|
|
131
136
|
log.warning(messages.devrequests.install.notFound(moduleInfo.github));
|
|
132
|
-
|
|
137
|
+
const downloadSpecificRelease = version && !(0, import_file_provider.checkDir)("c") && (release == null ? void 0 : release.tag_name);
|
|
138
|
+
if ((release == null ? void 0 : release.tag_name) && ![moduleInfo.version, moduleInfo.install].includes(release.tag_name) || downloadSpecificRelease) {
|
|
133
139
|
const downloadPath = import_path.default.join(
|
|
134
140
|
this.basePath,
|
|
135
141
|
`${this.name}-${release.tag_name}`
|
|
@@ -145,6 +151,7 @@ ${release.html_url}`
|
|
|
145
151
|
}
|
|
146
152
|
try {
|
|
147
153
|
await github.DownloadRelease(release, {
|
|
154
|
+
cmd,
|
|
148
155
|
path: downloadPath,
|
|
149
156
|
platforms: [
|
|
150
157
|
["win32", "win-x64"],
|
|
@@ -169,8 +176,12 @@ ${release.html_url}`
|
|
|
169
176
|
release.tag_name
|
|
170
177
|
)
|
|
171
178
|
});
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
if (!version) {
|
|
180
|
+
this.moduleInfo.install = release.tag_name;
|
|
181
|
+
manifest.writeModule(this.name, this.moduleInfo);
|
|
182
|
+
} else {
|
|
183
|
+
this.moduleInfo.version = release.tag_name;
|
|
184
|
+
}
|
|
174
185
|
}
|
|
175
186
|
}
|
|
176
187
|
}
|
|
@@ -194,7 +205,7 @@ ${release.html_url}`
|
|
|
194
205
|
}
|
|
195
206
|
}
|
|
196
207
|
}
|
|
197
|
-
const createRequestHandler = () => new RequestHandlerFactory().Create();
|
|
208
|
+
const createRequestHandler = (version) => new RequestHandlerFactory(version).Create();
|
|
198
209
|
// Annotate the CommonJS export names for ESM import in node:
|
|
199
210
|
0 && (module.exports = {
|
|
200
211
|
RequestHandlerFactory,
|