
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@dotdev/cross-dataset-duplicator
Advanced tools
Empower content editors to migrate Documents and Assets between Sanity Projects and Datasets from inside Sanity Studio
This package is a fork allowing to duplicate document across dataset using a field rather than the document ID. See "2.2 Fork extra configuration"
Sanity Studio Tool and Document Action for empowering content editors to migrate Documents and Assets between Sanity Datasets and Projects from inside the Studio.
From the root directory of your studio
sanity install @dotdev/cross-dataset-duplicator
This plugin is designed as a convenience for Authors to make small, infrequent content migrations between Datasets.
The Duplicate Tool allows you to migrate Documents that are returned from any GROQ query.
The Duplicate to... Document Action allows you to migrate an individual Document.
Note: If your Studio registered its own Document Actions, the plugin config will be overruled. See "Importing the Document Action" below.
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.
Once setup, you will see a dropdown menu next to the Search bar in the Studio with the Datasets you have configured in Spaces.
The plugin has some configuration options. These can be set by adding a config file to your Studio
// ./config/@sanity/cross-dataset-duplicator.json
{
"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.With our update, developers can now additionally customize the fetchBy settings to copy content across datasets based on any field they wish to use as a reference, instead of only the id.
Example to duplicate products and collections by handle:
{
"tool": true,
"fetchBy": {
"product": {
"fetchBy": "shopify.handle",
"ignore": ["shopify", "title", "_type"]
},
"collection": {
"fetchBy": "shopify.handle",
"ignore": ["shopify", "title", "_type"]
}
}
}
The ignore option allow the plugin to prevent the override of specific fields. For instance, when you migrate the content from a dataset to another you don't wan't override the shopify fields.
To Duplicate the original files of Assets, an API Token with Viewer permissions 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 create API tokens in manage
If you want to duplicate data across different projects, you need to enable CORS for the different hosts. This allows different projects to connect to each other through the project API. CORS origins configuration can be found in your project page, under the API tab.
In your Studio's sanity.json
file, look for the document-actions/resolver
part, it will look like this:
{
"implements": "part:@sanity/base/document-actions/resolver",
"path": "./src/document-actions"
}
Now update your Studio's Document Actions resolver to be something like this
import defaultResolve from 'part:@sanity/base/document-actions'
import {DuplicateToAction} from '@sanity/cross-dataset-duplicator'
import config from 'config:@sanity/cross-dataset-duplicator'
export default function resolveDocumentActions(props) {
const defaultActions = defaultResolve(props)
// This will look through the "types" array in your migration.json config file
// If the type of this document is found in that array, the Migrate Action will show
if (config?.types?.length && config.types.includes(props.type)) {
return [...defaultActions, DuplicateToAction]
}
// ...all your other document action code
return defaultActions
}
FAQs
Empower content editors to migrate Documents and Assets between Sanity Projects and Datasets from inside Sanity Studio
We found that @dotdev/cross-dataset-duplicator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.