@sanity/cross-dataset-duplicator
2.1.62.1.7
~
Modified (6 files)
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -333,26 +333,22 @@
return missingIds;
}
async function commitOneByOne(docs, client, setMessage, onSuccess) {
let successCount = 0, failCount = 0;
- if (await mapWithConcurrency(docs, 1, async (doc) => {
+ await mapWithConcurrency(docs, 1, async (doc) => {
try {
let tx = client.transaction();
tx.createOrReplace(doc), await tx.commit(), successCount += 1;
} catch (commitErr) {
failCount += 1, console.error(`Failed to duplicate document "${doc._id}"`, commitErr);
}
- }), failCount === 0) {
- setMessage({
- tone: "positive",
- text: "Duplication complete!"
- }), onSuccess();
- return;
- }
- setMessage({
+ }), failCount === 0 ? (setMessage({
+ tone: "positive",
+ text: "Duplication complete!"
+ }), onSuccess()) : (setMessage({
tone: "critical",
text: `Duplication finished with ${failCount} error(s). ${successCount} document(s) duplicated successfully.`
- }), successCount > 0 && onSuccess();
+ }), successCount > 0 && onSuccess());
}
function assetDownloadInit(url, token, typeIsFile) {
if (typeIsFile) return {};
try { Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
{
"name": "@sanity/cross-dataset-duplicator",
- "version": "2.1.6",
+ "version": "2.1.7",
"description": "Empower content editors to migrate Documents and Assets between Sanity Projects and Datasets from inside Sanity Studio",
"keywords": [
"sanity",
"sanity-plugin"
@@ -28,25 +28,25 @@
},
"dependencies": {
"@sanity/asset-utils": "^2.3.0",
"@sanity/icons": "^5.2.3",
- "@sanity/mutator": "^6.16.0",
- "@sanity/studio-secrets": "^4.0.21",
- "@sanity/ui": "^4.4.0",
+ "@sanity/mutator": "^6.18.0",
+ "@sanity/studio-secrets": "^4.0.22",
+ "@sanity/ui": "^4.4.4",
"dset": "^3.1.4"
},
"devDependencies": {
"@sanity/client": "^8.9.0",
"@sanity/tsconfig": "^2.2.1",
- "@sanity/tsdown-config": "^0.27.1",
+ "@sanity/tsdown-config": "^0.28.8",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"oxc-transform-react": "^0.153.0",
"react": "^19.3.0",
"react-dom": "^19.3.0",
- "sanity": "^6.16.0",
+ "sanity": "^6.18.0",
"styled-components": "^6.5.3",
- "tsdown": "^0.22.14"
+ "tsdown": "^0.23.1"
},
"peerDependencies": {
"react": "^19.2",
"react-dom": "^19.2", Index: package/dist/index.d.ts.map
===================================================================
--- package/dist/index.d.ts.map
+++ package/dist/index.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/index.ts","../src/plugin.tsx","../src/actions/DuplicateToAction.tsx","../src/context/ConfigProvider.tsx","../src/components/CrossDatasetDuplicatorAction.tsx"],"mappings":";;KAEK;EACH;EACA;;;;;;;KAQU;EACV;EACA;;;;;;KAOU;EACV;EACA,SAAS;;;;;;UAOM;EACf;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,mBAAmB;;;;;;KAOT;EACV,MAAM;EACN,qBAAqB;;;;;;cClCV,yCAAsB,cAAA,QAAA;iBCFD,kBAAA,OAAO;;;;;;;;;;;;;;;;;;;;iBCIzB,mCAA+B,SAAA;;;;;iBCP/B,6BAA6B,OAAO,oDAAiC,IAAA"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/index.ts","../src/plugin.tsx","../src/actions/DuplicateToAction.tsx","../src/context/ConfigProvider.tsx","../src/components/CrossDatasetDuplicatorAction.tsx"],"mappings":";;KAEK;EACH;EACA;;;;;;;YAQU;EACV;EACA;;;;;;YAOU;EACV;EACA,SAAS;;;;;;iBAOM;EACf;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,mBAAmB;;;;;;YAOT;EACV,MAAM;EACN,qBAAqB;;;;;;qBClCV,yCAAsB,cAAA,QAAA;wBCFD,kBAAA,OAAO;;;;;;;;;;;;;;;;;;;;wBCIzB,mCAA+B,SAAA;;;;;wBCP/B,6BAA6B,OAAO,oDAAiC,IAAA"}
\ No newline at end of file File too large for inline diff
Index: package/README.md
===================================================================
--- package/README.md
+++ package/README.md
@@ -55,10 +55,10 @@
```ts
// ./sanity.config.ts
-import {defineConfig} from 'sanity'
import {crossDatasetDuplicator} from '@sanity/cross-dataset-duplicator'
+import {defineConfig} from 'sanity'
export default defineConfig({
// all other settings...
plugins: [ Index: package/dist/index.d.ts
===================================================================
--- package/dist/index.d.ts
+++ package/dist/index.d.ts
@@ -8,25 +8,25 @@
* A single allowed migration target.
* If `projectId` is omitted, the target is only allowed within the source project.
* @public
*/
-type MigrationTarget = {
+export type MigrationTarget = {
projectId?: string;
dataset: string;
};
/**
* Restricts which Datasets (and Projects) a given source Dataset may migrate to.
* @public
*/
-type MigrationFilter = {
+export type MigrationFilter = {
sourceDataset: string;
targets: MigrationTarget[];
};
/**
* Plugin configuration
* @public
*/
-interface PluginConfig {
+export interface PluginConfig {
apiVersion?: string;
tool?: boolean;
types?: string[];
filter?: string;
@@ -37,18 +37,18 @@
/**
* Cross Dataset Duplicator document action props
* @public
*/
-type CrossDatasetDuplicatorActionProps = {
+export type CrossDatasetDuplicatorActionProps = {
docs: SanityDocument[];
onDuplicated?: () => Promise<void>;
};
/**
* Plugin: Cross Dataset Duplicator
* @public
*/
-declare const crossDatasetDuplicator: import("sanity").Plugin<void | Partial<PluginConfig>>;
-declare function DuplicateToAction(props: DocumentActionProps): {
+export declare const crossDatasetDuplicator: import("sanity").Plugin<void | Partial<PluginConfig>>;
+export declare function DuplicateToAction(props: DocumentActionProps): {
disabled: boolean;
title: string | null;
label: string;
dialog: false | {
@@ -59,19 +59,19 @@
} | null;
onHandle: () => void;
icon: import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
};
-declare namespace DuplicateToAction {
+export declare namespace DuplicateToAction {
var action: string;
}
/**
* Plugin config context hook from the Cross Dataset Duplicator plugin
* @public
*/
-declare function useCrossDatasetDuplicatorConfig(): Required<PluginConfig>;
+export declare function useCrossDatasetDuplicatorConfig(): Required<PluginConfig>;
/**
* Component to perform a migration from the Cross Dataset Duplicator plugin
* @public
*/
-declare function CrossDatasetDuplicatorAction(props: CrossDatasetDuplicatorActionProps): import("react").JSX.Element;
-export { CrossDatasetDuplicatorAction, CrossDatasetDuplicatorActionProps, DuplicateToAction, MigrationFilter, MigrationTarget, PluginConfig, crossDatasetDuplicator, useCrossDatasetDuplicatorConfig };
+export declare function CrossDatasetDuplicatorAction(props: CrossDatasetDuplicatorActionProps): import("react").JSX.Element;
+export {};
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file