@sanity/client 8.0.0 → 8.1.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.
Files changed (54) hide show
  1. package/README.md +94 -0
  2. package/dist/{browserUpload-CQgx9YYo.js → browserUpload-2tz6Sdqp.js} +4 -3
  3. package/dist/browserUpload-2tz6Sdqp.js.map +1 -0
  4. package/dist/{browserUpload-icWlVP15.js → browserUpload-CwpNx7Vl.js} +4 -3
  5. package/dist/browserUpload-CwpNx7Vl.js.map +1 -0
  6. package/dist/{config-a8VajuEY.js → config-3wiPP-sZ.js} +2 -2
  7. package/dist/config-3wiPP-sZ.js.map +1 -0
  8. package/dist/csm.js +2 -2
  9. package/dist/csm.js.map +1 -1
  10. package/dist/index.d.ts +17 -11
  11. package/dist/index.js +247 -120
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.node.d.ts +270 -26
  14. package/dist/index.node.js +183 -50
  15. package/dist/index.node.js.map +1 -1
  16. package/dist/media-library.d.ts +1 -1
  17. package/dist/{request-CJxcN16k.js → request-BhMuKj0D.js} +10 -9
  18. package/dist/request-BhMuKj0D.js.map +1 -0
  19. package/dist/{request-k7VS_NnC.js → request-SnMg7nUX.js} +10 -9
  20. package/dist/request-SnMg7nUX.js.map +1 -0
  21. package/dist/{resolveEditInfo-sq7yF78q.js → resolveEditInfo-Cz-smq3a.js} +17 -3
  22. package/dist/resolveEditInfo-Cz-smq3a.js.map +1 -0
  23. package/dist/stega.js +1 -1
  24. package/dist/{stegaEncodeSourceMap-DkoIlutY.js → stegaEncodeSourceMap-DbM2fTN4.js} +8 -2
  25. package/dist/stegaEncodeSourceMap-DbM2fTN4.js.map +1 -0
  26. package/dist/{stegaEncodeSourceMap-B2fGArSf.js → stegaEncodeSourceMap-YR3NQ3iz.js} +2 -2
  27. package/dist/{stegaEncodeSourceMap-B2fGArSf.js.map → stegaEncodeSourceMap-YR3NQ3iz.js.map} +1 -1
  28. package/dist/{types-CUxZSgB2.d.ts → types-BODIEY7F.d.ts} +262 -24
  29. package/package.json +26 -11
  30. package/src/SanityClient.ts +19 -20
  31. package/src/assets/AssetsClient.ts +54 -5
  32. package/src/csm/applySourceDocuments.ts +2 -4
  33. package/src/csm/draftUtils.ts +23 -4
  34. package/src/data/dataMethods.ts +2 -19
  35. package/src/data/eventsource.ts +71 -41
  36. package/src/data/live.ts +17 -9
  37. package/src/data/resolveEventSourceFetch.ts +9 -1
  38. package/src/defineCreateClient.ts +5 -1
  39. package/src/functions/FunctionsClient.ts +66 -0
  40. package/src/functions/invoke.ts +176 -0
  41. package/src/http/browserUpload.ts +1 -0
  42. package/src/http/errors.ts +2 -1
  43. package/src/http/request.ts +8 -14
  44. package/src/mediaLibrary/MediaLibraryVideoClient.ts +1 -1
  45. package/src/types.ts +186 -4
  46. package/src/validators.ts +1 -1
  47. package/src/warnings.ts +7 -1
  48. package/dist/browserUpload-CQgx9YYo.js.map +0 -1
  49. package/dist/browserUpload-icWlVP15.js.map +0 -1
  50. package/dist/config-a8VajuEY.js.map +0 -1
  51. package/dist/request-CJxcN16k.js.map +0 -1
  52. package/dist/request-k7VS_NnC.js.map +0 -1
  53. package/dist/resolveEditInfo-sq7yF78q.js.map +0 -1
  54. package/dist/stegaEncodeSourceMap-DkoIlutY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"stegaEncodeSourceMap-B2fGArSf.js","names":["vercelStegaCombine","studioPathToString"],"sources":["../src/stega/encodeIntoResult.ts","../src/stega/filterDefault.ts","../src/stega/stegaEncodeSourceMap.ts"],"sourcesContent":["import type {ContentSourceMap} from '@sanity/client/csm'\n\nimport {parseJsonPath} from '../csm/jsonPath'\nimport {resolveMapping} from '../csm/resolveMapping'\nimport {walkMap} from '../csm/walkMap'\nimport type {Encoder} from './types'\n\n/**\n * @internal\n */\nexport function encodeIntoResult<Result>(\n result: Result,\n csm: ContentSourceMap,\n encoder: Encoder,\n): Result {\n return walkMap(result, (value, path) => {\n // Only map strings, we could extend this in the future to support other types like integers...\n if (typeof value !== 'string') {\n return value\n }\n\n const resolveMappingResult = resolveMapping(path, csm)\n if (!resolveMappingResult) {\n return value\n }\n\n const {mapping, matchedPath} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = csm.documents[mapping.source.document!]\n const sourcePath = csm.paths[mapping.source.path]\n\n const matchPathSegments = parseJsonPath(matchedPath)\n const sourcePathSegments = parseJsonPath(sourcePath)\n const fullSourceSegments = sourcePathSegments.concat(path.slice(matchPathSegments.length))\n\n return encoder({\n sourcePath: fullSourceSegments,\n sourceDocument,\n resultPath: path,\n value,\n })\n }) as Result\n}\n","import type {ContentSourceMapParsedPath, FilterDefault} from './types'\n\nexport const filterDefault: FilterDefault = ({sourcePath, resultPath, value}) => {\n // Skips encoding on URL or Date strings, similar to the `skip: 'auto'` parameter in vercelStegaCombine()\n if (isValidDate(value) || isValidURL(value)) {\n return false\n }\n\n const endPath = sourcePath.at(-1)\n // Never encode slugs\n if (sourcePath.at(-2) === 'slug' && endPath === 'current') {\n return false\n }\n\n // Skip underscored keys, and strings that end with `Id`, needs better heuristics but it works for now\n if (typeof endPath === 'string' && (endPath.startsWith('_') || endPath.endsWith('Id'))) {\n return false\n }\n\n // Don't encode into anything that is suggested it'll render for SEO in meta tags\n if (\n sourcePath.some(\n (path) => path === 'meta' || path === 'metadata' || path === 'openGraph' || path === 'seo',\n )\n ) {\n return false\n }\n\n // If the sourcePath or resultPath contains something that sounds like a type, like iconType, we skip encoding, as it's most\n // of the time used for logic that breaks if it contains stega characters\n if (hasTypeLike(sourcePath) || hasTypeLike(resultPath)) {\n return false\n }\n\n // Finally, we ignore a bunch of paths that are typically used for page building\n if (typeof endPath === 'string' && denylist.has(endPath)) {\n return false\n }\n\n return true\n}\n\nconst denylist = new Set([\n 'color',\n 'colour',\n 'currency',\n 'email',\n 'format',\n 'gid',\n 'hex',\n 'href',\n 'hsl',\n 'hsla',\n 'icon',\n 'id',\n 'index',\n 'key',\n 'language',\n 'layout',\n 'link',\n 'linkAction',\n 'locale',\n 'lqip',\n 'page',\n 'path',\n 'ref',\n 'rgb',\n 'rgba',\n 'route',\n 'secret',\n 'slug',\n 'status',\n 'tag',\n 'template',\n 'theme',\n 'type',\n 'textTheme',\n 'unit',\n 'url',\n 'username',\n 'variant',\n 'website',\n])\n\nfunction isValidDate(dateString: string) {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(dateString) ? Boolean(Date.parse(dateString)) : false\n}\n\nconst allowedProtocols = new Set([\n 'app:',\n 'data:',\n 'discord:',\n 'file:',\n 'ftp:',\n 'ftps:',\n 'geo:',\n 'http:',\n 'https:',\n 'imap:',\n 'javascript:',\n 'magnet:',\n 'mailto:',\n 'maps:',\n 'ms-excel:',\n 'ms-powerpoint:',\n 'ms-word:',\n 'slack:',\n 'sms:',\n 'spotify:',\n 'steam:',\n 'teams:',\n 'tel:',\n 'vscode:',\n 'zoom:',\n])\n\nfunction isValidURL(url: string) {\n try {\n const {protocol} = new URL(url, url.startsWith('/') ? 'https://acme.com' : undefined)\n return allowedProtocols.has(protocol) || protocol.startsWith('web+')\n } catch {\n return false\n }\n}\n\nfunction hasTypeLike(path: ContentSourceMapParsedPath): boolean {\n return path.some((segment) => typeof segment === 'string' && segment.match(/type/i) !== null)\n}\n","import {vercelStegaCombine} from '@vercel/stega'\n\nimport {createEditUrl} from '../csm/createEditUrl'\nimport {jsonPathToStudioPath} from '../csm/jsonPath'\nimport {resolveStudioBaseRoute} from '../csm/resolveEditInfo'\nimport {reKeySegment, toString as studioPathToString} from '../csm/studioPath'\nimport {encodeIntoResult} from './encodeIntoResult'\n// Re-export so `encodeIntoResult` is a genuine export of this module - which\n// forms its own output chunk via the dynamic import in `dataMethods`. Without\n// this, rolldown absorbs `encodeIntoResult` into the chunk but omits it from\n// the chunk's exports, breaking `@sanity/client/stega`'s re-export of it.\nexport {encodeIntoResult} from './encodeIntoResult'\nimport {filterDefault} from './filterDefault'\nimport {\n type ContentSourceMap,\n type ContentSourceMapParsedPath,\n type InitializedStegaConfig,\n} from './types'\n\nconst TRUNCATE_LENGTH = 20\n\n/**\n * Uses `@vercel/stega` to embed edit info JSON into strings in your query result.\n * The JSON payloads are added using invisible characters so they don't show up visually.\n * The edit info is generated from the Content Source Map (CSM) that is returned from Sanity for the query.\n * @public\n */\nexport function stegaEncodeSourceMap<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n config: InitializedStegaConfig,\n): Result {\n const {filter, logger, enabled} = config\n if (!enabled) {\n const msg = \"config.enabled must be true, don't call this function otherwise\"\n logger?.error?.(`[@sanity/client]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n if (!resultSourceMap) {\n logger?.error?.('[@sanity/client]: Missing Content Source Map from response body', {\n result,\n resultSourceMap,\n config,\n })\n return result\n }\n\n if (!config.studioUrl) {\n const msg = 'config.studioUrl must be defined'\n logger?.error?.(`[@sanity/client]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n const report: Record<'encoded' | 'skipped', {path: string; length: number; value: string}[]> = {\n encoded: [],\n skipped: [],\n }\n\n const resultWithStega = encodeIntoResult(\n result,\n resultSourceMap,\n ({sourcePath, sourceDocument, resultPath, value}) => {\n // Allow userland to control when to opt-out of encoding\n if (\n (typeof filter === 'function'\n ? filter({sourcePath, resultPath, filterDefault, sourceDocument, value})\n : filterDefault({sourcePath, resultPath, filterDefault, sourceDocument, value})) === false\n ) {\n if (logger) {\n report.skipped.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${\n value.length > TRUNCATE_LENGTH ? '...' : ''\n }`,\n length: value.length,\n })\n }\n return value\n }\n\n if (logger) {\n report.encoded.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? '...' : ''}`,\n length: value.length,\n })\n }\n\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof config.studioUrl === 'function'\n ? config.studioUrl(sourceDocument)\n : config.studioUrl!,\n )\n if (!baseUrl) return value\n const {_id: id, _type: type, _projectId: projectId, _dataset: dataset} = sourceDocument\n\n return vercelStegaCombine(\n value,\n {\n origin: 'sanity.io',\n href: createEditUrl({\n baseUrl,\n workspace,\n tool,\n id,\n type,\n path: sourcePath,\n ...(!config.omitCrossDatasetReferenceData && {dataset, projectId}),\n }),\n },\n // We use custom logic to determine if we should skip encoding\n false,\n )\n },\n )\n\n if (logger) {\n const isSkipping = report.skipped.length\n const isEncoding = report.encoded.length\n if (isSkipping || isEncoding) {\n ;(logger?.groupCollapsed || logger.log)?.('[@sanity/client]: Encoding source map into result')\n logger.log?.(\n `[@sanity/client]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`,\n )\n }\n if (report.encoded.length > 0) {\n logger?.log?.(`[@sanity/client]: Table of encoded paths`)\n ;(logger?.table || logger.log)?.(report.encoded)\n }\n if (report.skipped.length > 0) {\n const skipped = new Set<string>()\n for (const {path} of report.skipped) {\n skipped.add(path.replace(reKeySegment, '0').replace(/\\[\\d+\\]/g, '[]'))\n }\n logger?.log?.(`[@sanity/client]: List of skipped paths`, [...skipped.values()])\n }\n\n if (isSkipping || isEncoding) {\n logger?.groupEnd?.()\n }\n }\n\n return resultWithStega\n}\n\nfunction prettyPathForLogging(path: ContentSourceMapParsedPath): string {\n return studioPathToString(jsonPathToStudioPath(path))\n}\n"],"mappings":";;;;;;AAUA,SAAgB,iBACd,QACA,KACA,SACQ;CACR,OAAO,QAAQ,SAAS,OAAO,SAAS;EAEtC,IAAI,OAAO,SAAU,UACnB,OAAO;EAGT,IAAM,uBAAuB,eAAe,MAAM,GAAG;EACrD,IAAI,CAAC,sBACH,OAAO;EAGT,IAAM,EAAC,SAAS,gBAAe;EAK/B,IAJI,QAAQ,SAAS,WAIjB,QAAQ,OAAO,SAAS,iBAC1B,OAAO;EAGT,IAAM,iBAA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b;EACA,IAAI,CAAC,SAAS,OAAO;EACrB,IAAM,EAAC,KAAK,IAAI,OAAO,MAAM,YAAY,WAAW,UAAU,YAAW;EAEzE,OAAOA,EACL,OACA;GACE,QAAQ;GACR,MAAM,cAAc;IAClB;IACA;IACA;IACA;IACA;IACA,MAAM;IACN,GAAI,CAAC,OAAO,iCAAiC;KAAC;KAAS;IAAS;GAClE,CAAC;EACH,GAEA,EACF;CACF,CACF;CAEA,IAAI,QAAQ;EACV,IAAM,aAAa,OAAO,QAAQ,QAC5B,aAAa,OAAO,QAAQ;EAWlC,KAVI,cAAc,iBACd,QAAQ,kBAAkB,OAAO,IAAA,GAAO,mDAAmD,GAC7F,OAAO,MACL,oCAAoC,OAAO,QAAQ,OAAO,aAAa,OAAO,QAAQ,QACxF,IAEE,OAAO,QAAQ,SAAS,MAC1B,QAAQ,MAAM,0CAA0C,IACtD,QAAQ,SAAS,OAAO,IAAA,GAAO,OAAO,OAAO,IAE7C,OAAO,QAAQ,SAAS,GAAG;GAC7B,IAAM,0BAAU,IAAI,IAAY;GAChC,KAAK,IAAM,EAAC,UAAS,OAAO,SAC1B,QAAQ,IAAI,KAAK,QAAQ,cAAc,GAAG,CAAC,CAAC,QAAQ,YAAY,IAAI,CAAC;GAEvE,QAAQ,MAAM,2CAA2C,CAAC,GAAG,QAAQ,OAAO,CAAC,CAAC;EAChF;EAEA,CAAI,cAAc,eAChB,QAAQ,WAAW;CAEvB;CAEA,OAAO;AACT;AAEA,SAAS,qBAAqB,MAA0C;CACtE,OAAOC,SAAmB,qBAAqB,IAAI,CAAC;AACtD"}
