@devite/nuxt-sanity 2.9.0 → 2.9.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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/client/DefaultSanityClient.js +1 -1
- package/dist/runtime/client/MinimalSanityClient.js +1 -1
- package/dist/runtime/composables/query.d.ts +1 -1
- package/dist/runtime/composables/query.js +1 -1
- package/dist/runtime/server/routes/cache/query.js +1 -1
- package/package.json +10 -8
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { defineNuxtModule, createResolver, addPlugin, addServerHandler, addImpor
|
|
|
3
3
|
import defu from 'defu';
|
|
4
4
|
|
|
5
5
|
const name = "@devite/nuxt-sanity";
|
|
6
|
-
const version = "2.9.
|
|
6
|
+
const version = "2.9.1";
|
|
7
7
|
|
|
8
8
|
const CONFIG_KEY = "sanity";
|
|
9
9
|
const module = defineNuxtModule({
|
|
@@ -9,7 +9,7 @@ class MinimalSanityClient extends SanityClient {
|
|
|
9
9
|
super({
|
|
10
10
|
...config,
|
|
11
11
|
perspective: config.perspective || "raw",
|
|
12
|
-
useCdn: config.perspective === "
|
|
12
|
+
useCdn: config.perspective === "drafts" ? false : config.useCdn
|
|
13
13
|
});
|
|
14
14
|
this.queryPath = `/v${config.apiVersion}/data/query/${config.dataset}`;
|
|
15
15
|
this.fetchOptions = {
|
|
@@ -4,7 +4,7 @@ import type { EncodeDataAttributeFunction } from '@sanity/core-loader/encode-dat
|
|
|
4
4
|
import { type Ref } from 'vue';
|
|
5
5
|
export interface UseSanityQueryOptions<T> extends AsyncDataOptions<T> {
|
|
6
6
|
client?: 'default' | 'minimal';
|
|
7
|
-
perspective?: '
|
|
7
|
+
perspective?: 'drafts' | 'published' | 'raw';
|
|
8
8
|
}
|
|
9
9
|
export interface SanityQueryResponse<T> {
|
|
10
10
|
data: T;
|
|
@@ -13,7 +13,7 @@ export function useSanityQuery(query, _params = {}, options = {}, lazy = false)
|
|
|
13
13
|
const sanityConfig = defu(import.meta.server ? $config.sanity : {}, $config.public.sanity);
|
|
14
14
|
const visualEditingEnabled = useSanityVisualEditingState().enabled;
|
|
15
15
|
const clientType = visualEditingEnabled ? "default" : options.client || (sanityConfig.minimalClient ? "minimal" : "default");
|
|
16
|
-
const perspective = options.perspective || (visualEditingEnabled ? "
|
|
16
|
+
const perspective = options.perspective || (visualEditingEnabled ? "drafts" : "published");
|
|
17
17
|
const reactiveParams = _params ? reactive(_params) : void 0;
|
|
18
18
|
if (reactiveParams) {
|
|
19
19
|
options.watch ||= [];
|
|
@@ -17,7 +17,7 @@ export default defineEventHandler(async (event) => {
|
|
|
17
17
|
throw createError({ statusCode: 400, statusMessage: "Missing query parameter" });
|
|
18
18
|
const params = Array.from(queryParams).filter(([key]) => key.startsWith("$"));
|
|
19
19
|
const perspective = queryParams.get("perspective") || useRuntimeConfig().public.sanity.perspective;
|
|
20
|
-
if (typeof perspective === "string" && !["
|
|
20
|
+
if (typeof perspective === "string" && !["drafts", "published", "raw"].includes(perspective))
|
|
21
21
|
throw createError({ statusCode: 400, statusMessage: "Invalid perspective" });
|
|
22
22
|
const hashedQuery = hash(query + JSON.stringify(params) + (perspective || ""));
|
|
23
23
|
const dataCache = useStorage("sanityData");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devite/nuxt-sanity",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Advanced Sanity integration for Nuxt.js.",
|
|
5
5
|
"repository": "devite-io/nuxt-sanity",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,28 +23,30 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@nuxt/image": "^1.9.0",
|
|
26
|
-
"@portabletext/vue": "^1.0.
|
|
26
|
+
"@portabletext/vue": "^1.0.12",
|
|
27
27
|
"@sanity/client": "^6.28.3",
|
|
28
28
|
"@sanity/core-loader": "^1.7.38",
|
|
29
29
|
"@sanity/preview-url-secret": "^2.1.5",
|
|
30
|
-
"@sanity/types": "^3.
|
|
30
|
+
"@sanity/types": "^3.79.0",
|
|
31
31
|
"@sanity/visual-editing": "^2.13.7",
|
|
32
32
|
"defu": "^6.1.4",
|
|
33
33
|
"ofetch": "^1.4.1",
|
|
34
|
-
"ohash": "^1.1.
|
|
34
|
+
"ohash": "^1.1.6",
|
|
35
|
+
"react": "^19.0.0",
|
|
36
|
+
"react-dom": "^19.0.0",
|
|
35
37
|
"unstorage": "^1.15.0"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"@nuxt/eslint-config": "^0.7.6",
|
|
39
|
-
"@nuxt/kit": "^3.
|
|
41
|
+
"@nuxt/kit": "^3.16.0",
|
|
40
42
|
"@nuxt/module-builder": "^0.8.4",
|
|
41
|
-
"@nuxt/schema": "^3.
|
|
42
|
-
"@nuxt/test-utils": "^3.
|
|
43
|
+
"@nuxt/schema": "^3.16.0",
|
|
44
|
+
"@nuxt/test-utils": "^3.17.2",
|
|
43
45
|
"@types/node": "latest",
|
|
44
46
|
"changelogen": "^0.5.7",
|
|
45
47
|
"eslint": "^9.22.0",
|
|
46
48
|
"h3": "^1.15.1",
|
|
47
|
-
"nuxt": "^3.
|
|
49
|
+
"nuxt": "^3.16.0",
|
|
48
50
|
"typescript": "5.6.3",
|
|
49
51
|
"vite": "6.0.1",
|
|
50
52
|
"vitest": "^2.1.9",
|