@sanity/client 5.0.0-esm.2 → 5.0.0-esm.4

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.
@@ -13,6 +13,7 @@ import type {
13
13
  } from '../types'
14
14
  import * as validators from '../validators'
15
15
 
16
+ /** @internal */
16
17
  export class ObservableAssetsClient {
17
18
  #client: ObservableSanityClient
18
19
  #httpRequest: HttpRequest
@@ -24,9 +25,9 @@ export class ObservableAssetsClient {
24
25
  /**
25
26
  * Uploads a file asset to the configured dataset
26
27
  *
27
- * @param assetType Asset type (file/image)
28
- * @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
29
- * @param options Options to use for the upload
28
+ * @param assetType - Asset type (file/image)
29
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
30
+ * @param options - Options to use for the upload
30
31
  */
31
32
  upload(
32
33
  assetType: 'file',
@@ -37,9 +38,9 @@ export class ObservableAssetsClient {
37
38
  /**
38
39
  * Uploads an image asset to the configured dataset
39
40
  *
40
- * @param assetType Asset type (file/image)
41
- * @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
42
- * @param options Options to use for the upload
41
+ * @param assetType - Asset type (file/image)
42
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
43
+ * @param options - Options to use for the upload
43
44
  */
44
45
  upload(
45
46
  assetType: 'image',
@@ -55,6 +56,7 @@ export class ObservableAssetsClient {
55
56
  }
56
57
  }
57
58
 
59
+ /** @internal */
58
60
  export class AssetsClient {
59
61
  #client: SanityClient
60
62
  #httpRequest: HttpRequest
@@ -66,9 +68,9 @@ export class AssetsClient {
66
68
  /**
67
69
  * Uploads a file asset to the configured dataset
68
70
  *
69
- * @param assetType Asset type (file/image)
70
- * @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
71
- * @param options Options to use for the upload
71
+ * @param assetType - Asset type (file/image)
72
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
73
+ * @param options - Options to use for the upload
72
74
  */
73
75
  upload(
74
76
  assetType: 'file',
@@ -78,9 +80,9 @@ export class AssetsClient {
78
80
  /**
79
81
  * Uploads an image asset to the configured dataset
80
82
  *
81
- * @param assetType Asset type (file/image)
82
- * @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
83
- * @param options Options to use for the upload
83
+ * @param assetType - Asset type (file/image)
84
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
85
+ * @param options - Options to use for the upload
84
86
  */
85
87
  upload(
86
88
  assetType: 'image',
@@ -1,9 +1,10 @@
1
1
  import {type Observable, lastValueFrom} from 'rxjs'
2
2
 
3
- import * as dataMethods from '../data/dataMethods'
3
+ import {_request} from '../data/dataMethods'
4
4
  import type {ObservableSanityClient, SanityClient} from '../SanityClient'
5
5
  import type {AuthProviderResponse, HttpRequest} from '../types'
6
6
 
7
+ /** @internal */
7
8
  export class ObservableAuthClient {
8
9
  #client: ObservableSanityClient
9
10
  #httpRequest: HttpRequest
@@ -15,21 +16,24 @@ export class ObservableAuthClient {
15
16
  /**
16
17
  * Fetch available login providers
17
18
  */
18
- getLoginProviders<R = AuthProviderResponse>(): Observable<R> {
19
- return dataMethods._request<R>(this.#client, this.#httpRequest, {uri: '/auth/providers'})
19
+ getLoginProviders(): Observable<AuthProviderResponse> {
20
+ return _request<AuthProviderResponse>(this.#client, this.#httpRequest, {
21
+ uri: '/auth/providers',
22
+ })
20
23
  }
21
24
 
22
25
  /**
23
26
  * Revoke the configured session/token
24
27
  */
25
- logout<R = any>(): Observable<R> {
26
- return dataMethods._request<R>(this.#client, this.#httpRequest, {
28
+ logout(): Observable<void> {
29
+ return _request<void>(this.#client, this.#httpRequest, {
27
30
  uri: '/auth/logout',
28
31
  method: 'POST',
29
32
  })
30
33
  }
31
34
  }
32
35
 
36
+ /** @internal */
33
37
  export class AuthClient {
34
38
  #client: SanityClient
35
39
  #httpRequest: HttpRequest
@@ -41,18 +45,20 @@ export class AuthClient {
41
45
  /**
42
46
  * Fetch available login providers
43
47
  */
44
- getLoginProviders<R = AuthProviderResponse>(): Promise<R> {
48
+ getLoginProviders(): Promise<AuthProviderResponse> {
45
49
  return lastValueFrom(
46
- dataMethods._request<R>(this.#client, this.#httpRequest, {uri: '/auth/providers'})
50
+ _request<AuthProviderResponse>(this.#client, this.#httpRequest, {
51
+ uri: '/auth/providers',
52
+ })
47
53
  )
48
54
  }
49
55
 
50
56
  /**
51
57
  * Revoke the configured session/token
52
58
  */
53
- logout<R = any>(): Promise<R> {
59
+ logout(): Promise<void> {
54
60
  return lastValueFrom(
55
- dataMethods._request<R>(this.#client, this.#httpRequest, {
61
+ _request<void>(this.#client, this.#httpRequest, {
56
62
  uri: '/auth/logout',
57
63
  method: 'POST',
58
64
  })
package/src/config.ts CHANGED
@@ -4,7 +4,7 @@ import * as validate from './validators'
4
4
  import * as warnings from './warnings'
5
5
 
6
6
  const defaultCdnHost = 'apicdn.sanity.io'
7
- const defaultConfig = {
7
+ export const defaultConfig = {
8
8
  apiHost: 'https://api.sanity.io',
9
9
  apiVersion: '1',
10
10
  useProjectHostname: true,
@@ -58,7 +58,7 @@ export const initConfig = (
58
58
  }
59
59
 
60
60
  if (projectBased) {
61
- validate.projectId(newConfig.projectId)
61
+ validate.projectId(newConfig.projectId!)
62
62
  }
63
63
 
64
64
  if (newConfig.dataset) {
@@ -79,7 +79,7 @@ export function _getDocument<R extends Record<string, any>>(
79
79
  id: string,
80
80
  opts: {tag?: string} = {}
81
81
  ): Observable<SanityDocument<R> | undefined> {
82
- const options = {uri: client.getDataUrl('doc', id), json: true, tag: opts.tag}
82
+ const options = {uri: _getDataUrl(client, 'doc', id), json: true, tag: opts.tag}
83
83
  return _requestObservable<SanityDocument<R> | undefined>(client, httpRequest, options).pipe(
84
84
  filter(isResponse),
85
85
  map((event) => event.body.documents && event.body.documents[0])
@@ -93,7 +93,7 @@ export function _getDocuments<R extends Record<string, any>>(
93
93
  ids: string[],
94
94
  opts: {tag?: string} = {}
95
95
  ): Observable<(SanityDocument<R> | null)[]> {
96
- const options = {uri: client.getDataUrl('doc', ids.join(',')), json: true, tag: opts.tag}
96
+ const options = {uri: _getDataUrl(client, 'doc', ids.join(',')), json: true, tag: opts.tag}
97
97
  return _requestObservable<(SanityDocument<R> | null)[]>(client, httpRequest, options).pipe(
98
98
  filter(isResponse),
99
99
  map((event: any) => {
@@ -210,7 +210,7 @@ export function _dataRequest(
210
210
  const returnFirst = options.returnFirst
211
211
  const {timeout, token, tag, headers} = options
212
212
 
213
- const uri = client.getDataUrl(endpoint, stringQuery)
213
+ const uri = _getDataUrl(client, endpoint, stringQuery)
214
214
 
215
215
  const reqOptions = {
216
216
  method: useGet ? 'GET' : 'POST',
@@ -302,7 +302,7 @@ export function _requestObservable<R>(
302
302
  const reqOptions = getRequestOptions(
303
303
  config,
304
304
  Object.assign({}, options, {
305
- url: client.getUrl(uri, useCdn),
305
+ url: _getUrl(client, uri, useCdn),
306
306
  })
307
307
  ) as RequestOptions
308
308
 
@@ -326,3 +326,31 @@ export function _request<R>(
326
326
 
327
327
  return observable
328
328
  }
329
+
330
+ /**
331
+ * @internal
332
+ */
333
+ export function _getDataUrl(
334
+ client: SanityClient | ObservableSanityClient,
335
+ operation: string,
336
+ path?: string
337
+ ): string {
338
+ const config = client.config()
339
+ const catalog = validators.hasDataset(config)
340
+ const baseUri = `/${operation}/${catalog}`
341
+ const uri = path ? `${baseUri}/${path}` : baseUri
342
+ return `/data${uri}`.replace(/\/($|\?)/, '$1')
343
+ }
344
+
345
+ /**
346
+ * @internal
347
+ */
348
+ export function _getUrl(
349
+ client: SanityClient | ObservableSanityClient,
350
+ uri: string,
351
+ canUseCdn = false
352
+ ): string {
353
+ const {url, cdnUrl} = client.config()
354
+ const base = canUseCdn ? cdnUrl : url
355
+ return `${base}/${uri.replace(/^\//, '')}`
356
+ }
@@ -1,10 +1,11 @@
1
1
  import polyfilledEventSource from '@sanity/eventsource'
2
2
  import {Observable} from 'rxjs'
3
3
 
4
- import type {ObservableSanityClient, SanityClient} from '../SanityClient'
4
+ import type {SanityClient} from '../SanityClient'
5
5
  import type {ListenEvent, ListenOptions, MutationEvent, QueryParams} from '../types'
6
6
  import defaults from '../util/defaults'
7
7
  import pick from '../util/pick'
8
+ import {_getDataUrl} from './dataMethods'
8
9
  import encodeQueryString from './encodeQueryString'
9
10
 
10
11
  // Limit is 16K for a _request_, eg including headers. Have to account for an
@@ -28,9 +29,9 @@ const defaultOptions = {
28
29
  /**
29
30
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
30
31
  *
31
- * @param query GROQ-filter to listen to changes for
32
- * @param params Optional query parameters
33
- * @param options Listener options
32
+ * @param query - GROQ-filter to listen to changes for
33
+ * @param params - Optional query parameters
34
+ * @param options - Listener options
34
35
  * @internal
35
36
  */
36
37
  export function _listen<R extends Record<string, any> = Record<string, any>>(
@@ -41,9 +42,9 @@ export function _listen<R extends Record<string, any> = Record<string, any>>(
41
42
  /**
42
43
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
43
44
  *
44
- * @param query GROQ-filter to listen to changes for
45
- * @param params Optional query parameters
46
- * @param options Listener options
45
+ * @param query - GROQ-filter to listen to changes for
46
+ * @param params - Optional query parameters
47
+ * @param options - Listener options
47
48
  * @internal
48
49
  */
49
50
  export function _listen<R extends Record<string, any> = Record<string, any>>(
@@ -54,7 +55,7 @@ export function _listen<R extends Record<string, any> = Record<string, any>>(
54
55
  ): Observable<ListenEvent<R>>
55
56
  /** @internal */
56
57
  export function _listen<R extends Record<string, any> = Record<string, any>>(
57
- this: SanityClient | ObservableSanityClient,
58
+ this: SanityClient,
58
59
  query: string,
59
60
  params?: QueryParams,
60
61
  opts: ListenOptions = {}
@@ -65,7 +66,7 @@ export function _listen<R extends Record<string, any> = Record<string, any>>(
65
66
  const listenOpts = pick(options, possibleOptions)
66
67
  const qs = encodeQueryString({query, params, options: {tag, ...listenOpts}})
67
68
 
68
- const uri = `${url}${this.getDataUrl('listen', qs)}`
69
+ const uri = `${url}${_getDataUrl(this, 'listen', qs)}`
69
70
  if (uri.length > MAX_URL_LENGTH) {
70
71
  return new Observable((observer) => observer.error(new Error('Query too large for listener')))
71
72
  }
package/src/data/patch.ts CHANGED
@@ -18,6 +18,7 @@ import type {
18
18
  import getSelection from '../util/getSelection'
19
19
  import {validateInsert, validateObject} from '../validators'
20
20
 
21
+ /** @internal */
21
22
  export class BasePatch {
22
23
  protected selection: PatchSelection
23
24
  protected operations: PatchOperations
@@ -30,8 +31,8 @@ export class BasePatch {
30
31
  * DEPRECATED: Don't use.
31
32
  * The operation is added to the current patch, ready to be commited by `commit()`
32
33
  *
33
- * @deprecated
34
- * @param attrs Attributes to replace
34
+ * @deprecated - Don't use.
35
+ * @param attrs - Attributes to replace
35
36
  */
36
37
  replace(attrs: AttributeSet): this {
37
38
  validateObject('replace', attrs)
@@ -42,7 +43,7 @@ export class BasePatch {
42
43
  * Sets the given attributes to the document. Does NOT merge objects.
43
44
  * The operation is added to the current patch, ready to be commited by `commit()`
44
45
  *
45
- * @param attrs Attributes to set. To set a deep attribute, use JSONMatch, eg: {"nested.prop": "value"}
46
+ * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
46
47
  */
47
48
  set(attrs: AttributeSet): this {
48
49
  return this._assign('set', attrs)
@@ -52,7 +53,7 @@ export class BasePatch {
52
53
  * Sets the given attributes to the document if they are not currently set. Does NOT merge objects.
53
54
  * The operation is added to the current patch, ready to be commited by `commit()`
54
55
  *
55
- * @param attrs Attributes to set. To set a deep attribute, use JSONMatch, eg: {"nested.prop": "value"}
56
+ * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
56
57
  */
57
58
  setIfMissing(attrs: AttributeSet): this {
58
59
  return this._assign('setIfMissing', attrs)
@@ -62,7 +63,7 @@ export class BasePatch {
62
63
  * Performs a "diff-match-patch" operation on the string attributes provided.
63
64
  * The operation is added to the current patch, ready to be commited by `commit()`
64
65
  *
65
- * @param attrs Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: {"nested.prop": "dmp"}
66
+ * @param attrs - Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "dmp"\}
66
67
  */
67
68
  diffMatchPatch(attrs: AttributeSet): this {
68
69
  validateObject('diffMatchPatch', attrs)
@@ -73,7 +74,7 @@ export class BasePatch {
73
74
  * Unsets the attribute paths provided.
74
75
  * The operation is added to the current patch, ready to be commited by `commit()`
75
76
  *
76
- * @param attrs Attribute paths to unset.
77
+ * @param attrs - Attribute paths to unset.
77
78
  */
78
79
  unset(attrs: string[]): this {
79
80
  if (!Array.isArray(attrs)) {
@@ -87,7 +88,7 @@ export class BasePatch {
87
88
  /**
88
89
  * Increment a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
89
90
  *
90
- * @param attrs Object of attribute paths to increment, values representing the number to increment by.
91
+ * @param attrs - Object of attribute paths to increment, values representing the number to increment by.
91
92
  */
92
93
  inc(attrs: {[key: string]: number}): this {
93
94
  return this._assign('inc', attrs)
@@ -96,7 +97,7 @@ export class BasePatch {
96
97
  /**
97
98
  * Decrement a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
98
99
  *
99
- * @param attrs Object of attribute paths to decrement, values representing the number to decrement by.
100
+ * @param attrs - Object of attribute paths to decrement, values representing the number to decrement by.
100
101
  */
101
102
  dec(attrs: {[key: string]: number}): this {
102
103
  return this._assign('dec', attrs)
@@ -105,9 +106,9 @@ export class BasePatch {
105
106
  /**
106
107
  * Provides methods for modifying arrays, by inserting, appending and replacing elements via a JSONPath expression.
107
108
  *
108
- * @param at Location to insert at, relative to the given selector, or 'replace' the matched path
109
- * @param selector JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
110
- * @param items Array of items to insert/replace
109
+ * @param at - Location to insert at, relative to the given selector, or 'replace' the matched path
110
+ * @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
111
+ * @param items - Array of items to insert/replace
111
112
  */
112
113
  insert(at: 'before' | 'after' | 'replace', selector: string, items: any[]): this {
113
114
  validateInsert(at, selector, items)
@@ -117,8 +118,8 @@ export class BasePatch {
117
118
  /**
118
119
  * Append the given items to the array at the given JSONPath
119
120
  *
120
- * @param selector Attribute/path to append to, eg `comments` or `person.hobbies`
121
- * @param items Array of items to append to the array
121
+ * @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`
122
+ * @param items - Array of items to append to the array
122
123
  */
123
124
  append(selector: string, items: any[]): this {
124
125
  return this.insert('after', `${selector}[-1]`, items)
@@ -127,8 +128,8 @@ export class BasePatch {
127
128
  /**
128
129
  * Prepend the given items to the array at the given JSONPath
129
130
  *
130
- * @param selector Attribute/path to prepend to, eg `comments` or `person.hobbies`
131
- * @param items Array of items to prepend to the array
131
+ * @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`
132
+ * @param items - Array of items to prepend to the array
132
133
  */
133
134
  prepend(selector: string, items: any[]): this {
134
135
  return this.insert('before', `${selector}[0]`, items)
@@ -137,12 +138,12 @@ export class BasePatch {
137
138
  /**
138
139
  * Change the contents of an array by removing existing elements and/or adding new elements.
139
140
  *
140
- * @param selector Attribute or JSONPath expression for array
141
- * @param start Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x
142
- * @param deleteCount An integer indicating the number of old array elements to remove.
143
- * @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.
141
+ * @param selector - Attribute or JSONPath expression for array
142
+ * @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x
143
+ * @param deleteCount - An integer indicating the number of old array elements to remove.
144
+ * @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.
144
145
  */
145
- splice(selector: string, start: number, deleteCount: number, items: any[]): this {
146
+ splice(selector: string, start: number, deleteCount?: number, items?: any[]): this {
146
147
  // Negative indexes doesn't mean the same in Sanity as they do in JS;
147
148
  // -1 means "actually at the end of the array", which allows inserting
148
149
  // at the end of the array without knowing its length. We therefore have
@@ -159,7 +160,7 @@ export class BasePatch {
159
160
  /**
160
161
  * Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value
161
162
  *
162
- * @param rev Revision to lock the patch to
163
+ * @param rev - Revision to lock the patch to
163
164
  */
164
165
  ifRevisionId(rev: string): this {
165
166
  this.operations.ifRevisionID = rev
@@ -201,6 +202,7 @@ export class BasePatch {
201
202
  }
202
203
  }
203
204
 
205
+ /** @public */
204
206
  export class ObservablePatch extends BasePatch {
205
207
  #client?: ObservableSanityClient
206
208
 
@@ -223,7 +225,7 @@ export class ObservablePatch extends BasePatch {
223
225
  /**
224
226
  * Commit the patch, returning an observable that produces the first patched document
225
227
  *
226
- * @param options Options for the mutation operation
228
+ * @param options - Options for the mutation operation
227
229
  */
228
230
  commit<R extends Record<string, any> = Record<string, any>>(
229
231
  options: FirstDocumentMutationOptions
@@ -231,7 +233,7 @@ export class ObservablePatch extends BasePatch {
231
233
  /**
232
234
  * Commit the patch, returning an observable that produces an array of the mutated documents
233
235
  *
234
- * @param options Options for the mutation operation
236
+ * @param options - Options for the mutation operation
235
237
  */
236
238
  commit<R extends Record<string, any> = Record<string, any>>(
237
239
  options: AllDocumentsMutationOptions
@@ -239,19 +241,19 @@ export class ObservablePatch extends BasePatch {
239
241
  /**
240
242
  * Commit the patch, returning an observable that produces a mutation result object
241
243
  *
242
- * @param options Options for the mutation operation
244
+ * @param options - Options for the mutation operation
243
245
  */
244
246
  commit(options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>
245
247
  /**
246
248
  * Commit the patch, returning an observable that produces a mutation result object
247
249
  *
248
- * @param options Options for the mutation operation
250
+ * @param options - Options for the mutation operation
249
251
  */
250
252
  commit(options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
251
253
  /**
252
254
  * Commit the patch, returning an observable that produces the first patched document
253
255
  *
254
- * @param options Options for the mutation operation
256
+ * @param options - Options for the mutation operation
255
257
  */
256
258
  commit<R extends Record<string, any> = Record<string, any>>(
257
259
  options?: BaseMutationOptions
@@ -279,6 +281,7 @@ export class ObservablePatch extends BasePatch {
279
281
  }
280
282
  }
281
283
 
284
+ /** @public */
282
285
  export class Patch extends BasePatch {
283
286
  #client?: SanityClient
284
287
  constructor(selection: PatchSelection, operations?: PatchOperations, client?: SanityClient) {
@@ -296,7 +299,7 @@ export class Patch extends BasePatch {
296
299
  /**
297
300
  * Commit the patch, returning a promise that resolves to the first patched document
298
301
  *
299
- * @param options Options for the mutation operation
302
+ * @param options - Options for the mutation operation
300
303
  */
301
304
  commit<R extends Record<string, any> = Record<string, any>>(
302
305
  options: FirstDocumentMutationOptions
@@ -304,7 +307,7 @@ export class Patch extends BasePatch {
304
307
  /**
305
308
  * Commit the patch, returning a promise that resolves to an array of the mutated documents
306
309
  *
307
- * @param options Options for the mutation operation
310
+ * @param options - Options for the mutation operation
308
311
  */
309
312
  commit<R extends Record<string, any> = Record<string, any>>(
310
313
  options: AllDocumentsMutationOptions
@@ -312,19 +315,19 @@ export class Patch extends BasePatch {
312
315
  /**
313
316
  * Commit the patch, returning a promise that resolves to a mutation result object
314
317
  *
315
- * @param options Options for the mutation operation
318
+ * @param options - Options for the mutation operation
316
319
  */
317
320
  commit(options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>
318
321
  /**
319
322
  * Commit the patch, returning a promise that resolves to a mutation result object
320
323
  *
321
- * @param options Options for the mutation operation
324
+ * @param options - Options for the mutation operation
322
325
  */
323
326
  commit(options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>
324
327
  /**
325
328
  * Commit the patch, returning a promise that resolves to the first patched document
326
329
  *
327
- * @param options Options for the mutation operation
330
+ * @param options - Options for the mutation operation
328
331
  */
329
332
  commit<R extends Record<string, any> = Record<string, any>>(
330
333
  options?: BaseMutationOptions
@@ -18,11 +18,14 @@ import type {
18
18
  import * as validators from '../validators'
19
19
  import {ObservablePatch, Patch} from './patch'
20
20
 
21
+ /** @public */
21
22
  export type PatchBuilder = (patch: Patch) => Patch
23
+ /** @public */
22
24
  export type ObservablePatchBuilder = (patch: ObservablePatch) => ObservablePatch
23
25
 
24
26
  const defaultMutateOptions = {returnDocuments: false}
25
27
 
28
+ /** @internal */
26
29
  export class BaseTransaction {
27
30
  protected operations: Mutation[]
28
31
  protected trxId?: string
@@ -129,6 +132,7 @@ export class BaseTransaction {
129
132
  }
130
133
  }
131
134
 
135
+ /** @public */
132
136
  export class Transaction extends BaseTransaction {
133
137
  #client?: SanityClient
134
138
  constructor(operations?: Mutation[], client?: SanityClient, transactionId?: string) {
@@ -238,6 +242,7 @@ export class Transaction extends BaseTransaction {
238
242
  }
239
243
  }
240
244
 
245
+ /** @public */
241
246
  export class ObservableTransaction extends BaseTransaction {
242
247
  #client?: ObservableSanityClient
243
248
  constructor(operations?: Mutation[], client?: ObservableSanityClient, transactionId?: string) {