Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sanity-plugin-migration

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanity-plugin-migration

Empower content editors to migrate Documents and Assets between Sanity Datasets from inside Sanity Studio

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

Sanity Migration Tool & Document Action

Proof of Concept for empowering content editors to migrate Documents and Assets between Sanity Datasets from inside Sanity Studio.

🚧 Note: This plugin has gone through basic testing but may not account for all edge cases. Proceed with caution as it can instantly write changes to Datasets.

Before starting a Migration you can select which related Documents and Assets to include. Keep in mind Migrations will likely fail if every Referenced Document or Asset is not already present at the destination Dataset.

Both methods can gather References –- and do a recursive search for References of References –- so the Migration has every Document and Asset it needs to complete.

Tool

The Migration Tool allows you to migrate Documents that are returned from any GROQ query.

<< Insert GIF >>

Document Action

The Migration Document Action allows you to migrate an individual Document.

<< Insert GIF >>

Required Setup

1. Spaces

You must have Spaces configured to use this plugin. Spaces are still listed as an experimental feature but have been supported for some time.

All Datasets setup in Spaces will become selectable "destinations" for Migrations. This means you can have additional datasets in the project that cannot be Migrated to.

Once setup, you will see a dropdown menu next to the Search bar in the Studio with the Datasets you have configured in Spaces.

2. Configuration

The plugin has some configuration options. These can be set by adding a config file to your studio at ./config/migration.json.

For example:

{
  "tool": true,
  "types": ["article", "page"]
}

Options:

  • tool (boolean, default: true) – Set whether the Migration Tool is enabled.
  • types (Array[String], default: []) – Set which Schema Types the Migration Action should be enabled in.

3. Authentication Key

To Migrate Assets between Datasets an additional Authentication Token is required. You will be prompted for this the first time you attempt to use either the Tool or Document Action on any Dataset.

This plugin uses Sanity Secrets to store the token in the Dataset itself.

You can reveal the token belonging to your user account with sanity debug --secrets

Roadmap

  • Save predefined GROQ queries in the Tool to make bulk repeated Migrations simpler
  • More UI affordances eg "Only Migrate New", "Only Migrate Documents", etc.

Keywords

FAQs

Package last updated on 19 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc