@sanity/client 8.5.0 → 8.6.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.
@@ -462,7 +462,7 @@ export interface paths {
462
462
  get?: never
463
463
  /**
464
464
  * Record a conversation
465
- * @description Upserts the conversation telemetry for one thread. `threadId` identifies the conversation within your organization — reuse means the same conversation. Messages replace the stored transcript wholesale; `metadata` and model fields only overwrite when present. Last write per thread wins — retries are safe.
465
+ * @description Upserts the conversation telemetry for one thread. `threadId` identifies the conversation within your organization — reuse means the same conversation. Messages replace the stored transcript wholesale; `metadata`, `sharing`, and model fields only overwrite when present. Last write per thread wins — retries are safe. `sharing` records your opt-in to share telemetry with Sanity: metadata-only metrics, or full transcripts.
466
466
  */
467
467
  put: operations['saveConversation']
468
468
  post?: never
@@ -533,6 +533,15 @@ export interface components {
533
533
  /** Format: date-time */
534
534
  classifiedAt: string | null
535
535
  classificationError: string | null
536
+ /**
537
+ * @description ConversationSharing
538
+ * @default null
539
+ */
540
+ sharing: {
541
+ metrics?: boolean
542
+ conversations?: boolean
543
+ contact?: string
544
+ } | null
536
545
  }
537
546
  /** @description A `sanity.context.entry` document, one outline node stored in the bound dataset. Not returned by any endpoint; published so GROQ reads against the dataset can be typed. The entries endpoints serve the validated wire view. */
538
547
  EntryDoc: {
@@ -931,6 +940,11 @@ export interface operations {
931
940
  refreshInFlight: boolean
932
941
  openIssueCount: number
933
942
  instructionCount: number
943
+ /** @description Actor */
944
+ createdBy: {
945
+ id: string | null
946
+ displayName: string | null
947
+ } | null
934
948
  /** Format: date-time */
935
949
  createdAt: string
936
950
  /** Format: date-time */
@@ -1032,6 +1046,11 @@ export interface operations {
1032
1046
  refreshInFlight: boolean
1033
1047
  openIssueCount: number
1034
1048
  instructionCount: number
1049
+ /** @description Actor */
1050
+ createdBy: {
1051
+ id: string | null
1052
+ displayName: string | null
1053
+ } | null
1035
1054
  /** Format: date-time */
1036
1055
  createdAt: string
1037
1056
  /** Format: date-time */
@@ -1123,6 +1142,11 @@ export interface operations {
1123
1142
  refreshInFlight: boolean
1124
1143
  openIssueCount: number
1125
1144
  instructionCount: number
1145
+ /** @description Actor */
1146
+ createdBy: {
1147
+ id: string | null
1148
+ displayName: string | null
1149
+ } | null
1126
1150
  /** Format: date-time */
1127
1151
  createdAt: string
1128
1152
  /** Format: date-time */
@@ -1246,6 +1270,11 @@ export interface operations {
1246
1270
  refreshInFlight: boolean
1247
1271
  openIssueCount: number
1248
1272
  instructionCount: number
1273
+ /** @description Actor */
1274
+ createdBy: {
1275
+ id: string | null
1276
+ displayName: string | null
1277
+ } | null
1249
1278
  /** Format: date-time */
1250
1279
  createdAt: string
1251
1280
  /** Format: date-time */
@@ -2283,6 +2312,12 @@ export interface operations {
2283
2312
  metadata?: {
2284
2313
  [key: string]: string | string[]
2285
2314
  }
2315
+ /** @description ConversationSharing */
2316
+ sharing?: {
2317
+ metrics?: boolean
2318
+ conversations?: boolean
2319
+ contact?: string
2320
+ }
2286
2321
  }
2287
2322
  }
2288
2323
  }
@@ -2335,6 +2370,12 @@ export interface operations {
2335
2370
  /** Format: date-time */
2336
2371
  classifiedAt: string | null
2337
2372
  classificationError: string | null
2373
+ /** @description ConversationSharing */
2374
+ sharing: {
2375
+ metrics?: boolean
2376
+ conversations?: boolean
2377
+ contact?: string
2378
+ } | null
2338
2379
  /** Format: date-time */
2339
2380
  createdAt: string
2340
2381
  /** Format: date-time */
@@ -2416,6 +2457,12 @@ export interface operations {
2416
2457
  /** Format: date-time */
2417
2458
  classifiedAt: string | null
2418
2459
  classificationError: string | null
2460
+ /** @description ConversationSharing */
2461
+ sharing: {
2462
+ metrics?: boolean
2463
+ conversations?: boolean
2464
+ contact?: string
2465
+ } | null
2419
2466
  /** Format: date-time */
2420
2467
  createdAt: string
2421
2468
  /** Format: date-time */
@@ -1,4 +1,5 @@
1
1
  import {getDraftId, getVersionFromId, getVersionId, isDraftId} from '@sanity/client/csm'
2
+ import {anySignal} from 'any-signal'
2
3
  import {type MonoTypeOperatorFunction, Observable} from 'rxjs'
3
4
  import {filter, map} from 'rxjs/operators'
4
5
 
@@ -1134,11 +1135,7 @@ export function _observe<R>(
1134
1135
  ): Observable<R> {
1135
1136
  return new Observable<R>((subscriber) => {
1136
1137
  const controller = new AbortController()
1137
- // `AbortSignal.any` rather than an `addEventListener` on the caller's
1138
- // signal: that signal can be long-lived and reused across many requests,
1139
- // and a listener per subscription would accumulate there (`{once: true}`
1140
- // only cleans up if the signal actually fires).
1141
- const signal = userSignal ? AbortSignal.any([userSignal, controller.signal]) : controller.signal
1138
+ const signal = userSignal ? anySignal([userSignal, controller.signal]) : controller.signal
1142
1139
  run(signal).then(
1143
1140
  (value) => {
1144
1141
  subscriber.next(value)
@@ -1,3 +1,4 @@
1
+ import {anySignal} from 'any-signal'
1
2
  import {
2
3
  createRequester,
3
4
  type FetchFunction,
@@ -140,20 +141,11 @@ export function defineRequester(
140
141
  return executeRequest(requester, options)
141
142
  }
142
143
 
143
- // Same per-subscription AbortController pattern as `_observe` in
144
- // dataMethods: a caller-supplied signal is combined in via
145
- // `AbortSignal.any`, so the request aborts both on the caller's signal and
146
- // on unsubscribe. `AbortSignal.any` (rather than `addEventListener`)
147
- // because the caller's signal can be long-lived and reused — a manually
148
- // added listener would accumulate there once per subscription, since
149
- // `{once: true}` only cleans up if the signal actually fires.
150
144
  const observable: LegacyRequester = (options: Any) =>
151
145
  new Observable<ResponseEvent>((subscriber) => {
152
146
  const controller = new AbortController()
153
147
  const userSignal: AbortSignal | undefined = options.signal
154
- const signal = userSignal
155
- ? AbortSignal.any([userSignal, controller.signal])
156
- : controller.signal
148
+ const signal = userSignal ? anySignal([userSignal, controller.signal]) : controller.signal
157
149
  const subscription = from(promise({...options, signal})).subscribe(subscriber)
158
150
  return () => {
159
151
  subscription.unsubscribe()
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-BhMuKj0D.js","names":["headersToRecord","isHttpError","isGetItHttpError"],"sources":["../src/util/codeFrame.ts","../src/http/errors.ts","../src/http/request.ts"],"sourcesContent":["/**\n * Inlined, modified version of the `codeFrameColumns` function from `@babel/code-frame`.\n * MIT-licensed - https://github.com/babel/babel/blob/main/LICENSE\n * Copyright (c) 2014-present Sebastian McKenzie and other contributors.\n */\ntype Location = {\n column: number\n line: number\n}\n\ntype NodeLocation = {\n start: Location\n end?: Location\n}\n\ntype GroqLocation = {\n start: number\n end?: number\n}\n\n/**\n * RegExp to test for newlines.\n */\n\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/\n\n/**\n * Extract what lines should be marked and highlighted.\n */\n\ntype MarkerLines = Record<number, true | [number, number]>\n\n/**\n * Highlight a code frame with the given location and message.\n *\n * @param query - The query to be highlighted.\n * @param location - The location of the error in the code/query.\n * @param message - Message to be displayed inline (if possible) next to the highlighted\n * location in the code. If it can't be positioned inline, it will be placed above the\n * code frame.\n * @returns The highlighted code frame.\n */\nexport function codeFrame(query: string, location: GroqLocation, message?: string): string {\n const lines = query.split(NEWLINE)\n const loc = {\n start: columnToLine(location.start, lines),\n end: location.end ? columnToLine(location.end, lines) : undefined,\n }\n\n const {start, end, markerLines} = getMarkerLines(loc, lines)\n\n const numberMaxWidth = `${end}`.length\n\n return query\n .split(NEWLINE, end)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth)\n const gutter = ` ${paddedNumber} |`\n const hasMarker = markerLines[number]\n const lastMarkerLine = !markerLines[number + 1]\n if (!hasMarker) {\n return ` ${gutter}${line.length > 0 ? ` ${line}` : ''}`\n }\n\n let markerLine = ''\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\\t]/g, ' ')\n const numberOfMarkers = hasMarker[1] || 1\n\n markerLine = [\n '\\n ',\n gutter.replace(/\\d/g, ' '),\n ' ',\n markerSpacing,\n '^'.repeat(numberOfMarkers),\n ].join('')\n\n if (lastMarkerLine && message) {\n markerLine += ' ' + message\n }\n }\n return ['>', gutter, line.length > 0 ? ` ${line}` : '', markerLine].join('')\n })\n .join('\\n')\n}\n\nfunction getMarkerLines(\n loc: NodeLocation,\n source: Array<string>,\n): {\n start: number\n end: number\n markerLines: MarkerLines\n} {\n const startLoc: Location = {...loc.start}\n const endLoc: Location = {...startLoc, ...loc.end}\n const linesAbove = 2\n const linesBelow = 3\n const startLine = startLoc.line ?? -1\n const startColumn = startLoc.column ?? 0\n const endLine = endLoc.line\n const endColumn = endLoc.column\n\n let start = Math.max(startLine - (linesAbove + 1), 0)\n let end = Math.min(source.length, endLine + linesBelow)\n\n if (startLine === -1) {\n start = 0\n }\n\n if (endLine === -1) {\n end = source.length\n }\n\n const lineDiff = endLine - startLine\n const markerLines: MarkerLines = {}\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine\n\n if (!startColumn) {\n markerLines[lineNumber] = true\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1].length\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1]\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn]\n } else {\n const sourceLength = source[lineNumber - i].length\n\n markerLines[lineNumber] = [0, sourceLength]\n }\n }\n } else {\n if (startColumn === endColumn) {\n if (startColumn) {\n markerLines[startLine] = [startColumn, 0]\n } else {\n markerLines[startLine] = true\n }\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn]\n }\n }\n\n return {start, end, markerLines}\n}\n\nfunction columnToLine(column: number, lines: string[]): Location {\n let offset = 0\n\n for (let i = 0; i < lines.length; i++) {\n const lineLength = lines[i].length + 1 // assume '\\n' after each line\n\n if (offset + lineLength > column) {\n return {\n line: i + 1, // 1-based line\n column: column - offset, // 0-based column\n }\n }\n\n offset += lineLength\n }\n\n // Fallback: beyond last line\n return {\n line: lines.length,\n column: lines[lines.length - 1]?.length ?? 0,\n }\n}\n","import type {ActionError, Any, ErrorProps, MutationError, QueryParseError} from '../types'\nimport {codeFrame} from '../util/codeFrame'\nimport {isRecord} from '../util/isRecord'\n\nconst MAX_ITEMS_IN_ERROR_MESSAGE = 5\n\n/**\n * Canonical HTTP response shape used internally to build {@link ClientError}\n * and {@link ServerError}. Decouples the error layer from any particular\n * transport library — adapters in the HTTP layer (e.g. `httpResponseFromGetIt`)\n * project transport-specific response shapes into this stable form before\n * constructing errors.\n *\n * Matches the public {@link HttpError.response} shape so consumers see no\n * difference in error properties when the underlying transport changes.\n *\n * @internal\n */\nexport interface CanonicalHttpResponse {\n statusCode: number\n statusMessage: string | null\n headers: Record<string, string>\n body: unknown\n url: string\n method: string\n}\n\n/**\n * Adapter for buffered responses from get-it v9 (`BufferedResponse`-shaped).\n *\n * The URL and method aren't on the response itself in v9, so the request\n * options must be passed alongside.\n *\n * @internal\n */\nexport function httpResponseFromFetch(\n res: {\n status: number\n statusText: string\n headers: Headers\n body: unknown\n url: string\n },\n reqUrl: string,\n reqMethod: string,\n): CanonicalHttpResponse {\n return {\n statusCode: res.status,\n statusMessage: res.statusText || null,\n headers: headersToRecord(res.headers),\n body: res.body,\n url: res.url || reqUrl,\n method: reqMethod,\n }\n}\n\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {}\n headers.forEach((value, key) => {\n out[key] = value\n })\n return out\n}\n\n/**\n * Shared properties for HTTP errors (eg both ClientError and ServerError)\n * Use `isHttpError` for type narrowing and accessing response properties.\n *\n * @public\n */\nexport interface HttpError {\n statusCode: number\n message: string\n response: {\n body: unknown\n url: string\n method: string\n headers: Record<string, string>\n statusCode: number\n statusMessage: string | null\n }\n}\n\n/**\n * Checks if the provided error is an HTTP error.\n *\n * @param error - The error to check.\n * @returns `true` if the error is an HTTP error, `false` otherwise.\n * @public\n */\nexport function isHttpError(error: unknown): error is HttpError {\n if (!isRecord(error)) {\n return false\n }\n\n const response = error.response\n if (\n typeof error.statusCode !== 'number' ||\n typeof error.message !== 'string' ||\n !isRecord(response)\n ) {\n return false\n }\n\n if (\n typeof response.body === 'undefined' ||\n typeof response.url !== 'string' ||\n typeof response.method !== 'string' ||\n typeof response.headers !== 'object' ||\n typeof response.statusCode !== 'number'\n ) {\n return false\n }\n\n return true\n}\n\n/** @public */\nexport class ClientError extends Error {\n response: ErrorProps['response']\n statusCode: ErrorProps['statusCode'] = 400\n responseBody: ErrorProps['responseBody']\n traceId: ErrorProps['traceId']\n details: ErrorProps['details']\n\n constructor(res: Any, tag?: string) {\n const props = extractErrorProps(res, tag)\n super(props.message)\n Object.assign(this, props)\n }\n}\n\n/** @public */\nexport class ServerError extends Error {\n response: ErrorProps['response']\n statusCode: ErrorProps['statusCode'] = 500\n responseBody: ErrorProps['responseBody']\n traceId: ErrorProps['traceId']\n details: ErrorProps['details']\n\n constructor(res: Any) {\n const props = extractErrorProps(res)\n super(props.message)\n Object.assign(this, props)\n }\n}\n\nfunction extractErrorProps(res: Any, tag?: string): ErrorProps {\n const body = res.body\n const props = {\n response: res,\n statusCode: res.statusCode,\n responseBody: stringifyBody(body, res),\n traceId: extractTraceId(res),\n message: '',\n details: undefined as Any,\n }\n\n // Fall back early if we didn't get a JSON object returned as expected\n if (!isRecord(body)) {\n props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`\n return props\n }\n\n const error = body.error\n\n // API/Boom style errors ({statusCode, error, message})\n if (typeof error === 'string' && typeof body.message === 'string') {\n props.message = `${error} - ${body.message}${formatTraceId(props.traceId)}`\n return props\n }\n\n // Content Lake errors with a `error` prop being an object\n if (typeof error !== 'object' || error === null) {\n if (typeof error === 'string') {\n props.message = `${error}${formatTraceId(props.traceId)}`\n } else if (typeof body.message === 'string') {\n props.message = `${body.message}${formatTraceId(props.traceId)}`\n } else {\n props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`\n }\n return props\n }\n\n // Mutation errors (specifically)\n if (isMutationError(error) || isActionError(error)) {\n const allItems = error.items || []\n const items = allItems\n .slice(0, MAX_ITEMS_IN_ERROR_MESSAGE)\n .map((item) => item.error?.description)\n .filter(Boolean)\n let itemsStr = items.length ? `:\\n- ${items.join('\\n- ')}` : ''\n if (allItems.length > MAX_ITEMS_IN_ERROR_MESSAGE) {\n itemsStr += `\\n...and ${allItems.length - MAX_ITEMS_IN_ERROR_MESSAGE} more`\n }\n props.message = `${error.description}${formatTraceId(props.traceId)}${itemsStr}`\n props.details = body.error\n return props\n }\n\n // Query parse errors\n if (isQueryParseError(error)) {\n props.message = formatQueryParseError(error, tag, props.traceId)\n props.details = body.error\n return props\n }\n\n if ('description' in error && typeof error.description === 'string') {\n // Query/database errors ({error: {description, other, arb, props}})\n props.message = `${error.description}${formatTraceId(props.traceId)}`\n props.details = error\n return props\n }\n\n // Other, more arbitrary errors\n props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`\n return props\n}\n\nfunction isMutationError(error: object): error is MutationError {\n return (\n 'type' in error &&\n error.type === 'mutationError' &&\n 'description' in error &&\n typeof error.description === 'string'\n )\n}\n\nfunction isActionError(error: object): error is ActionError {\n return (\n 'type' in error &&\n error.type === 'actionError' &&\n 'description' in error &&\n typeof error.description === 'string'\n )\n}\n\n/** @internal */\nexport function isQueryParseError(error: object): error is QueryParseError {\n return (\n isRecord(error) &&\n error.type === 'queryParseError' &&\n typeof error.query === 'string' &&\n typeof error.start === 'number' &&\n typeof error.end === 'number'\n )\n}\n\n/**\n * Formats a GROQ query parse error into a human-readable string.\n *\n * @param error - The error object containing details about the parse error.\n * @param tag - An optional tag to include in the error message.\n * @returns A formatted error message string.\n * @public\n */\nexport function formatQueryParseError(\n error: QueryParseError,\n tag?: string | null,\n traceId?: string,\n) {\n const {query, start, end, description} = error\n const withTraceId = traceId ? `\\n(traceId: ${traceId})` : ''\n\n if (!query || typeof start === 'undefined') {\n return `GROQ query parse error: ${description}${withTraceId}`\n }\n\n const withTag = tag ? `\\n\\nTag: ${tag}` : ''\n const framed = codeFrame(query, {start, end}, description)\n\n return `GROQ query parse error:\\n${framed}${withTag}${withTraceId}`\n}\n\nfunction httpErrorMessage(res: Any, body: unknown) {\n const details = typeof body === 'string' ? ` (${sliceWithEllipsis(body, 100)})` : ''\n const statusMessage = res.statusMessage ? ` ${res.statusMessage}` : ''\n return `${res.method}-request to ${res.url} resulted in HTTP ${res.statusCode}${statusMessage}${details}`\n}\n\n/**\n * Extract the traceId from the traceparent header on the response.\n *\n * The traceparent is on the format [version]-[traceId]-[parentId]-[traceFlags], but\n * when debugging end-user issues it's the traceId we need to be able to get hold of\n * the relevant traces.\n *\n * @see https://www.w3.org/TR/trace-context/\n * @returns The traceId for HTTP response\n */\nfunction extractTraceId(res: Any): string | undefined {\n const traceparent = res?.headers?.['traceparent']\n if (!traceparent) return\n\n return traceparent.split('-')[1]\n}\n\nfunction stringifyBody(body: Any, res: Any) {\n const contentType = (res.headers['content-type'] || '').toLowerCase()\n const isJson = contentType.indexOf('application/json') !== -1\n return isJson ? JSON.stringify(body, null, 2) : body\n}\n\nfunction formatTraceId(traceId: string | undefined): string {\n return traceId ? ` (traceId: ${traceId})` : ''\n}\n\nfunction sliceWithEllipsis(str: string, max: number) {\n return str.length > max ? `${str.slice(0, max)}…` : str\n}\n\n/** @public */\nexport class CorsOriginError extends Error {\n projectId?: string\n addOriginUrl?: URL\n\n constructor({projectId, credentials}: {projectId?: string; credentials?: boolean} = {}) {\n super('CorsOriginError')\n this.name = 'CorsOriginError'\n this.projectId = projectId\n\n // Only build a deep-link when we know which project the user needs to\n // configure - without `projectId` the management URL can't actually route\n // them anywhere useful.\n if (projectId && typeof location !== 'undefined') {\n const url = new URL(`https://sanity.io/manage/project/${projectId}/api`)\n const {origin} = location\n url.searchParams.set('cors', 'add')\n url.searchParams.set('origin', origin)\n if (credentials) {\n // Pre-selects the \"Allow credentials (token-based auth)\" toggle in\n // the Sanity management CORS form.\n url.searchParams.set('credentials', '')\n }\n this.addOriginUrl = url\n this.message = `The current origin is not allowed to connect to the Live Content API. Add it here: ${url}`\n } else if (projectId) {\n this.message = `The current origin is not allowed to connect to the Live Content API. Change your configuration here: https://sanity.io/manage/project/${projectId}/api`\n } else {\n this.message = `The current origin is not allowed to connect to the Live Content API.`\n }\n }\n}\n","import {\n createRequester,\n type FetchFunction,\n isHttpError as isGetItHttpError,\n type RequestOptions as FetchRequestOptions,\n type TransformMiddleware,\n type WrappingMiddleware,\n} from 'get-it'\nimport {isRetryableRequest, retry} from 'get-it/middleware'\nimport {from, Observable} from 'rxjs'\n\nimport type {Any} from '../types'\nimport {ClientError, httpResponseFromFetch, ServerError} from './errors'\n\n/**\n * Middleware accepted by the internal HTTP layer. Two flavors per get-it v9:\n * a flat-pipeline transform (`beforeRequest`/`afterResponse`) or a wrapping\n * middleware that surrounds the fetch chain.\n *\n * @internal\n */\nexport type LegacyMiddleware = TransformMiddleware | WrappingMiddleware\n\n/**\n * The shape this client's internal pipeline produces. Mirrors the historical\n * `ResponseEvent` from the get-it v8 multi-event observable, so all the existing\n * downstream code (`_requestObservable`, `_uploadObservable`,\n * `defineCreateClient`) keeps working without churn.\n *\n * @internal\n */\nexport interface ResponseEvent {\n type: 'response'\n body: unknown\n statusCode: number\n statusMessage: string | null\n headers: Record<string, string>\n url: string\n method: string\n}\n\n/**\n * Legacy \"requester\" type - the observable half of `defineRequester`'s\n * result. Returns a single-event Observable for compatibility with the rest\n * of the codebase.\n *\n * @internal\n */\nexport type LegacyRequester = (options: Any) => Observable<ResponseEvent>\n\n/**\n * Promise-based sibling of {@link LegacyRequester}. Resolves directly to the\n * single `ResponseEvent` the transport produces, skipping the RxJS wrapper.\n * Used by the promise-based client surface so it never constructs an\n * Observable.\n *\n * @internal\n */\nexport type PromiseRequester = (options: Any) => Promise<ResponseEvent>\n\n/**\n * Both forms of the transport, sharing a single underlying get-it requester\n * (so retry state and the one-shot warning de-duplication are shared between\n * the observable and promise paths).\n *\n * @internal\n */\nexport interface DualRequester {\n observable: LegacyRequester\n promise: PromiseRequester\n}\n\n/**\n * Options for tuning the HTTP request pipeline per-client.\n *\n * @internal\n */\nexport interface HttpRequestConfig {\n ignoreWarnings?: string | RegExp | Array<string | RegExp>\n maxRetries?: number\n retryDelay?: (attemptNumber: number) => number\n}\n\n/**\n * Build both the observable and promise transport forms from a single get-it\n * requester. The promise form is the primitive (`executeRequest` is already\n * promise-based); the observable form wraps it lazily so each subscription\n * starts its own request (cold), and unsubscribing aborts the in-flight\n * fetch — the same contract as the get-it v8 observable adapter.\n *\n * @internal\n */\nexport function defineRequester(\n envOptions: EnvironmentOptions,\n config: HttpRequestConfig = {},\n): DualRequester {\n // Framework-patched fetch implementations read extra `RequestInit` fields\n // for caching semantics — Next.js App Router's `cache` and `next` options in\n // particular. Legacy callers pass those via an object-valued `fetch` request\n // option (see `adaptToFetchOptions`, which stashes it in `meta.fetchInit`\n // since get-it v9's own `fetch` option only accepts a function). Merge them\n // into the init of whichever fetch implementation is effective for the\n // request: per-request/test-override fetch, the environment default, or the\n // global fetch.\n const applyFetchInit: WrappingMiddleware = (opts, next) => {\n const fetchInit = opts.meta?.fetchInit\n if (typeof fetchInit !== 'object' || fetchInit === null) return next(opts)\n const baseFetch: NonNullable<FetchRequestOptions['fetch']> =\n opts.fetch ?? envOptions.fetch ?? globalThis.fetch\n const fetchWithInit: typeof baseFetch = (input, init) =>\n baseFetch(input, {...fetchInit, ...init})\n return next({...opts, fetch: fetchWithInit})\n }\n\n const requester = createRequester({\n ...(envOptions.fetch ? {fetch: envOptions.fetch} : {}),\n headers: envOptions.headers,\n // Keep get-it's built-in 4xx/5xx → HttpError so the retry middleware can\n // see them; we translate to ClientError/ServerError after the retry loop\n // has exhausted in `executeRequest`.\n httpErrors: true,\n middleware: [\n retry({\n shouldRetry: shouldRetryRequest,\n maxRetries: config.maxRetries ?? 5,\n ...(config.retryDelay ? {retryDelay: config.retryDelay} : {}),\n }),\n ...envOptions.middleware,\n applyFetchInit,\n printWarnings(config),\n ],\n })\n\n const promise: PromiseRequester = (options: Any) => {\n // Options arrive fetch-shaped from `requestOptions` — the single\n // translation boundary between public option names and the transport.\n if (typeof options.url !== 'string') {\n throw new TypeError('Request options must include a `url`')\n }\n return executeRequest(requester, options)\n }\n\n // Same per-subscription AbortController pattern as `_observe` in\n // dataMethods: a caller-supplied signal is combined in via\n // `AbortSignal.any`, so the request aborts both on the caller's signal and\n // on unsubscribe. `AbortSignal.any` (rather than `addEventListener`)\n // because the caller's signal can be long-lived and reused — a manually\n // added listener would accumulate there once per subscription, since\n // `{once: true}` only cleans up if the signal actually fires.\n const observable: LegacyRequester = (options: Any) =>\n new Observable<ResponseEvent>((subscriber) => {\n const controller = new AbortController()\n const userSignal: AbortSignal | undefined = options.signal\n const signal = userSignal\n ? AbortSignal.any([userSignal, controller.signal])\n : controller.signal\n const subscription = from(promise({...options, signal})).subscribe(subscriber)\n return () => {\n subscription.unsubscribe()\n controller.abort()\n }\n })\n\n return {promise, observable}\n}\n\n/**\n * Options describing the environment-specific defaults (Node vs. browser).\n *\n * @internal\n */\nexport interface EnvironmentOptions {\n fetch?: FetchRequestOptions['fetch']\n headers?: Record<string, string>\n middleware: LegacyMiddleware[]\n /**\n * Resolves the environment's fetch implementation — the same transport\n * regular requests use (custom fetch variants, undici configuration,\n * env-proxy support and all), optionally configured for an explicit proxy\n * URL. Lets consumers of the resolved config (the EventSource fetch\n * resolver) avoid falling back to whatever `globalThis.fetch` happens to\n * be. The Node environment supplies get-it's undici-backed fetch; the\n * browser environment leaves it unset (the global fetch IS the\n * environment's fetch there).\n *\n * Looked up via the env rather than imported directly so that the Node-only\n * `get-it/node` (which transitively pulls in `undici`) never ends up in the\n * browser bundle, even via rollup's inlined dynamic imports.\n */\n resolveFetch?: (proxyUrl?: string) => FetchFunction\n}\n\nasync function executeRequest(\n requester: ReturnType<typeof createRequester>,\n fetchOptions: FetchRequestOptions,\n): Promise<ResponseEvent> {\n const url = fetchOptions.url\n const method = (fetchOptions.method ?? 'GET').toUpperCase()\n\n let response\n try {\n response = await requester(fetchOptions)\n } catch (err) {\n if (isGetItHttpError(err)) {\n // `err.body` is the response body as a string (get-it v9 stores the\n // already-decoded text), regardless of which response variant\n // `err.response` is.\n const errBodyText = typeof err.body === 'string' ? err.body : ''\n const errBody = parseJsonText(errBodyText, err.headers)\n const canonical = httpResponseFromFetch(\n {\n status: err.status,\n statusText: err.statusText,\n headers: err.headers,\n body: errBody,\n url: err.response.url ?? err.url,\n },\n url,\n method,\n )\n const tag = extractRequestTag(fetchOptions.query)\n if (canonical.statusCode >= 500) {\n throw new ServerError(canonical)\n }\n throw new ClientError(canonical, tag)\n }\n throw err\n }\n\n const body = parseJsonBody(response)\n return {\n type: 'response',\n body,\n statusCode: response.status,\n statusMessage: response.statusText || null,\n headers: headersToRecord(response.headers),\n url: response.url || url,\n method,\n }\n}\n\n/**\n * Extract the GROQ request tag (used for error messages) from the query.\n */\nfunction extractRequestTag(query: FetchRequestOptions['query']): string | undefined {\n if (!query) return undefined\n if (query instanceof URLSearchParams) return query.get('tag') ?? undefined\n const tag = query.tag\n return typeof tag === 'string' ? tag : undefined\n}\n\nfunction parseJsonBody(response: {headers: Headers; text(): string}): unknown {\n return parseJsonText(response.text(), response.headers)\n}\n\n/**\n * Parse a response body according to its `content-type`: JSON when the header\n * says so (falling back to the raw text on malformed JSON), text otherwise.\n * Shared with the browser XHR upload path so error bodies parse identically\n * on both transports.\n *\n * @internal\n */\nexport function parseJsonText(text: string, headers: Headers): unknown {\n const contentType = (headers.get('content-type') ?? '').toLowerCase()\n if (!text) return undefined\n if (contentType.includes('application/json')) {\n try {\n return JSON.parse(text)\n } catch {\n return text\n }\n }\n return text\n}\n\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {}\n headers.forEach((value, key) => {\n out[key] = value\n })\n return out\n}\n\nfunction shouldRetryRequest(err: unknown, attempt: number, options: FetchRequestOptions): boolean {\n // HTTP errors aren't usually retryable, but Content Lake gives us a few\n // status codes where retrying *is* the right move.\n if (isGetItHttpError(err)) {\n const isSafe = (options.method ?? 'GET') === 'GET' || options.method === 'HEAD'\n const isQuery = (options.url ?? '').includes('/data/query')\n const status = err.status\n const retryableStatus = status === 429 || status === 502 || status === 503\n if ((isSafe || isQuery) && retryableStatus) return true\n return false\n }\n\n return isRetryableRequest(err, attempt, options)\n}\n\nfunction printWarnings(config: HttpRequestConfig): TransformMiddleware {\n const seen: Record<string, boolean> = {}\n\n const shouldIgnore = (message: string): boolean => {\n if (config.ignoreWarnings === undefined) return false\n const patterns = Array.isArray(config.ignoreWarnings)\n ? config.ignoreWarnings\n : [config.ignoreWarnings]\n return patterns.some((pattern) =>\n typeof pattern === 'string' ? message.includes(pattern) : pattern.test(message),\n )\n }\n\n return {\n afterResponse(response) {\n const header = response.headers.get('x-sanity-warning')\n if (!header) return response\n // Multiple warnings can be comma-separated per HTTP header semantics.\n for (const msg of header.split(',').map((m) => m.trim())) {\n if (!msg || seen[msg] || shouldIgnore(msg)) continue\n seen[msg] = true\n // oxlint-disable-next-line no-console\n console.warn(msg)\n }\n return response\n },\n }\n}\n"],"mappings":";;;;;;;AAwBA,MAAM,UAAU;;;;;;;;;;;AAkBhB,SAAgB,UAAU,OAAe,UAAwB,SAA0B;CACzF,IAAM,QAAQ,MAAM,MAAM,OAAO,GAM3B,EAAC,OAAO,KAAK,gBAAe,eAAe;EAJ/C,OAAO,aAAa,SAAS,OAAO,KAAK;EACzC,KAAK,SAAS,MAAM,aAAa,SAAS,KAAK,KAAK,IAAI,KAAA;CAGP,GAAG,KAAK,GAErD,iBAAiB,GAAG,MAAM;CAEhC,OAAO,MACJ,MAAM,SAAS,GAAG,CAAC,CACnB,MAAM,OAAO,GAAG,CAAC,CACjB,KAAK,MAAM,UAAU;EACpB,IAAM,SAAS,QAAQ,IAAI,OAErB,SAAS,IADM,IAAI,SAAS,MAAM,CAAC,cACX,EAAE,KAC1B,YAAY,YAAY,SACxB,iBAAiB,CAAC,YAAY,SAAS;EAC7C,IAAI,CAAC,WACH,OAAO,IAAI,SAAS,KAAK,SAAS,IAAI,IAAI,SAAS;EAGrD,IAAI,aAAa;EACjB,IAA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B,QAAQ;GACN,OAAO;EACT;EAEF,OAAO;CAFL;AAGJ;AAEA,SAAS,gBAAgB,SAA0C;CACjE,IAAM,MAA8B,CAAC;CAIrC,OAHA,QAAQ,SAAS,OAAO,QAAQ;EAC9B,IAAI,OAAO;CACb,CAAC,GACM;AACT;AAEA,SAAS,mBAAmB,KAAc,SAAiB,SAAuC;CAGhG,IAAIA,YAAiB,GAAG,GAAG;EACzB,IAAM,UAAU,QAAQ,UAAU,WAAW,SAAS,QAAQ,WAAW,QACnE,WAAW,QAAQ,OAAO,GAAA,CAAI,SAAS,aAAa,GACpD,SAAS,IAAI;EAGnB,OADA,IAAK,UAAU,aADS,WAAW,OAAO,WAAW,OAAO,WAAW;CAGzE;CAEA,OAAO,mBAAmB,KAAK,SAAS,OAAO;AACjD;AAEA,SAAS,cAAc,QAAgD;CACrE,IAAM,OAAgC,CAAC,GAEjC,gBAAgB,YAChB,OAAO,mBAAmB,KAAA,MACb,MAAM,QAAQ,OAAO,cAAc,IAChD,OAAO,iBACP,CAAC,OAAO,cAAc,EAAA,CACV,MAAM,YACpB,OAAO,WAAY,WAAW,QAAQ,SAAS,OAAO,IAAI,QAAQ,KAAK,OAAO,CAChF;CAGF,OAAO,EACL,cAAc,UAAU;EACtB,IAAM,SAAS,SAAS,QAAQ,IAAI,kBAAkB;EACtD,IAAI,CAAC,QAAQ,OAAO;EAEpB,KAAK,IAAM,OAAO,OAAO,MAAM,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE,KAAK,CAAC,GACjD,CAAC,OAAO,KAAK,QAAQ,aAAa,GAAG,MACzC,KAAK,OAAO,IAEZ,QAAQ,KAAK,GAAG;EAElB,OAAO;CACT,EACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-SnMg7nUX.js","names":["headersToRecord","isHttpError","isGetItHttpError"],"sources":["../src/util/codeFrame.ts","../src/http/errors.ts","../src/http/request.ts"],"sourcesContent":["/**\n * Inlined, modified version of the `codeFrameColumns` function from `@babel/code-frame`.\n * MIT-licensed - https://github.com/babel/babel/blob/main/LICENSE\n * Copyright (c) 2014-present Sebastian McKenzie and other contributors.\n */\ntype Location = {\n column: number\n line: number\n}\n\ntype NodeLocation = {\n start: Location\n end?: Location\n}\n\ntype GroqLocation = {\n start: number\n end?: number\n}\n\n/**\n * RegExp to test for newlines.\n */\n\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/\n\n/**\n * Extract what lines should be marked and highlighted.\n */\n\ntype MarkerLines = Record<number, true | [number, number]>\n\n/**\n * Highlight a code frame with the given location and message.\n *\n * @param query - The query to be highlighted.\n * @param location - The location of the error in the code/query.\n * @param message - Message to be displayed inline (if possible) next to the highlighted\n * location in the code. If it can't be positioned inline, it will be placed above the\n * code frame.\n * @returns The highlighted code frame.\n */\nexport function codeFrame(query: string, location: GroqLocation, message?: string): string {\n const lines = query.split(NEWLINE)\n const loc = {\n start: columnToLine(location.start, lines),\n end: location.end ? columnToLine(location.end, lines) : undefined,\n }\n\n const {start, end, markerLines} = getMarkerLines(loc, lines)\n\n const numberMaxWidth = `${end}`.length\n\n return query\n .split(NEWLINE, end)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth)\n const gutter = ` ${paddedNumber} |`\n const hasMarker = markerLines[number]\n const lastMarkerLine = !markerLines[number + 1]\n if (!hasMarker) {\n return ` ${gutter}${line.length > 0 ? ` ${line}` : ''}`\n }\n\n let markerLine = ''\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\\t]/g, ' ')\n const numberOfMarkers = hasMarker[1] || 1\n\n markerLine = [\n '\\n ',\n gutter.replace(/\\d/g, ' '),\n ' ',\n markerSpacing,\n '^'.repeat(numberOfMarkers),\n ].join('')\n\n if (lastMarkerLine && message) {\n markerLine += ' ' + message\n }\n }\n return ['>', gutter, line.length > 0 ? ` ${line}` : '', markerLine].join('')\n })\n .join('\\n')\n}\n\nfunction getMarkerLines(\n loc: NodeLocation,\n source: Array<string>,\n): {\n start: number\n end: number\n markerLines: MarkerLines\n} {\n const startLoc: Location = {...loc.start}\n const endLoc: Location = {...startLoc, ...loc.end}\n const linesAbove = 2\n const linesBelow = 3\n const startLine = startLoc.line ?? -1\n const startColumn = startLoc.column ?? 0\n const endLine = endLoc.line\n const endColumn = endLoc.column\n\n let start = Math.max(startLine - (linesAbove + 1), 0)\n let end = Math.min(source.length, endLine + linesBelow)\n\n if (startLine === -1) {\n start = 0\n }\n\n if (endLine === -1) {\n end = source.length\n }\n\n const lineDiff = endLine - startLine\n const markerLines: MarkerLines = {}\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine\n\n if (!startColumn) {\n markerLines[lineNumber] = true\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1].length\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1]\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn]\n } else {\n const sourceLength = source[lineNumber - i].length\n\n markerLines[lineNumber] = [0, sourceLength]\n }\n }\n } else {\n if (startColumn === endColumn) {\n if (startColumn) {\n markerLines[startLine] = [startColumn, 0]\n } else {\n markerLines[startLine] = true\n }\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn]\n }\n }\n\n return {start, end, markerLines}\n}\n\nfunction columnToLine(column: number, lines: string[]): Location {\n let offset = 0\n\n for (let i = 0; i < lines.length; i++) {\n const lineLength = lines[i].length + 1 // assume '\\n' after each line\n\n if (offset + lineLength > column) {\n return {\n line: i + 1, // 1-based line\n column: column - offset, // 0-based column\n }\n }\n\n offset += lineLength\n }\n\n // Fallback: beyond last line\n return {\n line: lines.length,\n column: lines[lines.length - 1]?.length ?? 0,\n }\n}\n","import type {ActionError, Any, ErrorProps, MutationError, QueryParseError} from '../types'\nimport {codeFrame} from '../util/codeFrame'\nimport {isRecord} from '../util/isRecord'\n\nconst MAX_ITEMS_IN_ERROR_MESSAGE = 5\n\n/**\n * Canonical HTTP response shape used internally to build {@link ClientError}\n * and {@link ServerError}. Decouples the error layer from any particular\n * transport library — adapters in the HTTP layer (e.g. `httpResponseFromGetIt`)\n * project transport-specific response shapes into this stable form before\n * constructing errors.\n *\n * Matches the public {@link HttpError.response} shape so consumers see no\n * difference in error properties when the underlying transport changes.\n *\n * @internal\n */\nexport interface CanonicalHttpResponse {\n statusCode: number\n statusMessage: string | null\n headers: Record<string, string>\n body: unknown\n url: string\n method: string\n}\n\n/**\n * Adapter for buffered responses from get-it v9 (`BufferedResponse`-shaped).\n *\n * The URL and method aren't on the response itself in v9, so the request\n * options must be passed alongside.\n *\n * @internal\n */\nexport function httpResponseFromFetch(\n res: {\n status: number\n statusText: string\n headers: Headers\n body: unknown\n url: string\n },\n reqUrl: string,\n reqMethod: string,\n): CanonicalHttpResponse {\n return {\n statusCode: res.status,\n statusMessage: res.statusText || null,\n headers: headersToRecord(res.headers),\n body: res.body,\n url: res.url || reqUrl,\n method: reqMethod,\n }\n}\n\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {}\n headers.forEach((value, key) => {\n out[key] = value\n })\n return out\n}\n\n/**\n * Shared properties for HTTP errors (eg both ClientError and ServerError)\n * Use `isHttpError` for type narrowing and accessing response properties.\n *\n * @public\n */\nexport interface HttpError {\n statusCode: number\n message: string\n response: {\n body: unknown\n url: string\n method: string\n headers: Record<string, string>\n statusCode: number\n statusMessage: string | null\n }\n}\n\n/**\n * Checks if the provided error is an HTTP error.\n *\n * @param error - The error to check.\n * @returns `true` if the error is an HTTP error, `false` otherwise.\n * @public\n */\nexport function isHttpError(error: unknown): error is HttpError {\n if (!isRecord(error)) {\n return false\n }\n\n const response = error.response\n if (\n typeof error.statusCode !== 'number' ||\n typeof error.message !== 'string' ||\n !isRecord(response)\n ) {\n return false\n }\n\n if (\n typeof response.body === 'undefined' ||\n typeof response.url !== 'string' ||\n typeof response.method !== 'string' ||\n typeof response.headers !== 'object' ||\n typeof response.statusCode !== 'number'\n ) {\n return false\n }\n\n return true\n}\n\n/** @public */\nexport class ClientError extends Error {\n response: ErrorProps['response']\n statusCode: ErrorProps['statusCode'] = 400\n responseBody: ErrorProps['responseBody']\n traceId: ErrorProps['traceId']\n details: ErrorProps['details']\n\n constructor(res: Any, tag?: string) {\n const props = extractErrorProps(res, tag)\n super(props.message)\n Object.assign(this, props)\n }\n}\n\n/** @public */\nexport class ServerError extends Error {\n response: ErrorProps['response']\n statusCode: ErrorProps['statusCode'] = 500\n responseBody: ErrorProps['responseBody']\n traceId: ErrorProps['traceId']\n details: ErrorProps['details']\n\n constructor(res: Any) {\n const props = extractErrorProps(res)\n super(props.message)\n Object.assign(this, props)\n }\n}\n\nfunction extractErrorProps(res: Any, tag?: string): ErrorProps {\n const body = res.body\n const props = {\n response: res,\n statusCode: res.statusCode,\n responseBody: stringifyBody(body, res),\n traceId: extractTraceId(res),\n message: '',\n details: undefined as Any,\n }\n\n // Fall back early if we didn't get a JSON object returned as expected\n if (!isRecord(body)) {\n props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`\n return props\n }\n\n const error = body.error\n\n // API/Boom style errors ({statusCode, error, message})\n if (typeof error === 'string' && typeof body.message === 'string') {\n props.message = `${error} - ${body.message}${formatTraceId(props.traceId)}`\n return props\n }\n\n // Content Lake errors with a `error` prop being an object\n if (typeof error !== 'object' || error === null) {\n if (typeof error === 'string') {\n props.message = `${error}${formatTraceId(props.traceId)}`\n } else if (typeof body.message === 'string') {\n props.message = `${body.message}${formatTraceId(props.traceId)}`\n } else {\n props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`\n }\n return props\n }\n\n // Mutation errors (specifically)\n if (isMutationError(error) || isActionError(error)) {\n const allItems = error.items || []\n const items = allItems\n .slice(0, MAX_ITEMS_IN_ERROR_MESSAGE)\n .map((item) => item.error?.description)\n .filter(Boolean)\n let itemsStr = items.length ? `:\\n- ${items.join('\\n- ')}` : ''\n if (allItems.length > MAX_ITEMS_IN_ERROR_MESSAGE) {\n itemsStr += `\\n...and ${allItems.length - MAX_ITEMS_IN_ERROR_MESSAGE} more`\n }\n props.message = `${error.description}${formatTraceId(props.traceId)}${itemsStr}`\n props.details = body.error\n return props\n }\n\n // Query parse errors\n if (isQueryParseError(error)) {\n props.message = formatQueryParseError(error, tag, props.traceId)\n props.details = body.error\n return props\n }\n\n if ('description' in error && typeof error.description === 'string') {\n // Query/database errors ({error: {description, other, arb, props}})\n props.message = `${error.description}${formatTraceId(props.traceId)}`\n props.details = error\n return props\n }\n\n // Other, more arbitrary errors\n props.message = `${httpErrorMessage(res, body)}${formatTraceId(props.traceId)}`\n return props\n}\n\nfunction isMutationError(error: object): error is MutationError {\n return (\n 'type' in error &&\n error.type === 'mutationError' &&\n 'description' in error &&\n typeof error.description === 'string'\n )\n}\n\nfunction isActionError(error: object): error is ActionError {\n return (\n 'type' in error &&\n error.type === 'actionError' &&\n 'description' in error &&\n typeof error.description === 'string'\n )\n}\n\n/** @internal */\nexport function isQueryParseError(error: object): error is QueryParseError {\n return (\n isRecord(error) &&\n error.type === 'queryParseError' &&\n typeof error.query === 'string' &&\n typeof error.start === 'number' &&\n typeof error.end === 'number'\n )\n}\n\n/**\n * Formats a GROQ query parse error into a human-readable string.\n *\n * @param error - The error object containing details about the parse error.\n * @param tag - An optional tag to include in the error message.\n * @returns A formatted error message string.\n * @public\n */\nexport function formatQueryParseError(\n error: QueryParseError,\n tag?: string | null,\n traceId?: string,\n) {\n const {query, start, end, description} = error\n const withTraceId = traceId ? `\\n(traceId: ${traceId})` : ''\n\n if (!query || typeof start === 'undefined') {\n return `GROQ query parse error: ${description}${withTraceId}`\n }\n\n const withTag = tag ? `\\n\\nTag: ${tag}` : ''\n const framed = codeFrame(query, {start, end}, description)\n\n return `GROQ query parse error:\\n${framed}${withTag}${withTraceId}`\n}\n\nfunction httpErrorMessage(res: Any, body: unknown) {\n const details = typeof body === 'string' ? ` (${sliceWithEllipsis(body, 100)})` : ''\n const statusMessage = res.statusMessage ? ` ${res.statusMessage}` : ''\n return `${res.method}-request to ${res.url} resulted in HTTP ${res.statusCode}${statusMessage}${details}`\n}\n\n/**\n * Extract the traceId from the traceparent header on the response.\n *\n * The traceparent is on the format [version]-[traceId]-[parentId]-[traceFlags], but\n * when debugging end-user issues it's the traceId we need to be able to get hold of\n * the relevant traces.\n *\n * @see https://www.w3.org/TR/trace-context/\n * @returns The traceId for HTTP response\n */\nfunction extractTraceId(res: Any): string | undefined {\n const traceparent = res?.headers?.['traceparent']\n if (!traceparent) return\n\n return traceparent.split('-')[1]\n}\n\nfunction stringifyBody(body: Any, res: Any) {\n const contentType = (res.headers['content-type'] || '').toLowerCase()\n const isJson = contentType.indexOf('application/json') !== -1\n return isJson ? JSON.stringify(body, null, 2) : body\n}\n\nfunction formatTraceId(traceId: string | undefined): string {\n return traceId ? ` (traceId: ${traceId})` : ''\n}\n\nfunction sliceWithEllipsis(str: string, max: number) {\n return str.length > max ? `${str.slice(0, max)}…` : str\n}\n\n/** @public */\nexport class CorsOriginError extends Error {\n projectId?: string\n addOriginUrl?: URL\n\n constructor({projectId, credentials}: {projectId?: string; credentials?: boolean} = {}) {\n super('CorsOriginError')\n this.name = 'CorsOriginError'\n this.projectId = projectId\n\n // Only build a deep-link when we know which project the user needs to\n // configure - without `projectId` the management URL can't actually route\n // them anywhere useful.\n if (projectId && typeof location !== 'undefined') {\n const url = new URL(`https://sanity.io/manage/project/${projectId}/api`)\n const {origin} = location\n url.searchParams.set('cors', 'add')\n url.searchParams.set('origin', origin)\n if (credentials) {\n // Pre-selects the \"Allow credentials (token-based auth)\" toggle in\n // the Sanity management CORS form.\n url.searchParams.set('credentials', '')\n }\n this.addOriginUrl = url\n this.message = `The current origin is not allowed to connect to the Live Content API. Add it here: ${url}`\n } else if (projectId) {\n this.message = `The current origin is not allowed to connect to the Live Content API. Change your configuration here: https://sanity.io/manage/project/${projectId}/api`\n } else {\n this.message = `The current origin is not allowed to connect to the Live Content API.`\n }\n }\n}\n","import {\n createRequester,\n type FetchFunction,\n isHttpError as isGetItHttpError,\n type RequestOptions as FetchRequestOptions,\n type TransformMiddleware,\n type WrappingMiddleware,\n} from 'get-it'\nimport {isRetryableRequest, retry} from 'get-it/middleware'\nimport {from, Observable} from 'rxjs'\n\nimport type {Any} from '../types'\nimport {ClientError, httpResponseFromFetch, ServerError} from './errors'\n\n/**\n * Middleware accepted by the internal HTTP layer. Two flavors per get-it v9:\n * a flat-pipeline transform (`beforeRequest`/`afterResponse`) or a wrapping\n * middleware that surrounds the fetch chain.\n *\n * @internal\n */\nexport type LegacyMiddleware = TransformMiddleware | WrappingMiddleware\n\n/**\n * The shape this client's internal pipeline produces. Mirrors the historical\n * `ResponseEvent` from the get-it v8 multi-event observable, so all the existing\n * downstream code (`_requestObservable`, `_uploadObservable`,\n * `defineCreateClient`) keeps working without churn.\n *\n * @internal\n */\nexport interface ResponseEvent {\n type: 'response'\n body: unknown\n statusCode: number\n statusMessage: string | null\n headers: Record<string, string>\n url: string\n method: string\n}\n\n/**\n * Legacy \"requester\" type - the observable half of `defineRequester`'s\n * result. Returns a single-event Observable for compatibility with the rest\n * of the codebase.\n *\n * @internal\n */\nexport type LegacyRequester = (options: Any) => Observable<ResponseEvent>\n\n/**\n * Promise-based sibling of {@link LegacyRequester}. Resolves directly to the\n * single `ResponseEvent` the transport produces, skipping the RxJS wrapper.\n * Used by the promise-based client surface so it never constructs an\n * Observable.\n *\n * @internal\n */\nexport type PromiseRequester = (options: Any) => Promise<ResponseEvent>\n\n/**\n * Both forms of the transport, sharing a single underlying get-it requester\n * (so retry state and the one-shot warning de-duplication are shared between\n * the observable and promise paths).\n *\n * @internal\n */\nexport interface DualRequester {\n observable: LegacyRequester\n promise: PromiseRequester\n}\n\n/**\n * Options for tuning the HTTP request pipeline per-client.\n *\n * @internal\n */\nexport interface HttpRequestConfig {\n ignoreWarnings?: string | RegExp | Array<string | RegExp>\n maxRetries?: number\n retryDelay?: (attemptNumber: number) => number\n}\n\n/**\n * Build both the observable and promise transport forms from a single get-it\n * requester. The promise form is the primitive (`executeRequest` is already\n * promise-based); the observable form wraps it lazily so each subscription\n * starts its own request (cold), and unsubscribing aborts the in-flight\n * fetch — the same contract as the get-it v8 observable adapter.\n *\n * @internal\n */\nexport function defineRequester(\n envOptions: EnvironmentOptions,\n config: HttpRequestConfig = {},\n): DualRequester {\n // Framework-patched fetch implementations read extra `RequestInit` fields\n // for caching semantics — Next.js App Router's `cache` and `next` options in\n // particular. Legacy callers pass those via an object-valued `fetch` request\n // option (see `adaptToFetchOptions`, which stashes it in `meta.fetchInit`\n // since get-it v9's own `fetch` option only accepts a function). Merge them\n // into the init of whichever fetch implementation is effective for the\n // request: per-request/test-override fetch, the environment default, or the\n // global fetch.\n const applyFetchInit: WrappingMiddleware = (opts, next) => {\n const fetchInit = opts.meta?.fetchInit\n if (typeof fetchInit !== 'object' || fetchInit === null) return next(opts)\n const baseFetch: NonNullable<FetchRequestOptions['fetch']> =\n opts.fetch ?? envOptions.fetch ?? globalThis.fetch\n const fetchWithInit: typeof baseFetch = (input, init) =>\n baseFetch(input, {...fetchInit, ...init})\n return next({...opts, fetch: fetchWithInit})\n }\n\n const requester = createRequester({\n ...(envOptions.fetch ? {fetch: envOptions.fetch} : {}),\n headers: envOptions.headers,\n // Keep get-it's built-in 4xx/5xx → HttpError so the retry middleware can\n // see them; we translate to ClientError/ServerError after the retry loop\n // has exhausted in `executeRequest`.\n httpErrors: true,\n middleware: [\n retry({\n shouldRetry: shouldRetryRequest,\n maxRetries: config.maxRetries ?? 5,\n ...(config.retryDelay ? {retryDelay: config.retryDelay} : {}),\n }),\n ...envOptions.middleware,\n applyFetchInit,\n printWarnings(config),\n ],\n })\n\n const promise: PromiseRequester = (options: Any) => {\n // Options arrive fetch-shaped from `requestOptions` — the single\n // translation boundary between public option names and the transport.\n if (typeof options.url !== 'string') {\n throw new TypeError('Request options must include a `url`')\n }\n return executeRequest(requester, options)\n }\n\n // Same per-subscription AbortController pattern as `_observe` in\n // dataMethods: a caller-supplied signal is combined in via\n // `AbortSignal.any`, so the request aborts both on the caller's signal and\n // on unsubscribe. `AbortSignal.any` (rather than `addEventListener`)\n // because the caller's signal can be long-lived and reused — a manually\n // added listener would accumulate there once per subscription, since\n // `{once: true}` only cleans up if the signal actually fires.\n const observable: LegacyRequester = (options: Any) =>\n new Observable<ResponseEvent>((subscriber) => {\n const controller = new AbortController()\n const userSignal: AbortSignal | undefined = options.signal\n const signal = userSignal\n ? AbortSignal.any([userSignal, controller.signal])\n : controller.signal\n const subscription = from(promise({...options, signal})).subscribe(subscriber)\n return () => {\n subscription.unsubscribe()\n controller.abort()\n }\n })\n\n return {promise, observable}\n}\n\n/**\n * Options describing the environment-specific defaults (Node vs. browser).\n *\n * @internal\n */\nexport interface EnvironmentOptions {\n fetch?: FetchRequestOptions['fetch']\n headers?: Record<string, string>\n middleware: LegacyMiddleware[]\n /**\n * Resolves the environment's fetch implementation — the same transport\n * regular requests use (custom fetch variants, undici configuration,\n * env-proxy support and all), optionally configured for an explicit proxy\n * URL. Lets consumers of the resolved config (the EventSource fetch\n * resolver) avoid falling back to whatever `globalThis.fetch` happens to\n * be. The Node environment supplies get-it's undici-backed fetch; the\n * browser environment leaves it unset (the global fetch IS the\n * environment's fetch there).\n *\n * Looked up via the env rather than imported directly so that the Node-only\n * `get-it/node` (which transitively pulls in `undici`) never ends up in the\n * browser bundle, even via rollup's inlined dynamic imports.\n */\n resolveFetch?: (proxyUrl?: string) => FetchFunction\n}\n\nasync function executeRequest(\n requester: ReturnType<typeof createRequester>,\n fetchOptions: FetchRequestOptions,\n): Promise<ResponseEvent> {\n const url = fetchOptions.url\n const method = (fetchOptions.method ?? 'GET').toUpperCase()\n\n let response\n try {\n response = await requester(fetchOptions)\n } catch (err) {\n if (isGetItHttpError(err)) {\n // `err.body` is the response body as a string (get-it v9 stores the\n // already-decoded text), regardless of which response variant\n // `err.response` is.\n const errBodyText = typeof err.body === 'string' ? err.body : ''\n const errBody = parseJsonText(errBodyText, err.headers)\n const canonical = httpResponseFromFetch(\n {\n status: err.status,\n statusText: err.statusText,\n headers: err.headers,\n body: errBody,\n url: err.response.url ?? err.url,\n },\n url,\n method,\n )\n const tag = extractRequestTag(fetchOptions.query)\n if (canonical.statusCode >= 500) {\n throw new ServerError(canonical)\n }\n throw new ClientError(canonical, tag)\n }\n throw err\n }\n\n const body = parseJsonBody(response)\n return {\n type: 'response',\n body,\n statusCode: response.status,\n statusMessage: response.statusText || null,\n headers: headersToRecord(response.headers),\n url: response.url || url,\n method,\n }\n}\n\n/**\n * Extract the GROQ request tag (used for error messages) from the query.\n */\nfunction extractRequestTag(query: FetchRequestOptions['query']): string | undefined {\n if (!query) return undefined\n if (query instanceof URLSearchParams) return query.get('tag') ?? undefined\n const tag = query.tag\n return typeof tag === 'string' ? tag : undefined\n}\n\nfunction parseJsonBody(response: {headers: Headers; text(): string}): unknown {\n return parseJsonText(response.text(), response.headers)\n}\n\n/**\n * Parse a response body according to its `content-type`: JSON when the header\n * says so (falling back to the raw text on malformed JSON), text otherwise.\n * Shared with the browser XHR upload path so error bodies parse identically\n * on both transports.\n *\n * @internal\n */\nexport function parseJsonText(text: string, headers: Headers): unknown {\n const contentType = (headers.get('content-type') ?? '').toLowerCase()\n if (!text) return undefined\n if (contentType.includes('application/json')) {\n try {\n return JSON.parse(text)\n } catch {\n return text\n }\n }\n return text\n}\n\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {}\n headers.forEach((value, key) => {\n out[key] = value\n })\n return out\n}\n\nfunction shouldRetryRequest(err: unknown, attempt: number, options: FetchRequestOptions): boolean {\n // HTTP errors aren't usually retryable, but Content Lake gives us a few\n // status codes where retrying *is* the right move.\n if (isGetItHttpError(err)) {\n const isSafe = (options.method ?? 'GET') === 'GET' || options.method === 'HEAD'\n const isQuery = (options.url ?? '').includes('/data/query')\n const status = err.status\n const retryableStatus = status === 429 || status === 502 || status === 503\n if ((isSafe || isQuery) && retryableStatus) return true\n return false\n }\n\n return isRetryableRequest(err, attempt, options)\n}\n\nfunction printWarnings(config: HttpRequestConfig): TransformMiddleware {\n const seen: Record<string, boolean> = {}\n\n const shouldIgnore = (message: string): boolean => {\n if (config.ignoreWarnings === undefined) return false\n const patterns = Array.isArray(config.ignoreWarnings)\n ? config.ignoreWarnings\n : [config.ignoreWarnings]\n return patterns.some((pattern) =>\n typeof pattern === 'string' ? message.includes(pattern) : pattern.test(message),\n )\n }\n\n return {\n afterResponse(response) {\n const header = response.headers.get('x-sanity-warning')\n if (!header) return response\n // Multiple warnings can be comma-separated per HTTP header semantics.\n for (const msg of header.split(',').map((m) => m.trim())) {\n if (!msg || seen[msg] || shouldIgnore(msg)) continue\n seen[msg] = true\n // oxlint-disable-next-line no-console\n console.warn(msg)\n }\n return response\n },\n }\n}\n"],"mappings":";;;;;;;AAwBA,MAAM,UAAU;;;;;;;;;;;AAkBhB,SAAgB,UAAU,OAAe,UAAwB,SAA0B;CACzF,IAAM,QAAQ,MAAM,MAAM,OAAO,GAM3B,EAAC,OAAO,KAAK,gBAAe,eAAe;EAJ/C,OAAO,aAAa,SAAS,OAAO,KAAK;EACzC,KAAK,SAAS,MAAM,aAAa,SAAS,KAAK,KAAK,IAAI,KAAA;CAGP,GAAG,KAAK,GAErD,iBAAiB,GAAG,MAAM;CAEhC,OAAO,MACJ,MAAM,SAAS,GAAG,CAAC,CACnB,MAAM,OAAO,GAAG,CAAC,CACjB,KAAK,MAAM,UAAU;EACpB,IAAM,SAAS,QAAQ,IAAI,OAErB,SAAS,IADM,IAAI,SAAS,MAAM,CAAC,cACX,EAAE,KAC1B,YAAY,YAAY,SACxB,iBAAiB,CAAC,YAAY,SAAS;EAC7C,IAAI,CAAC,WACH,OAAO,IAAI,SAAS,KAAK,SAAS,IAAI,IAAI,SAAS;EAGrD,IAAI,aAAa;EACjB,IAAI,MAAM,QAAQ,SAAS,GAAG;GAC5B,IAAM,gBAAgB,KAAK,MAAM,GAAG,KAAK,IAAI,U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