next-sanity 8.4.2 → 8.4.4

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.
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+
3
+ import {ImageLoaderProps} from 'next/image'
4
+ import {ImageProps as ImageProps_2} from 'next/image'
5
+
6
+ /**
7
+ * @alpha
8
+ */
9
+ declare function Image_2(props: ImageProps): JSX.Element
10
+ export {Image_2 as Image}
11
+
12
+ /**
13
+ * @alpha
14
+ */
15
+ export declare const imageLoader: ({src, width, quality}: ImageLoaderProps) => string
16
+
17
+ /**
18
+ * @alpha
19
+ */
20
+ export declare interface ImageProps extends Omit<ImageProps_2, 'loader' | 'src'> {
21
+ /**
22
+ * The `loader` prop is not supported on `Image` components. Use `next/image` directly to use a custom loader.
23
+ */
24
+ loader?: never
25
+ /**
26
+ * Must be a string that is a valid URL to an image on the Sanity Image CDN.
27
+ */
28
+ src: string
29
+ }
30
+
31
+ export {}
@@ -0,0 +1,44 @@
1
+ /// <reference types="react" />
2
+
3
+ import {createClient} from '@sanity/client'
4
+ import {CreateDataAttribute} from '@sanity/visual-editing/create-data-attribute'
5
+ import {createDataAttribute} from '@sanity/visual-editing/create-data-attribute'
6
+ import {CreateDataAttributeProps} from '@sanity/visual-editing/create-data-attribute'
7
+ import {default as groq} from 'groq'
8
+ import {unstable__adapter} from '@sanity/client'
9
+ import {unstable__environment} from '@sanity/client'
10
+ import {VisualEditingOptions} from '@sanity/visual-editing'
11
+
12
+ export {createClient}
13
+
14
+ export {CreateDataAttribute}
15
+
16
+ export {createDataAttribute}
17
+
18
+ export {CreateDataAttributeProps}
19
+
20
+ export {groq}
21
+
22
+ export {unstable__adapter}
23
+
24
+ export {unstable__environment}
25
+
26
+ /**
27
+ * @public
28
+ */
29
+ export declare function VisualEditing(props: VisualEditingProps): React.ReactElement
30
+
31
+ /**
32
+ * @public
33
+ */
34
+ export declare interface VisualEditingProps extends Omit<VisualEditingOptions, 'history'> {
35
+ /**
36
+ * @deprecated The histoy adapter is already implemented
37
+ */
38
+ history?: never
39
+ }
40
+
41
+ export * from '@portabletext/react'
42
+ export * from '@sanity/client'
43
+
44
+ export {}
@@ -0,0 +1,41 @@
1
+ import {CacheOptions} from '@sanity/preview-kit'
2
+ import {default as default_2} from '@sanity/preview-kit'
3
+ import {DefineListenerContext} from '@sanity/preview-kit'
4
+ import {isEqualFn} from '@sanity/preview-kit'
5
+ import {ListenerGetSnapshot} from '@sanity/preview-kit'
6
+ import {ListenerSubscribe} from '@sanity/preview-kit'
7
+ import {LiveQueryHookOptions} from '@sanity/preview-kit'
8
+ import {LiveQueryProvider} from '@sanity/preview-kit'
9
+ import {LiveQueryProviderProps} from '@sanity/preview-kit'
10
+ import {Logger} from '@sanity/preview-kit'
11
+ import {QueryEnabled} from '@sanity/preview-kit'
12
+ import {QueryLoading} from '@sanity/preview-kit'
13
+ import {useLiveQuery} from '@sanity/preview-kit'
14
+
15
+ export {CacheOptions}
16
+
17
+ export default default_2
18
+
19
+ export {DefineListenerContext}
20
+
21
+ export {isEqualFn}
22
+
23
+ export {ListenerGetSnapshot}
24
+
25
+ export {ListenerSubscribe}
26
+
27
+ export {LiveQueryHookOptions}
28
+
29
+ export {LiveQueryProvider}
30
+
31
+ export {LiveQueryProviderProps}
32
+
33
+ export {Logger}
34
+
35
+ export {QueryEnabled}
36
+
37
+ export {QueryLoading}
38
+
39
+ export {useLiveQuery}
40
+
41
+ export {}
@@ -0,0 +1,12 @@
1
+ import {LiveQuery} from '@sanity/preview-kit/live-query'
2
+ import {LiveQueryClientComponentProps} from '@sanity/preview-kit/live-query'
3
+ import {LiveQueryProps} from '@sanity/preview-kit/live-query'
4
+
5
+ export {LiveQuery}
6
+ export default LiveQuery
7
+
8
+ export {LiveQueryClientComponentProps}
9
+
10
+ export {LiveQueryProps}
11
+
12
+ export {}
@@ -0,0 +1,97 @@
1
+ /// <reference types="react" />
2
+
3
+ import {JSX as JSX_2} from 'react'
4
+ import {MemoExoticComponent} from 'react'
5
+ import {StudioProps} from 'sanity'
6
+
7
+ /**
8
+ * In router segments (`/app/studio/[[...index]]/page.tsx`):
9
+ * ```tsx
10
+ * // If you don't want to change any defaults you can just re-export the metadata directly:
11
+ * export {metadata} from 'next-sanity/studio'
12
+ *
13
+ * // To customize the metadata, spread it on the export:
14
+ * import {metadata as studioMetadata} from 'next-sanity/studio'
15
+ * import type { Metadata } from 'next'
16
+ *
17
+ * export const metadata: Metadata = {
18
+ * ...studioMetadata,
19
+ * // Set another title
20
+ * title: 'My Studio',
21
+ * })
22
+ * ```
23
+ * @public
24
+ */
25
+ export declare const metadata: {
26
+ referrer: 'same-origin'
27
+ robots: 'noindex'
28
+ }
29
+
30
+ /**
31
+ * Override how the Studio renders by passing children.
32
+ * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:
33
+ * ```
34
+ * import {StudioProvider, StudioLayout} from 'sanity'
35
+ * import {NextStudio} from 'next-sanity/studio'
36
+ * <NextStudio config={config}>
37
+ * <StudioProvider config={config}>
38
+ * <CustomComponentThatUsesContextFromStudioProvider />
39
+ * <StudioLayout />
40
+ * </StudioProvider>
41
+ * </NextStudio>
42
+ * ```
43
+ * @public
44
+ */
45
+ export declare const NextStudio: MemoExoticComponent<
46
+ ({children, config, unstable__noScript, scheme, ...props}: NextStudioProps) => JSX_2.Element
47
+ >
48
+
49
+ /** @public */
50
+ export declare const NextStudioLayout: MemoExoticComponent<
51
+ ({children}: NextStudioLayoutProps) => JSX_2.Element
52
+ >
53
+
54
+ /** @public */
55
+ export declare interface NextStudioLayoutProps {
56
+ children: React.ReactNode
57
+ }
58
+
59
+ /** @internal */
60
+ export declare const NextStudioNoScript: () => JSX.Element
61
+
62
+ /** @public */
63
+ export declare interface NextStudioProps extends StudioProps {
64
+ children?: React.ReactNode
65
+ /**
66
+ * Render the <noscript> tag
67
+ * @defaultValue true
68
+ * @alpha
69
+ */
70
+ unstable__noScript?: boolean
71
+ }
72
+
73
+ /**
74
+ * In router segments (`/app/studio/[[...index]]/page.tsx`):
75
+ * ```tsx
76
+ * // If you don't want to change any defaults you can just re-export the viewport config directly:
77
+ * export {viewport} from 'next-sanity/studio'
78
+ *
79
+ * // To customize the viewport config, spread it on the export:
80
+ * import {viewport as studioViewport} from 'next-sanity/studio'
81
+ * import type { Viewport } from 'next'
82
+ *
83
+ * export const viewport: Viewport = {
84
+ * ...studioViewport,
85
+ * // Overrides the viewport to resize behavior
86
+ * interactiveWidget: 'resizes-content'
87
+ * })
88
+ * ```
89
+ * @public
90
+ */
91
+ export declare const viewport: {
92
+ width: string
93
+ initialScale: number
94
+ viewportFit: 'cover'
95
+ }
96
+
97
+ export {}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @public
3
+ * @deprecated use `export {metadata} from 'next-sanity/studio'` instead
4
+ */
5
+ export declare const metadata: {
6
+ referrer: 'same-origin'
7
+ robots: 'noindex'
8
+ }
9
+
10
+ export {}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @public
3
+ * @deprecated use `export {viewport} from 'next-sanity/studio'` instead
4
+ */
5
+ export declare const viewport: {
6
+ width: string
7
+ initialScale: number
8
+ viewportFit: 'cover'
9
+ }
10
+
11
+ export {}
@@ -0,0 +1,45 @@
1
+ import type {NextApiRequest} from 'next'
2
+ import type {NextRequest} from 'next/server'
3
+ import type {PageConfig} from 'next/types'
4
+ import type {SanityDocument} from '@sanity/types'
5
+
6
+ /**
7
+ * Configurates the API function with the right runtime and body parsing to handle Sanity Webhook events.
8
+ * @public
9
+ * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.
10
+ */
11
+ export declare const config: PageConfig
12
+
13
+ /**
14
+ * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
15
+ * without worrying about getting stale data.
16
+ * @public
17
+ */
18
+ export declare function parseBody<Body = SanityDocument>(
19
+ req: NextRequest,
20
+ secret?: string,
21
+ waitForContentLakeEventualConsistency?: boolean,
22
+ ): Promise<ParsedBody<Body>>
23
+
24
+ /**
25
+ * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
26
+ * without worrying about getting stale data.
27
+ * @public
28
+ * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.
29
+ */
30
+ export declare function parseBody<Body = SanityDocument>(
31
+ req: NextApiRequest,
32
+ secret?: string,
33
+ waitForContentLakeEventualConsistency?: boolean,
34
+ ): Promise<ParsedBody<Body>>
35
+
36
+ /** @public */
37
+ export declare type ParsedBody<T> = {
38
+ /**
39
+ * If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`
40
+ */
41
+ isValidSignature: boolean | null
42
+ body: T | null
43
+ }
44
+
45
+ export {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "8.4.2",
3
+ "version": "8.4.4",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "sanity",
@@ -26,56 +26,48 @@
26
26
  "type": "module",
27
27
  "exports": {
28
28
  ".": {
29
- "types": "./dist/index.d.ts",
30
29
  "source": "./src/index.ts",
31
30
  "import": "./dist/index.js",
32
31
  "require": "./dist/index.cjs",
33
32
  "default": "./dist/index.js"
34
33
  },
35
34
  "./image": {
36
- "types": "./dist/image/index.d.ts",
37
35
  "source": "./src/image/index.ts",
38
36
  "import": "./dist/image/index.js",
39
37
  "require": "./dist/image/index.cjs",
40
38
  "default": "./dist/image/index.js"
41
39
  },
42
40
  "./preview": {
43
- "types": "./dist/preview/index.d.ts",
44
41
  "source": "./src/preview/index.ts",
45
42
  "import": "./dist/preview/index.js",
46
43
  "require": "./dist/preview/index.cjs",
47
44
  "default": "./dist/preview/index.js"
48
45
  },
49
46
  "./preview/live-query": {
50
- "types": "./dist/preview/live-query.d.ts",
51
47
  "source": "./src/preview/LiveQuery/index.ts",
52
48
  "import": "./dist/preview/live-query.js",
53
49
  "require": "./dist/preview/live-query.cjs",
54
50
  "default": "./dist/preview/live-query.js"
55
51
  },
56
52
  "./studio": {
57
- "types": "./dist/studio/index.d.ts",
58
53
  "source": "./src/studio/index.ts",
59
54
  "import": "./dist/studio/index.js",
60
55
  "require": "./dist/studio/index.cjs",
61
56
  "default": "./dist/studio/index.js"
62
57
  },
63
58
  "./studio/metadata": {
64
- "types": "./dist/studio/metadata.d.ts",
65
59
  "source": "./src/studio/metadata.ts",
66
60
  "import": "./dist/studio/metadata.js",
67
61
  "require": "./dist/studio/metadata.cjs",
68
62
  "default": "./dist/studio/metadata.js"
69
63
  },
70
64
  "./studio/viewport": {
71
- "types": "./dist/studio/viewport.d.ts",
72
65
  "source": "./src/studio/viewport.ts",
73
66
  "import": "./dist/studio/viewport.js",
74
67
  "require": "./dist/studio/viewport.cjs",
75
68
  "default": "./dist/studio/viewport.js"
76
69
  },
77
70
  "./webhook": {
78
- "types": "./dist/webhook.d.ts",
79
71
  "source": "./src/webhook/index.ts",
80
72
  "import": "./dist/webhook.js",
81
73
  "require": "./dist/webhook.cjs",
@@ -112,43 +104,42 @@
112
104
  ]
113
105
  }
114
106
  },
