@sanity/client 8.6.2 → 8.8.0

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/src/types.ts CHANGED
@@ -2298,6 +2298,53 @@ declare global {
2298
2298
  * direct dependency, how many copies of it are installed, and from every subpath export.
2299
2299
  */
2300
2300
  interface SanityQueries {}
2301
+
2302
+ /**
2303
+ * Schema types, keyed first by resource and then read as a union. Empty by default; a
2304
+ * multi-resource `sanity typegen` run registers one entry per configured resource:
2305
+ * ```ts
2306
+ * declare global {
2307
+ * interface SanitySchemasByResource {
2308
+ * 'ppsg7ml5.test': Author | Movie | Slug
2309
+ * }
2310
+ * }
2311
+ * ```
2312
+ * A resource key is the same string the SDK uses for its runtime cache: `projectId.dataset`
2313
+ * for a dataset, with no prefix. Consumers select one document type out of the union by its
2314
+ * `_type`, so the union may include object types that are not documents.
2315
+ */
2316
+ interface SanitySchemasByResource {}
2317
+
2318
+ /**
2319
+ * Query result types, keyed by resource and then by GROQ query string. Empty by default; a
2320
+ * multi-resource `sanity typegen` run registers the queries it finds per resource:
2321
+ * ```ts
2322
+ * declare global {
2323
+ * interface SanityQueriesByResource {
2324
+ * 'ppsg7ml5.test': {'*[_type == "post"]': PostsQueryResult}
2325
+ * }
2326
+ * }
2327
+ * ```
2328
+ * The flat `SanityQueries` registry stays as it is. It cannot express two datasets whose
2329
+ * schemas give the same query text different result types, which is what this adds.
2330
+ */
2331
+ interface SanityQueriesByResource {}
2332
+
2333
+ /**
2334
+ * Projection result types, keyed by resource, then document type, then projection string.
2335
+ * Empty by default:
2336
+ * ```ts
2337
+ * declare global {
2338
+ * interface SanityProjectionsByResource {
2339
+ * 'ppsg7ml5.test': {author: {'{name}': {name: string | null}}}
2340
+ * }
2341
+ * }
2342
+ * ```
2343
+ * A projection applies to a document the caller identifies by handle, so the same projection
2344
+ * text resolves differently per document type as well as per resource. That is why there is a
2345
+ * document-type level here and not in `SanityQueriesByResource`.
2346
+ */
2347
+ interface SanityProjectionsByResource {}
2301
2348
  }
2302
2349
 
2303
2350
  /**
@@ -2322,6 +2369,28 @@ declare global {
2322
2369
  */
2323
2370
  export interface SanityQueries extends globalThis.SanityQueries {}
2324
2371
 
2372
+ /**
2373
+ * The schema registry as seen from `@sanity/client`. Inherits every resource registered on the
2374
+ * global `SanitySchemasByResource`, and also accepts a module augmentation, the same way
2375
+ * {@link SanityQueries} does.
2376
+ * @public
2377
+ */
2378
+ export interface SanitySchemasByResource extends globalThis.SanitySchemasByResource {}
2379
+
2380
+ /**
2381
+ * The per-resource query registry as seen from `@sanity/client`. Inherits every resource
2382
+ * registered on the global `SanityQueriesByResource`, and also accepts a module augmentation.
2383
+ * @public
2384
+ */
2385
+ export interface SanityQueriesByResource extends globalThis.SanityQueriesByResource {}
2386
+
2387
+ /**
2388
+ * The projection registry as seen from `@sanity/client`. Inherits every resource registered on
2389
+ * the global `SanityProjectionsByResource`, and also accepts a module augmentation.
2390
+ * @public
2391
+ */
2392
+ export interface SanityProjectionsByResource extends globalThis.SanityProjectionsByResource {}
2393
+
2325
2394
  /** @public */
2326
2395
  export type ClientReturn<
2327
2396
  GroqString extends string,
@@ -2379,6 +2448,7 @@ export type {
2379
2448
  CollaborationCommentsWriteOptions,
2380
2449
  CollaborationCommentTarget,
2381
2450
  CollaborationCommentUpdate,
2451
+ CollaborationCommentAnchor,
2382
2452
  CollaborationCommentRange,
2383
2453
  CollaborationCommentFieldValue,
2384
2454
  } from './collaboration/types'