contensis-cli 1.5.1-beta.2 → 1.5.1-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -23
- package/cli.js +20 -0
- package/dist/commands/get.js +9 -3
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/globalOptions.js +18 -1
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +5 -2
- package/dist/commands/import.js.map +2 -2
- package/dist/localisation/en-GB.js +11 -6
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/mappers/MixedFileData.js +83 -0
- package/dist/mappers/MixedFileData.js.map +7 -0
- package/dist/services/ContensisCliService.js +125 -105
- package/dist/services/ContensisCliService.js.map +3 -3
- package/dist/util/console.printer.js +9 -10
- package/dist/util/console.printer.js.map +3 -3
- package/dist/util/index.js +0 -11
- package/dist/util/index.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/get.ts +10 -3
- package/src/commands/globalOptions.ts +21 -0
- package/src/commands/import.ts +8 -1
- package/src/localisation/en-GB.ts +16 -4
- package/src/mappers/MixedFileData.ts +80 -0
- package/src/services/ContensisCliService.ts +158 -130
- package/src/util/console.printer.ts +10 -9
- package/src/util/index.ts +1 -13
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Use Contensis from your favourite terminal
|
|
4
4
|
|
|
5
|
+
- [Windows Terminal](https://github.com/microsoft/terminal?tab=readme-ov-file#installing-and-running-windows-terminal) is strongly recommended over classic PowerShell for Windows users
|
|
6
|
+
|
|
5
7
|
Download the executable for your operating system from the [Releases page](https://github.com/contensis/cli/releases) and add it to a folder in your local `PATH`
|
|
6
8
|
|
|
7
9
|
or use your preferred installation method below
|
|
@@ -40,12 +42,27 @@ brew install contensis-cli-linux
|
|
|
40
42
|
Install the package via [`npm`](https://www.npmjs.com/package/contensis-cli) as a global module (requires [Node.js](https://nodejs.org/en/download/))
|
|
41
43
|
|
|
42
44
|
```shell
|
|
43
|
-
npm i --global contensis-cli
|
|
45
|
+
npm i --global contensis-cli
|
|
44
46
|
```
|
|
45
47
|
|
|
46
48
|
If you use `nvm` and are frequently switching your local `node` version it will also switch your global `node_modules` each time, it is recommended use one of the binary installations instead.
|
|
47
49
|
|
|
48
|
-
##
|
|
50
|
+
## Try out a prerelease version
|
|
51
|
+
|
|
52
|
+
You can check the change logs for any upcoming release, there will be an [open pull request](https://github.com/contensis/cli/pulls)
|
|
53
|
+
|
|
54
|
+
### Executable from build Artifacts
|
|
55
|
+
|
|
56
|
+
- Click on the latest build pipeline from the [Actions page](https://github.com/contensis/cli/actions)
|
|
57
|
+
- At the bottom there will be Artifacts - download and unzip the correct version for your platform.
|
|
58
|
+
- Run the unzipped executable, you will need to bypass any security warnings or prompts you might encounter.
|
|
59
|
+
|
|
60
|
+
### Prerelease version from NPM
|
|
61
|
+
|
|
62
|
+
- `npx contensis-cli@prerelease`
|
|
63
|
+
- Note: your local Node.js version must be a compatible version, today we recommend Node.js v22
|
|
64
|
+
|
|
65
|
+
## Run from source
|
|
49
66
|
|
|
50
67
|
Clone the [repository](https://github.com/contensis/cli) and follow the instructions in the [`README`](https://github.com/contensis/cli#readme)
|
|
51
68
|
|
|
@@ -1002,17 +1019,17 @@ website t.durden@example-dev> create tags in topics Books Faces History Places S
|
|
|
1002
1019
|
-------------------------------------
|
|
1003
1020
|
[cli] ✅ 🔍 IMPORT PREVIEW 🔭
|
|
1004
1021
|
[25/06 16:41:41] [INFO] Fetching tags in all groups from target environment example-dev website
|
|
1005
|
-
|
|
1006
|
-
No tag group to migrate into website
|
|
1007
1022
|
|
|
1008
|
-
|
|
1023
|
+
No tag group to migrate into website
|
|
1024
|
+
|
|
1025
|
+
status total
|
|
1009
1026
|
-----------------------
|
|
1010
1027
|
no change 1
|
|
1011
1028
|
-----------------------
|
|
1012
1029
|
|
|
1013
|
-
No tags to migrate into website
|
|
1030
|
+
No tags to migrate into website
|
|
1014
1031
|
|
|
1015
|
-
status total
|
|
1032
|
+
status total
|
|
1016
1033
|
-----------------------
|
|
1017
1034
|
no change 5
|
|
1018
1035
|
-----------------------
|
|
@@ -1055,7 +1072,7 @@ website t.durden@example-dev> remove tags 109eb3e9-98c9-5ab2-b9df-f1c80af3ac5c d
|
|
|
1055
1072
|
|
|
1056
1073
|
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1057
1074
|
|
|
1058
|
-
website t.durden@example-dev>
|
|
1075
|
+
website t.durden@example-dev>
|
|
1059
1076
|
```
|
|
1060
1077
|
|
|
1061
1078
|
### Remove tags in group
|
|
@@ -1837,6 +1854,7 @@ The output will be the same as the `import models` examples above
|
|
|
1837
1854
|
<sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
|
|
1838
1855
|
|
|
1839
1856
|
## Import tags and groups
|
|
1857
|
+
|
|
1840
1858
|
### Import from another Contensis environment
|
|
1841
1859
|
|
|
1842
1860
|
Connect to your "source" environment, ensure you can fetch the tags from this environment first and that these are the right tags you plan on importing to your "target" environment.
|
|
@@ -1853,36 +1871,36 @@ website t.durden@example-dev> import tags --source-alias example-dev --source-pr
|
|
|
1853
1871
|
[cli] ✅ 🔍 IMPORT PREVIEW 🔭
|
|
1854
1872
|
[25/06 15:26:37] [INFO] Fetching tags in all groups from example-dev leif
|
|
1855
1873
|
[25/06 15:26:37] [INFO] Fetching tags in all groups from target environment example-dev website
|
|
1856
|
-
|
|
1857
|
-
1/2 tag groups to migrate into website
|
|
1858
1874
|
|
|
1859
|
-
|
|
1875
|
+
1/2 tag groups to migrate into website
|
|
1876
|
+
|
|
1877
|
+
status total
|
|
1860
1878
|
-----------------------
|
|
1861
1879
|
create 1
|
|
1862
1880
|
no change 1
|
|
1863
1881
|
-----------------------
|
|
1864
1882
|
|
|
1865
|
-
id status name description
|
|
1883
|
+
id status name description
|
|
1866
1884
|
------------------------------------------------------------------------------------------------
|
|
1867
1885
|
newGroup create New group
|
|
1868
1886
|
------------------------------------------------------------------------------------------------
|
|
1869
1887
|
|
|
1870
|
-
|
|
1871
|
-
5/7 tags to migrate into website
|
|
1872
1888
|
|
|
1873
|
-
|
|
1889
|
+
5/7 tags to migrate into website
|
|
1890
|
+
|
|
1891
|
+
status total
|
|
1874
1892
|
-----------------------
|
|
1875
1893
|
create 5
|
|
1876
1894
|
no change 2
|
|
1877
1895
|
-----------------------
|
|
1878
1896
|
|
|
1879
|
-
id value status groupId label
|
|
1897
|
+
id value status groupId label
|
|
1880
1898
|
------------------------------------------------------------------------------------------------
|
|
1881
|
-
02bcb977-1196-4c3f-a921-d2dfce3ca32b new1 create newGroup {"en-GB":"New 1"}
|
|
1882
|
-
f48eb862-7b73-4a77-a2af-09492a88a8f0 new2 create newGroup {"en-GB":"New 2"}
|
|
1883
|
-
8673e419-55c9-4ba0-bcd7-28c7c6fa46cc new3 create newGroup {"en-GB":"New 3"}
|
|
1884
|
-
90a11d09-3727-45c2-a0df-86f1865828ab tag3 create newGroup {"en-GB":"Tag 3"}
|
|
1885
|
-
d4267b35-0d25-41ae-bce9-eeb490c793f4 tag3 create resourcesTagGroup {"en-GB":"Tag 3"}
|
|
1899
|
+
02bcb977-1196-4c3f-a921-d2dfce3ca32b new1 create newGroup {"en-GB":"New 1"}
|
|
1900
|
+
f48eb862-7b73-4a77-a2af-09492a88a8f0 new2 create newGroup {"en-GB":"New 2"}
|
|
1901
|
+
8673e419-55c9-4ba0-bcd7-28c7c6fa46cc new3 create newGroup {"en-GB":"New 3"}
|
|
1902
|
+
90a11d09-3727-45c2-a0df-86f1865828ab tag3 create newGroup {"en-GB":"Tag 3"}
|
|
1903
|
+
d4267b35-0d25-41ae-bce9-eeb490c793f4 tag3 create resourcesTagGroup {"en-GB":"Tag 3"}
|
|
1886
1904
|
------------------------------------------------------------------------------------------------
|
|
1887
1905
|
|
|
1888
1906
|
[25/06 15:26:38] [OK] Tags migration preview ready
|
|
@@ -1901,9 +1919,11 @@ Import resources directly from a JSON file. The path can be relative or absolute
|
|
|
1901
1919
|
```shell
|
|
1902
1920
|
website t.durden@example-dev> import tags --from-file ./tags.json
|
|
1903
1921
|
```
|
|
1922
|
+
|
|
1904
1923
|
```shell
|
|
1905
1924
|
website t.durden@example-dev> import taggroups --from-file ./taggroups.json
|
|
1906
1925
|
```
|
|
1926
|
+
|
|
1907
1927
|
```shell
|
|
1908
1928
|
website t.durden@example-dev> import tags --from-file ./tags-and-groups.json
|
|
1909
1929
|
```
|
|
@@ -2132,7 +2152,7 @@ The required inputs for using `copy field` are:
|
|
|
2132
2152
|
- `fieldId`: the field id containing the source data
|
|
2133
2153
|
- `destinationId`: the target field id where the data will be copied to
|
|
2134
2154
|
|
|
2135
|
-
Copying field data from one field to another can only be done with fields that exist in the content type, and with the source and destination field types are metioned in the [transformation matrix](docs/copy_field_transformation_matrix.md)
|
|
2155
|
+
Copying field data from one field to another can only be done with fields that exist in the content type, and with the source and destination field types are metioned in the [transformation matrix](https://github.com/contensis/cli/blob/main/packages/contensis-cli/docs/copy_field_transformation_matrix.md)
|
|
2136
2156
|
|
|
2137
2157
|
Similar to the `import` commands, the `copy` command is safe to run again and again for testing and reviewing the output. The changes are made to the entries permanently when the `--commit` option is added.
|
|
2138
2158
|
|
|
@@ -2254,7 +2274,7 @@ Adding a template containing html? Attributes can be wrapped in single quotes.
|
|
|
2254
2274
|
|
|
2255
2275
|
Escape characters and new lines can be introduced inside templates when calling `contensis copy field` from your system shell as a cli command. This is OS/shell dependent and does not work in the Contensis shell (due to the combined layers of command parsing)
|
|
2256
2276
|
|
|
2257
|
-
Further documentation on using [templates](docs/copy_field_templates.md)
|
|
2277
|
+
Further documentation on using [templates](https://github.com/contensis/cli/blob/main/packages/contensis-cli/docs/copy_field_templates.md)
|
|
2258
2278
|
|
|
2259
2279
|
### Copy a hard-coded entry link into a field using a template
|
|
2260
2280
|
|
package/cli.js
CHANGED
|
@@ -16,6 +16,26 @@ if (!globalThis.crypto) {
|
|
|
16
16
|
globalThis.crypto = crypto.webcrypto;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** enterprise-fetch v2 uses the native node fetch if available which
|
|
20
|
+
* does not work with Management API file uploads correctly,
|
|
21
|
+
* so we force it to fallback to use the older `node-fetch` implementation
|
|
22
|
+
* which the Management API is deisgned to work with.
|
|
23
|
+
* Native fetch shows this when uploading an asset:
|
|
24
|
+
|
|
25
|
+
content-length: 17
|
|
26
|
+
|
|
27
|
+
[object FormData]
|
|
28
|
+
* where node-fetch show this
|
|
29
|
+
Content-Length: 53427
|
|
30
|
+
|
|
31
|
+
----------------------------220769149404052112875897
|
|
32
|
+
Content-Disposition: form-data; name="file"; filename="default-meta1.jpg"
|
|
33
|
+
Content-Type: image/jpeg
|
|
34
|
+
|
|
35
|
+
...binary data...
|
|
36
|
+
*/
|
|
37
|
+
globalThis.fallbackFetch = true;
|
|
38
|
+
|
|
19
39
|
/**
|
|
20
40
|
* Run cli command or launch shell
|
|
21
41
|
*/
|
package/dist/commands/get.js
CHANGED
|
@@ -214,9 +214,15 @@ Example call:
|
|
|
214
214
|
program.command("entries").description("get entries").argument(
|
|
215
215
|
"[search phrase]",
|
|
216
216
|
"get entries with the search phrase, use quotes for multiple words"
|
|
217
|
-
).addOption(import_globalOptions.contentTypes).
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
).addOption(import_globalOptions.contentTypes).addOption(
|
|
218
|
+
new import_commander.Option(
|
|
219
|
+
"-d --dependents [depth]",
|
|
220
|
+
"find and return any dependencies of all found entries (optionally limit the number of dependency levels)"
|
|
221
|
+
).argParser((value) => {
|
|
222
|
+
if (value === void 0) return true;
|
|
223
|
+
const num = Number(value);
|
|
224
|
+
return isNaN(num) ? true : num;
|
|
225
|
+
})
|
|
220
226
|
)
|
|
221
227
|
).addOption(
|
|
222
228
|
new import_commander.Option(
|
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 {\n addGlobalOptions,\n assetTypes,\n contentTypes,\n delivery,\n entryId,\n exportOption,\n latest,\n mapContensisOpts,\n noCache,\n requiredBy,\n versionStatus,\n zenql,\n} from './globalOptions';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { isUuid } from '~/util/assert';\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('proxy')\n .description('get a proxy')\n .argument('<proxyId>', 'id of the proxy to get')\n .addHelpText(\n 'after',\n `\n Example call:\n > get proxy b8b6958f-6ae2-41d5-876a-abc86755fd7b\n `\n )\n .action(async (proxyId: string, opts) => {\n await cliCommand(['get', 'proxy', proxyId], opts).PrintProxies(proxyId);\n });\n\n program\n .command('renderer')\n .description('get a renderer')\n .argument('<rendererId>', 'id of the renderer to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get renderer contensis-website\n`\n )\n .action(async (rendererId: string, opts) => {\n await cliCommand(['get', 'renderer', rendererId], opts).PrintRenderers(\n rendererId\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('tag')\n .description('get a tag')\n .argument('[idOrLabel]', 'find a tag with this id or label')\n .option('-in --group <groupId>', 'id of the tag group containing tags')\n .option('-l --language <language>', 'find tags in the supplied language')\n .option('-d --dependents', 'find and return tag groups for all found tags')\n .addHelpText(\n 'after',\n `\n Example call:\n > get tag \"Places\" --group topics\n > get tag \"Places\" -in topics\n > get tag \"Lieux\" --language fr-FR -in topics\n > get tag d4267b35-0d25-41ae-bce9-eeb490c793f4\n `\n )\n .action(async (idOrlabel: string, opts) => {\n await cliCommand(['get', 'tag', idOrlabel], opts).PrintTag(\n {\n id: isUuid(idOrlabel) ? idOrlabel : undefined,\n groupId: opts.group,\n label: isUuid(idOrlabel) ? undefined : idOrlabel,\n language: opts.language,\n },\n opts.dependents\n );\n });\n\n program\n .command('taggroup')\n .description('get a tag group')\n .argument('<groupId>', 'id of the tag group to get')\n .addHelpText(\n 'after',\n `\n Example call:\n > get taggroup topics\n `\n )\n .action(async (groupId: string, opts) => {\n await cliCommand(['get', 'taggroup', groupId], opts).PrintTagGroup(\n groupId\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 .addOption(requiredBy)\n .addOption(exportOption)\n .addOption(noCache)\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 mapContensisOpts(opts)\n ).PrintContentModels(modelIds, opts);\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 .addOption(latest)\n .addOption(versionStatus)\n .addOption(delivery);\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 (search: 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', search, ...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 (search: string, opts, cmd) => {\n await cliCommand(\n ['get', 'entries'],\n opts,\n mapContensisOpts({ search, ...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,2BAaO;AACP,iCAA2B;AAC3B,oBAAuB;AAEhB,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,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AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACC,UAAU,2BAAM,EAChB,UAAU,kCAAa,EACvB,UAAU,6BAAQ;AAEvB;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;AAAA,EACf,CAAC;AAEH;AAAA,IACE,QACG,QAAQ,SAAS,EACjB,YAAY,aAAa,EACzB;AAAA,MACC;AAAA,MACA;AAAA,IACF,EACC,UAAU,iCAAY,EACtB;AAAA,MACC;AAAA,
|
|
4
|
+
"sourcesContent": ["import { Argument, Command, Option } from 'commander';\nimport { merge } from 'lodash';\nimport {\n addGlobalOptions,\n assetTypes,\n contentTypes,\n delivery,\n entryId,\n exportOption,\n latest,\n mapContensisOpts,\n noCache,\n requiredBy,\n versionStatus,\n zenql,\n} from './globalOptions';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { isUuid } from '~/util/assert';\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('proxy')\n .description('get a proxy')\n .argument('<proxyId>', 'id of the proxy to get')\n .addHelpText(\n 'after',\n `\n Example call:\n > get proxy b8b6958f-6ae2-41d5-876a-abc86755fd7b\n `\n )\n .action(async (proxyId: string, opts) => {\n await cliCommand(['get', 'proxy', proxyId], opts).PrintProxies(proxyId);\n });\n\n program\n .command('renderer')\n .description('get a renderer')\n .argument('<rendererId>', 'id of the renderer to get')\n .addHelpText(\n 'after',\n `\nExample call:\n > get renderer contensis-website\n`\n )\n .action(async (rendererId: string, opts) => {\n await cliCommand(['get', 'renderer', rendererId], opts).PrintRenderers(\n rendererId\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('tag')\n .description('get a tag')\n .argument('[idOrLabel]', 'find a tag with this id or label')\n .option('-in --group <groupId>', 'id of the tag group containing tags')\n .option('-l --language <language>', 'find tags in the supplied language')\n .option('-d --dependents', 'find and return tag groups for all found tags')\n .addHelpText(\n 'after',\n `\n Example call:\n > get tag \"Places\" --group topics\n > get tag \"Places\" -in topics\n > get tag \"Lieux\" --language fr-FR -in topics\n > get tag d4267b35-0d25-41ae-bce9-eeb490c793f4\n `\n )\n .action(async (idOrlabel: string, opts) => {\n await cliCommand(['get', 'tag', idOrlabel], opts).PrintTag(\n {\n id: isUuid(idOrlabel) ? idOrlabel : undefined,\n groupId: opts.group,\n label: isUuid(idOrlabel) ? undefined : idOrlabel,\n language: opts.language,\n },\n opts.dependents\n );\n });\n\n program\n .command('taggroup')\n .description('get a tag group')\n .argument('<groupId>', 'id of the tag group to get')\n .addHelpText(\n 'after',\n `\n Example call:\n > get taggroup topics\n `\n )\n .action(async (groupId: string, opts) => {\n await cliCommand(['get', 'taggroup', groupId], opts).PrintTagGroup(\n groupId\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 .addOption(requiredBy)\n .addOption(exportOption)\n .addOption(noCache)\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 mapContensisOpts(opts)\n ).PrintContentModels(modelIds, opts);\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 .addOption(latest)\n .addOption(versionStatus)\n .addOption(delivery);\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 (search: 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', search, ...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 .addOption(\n new Option(\n '-d --dependents [depth]',\n 'find and return any dependencies of all found entries (optionally limit the number of dependency levels)'\n ).argParser(value => {\n // If value is undefined, treat as boolean true\n if (value === undefined) return true;\n const num = Number(value);\n return isNaN(num) ? true : num;\n })\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 (search: string, opts, cmd) => {\n await cliCommand(\n ['get', 'entries'],\n opts,\n mapContensisOpts({ search, ...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,2BAaO;AACP,iCAA2B;AAC3B,oBAAuB;AAEhB,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,OAAO,EACf,Y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ACF,EACC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMF,EACC,OAAO,OAAO,SAAiB,QAAgB,SAAiB,SAAS;AACxE,cAAM,uCAAW,CAAC,OAAO,SAAS,OAAO,GAAG,IAAI,EAAE;AAAA,MAChD;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAEH,QACG,QAAQ,MAAM,EACd,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;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF,EACG,QAAQ,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
|
}
|
|
@@ -34,6 +34,7 @@ __export(globalOptions_exports, {
|
|
|
34
34
|
fromProject: () => fromProject,
|
|
35
35
|
ignoreErrors: () => ignoreErrors,
|
|
36
36
|
latest: () => latest,
|
|
37
|
+
logLevel: () => logLevel,
|
|
37
38
|
mapContensisOpts: () => mapContensisOpts,
|
|
38
39
|
noCache: () => noCache,
|
|
39
40
|
noPublish: () => noPublish,
|
|
@@ -42,6 +43,7 @@ __export(globalOptions_exports, {
|
|
|
42
43
|
requiredBy: () => requiredBy,
|
|
43
44
|
saveEntries: () => saveEntries,
|
|
44
45
|
search: () => search,
|
|
46
|
+
stopLevel: () => stopLevel,
|
|
45
47
|
versionStatus: () => versionStatus,
|
|
46
48
|
zenql: () => zenql
|
|
47
49
|
});
|
|
@@ -76,9 +78,13 @@ const mapContensisOpts = (opts = {}) => ({
|
|
|
76
78
|
// arg is inverted automatically from `--no-cache` to `cache: false`
|
|
77
79
|
includeDefaults: opts.defaults,
|
|
78
80
|
// arg is inverted automatically from `--no-defaults` to `defaults: false`
|
|
81
|
+
includeValidations: opts.validations,
|
|
82
|
+
// arg is inverted automatically from `--no-validations` to `validations: false`
|
|
79
83
|
concurrency: opts.concurrency ? Number(opts.concurrency) : void 0,
|
|
80
|
-
noPublish: !opts.publish
|
|
84
|
+
noPublish: !opts.publish,
|
|
81
85
|
// arg is inverted automatically from `--no-publish` to `publish: false`
|
|
86
|
+
outputLogs: opts.logLevel,
|
|
87
|
+
stopLevel: typeof opts.stopLevel === "number" ? Number(opts.stopLevel) : typeof opts.dependents === "number" ? Number(opts.dependents) : void 0
|
|
82
88
|
});
|
|
83
89
|
const output = new import_commander.Option(
|
|
84
90
|
"-o --output <output>",
|
|
@@ -166,6 +172,10 @@ const ignoreErrors = new import_commander.Option(
|
|
|
166
172
|
"-ignore --ignore-errors",
|
|
167
173
|
"commit the import ignoring any reported errors"
|
|
168
174
|
).default(false);
|
|
175
|
+
const logLevel = new import_commander.Option(
|
|
176
|
+
"-ll --log-level <logLevel>",
|
|
177
|
+
"set the logging level to output more detailed logs"
|
|
178
|
+
).choices(["debug", "info", "warning", "error", "none"]).default("warning");
|
|
169
179
|
const outputDetail = new import_commander.Option(
|
|
170
180
|
"-od --output-detail <outputDetail>",
|
|
171
181
|
"how much detail to output from the import"
|
|
@@ -186,6 +196,10 @@ const noPublish = new import_commander.Option(
|
|
|
186
196
|
"--no-publish",
|
|
187
197
|
"don't publish created or updated entries"
|
|
188
198
|
);
|
|
199
|
+
const stopLevel = new import_commander.Option(
|
|
200
|
+
"-d --stop-level <stopLevel>",
|
|
201
|
+
"the level at which to stop resolving dependent entries (may result in incomplete entries)"
|
|
202
|
+
).argParser(parseInt);
|
|
189
203
|
const addConnectOptions = (program) => program.addOption(alias.hideHelp()).addOption(project.hideHelp());
|
|
190
204
|
const addAuthenticationOptions = (program) => program.addOption(user.hideHelp()).addOption(password.hideHelp()).addOption(clientId.hideHelp()).addOption(sharedSecret.hideHelp());
|
|
191
205
|
const addOutputAndFormatOptions = (program) => program.addOption(output).addOption(format);
|
|
@@ -197,6 +211,7 @@ const addImportOptions = (program) => {
|
|
|
197
211
|
};
|
|
198
212
|
const addGlobalOptions = (program) => {
|
|
199
213
|
for (const command of program.commands) {
|
|
214
|
+
command.addOption(logLevel.hideHelp());
|
|
200
215
|
addOutputAndFormatOptions(command);
|
|
201
216
|
addConnectOptions(command);
|
|
202
217
|
addAuthenticationOptions(command);
|
|
@@ -221,6 +236,7 @@ const addGlobalOptions = (program) => {
|
|
|
221
236
|
fromProject,
|
|
222
237
|
ignoreErrors,
|
|
223
238
|
latest,
|
|
239
|
+
logLevel,
|
|
224
240
|
mapContensisOpts,
|
|
225
241
|
noCache,
|
|
226
242
|
noPublish,
|
|
@@ -229,6 +245,7 @@ const addGlobalOptions = (program) => {
|
|
|
229
245
|
requiredBy,
|
|
230
246
|
saveEntries,
|
|
231
247
|
search,
|
|
248
|
+
stopLevel,
|
|
232
249
|
versionStatus,
|
|
233
250
|
zenql
|
|
234
251
|
});
|
|
@@ -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 { 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 updateField: opts.updateField,\n // convert various cli options into MigrateRequest.query format\n query:\n opts.id ||\n opts.entryIds ||\n opts.search ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat ||\n opts.deliveryApi ||\n opts.latest ||\n opts.versionStatus\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.search,\n useDelivery: opts.deliveryApi,\n versionStatus: opts.latest ? 'latest' : opts.versionStatus,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n ignoreErrors: opts.ignoreErrors,\n noCache: !opts.cache, // arg is inverted automatically from `--no-cache` to `cache: false`\n includeDefaults: opts.defaults, // arg is inverted automatically from `--no-defaults` to `defaults: false`\n concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,\n noPublish: !opts.publish, // arg is inverted automatically from `--no-publish` to `publish: false`\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, html, xml or default'\n).choices(['csv', 'json', 'html', '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/* Model get options */\nexport const requiredBy = new Option(\n '--required-by',\n 'shows the id(s) that created each dependency'\n);\nexport const exportOption = new Option(\n '--export',\n 'export the raw resources that make up the content model(s) (used with --output)'\n);\n\n/* Entry get options */\nexport const delivery = new Option(\n '-delivery --delivery-api',\n 'use delivery api to get the entries'\n);\nexport const search = new Option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\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);\nexport const versionStatus = new Option(\n '-vs --version-status <versionStatus>',\n 'the entry versions to get'\n)\n .choices(['latest', 'published'])\n .default('published');\n\nexport const latest = new Option('--latest', 'get the latest entry versions');\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 outputDetail = 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\nexport const saveEntries = new Option(\n '-save --save-entries',\n \"save the entries we're migrating instead of the migration preview (used with --output)\"\n);\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 noCache = new Option(\n '--no-cache',\n 'ignore internal cache and rebuild all resources from scratch'\n);\n\nexport const noPublish = new Option(\n '--no-publish',\n \"don't publish created or updated entries\"\n);\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 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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAEhC,kBAAoB;AAIb,MAAM,mBAAmB,CAAC,OAAY,CAAC,OAAuB;AAAA,EACnE,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,EACb,WAAW,KAAK;AAAA,EAChB,aAAa,KAAK;AAAA;AAAA,EAElB,OACE,KAAK,MACL,KAAK,YACL,KAAK,UACL,KAAK,UACL,KAAK,WACL,KAAK,SACL,KAAK,aACL,KAAK,eACL,KAAK,cACL,KAAK,eACL,KAAK,UACL,KAAK,gBACD;AAAA,IACE,YAAY,KAAK;AAAA,IACjB,gBAAgB,KAAK;AAAA,IACrB,aAAa,KAAK,aAAa,CAAC,KAAK,UAAU,IAAI;AAAA,IACnD,QAAQ,KAAK;AAAA,IACb,YAAY,KAAK,MAAM,KAAK;AAAA,IAC5B,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,YAAY,KAAK;AAAA,IACjB,aAAa,KAAK;AAAA,IAClB,eAAe,KAAK,SAAS,WAAW,KAAK;AAAA,EAC/C,IACA;AAAA,EACN,OAAO,KAAK;AAAA,EACZ,gBAAgB,CAAC,KAAK;AAAA,EACtB,cAAc,KAAK;AAAA,EACnB,SAAS,CAAC,KAAK;AAAA;AAAA,EACf,iBAAiB,KAAK;AAAA;AAAA,EACtB,aAAa,KAAK,cAAc,OAAO,KAAK,WAAW,IAAI;AAAA,EAC3D,WAAW,CAAC,KAAK;AAAA;
|
|
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 updateField: opts.updateField,\n // convert various cli options into MigrateRequest.query format\n query:\n opts.id ||\n opts.entryIds ||\n opts.search ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat ||\n opts.deliveryApi ||\n opts.latest ||\n opts.versionStatus\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.search,\n useDelivery: opts.deliveryApi,\n versionStatus: opts.latest ? 'latest' : opts.versionStatus,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n ignoreErrors: opts.ignoreErrors,\n noCache: !opts.cache, // arg is inverted automatically from `--no-cache` to `cache: false`\n includeDefaults: opts.defaults, // arg is inverted automatically from `--no-defaults` to `defaults: false`\n includeValidations: opts.validations, // arg is inverted automatically from `--no-validations` to `validations: false`\n concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,\n noPublish: !opts.publish, // arg is inverted automatically from `--no-publish` to `publish: false`\n outputLogs: opts.logLevel,\n stopLevel:\n typeof opts.stopLevel === 'number'\n ? Number(opts.stopLevel)\n : typeof opts.dependents === 'number'\n ? Number(opts.dependents)\n : 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, html, xml or default'\n).choices(['csv', 'json', 'html', '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/* Model get options */\nexport const requiredBy = new Option(\n '--required-by',\n 'shows the id(s) that created each dependency'\n);\nexport const exportOption = new Option(\n '--export',\n 'export the raw resources that make up the content model(s) (used with --output)'\n);\n\n/* Entry get options */\nexport const delivery = new Option(\n '-delivery --delivery-api',\n 'use delivery api to get the entries'\n);\nexport const search = new Option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\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);\nexport const versionStatus = new Option(\n '-vs --version-status <versionStatus>',\n 'the entry versions to get'\n)\n .choices(['latest', 'published'])\n .default('published');\n\nexport const latest = new Option('--latest', 'get the latest entry versions');\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 logLevel = new Option(\n '-ll --log-level <logLevel>',\n 'set the logging level to output more detailed logs'\n)\n .choices(['debug', 'info', 'warning', 'error', 'none'])\n .default('warning');\n\nexport const outputDetail = 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\nexport const saveEntries = new Option(\n '-save --save-entries',\n \"save the entries we're migrating instead of the migration preview (used with --output)\"\n);\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 noCache = new Option(\n '--no-cache',\n 'ignore internal cache and rebuild all resources from scratch'\n);\n\nexport const noPublish = new Option(\n '--no-publish',\n \"don't publish created or updated entries\"\n);\n\nexport const stopLevel = new Option(\n '-d --stop-level <stopLevel>',\n 'the level at which to stop resolving dependent entries (may result in incomplete entries)'\n).argParser(parseInt);\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 addGlobalOptions = (program: Command) => {\n for (const command of program.commands) {\n command.addOption(logLevel.hideHelp());\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAEhC,kBAAoB;AAIb,MAAM,mBAAmB,CAAC,OAAY,CAAC,OAAuB;AAAA,EACnE,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,EACb,WAAW,KAAK;AAAA,E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ACpC,QAAQ,QAAQ;AAEZ,MAAM,cAAc,IAAI;AAAA,EAC7B;AAAA,EACA;AACF;AAEO,MAAM,cAAc,IAAI;AAAA,EAC7B;AAAA,EACA;AACF,EAAE,QAAQ,CAAC;AAEJ,MAAM,UAAU,IAAI;AAAA,EACzB;AAAA,EACA;AACF;AAEO,MAAM,YAAY,IAAI;AAAA,EAC3B;AAAA,EACA;AACF;AAEO,MAAM,YAAY,IAAI;AAAA,EAC3B;AAAA,EACA;AACF,EAAE,UAAU,QAAQ;AAEb,MAAM,oBAAoB,CAAC,YAChC,QAAQ,UAAU,MAAM,SAAS,CAAC,EAAE,UAAU,QAAQ,SAAS,CAAC;AAE3D,MAAM,2BAA2B,CAAC,YACvC,QACG,UAAU,KAAK,SAAS,CAAC,EACzB,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,aAAa,SAAS,CAAC;AAEtC,MAAM,4BAA4B,CAAC,YACjC,QAAQ,UAAU,MAAM,EAAE,UAAU,MAAM;AAErC,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,OAAO,EAAE,UAAU,WAAW,EAAE,UAAU,QAAQ;AAAA,EACtE;AACA,SAAO;AACT;AAEO,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,SAAS,SAAS,CAAC;AACrC,8BAA0B,OAAO;AACjC,sBAAkB,OAAO;AACzB,6BAAyB,OAAO;AAAA,EAClC;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/import.js
CHANGED
|
@@ -31,10 +31,13 @@ const makeImportCommand = () => {
|
|
|
31
31
|
program.command("models").description("import complete content models").argument("[modelIds...]", "ids of the content models to import (optional)").addOption(import_globalOptions.noCache).addOption(import_globalOptions.commit).option(
|
|
32
32
|
"-nod --no-defaults",
|
|
33
33
|
"ignore any default entries or nodes attached to content types or fields"
|
|
34
|
+
).option(
|
|
35
|
+
"-nov --no-validations",
|
|
36
|
+
"import fields with validations removed"
|
|
34
37
|
).option(
|
|
35
38
|
"-preserve --preserve-guids",
|
|
36
39
|
"import any default entries or nodes using the same id as the source"
|
|
37
|
-
).addHelpText(
|
|
40
|
+
).addOption(import_globalOptions.ignoreErrors).addHelpText(
|
|
38
41
|
"after",
|
|
39
42
|
`
|
|
40
43
|
Example call:
|
|
@@ -100,7 +103,7 @@ Example call:
|
|
|
100
103
|
program.command("entries").description("import entries").argument(
|
|
101
104
|
"[search phrase]",
|
|
102
105
|
"get entries with the search phrase, use quotes for multiple words"
|
|
103
|
-
).addOption(import_globalOptions.entryId).addOption(import_globalOptions.zenql).addOption(import_globalOptions.contentTypes).addOption(import_globalOptions.assetTypes).addOption(import_globalOptions.latest).addOption(import_globalOptions.versionStatus).addOption(import_globalOptions.commit).option(
|
|
106
|
+
).addOption(import_globalOptions.entryId).addOption(import_globalOptions.zenql).addOption(import_globalOptions.contentTypes).addOption(import_globalOptions.assetTypes).addOption(import_globalOptions.latest).addOption(import_globalOptions.versionStatus).addOption(import_globalOptions.stopLevel).addOption(import_globalOptions.commit).option(
|
|
104
107
|
"-preserve --preserve-guids",
|
|
105
108
|
"include this flag when you are importing entries that you have previously exported and wish to update"
|
|
106
109
|
).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.outputDetail).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.noCache).addOption(import_globalOptions.noPublish).addOption(import_globalOptions.saveEntries).addHelpText(
|
|
@@ -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 assetTypes,\n commit,\n concurrency,\n contentTypes,\n entryId,\n ignoreErrors,\n latest,\n mapContensisOpts,\n noCache,\n noPublish,\n outputDetail,\n saveEntries,\n versionStatus,\n zenql,\n} from './globalOptions';\n\nexport const 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(noCache)\n .addOption(commit)\n .option(\n '-nod --no-defaults',\n 'ignore any default entries or nodes attached to content types or fields'\n )\n .option(\n '-preserve --preserve-guids',\n 'import any default entries or nodes using the same id as the source'\n )\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 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 .addOption(entryId)\n .addOption(zenql)\n .addOption(contentTypes)\n .addOption(assetTypes)\n .addOption(latest)\n .addOption(versionStatus)\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(outputDetail)\n .addOption(ignoreErrors)\n .addOption(noCache)\n .addOption(noPublish)\n .addOption(saveEntries)\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 (search: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ search, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\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 program\n .command('taggroups')\n .description('import taggroups')\n .argument('[query]', 'apply a filter')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tag groups we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import taggroups --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import taggroups --from-file myImportData.json --preserve-guids\n `\n )\n .action(async (query: string, opts) => {\n await cliCommand(\n ['import', 'taggroups'],\n opts,\n mapContensisOpts(opts)\n ).ImportTagGroups({\n commit: opts.commit,\n fromFile: opts.fromFile,\n getBy: {\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n q: query,\n },\n save: opts.save,\n });\n });\n\n program\n .command('tags')\n .description('import tags')\n .option('-in --group <groupId>', 'id of the tag group containing tags')\n .option('--label <label>', 'filter by tags that match this label')\n .option('-l --language <language>', 'find tags in the supplied language')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tags we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import tags --source-cms example-dev --source-project-id microsite --group example\n > import tags --from-file myImportData.json --preserve-guids\n `\n )\n .action(async
|
|
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 assetTypes,\n commit,\n concurrency,\n contentTypes,\n entryId,\n ignoreErrors,\n latest,\n mapContensisOpts,\n noCache,\n noPublish,\n outputDetail,\n saveEntries,\n stopLevel,\n versionStatus,\n zenql,\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(noCache)\n .addOption(commit)\n .option(\n '-nod --no-defaults',\n 'ignore any default entries or nodes attached to content types or fields'\n )\n .option(\n '-nov --no-validations',\n 'import fields with validations removed'\n )\n .option(\n '-preserve --preserve-guids',\n 'import any default entries or nodes using the same id as the source'\n )\n .addOption(ignoreErrors)\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 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 .addOption(entryId)\n .addOption(zenql)\n .addOption(contentTypes)\n .addOption(assetTypes)\n .addOption(latest)\n .addOption(versionStatus)\n .addOption(stopLevel)\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(outputDetail)\n .addOption(ignoreErrors)\n .addOption(noCache)\n .addOption(noPublish)\n .addOption(saveEntries)\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 (search: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ search, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\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 program\n .command('taggroups')\n .description('import taggroups')\n .argument('[query]', 'apply a filter')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tag groups we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import taggroups --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import taggroups --from-file myImportData.json --preserve-guids\n `\n )\n .action(async (query: string, opts) => {\n await cliCommand(\n ['import', 'taggroups'],\n opts,\n mapContensisOpts(opts)\n ).ImportTagGroups({\n commit: opts.commit,\n fromFile: opts.fromFile,\n getBy: {\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n q: query,\n },\n save: opts.save,\n });\n });\n\n program\n .command('tags')\n .description('import tags')\n .option('-in --group <groupId>', 'id of the tag group containing tags')\n .option('--label <label>', 'filter by tags that match this label')\n .option('-l --language <language>', 'find tags in the supplied language')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tags we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import tags --source-cms example-dev --source-project-id microsite --group example\n > import tags --from-file myImportData.json --preserve-guids\n `\n )\n .action(async opts => {\n await cliCommand(\n ['import', 'tags'],\n opts,\n mapContensisOpts(opts)\n ).ImportTags({\n commit: opts.commit,\n fromFile: opts.fromFile,\n getBy: {\n groupId: opts.group,\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n label: opts.label,\n language: opts.language,\n },\n save: opts.save,\n });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,2BAgBO;AAEA,MAAM,oBAAoB,MAAM;AACrC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,QAAQ,EAChB,YAAY,gCAAgC,EAC5C,SAAS,iBAAiB,gDAAgD,EAC1E,UAAU,4BAAO,EACjB,UAAU,2BAAM,EAChB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,iCAAY,EACtB;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,OAAO,OAAO,UAAoB,SAAS;AAC1C,cAAM;AAAA,MACJ,CAAC,UAAU,UAAU,SAAS,KAAK,GAAG,CAAC;AAAA,MACvC;AAAA,UACA,uCAAiB,EAAE,UAAU,GAAG,KAAK,CAAC;AAAA,IACxC,EAAE,oBAAoB;AAAA,MACpB,UAAU,KAAK;AAAA,MACf,QAAQ,KAAK;AAAA,IACf,CAAC;AAAA,EACH,CAAC;AAEH,UACG,QAAQ,cAAc,EACtB,YAAY,sBAAsB,EAClC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,2BAAM,EAChB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AAA,MACjB;AAAA,MACA,MAAM,KAAK;AAAA,IACb,CAAC;AAAA,EACH,CAAC;AAEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -131,7 +131,9 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
|
|
|
131
131
|
commitTip: () => `Add --commit flag to commit the previewed changes`,
|
|
132
132
|
preview: (verb = "IMPORT") => `\u{1F50D} ${verb} PREVIEW \u{1F52D}`,
|
|
133
133
|
commit: (verb = "IMPORT") => `COMMITTING ${verb} \u2728\u2604\uFE0F `,
|
|
134
|
-
imported: (env, commit, entities) => `${commit ? `Imported` : `Will import`} ${Object.entries(entities).map(
|
|
134
|
+
imported: (env, commit, entities) => `${commit ? `Imported` : `Will import`} ${Object.entries(entities).map(
|
|
135
|
+
([noun, count], i, arr) => `${i > 0 ? i === arr.length - 1 ? " and " : ", " : ""}${(0, import_pluralize.default)(noun, count, true)}`
|
|
136
|
+
).join("")} into ${env} environment`,
|
|
135
137
|
models: {
|
|
136
138
|
result: (status) => {
|
|
137
139
|
switch (status) {
|
|
@@ -202,20 +204,22 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
|
|
|
202
204
|
noEnv: () => `No Contensis environment set, connect to your Contensis cloud instance using "contensis connect {cms alias}"`
|
|
203
205
|
},
|
|
204
206
|
entries: {
|
|
205
|
-
imported: (env, commit, entries, nodes = 0) => LogMessages.migrate.imported(env, commit, {
|
|
207
|
+
imported: (env, commit, entries, nodes = 0, tags = 0) => LogMessages.migrate.imported(env, commit, {
|
|
206
208
|
entry: entries,
|
|
207
|
-
node: nodes
|
|
209
|
+
node: nodes,
|
|
210
|
+
tag: tags
|
|
208
211
|
}),
|
|
209
212
|
failedImport: (env) => `[${env}] Unable to import entries`,
|
|
210
213
|
update: {
|
|
211
214
|
preview: () => LogMessages.migrate.preview("UPDATE FIELD"),
|
|
212
|
-
commit: () => LogMessages.migrate.
|
|
215
|
+
commit: () => LogMessages.migrate.commit("FIELD UPDATES"),
|
|
213
216
|
success: (env, commit, entries, nodes = 0) => `${commit ? `Updated` : `Will update`} ${(0, import_pluralize.default)("entry", entries, true)}${nodes > 0 ? ` and ${(0, import_pluralize.default)("node", nodes, true)}` : ""} in ${env} environment`,
|
|
214
217
|
failed: (env) => `[${env}] Unable to update any entries`
|
|
215
218
|
},
|
|
216
219
|
removed: (env, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,
|
|
217
220
|
failedRemove: (env) => `[${env}] Unable to delete entries`,
|
|
218
|
-
notFound: (env) => `[${env}] Entries were not found
|
|
221
|
+
notFound: (env) => `[${env}] Entries were not found`,
|
|
222
|
+
noChange: (env) => `[${env}] No changes to be made`
|
|
219
223
|
},
|
|
220
224
|
keys: {
|
|
221
225
|
list: (env) => `[${env}] API keys:`,
|
|
@@ -331,7 +335,8 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
|
|
|
331
335
|
failedCreate: (env, name) => `[${env}] Unable to create ${name ? `tag ${import_logger.Logger.highlightText(name)}` : "tags"}`,
|
|
332
336
|
removed: (env, length, commit) => `[${env}] ${!length ? "No tags to delete" : `${commit ? `Deleted` : `Will delete`} ${(0, import_pluralize.default)("tag", length, true)}
|
|
333
337
|
`}`,
|
|
334
|
-
failedRemove: (env, length) => `[${env}] Unable to delete tags with ${(0, import_pluralize.default)("error", length)}
|
|
338
|
+
failedRemove: (env, length) => `[${env}] Unable to delete tags with ${(0, import_pluralize.default)("error", length)}`,
|
|
339
|
+
noChange: (env) => `[${env}] No changes to be made`
|
|
335
340
|
},
|
|
336
341
|
blocks: {
|
|
337
342
|
runningStatus: (status) => {
|