@sanity/client 8.4.0 → 8.5.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.
@@ -10,7 +10,10 @@ import type {
10
10
  VideoPlaybackInfo,
11
11
  } from '../types'
12
12
 
13
- /** @internal */
13
+ /**
14
+ * @internal
15
+ * @inline
16
+ */
14
17
  export class ObservableMediaLibraryVideoClient {
15
18
  #client: ObservableSanityClient
16
19
  #httpRequest: HttpRequest
@@ -53,7 +56,10 @@ export class ObservableMediaLibraryVideoClient {
53
56
  }
54
57
  }
55
58
 
56
- /** @internal */
59
+ /**
60
+ * @internal
61
+ * @inline
62
+ */
57
63
  export class MediaLibraryVideoClient {
58
64
  #client: SanityClient
59
65
  #httpRequest: HttpRequest
@@ -15,7 +15,10 @@ type OmittedProjectFields<T extends ListOptions | undefined> =
15
15
  | (T extends {includeMembers: false} ? 'members' : never)
16
16
  | (T extends {includeFeatures: false} ? 'features' : never)
17
17
 
18
- /** @internal */
18
+ /**
19
+ * @internal
20
+ * @inline
21
+ */
19
22
  export class ObservableProjectsClient {
20
23
  #client: ObservableSanityClient
21
24
  #httpRequest: HttpRequest
@@ -69,7 +72,10 @@ export class ObservableProjectsClient {
69
72
  }
70
73
  }
71
74
 
72
- /** @internal */
75
+ /**
76
+ * @internal
77
+ * @inline
78
+ */
73
79
  export class ProjectsClient {
74
80
  #client: SanityClient
75
81
  #httpRequest: HttpRequest
@@ -28,7 +28,10 @@ import type {
28
28
  } from '../types'
29
29
  import {createRelease} from './createRelease'
30
30
 
31
- /** @public */
31
+ /**
32
+ * @public
33
+ * @inline
34
+ */
32
35
  export class ObservableReleasesClient {
33
36
  #client: ObservableSanityClient
34
37
  #httpRequest: HttpRequest
@@ -365,7 +368,10 @@ export class ObservableReleasesClient {
365
368
  }
366
369
  }
367
370
 
368
- /** @public */
371
+ /**
372
+ * @public
373
+ * @inline
374
+ */
369
375
  export class ReleasesClient {
370
376
  #client: SanityClient
371
377
  #httpRequest: HttpRequest
package/src/types.ts CHANGED
@@ -635,7 +635,7 @@ export type DatasetAclMode = 'public' | 'private' | 'custom'
635
635
  /** @public */
636
636
  export type DatasetCreateOptions = {
637
637
  aclMode?: DatasetAclMode
638
- description?: string
638
+ description?: string | null
639
639
  embeddings?: {
640
640
  enabled: boolean
641
641
  projection?: string
@@ -645,7 +645,7 @@ export type DatasetCreateOptions = {
645
645
  /** @public */
646
646
  export type DatasetEditOptions = {
647
647
  aclMode?: DatasetAclMode
648
- description?: string
648
+ description?: string | null
649
649
  }
650
650
 
651
651
  /** @public */
@@ -662,12 +662,16 @@ export type EmbeddingsSettingsBody = {
662
662
  }
663
663
 
664
664
  /** @public */
665
- export type DatasetResponse = {datasetName: string; aclMode: DatasetAclMode; description: string}
665
+ export type DatasetResponse = {
666
+ datasetName: string
667
+ aclMode: DatasetAclMode
668
+ description: string | null
669
+ }
666
670
  /** @public */
667
671
  export type DatasetsResponse = {
668
672
  name: string
669
673
  aclMode: DatasetAclMode
670
- description: string
674
+ description?: string
671
675
  createdAt: string
672
676
  createdByUserId: string
673
677
  addonFor: string | null
@@ -2276,8 +2280,47 @@ export type LiveEvent =
2276
2280
  | LiveEventWelcome
2277
2281
  | LiveEventGoAway
2278
2282
 
2279
- /** @public */
2280
- export interface SanityQueries {}
2283
+ declare global {
2284
+ /**
2285
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
2286
+ * the queries it finds:
2287
+ * ```ts
2288
+ * declare global {
2289
+ * interface SanityQueries {
2290
+ * '*[_type == "post"]': PostsQueryResult
2291
+ * }
2292
+ * }
2293
+ * ```
2294
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
2295
+ *
2296
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
2297
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
2298
+ * direct dependency, how many copies of it are installed, and from every subpath export.
2299
+ */
2300
+ interface SanityQueries {}
2301
+ }
2302
+
2303
+ /**
2304
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
2305
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
2306
+ * ```ts
2307
+ * declare module '@sanity/client' {
2308
+ * interface SanityQueries {
2309
+ * '*[_type == "post"]': PostsQueryResult
2310
+ * }
2311
+ * }
2312
+ * ```
2313
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
2314
+ * generated file that registers queries globally can bridge them with an augmentation that adds
2315
+ * the global as a base type. It is harmless on releases that already inherit it:
2316
+ * ```ts
2317
+ * declare module '@sanity/client' {
2318
+ * interface SanityQueries extends globalThis.SanityQueries {}
2319
+ * }
2320
+ * ```
2321
+ * @public
2322
+ */
2323
+ export interface SanityQueries extends globalThis.SanityQueries {}
2281
2324
 
2282
2325
  /** @public */
2283
2326
  export type ClientReturn<
@@ -4,7 +4,10 @@ import {_request, _requestObservable} from '../data/dataMethods'
4
4
  import type {ObservableSanityClient, SanityClient} from '../SanityClient'
5
5
  import type {CurrentSanityUser, HttpRequest, SanityUser} from '../types'
6
6
 
7
- /** @public */
7
+ /**
8
+ * @public
9
+ * @inline
10
+ */
8
11
  export class ObservableUsersClient {
9
12
  #client: ObservableSanityClient
10
13
  #httpRequest: HttpRequest
@@ -27,7 +30,10 @@ export class ObservableUsersClient {
27
30
  }
28
31
  }
29
32
 
30
- /** @public */
33
+ /**
34
+ * @public
35
+ * @inline
36
+ */
31
37
  export class UsersClient {
32
38
  #client: SanityClient
33
39
  #httpRequest: HttpRequest
@@ -1 +0,0 @@
1
- {"version":3,"file":"dist-Z8cIRxoB.js","names":[],"sources":["../node_modules/.pnpm/@vercel+stega@1.1.0/node_modules/@vercel/stega/dist/index.mjs"],"sourcesContent":["var p={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},l={0:8203,1:8204,2:8205,3:65279},d={0:String.fromCodePoint(l[0]),1:String.fromCodePoint(l[1]),2:String.fromCodePoint(l[2]),3:String.fromCodePoint(l[3])},u=new Array(4).fill(String.fromCodePoint(l[0])).join(\"\"),g=String.fromCharCode(0);function A(e){let r=JSON.stringify(e),t=new TextEncoder().encode(r),i=\"\";for(let c=0;c<t.length;c++){let n=t[c];i+=d[n>>6&3]+d[n>>4&3]+d[n>>2&3]+d[n&3]}return u+i}function C(e){let r=JSON.stringify(e);return Array.from(r).map(t=>{let i=t.charCodeAt(0);if(i>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${r} on character ${t} (${i})`);return Array.from(i.toString(16).padStart(2,\"0\")).map(c=>String.fromCodePoint(p[c])).join(\"\")}).join(\"\")}function I(e){return!Number.isNaN(Number(e))||/[a-z]/i.test(e)&&!/\\d+(?:[-:\\/]\\d+){2}(?:T\\d+(?:[-:\\/]\\d+){1,2}(\\.\\d+)?Z?)?/.test(e)?!1:!!Date.parse(e)}function S(e){try{new URL(e,e.startsWith(\"/\")?\"https://acme.com\":void 0)}catch{return!1}return!0}function y(e,r,t=\"auto\"){return t===!0||t===\"auto\"&&(I(e)||S(e))?e:`${e}${A(r)}`}var m=Object.fromEntries(Object.entries(d).map(e=>[e[1],+e[0]])),T=Object.fromEntries(Object.entries(p).map(e=>e.reverse())),h=`${Object.values(p).map(e=>`\\\\u{${e.toString(16)}}`).join(\"\")}`,x=new RegExp(`[${h}]{4,}`,\"gu\");function X(e){let r=e.match(x);if(r)return E(r[0],!0)[0]}function M(e){let r=e.match(x);if(r)return r.map(t=>E(t)).flat()}function E(e,r=!1){let t=Array.from(e),i=1/0,c=-1;for(let n=0;n<t.length;++n)t[n]===u[0]&&t[n+1]===u[1]&&t[n+2]===u[2]&&t[n+3]===u[3]&&(i=Math.min(i,n),c=Math.max(c,n));if(c===-1)return _(t,r);for(let n=i;n<=c;++n)if(!((t.length-n)%4))try{let f=t.slice(n+4),s=new Uint8Array(f.length/4);for(let o=0;o<s.length;o++)s[o]=m[f[o*4]]<<6|m[f[o*4+1]]<<4|m[f[o*4+2]]<<2|m[f[o*4+3]];let a=new TextDecoder().decode(s);if(r){let o=a.indexOf(g);return o===-1&&(o=a.length),[JSON.parse(a.slice(0,o))]}return a.split(g).filter(Boolean).map(o=>JSON.parse(o))}catch{}return[]}function _(e,r){var f;let t=[];for(let s=e.length*.5;s--;){let a=`${T[e[s*2].codePointAt(0)]}${T[e[s*2+1].codePointAt(0)]}`;t.unshift(String.fromCharCode(parseInt(a,16)))}let i=[],c=[t.join(\"\")],n=10;for(;c.length;){let s=c.shift();try{if(i.push(JSON.parse(s)),r)return i}catch(a){if(!n--)throw a;let o=+((f=a.message.match(/\\sposition\\s(\\d+)$/))==null?void 0:f[1]);if(!o)throw a;c.unshift(s.substring(0,o),s.substring(o))}}return i}function P(e){var r;return{cleaned:e.replace(x,\"\"),encoded:((r=e.match(x))==null?void 0:r[0])||\"\"}}function w(e){return e&&JSON.parse(P(JSON.stringify(e)).cleaned)}export{x as VERCEL_STEGA_REGEX,C as legacyStegaEncode,w as vercelStegaClean,y as vercelStegaCombine,X as vercelStegaDecode,M as vercelStegaDecodeAll,A as vercelStegaEncode,P as vercelStegaSplit};\n"],"x_google_ignoreList":[0],"mappings":"AAAA,IAAI,IAAE;CAAC,GAAE;CAAK,GAAE;CAAK,GAAE;CAAK,GAAE;CAAK,GAAE;CAAK,GAAE;CAAK,GAAE;CAAM,GAAE;CAAK,GAAE;CAAO,GAAE;CAAO,GAAE;CAAO,GAAE;CAAO,GAAE;CAAO,GAAE;CAAO,GAAE;CAAO,GAAE;AAAM,GAAE,IAAE;CAAC,GAAE;CAAK,GAAE;CAAK,GAAE;CAAK,GAAE;AAAK,GAAE,IAAE;CAAC,GAAE,OAAO,cAAc,EAAE,EAAE;CAAE,GAAE,OAAO,cAAc,EAAE,EAAE;CAAE,GAAE,OAAO,cAAc,EAAE,EAAE;CAAE,GAAE,OAAO,cAAc,EAAE,EAAE;AAAC,GAAE,IAAE;;;;;AAAW,CAAC,CAAC,KAAK,OAAO,cAAc,EAAE,EAAE,CAAC,CA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EAAE,GAAE;CAAO,OAAM;EAAC,SAAQ,EAAE,QAAQ,GAAE,EAAE;EAAE,SAAY,EAAE,MAAM,CAAC,CAAA,GAAkB,MAAK;CAAE;AAAC;AAAC,SAAS,EAAE,GAAE;CAAC,OAAO,KAAG,KAAK,MAAM,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO;AAAC"}
@@ -1,21 +0,0 @@
1
- import { t as w } from "./dist-Z8cIRxoB.js";
2
- /**
3
- * Can take a `result` JSON from a `const {result} = client.fetch(query, params, {filterResponse: false})`
4
- * and remove all stega-encoded data from it.
5
- * If the result type has strings branded as `StegaString` (by `ClientReturnStega` or `stegaBrand()`),
6
- * the brand is stripped and the original string type is restored.
7
- * @public
8
- */
9
- function stegaClean(result) {
10
- return w(result);
11
- }
12
- /**
13
- * Can take a `result` JSON from a `const {result} = client.fetch(query, params, {filterResponse: false})`
14
- * and remove all stega-encoded data from it.
15
- * @alpha
16
- * @deprecated Use `stegaClean` instead
17
- */
18
- const vercelStegaCleanAll = stegaClean;
19
- export { vercelStegaCleanAll as n, stegaClean as t };
20
-
21
- //# sourceMappingURL=stegaClean-C18wLWau.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stegaClean-C18wLWau.js","names":["vercelStegaClean"],"sources":["../src/stega/stegaClean.ts"],"sourcesContent":["import {vercelStegaClean} from '@vercel/stega'\n\n/**\n * The result of removing stega-encoded data from a value with `stegaClean()`: strings that were\n * branded as `StegaString` are returned to their original type, everything else is left as-is.\n * @public\n */\nexport type StegaCleaned<T> = 0 extends 1 & T\n ? T\n : T extends {readonly ' stegaBrand': infer Original extends string}\n ? Original\n : T extends string | number | bigint | boolean | null | undefined\n ? T\n : T extends Date | RegExp | ((...args: never[]) => unknown)\n ? T\n : T extends readonly unknown[]\n ? {[Index in keyof T]: StegaCleaned<T[Index]>}\n : T extends object\n ? {[K in keyof T]: StegaCleaned<T[K]>}\n : T\n\n/**\n * Can take a `result` JSON from a `const {result} = client.fetch(query, params, {filterResponse: false})`\n * and remove all stega-encoded data from it.\n * If the result type has strings branded as `StegaString` (by `ClientReturnStega` or `stegaBrand()`),\n * the brand is stripped and the original string type is restored.\n * @public\n */\nexport function stegaClean<Result = unknown>(result: Result): StegaCleaned<Result> {\n return vercelStegaClean(result) as StegaCleaned<Result>\n}\n\n/**\n * Can take a `result` JSON from a `const {result} = client.fetch(query, params, {filterResponse: false})`\n * and remove all stega-encoded data from it.\n * @alpha\n * @deprecated Use `stegaClean` instead\n */\nexport const vercelStegaCleanAll = stegaClean\n"],"mappings":";;;;;;;;AA4BA,SAAgB,WAA6B,QAAsC;CACjF,OAAOA,EAAiB,MAAM;AAChC;;;;;;;AAQA,MAAa,sBAAsB"}