1
+ {"version":3,"file":"stegaEncodeSourceMap-YR3NQ3iz.js","names":["vercelStegaCombine","studioPathToString"],"sources":["../src/stega/encodeIntoResult.ts","../src/stega/filterDefault.ts","../src/stega/stegaEncodeSourceMap.ts"],"sourcesContent":["import type {ContentSourceMap} from '@sanity/client/csm'\n\nimport {parseJsonPath} from '../csm/jsonPath'\nimport {resolveMapping} from '../csm/resolveMapping'\nimport {walkMap} from '../csm/walkMap'\nimport type {Encoder} from './types'\n\n/**\n * @internal\n */\nexport function encodeIntoResult<Result>(\n result: Result,\n csm: ContentSourceMap,\n encoder: Encoder,\n): Result {\n return walkMap(result, (value, path) => {\n // Only map strings, we could extend this in the future to support other types like integers...\n if (typeof value !== 'string') {\n return value\n }\n\n const resolveMappingResult = resolveMapping(path, csm)\n if (!resolveMappingResult) {\n return value\n }\n\n const {mapping, matchedPath} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = csm.documents[mapping.source.document!]\n const sourcePath = csm.paths[mapping.source.path]\n\n const matchPathSegments = parseJsonPath(matchedPath)\n const sourcePathSegments = parseJsonPath(sourcePath)\n const fullSourceSegments = sourcePathSegments.concat(path.slice(matchPathSegments.length))\n\n return encoder({\n sourcePath: fullSourceSegments,\n sourceDocument,\n resultPath: path,\n value,\n })\n }) as Result\n}\n","import type {ContentSourceMapParsedPath, FilterDefault} from './types'\n\nexport const filterDefault: FilterDefault = ({sourcePath, resultPath, value}) => {\n // Skips encoding on URL or Date strings, similar to the `skip: 'auto'` parameter in vercelStegaCombine()\n if (isValidDate(value) || isValidURL(value)) {\n return false\n }\n\n const endPath = sourcePath.at(-1)\n // Never encode slugs\n if (sourcePath.at(-2) === 'slug' && endPath === 'current') {\n return false\n }\n\n // Skip underscored keys, and strings that end with `Id`, needs better heuristics but it works for now\n if (typeof endPath === 'string' && (endPath.startsWith('_') || endPath.endsWith('Id'))) {\n return false\n }\n\n // Don't encode into anything that is suggested it'll render for SEO in meta tags\n if (\n sourcePath.some(\n (path) => path === 'meta' || path === 'metadata' || path === 'openGraph' || path === 'seo',\n )\n ) {\n return false\n }\n\n // If the sourcePath or resultPath contains something that sounds like a type, like iconType, we skip encoding, as it's most\n // of the time used for logic that breaks if it contains stega characters\n if (hasTypeLike(sourcePath) || hasTypeLike(resultPath)) {\n return false\n }\n\n // Finally, we ignore a bunch of paths that are typically used for page building\n if (typeof endPath === 'string' && denylist.has(endPath)) {\n return false\n }\n\n return true\n}\n\nconst denylist = new Set([\n 'color',\n 'colour',\n 'currency',\n 'email',\n 'format',\n 'gid',\n 'hex',\n 'href',\n 'hsl',\n 'hsla',\n 'icon',\n 'id',\n 'index',\n 'key',\n 'language',\n 'layout',\n 'link',\n 'linkAction',\n 'locale',\n 'lqip',\n 'page',\n 'path',\n 'ref',\n 'rgb',\n 'rgba',\n 'route',\n 'secret',\n 'slug',\n 'status',\n 'tag',\n 'template',\n 'theme',\n 'type',\n 'textTheme',\n 'unit',\n 'url',\n 'username',\n 'variant',\n 'website',\n])\n\nfunction isValidDate(dateString: string) {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(dateString) ? Boolean(Date.parse(dateString)) : false\n}\n\nconst allowedProtocols = new Set([\n 'app:',\n 'data:',\n 'discord:',\n 'file:',\n 'ftp:',\n 'ftps:',\n 'geo:',\n 'http:',\n 'https:',\n 'imap:',\n 'javascript:',\n 'magnet:',\n 'mailto:',\n 'maps:',\n 'ms-excel:',\n 'ms-powerpoint:',\n 'ms-word:',\n 'slack:',\n 'sms:',\n 'spotify:',\n 'steam:',\n 'teams:',\n 'tel:',\n 'vscode:',\n 'zoom:',\n])\n\nfunction isValidURL(url: string) {\n try {\n const {protocol} = new URL(url, url.startsWith('/') ? 'https://acme.com' : undefined)\n return allowedProtocols.has(protocol) || protocol.startsWith('web+')\n } catch {\n return false\n }\n}\n\nfunction hasTypeLike(path: ContentSourceMapParsedPath): boolean {\n return path.some((segment) => typeof segment === 'string' && segment.match(/type/i) !== null)\n}\n","import {vercelStegaCombine} from '@vercel/stega'\n\nimport {createEditUrl} from '../csm/createEditUrl'\nimport {jsonPathToStudioPath} from '../csm/jsonPath'\nimport {resolveStudioBaseRoute} from '../csm/resolveEditInfo'\nimport {reKeySegment, toString as studioPathToString} from '../csm/studioPath'\nimport {encodeIntoResult} from './encodeIntoResult'\n// Re-export so `encodeIntoResult` is a genuine export of this module - which\n// forms its own output chunk via the dynamic import in `dataMethods`. Without\n// this, rolldown absorbs `encodeIntoResult` into the chunk but omits it from\n// the chunk's exports, breaking `@sanity/client/stega`'s re-export of it.\nexport {encodeIntoResult} from './encodeIntoResult'\nimport {filterDefault} from './filterDefault'\nimport {\n type ContentSourceMap,\n type ContentSourceMapParsedPath,\n type InitializedStegaConfig,\n} from './types'\n\nconst TRUNCATE_LENGTH = 20\n\n/**\n * Uses `@vercel/stega` to embed edit info JSON into strings in your query result.\n * The JSON payloads are added using invisible characters so they don't show up visually.\n * The edit info is generated from the Content Source Map (CSM) that is returned from Sanity for the query.\n * @public\n */\nexport function stegaEncodeSourceMap<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n config: InitializedStegaConfig,\n): Result {\n const {filter, logger, enabled} = config\n if (!enabled) {\n const msg = \"config.enabled must be true, don't call this function otherwise\"\n logger?.error?.(`[@sanity/client]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n if (!resultSourceMap) {\n logger?.error?.('[@sanity/client]: Missing Content Source Map from response body', {\n result,\n resultSourceMap,\n config,\n })\n return result\n }\n\n if (!config.studioUrl) {\n const msg = 'config.studioUrl must be defined'\n logger?.error?.(`[@sanity/client]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n const report: Record<'encoded' | 'skipped', {path: string; length: number; value: string}[]> = {\n encoded: [],\n skipped: [],\n }\n\n const resultWithStega = encodeIntoResult(\n result,\n resultSourceMap,\n ({sourcePath, sourceDocument, resultPath, value}) => {\n // Allow userland to control when to opt-out of encoding\n if (\n (typeof filter === 'function'\n ? filter({sourcePath, resultPath, filterDefault, sourceDocument, value})\n : filterDefault({sourcePath, resultPath, filterDefault, sourceDocument, value})) === false\n ) {\n if (logger) {\n report.skipped.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${\n value.length > TRUNCATE_LENGTH ? '...' : ''\n }`,\n length: value.length,\n })\n }\n return value\n }\n\n if (logger) {\n report.encoded.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? '...' : ''}`,\n length: value.length,\n })\n }\n\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof config.studioUrl === 'function'\n ? config.studioUrl(sourceDocument)\n : config.studioUrl!,\n )\n if (!baseUrl) return value\n const {_id: id, _type: type, _projectId: projectId, _dataset: dataset} = sourceDocument\n\n return vercelStegaCombine(\n value,\n {\n origin: 'sanity.io',\n href: createEditUrl({\n baseUrl,\n workspace,\n tool,\n id,\n type,\n path: sourcePath,\n ...(!config.omitCrossDatasetReferenceData && {dataset, projectId}),\n }),\n },\n // We use custom logic to determine if we should skip encoding\n false,\n )\n },\n )\n\n if (logger) {\n const isSkipping = report.skipped.length\n const isEncoding = report.encoded.length\n if (isSkipping || isEncoding) {\n ;(logger?.groupCollapsed || logger.log)?.('[@sanity/client]: Encoding source map into result')\n logger.log?.(\n `[@sanity/client]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`,\n )\n }\n if (report.encoded.length > 0) {\n logger?.log?.(`[@sanity/client]: Table of encoded paths`)\n ;(logger?.table || logger.log)?.(report.encoded)\n }\n if (report.skipped.length > 0) {\n const skipped = new Set<string>()\n for (const {path} of report.skipped) {\n skipped.add(path.replace(reKeySegment, '0').replace(/\\[\\d+\\]/g, '[]'))\n }\n logger?.log?.(`[@sanity/client]: List of skipped paths`, [...skipped.values()])\n }\n\n if (isSkipping || isEncoding) {\n logger?.groupEnd?.()\n }\n }\n\n return resultWithStega\n}\n\nfunction prettyPathForLogging(path: ContentSourceMapParsedPath): string {\n return studioPathToString(jsonPathToStudioPath(path))\n}\n"],"mappings":";;;;;;AAUA,SAAgB,iBACd,QACA,KACA,SACQ;CACR,OAAO,QAAQ,SAAS,OAAO,SAAS;EAEtC,IAAI,OAAO,SAAU,UACnB,OAAO;EAGT,IAAM,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2
- import { FetchFunction } from "get-it";
2
+ import { FetchFunction, RequestOptions } from "get-it";
3
3
  import { Observable } from "rxjs";
4
4
  import { ClientPerspective } from "@sanity/client";
5
5
  /**
@@ -1066,6 +1066,16 @@ declare class AssetsClient {
1066
1066
  /**
1067
1067
  * Uploads a file asset to the configured dataset
1068
1068
  *
1069
+ * Note: when the client is configured against a Media Library
1070
+ * (`resource: {type: 'media-library', id}`), this resolves to a
1071
+ * {@link MediaLibraryAssetDocument} at runtime, not to a
1072
+ * {@link SanityAssetDocument}. The declared type cannot express that: the
1073
+ * shape depends on the client's configuration rather than on the arguments,
1074
+ * so an overload cannot discriminate it, and widening the return type into a
1075
+ * union would be a breaking change for every existing caller. Narrow the
1076
+ * result yourself (for example, check for `currentVersion`) if you upload to
1077
+ * a Media Library. Typing this honestly is deferred to the next major.
1078
+ *
1069
1079
  * @param assetType - Asset type (file)
1070
1080
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
1071
1081
  * @param options - Options to use for the upload
@@ -1074,6 +1084,10 @@ declare class AssetsClient {
1074
1084
  /**
1075
1085
  * Uploads an image asset to the configured dataset
1076
1086
  *
1087
+ * Note: against a Media Library this resolves to a
1088
+ * {@link MediaLibraryAssetDocument} at runtime. See the `'file'` overload
1089
+ * above for why the declared type cannot say so.
1090
+ *
1077
1091
  * @param assetType - Asset type (image)
1078
1092
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
1079
1093
  * @param options - Options to use for the upload
@@ -1593,6 +1607,72 @@ declare class DatasetsClient {
1593
1607
  */
1594
1608
  editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void>;
1595
1609
  }
