@sanity/cross-dataset-duplicator 1.4.0 → 1.4.2

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.
@@ -2,11 +2,14 @@ import {useCallback} from 'react'
2
2
  import {useClient} from 'sanity'
3
3
  import {Button, Flex} from '@sanity/ui'
4
4
 
5
- import {clientConfig} from '../helpers/clientConfig'
6
5
  import {SECRET_NAMESPACE} from '../helpers/constants'
7
6
 
8
- export default function ResetSecret() {
9
- const client = useClient(clientConfig)
7
+ type ResetSecretProps = {
8
+ apiVersion: string
9
+ }
10
+
11
+ export default function ResetSecret({apiVersion}: ResetSecretProps) {
12
+ const client = useClient({apiVersion})
10
13
 
11
14
  const handleClick = useCallback(() => {
12
15
  client.delete({query: `*[_id == "secrets.${SECRET_NAMESPACE}"]`})
@@ -7,7 +7,7 @@ import {PluginConfig} from '../types'
7
7
 
8
8
  const CrossDatasetDuplicatorContext = createContext(DEFAULT_CONFIG)
9
9
 
10
- type ConfigProviderProps = LayoutProps & {pluginConfig: PluginConfig}
10
+ type ConfigProviderProps = LayoutProps & {pluginConfig: Required<PluginConfig>}
11
11
 
12
12
  /**
13
13
  * Plugin config context hook from the Cross Dataset Duplicator plugin
@@ -2,7 +2,8 @@ import {PluginConfig} from '../types'
2
2
 
3
3
  export const SECRET_NAMESPACE = `CrossDatasetDuplicator`
4
4
 
5
- export const DEFAULT_CONFIG: PluginConfig = {
5
+ export const DEFAULT_CONFIG: Required<PluginConfig> = {
6
+ apiVersion: '2025-02-19',
6
7
  tool: true,
7
8
  types: [],
8
9
  filter: '',
package/src/plugin.tsx CHANGED
@@ -10,7 +10,7 @@ import {PluginConfig} from './types'
10
10
  * Plugin: Cross Dataset Duplicator
11
11
  * @public
12
12
  */
13
- export const crossDatasetDuplicator = definePlugin<PluginConfig | void>((config = {}) => {
13
+ export const crossDatasetDuplicator = definePlugin<Partial<PluginConfig> | void>((config = {}) => {
14
14
  const pluginConfig = {...DEFAULT_CONFIG, ...config}
15
15
  const {types} = pluginConfig
16
16
 
@@ -9,6 +9,7 @@ type PreDefinedQuery = {
9
9
  * @public
10
10
  */
11
11
  export interface PluginConfig {
12
+ apiVersion?: string
12
13
  tool?: boolean
13
14
  types?: string[]
14
15
  filter?: string
@@ -1 +0,0 @@
1
- export const clientConfig = {apiVersion: `2021-05-19`}