115
- "typings": "dist/index.d.ts",
116
107
  "files": [
117
108
  "dist",
118
109
  "src"
119
110
  ],
120
111
  "browserslist": "extends @sanity/browserslist-config",
121
112
  "dependencies": {
122
- "@portabletext/react": "^3.0.12",
123
- "@sanity/client": "^6.15.5",
124
- "@sanity/preview-kit": "5.0.33",
125
- "@sanity/visual-editing": "1.8.1",
113
+ "@portabletext/react": "^3.0.13",
114
+ "@sanity/client": "^6.15.7",
115
+ "@sanity/preview-kit": "5.0.35",
116
+ "@sanity/visual-editing": "1.8.2",
126
117
  "@sanity/webhook": "4.0.2-bc",
127
118
  "groq": "^3.19"
128
119
  },
129
120
  "devDependencies": {
130
121
  "@sanity/browserslist-config": "^1.0.3",
131
122
  "@sanity/eslint-config-studio": "^3.0.1",
132
- "@sanity/pkg-utils": "^5.0.2",
133
- "@types/react": "^18.2.66",
134
- "@typescript-eslint/eslint-plugin": "^7.2.0",
123
+ "@sanity/pkg-utils": "^5.1.1",
124
+ "@types/react": "^18.2.67",
125
+ "@typescript-eslint/eslint-plugin": "^7.3.1",
135
126
  "@vitest/coverage-v8": "^1.4.0",
136
127
  "eslint": "^8.57.0",
137
128
  "eslint-config-prettier": "^9.1.0",
138
- "eslint-config-sanity": "^7.1.1",
129
+ "eslint-config-sanity": "^7.1.2",
139
130
  "eslint-gitignore": "^0.1.0",
140
131
  "eslint-plugin-simple-import-sort": "^12.0.0",
141
132
  "ls-engines": "^0.9.1",
142
- "next": "14.1.3",
133
+ "next": "14.1.4",
143
134
  "react": "^18.2.0",
144
135
  "rimraf": "^5.0.5",
145
136
  "styled-components": "^6.1.8",
146
- "typescript": "5.3.3",
137
+ "typescript": "5.4.2",
147
138
  "vitest": "^1.4.0",
148
139
  "vitest-github-actions-reporter": "^0.11.1"
149
140
  },
150
141
  "peerDependencies": {
151
- "@sanity/client": "^6.15.5",
142
+ "@sanity/client": "^6.15.7",
152
143
  "@sanity/icons": "^2.8",
153
144
  "@sanity/types": "^3.25",
154
145
  "@sanity/ui": "^1.8 || ^2.0.0-beta || ^2.0",