1610
+ /** @public */
1611
+ interface InvokeFunctionEvent {
1612
+ /**
1613
+ * Payload handed to the function.
1614
+ * The function receives it as `event.data`.
1615
+ */
1616
+ data?: unknown;
1617
+ }
1618
+ /** @public */
1619
+ interface InvokeFunctionRequest {
1620
+ event?: InvokeFunctionEvent;
1621
+ /**
1622
+ * Stack to resolve the function name against.
1623
+ * Overrides `stackId` from the client config.
1624
+ */
1625
+ stackId?: string;
1626
+ /**
1627
+ * Organization owning the stack.
1628
+ */
1629
+ organizationId?: string;
1630
+ /**
1631
+ * Milliseconds to wait for the function to return.
1632
+ */
1633
+ timeout?: number;
1634
+ /** Abort the invocation. */
1635
+ signal?: AbortSignal;
1636
+ }
1637
+ /** @public */
1638
+ declare class ObservableFunctionsClient {
1639
+ #private;
1640
+ constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
1641
+ /**
1642
+ * Invoke a deployed function by its blueprint name.
1643
+ *
1644
+ * The name is resolved within the stack given by `stackId` on the request or
1645
+ * the client config. Passes the function's return value once it finishes.
1646
+ *
1647
+ * @param functionName - name of the function, as declared in the blueprint
1648
+ * @param request - payload and request options
1649
+ */
1650
+ invoke<R = unknown>(functionName: string, request?: InvokeFunctionRequest): Observable<R | undefined>;
1651
+ }
1652
+ /** @public */
1653
+ declare class FunctionsClient {
1654
+ #private;
1655
+ constructor(client: SanityClient$1, httpRequest: HttpRequest);
1656
+ /**
1657
+ * Invoke a deployed function by its blueprint name.
1658
+ *
1659
+ * The name is resolved within the stack given by `stackId` on the request or
1660
+ * the client config, which costs one extra request per call. Rejects if the
1661
+ * stack has no function by that name, or if the name resolves to anything
1662
+ * other than a `sanity.function.pubsub` function.
1663
+ *
1664
+ * The lookup is scoped to `projectId`, or to `organizationId` when one is set
1665
+ * for a stack deployed at organization scope.
1666
+ *
1667
+ * The request stays open until the function finishes, and resolves with its
1668
+ * return value, or `undefined` if it returns nothing. Long-running functions
1669
+ * may need an explicit `timeout`.
1670
+ *
1671
+ * @param functionName - name of the function, as declared in the blueprint
1672
+ * @param request - payload and request options
1673
+ */
1674
+ invoke<R = unknown>(functionName: string, request?: InvokeFunctionRequest): Promise<R | undefined>;
1675
+ }
1596
1676
  /** @internal */
