next-sanity 12.2.2 → 12.3.1
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/dist/NextStudio.js +17 -0
- package/dist/NextStudio.js.map +1 -1
- package/dist/NextStudioNoScript.js +2 -0
- package/dist/NextStudioNoScript.js.map +1 -1
- package/dist/PresentationComlink.js +1 -1
- package/dist/RefreshOnFocus.js +1 -1
- package/dist/RefreshOnMount.js +7 -1
- package/dist/RefreshOnMount.js.map +1 -1
- package/dist/RefreshOnReconnect.js +1 -1
- package/dist/SanityLiveStream.js +4 -0
- package/dist/SanityLiveStream.js.map +1 -1
- package/dist/VisualEditing.js +42 -1
- package/dist/VisualEditing.js.map +1 -1
- package/dist/context.js +12 -0
- package/dist/context.js.map +1 -1
- package/dist/defineLive.d.ts +5 -0
- package/dist/defineLive.d.ts.map +1 -1
- package/dist/draft-mode/index.js +19 -2
- package/dist/draft-mode/index.js.map +1 -1
- package/dist/hooks/index.js +53 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/image/index.d.ts +1 -1
- package/dist/image/index.js +7 -1
- package/dist/image/index.js.map +1 -1
- package/dist/isCorsOriginError.js +1 -0
- package/dist/isCorsOriginError.js.map +1 -1
- package/dist/live/client-components/live/index.d.ts +8 -0
- package/dist/live/client-components/live/index.d.ts.map +1 -1
- package/dist/live/client-components/live/index.js +31 -6
- package/dist/live/client-components/live/index.js.map +1 -1
- package/dist/live/client-components/live-stream/index.js +6 -1
- package/dist/live/client-components/live-stream/index.js.map +1 -1
- package/dist/live/server-actions/index.js +2 -2
- package/dist/live.js +12 -4
- package/dist/live.js.map +1 -1
- package/dist/live.server-only.js +3 -0
- package/dist/live.server-only.js.map +1 -1
- package/dist/studio/client-component/index.js +7 -0
- package/dist/studio/client-component/index.js.map +1 -1
- package/dist/studio/index.js +40 -0
- package/dist/studio/index.js.map +1 -1
- package/dist/utils.js +1 -0
- package/dist/utils.js.map +1 -1
- package/dist/visual-editing/client-component/index.js +7 -0
- package/dist/visual-editing/client-component/index.js.map +1 -1
- package/dist/visual-editing/index.js +3 -0
- package/dist/visual-editing/index.js.map +1 -1
- package/dist/visual-editing/server-actions/index.js +2 -2
- package/dist/webhook/index.d.ts +1 -1
- package/dist/webhook/index.js +5 -0
- package/dist/webhook/index.js.map +1 -1
- package/package.json +17 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use server";
|
|
2
|
-
import { draftMode } from "next/headers";
|
|
3
|
-
import { revalidatePath } from "next/cache";
|
|
2
|
+
import { draftMode } from "next/headers.js";
|
|
3
|
+
import { revalidatePath } from "next/cache.js";
|
|
4
4
|
async function revalidateRootLayout() {
|
|
5
5
|
if (!(await draftMode()).isEnabled) {
|
|
6
6
|
console.warn("Skipped revalidatePath request because draft mode is not enabled");
|
package/dist/webhook/index.d.ts
CHANGED
package/dist/webhook/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { SIGNATURE_HEADER_NAME, isValidSignature } from "@sanity/webhook";
|
|
2
|
+
/**
|
|
3
|
+
* Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
|
|
4
|
+
* without worrying about getting stale data.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
2
7
|
async function parseBody(req, secret, waitForContentLakeEventualConsistency = true) {
|
|
3
8
|
const signature = req.headers.get(SIGNATURE_HEADER_NAME);
|
|
4
9
|
if (!signature) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/webhook/index.ts"],"sourcesContent":["import {isValidSignature, SIGNATURE_HEADER_NAME} from '@sanity/webhook'\nimport type {NextRequest} from 'next/server'\n\n/** @public */\nexport type ParsedBody<T> = {\n /**\n * 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`\n */\n isValidSignature: boolean | null\n body: T | null\n}\n\n/** @public */\ninterface SanityDocument {\n _id: string\n _type: string\n _createdAt: string\n _updatedAt: string\n _rev: string\n [key: string]: unknown\n}\n\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency = true,\n): Promise<ParsedBody<Body>> {\n const signature = req.headers.get(SIGNATURE_HEADER_NAME)\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n const body = await req.text()\n const validSignature = secret ? await isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 3000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/webhook/index.ts"],"sourcesContent":["import {isValidSignature, SIGNATURE_HEADER_NAME} from '@sanity/webhook'\nimport type {NextRequest} from 'next/server'\n\n/** @public */\nexport type ParsedBody<T> = {\n /**\n * 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`\n */\n isValidSignature: boolean | null\n body: T | null\n}\n\n/** @public */\ninterface SanityDocument {\n _id: string\n _type: string\n _createdAt: string\n _updatedAt: string\n _rev: string\n [key: string]: unknown\n}\n\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency = true,\n): Promise<ParsedBody<Body>> {\n const signature = req.headers.get(SIGNATURE_HEADER_NAME)\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n const body = await req.text()\n const validSignature = secret ? await isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 3000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n"],"mappings":";;;;;;AA2BA,eAAsB,UACpB,KACA,QACA,wCAAwC,MACb;CAC3B,MAAM,YAAY,IAAI,QAAQ,IAAI,sBAAsB;AACxD,KAAI,CAAC,WAAW;AACd,UAAQ,MAAM,2BAA2B;AACzC,SAAO;GAAC,MAAM;GAAM,kBAAkB;GAAK;;CAG7C,MAAM,OAAO,MAAM,IAAI,MAAM;CAC7B,MAAM,iBAAiB,SAAS,MAAM,iBAAiB,MAAM,WAAW,OAAO,MAAM,CAAC,GAAG;AAEzF,KAAI,mBAAmB,SAAS,sCAC9B,OAAM,IAAI,SAAS,YAAY,WAAW,SAAS,IAAK,CAAC;AAG3D,QAAO;EACL,MAAM,KAAK,MAAM,GAAG,KAAK,MAAM,KAAK,GAAG;EACvC,kBAAkB;EACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.1",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"live",
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@portabletext/react": "^6.0.3",
|
|
60
|
-
"@sanity/client": "^7.
|
|
60
|
+
"@sanity/client": "^7.22.0",
|
|
61
61
|
"@sanity/comlink": "^4.0.1",
|
|
62
62
|
"@sanity/presentation-comlink": "^2.0.1",
|
|
63
|
-
"@sanity/preview-url-secret": "^4.0.
|
|
64
|
-
"@sanity/visual-editing": "^5.3.
|
|
63
|
+
"@sanity/preview-url-secret": "^4.0.5",
|
|
64
|
+
"@sanity/visual-editing": "^5.3.4",
|
|
65
65
|
"@sanity/webhook": "^4.0.4",
|
|
66
66
|
"dequal": "^2.0.3",
|
|
67
|
-
"groq": "^5.
|
|
67
|
+
"groq": "^5.22.0",
|
|
68
68
|
"history": "^5.3.0",
|
|
69
69
|
"server-only": "^0.0.1"
|
|
70
70
|
},
|
|
@@ -74,26 +74,27 @@
|
|
|
74
74
|
"@types/node": "^24.12.2",
|
|
75
75
|
"@types/react": "^19.2.14",
|
|
76
76
|
"@types/react-dom": "^19.2.3",
|
|
77
|
-
"@vitejs/plugin-react": "^
|
|
78
|
-
"@vitest/coverage-v8": "^4.1.
|
|
77
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
78
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
79
79
|
"js-yaml": "^4.1.1",
|
|
80
|
-
"next": "16.
|
|
80
|
+
"next": "16.3.0-canary.2",
|
|
81
81
|
"publint": "^0.3.18",
|
|
82
|
-
"react": "^19.2.
|
|
83
|
-
"react-dom": "^19.2.
|
|
84
|
-
"styled-components": "^6.
|
|
85
|
-
"tsdown": "0.
|
|
86
|
-
"typedoc": "^0.28.
|
|
82
|
+
"react": "^19.2.5",
|
|
83
|
+
"react-dom": "^19.2.5",
|
|
84
|
+
"styled-components": "^6.4.1",
|
|
85
|
+
"tsdown": "^0.21.10",
|
|
86
|
+
"typedoc": "^0.28.19",
|
|
87
87
|
"typescript": "5.9.3",
|
|
88
|
-
"
|
|
88
|
+
"vite": "^8.0.0",
|
|
89
|
+
"vitest": "^4.1.5",
|
|
89
90
|
"vitest-package-exports": "^1.2.0"
|
|
90
91
|
},
|
|
91
92
|
"peerDependencies": {
|
|
92
|
-
"@sanity/client": "^7.
|
|
93
|
+
"@sanity/client": "^7.22.0",
|
|
93
94
|
"next": "^16.0.0-0",
|
|
94
95
|
"react": "^19.2.3",
|
|
95
96
|
"react-dom": "^19.2.3",
|
|
96
|
-
"sanity": "^5.
|
|
97
|
+
"sanity": "^5.22.0",
|
|
97
98
|
"styled-components": "^6.1"
|
|
98
99
|
},
|
|
99
100
|
"engines": {
|