@sanity/client 6.27.3-canary.1 → 6.27.3-canary.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/README.md +16 -16
- package/dist/index.browser.cjs +1 -0
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +5 -0
- package/dist/index.browser.d.ts +5 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +5 -0
- package/dist/stega.browser.d.ts +5 -0
- package/dist/stega.d.cts +5 -0
- package/dist/stega.d.ts +5 -0
- package/package.json +1 -1
- package/src/data/listen.ts +1 -0
- package/src/types.ts +6 -0
- package/umd/sanityClient.js +1 -0
- package/umd/sanityClient.min.js +2 -2
package/README.md
CHANGED
|
@@ -27,8 +27,8 @@ export const client = createClient({
|
|
|
27
27
|
projectId: 'your-project-id',
|
|
28
28
|
dataset: 'your-dataset-name',
|
|
29
29
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
30
|
-
apiVersion: '
|
|
31
|
-
// token: process.env.SANITY_SECRET_TOKEN // Needed for certain operations like updating content or
|
|
30
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
31
|
+
// token: process.env.SANITY_SECRET_TOKEN // Needed for certain operations like updating content, accessing drafts or using draft perspectives
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
// uses GROQ to query content: https://www.sanity.io/docs/groq
|
|
@@ -164,7 +164,7 @@ const client = createClient({
|
|
|
164
164
|
projectId: 'your-project-id',
|
|
165
165
|
dataset: 'your-dataset-name',
|
|
166
166
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
167
|
-
apiVersion: '
|
|
167
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
168
168
|
})
|
|
169
169
|
|
|
170
170
|
const data = await client.fetch(`count(*)`)
|
|
@@ -180,7 +180,7 @@ const client = createClient({
|
|
|
180
180
|
projectId: 'your-project-id',
|
|
181
181
|
dataset: 'your-dataset-name',
|
|
182
182
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
183
|
-
apiVersion: '
|
|
183
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
184
184
|
})
|
|
185
185
|
|
|
186
186
|
client
|
|
@@ -198,7 +198,7 @@ const config: ClientConfig = {
|
|
|
198
198
|
projectId: 'your-project-id',
|
|
199
199
|
dataset: 'your-dataset-name',
|
|
200
200
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
201
|
-
apiVersion: '
|
|
201
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
202
202
|
}
|
|
203
203
|
const client = createClient(config)
|
|
204
204
|
|
|
@@ -218,7 +218,7 @@ const client = createClient({
|
|
|
218
218
|
projectId: 'your-project-id',
|
|
219
219
|
dataset: 'your-dataset-name',
|
|
220
220
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
221
|
-
apiVersion: '
|
|
221
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
222
222
|
})
|
|
223
223
|
|
|
224
224
|
const schema = z.number()
|
|
@@ -238,7 +238,7 @@ const client = createClient({
|
|
|
238
238
|
projectId: 'your-project-id',
|
|
239
239
|
dataset: 'your-dataset-name',
|
|
240
240
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
241
|
-
apiVersion: '
|
|
241
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
242
242
|
})
|
|
243
243
|
|
|
244
244
|
export default async function ReactServerComponent() {
|
|
@@ -282,7 +282,7 @@ const client = createClient({
|
|
|
282
282
|
projectId: 'your-project-id',
|
|
283
283
|
dataset: 'your-dataset-name',
|
|
284
284
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
285
|
-
apiVersion: '
|
|
285
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
286
286
|
})
|
|
287
287
|
|
|
288
288
|
const data = await client.fetch<number>(`count(*)`)
|
|
@@ -310,7 +310,7 @@ const client = createClient({
|
|
|
310
310
|
projectId: 'your-project-id',
|
|
311
311
|
dataset: 'your-dataset-name',
|
|
312
312
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
313
|
-
apiVersion: '
|
|
313
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
314
314
|
})
|
|
315
315
|
|
|
316
316
|
const data = await client.fetch<number>(`count(*)`)
|
|
@@ -343,7 +343,7 @@ export default async function handler(req: NextRequest) {
|
|
|
343
343
|
projectId: 'your-project-id',
|
|
344
344
|
dataset: 'your-dataset-name',
|
|
345
345
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
346
|
-
apiVersion: '
|
|
346
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
347
347
|
})
|
|
348
348
|
|
|
349
349
|
const count = await client.fetch<number>(`count(*)`)
|
|
@@ -374,7 +374,7 @@ Using [esm.sh] you can either load the client using a `<script type="module">` t
|
|
|
374
374
|
projectId: 'your-project-id',
|
|
375
375
|
dataset: 'your-dataset-name',
|
|
376
376
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
377
|
-
apiVersion: '
|
|
377
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
378
378
|
})
|
|
379
379
|
|
|
380
380
|
const data = await client.fetch(`count(*)`)
|
|
@@ -393,7 +393,7 @@ const client = createClient({
|
|
|
393
393
|
projectId: 'your-project-id',
|
|
394
394
|
dataset: 'your-dataset-name',
|
|
395
395
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
396
|
-
apiVersion: '
|
|
396
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
397
397
|
})
|
|
398
398
|
|
|
399
399
|
const data = await client.fetch(`count(*)`)
|
|
@@ -415,7 +415,7 @@ Loading the UMD script creates a `SanityClient` global that have the same export
|
|
|
415
415
|
projectId: 'your-project-id',
|
|
416
416
|
dataset: 'your-dataset-name',
|
|
417
417
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
418
|
-
apiVersion: '
|
|
418
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
419
419
|
})
|
|
420
420
|
|
|
421
421
|
client.fetch(`count(*)`).then((data) => console.log(`Number of documents: ${data}`))
|
|
@@ -436,7 +436,7 @@ The `require-unpkg` library lets you consume `npm` packages from `unpkg.com` sim
|
|
|
436
436
|
projectId: 'your-project-id',
|
|
437
437
|
dataset: 'your-dataset-name',
|
|
438
438
|
useCdn: true, // set to `false` to bypass the edge cache
|
|
439
|
-
apiVersion: '
|
|
439
|
+
apiVersion: '2025-02-06', // use current date (YYYY-MM-DD) to target the latest API version. Note: this should always be hard coded. Setting API version based on a dynamic value (e.g. new Date()) may break your application at a random point in the future.
|
|
440
440
|
})
|
|
441
441
|
|
|
442
442
|
const data = await client.fetch(`count(*)`)
|
|
@@ -471,7 +471,7 @@ const client = createClient({
|
|
|
471
471
|
projectId: '<project>',
|
|
472
472
|
dataset: '<dataset>',
|
|
473
473
|
useCdn: true,
|
|
474
|
-
apiVersion: '
|
|
474
|
+
apiVersion: '2025-02-06',
|
|
475
475
|
requestTagPrefix: 'website', // Added to every request
|
|
476
476
|
})
|
|
477
477
|
|
|
@@ -1567,7 +1567,7 @@ import {createClient} from '@sanity/client'
|
|
|
1567
1567
|
export const client = createClient({
|
|
1568
1568
|
projectId: 'your-project-id',
|
|
1569
1569
|
dataset: 'your-dataset-name',
|
|
1570
|
-
apiVersion: '
|
|
1570
|
+
apiVersion: '2025-02-06',
|
|
1571
1571
|
+ useCdn: false, // set to `true` to use the edge cache
|
|
1572
1572
|
})
|
|
1573
1573
|
```
|