1597
1677
  declare class ObservableMediaLibraryVideoClient {
1598
1678
  #private;
@@ -2187,6 +2267,7 @@ declare class ObservableSanityClient$1 {
2187
2267
  agent: {
2188
2268
  action: ObservableAgentsActionClient;
2189
2269
  };
2270
+ functions: ObservableFunctionsClient;
2190
2271
  releases: ObservableReleasesClient;
2191
2272
  /**
2192
2273
  * Instance properties
@@ -2526,12 +2607,12 @@ declare class ObservableSanityClient$1 {
2526
2607
  delete(id: string, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
2527
2608
  /**
2528
2609
  * Deletes a document with the given document ID.
2529
- * Returns an observable that resolves to the deleted document.
2610
+ * Returns an observable that resolves to a mutation result object containing the deleted document ID.
2530
2611
  *
2531
2612
  * @param id - Document ID to delete
2532
2613
  * @param options - Options for the mutation
2533
2614
  */
2534
- delete<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options?: BaseMutationOptions): Observable<SanityDocument$1<R>>;
2615
+ delete(id: string, options?: BaseMutationOptions): Observable<MultipleMutationResult>;
2535
2616
  /**
2536
2617
  * Deletes one or more documents matching the given query or document ID.
2537
2618
  * Returns an observable that resolves to first deleted document.
@@ -2566,12 +2647,12 @@ declare class ObservableSanityClient$1 {
2566
2647
  delete(selection: MutationSelection, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
2567
2648
  /**
2568
2649
  * Deletes one or more documents matching the given query or document ID.
2569
- * Returns an observable that resolves to first deleted document.
2650
+ * Returns an observable that resolves to a mutation result object containing the document IDs that were deleted.
2570
2651
  *
2571
2652
  * @param selection - An object with either an `id` or `query` key defining what to delete
2572
2653
  * @param options - Options for the mutation
2573
2654
  */
2574
- delete<R extends Record<string, Any$1> = Record<string, Any$1>>(selection: MutationSelection, options?: BaseMutationOptions): Observable<SanityDocument$1<R>>;
2655
+ delete(selection: MutationSelection, options?: BaseMutationOptions): Observable<MultipleMutationResult>;
2575
2656
  /**
2576
2657
  * @public
2577
2658
  *
@@ -2738,12 +2819,12 @@ declare class ObservableSanityClient$1 {
2738
2819
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
2739
2820
  /**
2740
2821
  * Perform mutation operations against the configured dataset
2741
- * Returns an observable that resolves to the first mutated document.
2822
+ * Returns an observable that resolves to a mutation result object containing the mutated document IDs.
2742
2823
  *
2743
2824
  * @param operations - Mutation operations to execute
2744
2825
  * @param options - Mutation options
2745
2826
  */
2746
- mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options?: BaseMutationOptions): Observable<SanityDocument$1<R>>;
2827
+ mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options?: BaseMutationOptions): Observable<MultipleMutationResult>;
2747
2828
  /**
2748
2829
  * Create a new buildable patch of operations to perform
2749
2830
  *
@@ -2816,6 +2897,7 @@ declare class SanityClient$1 {
2816
2897
  agent: {
2817
2898
  action: AgentActionsClient;
2818
2899
  };
2900
+ functions: FunctionsClient;
2819
2901
  releases: ReleasesClient;
2820
2902
  /**
2821
2903
  * Observable version of the Sanity client, with the same configuration as the promise-based one
@@ -3148,12 +3230,12 @@ declare class SanityClient$1 {
3148
3230
  delete(id: string, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
3149
3231
  /**
3150
3232
  * Deletes a document with the given document ID.
3151
- * Returns a promise that resolves to the deleted document.
3233
+ * Returns a promise that resolves to a mutation result object containing the deleted document ID.
3152
3234
  *
3153
3235
  * @param id - Document ID to delete
3154
3236
  * @param options - Options for the mutation
3155
3237
  */
