@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.
- package/LICENSE +1 -1
- package/README.md +4 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.esm.js +93 -36
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +93 -36
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/components/CrossDatasetDuplicator.tsx +1 -1
- package/src/components/Duplicator.tsx +6 -6
- package/src/components/DuplicatorQuery.tsx +3 -10
- package/src/components/DuplicatorWrapper.tsx +2 -3
- package/src/components/ResetSecret.tsx +6 -3
- package/src/context/ConfigProvider.tsx +1 -1
- package/src/helpers/constants.ts +2 -1
- package/src/plugin.tsx +1 -1
- package/src/types/index.ts +1 -0
- package/src/helpers/clientConfig.ts +0 -1
|
@@ -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
|
-
|
|
9
|
-
|
|
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
|
package/src/helpers/constants.ts
CHANGED
|
@@ -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
|
|
package/src/types/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const clientConfig = {apiVersion: `2021-05-19`}
|