contensis-cli 1.1.2-beta.9 → 1.2.1-beta.0
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/CHANGELOG.md +30 -0
- package/README.md +169 -8
- package/cli.js +16 -0
- package/dist/commands/copy.js +11 -3
- package/dist/commands/copy.js.map +2 -2
- package/dist/commands/create.js +1 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/get.js +5 -5
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/globalOptions.js +15 -2
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +2 -2
- package/dist/commands/import.js.map +1 -1
- package/dist/localisation/en-GB.js +4 -4
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/services/ContensisCliService.js +66 -51
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/docs/copy_field_templates.md +354 -0
- package/docs/copy_field_transformation_matrix.md +65 -0
- package/package.json +4 -3
- package/src/commands/copy.ts +15 -1
- package/src/commands/create.ts +1 -1
- package/src/commands/get.ts +7 -7
- package/src/commands/globalOptions.ts +13 -3
- package/src/commands/import.ts +2 -2
- package/src/localisation/en-GB.ts +4 -4
- package/src/services/ContensisCliService.ts +75 -53
- package/src/version.ts +1 -1
- package/tsconfig.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0](https://github.com/contensis/cli/compare/contensis-cli-v1.1.1...contensis-cli-v1.2.0) (2024-05-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add `save-entries` option in `copy field` to save the built entries to json file specified in `output` option ([283a6cd](https://github.com/contensis/cli/commit/283a6cd439df1d51a86a1d1e6bd9cf3edaae5f6f))
|
|
9
|
+
* add `search` option in `copy field` ([45bc264](https://github.com/contensis/cli/commit/45bc264f73c3be2fcfd9c1ed66f1b8f2f4cb20ea))
|
|
10
|
+
* added `delivery-api` option in `get entries` ([d2028bf](https://github.com/contensis/cli/commit/d2028bfeef3a8334f0c6d5c5f0a4c4c617b5e768))
|
|
11
|
+
* added `RequestHandlerFactory` to manage request handler release binary install/update before returning a request handler invocation method in `dev requests` command. Update implementation to supply args instead of writing yaml to launch request handler. ([1898a2a](https://github.com/contensis/cli/commit/1898a2a6a83dedbe17fc7725795b0fd1dac198d3))
|
|
12
|
+
* new command `copy field` ([1f27c2d](https://github.com/contensis/cli/commit/1f27c2d009072a9708272929feca4f79b72ecee0))
|
|
13
|
+
* prompt to override a running block and set a local uri with `dev requests`, ability to run a specific request handler version with `--release` option ([a39ebbd](https://github.com/contensis/cli/commit/a39ebbd0ad449d42398db38992fbbc298f552de5))
|
|
14
|
+
* templating improvements with `copy field` command, new arguments to copy just entry ids, or copy from zenql. Initial support for getting entries via delivery api ([caa4eab](https://github.com/contensis/cli/commit/caa4eab906f24a1bab280267eb32d254fd44ffe8))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* `import contenttypes` and `import components` implementation when specifiying a source-cms, fix corrupted console output on both `remove` commands ([e4b6afa](https://github.com/contensis/cli/commit/e4b6afaf2417ef61d9eee1d545e82685bc3b8747))
|
|
20
|
+
* after extensive testing copy field template variables ([186ece2](https://github.com/contensis/cli/commit/186ece2b9bd5594ead103b4aaa673390df7a9314))
|
|
21
|
+
* ensure downloaded request handler script has execute permission ([cb6b9c7](https://github.com/contensis/cli/commit/cb6b9c760e55ef72b31342129edbb575ce47f7b7))
|
|
22
|
+
* improve output logging when finding block versions using `get block` command ([6f3f003](https://github.com/contensis/cli/commit/6f3f0030f0c0fe09830d27d1b91ab9a421cf3a8e))
|
|
23
|
+
* language option in `create project` command incorrectly read as boolean and needs to be a string ([2bb5c90](https://github.com/contensis/cli/commit/2bb5c902055acff285666a081c80ba71f62b8c8e))
|
|
24
|
+
* sanitise `--fields` input ensuring they are valid api ids ([fefcb34](https://github.com/contensis/cli/commit/fefcb3415cdc1cbdf89148a88f18e26e8838d2ff))
|
|
25
|
+
* update migration package version for latest fixes ([964cdb0](https://github.com/contensis/cli/commit/964cdb0447856a6bae87a4285ffa4c7af5268fc2))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Performance Improvements
|
|
29
|
+
|
|
30
|
+
* improve response times when using `import entries` with very large workloads ([28c2535](https://github.com/contensis/cli/commit/28c2535f2fe09593c47b0d6f38c523a44a587555))
|
|
31
|
+
* request block versions concurrently before launching local request handler with `dev requests` ([18135b6](https://github.com/contensis/cli/commit/18135b635284f3714f82581cb755cb9b1a1edeec))
|
|
32
|
+
|
|
3
33
|
## [1.1.1](https://github.com/contensis/cli/compare/contensis-cli-v1.1.0...contensis-cli-v1.1.1) (2023-12-08)
|
|
4
34
|
|
|
5
35
|
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ or use your preferred installation method below
|
|
|
11
11
|
### Windows ([Chocolatey](https://chocolatey.org/install))
|
|
12
12
|
|
|
13
13
|
```shell
|
|
14
|
-
choco install contensis-cli
|
|
14
|
+
choco install contensis-cli
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
- [Choco package docs and source](https://github.com/contensis/cli/tree/main/installers/chocolatey)
|
|
@@ -242,6 +242,7 @@ contensis >
|
|
|
242
242
|
- [Get an entry with all of its dependents](#get-an-entry-with-all-of-its-dependents)
|
|
243
243
|
- [Get entries with a ZenQL statement](#get-entries-with-a-zenql-statement)
|
|
244
244
|
- [Choose entry fields to output](#choose-entry-fields-to-output)
|
|
245
|
+
- [Get entries using the Delivery API](#get-entries-using-the-delivery-api)
|
|
245
246
|
- [Output results to a file](#output-results-to-a-file)
|
|
246
247
|
- [Format output](#format-output)
|
|
247
248
|
- [Manage API keys](#manage-api-keys)
|
|
@@ -254,7 +255,7 @@ contensis >
|
|
|
254
255
|
- [Set role details](#set-role-details)
|
|
255
256
|
- [Disable role](#disable-role)
|
|
256
257
|
- [Remove role](#remove-role)
|
|
257
|
-
- [Manage
|
|
258
|
+
- [Manage blocks](#manage-blocks)
|
|
258
259
|
- [List blocks](#list-blocks)
|
|
259
260
|
- [Get block](#get-block)
|
|
260
261
|
- [Get block logs](#get-block-logs)
|
|
@@ -277,6 +278,12 @@ contensis >
|
|
|
277
278
|
- [Import from a file](#import-from-a-file-1)
|
|
278
279
|
- [Import entries further reading](#import-entries-further-reading)
|
|
279
280
|
- [Remove entries](#remove-entries)
|
|
281
|
+
- [Copy an entry field](#copy-an-entry-field)
|
|
282
|
+
- [Copy a simple entry field](#copy-a-simple-entry-field)
|
|
283
|
+
- [Limit entries when copying field content](#limit-entries-when-copying-field-content)
|
|
284
|
+
- [Copy a composer into a canvas field](#copy-a-composer-into-a-canvas-field)
|
|
285
|
+
- [Copy a field using a template](#copy-a-field-using-a-template)
|
|
286
|
+
- [Copy a field and save the entries as output](#copy-a-field-and-save-the-entries-as-output)
|
|
280
287
|
|
|
281
288
|
## Get started
|
|
282
289
|
|
|
@@ -706,7 +713,7 @@ Use a ZenQL statement to find entries with the `--zenql` or `-q` option, add you
|
|
|
706
713
|
website t.durden@example-dev> get entries --zenql "sys.contentTypeId = plant"
|
|
707
714
|
-------------------------------------
|
|
708
715
|
[24/07 01:52:37] [INFO] Fetching initial entries in project 'website'
|
|
709
|
-
Fetch [website] >> 100% 21 0.0s/0.0s
|
|
716
|
+
Fetch [website] >> 100% 21 0.0s/0.0s
|
|
710
717
|
|
|
711
718
|
Found 21 entries in [website]
|
|
712
719
|
--------------------------------------------
|
|
@@ -771,6 +778,16 @@ Found 12 entries in [website]
|
|
|
771
778
|
website t.durden@example-dev>
|
|
772
779
|
```
|
|
773
780
|
|
|
781
|
+
### Get entries using the Delivery API
|
|
782
|
+
|
|
783
|
+
By default all Contensis operations are performed using the Management API. Some data fields are only available to output when searching the Delivery API e.g. `sys.uri`
|
|
784
|
+
|
|
785
|
+
To include the `sys.uri` field with the entries returned from the above example, as well as adding the `sys.uri` field to the `--fields` list, we would also include the `--delivery-api` option in the `get entries` command.
|
|
786
|
+
|
|
787
|
+
```shell
|
|
788
|
+
website t.durden@example-dev> get entries --delivery-api --fields sys.uri productName colour material externalPromotion --zenql "sys.contentTypeId = pot"
|
|
789
|
+
```
|
|
790
|
+
|
|
774
791
|
### Output results to a file
|
|
775
792
|
|
|
776
793
|
Use the `--output` or `-o` option followed by the file name you wish for command output to be written to
|
|
@@ -784,10 +801,10 @@ website t.durden@example-dev> get entries --zenql "sys.contentTypeId = pot" --ou
|
|
|
784
801
|
website t.durden@example-dev>
|
|
785
802
|
```
|
|
786
803
|
|
|
787
|
-
Combine other options and mobilise your data to consume elsewhere
|
|
804
|
+
Combine other options and mobilise your data to consume elsewhere: this command will dump an entry and all of its dependents (at all link depths) to a json file creating a complete picture of the entry data and everything that is linked to it.
|
|
788
805
|
|
|
789
806
|
```shell
|
|
790
|
-
get entries
|
|
807
|
+
get entries --dependents --output aloe-complete-entry.json --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
|
|
791
808
|
-------------------------------------
|
|
792
809
|
[24/07 02:16:04] [INFO] Fetching initial entries in project 'website'
|
|
793
810
|
Fetch [website] >> 100% 1 0.0s/0.0s 100000p/s
|
|
@@ -1103,9 +1120,9 @@ website t.durden@example-dev> get webhook "Slack"
|
|
|
1103
1120
|
website t.durden@example-dev>
|
|
1104
1121
|
```
|
|
1105
1122
|
|
|
1106
|
-
## Manage
|
|
1123
|
+
## Manage blocks
|
|
1107
1124
|
|
|
1108
|
-
You can manage blocks for any Contensis project using the following commands
|
|
1125
|
+
You can manage deployed blocks for any Contensis project using the following commands
|
|
1109
1126
|
|
|
1110
1127
|
### List blocks
|
|
1111
1128
|
|
|
@@ -1229,7 +1246,7 @@ website t.durden@example-dev> execute block action release contensis-website 78
|
|
|
1229
1246
|
[cli] ✅ [example-dev] Action release on contensis-website in project website requested successfully
|
|
1230
1247
|
v78 contensis-website
|
|
1231
1248
|
state: available
|
|
1232
|
-
released: [23/11/2022 01:42]
|
|
1249
|
+
released: [23/11/2022 01:42] t.durden
|
|
1233
1250
|
status:
|
|
1234
1251
|
deployment: deployed
|
|
1235
1252
|
workflow: released
|
|
@@ -1697,3 +1714,147 @@ website t.durden@example-dev>
|
|
|
1697
1714
|
```
|
|
1698
1715
|
|
|
1699
1716
|
<sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
|
|
1717
|
+
|
|
1718
|
+
## Copy an entry field
|
|
1719
|
+
|
|
1720
|
+
This command allows us to copy the contents of one entry field to another, this is useful if, for example - when a field is named incorrectly, or was specified originally as one field type but we would like to curate and present this content differently in future.
|
|
1721
|
+
|
|
1722
|
+
The required inputs for using `copy field` are:
|
|
1723
|
+
|
|
1724
|
+
- `contentTypeId`: the content type containing the field to copy
|
|
1725
|
+
- `fieldId`: the field id containing the source data
|
|
1726
|
+
- `destinationId`: the target field id where the data will be copied to
|
|
1727
|
+
|
|
1728
|
+
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)
|
|
1729
|
+
|
|
1730
|
+
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.
|
|
1731
|
+
|
|
1732
|
+
### Copy a simple entry field
|
|
1733
|
+
|
|
1734
|
+
To copy the contents of one field to another use the command like this:
|
|
1735
|
+
|
|
1736
|
+
```
|
|
1737
|
+
copy field <contentTypeId> <fieldId> <destinationId>
|
|
1738
|
+
```
|
|
1739
|
+
|
|
1740
|
+
For the next example, we will copy the contents of a field called `text` into another field called `heading`, in the `contentPage` content type
|
|
1741
|
+
|
|
1742
|
+
```shell
|
|
1743
|
+
website t.durden@example-dev> copy field contentPage text heading
|
|
1744
|
+
-------------------------------------
|
|
1745
|
+
-- IMPORT PREVIEW --
|
|
1746
|
+
[07/05 16:21:40] [INFO] OK to copy contentPage[text]<string> field into contentPage[heading]<string> in website on example-dev [direct]
|
|
1747
|
+
[07/05 16:21:40] [INFO] Searching for initial entries in example-dev project 'website'
|
|
1748
|
+
[07/05 16:21:40] [INFO] Finding 2 entries in example-dev project 'website'
|
|
1749
|
+
[07/05 16:21:45] [INFO] Building 2 content entries
|
|
1750
|
+
|
|
1751
|
+
2/2 entries to migrate into [website]
|
|
1752
|
+
|
|
1753
|
+
contentTypeId status total
|
|
1754
|
+
----------------------------------------------
|
|
1755
|
+
contentPage update 2
|
|
1756
|
+
----------------------------------------------
|
|
1757
|
+
|
|
1758
|
+
id contentTypeId status updates entryTitle
|
|
1759
|
+
--------------------------------------------------------------------------------------------------------------
|
|
1760
|
+
21818721-f03e-4e8a-9982-c83212409850 contentPage update -1,+1 Content page
|
|
1761
|
+
70fa7283-cdba-462d-8cd3-a1d4b30ac2e7 contentPage update -0,+1 Test field data
|
|
1762
|
+
--------------------------------------------------------------------------------------------------------------
|
|
1763
|
+
|
|
1764
|
+
[07/05 16:21:45] [OK] Entries migration preview ready
|
|
1765
|
+
|
|
1766
|
+
[cli] ⏩ import from project website to website
|
|
1767
|
+
|
|
1768
|
+
- contentPage: 2 [existing: 100%] [needs update: 100%]
|
|
1769
|
+
- totalCount: 2
|
|
1770
|
+
|
|
1771
|
+
[cli] ✅ [example-dev] Will import 2 entries
|
|
1772
|
+
|
|
1773
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1774
|
+
|
|
1775
|
+
website t.durden@example-dev>
|
|
1776
|
+
```
|
|
1777
|
+
|
|
1778
|
+
We can request more output for our preview by adding `--output-entries changes` option and we will see a diff of the entries that have updates applied to them.
|
|
1779
|
+
|
|
1780
|
+
### Limit entries when copying field content
|
|
1781
|
+
|
|
1782
|
+
If the number of entries to copy in a content type are too large to manage, or if we are testing the `copy field` command with a subset of entries we can supply one of the following options to limit the entries that are returned when we run the `copy field` command.
|
|
1783
|
+
|
|
1784
|
+
- `--id`: copy the field contents of one entry only
|
|
1785
|
+
- `--zenql`: provides the finest level of control over the returned entries
|
|
1786
|
+
- `--search`: limits the results with a simple keyword or phrase
|
|
1787
|
+
|
|
1788
|
+
Consult the command `copy field --help` to see all of the available options
|
|
1789
|
+
|
|
1790
|
+
### Copy a composer into a canvas field
|
|
1791
|
+
|
|
1792
|
+
, in order to transform the contents of a Composer field in an entry to a canvas field type, we achieve this by rendering each item in the Composer as simple HTML representation internally before parsing this markup and converting it to canvas then adding the output to our destination entry field, working in the same way as if we were copying the contents of a rich text field type (containing markup) to a canvas field.
|
|
1793
|
+
|
|
1794
|
+
```shell
|
|
1795
|
+
contensis t.durden@example-dev> copy field contentPage composer canvas --output-entries changes
|
|
1796
|
+
-------------------------------------
|
|
1797
|
+
-- IMPORT PREVIEW --
|
|
1798
|
+
[07/05 17:02:51] [INFO] OK to copy contentPage[composer]<objectArray> field into contentPage[canvas]<objectArray> in website on example-dev [canvas]
|
|
1799
|
+
[07/05 17:02:51] [INFO] Searching for initial entries in example-dev project 'website'
|
|
1800
|
+
[07/05 17:02:53] [INFO] Finding 1 entries in example-dev project 'website'
|
|
1801
|
+
[07/05 17:02:56] [INFO] Building 1 content entries
|
|
1802
|
+
|
|
1803
|
+
1/1 entries to migrate into [website]
|
|
1804
|
+
|
|
1805
|
+
contentTypeId status total
|
|
1806
|
+
----------------------------------------------
|
|
1807
|
+
contentPage update 1
|
|
1808
|
+
----------------------------------------------
|
|
1809
|
+
|
|
1810
|
+
id contentTypeId status updates entryTitle
|
|
1811
|
+
--------------------------------------------------------------------------------------------------------------
|
|
1812
|
+
401abeba-d47d-4975-8890-db4b07ad58c4 contentPage update -1,+1 Content page
|
|
1813
|
+
--------------------------------------------------------------------------------------------------------------
|
|
1814
|
+
|
|
1815
|
+
[07/05 17:02:56] [OK] Entries migration preview ready
|
|
1816
|
+
|
|
1817
|
+
update 401abeba-d47d-4975-8890-db4b07ad58c4 contentPage Content page
|
|
1818
|
+
diff: '{'canvas':[{'id':'<->9fef6713','type':'_paragraph'}],'</-><+>c2c69573','type':'_paragraph','value':[{'id':'2edb9251','type':'_fragment','value':'This is the page content curated in a '},{'id':'fc28bf06','properties':{'decorators':['code']},'type':'_fragment','value':'markup'},{'id':'b67233b7','type':'_fragment','value':' composer item'}]},{'id':'f13ced2f','type':'_image','value':{'asset':{'sys':{'availableLanguages':['en-GB'],'id':'e7ee357f-35b1-4315-be7a-3d0cc2ff661b','isPublished':true,'language':'en-GB','metadata':{'includeInAToZ':false,'includeInMenu':false,'includeInSearch':true,'includeInSiteMap':false,'nodeId':'e7ee357f-35b1-4315-be7a-3d0cc2ff661b'},'owner':'d.mee','projectId':'contensis','properties':{'fileId':'e7ee357f-35b1-4315-be7a-3d0cc2ff661b','filename':'swiss-army-knife-blog-image1.jpeg','filePath':'/image-library/blog-images/','fileSize':48731,'height':512,'width':357},'version':{'created':'2021-09-24T10:56:10.8000819Z','createdBy':'ServicesUser','modified':'2021-09-24T10:56:10.8000819Z','modifiedBy':'ServicesUser','published':'2021-10-04T10:05:45.9434807Z','publishedBy':'ServicesUser','versionNo':'1.0'},'versionStatus':'latest','workflow':{'id':'contensisEntryBasic','state':'versionComplete'}},'title':'Swiss Army Knife - Blog image1'}}},{'id':'867aebcd','type':'_paragraph','value':'This line was curated as plain text'},{'id':'f9e378c8','properties':{'component':'iconWithText'},'type':'_component','value':{'icon':{'sys':{'id':'7d62ee24-b36a-46c3-b49f-09b32575dfbd','language':'en-GB'}},'text':'Some text curated in a component along with my icon'}}],'</+>composer':[{'type':'markup','value':'<p>This is the page content curated in a <code>markup</code> composer item</p>'},{'type':'image','value':{'altText':'An inline image in my content page','asset':{'sys':{'id':'e7ee357f-35b1-4315-be7a-3d0cc2ff661b'}}}},{'type':'text','value':'This line was curated as plain text'},{'type':'iconWithText','value':{'icon':{'sys':{'id':'7d62ee24-b36a-46c3-b49f-09b32575dfbd'}},'text':'Some text curated in a component along with my icon'}}],'heading':'This is my content heading','text':'Content page'}
|
|
1819
|
+
|
|
1820
|
+
[cli] ⏩ import from project website to website
|
|
1821
|
+
|
|
1822
|
+
- contentPage: 1 [existing: 100%] [needs update: 100%]
|
|
1823
|
+
- totalCount: 1
|
|
1824
|
+
|
|
1825
|
+
[cli] ✅ [example-dev] Will import 1 entries
|
|
1826
|
+
|
|
1827
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1828
|
+
|
|
1829
|
+
website t.durden@example-dev>
|
|
1830
|
+
```
|
|
1831
|
+
|
|
1832
|
+
### Copy a field using a template
|
|
1833
|
+
|
|
1834
|
+
For fine-grained control of what is rendered or copied into the target field we can supply a `--template` option with a string value that is a [LiquidJS](https://liquidjs.com/tutorials/intro-to-liquid.html) template with access to variables we can use to directly drive how the output is written into our target field
|
|
1835
|
+
|
|
1836
|
+
The syntax for applying a template with the `copy field` command is
|
|
1837
|
+
```shell
|
|
1838
|
+
copy field blog description kicker --template "<h2>{{ value }}</h2>"
|
|
1839
|
+
```
|
|
1840
|
+
in this example the `value` from `description` field will be wrapped in a `<h2>` tag before being added to the `kicker` field
|
|
1841
|
+
|
|
1842
|
+
The template must be surrounded in double-quotes and be entered (or pasted) in a single line for it to be parsed correctly with the intended command.
|
|
1843
|
+
|
|
1844
|
+
Adding a template containing html? Attributes can be wrapped in single quotes.
|
|
1845
|
+
|
|
1846
|
+
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)
|
|
1847
|
+
|
|
1848
|
+
Further documentation on using [templates](docs/copy_field_templates.md)
|
|
1849
|
+
|
|
1850
|
+
### Copy a field and save the entries as output
|
|
1851
|
+
|
|
1852
|
+
As we do not actually commit the output of a `copy field` command until specified we can also save the entries preview containing the new field data.
|
|
1853
|
+
|
|
1854
|
+
With the saved output we can examine the raw output of each entry containing the copied field data before we choose to load it, or we can repurpose the saved entries output for further processing.
|
|
1855
|
+
|
|
1856
|
+
Add the `--save-entries` option to the `copy field` command, remember to also include the `--output copy-entries.json` option, specifying the file where the output will be saved.
|
|
1857
|
+
|
|
1858
|
+
```shell
|
|
1859
|
+
copy field contentPage composer canvas --save-entries --output canvas-entries.json
|
|
1860
|
+
```
|
package/cli.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// console.log(process.argv);
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Activate additional console output
|
|
6
|
+
*/
|
|
4
7
|
// process.env.debug = 'true';
|
|
5
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Polyfills to load before the CLI
|
|
11
|
+
*/
|
|
12
|
+
if (!globalThis.crypto) {
|
|
13
|
+
// Versions of Node < 20 do not have crypto attached to global by default
|
|
14
|
+
// and this is required by @contensis/html-canvas package
|
|
15
|
+
const crypto = require('node:crypto');
|
|
16
|
+
globalThis.crypto = crypto.webcrypto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Run cli command or launch shell
|
|
21
|
+
*/
|
|
6
22
|
if (process.argv.length > 2)
|
|
7
23
|
// run cli if args provided
|
|
8
24
|
require('./dist');
|
package/dist/commands/copy.js
CHANGED
|
@@ -33,7 +33,13 @@ const makeCopyCommand = () => {
|
|
|
33
33
|
).argument("<fieldId>", "the id of the field to copy from").argument("<destinationId>", "the id of the field to copy to").option(
|
|
34
34
|
"-t --template <template>",
|
|
35
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).
|
|
36
|
+
).addOption(import_globalOptions.commit).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.outputEntries).option(
|
|
37
|
+
"--search <phrase>",
|
|
38
|
+
"get entries with the search phrase, use quotes for multiple words"
|
|
39
|
+
).addOption(import_globalOptions.entryId).addOption(import_globalOptions.zenql).option(
|
|
40
|
+
"-s --save-entries",
|
|
41
|
+
"save the entries we're migrating instead of the migration preview when using --output option"
|
|
42
|
+
).usage("<contentTypeId> <fieldId> <destinationId> (all arguments required)").addHelpText(
|
|
37
43
|
"after",
|
|
38
44
|
`
|
|
39
45
|
Example call:
|
|
@@ -43,6 +49,7 @@ Example call:
|
|
|
43
49
|
`
|
|
44
50
|
).action(
|
|
45
51
|
async (contentTypeId, fieldId, destinationId, opts) => {
|
|
52
|
+
const { template, ...restOpts } = opts;
|
|
46
53
|
const copyField = {
|
|
47
54
|
contentTypeId,
|
|
48
55
|
fieldId,
|
|
@@ -52,11 +59,12 @@ Example call:
|
|
|
52
59
|
return await (0, import_ContensisCliService.cliCommand)(
|
|
53
60
|
["copy", "project", contentTypeId, fieldId, destinationId],
|
|
54
61
|
opts,
|
|
55
|
-
(0, import_globalOptions.mapContensisOpts)({ copyField })
|
|
62
|
+
(0, import_globalOptions.mapContensisOpts)({ copyField, ...restOpts })
|
|
56
63
|
).CopyEntryField({
|
|
57
64
|
commit: opts.commit,
|
|
58
65
|
fromFile: opts.fromFile,
|
|
59
|
-
logOutput: opts.outputEntries
|
|
66
|
+
logOutput: opts.outputEntries,
|
|
67
|
+
saveEntries: opts.saveEntries
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
70
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 ignoreErrors,\n mapContensisOpts,\n outputEntries,\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 .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 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 })\n ).CopyEntryField({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n });\n }\n );\n\n return copy;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { CopyField } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\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 .option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(entryId)\n .addOption(zenql)\n .option(\n '-s --save-entries',\n \"save the entries we're migrating instead of the migration preview when using --output option\"\n )\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 saveEntries: opts.saveEntries,\n });\n }\n );\n\n return copy;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,2BAQO;AAEA,MAAM,kBAAkB,MAAM;AACnC,QAAM,OAAO,IAAI,yBAAQ,EACtB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,OACG,QAAQ,OAAO,EACf,YAAY,wDAAwD,EACpE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,SAAS,aAAa,kCAAkC,EACxD,SAAS,mBAAmB,gCAAgC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,2BAAM,EAChB,UAAU,gCAAW,EACrB,UAAU,iCAAY,EACtB,UAAU,kCAAa,EACvB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,4BAAO,EACjB,UAAU,0BAAK,EACf;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,MAAM,oEAAoE,EAC1E;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC;AAAA,IACC,OACE,eACA,SACA,eACA,SACG;AACH,YAAM,EAAE,aAAa,SAAS,IAAI;AAClC,YAAM,YAAuB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,MACjB;AAEA,aAAO,UAAM;AAAA,QACX,CAAC,QAAQ,WAAW,eAAe,SAAS,aAAa;AAAA,QACzD;AAAA,YACA,uCAAiB,EAAE,WAAW,GAAG,SAAS,CAAC;AAAA,MAC7C,EAAE,eAAe;AAAA,QACf,QAAQ,KAAK;AAAA,QACb,UAAU,KAAK;AAAA,QACf,WAAW,KAAK;AAAA,QAChB,aAAa,KAAK;AAAA,MACpB,CAAC;AAAA,IACH;AAAA,EACF;AAEF,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/create.js
CHANGED
|
@@ -28,7 +28,7 @@ const makeCreateCommand = () => {
|
|
|
28
28
|
const create = new import_commander.Command().command("create").description("create command").addHelpText("after", `
|
|
29
29
|
`).showHelpAfterError(true).exitOverride();
|
|
30
30
|
create.command("project").description("create a new project").argument("<projectId>", "the id of the project to create").argument("<name>", "the name of the project to create").argument("[description]", "optional description of the project").option(
|
|
31
|
-
"-l --language",
|
|
31
|
+
"-l --language <language>",
|
|
32
32
|
"the default language of the project to create",
|
|
33
33
|
"en-GB"
|
|
34
34
|
).option(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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';\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"],
|
|
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 <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};\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ACF;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/get.js
CHANGED
|
@@ -138,7 +138,7 @@ Example call:
|
|
|
138
138
|
"-ob --order-by <orderBy...>",
|
|
139
139
|
'field name(s) to order the results by (prefix "-" for descending)'
|
|
140
140
|
)
|
|
141
|
-
);
|
|
141
|
+
).addOption(import_globalOptions.delivery);
|
|
142
142
|
sharedGetEntryOptions(
|
|
143
143
|
program.command("assets").description("get asset entries").argument(
|
|
144
144
|
"[search phrase]",
|
|
@@ -150,11 +150,11 @@ Example call:
|
|
|
150
150
|
Example call:
|
|
151
151
|
> get assets --zenql "sys.contentTypeId = blog" --fields sys.id sys.properties.filePath sys.properties.filename
|
|
152
152
|
`
|
|
153
|
-
).action(async (
|
|
153
|
+
).action(async (search, opts) => {
|
|
154
154
|
await (0, import_ContensisCliService.cliCommand)(
|
|
155
155
|
["get", "assets"],
|
|
156
156
|
opts,
|
|
157
|
-
(0, import_globalOptions.mapContensisOpts)({ dataFormat: "asset",
|
|
157
|
+
(0, import_globalOptions.mapContensisOpts)({ dataFormat: "asset", search, ...opts })
|
|
158
158
|
).GetEntries({});
|
|
159
159
|
});
|
|
160
160
|
sharedGetEntryOptions(
|
|
@@ -177,11 +177,11 @@ Example call:
|
|
|
177
177
|
> get entries --zenql "sys.contentTypeId = blog" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv
|
|
178
178
|
> get entries --content-type blog --fields entryTitle sys.version.modified --order-by -sys.version.modified
|
|
179
179
|
`
|
|
180
|
-
).action(async (
|
|
180
|
+
).action(async (search, opts, cmd) => {
|
|
181
181
|
await (0, import_ContensisCliService.cliCommand)(
|
|
182
182
|
["get", "entries"],
|
|
183
183
|
opts,
|
|
184
|
-
(0, import_globalOptions.mapContensisOpts)({
|
|
184
|
+
(0, import_globalOptions.mapContensisOpts)({ search, ...opts })
|
|
185
185
|
).GetEntries({
|
|
186
186
|
withDependents: opts.dependents
|
|
187
187
|
});
|
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 (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C;AAC1C,oBAAsB;AACtB,iCAA2B;AAC3B,
|
|
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 delivery,\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 .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,iCAA2B;AAC3B,2BAQO;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,YA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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
|
}
|
|
@@ -26,6 +26,7 @@ __export(globalOptions_exports, {
|
|
|
26
26
|
commit: () => commit,
|
|
27
27
|
concurrency: () => concurrency,
|
|
28
28
|
contentTypes: () => contentTypes,
|
|
29
|
+
delivery: () => delivery,
|
|
29
30
|
entryId: () => entryId,
|
|
30
31
|
fromCms: () => fromCms,
|
|
31
32
|
fromFile: () => fromFile,
|
|
@@ -35,6 +36,7 @@ __export(globalOptions_exports, {
|
|
|
35
36
|
mapContensisOpts: () => mapContensisOpts,
|
|
36
37
|
outputEntries: () => outputEntries,
|
|
37
38
|
project: () => project,
|
|
39
|
+
search: () => search,
|
|
38
40
|
zenql: () => zenql
|
|
39
41
|
});
|
|
40
42
|
module.exports = __toCommonJS(globalOptions_exports);
|
|
@@ -47,7 +49,7 @@ const mapContensisOpts = (opts = {}) => ({
|
|
|
47
49
|
} : void 0,
|
|
48
50
|
models: opts.modelIds,
|
|
49
51
|
copyField: opts.copyField,
|
|
50
|
-
query: opts.id || opts.entryIds || opts.
|
|
52
|
+
query: opts.id || opts.entryIds || opts.search || opts.fields || opts.orderBy || opts.paths || opts.assetType || opts.contentType || opts.dataFormat || opts.deliveryApi ? {
|
|
51
53
|
assetTypes: opts.assetType,
|
|
52
54
|
contentTypeIds: opts.contentType,
|
|
53
55
|
dataFormats: opts.dataFormat ? [opts.dataFormat] : void 0,
|
|
@@ -55,7 +57,8 @@ const mapContensisOpts = (opts = {}) => ({
|
|
|
55
57
|
includeIds: opts.id || opts.entryIds,
|
|
56
58
|
includePaths: opts.paths,
|
|
57
59
|
orderBy: opts.orderBy,
|
|
58
|
-
searchTerm: opts.
|
|
60
|
+
searchTerm: opts.search,
|
|
61
|
+
useDelivery: opts.deliveryApi
|
|
59
62
|
} : void 0,
|
|
60
63
|
zenQL: opts.zenql,
|
|
61
64
|
transformGuids: !opts.preserveGuids,
|
|
@@ -94,6 +97,14 @@ const sharedSecret = new import_commander.Option(
|
|
|
94
97
|
"-s --shared-secret <sharedSecret>",
|
|
95
98
|
"the shared secret to use when logging in with a client id"
|
|
96
99
|
);
|
|
100
|
+
const delivery = new import_commander.Option(
|
|
101
|
+
"-delivery --delivery-api",
|
|
102
|
+
"use delivery api to get the entries"
|
|
103
|
+
);
|
|
104
|
+
const search = new import_commander.Option(
|
|
105
|
+
"--search <phrase>",
|
|
106
|
+
"get entries with the search phrase, use quotes for multiple words"
|
|
107
|
+
);
|
|
97
108
|
const zenql = new import_commander.Option(
|
|
98
109
|
"-q --zenql <zenql>",
|
|
99
110
|
"get entries with a supplied ZenQL statement"
|
|
@@ -163,6 +174,7 @@ const addGlobalOptions = (program) => {
|
|
|
163
174
|
commit,
|
|
164
175
|
concurrency,
|
|
165
176
|
contentTypes,
|
|
177
|
+
delivery,
|
|
166
178
|
entryId,
|
|
167
179
|
fromCms,
|
|
168
180
|
fromFile,
|
|
@@ -172,6 +184,7 @@ const addGlobalOptions = (program) => {
|
|
|
172
184
|
mapContensisOpts,
|
|
173
185
|
outputEntries,
|
|
174
186
|
project,
|
|
187
|
+
search,
|
|
175
188
|
zenql
|
|
176
189
|
});
|
|
177
190
|
//# sourceMappingURL=globalOptions.js.map
|