@sanity/client 5.0.0-esm.8 → 5.0.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.
@@ -1,9 +1,10 @@
1
- import {type Observable, lastValueFrom} from 'rxjs'
1
+ import {lastValueFrom, type Observable} from 'rxjs'
2
2
  import {filter, map} from 'rxjs/operators'
3
3
 
4
4
  import {_requestObservable} from '../data/dataMethods'
5
5
  import type {ObservableSanityClient, SanityClient} from '../SanityClient'
6
6
  import type {
7
+ FIXME,
7
8
  HttpRequest,
8
9
  HttpRequestEvent,
9
10
  ResponseEvent,
@@ -25,7 +26,7 @@ export class ObservableAssetsClient {
25
26
  /**
26
27
  * Uploads a file asset to the configured dataset
27
28
  *
28
- * @param assetType - Asset type (file/image)
29
+ * @param assetType - Asset type (file)
29
30
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
30
31
  * @param options - Options to use for the upload
31
32
  */
@@ -38,7 +39,7 @@ export class ObservableAssetsClient {
38
39
  /**
39
40
  * Uploads an image asset to the configured dataset
40
41
  *
41
- * @param assetType - Asset type (file/image)
42
+ * @param assetType - Asset type (image)
42
43
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
43
44
  * @param options - Options to use for the upload
44
45
  */
@@ -47,6 +48,18 @@ export class ObservableAssetsClient {
47
48
  body: File | Blob | Buffer | NodeJS.ReadableStream,
48
49
  options?: UploadClientConfig
49
50
  ): Observable<HttpRequestEvent<{document: SanityImageAssetDocument}>>
51
+ /**
52
+ * Uploads a file or an image asset to the configured dataset
53
+ *
54
+ * @param assetType - Asset type (file/image)
55
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
56
+ * @param options - Options to use for the upload
57
+ */
58
+ upload(
59
+ assetType: 'file' | 'image',
60
+ body: File | Blob | Buffer | NodeJS.ReadableStream,
61
+ options?: UploadClientConfig
62
+ ): Observable<HttpRequestEvent<{document: SanityAssetDocument | SanityImageAssetDocument}>>
50
63
  upload(
51
64
  assetType: 'file' | 'image',
52
65
  body: File | Blob | Buffer | NodeJS.ReadableStream,
@@ -68,7 +81,7 @@ export class AssetsClient {
68
81
  /**
69
82
  * Uploads a file asset to the configured dataset
70
83
  *
71
- * @param assetType - Asset type (file/image)
84
+ * @param assetType - Asset type (file)
72
85
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
73
86
  * @param options - Options to use for the upload
74
87
  */
@@ -80,7 +93,7 @@ export class AssetsClient {
80
93
  /**
81
94
  * Uploads an image asset to the configured dataset
82
95
  *
83
- * @param assetType - Asset type (file/image)
96
+ * @param assetType - Asset type (image)
84
97
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
85
98
  * @param options - Options to use for the upload
86
99
  */
@@ -89,6 +102,18 @@ export class AssetsClient {
89
102
  body: File | Blob | Buffer | NodeJS.ReadableStream,
90
103
  options?: UploadClientConfig
91
104
  ): Promise<SanityImageAssetDocument>
105
+ /**
106
+ * Uploads a file or an image asset to the configured dataset
107
+ *
108
+ * @param assetType - Asset type (file/image)
109
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
110
+ * @param options - Options to use for the upload
111
+ */
112
+ upload(
113
+ assetType: 'file' | 'image',
114
+ body: File | Blob | Buffer | NodeJS.ReadableStream,
115
+ options?: UploadClientConfig
116
+ ): Promise<SanityAssetDocument | SanityImageAssetDocument>
92
117
  upload(
93
118
  assetType: 'file' | 'image',
94
119
  body: File | Blob | Buffer | NodeJS.ReadableStream,
@@ -97,7 +122,7 @@ export class AssetsClient {
97
122
  const observable = _upload(this.#client, this.#httpRequest, assetType, body, options)
98
123
  return lastValueFrom(
99
124
  observable.pipe(
100
- filter((event: any) => event.type === 'response'),
125
+ filter((event: FIXME) => event.type === 'response'),
101
126
  map(
102
127
  (event) =>
103
128
  (event as ResponseEvent<{document: SanityAssetDocument | SanityImageAssetDocument}>)
@@ -127,7 +152,7 @@ function _upload(
127
152
  const assetEndpoint = assetType === 'image' ? 'images' : 'files'
128
153
  const options = optionsFromFile(opts, body)
129
154
  const {tag, label, title, description, creditLine, filename, source} = options
130
- const query: any = {
155
+ const query: FIXME = {
131
156
  label,
132
157
  title,
133
158
  description,
@@ -151,7 +176,7 @@ function _upload(
151
176
  })
152
177
  }
153
178
 
154
- function optionsFromFile(opts: Record<string, any>, file: any) {
179
+ function optionsFromFile(opts: Record<string, FIXME>, file: FIXME) {
155
180
  if (typeof window === 'undefined' || !(file instanceof window.File)) {
156
181
  return opts
157
182
  }
package/src/config.ts CHANGED
@@ -58,6 +58,7 @@ export const initConfig = (
58
58
  }
59
59
 
60
60
  if (projectBased) {
61
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the nullability here is wrong, as line 48 throws an error if it's undefined
61
62
  validate.projectId(newConfig.projectId!)
62
63
  }
63
64
 
@@ -10,6 +10,7 @@ import type {
10
10
  FilteredResponseQueryOptions,
11
11
  FirstDocumentIdMutationOptions,
12
12
  FirstDocumentMutationOptions,
13
+ FIXME,
13
14
  HttpRequest,
14
15
  HttpRequestEvent,
15
16
  IdentifiedSanityDocumentStub,
@@ -31,7 +32,7 @@ import encodeQueryString from './encodeQueryString'
31
32
  import {ObservablePatch, Patch} from './patch'
32
33
  import {ObservableTransaction, Transaction} from './transaction'
33
34
 
34
- const excludeFalsey = (param: any, defValue: any) => {
35
+ const excludeFalsey = (param: FIXME, defValue: FIXME) => {
35
36
  const value = typeof param === 'undefined' ? defValue : param
36
37
  return param === false ? undefined : value
37
38
  }
@@ -47,10 +48,10 @@ const getMutationQuery = (options: BaseMutationOptions = {}) => {
47
48
  }
48
49
  }
49
50
 
50
- const isResponse = (event: any) => event.type === 'response'
51
- const getBody = (event: any) => event.body
51
+ const isResponse = (event: FIXME) => event.type === 'response'
52
+ const getBody = (event: FIXME) => event.body
52
53
 
53
- const indexBy = (docs: any[], attr: any) =>
54
+ const indexBy = (docs: FIXME[], attr: FIXME) =>
54
55
  docs.reduce((indexed, doc) => {
55
56
  indexed[attr(doc)] = doc
56
57
  return indexed
@@ -59,21 +60,21 @@ const indexBy = (docs: any[], attr: any) =>
59
60
  const getQuerySizeLimit = 11264
60
61
 
61
62
  /** @internal */
62
- export function _fetch<R>(
63
+ export function _fetch<R, Q extends QueryParams>(
63
64
  client: ObservableSanityClient | SanityClient,
64
65
  httpRequest: HttpRequest,
65
66
  query: string,
66
- params?: QueryParams,
67
+ params?: Q,
67
68
  options: FilteredResponseQueryOptions | UnfilteredResponseQueryOptions = {}
68
69
  ): Observable<RawQueryResponse<R> | R> {
69
70
  const mapResponse =
70
- options.filterResponse === false ? (res: any) => res : (res: any) => res.result
71
+ options.filterResponse === false ? (res: FIXME) => res : (res: FIXME) => res.result
71
72
 
72
73
  return _dataRequest(client, httpRequest, 'query', {query, params}, options).pipe(map(mapResponse))
73
74
  }
74
75
 
75
76
  /** @internal */
76
- export function _getDocument<R extends Record<string, any>>(
77
+ export function _getDocument<R extends Record<string, FIXME>>(
77
78
  client: ObservableSanityClient | SanityClient,
78
79
  httpRequest: HttpRequest,
79
80
  id: string,
@@ -87,7 +88,7 @@ export function _getDocument<R extends Record<string, any>>(
87
88
  }
88
89
 
89
90
  /** @internal */
90
- export function _getDocuments<R extends Record<string, any>>(
91
+ export function _getDocuments<R extends Record<string, FIXME>>(
91
92
  client: ObservableSanityClient | SanityClient,
92
93
  httpRequest: HttpRequest,
93
94
  ids: string[],
@@ -96,15 +97,15 @@ export function _getDocuments<R extends Record<string, any>>(
96
97
  const options = {uri: _getDataUrl(client, 'doc', ids.join(',')), json: true, tag: opts.tag}
97
98
  return _requestObservable<(SanityDocument<R> | null)[]>(client, httpRequest, options).pipe(
98
99
  filter(isResponse),
99
- map((event: any) => {
100
- const indexed = indexBy(event.body.documents || [], (doc: any) => doc._id)
100
+ map((event: FIXME) => {
101
+ const indexed = indexBy(event.body.documents || [], (doc: FIXME) => doc._id)
101
102
  return ids.map((id) => indexed[id] || null)
102
103
  })
103
104
  )
104
105
  }
105
106
 
106
107
  /** @internal */
107
- export function _createIfNotExists<R extends Record<string, any>>(
108
+ export function _createIfNotExists<R extends Record<string, FIXME>>(
108
109
  client: ObservableSanityClient | SanityClient,
109
110
  httpRequest: HttpRequest,
110
111
  doc: IdentifiedSanityDocumentStub<R>,
@@ -122,7 +123,7 @@ export function _createIfNotExists<R extends Record<string, any>>(
122
123
  }
123
124
 
124
125
  /** @internal */
125
- export function _createOrReplace<R extends Record<string, any>>(
126
+ export function _createOrReplace<R extends Record<string, FIXME>>(
126
127
  client: ObservableSanityClient | SanityClient,
127
128
  httpRequest: HttpRequest,
128
129
  doc: IdentifiedSanityDocumentStub<R>,
@@ -140,7 +141,7 @@ export function _createOrReplace<R extends Record<string, any>>(
140
141
  }
141
142
 
142
143
  /** @internal */
143
- export function _delete<R extends Record<string, any>>(
144
+ export function _delete<R extends Record<string, FIXME>>(
144
145
  client: ObservableSanityClient | SanityClient,
145
146
  httpRequest: HttpRequest,
146
147
  selection: string | MutationSelection,
@@ -163,7 +164,7 @@ export function _delete<R extends Record<string, any>>(
163
164
  }
164
165
 
165
166
  /** @internal */
166
- export function _mutate<R extends Record<string, any>>(
167
+ export function _mutate<R extends Record<string, FIXME>>(
167
168
  client: SanityClient | ObservableSanityClient,
168
169
  httpRequest: HttpRequest,
169
170
  mutations: Mutation<R>[] | Patch | ObservablePatch | Transaction | ObservableTransaction,
@@ -185,7 +186,7 @@ export function _mutate<R extends Record<string, any>>(
185
186
  : mutations
186
187
 
187
188
  const muts = Array.isArray(mut) ? mut : [mut]
188
- const transactionId = options && (options as any).transactionId
189
+ const transactionId = options && (options as FIXME).transactionId
189
190
  return _dataRequest(client, httpRequest, 'mutate', {mutations: muts, transactionId}, options)
190
191
  }
191
192
 
@@ -196,9 +197,9 @@ export function _dataRequest(
196
197
  client: SanityClient | ObservableSanityClient,
197
198
  httpRequest: HttpRequest,
198
199
  endpoint: string,
199
- body: any,
200
- options: any = {}
201
- ): any {
200
+ body: FIXME,
201
+ options: FIXME = {}
202
+ ): FIXME {
202
203
  const isMutation = endpoint === 'mutate'
203
204
  const isQuery = endpoint === 'query'
204
205
 
@@ -238,12 +239,12 @@ export function _dataRequest(
238
239
  if (options.returnDocuments) {
239
240
  return returnFirst
240
241
  ? results[0] && results[0].document
241
- : results.map((mut: any) => mut.document)
242
+ : results.map((mut: FIXME) => mut.document)
242
243
  }
243
244
 
244
245
  // Return a reduced subset
245
246
  const key = returnFirst ? 'documentId' : 'documentIds'
246
- const ids = returnFirst ? results[0] && results[0].id : results.map((mut: any) => mut.id)
247
+ const ids = returnFirst ? results[0] && results[0].id : results.map((mut: FIXME) => mut.id)
247
248
  return {
248
249
  transactionId: res.transactionId,
249
250
  results: results,
@@ -256,12 +257,12 @@ export function _dataRequest(
256
257
  /**
257
258
  * @internal
258
259
  */
259
- export function _create<R extends Record<string, any>>(
260
+ export function _create<R extends Record<string, FIXME>>(
260
261
  client: SanityClient | ObservableSanityClient,
261
262
  httpRequest: HttpRequest,
262
- doc: any,
263
- op: any,
264
- options: any = {}
263
+ doc: FIXME,
264
+ op: FIXME,
265
+ options: FIXME = {}
265
266
  ): Observable<
266
267
  SanityDocument<R> | SanityDocument<R>[] | SingleMutationResult | MultipleMutationResult
267
268
  > {
@@ -307,6 +308,7 @@ export function _requestObservable<R>(
307
308
  ) as RequestOptions
308
309
 
309
310
  return new Observable<HttpRequestEvent<R>>((subscriber) =>
311
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the typings thinks it's optional because it's not required to specify it when calling createClient, but it's always defined in practice since SanityClient provides a default
310
312
  httpRequest(reqOptions, config.requester!).subscribe(subscriber)
311
313
  )
312
314
  }
@@ -317,11 +319,11 @@ export function _requestObservable<R>(
317
319
  export function _request<R>(
318
320
  client: SanityClient | ObservableSanityClient,
319
321
  httpRequest: HttpRequest,
320
- options: any
322
+ options: FIXME
321
323
  ): Observable<R> {
322
324
  const observable = _requestObservable<R>(client, httpRequest, options).pipe(
323
- filter((event: any) => event.type === 'response'),
324
- map((event: any) => event.body)
325
+ filter((event: FIXME) => event.type === 'response'),
326
+ map((event: FIXME) => event.body)
325
327
  )
326
328
 
327
329
  return observable
@@ -1,28 +1,29 @@
1
- import type {QueryParams} from '../types'
2
-
3
- const enc = encodeURIComponent
1
+ import type {FIXME, QueryParams} from '../types'
4
2
 
5
3
  export default ({
6
4
  query,
7
- params = {} as any,
8
- options = {} as any,
5
+ params = {},
6
+ options = {},
9
7
  }: {
10
8
  query: string
11
9
  params?: QueryParams
12
- options?: any
10
+ options?: FIXME
13
11
  }) => {
12
+ const searchParams = new URLSearchParams()
14
13
  // We generally want tag at the start of the query string
15
14
  const {tag, ...opts} = options
16
- const q = `query=${enc(query)}`
17
- const base = tag ? `?tag=${enc(tag)}&${q}` : `?${q}`
15
+ if (tag) searchParams.set('tag', tag)
16
+ searchParams.set('query', query)
18
17
 
19
- const qString = Object.keys(params).reduce(
20
- (qs, param) => `${qs}&${enc(`$${param}`)}=${enc(JSON.stringify(params[param]))}`,
21
- base
22
- )
18
+ // Iterate params, the keys are prefixed with `$` and their values JSON stringified
19
+ for (const [key, value] of Object.entries(params)) {
20
+ searchParams.set(`$${key}`, JSON.stringify(value))
21
+ }
22
+ // Options are passed as-is
23
+ for (const [key, value] of Object.entries(opts)) {
24
+ // Skip falsy values
25
+ if (value) searchParams.set(key, `${value}`)
26
+ }
23
27
 
24
- return Object.keys(opts).reduce((qs, option) => {
25
- // Only include the option if it is truthy
26
- return options[option] ? `${qs}&${enc(option)}=${enc(options[option])}` : qs
27
- }, qString)
28
+ return `?${searchParams}`
28
29
  }
@@ -1,8 +1,8 @@
1
1
  import polyfilledEventSource from '@sanity/eventsource'
2
2
  import {Observable} from 'rxjs'
3
3
 
4
- import type {SanityClient} from '../SanityClient'
5
- import type {ListenEvent, ListenOptions, MutationEvent, QueryParams} from '../types'
4
+ import type {ObservableSanityClient, SanityClient} from '../SanityClient'
5
+ import type {FIXME, ListenEvent, ListenOptions, MutationEvent, QueryParams} from '../types'
6
6
  import defaults from '../util/defaults'
7
7
  import pick from '../util/pick'
8
8
  import {_getDataUrl} from './dataMethods'
@@ -34,8 +34,8 @@ const defaultOptions = {
34
34
  * @param options - Listener options
35
35
  * @internal
36
36
  */
37
- export function _listen<R extends Record<string, any> = Record<string, any>>(
38
- this: SanityClient,
37
+ export function _listen<R extends Record<string, FIXME> = Record<string, FIXME>>(
38
+ this: SanityClient | ObservableSanityClient,
39
39
  query: string,
40
40
  params?: QueryParams
41
41
  ): Observable<MutationEvent<R>>
@@ -47,15 +47,15 @@ export function _listen<R extends Record<string, any> = Record<string, any>>(
47
47
  * @param options - Listener options
48
48
  * @internal
49
49
  */
50
- export function _listen<R extends Record<string, any> = Record<string, any>>(
51
- this: SanityClient,
50
+ export function _listen<R extends Record<string, FIXME> = Record<string, FIXME>>(
51
+ this: SanityClient | ObservableSanityClient,
52
52
  query: string,
53
53
  params?: QueryParams,
54
54
  options?: ListenOptions
55
55
  ): Observable<ListenEvent<R>>
56
56
  /** @internal */
57
- export function _listen<R extends Record<string, any> = Record<string, any>>(
58
- this: SanityClient,
57
+ export function _listen<R extends Record<string, FIXME> = Record<string, FIXME>>(
58
+ this: SanityClient | ObservableSanityClient,
59
59
  query: string,
60
60
  params?: QueryParams,
61
61
  opts: ListenOptions = {}
@@ -114,11 +114,11 @@ export function _listen<R extends Record<string, any> = Record<string, any>>(
114
114
  }
115
115
  }
116
116
 
117
- function onChannelError(err: any) {
117
+ function onChannelError(err: FIXME) {
118
118
  observer.error(cooerceError(err))
119
119
  }
120
120
 
121
- function onMessage(evt: any) {
121
+ function onMessage(evt: FIXME) {
122
122
  const event = parseEvent(evt)
123
123
  return event instanceof Error ? observer.error(event) : observer.next(event)
124
124
  }
@@ -165,7 +165,7 @@ export function _listen<R extends Record<string, any> = Record<string, any>>(
165
165
  })
166
166
  }
167
167
 
168
- function parseEvent(event: any) {
168
+ function parseEvent(event: FIXME) {
169
169
  try {
170
170
  const data = (event.data && JSON.parse(event.data)) || {}
171
171
  return Object.assign({type: event.type}, data)
@@ -174,7 +174,7 @@ function parseEvent(event: any) {
174
174
  }
175
175
  }
176
176
 
177
- function cooerceError(err: any) {
177
+ function cooerceError(err: FIXME) {
178
178
  if (err instanceof Error) {
179
179
  return err
180
180
  }
@@ -183,7 +183,7 @@ function cooerceError(err: any) {
183
183
  return evt instanceof Error ? evt : new Error(extractErrorMessage(evt))
184
184
  }
185
185
 
186
- function extractErrorMessage(err: any) {
186
+ function extractErrorMessage(err: FIXME) {
187
187
  if (!err.error) {
188
188
  return err.message || 'Unknown listener error'
189
189
  }
package/src/data/patch.ts CHANGED
@@ -8,6 +8,7 @@ import type {
8
8
  BaseMutationOptions,
9
9
  FirstDocumentIdMutationOptions,
10
10
  FirstDocumentMutationOptions,
11
+ FIXME,
11
12
  MultipleMutationResult,
12
13
  PatchMutationOperation,
13
14
  PatchOperations,
@@ -27,18 +28,6 @@ export class BasePatch {
27
28
  this.operations = operations
28
29
  }
29
30
 
30
- /**
31
- * DEPRECATED: Don't use.
32
- * The operation is added to the current patch, ready to be commited by `commit()`
33
- *
34
- * @deprecated - Don't use.
35
- * @param attrs - Attributes to replace
36
- */
37
- replace(attrs: AttributeSet): this {
38
- validateObject('replace', attrs)
39
- return this._set('set', {$: attrs})
40
- }
41
-
42
31
  /**
43
32
  * Sets the given attributes to the document. Does NOT merge objects.
44
33
  * The operation is added to the current patch, ready to be commited by `commit()`
@@ -110,7 +99,7 @@ export class BasePatch {
110
99
  * @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
111
100
  * @param items - Array of items to insert/replace
112
101
  */
113
- insert(at: 'before' | 'after' | 'replace', selector: string, items: any[]): this {
102
+ insert(at: 'before' | 'after' | 'replace', selector: string, items: FIXME[]): this {
114
103
  validateInsert(at, selector, items)
115
104
  return this._assign('insert', {[at]: selector, items})
116
105
  }
@@ -121,7 +110,7 @@ export class BasePatch {
121
110
  * @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`
122
111
  * @param items - Array of items to append to the array
123
112
  */
124
- append(selector: string, items: any[]): this {
113
+ append(selector: string, items: FIXME[]): this {
125
114
  return this.insert('after', `${selector}[-1]`, items)
126
115
  }
127
116
 
@@ -131,7 +120,7 @@ export class BasePatch {
131
120
  * @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`
132
121
  * @param items - Array of items to prepend to the array
133
122
  */
134
- prepend(selector: string, items: any[]): this {
123
+ prepend(selector: string, items: FIXME[]): this {
135
124
  return this.insert('before', `${selector}[0]`, items)
136
125
  }
137
126
 
@@ -143,7 +132,7 @@ export class BasePatch {
143
132
  * @param deleteCount - An integer indicating the number of old array elements to remove.
144
133
  * @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array.
145
134
  */
146
- splice(selector: string, start: number, deleteCount?: number, items?: any[]): this {
135
+ splice(selector: string, start: number, deleteCount?: number, items?: FIXME[]): this {
147
136
  // Negative indexes doesn't mean the same in Sanity as they do in JS;
148
137
  // -1 means "actually at the end of the array", which allows inserting
149
138
  // at the end of the array without knowing its length. We therefore have
@@ -189,7 +178,7 @@ export class BasePatch {
189
178
  return this
190
179
  }
191
180
 
192
- protected _assign(op: keyof PatchOperations, props: any, merge = true): this {
181
+ protected _assign(op: keyof PatchOperations, props: FIXME, merge = true): this {
193
182
  validateObject(op, props)
194
183
  this.operations = Object.assign({}, this.operations, {
195
184
  [op]: Object.assign({}, (merge && this.operations[op]) || {}, props),
@@ -197,7 +186,7 @@ export class BasePatch {
197
186
  return this
198
187
  }
199
188
 
200
- protected _set(op: keyof PatchOperations, props: any): this {
189
+ protected _set(op: keyof PatchOperations, props: FIXME): this {
201
190
  return this._assign(op, props, false)
202
191
  }
203
192
  }
@@ -227,7 +216,7 @@ export class ObservablePatch extends BasePatch {
227
216
  *
228
217
  * @param options - Options for the mutation operation
229
218
  */
230
- commit<R extends Record<string, any> = Record<string, any>>(
219
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
231
220
  options: FirstDocumentMutationOptions
232
221
  ): Observable<SanityDocument<R>>
233
222
  /**
@@ -235,7 +224,7 @@ export class ObservablePatch extends BasePatch {
235
224
  *
236
225
  * @param options - Options for the mutation operation
237
226
  */
238
- commit<R extends Record<string, any> = Record<string, any>>(
227
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
239
228
  options: AllDocumentsMutationOptions
240
229
  ): Observable<SanityDocument<R>[]>
241
230
  /**
@@ -255,10 +244,10 @@ export class ObservablePatch extends BasePatch {
255
244
  *
256
245
  * @param options - Options for the mutation operation
257
246
  */
258
- commit<R extends Record<string, any> = Record<string, any>>(
247
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
259
248
  options?: BaseMutationOptions
260
249
  ): Observable<SanityDocument<R>>
261
- commit<R extends Record<string, any> = Record<string, any>>(
250
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
262
251
  options?:
263
252
  | FirstDocumentMutationOptions
264
253
  | AllDocumentsMutationOptions
@@ -277,7 +266,7 @@ export class ObservablePatch extends BasePatch {
277
266
 
278
267
  const returnFirst = typeof this.selection === 'string'
279
268
  const opts = Object.assign({returnFirst, returnDocuments: true}, options)
280
- return this.#client.mutate<R>({patch: this.serialize()} as any, opts)
269
+ return this.#client.mutate<R>({patch: this.serialize()} as FIXME, opts)
281
270
  }
282
271
  }
283
272
 
@@ -301,7 +290,7 @@ export class Patch extends BasePatch {
301
290
  *
302
291
  * @param options - Options for the mutation operation
303
292
  */
304
- commit<R extends Record<string, any> = Record<string, any>>(
293
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
305
294
  options: FirstDocumentMutationOptions
306
295
  ): Promise<SanityDocument<R>>
307
296
  /**
@@ -309,7 +298,7 @@ export class Patch extends BasePatch {
309
298
  *
310
299
  * @param options - Options for the mutation operation
311
300
  */
312
- commit<R extends Record<string, any> = Record<string, any>>(
301
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
313
302
  options: AllDocumentsMutationOptions
314
303
  ): Promise<SanityDocument<R>[]>
315
304
  /**
@@ -329,10 +318,10 @@ export class Patch extends BasePatch {
329
318
  *
330
319
  * @param options - Options for the mutation operation
331
320
  */
332
- commit<R extends Record<string, any> = Record<string, any>>(
321
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
333
322
  options?: BaseMutationOptions
334
323
  ): Promise<SanityDocument<R>>
335
- commit<R extends Record<string, any> = Record<string, any>>(
324
+ commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
336
325
  options?:
337
326
  | FirstDocumentMutationOptions
338
327
  | AllDocumentsMutationOptions
@@ -351,6 +340,6 @@ export class Patch extends BasePatch {
351
340
 
352
341
  const returnFirst = typeof this.selection === 'string'
353
342
  const opts = Object.assign({returnFirst, returnDocuments: true}, options)
354
- return this.#client.mutate<R>({patch: this.serialize()} as any, opts)
343
+ return this.#client.mutate<R>({patch: this.serialize()} as FIXME, opts)
355
344
  }
356
345
  }