3156
- delete<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options?: BaseMutationOptions): Promise<SanityDocument$1<R>>;
3238
+ delete(id: string, options?: BaseMutationOptions): Promise<MultipleMutationResult>;
3157
3239
  /**
3158
3240
  * Deletes one or more documents matching the given query or document ID.
3159
3241
  * Returns a promise that resolves to first deleted document.
@@ -3188,12 +3270,12 @@ declare class SanityClient$1 {
3188
3270
  delete(selection: MutationSelection, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
3189
3271
  /**
3190
3272
  * Deletes one or more documents matching the given query or document ID.
3191
- * Returns a promise that resolves to first deleted document.
3273
+ * Returns a promise that resolves to a mutation result object containing the document IDs that were deleted.
3192
3274
  *
3193
3275
  * @param selection - An object with either an `id` or `query` key defining what to delete
3194
3276
  * @param options - Options for the mutation
3195
3277
  */
3196
- delete<R extends Record<string, Any$1> = Record<string, Any$1>>(selection: MutationSelection, options?: BaseMutationOptions): Promise<SanityDocument$1<R>>;
3278
+ delete(selection: MutationSelection, options?: BaseMutationOptions): Promise<MultipleMutationResult>;
3197
3279
  /**
3198
3280
  * @public
3199
3281
  *
@@ -3360,12 +3442,12 @@ declare class SanityClient$1 {
3360
3442
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
3361
3443
  /**
3362
3444
  * Perform mutation operations against the configured dataset
3363
- * Returns a promise that resolves to the first mutated document.
3445
+ * Returns a promise that resolves to a mutation result object containing the mutated document IDs.
3364
3446
  *
3365
3447
  * @param operations - Mutation operations to execute
3366
3448
  * @param options - Mutation options
3367
3449
  */
3368
- mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options?: BaseMutationOptions): Promise<SanityDocument$1<R>>;
3450
+ mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options?: BaseMutationOptions): Promise<MultipleMutationResult>;
3369
3451
  /**
3370
3452
  * Create a new buildable patch of operations to perform
3371
3453
  *
@@ -3687,8 +3769,9 @@ type GenerateAsyncInstruction<T extends Record<string, Any$1> = Record<string, A
3687
3769
  /** @beta */
3688
3770
  type GenerateInstruction<T extends Record<string, Any$1> = Record<string, Any$1>> = GenerateSyncInstruction<T> | GenerateAsyncInstruction<T>;
3689
3771
  /**
3690
- * Low-level requester returned by `defineHttpRequest`. Surfaces as
3691
- * `client.config().requester` and as the named `requester` export.
3772
+ * Low-level requester returned by `defineRequester(...).observable`.
3773
+ * Surfaces as `client.config().requester` and as the named `requester`
3774
+ * export.
3692
3775
  *
3693
3776
  * Defined locally rather than imported from `http/request` so api-extractor
3694
3777
  * inlines it into the bundled `.d.ts` instead of emitting a relative import
@@ -3710,7 +3793,7 @@ declare global {
3710
3793
  /** @public */
3711
3794
  type UploadBody = File | Blob | Buffer | NodeJS.ReadableStream;
3712
3795
  /** @public */
