Skip to content

feat(event): add event import/export commands and clone step#114

Merged
rs-amp merged 22 commits into
amplience:masterfrom
rs-amp:feature/events
May 16, 2022
Merged

feat(event): add event import/export commands and clone step#114
rs-amp merged 22 commits into
amplience:masterfrom
rs-amp:feature/events

Conversation

@rs-amp
Copy link
Copy Markdown
Contributor

@rs-amp rs-amp commented Oct 18, 2021

Depends on #111

This PR adds commands to import and export events, as well as a clone step for the clone. It also depends on the facet changes, as it depends on one of the methods to select date ranges for events.

The export command exports events with their editions and edition slots baked into the same json file to make them as portable as possible. Events contain an editions array, and editions contain a slots array. You can provide --fromDate and --toDate to limit the scope of the events you wish to export.

You also have the option to export snapshots with your events, by using the --snapshots argument. This will place snapshot json files in a snapshots/ subfolder in your export directory, with the snapshot id as the filename. You can cross reference these from the IDs in event content.

Importing is straightforward. Point the import <dir> command to a directory with events in the same format as the export. (events, editions, slots combined)

Importing snapshots is not supported, as the content items would have to be rapidly updated and reverted to create the snapshots, with a potentially very high number of child content items. Imported edition slots will instead generate snapshots on creation, from the existing state of the content in the hub. This might be revisited in future if a method is added to generate snapshots with more control (custom content? upload snapshot without validation?).

Events, Editions and Edition Slots are now present on the mapping file. These are used to allow updating events by re-importing them.

To import an event, your mapping file needs to have mappings for the content items contained within it. However, if you want to import events using content items that do not exist in the mapping file, but the ids in your imported json point to real content in your destination, you can use --originalIds to use original content IDs instead of mapped ones when importing events. This is useful for creating your own events to import with content that was not created by the CLI.

@rs-amp rs-amp marked this pull request as draft January 12, 2022 12:56
Copy link
Copy Markdown
Member

@easen-amp easen-amp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment we support all the commands in dc-cli, e.g. if one of them commands broke something in DC, we’re on the hook for it.

A “Use at your own risk / --experimental flag” doesn’t fit with this model.

@rs-amp rs-amp force-pushed the feature/events branch from 4ba3a45 to d686b88 Compare May 6, 2022 15:38
@rs-amp rs-amp marked this pull request as ready for review May 16, 2022 15:25
@rs-amp rs-amp merged commit 85a8889 into amplience:master May 16, 2022
Pureball pushed a commit to cosnova/dc-cli that referenced this pull request Aug 22, 2023
…ce#114)

This PR adds commands to import and export events, as well as a clone step for the clone. It also depends on the facet changes, as it depends on one of the methods to select date ranges for events.

The export command exports events with their editions and edition slots baked into the same json file to make them as portable as possible. Events contain an editions array, and editions contain a slots array. You can provide --fromDate and --toDate to limit the scope of the events you wish to export.

You also have the option to export snapshots with your events, by using the --snapshots argument. This will place snapshot json files in a snapshots/ subfolder in your export directory, with the snapshot id as the filename. You can cross reference these from the IDs in event content.

Importing is straightforward. Point the import <dir> command to a directory with events in the same format as the export. (events, editions, slots combined) Using the import command requires the --acceptSnapshotLimits argument.

Importing snapshots is not supported, as the content items would have to be rapidly updated and reverted to create the snapshots, with a potentially very high number of child content items. Imported edition slots will instead generate snapshots on creation, from the existing state of the content in the hub. This might be revisited in future if a method is added to generate snapshots with more control (custom content? upload snapshot without validation?).

Events, Editions and Edition Slots are now present on the mapping file. These are used to allow updating events by re-importing them.

To import an event, your mapping file needs to have mappings for the content items contained within it. However, if you want to import events using content items that do not exist in the mapping file, but the ids in your imported json point to real content in your destination, you can use --originalIds to use original content IDs instead of mapped ones when importing events. This is useful for creating your own events to import with content that was not created by the CLI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants