@sanity/client 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +200 -6
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +277 -22
- package/dist/index.node.js +150 -13
- package/dist/index.node.js.map +1 -1
- package/dist/media-library.d.ts +1 -1
- package/dist/stega.js +2 -2
- package/dist/{dist-Z8cIRxoB.js → stegaClean-YZRATV86.js} +19 -2
- package/dist/stegaClean-YZRATV86.js.map +1 -0
- package/dist/{stegaEncodeSourceMap-YR3NQ3iz.js → stegaEncodeSourceMap-Dj29aWKG.js} +2 -2
- package/dist/{stegaEncodeSourceMap-YR3NQ3iz.js.map → stegaEncodeSourceMap-Dj29aWKG.js.map} +1 -1
- package/dist/{types-DiPF0ENT.d.ts → types-CtHEe8SF.d.ts} +278 -23
- package/package.json +16 -14
- package/src/SanityClient.ts +176 -9
- package/src/agent/actions/AgentActionsClient.ts +8 -2
- package/src/assets/AssetsClient.ts +8 -2
- package/src/data/live.ts +1 -0
- package/src/datasets/DatasetsClient.ts +8 -2
- package/src/mediaLibrary/MediaLibraryVideoClient.ts +8 -2
- package/src/projects/ProjectsClient.ts +8 -2
- package/src/releases/ReleasesClient.ts +8 -2
- package/src/types.ts +49 -6
- package/src/users/UsersClient.ts +8 -2
- package/dist/dist-Z8cIRxoB.js.map +0 -1
- package/dist/stegaClean-C18wLWau.js +0 -21
- package/dist/stegaClean-C18wLWau.js.map +0 -1
package/README.md
CHANGED
|
@@ -61,6 +61,7 @@ export async function updateDocumentTitle(_id, title) {
|
|
|
61
61
|
- [Creating a client instance](#creating-a-client-instance)
|
|
62
62
|
- [ESM](#esm)
|
|
63
63
|
- [TypeScript](#typescript)
|
|
64
|
+
- [Typed query results with Sanity TypeGen](#typed-query-results-with-sanity-typegen)
|
|
64
65
|
- [Next.js App Router](#nextjs-app-router)
|
|
65
66
|
- [Bun](#bun)
|
|
66
67
|
- [Deno](#deno)
|
|
@@ -241,6 +242,52 @@ console.log(`Number of documents: ${data}`)
|
|
|
241
242
|
|
|
242
243
|
Another alternative is [groqd].
|
|
243
244
|
|
|
245
|
+
#### Typed query results with [Sanity TypeGen](https://www.sanity.io/docs/sanity-typegen)
|
|
246
|
+
|
|
247
|
+
`client.fetch` looks the query string up in the global `SanityQueries` interface and returns the registered result type when it finds one. `sanity typegen generate` writes these registrations for you, one per query it finds in your code, but the mechanism is plain interface merging:
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
import {createClient} from '@sanity/client'
|
|
251
|
+
|
|
252
|
+
// Generated by `sanity typegen`, or written by hand
|
|
253
|
+
declare global {
|
|
254
|
+
interface SanityQueries {
|
|
255
|
+
'*[_type == "post"]': {_id: string; title: string}[]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const client = createClient({
|
|
260
|
+
projectId: 'your-project-id',
|
|
261
|
+
dataset: 'your-dataset-name',
|
|
262
|
+
apiVersion: '2025-02-06',
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
const posts = await client.fetch('*[_type == "post"]')
|
|
266
|
+
// posts is typed as `{_id: string; title: string}[]`, no generic needed
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The registry is a global interface rather than a module augmentation of `@sanity/client`, so it does not depend on module resolution: a registration is seen whether or not `@sanity/client` is a direct dependency of the file that makes it, however many copies of the client are installed (a copy nested inside another package reads the same registry), and from every entry point, `@sanity/client/stega` included.
|
|
270
|
+
|
|
271
|
+
Two more forms are accepted:
|
|
272
|
+
|
|
273
|
+
- The module augmentation that earlier TypeGen releases generated keeps working. It registers on the `SanityQueries` interface exported from `@sanity/client`, which inherits the global one:
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
declare module '@sanity/client' {
|
|
277
|
+
interface SanityQueries {
|
|
278
|
+
'*[_type == "post"]': {_id: string; title: string}[]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- Releases of `@sanity/client` that predate the global registry only read that exported interface. A generated file that registers queries globally can still reach them with an augmentation that adds nothing but a base type, which is what `sanity typegen` emits alongside the global registry. It is a harmless duplicate on releases that already inherit the global, so the same generated file works with either:
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
declare module '@sanity/client' {
|
|
287
|
+
interface SanityQueries extends globalThis.SanityQueries {}
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
244
291
|
#### [Next.js App Router](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#fetching-data-on-the-server-with-fetch)
|
|
245
292
|
|
|
246
293
|
```tsx
|
|
@@ -827,7 +874,7 @@ const videoAsset = stegaClean(result.videoAsset)
|
|
|
827
874
|
|
|
828
875
|
Strings with stega payloads contain invisible characters, so comparing them against string literals fails in surprising ways: `imageLocation === 'left'` is `false` even though `imageLocation` looks exactly like `'left'` when logged. The branded types available on `@sanity/client/stega` turn these bugs into compile errors.
|
|
829
876
|
|
|
830
|
-
If you use [Sanity TypeGen](https://www.sanity.io/docs/sanity-typegen), pass `ClientReturnStega` as the first generic to `client.fetch` and every string in the result that may contain stega payloads is branded as `StegaString
|
|
877
|
+
If you use [Sanity TypeGen](https://www.sanity.io/docs/sanity-typegen), pass `ClientReturnStega` as the first generic to `client.fetch` and every string in the result that may contain stega payloads is branded as `StegaString`. It looks the query up in the same `SanityQueries` registry as `client.fetch` does (see [Typed query results with Sanity TypeGen](#typed-query-results-with-sanity-typegen)):
|
|
831
878
|
|
|
832
879
|
```ts
|
|
833
880
|
import {createClient} from '@sanity/client'
|
|
@@ -2260,11 +2307,23 @@ When you configure the client with a Media Library resource, you can use familia
|
|
|
2260
2307
|
|
|
2261
2308
|
#### Configuration
|
|
2262
2309
|
|
|
2310
|
+
> [!NOTE]
|
|
2311
|
+
>
|
|
2312
|
+
> Requires API version `2025-03-25` or later.
|
|
2313
|
+
|
|
2314
|
+
Getting playback information requires authentication. Use a token when calling this API from
|
|
2315
|
+
server-side code. In a browser, use `withCredentials: true` instead of exposing a token in client-side
|
|
2316
|
+
code.
|
|
2317
|
+
|
|
2318
|
+
Media Library resource clients send requests to the global API host (`api.sanity.io`), which does not
|
|
2319
|
+
support CORS. This configuration therefore only works outside the browser:
|
|
2320
|
+
|
|
2263
2321
|
```js
|
|
2264
2322
|
import {createClient} from '@sanity/client'
|
|
2265
2323
|
|
|
2266
2324
|
const client = createClient({
|
|
2267
|
-
token:
|
|
2325
|
+
token: process.env.SANITY_API_READ_TOKEN,
|
|
2326
|
+
apiVersion: '2025-03-25',
|
|
2268
2327
|
useCdn: false,
|
|
2269
2328
|
resource: {
|
|
2270
2329
|
type: 'media-library',
|
|
@@ -2273,6 +2332,19 @@ const client = createClient({
|
|
|
2273
2332
|
})
|
|
2274
2333
|
```
|
|
2275
2334
|
|
|
2335
|
+
For browser usage, configure the client with a project ID so requests use the CORS-enabled project
|
|
2336
|
+
API host. Enable credentials and include the browser's origin in
|
|
2337
|
+
[your project's CORS settings](https://www.sanity.io/docs/content-lake/browser-security-and-cors):
|
|
2338
|
+
|
|
2339
|
+
```js
|
|
2340
|
+
const browserClient = createClient({
|
|
2341
|
+
projectId: 'yourProjectId',
|
|
2342
|
+
apiVersion: '2025-03-25',
|
|
2343
|
+
useCdn: false,
|
|
2344
|
+
withCredentials: true,
|
|
2345
|
+
})
|
|
2346
|
+
```
|
|
2347
|
+
|
|
2276
2348
|
#### Querying assets
|
|
2277
2349
|
|
|
2278
2350
|
Use `client.fetch()` to query assets in your Media Library using GROQ:
|
|
@@ -2329,6 +2401,10 @@ await client
|
|
|
2329
2401
|
|
|
2330
2402
|
For video assets, use the specialized `getPlaybackInfo()` method to retrieve streaming URLs:
|
|
2331
2403
|
|
|
2404
|
+
> [!NOTE]
|
|
2405
|
+
>
|
|
2406
|
+
> See [Configuration](#configuration) for authentication and browser CORS requirements.
|
|
2407
|
+
|
|
2332
2408
|
```js
|
|
2333
2409
|
// Basic usage with video asset ID
|
|
2334
2410
|
const playbackInfo = await client.mediaLibrary.video.getPlaybackInfo(
|
|
@@ -2347,9 +2423,9 @@ const playbackInfo = await client.mediaLibrary.video.getPlaybackInfo(
|
|
|
2347
2423
|
},
|
|
2348
2424
|
)
|
|
2349
2425
|
|
|
2350
|
-
// Using
|
|
2426
|
+
// Using a Media Library asset reference
|
|
2351
2427
|
const playbackInfo = await client.mediaLibrary.video.getPlaybackInfo({
|
|
2352
|
-
_ref: 'media-library:mlZxz9rvqf76:30rh9U3GDEK3ToiId1Zje4uvalC',
|
|
2428
|
+
_ref: 'media-library:mlZxz9rvqf76:video-30rh9U3GDEK3ToiId1Zje4uvalC-mp4',
|
|
2353
2429
|
})
|
|
2354
2430
|
```
|
|
2355
2431
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as ResolveStudioUrl, f as StegaConfig, g as StudioUrl, h as StudioBaseUrl, i as ContentSourceMapParsedPathKeyedSegment, l as InitializedStegaConfig, m as StudioBaseRoute, p as StegaConfigRequiredKeys, r as ContentSourceMapParsedPath, s as FilterDefault, u as Logger } from "./types-CfGzbXrl.js";
|
|
2
|
-
import { $ as DisconnectEvent, $n as UploadClientConfig, $r as CollaborationCommentFieldValue, $t as QueryWithoutParams, A as ContentSourceMapMappings, Ai as AgentActionPathSegment, An as SanityReference, Ar as ObservableProjectsClient, At as MediaLibraryAssetVersion, B as CreateVersionAction, Bn as TransactionAllDocumentIdsMutationOptions, Br as ObservablePatchBuilder, Bt as MutationSelection, C as ContentSourceMap, Ci as PromptRequest, Cn as SanityDocument, Cr as GenerateTarget, Ct as LiveEventGoAway, D as ContentSourceMapDocuments, Di as AgentActionParam, Dn as SanityProject, Dr as SanityClient, Dt as LiveEventWelcome, E as ContentSourceMapDocumentValueSource, Ei as PatchTarget, En as SanityImagePalette, Er as ObservableSanityClient, Et as LiveEventRestart, F as ContentSourceMapValueMapping, Fi as GroqAgentActionParam, Fn as StackablePerspective, Fr as InvokeFunctionOptions, Ft as Mutation, G as DatasetResponse, Gn as UnarchiveReleaseAction, Gr as ObservablePatch, Gt as PatchOperations, H as DatasetAclMode, Hn as TransactionFirstDocumentIdMutationOptions, Hr as PatchBuilder, Ht as OpenEvent, I as CreateAction, In as StillImageFormat, Ir as InvokeFunctionRequest, It as MutationError, J as DeleteReleaseAction, Jn as UnpublishAction, Jr as types_d_exports, Jt as PublishReleaseAction, K as DatasetsResponse, Kn as UnfilteredResponseQueryOptions, Kr as Patch, Kt as PatchSelection, L as CreateReleaseAction, Ln as StoryboardTransformOptions, Lr as DatasetsClient, Lt as MutationErrorItem, M as ContentSourceMapRemoteDocument, Mi as ConstantAgentActionParam, Mn as ScheduleReleaseAction, Mr as MediaLibraryVideoClient, Mt as MediaLibraryVideoPlaybackTransformations, N as ContentSourceMapSource, Ni as DocumentAgentActionParam, Nn as SingleActionResult, Nr as ObservableMediaLibraryVideoClient, Nt as MultipleActionResult, O as ContentSourceMapLiteralSource, Oi as AgentActionParams, On as SanityProjectMember, Or as ObservableUsersClient, Ot as MediaLibraryAssetDocument, P as ContentSourceMapUnknownSource, Pi as FieldAgentActionParam, Pn as SingleMutationResult, Pr as InvokeFunctionEvent, Pt as MultipleMutationResult, Q as DiscardVersionAction, Qn as UploadBody, Qr as CollaborationCommentDocument, Qt as QueryParseError, R as CreateVariantAction, Rn as SyncTag, Rr as ObservableDatasetsClient, Rt as MutationEvent, S as ClientVariantConditions, Si as TransformTargetInclude, Sn as SanityAssetDocument, Sr as GenerateOperation, St as LiveEvent, T as ContentSourceMapDocumentBase, Ti as PatchOperation, Tn as SanityImageAssetDocument, Tr as GenerateTargetInclude, Tt as LiveEventReconnect, U as DatasetCreateOptions, Un as TransactionFirstDocumentMutationOptions, Ur as Transaction, Ut as PartialExcept, V as CurrentSanityUser, Vn as TransactionAllDocumentsMutationOptions, Vr as ObservableTransaction, Vt as MutationSelectionQueryParams, W as DatasetEditOptions, Wn as TransactionMutationOptions, Wr as BasePatch, Wt as PatchMutationOperation, X as DeleteVariantDefinitionAction, Xn as UnpublishVersionAction, Xr as ObservableCollaborationCommentsClient, Xt as QueryOptions, Y as DeleteVariantAction, Yn as UnpublishVariantAction, Yr as CollaborationCommentsClient, Yt as PublishVariantAction, Z as DiscardAction, Zn as UnscheduleReleaseAction, Zr as CollaborationCommentCreate, Zt as QueryParams, _ as ChannelErrorEvent, _i as ImageDescriptionOperation, _n as Requester, _r as VideoSubtitleInfoPublic, _t as InsertPatch, a as AllDocumentsMutationOptions, ai as CollaborationCommentStatus, an as ReleaseCardinality, ar as VersionAction, at as EditableReleaseDocument, b as ClientReturn, bi as TransformTarget, bn as ResumableListenEventNames, br as WelcomeEvent, bt as ListenOptions, c as Any, ci as CollaborationCommentsListenOptions, cn as ReleaseState, cr as VideoPlaybackInfoItemPublic, ct as ErrorProps, d as AssetMetadataType, di as _listen, dn as ReplaceVersionAction, dr as VideoPlaybackInfoSigned, dt as FirstDocumentMutationOptions, ei as CollaborationCommentMessage, en as RawQueryResponse, er as UploadEvent, et as EXPERIMENTAL_API_WARNING, f as AttributeSet, fi as AssetsClient, fn as RequestHandler, fr as VideoPlaybackTokens, ft as FitMode, g as BaseMutationOptions, gi as TranslateTargetInclude, gn as RequestUrlOptions, gr as VideoSubtitleInfo, gt as InitializedClientConfig, h as BaseActionOptions, hi as TranslateTarget, hn as RequestOptions, hr as VideoRenditionInfoSigned, ht as ImportReleaseAction, i as AllDocumentIdsMutationOptions, ii as CollaborationCommentSelection, in as ReleaseAction, ir as VariantDefinitionAction, it as EditVariantDefinitionAction, j as ContentSourceMapPaths, ji as AgentActionTarget, jn as SanityUser, jr as ProjectsClient, jt as MediaLibraryPlaybackInfoOptions, k as ContentSourceMapMapping, ki as AgentActionPath, kn as SanityQueries, kr as UsersClient, kt as MediaLibraryAssetInstanceIdentifier, l as ApiError, li as CollaborationCommentsRequestOptions, ln as ReleaseType, lr as VideoPlaybackInfoItemSigned, lt as FilteredResponseQueryOptions, m as AuthProviderResponse, mi as TranslateDocument, mn as RequestObservableOptions, mr as VideoRenditionInfoPublic, mt as IdentifiedSanityDocumentStub, n as ActionError, ni as CollaborationCommentRange, nn as RawRequestOptions, nr as UploadResponseEvent, nt as EditReleaseAction, o as AnimatedImageFormat, oi as CollaborationCommentTarget, on as ReleaseDocument, or as VideoPlaybackInfo, ot as EmbeddingsSettings, p as AuthProvider, pi as ObservableAssetsClient, pn as RequestHandlerOptions, pr as VideoRenditionInfo, pt as HttpRequest, q as DeleteAction, qn as UnfilteredResponseWithoutQuery, qr as LiveClient, qt as PublishAction, r as ActionErrorItem, ri as CollaborationCommentReactionShortName, rn as ReconnectEvent, rr as VariantAction, rt as EditVariantAction, s as AnimatedTransformOptions, si as CollaborationCommentUpdate, sn as ReleaseId, sr as VideoPlaybackInfoItem, st as EmbeddingsSettingsBody, t as Action, ti as CollaborationCommentPortableTextBlock, tn as RawQuerylessQueryResponse, tr as UploadProgressEvent, tt as EditAction, u as ArchiveReleaseAction, ui as CollaborationCommentsWriteOptions, un as ReplaceDraftAction, ur as VideoPlaybackInfoPublic, ut as FirstDocumentIdMutationOptions, v as ClientConfig, vi as TransformDocument, vn as ResetEvent, vr as VideoSubtitleInfoSigned, vt as ListenEvent, w as ContentSourceMapDocument, wi as PatchDocument, wn as SanityDocumentStub, wr as GenerateTargetDocument, wt as LiveEventMessage, x as ClientVariant, xi as TransformTargetDocument, xn as ResumableListenOptions, xr as GenerateInstruction, xt as ListenParams, y as ClientPerspective, yi as TransformOperation, yn as ResponseQueryOptions, yr as WelcomeBackEvent, yt as ListenEventName, z as CreateVariantDefinitionAction, zn as ThumbnailTransformOptions, zr as BaseTransaction, zt as MutationOperation } from "./types-
|
|
2
|
+
import { $ as DisconnectEvent, $n as UploadClientConfig, $r as CollaborationCommentFieldValue, $t as QueryWithoutParams, A as ContentSourceMapMappings, Ai as AgentActionPathSegment, An as SanityReference, Ar as ObservableProjectsClient, At as MediaLibraryAssetVersion, B as CreateVersionAction, Bn as TransactionAllDocumentIdsMutationOptions, Br as ObservablePatchBuilder, Bt as MutationSelection, C as ContentSourceMap, Ci as PromptRequest, Cn as SanityDocument, Cr as GenerateTarget, Ct as LiveEventGoAway, D as ContentSourceMapDocuments, Di as AgentActionParam, Dn as SanityProject, Dr as SanityClient, Dt as LiveEventWelcome, E as ContentSourceMapDocumentValueSource, Ei as PatchTarget, En as SanityImagePalette, Er as ObservableSanityClient, Et as LiveEventRestart, F as ContentSourceMapValueMapping, Fi as GroqAgentActionParam, Fn as StackablePerspective, Fr as InvokeFunctionOptions, Ft as Mutation, G as DatasetResponse, Gn as UnarchiveReleaseAction, Gr as ObservablePatch, Gt as PatchOperations, H as DatasetAclMode, Hn as TransactionFirstDocumentIdMutationOptions, Hr as PatchBuilder, Ht as OpenEvent, I as CreateAction, In as StillImageFormat, Ir as InvokeFunctionRequest, It as MutationError, J as DeleteReleaseAction, Jn as UnpublishAction, Jr as types_d_exports, Jt as PublishReleaseAction, K as DatasetsResponse, Kn as UnfilteredResponseQueryOptions, Kr as Patch, Kt as PatchSelection, L as CreateReleaseAction, Ln as StoryboardTransformOptions, Lr as DatasetsClient, Lt as MutationErrorItem, M as ContentSourceMapRemoteDocument, Mi as ConstantAgentActionParam, Mn as ScheduleReleaseAction, Mr as MediaLibraryVideoClient, Mt as MediaLibraryVideoPlaybackTransformations, N as ContentSourceMapSource, Ni as DocumentAgentActionParam, Nn as SingleActionResult, Nr as ObservableMediaLibraryVideoClient, Nt as MultipleActionResult, O as ContentSourceMapLiteralSource, Oi as AgentActionParams, On as SanityProjectMember, Or as ObservableUsersClient, Ot as MediaLibraryAssetDocument, P as ContentSourceMapUnknownSource, Pi as FieldAgentActionParam, Pn as SingleMutationResult, Pr as InvokeFunctionEvent, Pt as MultipleMutationResult, Q as DiscardVersionAction, Qn as UploadBody, Qr as CollaborationCommentDocument, Qt as QueryParseError, R as CreateVariantAction, Rn as SyncTag, Rr as ObservableDatasetsClient, Rt as MutationEvent, S as ClientVariantConditions, Si as TransformTargetInclude, Sn as SanityAssetDocument, Sr as GenerateOperation, St as LiveEvent, T as ContentSourceMapDocumentBase, Ti as PatchOperation, Tn as SanityImageAssetDocument, Tr as GenerateTargetInclude, Tt as LiveEventReconnect, U as DatasetCreateOptions, Un as TransactionFirstDocumentMutationOptions, Ur as Transaction, Ut as PartialExcept, V as CurrentSanityUser, Vn as TransactionAllDocumentsMutationOptions, Vr as ObservableTransaction, Vt as MutationSelectionQueryParams, W as DatasetEditOptions, Wn as TransactionMutationOptions, Wr as BasePatch, Wt as PatchMutationOperation, X as DeleteVariantDefinitionAction, Xn as UnpublishVersionAction, Xr as ObservableCollaborationCommentsClient, Xt as QueryOptions, Y as DeleteVariantAction, Yn as UnpublishVariantAction, Yr as CollaborationCommentsClient, Yt as PublishVariantAction, Z as DiscardAction, Zn as UnscheduleReleaseAction, Zr as CollaborationCommentCreate, Zt as QueryParams, _ as ChannelErrorEvent, _i as ImageDescriptionOperation, _n as Requester, _r as VideoSubtitleInfoPublic, _t as InsertPatch, a as AllDocumentsMutationOptions, ai as CollaborationCommentStatus, an as ReleaseCardinality, ar as VersionAction, at as EditableReleaseDocument, b as ClientReturn, bi as TransformTarget, bn as ResumableListenEventNames, br as WelcomeEvent, bt as ListenOptions, c as Any, ci as CollaborationCommentsListenOptions, cn as ReleaseState, cr as VideoPlaybackInfoItemPublic, ct as ErrorProps, d as AssetMetadataType, di as _listen, dn as ReplaceVersionAction, dr as VideoPlaybackInfoSigned, dt as FirstDocumentMutationOptions, ei as CollaborationCommentMessage, en as RawQueryResponse, er as UploadEvent, et as EXPERIMENTAL_API_WARNING, f as AttributeSet, fi as AssetsClient, fn as RequestHandler, fr as VideoPlaybackTokens, ft as FitMode, g as BaseMutationOptions, gi as TranslateTargetInclude, gn as RequestUrlOptions, gr as VideoSubtitleInfo, gt as InitializedClientConfig, h as BaseActionOptions, hi as TranslateTarget, hn as RequestOptions, hr as VideoRenditionInfoSigned, ht as ImportReleaseAction, i as AllDocumentIdsMutationOptions, ii as CollaborationCommentSelection, in as ReleaseAction, ir as VariantDefinitionAction, it as EditVariantDefinitionAction, j as ContentSourceMapPaths, ji as AgentActionTarget, jn as SanityUser, jr as ProjectsClient, jt as MediaLibraryPlaybackInfoOptions, k as ContentSourceMapMapping, ki as AgentActionPath, kn as SanityQueries, kr as UsersClient, kt as MediaLibraryAssetInstanceIdentifier, l as ApiError, li as CollaborationCommentsRequestOptions, ln as ReleaseType, lr as VideoPlaybackInfoItemSigned, lt as FilteredResponseQueryOptions, m as AuthProviderResponse, mi as TranslateDocument, mn as RequestObservableOptions, mr as VideoRenditionInfoPublic, mt as IdentifiedSanityDocumentStub, n as ActionError, ni as CollaborationCommentRange, nn as RawRequestOptions, nr as UploadResponseEvent, nt as EditReleaseAction, o as AnimatedImageFormat, oi as CollaborationCommentTarget, on as ReleaseDocument, or as VideoPlaybackInfo, ot as EmbeddingsSettings, p as AuthProvider, pi as ObservableAssetsClient, pn as RequestHandlerOptions, pr as VideoRenditionInfo, pt as HttpRequest, q as DeleteAction, qn as UnfilteredResponseWithoutQuery, qr as LiveClient, qt as PublishAction, r as ActionErrorItem, ri as CollaborationCommentReactionShortName, rn as ReconnectEvent, rr as VariantAction, rt as EditVariantAction, s as AnimatedTransformOptions, si as CollaborationCommentUpdate, sn as ReleaseId, sr as VideoPlaybackInfoItem, st as EmbeddingsSettingsBody, t as Action, ti as CollaborationCommentPortableTextBlock, tn as RawQuerylessQueryResponse, tr as UploadProgressEvent, tt as EditAction, u as ArchiveReleaseAction, ui as CollaborationCommentsWriteOptions, un as ReplaceDraftAction, ur as VideoPlaybackInfoPublic, ut as FirstDocumentIdMutationOptions, v as ClientConfig, vi as TransformDocument, vn as ResetEvent, vr as VideoSubtitleInfoSigned, vt as ListenEvent, w as ContentSourceMapDocument, wi as PatchDocument, wn as SanityDocumentStub, wr as GenerateTargetDocument, wt as LiveEventMessage, x as ClientVariant, xi as TransformTargetDocument, xn as ResumableListenOptions, xr as GenerateInstruction, xt as ListenParams, y as ClientPerspective, yi as TransformOperation, yn as ResponseQueryOptions, yr as WelcomeBackEvent, yt as ListenEventName, z as CreateVariantDefinitionAction, zn as ThumbnailTransformOptions, zr as BaseTransaction, zt as MutationOperation } from "./types-CtHEe8SF.js";
|
|
3
3
|
import { FetchFunction, RequestOptions as RequestOptions$1, TimeoutErrorLike, isTimeoutError } from "get-it";
|
|
4
4
|
import { Observable } from "rxjs";
|
|
5
5
|
import { EventSourceConstructor } from "eventsource";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-vyAXikos.js";
|
|
|
2
2
|
import { a as ServerError, c as isHttpError, i as CorsOriginError, l as isQueryParseError, o as formatQueryParseError, r as ClientError, t as defineRequester, u as _defineProperty } from "./request-BhMuKj0D.js";
|
|
3
3
|
import { t as isRecord } from "./isRecord-Kfmt-nk-.js";
|
|
4
4
|
import { _ as validateDocumentId, a as printCreateVersionWithBaseIdWarning, b as validateVersionIdMatch, c as printPreviewDraftsDeprecationWarning, d as requestTag, f as requireDocumentId, g as validateAssetType, h as resourceGuard, i as printCdnPreviewDraftsWarning, l as dataset, m as resourceConfig, n as initConfig, o as printDeprecatedUriOptionWarning, p as requireDocumentType, r as validateApiPerspective, s as printNoDefaultExport, t as defaultConfig, u as hasDataset, v as validateInsert, y as validateObject } from "./config-CgJ16jET.js";
|
|
5
|
-
import { t as stegaClean } from "./stegaClean-
|
|
5
|
+
import { t as stegaClean } from "./stegaClean-YZRATV86.js";
|
|
6
6
|
import { isTimeoutError } from "get-it";
|
|
7
7
|
import { Observable, catchError, concat, defer, finalize, isObservable, lastValueFrom, map, merge, mergeMap, of, share, tap, throwError, timer } from "rxjs";
|
|
8
8
|
import { getDraftId, getPublishedId, getVersionFromId, getVersionId, isDraftId, isVersionId } from "@sanity/client/csm";
|
|
@@ -627,7 +627,7 @@ function _fetch$2(client, httpRequest, _stega, query, _params = {}, options = {}
|
|
|
627
627
|
query,
|
|
628
628
|
params
|
|
629
629
|
}, reqOpts);
|
|
630
|
-
return stega.enabled ? Promise.all([request, import("./stegaEncodeSourceMap-
|
|
630
|
+
return stega.enabled ? Promise.all([request, import("./stegaEncodeSourceMap-Dj29aWKG.js").then((n) => n.n)]).then(([res, { stegaEncodeSourceMap }]) => {
|
|
631
631
|
let result = stegaEncodeSourceMap(res.result, res.resultSourceMap, stega);
|
|
632
632
|
return mapResponse({
|
|
633
633
|
...res,
|
|
@@ -3684,7 +3684,79 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3684
3684
|
}
|
|
3685
3685
|
}, _clientConfig = /* @__PURE__ */ new WeakMap(), _httpRequest = /* @__PURE__ */ new WeakMap(), ObservableSanityClient = class ObservableSanityClient {
|
|
3686
3686
|
constructor(httpRequest, config = defaultConfig) {
|
|
3687
|
-
_defineProperty(
|
|
3687
|
+
_defineProperty(
|
|
3688
|
+
this,
|
|
3689
|
+
/**
|
|
3690
|
+
* Upload, fetch and delete assets (images and files) in the configured dataset
|
|
3691
|
+
*
|
|
3692
|
+
* @category Assets
|
|
3693
|
+
*/
|
|
3694
|
+
"assets",
|
|
3695
|
+
void 0
|
|
3696
|
+
), _defineProperty(
|
|
3697
|
+
this,
|
|
3698
|
+
/**
|
|
3699
|
+
* Create, list, edit and delete datasets in the configured project
|
|
3700
|
+
*
|
|
3701
|
+
* @category Projects & Datasets
|
|
3702
|
+
*/
|
|
3703
|
+
"datasets",
|
|
3704
|
+
void 0
|
|
3705
|
+
), _defineProperty(
|
|
3706
|
+
this,
|
|
3707
|
+
/**
|
|
3708
|
+
* Subscribe to live content updates through the Live Content API
|
|
3709
|
+
*
|
|
3710
|
+
* @category Real-time
|
|
3711
|
+
*/
|
|
3712
|
+
"live",
|
|
3713
|
+
void 0
|
|
3714
|
+
), _defineProperty(
|
|
3715
|
+
this,
|
|
3716
|
+
/**
|
|
3717
|
+
* Interact with Media Library assets
|
|
3718
|
+
*
|
|
3719
|
+
* @category Assets
|
|
3720
|
+
*/
|
|
3721
|
+
"mediaLibrary",
|
|
3722
|
+
void 0
|
|
3723
|
+
), _defineProperty(
|
|
3724
|
+
this,
|
|
3725
|
+
/**
|
|
3726
|
+
* Fetch information about the projects the authenticated user has access to
|
|
3727
|
+
*
|
|
3728
|
+
* @category Projects & Datasets
|
|
3729
|
+
*/
|
|
3730
|
+
"projects",
|
|
3731
|
+
void 0
|
|
3732
|
+
), _defineProperty(
|
|
3733
|
+
this,
|
|
3734
|
+
/**
|
|
3735
|
+
* Fetch information about users in the configured project
|
|
3736
|
+
*
|
|
3737
|
+
* @category Projects & Datasets
|
|
3738
|
+
*/
|
|
3739
|
+
"users",
|
|
3740
|
+
void 0
|
|
3741
|
+
), _defineProperty(
|
|
3742
|
+
this,
|
|
3743
|
+
/**
|
|
3744
|
+
* Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
|
|
3745
|
+
*
|
|
3746
|
+
* @category Agent Actions
|
|
3747
|
+
*/
|
|
3748
|
+
"agent",
|
|
3749
|
+
void 0
|
|
3750
|
+
), _defineProperty(this, "collaboration", void 0), _defineProperty(this, "functions", void 0), _defineProperty(
|
|
3751
|
+
this,
|
|
3752
|
+
/**
|
|
3753
|
+
* Create and manage content releases and their scheduled publishing
|
|
3754
|
+
*
|
|
3755
|
+
* @category Releases
|
|
3756
|
+
*/
|
|
3757
|
+
"releases",
|
|
3758
|
+
void 0
|
|
3759
|
+
), _defineProperty(
|
|
3688
3760
|
this,
|
|
3689
3761
|
/** @beta */
|
|
3690
3762
|
"context",
|
|
@@ -3692,7 +3764,9 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3692
3764
|
), _classPrivateFieldInitSpec(this, _clientConfig, void 0), _classPrivateFieldInitSpec(this, _httpRequest, void 0), _defineProperty(
|
|
3693
3765
|
this,
|
|
3694
3766
|
/**
|
|
3695
|
-
*
|
|
3767
|
+
* Listen to document changes matching a GROQ query, delivered as server-sent events
|
|
3768
|
+
*
|
|
3769
|
+
* @category Real-time
|
|
3696
3770
|
*/
|
|
3697
3771
|
"listen",
|
|
3698
3772
|
_listen$2
|
|
@@ -3700,6 +3774,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3700
3774
|
}
|
|
3701
3775
|
/**
|
|
3702
3776
|
* Clone the client - returns a new instance
|
|
3777
|
+
*
|
|
3778
|
+
* @category Configuration
|
|
3703
3779
|
*/
|
|
3704
3780
|
clone() {
|
|
3705
3781
|
return new ObservableSanityClient(_classPrivateFieldGet2(_httpRequest, this), this.config());
|
|
@@ -3712,6 +3788,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3712
3788
|
/**
|
|
3713
3789
|
* Clone the client with a new (partial) configuration.
|
|
3714
3790
|
*
|
|
3791
|
+
* @category Configuration
|
|
3792
|
+
*
|
|
3715
3793
|
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
3716
3794
|
*/
|
|
3717
3795
|
withConfig(newConfig) {
|
|
@@ -3747,6 +3825,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3747
3825
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
3748
3826
|
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
3749
3827
|
*
|
|
3828
|
+
* @category Querying
|
|
3829
|
+
*
|
|
3750
3830
|
* @param ids - Document IDs to fetch
|
|
3751
3831
|
* @param options - Request options
|
|
3752
3832
|
*/
|
|
@@ -3757,6 +3837,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3757
3837
|
* Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
|
|
3758
3838
|
* Returns a set of the IDs that exist.
|
|
3759
3839
|
*
|
|
3840
|
+
* @category Querying
|
|
3841
|
+
*
|
|
3760
3842
|
* @param ids - Document IDs to check
|
|
3761
3843
|
* @param options - Request options
|
|
3762
3844
|
*/
|
|
@@ -3796,6 +3878,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3796
3878
|
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
3797
3879
|
* * If the draft or release version does not exist, any error will throw.
|
|
3798
3880
|
*
|
|
3881
|
+
* @category Versions
|
|
3882
|
+
*
|
|
3799
3883
|
* @param params - Version action parameters:
|
|
3800
3884
|
* - `releaseId` - The ID of the release to discard the document from.
|
|
3801
3885
|
* - `publishedId` - The published ID of the document to discard.
|
|
@@ -3839,6 +3923,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3839
3923
|
* @remarks
|
|
3840
3924
|
* * If the published document does not exist, an error will be thrown.
|
|
3841
3925
|
*
|
|
3926
|
+
* @category Versions
|
|
3927
|
+
*
|
|
3842
3928
|
* @param params - Version action parameters:
|
|
3843
3929
|
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
3844
3930
|
* - `publishedId` - The published ID of the document to unpublish.
|
|
@@ -3871,6 +3957,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3871
3957
|
/**
|
|
3872
3958
|
* Create a new transaction of mutations
|
|
3873
3959
|
*
|
|
3960
|
+
* @category Mutations
|
|
3961
|
+
*
|
|
3874
3962
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
3875
3963
|
*/
|
|
3876
3964
|
transaction(operations) {
|
|
@@ -3879,6 +3967,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3879
3967
|
/**
|
|
3880
3968
|
* Perform action operations against the configured dataset
|
|
3881
3969
|
*
|
|
3970
|
+
* @category Mutations
|
|
3971
|
+
*
|
|
3882
3972
|
* @param operations - Action operation(s) to execute
|
|
3883
3973
|
* @param options - Action options
|
|
3884
3974
|
*/
|
|
@@ -3888,6 +3978,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3888
3978
|
/**
|
|
3889
3979
|
* Perform an HTTP request against the Sanity API
|
|
3890
3980
|
*
|
|
3981
|
+
* @category HTTP
|
|
3982
|
+
*
|
|
3891
3983
|
* @param options - Request options
|
|
3892
3984
|
*/
|
|
3893
3985
|
request(options) {
|
|
@@ -3896,6 +3988,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3896
3988
|
/**
|
|
3897
3989
|
* Get a Sanity API URL for the URI provided
|
|
3898
3990
|
*
|
|
3991
|
+
* @category HTTP
|
|
3992
|
+
*
|
|
3899
3993
|
* @param uri - URI/path to build URL for
|
|
3900
3994
|
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
|
3901
3995
|
*/
|
|
@@ -3905,6 +3999,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3905
3999
|
/**
|
|
3906
4000
|
* Get a Sanity API URL for the data operation and path provided
|
|
3907
4001
|
*
|
|
4002
|
+
* @category HTTP
|
|
4003
|
+
*
|
|
3908
4004
|
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
|
3909
4005
|
* @param path - Path to append after the operation
|
|
3910
4006
|
*/
|
|
@@ -3913,7 +4009,79 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3913
4009
|
}
|
|
3914
4010
|
}, _clientConfig2 = /* @__PURE__ */ new WeakMap(), _httpRequest2 = /* @__PURE__ */ new WeakMap(), SanityClient = class SanityClient {
|
|
3915
4011
|
constructor(httpRequest, config = defaultConfig) {
|
|
3916
|
-
_defineProperty(
|
|
4012
|
+
_defineProperty(
|
|
4013
|
+
this,
|
|
4014
|
+
/**
|
|
4015
|
+
* Upload, fetch and delete assets (images and files) in the configured dataset
|
|
4016
|
+
*
|
|
4017
|
+
* @category Assets
|
|
4018
|
+
*/
|
|
4019
|
+
"assets",
|
|
4020
|
+
void 0
|
|
4021
|
+
), _defineProperty(
|
|
4022
|
+
this,
|
|
4023
|
+
/**
|
|
4024
|
+
* Create, list, edit and delete datasets in the configured project
|
|
4025
|
+
*
|
|
4026
|
+
* @category Projects & Datasets
|
|
4027
|
+
*/
|
|
4028
|
+
"datasets",
|
|
4029
|
+
void 0
|
|
4030
|
+
), _defineProperty(
|
|
4031
|
+
this,
|
|
4032
|
+
/**
|
|
4033
|
+
* Subscribe to live content updates through the Live Content API
|
|
4034
|
+
*
|
|
4035
|
+
* @category Real-time
|
|
4036
|
+
*/
|
|
4037
|
+
"live",
|
|
4038
|
+
void 0
|
|
4039
|
+
), _defineProperty(
|
|
4040
|
+
this,
|
|
4041
|
+
/**
|
|
4042
|
+
* Interact with Media Library assets
|
|
4043
|
+
*
|
|
4044
|
+
* @category Assets
|
|
4045
|
+
*/
|
|
4046
|
+
"mediaLibrary",
|
|
4047
|
+
void 0
|
|
4048
|
+
), _defineProperty(
|
|
4049
|
+
this,
|
|
4050
|
+
/**
|
|
4051
|
+
* Fetch information about the projects the authenticated user has access to
|
|
4052
|
+
*
|
|
4053
|
+
* @category Projects & Datasets
|
|
4054
|
+
*/
|
|
4055
|
+
"projects",
|
|
4056
|
+
void 0
|
|
4057
|
+
), _defineProperty(
|
|
4058
|
+
this,
|
|
4059
|
+
/**
|
|
4060
|
+
* Fetch information about users in the configured project
|
|
4061
|
+
*
|
|
4062
|
+
* @category Projects & Datasets
|
|
4063
|
+
*/
|
|
4064
|
+
"users",
|
|
4065
|
+
void 0
|
|
4066
|
+
), _defineProperty(
|
|
4067
|
+
this,
|
|
4068
|
+
/**
|
|
4069
|
+
* Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
|
|
4070
|
+
*
|
|
4071
|
+
* @category Agent Actions
|
|
4072
|
+
*/
|
|
4073
|
+
"agent",
|
|
4074
|
+
void 0
|
|
4075
|
+
), _defineProperty(this, "collaboration", void 0), _defineProperty(this, "functions", void 0), _defineProperty(
|
|
4076
|
+
this,
|
|
4077
|
+
/**
|
|
4078
|
+
* Create and manage content releases and their scheduled publishing
|
|
4079
|
+
*
|
|
4080
|
+
* @category Releases
|
|
4081
|
+
*/
|
|
4082
|
+
"releases",
|
|
4083
|
+
void 0
|
|
4084
|
+
), _defineProperty(
|
|
3917
4085
|
this,
|
|
3918
4086
|
/** @beta */
|
|
3919
4087
|
"context",
|
|
@@ -3922,13 +4090,17 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3922
4090
|
this,
|
|
3923
4091
|
/**
|
|
3924
4092
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
4093
|
+
*
|
|
4094
|
+
* @category Configuration
|
|
3925
4095
|
*/
|
|
3926
4096
|
"observable",
|
|
3927
4097
|
void 0
|
|
3928
4098
|
), _classPrivateFieldInitSpec(this, _clientConfig2, void 0), _classPrivateFieldInitSpec(this, _httpRequest2, void 0), _defineProperty(
|
|
3929
4099
|
this,
|
|
3930
4100
|
/**
|
|
3931
|
-
*
|
|
4101
|
+
* Listen to document changes matching a GROQ query, delivered as server-sent events
|
|
4102
|
+
*
|
|
4103
|
+
* @category Real-time
|
|
3932
4104
|
*/
|
|
3933
4105
|
"listen",
|
|
3934
4106
|
_listen$2
|
|
@@ -3936,6 +4108,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3936
4108
|
}
|
|
3937
4109
|
/**
|
|
3938
4110
|
* Clone the client - returns a new instance
|
|
4111
|
+
*
|
|
4112
|
+
* @category Configuration
|
|
3939
4113
|
*/
|
|
3940
4114
|
clone() {
|
|
3941
4115
|
return new SanityClient(_classPrivateFieldGet2(_httpRequest2, this), this.config());
|
|
@@ -3948,6 +4122,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3948
4122
|
/**
|
|
3949
4123
|
* Clone the client with a new (partial) configuration.
|
|
3950
4124
|
*
|
|
4125
|
+
* @category Configuration
|
|
4126
|
+
*
|
|
3951
4127
|
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
3952
4128
|
*/
|
|
3953
4129
|
withConfig(newConfig) {
|
|
@@ -3983,6 +4159,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3983
4159
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
3984
4160
|
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
3985
4161
|
*
|
|
4162
|
+
* @category Querying
|
|
4163
|
+
*
|
|
3986
4164
|
* @param ids - Document IDs to fetch
|
|
3987
4165
|
* @param options - Request options
|
|
3988
4166
|
*/
|
|
@@ -3993,6 +4171,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
3993
4171
|
* Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
|
|
3994
4172
|
* Returns a set of the IDs that exist.
|
|
3995
4173
|
*
|
|
4174
|
+
* @category Querying
|
|
4175
|
+
*
|
|
3996
4176
|
* @param ids - Document IDs to check
|
|
3997
4177
|
* @param options - Request options
|
|
3998
4178
|
*/
|
|
@@ -4032,6 +4212,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
4032
4212
|
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
4033
4213
|
* * If the draft or release version does not exist, any error will throw.
|
|
4034
4214
|
*
|
|
4215
|
+
* @category Versions
|
|
4216
|
+
*
|
|
4035
4217
|
* @param params - Version action parameters:
|
|
4036
4218
|
* - `releaseId` - The ID of the release to discard the document from.
|
|
4037
4219
|
* - `publishedId` - The published ID of the document to discard.
|
|
@@ -4075,6 +4257,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
4075
4257
|
* @remarks
|
|
4076
4258
|
* * If the published document does not exist, an error will be thrown.
|
|
4077
4259
|
*
|
|
4260
|
+
* @category Versions
|
|
4261
|
+
*
|
|
4078
4262
|
* @param params - Version action parameters:
|
|
4079
4263
|
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
4080
4264
|
* - `publishedId` - The published ID of the document to unpublish.
|
|
@@ -4107,6 +4291,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
4107
4291
|
/**
|
|
4108
4292
|
* Create a new transaction of mutations
|
|
4109
4293
|
*
|
|
4294
|
+
* @category Mutations
|
|
4295
|
+
*
|
|
4110
4296
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
4111
4297
|
*/
|
|
4112
4298
|
transaction(operations) {
|
|
@@ -4116,6 +4302,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
4116
4302
|
* Perform action operations against the configured dataset
|
|
4117
4303
|
* Returns a promise that resolves to the transaction result
|
|
4118
4304
|
*
|
|
4305
|
+
* @category Mutations
|
|
4306
|
+
*
|
|
4119
4307
|
* @param operations - Action operation(s) to execute
|
|
4120
4308
|
* @param options - Action options
|
|
4121
4309
|
*/
|
|
@@ -4126,6 +4314,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
4126
4314
|
* Perform a request against the Sanity API
|
|
4127
4315
|
* NOTE: Only use this for Sanity API endpoints, not for your own APIs!
|
|
4128
4316
|
*
|
|
4317
|
+
* @category HTTP
|
|
4318
|
+
*
|
|
4129
4319
|
* @param options - Request options
|
|
4130
4320
|
* @returns Promise resolving to the response body
|
|
4131
4321
|
*/
|
|
@@ -4148,6 +4338,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
4148
4338
|
/**
|
|
4149
4339
|
* Get a Sanity API URL for the URI provided
|
|
4150
4340
|
*
|
|
4341
|
+
* @category HTTP
|
|
4342
|
+
*
|
|
4151
4343
|
* @param uri - URI/path to build URL for
|
|
4152
4344
|
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
|
4153
4345
|
*/
|
|
@@ -4157,6 +4349,8 @@ var _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */
|
|
|
4157
4349
|
/**
|
|
4158
4350
|
* Get a Sanity API URL for the data operation and path provided
|
|
4159
4351
|
*
|
|
4352
|
+
* @category HTTP
|
|
4353
|
+
*
|
|
4160
4354
|
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
|
4161
4355
|
* @param path - Path to append after the operation
|
|
4162
4356
|
*/
|