3713
- interface RequestOptions {
3796
+ interface RequestOptions$1 {
3714
3797
  timeout?: number;
3715
3798
  token?: string;
3716
3799
  tag?: string;
@@ -3720,6 +3803,25 @@ interface RequestOptions {
3720
3803
  body?: Any$1;
3721
3804
  signal?: AbortSignal;
3722
3805
  }
3806
+ /**
3807
+ * The fully resolved request passed to a {@link RequestHandler}.
3808
+ *
3809
+ * @public
3810
+ */
3811
+ type RequestHandlerOptions = RequestOptions;
3812
+ /**
3813
+ * Intercepts a client request around the normal HTTP pipeline.
3814
+ *
3815
+ * Call `next(request)` to execute the request. It resolves to the parsed
3816
+ * response body and rejects with the same errors the client normally exposes,
3817
+ * including {@link ClientError} and {@link ServerError}. A handler can modify
3818
+ * the request, retry it by calling `next` again, or return a synthetic body.
3819
+ *
3820
+ * Browser asset uploads and server-sent event connections do not use this handler.
3821
+ *
3822
+ * @public
3823
+ */
3824
+ type RequestHandler = (request: RequestHandlerOptions, next: (request: RequestHandlerOptions) => Promise<unknown>) => Promise<unknown>;
3723
3825
  /**
3724
3826
  * @public
3725
3827
  * @deprecated – The `r`-prefix is not required, use `string` instead
@@ -3812,6 +3914,19 @@ interface ClientConfig$1 {
3812
3914
  * Optional request tag prefix for all request tags
3813
3915
  */
3814
3916
  requestTagPrefix?: string;
3917
+ /**
3918
+ * Intercepts requests after the client has resolved their URL, headers, and
3919
+ * transport options. The handler wraps the normal client pipeline, so errors
3920
+ * from `next` are already converted to {@link ClientError} or
3921
+ * {@link ServerError}.
3922
+ *
3923
+ * A handler supplied through `withConfig()` replaces the current handler.
3924
+ * To compose handlers, read the current handler from `client.config()` and
3925
+ * call it from the replacement.
3926
+ *
3927
+ * Browser asset uploads and server-sent event connections are not intercepted.
3928
+ */
3929
+ requestHandler?: RequestHandler;
3815
3930
  /**
3816
3931
  * Optional default headers to include with all requests
3817
3932
  *
@@ -3901,6 +4016,15 @@ interface ClientConfig$1 {
3901
4016
  * Lineage token for recursion control
3902
4017
  */
3903
4018
  lineage?: string;
4019
+ /**
4020
+ * ID of the blueprints stack that `functions.invoke()` resolves function
4021
+ * names against. Function names are unique within a stack
4022
+ */
4023
+ stackId?: string;
4024
+ /**
4025
+ * ID of the organization owning the blueprints stack
4026
+ */
4027
+ organizationId?: string;
3904
4028
  }
3905
4029
  /** @public */
3906
4030
  interface InitializedClientConfig$1 extends ClientConfig$1 {
@@ -4095,7 +4219,7 @@ interface ErrorProps {
4095
4219
  * @internal
4096
4220
  */
4097
4221
  type HttpRequest = {
4098
- (options: Any$1): Promise<unknown>;
4222
+ (options: Any$1, requestHandler?: RequestHandler): Promise<unknown>;
4099
4223
  };
4100
4224
  /**
4101
4225
  * Target URL for a request. Exactly one of `url` or the deprecated `uri` alias
@@ -4114,7 +4238,7 @@ type RequestUrlOptions = {
4114
4238
  url?: never;
4115
4239
  };
4116
4240
  /** @internal */
4117
- type RequestObservableOptions = RequestUrlOptions & Omit<RequestOptions, 'url'> & {
4241
+ type RequestObservableOptions = RequestUrlOptions & Omit<RequestOptions$1, 'url'> & {
4118
4242
  canUseCdn?: boolean;
4119
4243
  useCdn?: boolean;
4120
4244
  tag?: string;
@@ -4375,10 +4499,15 @@ type Mutation<R extends Record<string, Any$1> = Record<string, Any$1>> = {
4375
4499
  };
4376
4500
  /** @public */
4377
4501
  type ReleaseAction = CreateReleaseAction | EditReleaseAction | PublishReleaseAction | ArchiveReleaseAction | UnarchiveReleaseAction | ScheduleReleaseAction | UnscheduleReleaseAction | DeleteReleaseAction | ImportReleaseAction;
4502
+ /**
4503
+ * @public
4504
+ * @beta
4505
+ */
4506
+ type VariantDefinitionAction = CreateVariantDefinitionAction | EditVariantDefinitionAction | DeleteVariantDefinitionAction;
4378
4507
  /** @public */
4379
4508
  type VersionAction = CreateVersionAction | DiscardVersionAction | ReplaceVersionAction | UnpublishVersionAction;
4380
4509
  /** @public */
4381
- type Action = CreateAction | ReplaceDraftAction | EditAction | DeleteAction | DiscardAction | PublishAction | UnpublishAction | VersionAction | ReleaseAction;
4510
+ type Action = CreateAction | ReplaceDraftAction | EditAction | DeleteAction | DiscardAction | PublishAction | UnpublishAction | VersionAction | ReleaseAction | VariantDefinitionAction;
4382
4511
  /** @public */
4383
4512
  type ImportReleaseAction = {
4384
4513
  actionType: 'sanity.action.release.import';
@@ -4517,6 +4646,76 @@ interface UnpublishVersionAction {
4517
4646
  versionId: string;
4518
4647
  publishedId: string;
4519
4648
  }
4649
+ /**
4650
+ * Creates a new `system.variant` definition document.
4651
+ *
4652
+ * @public
4653
+ * @beta
4654
+ */
4655
+ interface CreateVariantDefinitionAction {
4656
+ actionType: 'sanity.action.variant.definition.create';
4657
+ /**
4658
+ * Name of the variant definition to create, as in
4659
+ * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
4660
+ */
4661
+ variantId: string;
4662
+ /**
4663
+ * Conditions used to select this variant.
4664
+ */
4665
+ conditions?: ClientVariantConditions;
4666
+ /**
4667
+ * Selection priority. Higher values are preferred when multiple variants
4668
+ * match.
4669
+ *
4670
+ * Defaults to `0`.
4671
+ */
4672
+ priority?: number;
4673
+ metadata?: Record<string, Any$1>;
4674
+ }
4675
+ /**
4676
+ * Edits an existing variant definition.
4677
+ *
4678
+ * @public
4679
+ * @beta
4680
+ */
4681
+ interface EditVariantDefinitionAction {
4682
+ actionType: 'sanity.action.variant.definition.edit';
4683
+ /**
4684
+ * Name of the variant definition to edit, as in `_.variants.{variantName}`.
4685
+ * Must be a bare name, not a full document ID.
4686
+ */
4687
+ variantId: string;
4688
+ /**
4689
+ * Patch operations to apply.
4690
+ */
4691
+ patch: PatchOperations;
4692
+ /**
4693
+ * When set, the action fails unless the current revision of the variant
4694
+ * definition matches this value.
4695
+ */
4696
+ ifRevisionId?: string;
4697
+ }
4698
+ /**
4699
+ * Deletes a variant definition.
4700
+ *
4701
+ * Deletion fails if any document holds a strong reference to this variant.
4702
+ *
4703
+ * @public
4704
+ * @beta
4705
+ */
4706
+ interface DeleteVariantDefinitionAction {
4707
+ actionType: 'sanity.action.variant.definition.delete';
4708
+ /**
4709
+ * Name of the variant definition to delete, as in
4710
+ * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
4711
+ */
4712
+ variantId: string;
4713
+ /**
4714
+ * When set, the action fails unless the current revision of the variant
4715
+ * definition matches this value.
4716
+ */
4717
+ ifRevisionId?: string;
4718
+ }
4520
4719
  /**
4521
4720
  * Creates a new draft document. The published version of the document must not already exist.
4522
4721
  * If the draft version of the document already exists the action will fail by default, but
@@ -4949,7 +5148,7 @@ interface ResumableListenOptions extends Omit<ListenOptions, 'events' | 'enableR
4949
5148
  events?: ResumableListenEventNames[];
4950
5149
  }
4951
5150
  /** @public */
4952
- interface ResponseQueryOptions extends RequestOptions {
5151
+ interface ResponseQueryOptions extends RequestOptions$1 {
4953
5152
  perspective?: ClientPerspective$1;
4954
5153
  /**
4955
5154
  * @beta
@@ -5008,7 +5207,7 @@ interface RawQueryResponse$1<R> {
5008
5207
  /** @public */
5009
5208
  type RawQuerylessQueryResponse<R> = Omit<RawQueryResponse$1<R>, 'query'>;
5010
5209
  /** @internal */
5011
- type BaseMutationOptions = RequestOptions & {
5210
+ type BaseMutationOptions = RequestOptions$1 & {
5012
5211
  visibility?: 'sync' | 'async' | 'deferred';
5013
5212
  returnDocuments?: boolean;
5014
5213
  returnFirst?: boolean;
@@ -5084,7 +5283,7 @@ type TransactionAllDocumentIdsMutationOptions = BaseMutationOptions & {
5084
5283
  /** @internal */
5085
5284
  type TransactionMutationOptions = TransactionFirstDocumentMutationOptions | TransactionFirstDocumentIdMutationOptions | TransactionAllDocumentsMutationOptions | TransactionAllDocumentIdsMutationOptions;
5086
5285
  /** @internal */
5087
- type BaseActionOptions = RequestOptions & {
5286
+ type BaseActionOptions = RequestOptions$1 & {
5088
5287
  transactionId?: string;
5089
5288
  skipCrossDatasetReferenceValidation?: boolean;
5090
5289
  dryRun?: boolean;
@@ -5498,5 +5697,44 @@ interface VideoPlaybackTokens {
5498
5697
  }
5499
5698
  /** @public */
5500
5699
  type MediaLibraryAssetInstanceIdentifier = string | SanityReference;
5501
- export { EditableReleaseDocument as $, VideoRenditionInfo as $n, DocumentAgentActionParam as $r, ReleaseState as $t, ContentSourceMapMappings as A, TransactionAllDocumentsMutationOptions as An, LiveClient as Ar, MutationEvent as At, DatasetAclMode as B, UploadBody as Bn, TransformTarget as Br, PublishReleaseAction as Bt, ContentSourceMap$1 as C, SingleMutationResult as Cn, ObservablePatchBuilder as Cr, MediaLibraryPlaybackInfoOptions as Ct, ContentSourceMapDocuments$1 as D, SyncTag as Dn, BasePatch as Dr, Mutation as Dt, ContentSourceMapDocumentValueSource as E, StoryboardTransformOptions as En, Transaction as Er, MultipleMutationResult as Et, ContentSourceMapValueMapping as F, UnfilteredResponseQueryOptions as Fn, TranslateTarget as Fr, PartialExcept as Ft, DeleteAction as G, VersionAction as Gn, PatchOperation as Gr, RawQueryResponse$1 as Gt, DatasetEditOptions as H, UploadEvent as Hn, TransformTargetInclude as Hr, QueryParams as Ht, CreateAction as I, UnfilteredResponseWithoutQuery as In, TranslateTargetInclude as Ir, PatchMutationOperation as It, DiscardVersionAction as J, VideoPlaybackInfoItemPublic as Jn, AgentActionParams as Jr, ReconnectEvent as Jt, DeleteReleaseAction as K, VideoPlaybackInfo as Kn, PatchTarget as Kr, RawQuerylessQueryResponse as Kt, CreateReleaseAction as L, UnpublishAction as Ln, ImageDescriptionOperation as Lr, PatchOperations as Lt, ContentSourceMapRemoteDocument as M, TransactionFirstDocumentMutationOptions as Mn, AssetsClient as Mr, MutationSelection as Mt, ContentSourceMapSource as N, TransactionMutationOptions as Nn, ObservableAssetsClient as Nr, MutationSelectionQueryParams as Nt, ContentSourceMapLiteralSource as O, ThumbnailTransformOptions as On, ObservablePatch as Or, MutationError as Ot, ContentSourceMapUnknownSource as P, UnarchiveReleaseAction as Pn, TranslateDocument as Pr, OpenEvent as Pt, EditReleaseAction as Q, VideoPlaybackTokens as Qn, ConstantAgentActionParam as Qr, ReleaseId as Qt, CreateVersionAction as R, UnpublishVersionAction as Rn, TransformDocument as Rr, PatchSelection as Rt, ClientVariantConditions as S, SingleActionResult as Sn, BaseTransaction as Sr, MediaLibraryAssetInstanceIdentifier as St, ContentSourceMapDocumentBase as T, StillImageFormat as Tn, PatchBuilder as Tr, MultipleActionResult as Tt, DatasetResponse as U, UploadProgressEvent as Un, PromptRequest as Ur, QueryParseError as Ut, DatasetCreateOptions as V, UploadClientConfig as Vn, TransformTargetDocument as Vr, QueryOptions as Vt, DatasetsResponse as W, UploadResponseEvent as Wn, PatchDocument as Wr, QueryWithoutParams as Wt, EXPERIMENTAL_API_WARNING as X, VideoPlaybackInfoPublic as Xn, AgentActionPathSegment as Xr, ReleaseCardinality as Xt, DisconnectEvent as Y, VideoPlaybackInfoItemSigned as Yn, AgentActionPath as Yr, ReleaseAction as Yt, EditAction as Z, VideoPlaybackInfoSigned as Zn, AgentActionTarget as Zr, ReleaseDocument as Zt, ChannelErrorEvent as _, SanityProjectMember as _n, ProjectsClient as _r, LiveEventGoAway as _t, AllDocumentsMutationOptions as a, RequestUrlOptions as an, WelcomeBackEvent as ar, FirstDocumentMutationOptions as at, ClientReturn$1 as b, SanityUser as bn, DatasetsClient as br, LiveEventRestart as bt, Any$1 as c, ResponseQueryOptions as cn, GenerateOperation as cr, IdentifiedSanityDocumentStub as ct, AssetMetadataType as d, SanityAssetDocument as dn, GenerateTargetInclude as dr, InsertPatch as dt, FieldAgentActionParam as ei, ReleaseType as en, VideoRenditionInfoPublic as er, EmbeddingsSettings as et, AttributeSet as f, SanityDocument$1 as fn, ObservableSanityClient$1 as fr, ListenEvent as ft, BaseMutationOptions as g, SanityProject as gn, ObservableProjectsClient as gr, LiveEvent as gt, BaseActionOptions as h, SanityImagePalette as hn, UsersClient as hr, ListenParams as ht, AllDocumentIdsMutationOptions as i, RequestOptions as in, VideoSubtitleInfoSigned as ir, FirstDocumentIdMutationOptions as it, ContentSourceMapPaths as j, TransactionFirstDocumentIdMutationOptions as jn, _listen as jr, MutationOperation as jt, ContentSourceMapMapping as k, TransactionAllDocumentIdsMutationOptions as kn, Patch as kr, MutationErrorItem as kt, ApiError as l, ResumableListenEventNames as ln, GenerateTarget as lr, ImportReleaseAction as lt, AuthProviderResponse as m, SanityImageAssetDocument as mn, ObservableUsersClient as mr, ListenOptions as mt, ActionError as n, ReplaceVersionAction as nn, VideoSubtitleInfo as nr, ErrorProps as nt, AnimatedImageFormat as o, Requester as on, WelcomeEvent as or, FitMode as ot, AuthProvider as p, SanityDocumentStub as pn, SanityClient$1 as pr, ListenEventName as pt, DiscardAction as q, VideoPlaybackInfoItem as qn, AgentActionParam as qr, RawRequestOptions as qt, ActionErrorItem as r, RequestObservableOptions as rn, VideoSubtitleInfoPublic as rr, FilteredResponseQueryOptions as rt, AnimatedTransformOptions as s, ResetEvent as sn, GenerateInstruction as sr, HttpRequest as st, Action as t, GroqAgentActionParam as ti, ReplaceDraftAction as tn, VideoRenditionInfoSigned as tr, EmbeddingsSettingsBody as tt, ArchiveReleaseAction as u, ResumableListenOptions as un, GenerateTargetDocument as ur, InitializedClientConfig$1 as ut, ClientConfig$1 as v, SanityQueries as vn, MediaLibraryVideoClient as vr, LiveEventMessage as vt, ContentSourceMapDocument as w, StackablePerspective as wn, ObservableTransaction as wr, MediaLibraryVideoPlaybackTransformations as wt, ClientVariant as x, ScheduleReleaseAction as xn, ObservableDatasetsClient as xr, LiveEventWelcome as xt, ClientPerspective$1 as y, SanityReference as yn, ObservableMediaLibraryVideoClient as yr, LiveEventReconnect as yt, CurrentSanityUser as z, UnscheduleReleaseAction as zn, TransformOperation as zr, PublishAction as zt };
5502
- //# sourceMappingURL=types-CUxZSgB2.d.ts.map
5700
+ /**
5701
+ * A single tracked version of a Media Library asset - one uploaded instance,
5702
+ * referencing the underlying (Content Lake shaped) asset document it wraps.
5703
+ *
5704
+ * @public
5705
+ */
5706
+ interface MediaLibraryAssetVersion {
5707
+ _key: string;
5708
+ _type: 'sanity.asset.version';
5709
+ title?: string;
5710
+ instance: SanityReference;
5711
+ }
5712
+ /**
5713
+ * The document returned by the Media Library upload endpoint
5714
+ * (`POST /media-libraries/:id/upload`).
5715
+ *
5716
+ * This is _not_ the same shape as {@link SanityAssetDocument} /
5717
+ * {@link SanityImageAssetDocument}: a Media Library asset is a `sanity.asset`
5718
+ * document that tracks one or more uploaded versions, each pointing at its
5719
+ * own underlying Content Lake asset document via `currentVersion`/`versions`.
5720
+ *
5721
+ * Modelled directly on an observed API response. Fields whose full shape has
5722
+ * not been confirmed (`parent`, `rootDirectory`, `aspects`) are typed loosely
5723
+ * on purpose - widen them once their shape is confirmed.
5724
+ *
5725
+ * @public
5726
+ */
5727
+ interface MediaLibraryAssetDocument {
5728
+ _id: string;
5729
+ _type: 'sanity.asset';
5730
+ assetType: string;
5731
+ title?: string;
5732
+ cdnAccessPolicy?: string;
5733
+ currentVersion: SanityReference;
5734
+ versions: MediaLibraryAssetVersion[];
5735
+ aspects?: Record<string, Any$1>;
5736
+ parent?: SanityReference | null;
5737
+ rootDirectory?: Any$1;
5738
+ }
5739
+ export { EditAction as $, VersionAction as $n, PromptRequest as $r, ReconnectEvent as $t, ContentSourceMapMappings as A, SingleMutationResult as An, DatasetsClient as Ar, MultipleActionResult as At, CurrentSanityUser as B, TransactionMutationOptions as Bn, LiveClient as Br, PartialExcept as Bt, ContentSourceMap$1 as C, SanityProject as Cn, UsersClient as Cr, LiveEventRestart as Ct, ContentSourceMapDocuments$1 as D, SanityUser as Dn, ObservableMediaLibraryVideoClient as Dr, MediaLibraryAssetVersion as Dt, ContentSourceMapDocumentValueSource as E, SanityReference as En, MediaLibraryVideoClient as Er, MediaLibraryAssetInstanceIdentifier as Et, ContentSourceMapValueMapping as F, ThumbnailTransformOptions as Fn, PatchBuilder as Fr, MutationEvent as Ft, DatasetsResponse as G, UnpublishVersionAction as Gn, TranslateTarget as Gr, PublishReleaseAction as Gt, DatasetCreateOptions as H, UnfilteredResponseQueryOptions as Hn, AssetsClient as Hr, PatchOperations as Ht, CreateAction as I, TransactionAllDocumentIdsMutationOptions as In, Transaction as Ir, MutationOperation as It, DeleteVariantDefinitionAction as J, UploadClientConfig as Jn, TransformDocument as Jr, QueryParseError as Jt, DeleteAction as K, UnscheduleReleaseAction as Kn, TranslateTargetInclude as Kr, QueryOptions as Kt, CreateReleaseAction as L, TransactionAllDocumentsMutationOptions as Ln, BasePatch as Lr, MutationSelection as Lt, ContentSourceMapRemoteDocument as M, StillImageFormat as Mn, BaseTransaction as Mr, Mutation as Mt, ContentSourceMapSource as N, StoryboardTransformOptions as Nn, ObservablePatchBuilder as Nr, MutationError as Nt, ContentSourceMapLiteralSource as O, ScheduleReleaseAction as On, InvokeFunctionEvent as Or, MediaLibraryPlaybackInfoOptions as Ot, ContentSourceMapUnknownSource as P, SyncTag as Pn, ObservableTransaction as Pr, MutationErrorItem as Pt, EXPERIMENTAL_API_WARNING as Q, VariantDefinitionAction as Qn, TransformTargetInclude as Qr, RawRequestOptions as Qt, CreateVariantDefinitionAction as R, TransactionFirstDocumentIdMutationOptions as Rn, ObservablePatch as Rr, MutationSelectionQueryParams as Rt, ClientVariantConditions as S, SanityImagePalette as Sn, ObservableUsersClient as Sr, LiveEventReconnect as St, ContentSourceMapDocumentBase as T, SanityQueries as Tn, ProjectsClient as Tr, MediaLibraryAssetDocument as Tt, DatasetEditOptions as U, UnfilteredResponseWithoutQuery as Un, ObservableAssetsClient as Ur, PatchSelection as Ut, DatasetAclMode as V, UnarchiveReleaseAction as Vn, _listen as Vr, PatchMutationOperation as Vt, DatasetResponse as W, UnpublishAction as Wn, TranslateDocument as Wr, PublishAction as Wt, DiscardVersionAction as X, UploadProgressEvent as Xn, TransformTarget as Xr, RawQueryResponse$1 as Xt, DiscardAction as Y, UploadEvent as Yn, TransformOperation as Yr, QueryWithoutParams as Yt, DisconnectEvent as Z, UploadResponseEvent as Zn, TransformTargetDocument as Zr, RawQuerylessQueryResponse as Zt, ChannelErrorEvent as _, ResumableListenOptions as _n, GenerateTarget as _r, ListenOptions as _t, AllDocumentsMutationOptions as a, AgentActionPath as ai, ReleaseType as an, VideoPlaybackInfoSigned as ar, ErrorProps as at, ClientReturn$1 as b, SanityDocumentStub as bn, ObservableSanityClient$1 as br, LiveEventGoAway as bt, Any$1 as c, ConstantAgentActionParam as ci, RequestHandler as cn, VideoRenditionInfoPublic as cr, FirstDocumentMutationOptions as ct, AssetMetadataType as d, GroqAgentActionParam as di, RequestOptions$1 as dn, VideoSubtitleInfoPublic as dr, IdentifiedSanityDocumentStub as dt, PatchDocument as ei, ReleaseAction as en, VideoPlaybackInfo as er, EditReleaseAction as et, AttributeSet as f, RequestUrlOptions as fn, VideoSubtitleInfoSigned as fr, ImportReleaseAction as ft, BaseMutationOptions as g, ResumableListenEventNames as gn, GenerateOperation as gr, ListenEventName as gt, BaseActionOptions as h, ResponseQueryOptions as hn, GenerateInstruction as hr, ListenEvent as ht, AllDocumentIdsMutationOptions as i, AgentActionParams as ii, ReleaseState as in, VideoPlaybackInfoPublic as ir, EmbeddingsSettingsBody as it, ContentSourceMapPaths as j, StackablePerspective as jn, ObservableDatasetsClient as jr, MultipleMutationResult as jt, ContentSourceMapMapping as k, SingleActionResult as kn, InvokeFunctionRequest as kr, MediaLibraryVideoPlaybackTransformations as kt, ApiError as l, DocumentAgentActionParam as li, RequestHandlerOptions as ln, VideoRenditionInfoSigned as lr, FitMode as lt, AuthProviderResponse as m, ResetEvent as mn, WelcomeEvent as mr, InsertPatch as mt, ActionError as n, PatchTarget as ni, ReleaseDocument as nn, VideoPlaybackInfoItemPublic as nr, EditableReleaseDocument as nt, AnimatedImageFormat as o, AgentActionPathSegment as oi, ReplaceDraftAction as on, VideoPlaybackTokens as or, FilteredResponseQueryOptions as ot, AuthProvider as p, Requester as pn, WelcomeBackEvent as pr, InitializedClientConfig$1 as pt, DeleteReleaseAction as q, UploadBody as qn, ImageDescriptionOperation as qr, QueryParams as qt, ActionErrorItem as r, AgentActionParam as ri, ReleaseId as rn, VideoPlaybackInfoItemSigned as rr, EmbeddingsSettings as rt, AnimatedTransformOptions as s, AgentActionTarget as si, ReplaceVersionAction as sn, VideoRenditionInfo as sr, FirstDocumentIdMutationOptions as st, Action as t, PatchOperation as ti, ReleaseCardinality as tn, VideoPlaybackInfoItem as tr, EditVariantDefinitionAction as tt, ArchiveReleaseAction as u, FieldAgentActionParam as ui, RequestObservableOptions as un, VideoSubtitleInfo as ur, HttpRequest as ut, ClientConfig$1 as v, SanityAssetDocument as vn, GenerateTargetDocument as vr, ListenParams as vt, ContentSourceMapDocument as w, SanityProjectMember as wn, ObservableProjectsClient as wr, LiveEventWelcome as wt, ClientVariant as x, SanityImageAssetDocument as xn, SanityClient$1 as xr, LiveEventMessage as xt, ClientPerspective$1 as y, SanityDocument$1 as yn, GenerateTargetInclude as yr, LiveEvent as yt, CreateVersionAction as z, TransactionFirstDocumentMutationOptions as zn, Patch as zr, OpenEvent as zt };
5740
+ //# sourceMappingURL=types-BODIEY7F.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "api",
@@ -49,15 +49,15 @@
49
49
  "./package.json": "./package.json"
50
50
  },
51
51
  "dependencies": {
52
- "eventsource": "^5.0.0",
53
- "get-it": "^9.4.1",
52
+ "eventsource": "^5.1.0",
53
+ "get-it": "^9.5.0",
54
54
  "nanoid": "^6.0.1",
55
55
  "obug": "^2.1.4",
56
56
  "rxjs": "^7.8.2"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@changesets/cli": "^2.31.1",
60
- "@cloudflare/vitest-pool-workers": "^0.20.1",
60
+ "@cloudflare/vitest-pool-workers": "^0.21.3",
61
61
  "@edge-runtime/types": "^4.0.0",
62
62
  "@edge-runtime/vm": "^5.0.0",
63
63
  "@sanity/pkg-utils": "^12.1.2",
@@ -65,17 +65,22 @@
65
65
  "@types/node": "^22.20.1",
66
66
  "@types/react": "^19.2.18",
67
67
  "@vercel/stega": "1.1.0",
68
+ "@vitest/browser": "^4.1.10",
69
+ "@vitest/browser-playwright": "^4.1.10",
68
70
  "@vitest/coverage-v8": "^4.1.10",
69
71
  "eventsource-encoder": "^1.0.2",
70
- "happy-dom": "^20.11.1",
72
+ "happy-dom": "^20.11.2",
71
73
  "json-diff": "^1.0.6",
74
+ "knip": "^6.32.2",
72
75
  "ls-engines": "^0.10.1",
73
- "next": "^16.3.0",
76
+ "next": "^16.3.1",
74
77
  "oxfmt": "^0.63.0",
75
78
  "oxlint": "^1.78.0",
76
79
  "oxlint-tsgolint": "^7.0.2001",
77
- "pkg-pr-new": "^0.0.86",
80
+ "pkg-pr-new": "^0.0.88",
81
+ "playwright": "^1.62.1",
78
82
  "typescript": "7.0.2",
83
+ "undici": "^7.29.0",
79
84
  "vitest": "^4.1.10"
80
85
  },
81
86
  "browserslist": "extends @sanity/browserslist-config",
@@ -92,13 +97,23 @@
92
97
  "release": "changeset publish",
93
98
  "test": "vitest",
94
99
  "test:browser": "vitest run --config ./vitest.browser.config.ts",
95
- "test:bun": "bun test runtimes/bun",
96
- "test:deno": "npm pack --pack-destination runtimes/deno && cd runtimes/deno && npm install --no-save --no-package-lock ./sanity-client-*.tgz @types/node && deno test --allow-read --allow-net --allow-env --fail-fast --node-modules-dir=manual .",
100
+ "test:bun": "bun run vitest run",
101
+ "test:deno": "deno run -A --node-modules-dir=manual npm:vitest run --config ./vitest.deno.config.ts",
102
+ "test:happy-dom": "vitest run --config ./vitest.happy-dom.config.ts",
103
+ "test:integration": "vitest run --config ./vitest.integration.config.ts",
104
+ "test:integration:bun": "bun run vitest run --config ./vitest.integration.config.ts",
105
+ "test:integration:deno": "deno run -A --node-modules-dir=manual npm:vitest run --config ./vitest.integration.config.ts",
106
+ "test:integration:node": "vitest run --config ./vitest.integration.config.ts",
107
+ "test:integration:vercel-edge": "vitest run --config ./vitest.integration.vercel-edge.config.ts",
108
+ "test:integration:workerd": "vitest run --config ./vitest.integration.workerd.config.ts",
97
109
  "test:next": "vitest run --config ./vitest.next.config.ts",
98
- "test:node-runtimes": "(cd runtimes/node && node --test)",
110
+ "test:packaging": "vitest run --config ./vitest.packaging.config.ts",
111
+ "test:react-server": "vitest run --config ./vitest.react-server.config.ts",
99
112
  "test:vercel-edge": "vitest run --config ./vitest.vercel-edge.config.ts",
100
113
  "test:workerd": "vitest run --config ./vitest.workerd.config.ts",
101
114
  "format": "oxfmt",
102
- "format:check": "oxfmt --check"
115
+ "format:check": "oxfmt --check",
116
+ "knip": "knip",
117
+ "typecheck": "tsc --noEmit"
103
118
  }
104
119
  }