@sanity/sdk 3.0.0-rc.0 → 3.0.0-rc.1
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/dist/_chunks-dts/createGroqSearchFilter.d.ts +1147 -0
- package/dist/_chunks-dts/createGroqSearchFilter.d.ts.map +1 -0
- package/dist/_chunks-es/_internal.js +134 -0
- package/dist/_chunks-es/_internal.js.map +1 -0
- package/dist/_chunks-es/createGroqSearchFilter.js +1864 -0
- package/dist/_chunks-es/createGroqSearchFilter.js.map +1 -0
- package/dist/_chunks-es/telemetryManager.js +93 -0
- package/dist/_chunks-es/telemetryManager.js.map +1 -0
- package/dist/_exports/_internal.d.ts +95 -0
- package/dist/_exports/_internal.d.ts.map +1 -0
- package/dist/_exports/_internal.js +24 -0
- package/dist/_exports/_internal.js.map +1 -0
- package/dist/index.d.ts +1079 -1076
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1967 -2302
- package/dist/index.js.map +1 -1
- package/package.json +48 -47
- package/src/_exports/_internal.ts +26 -0
- package/src/_exports/index.ts +120 -11
- package/src/access/checkPermissions.test.ts +55 -0
- package/src/access/checkPermissions.ts +54 -0
- package/src/agent/agentActions.test.ts +16 -60
- package/src/agent/agentActions.ts +25 -38
- package/src/applications/applications.test-d.ts +83 -0
- package/src/applications/applications.test.ts +130 -0
- package/src/applications/applications.ts +364 -0
- package/src/applications/userApplications.test.ts +126 -0
- package/src/applications/userApplications.ts +261 -0
- package/src/auth/authLogger.ts +30 -0
- package/src/auth/authMode.test.ts +25 -0
- package/src/auth/authMode.ts +6 -3
- package/src/auth/authStore.test.ts +194 -13
- package/src/auth/authStore.ts +59 -26
- package/src/auth/getOrganizationVerificationState.test.ts +18 -17
- package/src/auth/getOrganizationVerificationState.ts +4 -4
- package/src/auth/handleAuthCallback.test.ts +35 -1
- package/src/auth/handleAuthCallback.ts +25 -6
- package/src/auth/logout.test.ts +75 -2
- package/src/auth/logout.ts +23 -4
- package/src/auth/refreshStampedToken.test.ts +219 -469
- package/src/auth/refreshStampedToken.ts +79 -195
- package/src/auth/studioAuth.ts +1 -1
- package/src/auth/studioModeAuth.ts +2 -1
- package/src/auth/subscribeToStateAndFetchCurrentUser.test.ts +146 -13
- package/src/auth/subscribeToStateAndFetchCurrentUser.ts +37 -6
- package/src/auth/subscribeToStorageEventsAndSetToken.test.ts +2 -0
- package/src/client/clientStore.test.ts +62 -37
- package/src/client/clientStore.ts +45 -75
- package/src/client/liveEvents.test.ts +151 -0
- package/src/client/liveEvents.ts +107 -0
- package/src/comlink/controller/actions/destroyController.test.ts +4 -1
- package/src/comlink/controller/actions/getOrCreateChannel.test.ts +4 -1
- package/src/comlink/controller/actions/getOrCreateChannel.ts +2 -2
- package/src/comlink/controller/actions/getOrCreateController.test.ts +4 -1
- package/src/comlink/controller/actions/releaseChannel.test.ts +1 -1
- package/src/comlink/controller/comlinkControllerStore.test.ts +4 -1
- package/src/comlink/node/actions/getOrCreateNode.test.ts +9 -3
- package/src/comlink/node/actions/getOrCreateNode.ts +2 -2
- package/src/comlink/node/actions/releaseNode.test.ts +7 -4
- package/src/comlink/node/comlinkNodeStore.test.ts +2 -2
- package/src/comlink/node/getNodeState.test.ts +1 -1
- package/src/comlink/node/getNodeState.ts +2 -1
- package/src/config/__tests__/handles.test.ts +18 -12
- package/src/config/handles.ts +25 -7
- package/src/config/sanityConfig.ts +109 -79
- package/src/datasets/datasets.test.ts +2 -2
- package/src/datasets/datasets.ts +10 -4
- package/src/document/actions.test.ts +115 -33
- package/src/document/actions.ts +212 -15
- package/src/document/applyDocumentActions.test.ts +38 -12
- package/src/document/applyDocumentActions.ts +30 -9
- package/src/document/documentConstants.ts +7 -0
- package/src/document/documentStore.concurrency.test.ts +1306 -0
- package/src/document/documentStore.test.ts +673 -278
- package/src/document/documentStore.ts +162 -71
- package/src/document/events.test.ts +57 -2
- package/src/document/events.ts +82 -26
- package/src/document/listen.test.ts +56 -0
- package/src/document/listen.ts +74 -21
- package/src/document/listenerEventOperators.test.ts +311 -0
- package/src/document/listenerEventOperators.ts +217 -0
- package/src/document/patchOperations.test.ts +49 -2
- package/src/document/patchOperations.ts +50 -0
- package/src/document/permissions.test.ts +105 -60
- package/src/document/permissions.ts +44 -19
- package/src/document/processActions/create.ts +138 -0
- package/src/document/processActions/delete.ts +100 -0
- package/src/document/processActions/discard.ts +63 -0
- package/src/document/processActions/edit.ts +154 -0
- package/src/document/processActions/processActions.ts +218 -0
- package/src/document/processActions/publish.ts +120 -0
- package/src/document/processActions/releaseArchive.ts +77 -0
- package/src/document/processActions/releaseCreate.ts +59 -0
- package/src/document/processActions/releaseDelete.ts +65 -0
- package/src/document/processActions/releaseEdit.ts +37 -0
- package/src/document/processActions/releasePublish.ts +45 -0
- package/src/document/processActions/releaseSchedule.ts +87 -0
- package/src/document/processActions/releaseUtil.ts +31 -0
- package/src/document/processActions/shared.ts +308 -0
- package/src/document/processActions/unpublish.ts +85 -0
- package/src/document/processActions.test.ts +1129 -121
- package/src/document/reducers.test.ts +639 -64
- package/src/document/reducers.ts +187 -48
- package/src/document/resourceRules.test.ts +178 -0
- package/src/document/resourceRules.ts +117 -0
- package/src/document/sharedListener.test.ts +16 -14
- package/src/document/sharedListener.ts +24 -8
- package/src/document/util.ts +14 -0
- package/src/favorites/favorites.test.ts +5 -6
- package/src/installations/installations.test-d.ts +68 -0
- package/src/installations/installations.test.ts +62 -0
- package/src/installations/installations.ts +202 -0
- package/src/organization/organization.test-d.ts +36 -0
- package/src/organization/organization.test.ts +138 -0
- package/src/organization/organization.ts +138 -0
- package/src/organizations/organizations.test-d.ts +56 -0
- package/src/organizations/organizations.test.ts +150 -0
- package/src/organizations/organizations.ts +107 -0
- package/src/presence/bifurTransport.test.ts +46 -6
- package/src/presence/bifurTransport.ts +19 -2
- package/src/presence/presenceStore.test.ts +94 -23
- package/src/presence/presenceStore.ts +85 -29
- package/src/preview/getPreviewState.test.ts +137 -0
- package/src/preview/getPreviewState.ts +69 -0
- package/src/preview/previewProjectionUtils.test.ts +9 -22
- package/src/preview/previewProjectionUtils.ts +7 -3
- package/src/preview/resolvePreview.test.ts +64 -0
- package/src/preview/resolvePreview.ts +43 -0
- package/src/preview/types.ts +10 -0
- package/src/project/project.test-d.ts +37 -0
- package/src/project/project.test.ts +157 -12
- package/src/project/project.ts +138 -25
- package/src/projection/getProjectionState.test.ts +18 -20
- package/src/projection/getProjectionState.ts +23 -3
- package/src/projection/projectionQuery.ts +5 -5
- package/src/projection/projectionStore.test.ts +1 -1
- package/src/projection/resolveProjection.test.ts +1 -2
- package/src/projection/resolveProjection.ts +16 -0
- package/src/projection/subscribeToStateAndFetchBatches.test.ts +1 -1
- package/src/projection/subscribeToStateAndFetchBatches.ts +32 -23
- package/src/projection/types.ts +8 -0
- package/src/projects/projects.test-d.ts +32 -0
- package/src/projects/projects.test.ts +108 -42
- package/src/projects/projects.ts +63 -27
- package/src/query/queryStore.test.ts +259 -123
- package/src/query/queryStore.ts +78 -63
- package/src/query/reducers.test.ts +0 -42
- package/src/query/reducers.ts +2 -18
- package/src/releases/getPerspectiveState.test.ts +17 -23
- package/src/releases/getPerspectiveState.ts +8 -20
- package/src/releases/observeReleases.test.ts +127 -0
- package/src/releases/observeReleases.ts +102 -0
- package/src/releases/releasesStore.test.ts +100 -53
- package/src/releases/releasesStore.ts +69 -44
- package/src/releases/utils/sortReleases.test.ts +38 -2
- package/src/releases/utils/sortReleases.ts +15 -10
- package/src/store/createActionBinder.test.ts +87 -90
- package/src/store/createActionBinder.ts +79 -25
- package/src/store/createSanityInstance.test.ts +83 -13
- package/src/store/createSanityInstance.ts +77 -2
- package/src/store/createStateSourceAction.test.ts +64 -2
- package/src/store/createStateSourceAction.ts +39 -44
- package/src/store/createStoreInstance.test.ts +4 -2
- package/src/store/fetcherStore.test-d.ts +121 -0
- package/src/store/fetcherStore.test.ts +299 -0
- package/src/store/fetcherStore.ts +801 -0
- package/src/telemetry/environment.test.ts +119 -0
- package/src/telemetry/environment.ts +92 -0
- package/src/telemetry/events.ts +42 -0
- package/src/telemetry/initTelemetry.test.ts +432 -0
- package/src/telemetry/initTelemetry.ts +218 -0
- package/src/telemetry/telemetryManager.test.ts +327 -0
- package/src/telemetry/telemetryManager.ts +199 -0
- package/src/users/reducers.test.ts +6 -1
- package/src/users/reducers.ts +5 -6
- package/src/users/types.ts +4 -4
- package/src/users/usersStore.test.ts +16 -12
- package/src/users/usersStore.ts +5 -1
- package/src/utils/buildQuery.test.ts +14 -0
- package/src/utils/buildQuery.ts +17 -0
- package/src/utils/createFetcherStore.test.ts +7 -5
- package/src/utils/createFetcherStore.ts +8 -5
- package/src/utils/getStagingApiHost.test.ts +21 -0
- package/src/utils/getStagingApiHost.ts +14 -0
- package/src/utils/ids.test.ts +1 -29
- package/src/utils/ids.ts +0 -10
- package/src/utils/includeShape.ts +36 -0
- package/src/utils/isImportError.test.ts +72 -0
- package/src/utils/isImportError.ts +34 -0
- package/src/utils/logger.test.ts +12 -0
- package/src/utils/logger.ts +8 -3
- package/src/utils/object.test.ts +95 -0
- package/src/utils/object.ts +142 -0
- package/src/utils/setCleanupTimeout.ts +37 -0
- package/src/document/processActions.ts +0 -707
- package/src/utils/defineIntent.test.ts +0 -477
- package/src/utils/defineIntent.ts +0 -244
package/dist/index.d.ts
CHANGED
|
@@ -1,328 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ClientConfig,
|
|
1
|
+
import { $ as getIsInDashboardState, A as transformProjectionToPreview, At as isDatasetSource, B as getClientErrorApiBody, C as QueryOptions, Ct as ReleasePerspective, D as resolveQuery, Dt as isCanvasResource, E as parseQueryKey, Et as TokenSource, F as ValuePending, G as AuthStoreState, H as getClientErrorApiType, I as ProjectionValuePending, J as LoggedOutAuthState, K as ErrorAuthState, L as ValidProjection, M as PreviewQueryResult, Mt as isMediaLibrarySource, N as PreviewStoreState, Nt as AuthConfig, O as Selector, Ot as isCanvasSource, P as PreviewValue, Pt as AuthProvider, Q as getDashboardOrganizationId, R as PREVIEW_PROJECTION, St as ReleaseHandle, T as getQueryState, Tt as StudioConfig, U as isProjectUserNotFoundClientError, V as getClientErrorApiDescription, W as AuthState, X as getAuthState, Y as LoggingInAuthState, Z as getCurrentUserState, _t as DocumentTypeHandle, a as GetUsersOptions, at as StoreAction, b as MutationResult, bt as PerspectiveHandle, c as ResolveUsersOptions, ct as isStudioConfig, d as UserProfile, dt as DatasetHandle, et as getLoginUrlState, f as UsersGroupState, ft as DatasetResource, g as Fetcher, gt as DocumentSource, ht as DocumentResource, i as GetUserOptions, it as BoundStoreAction, j as PreviewMedia, jt as isMediaLibraryResource, k as StateSource, kt as isDatasetResource, l as SanityUser, lt as CanvasResource, mt as DocumentHandle, n as getUsersKey, nt as setAuthToken, o as Membership, ot as SanityInstance, p as UsersStoreState, pt as DatasetSource, q as LoggedInAuthState, r as parseUsersKey, rt as AuthStateType, s as ResolveUserOptions, st as createSanityInstance, t as createGroqSearchFilter, tt as getTokenState, u as SanityUserResponse, ut as CanvasSource, vt as MediaLibraryResource, w as getQueryKey, wt as SanityConfig, xt as ProjectHandle, yt as MediaLibrarySource, z as ApiErrorBody } from "./_chunks-dts/createGroqSearchFilter.js";
|
|
2
|
+
import { ClientConfig, ListenEvent, MultipleMutationResult, ReleaseDocument, ReleaseDocument as ReleaseDocument$1, SanityClient, SanityDocument as SanityDocument$1, SanityProject as SanityProject$1 } from "@sanity/client";
|
|
3
|
+
import { CurrentUser, Mutation, PatchOperations, Role, SanityDocument, SanityDocument as SanityDocument$2, SanityDocumentLike } from "@sanity/types";
|
|
3
4
|
import { Observable, Subject } from "rxjs";
|
|
4
|
-
import {
|
|
5
|
-
import * as _sanity_comlink5 from "@sanity/comlink";
|
|
5
|
+
import { SanityDocument as SanityDocument$3, SanityProjectionResult } from "groq";
|
|
6
6
|
import { ChannelInput, ChannelInstance, Controller, Message, Node, NodeInput, Status } from "@sanity/comlink";
|
|
7
7
|
import { PatchMutation } from "@sanity/mutate/_unstable_store";
|
|
8
8
|
import { ExprNode } from "groq-js";
|
|
9
9
|
import { CanvasResource as CanvasResource$1, MediaResource, StudioResource } from "@sanity/message-protocol";
|
|
10
10
|
import { getIndexForKey, getPathDepth, joinPaths, jsonMatch, slicePath, stringifyPath } from "@sanity/json-match";
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
interface AuthProvider {
|
|
16
|
-
/**
|
|
17
|
-
* Unique identifier for the auth provider (e.g., 'google', 'github')
|
|
18
|
-
*/
|
|
19
|
-
name: string;
|
|
20
|
-
/**
|
|
21
|
-
* Display name for the auth provider in the UI
|
|
22
|
-
*/
|
|
23
|
-
title: string;
|
|
24
|
-
/**
|
|
25
|
-
* Complete authentication URL including callback and token parameters
|
|
26
|
-
*/
|
|
27
|
-
url: string;
|
|
28
|
-
/**
|
|
29
|
-
* Optional URL for direct sign-up flow
|
|
30
|
-
*/
|
|
31
|
-
signUpUrl?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Configuration options for creating an auth store.
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
interface AuthConfig {
|
|
39
|
-
/**
|
|
40
|
-
* The initial location href to use when handling auth callbacks.
|
|
41
|
-
* Defaults to the current window location if available.
|
|
42
|
-
*/
|
|
43
|
-
initialLocationHref?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Factory function to create a SanityClient instance.
|
|
46
|
-
* Defaults to the standard Sanity client factory if not provided.
|
|
47
|
-
*/
|
|
48
|
-
clientFactory?: (config: ClientConfig) => SanityClient;
|
|
49
|
-
/**
|
|
50
|
-
* Custom authentication providers to use instead of or in addition to the default ones.
|
|
51
|
-
* Can be an array of providers or a function that takes the default providers and returns
|
|
52
|
-
* a modified array or a Promise resolving to one.
|
|
53
|
-
*/
|
|
54
|
-
providers?: AuthProvider[] | ((prev: AuthProvider[]) => AuthProvider[] | Promise<AuthProvider[]>);
|
|
55
|
-
/**
|
|
56
|
-
* The API hostname for requests. Usually leave this undefined, but it can be set
|
|
57
|
-
* if using a custom domain or CNAME for the API endpoint.
|
|
58
|
-
*/
|
|
59
|
-
apiHost?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Storage implementation to persist authentication state.
|
|
62
|
-
* Defaults to `localStorage` if available.
|
|
63
|
-
*/
|
|
64
|
-
storageArea?: Storage;
|
|
65
|
-
/**
|
|
66
|
-
* A callback URL for your application.
|
|
67
|
-
* If none is provided, the auth API will redirect back to the current location (`location.href`).
|
|
68
|
-
* When handling callbacks, this URL's pathname is checked to ensure it matches the callback.
|
|
69
|
-
*/
|
|
70
|
-
callbackUrl?: string;
|
|
71
|
-
/**
|
|
72
|
-
* A static authentication token to use instead of handling the OAuth flow.
|
|
73
|
-
* When provided, the auth store will remain in a logged-in state with this token,
|
|
74
|
-
* ignoring any storage or callback handling.
|
|
75
|
-
*/
|
|
76
|
-
token?: string;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* A minimal Observable-compatible interface for subscribing to token changes.
|
|
80
|
-
* Any object with a `subscribe` method that follows this contract will work,
|
|
81
|
-
* including RxJS Observables. This avoids coupling the SDK to a specific
|
|
82
|
-
* reactive library.
|
|
83
|
-
*
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
|
-
interface TokenSource {
|
|
87
|
-
/** Subscribe to token emissions. Emits `null` when logged out. */
|
|
88
|
-
subscribe(observer: {
|
|
89
|
-
next: (token: string | null) => void;
|
|
90
|
-
}): {
|
|
91
|
-
unsubscribe(): void;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Studio-specific configuration for the SDK.
|
|
96
|
-
* When present, the SDK operates in studio mode and derives auth from the
|
|
97
|
-
* provided token source instead of discovering tokens independently.
|
|
98
|
-
*
|
|
99
|
-
* @public
|
|
100
|
-
*/
|
|
101
|
-
interface StudioConfig {
|
|
102
|
-
/**
|
|
103
|
-
* Whether the Studio has already determined the user is authenticated.
|
|
104
|
-
* When `true` and the token source emits `null`, the SDK infers
|
|
105
|
-
* cookie-based auth is in use rather than transitioning to logged-out.
|
|
106
|
-
*/
|
|
107
|
-
authenticated?: boolean;
|
|
108
|
-
/** Reactive auth token source from the Studio's auth store. */
|
|
109
|
-
auth?: {
|
|
110
|
-
/**
|
|
111
|
-
* A reactive token source. The SDK subscribes and stays in sync — the
|
|
112
|
-
* Studio is the single authority for auth and handles token refresh.
|
|
113
|
-
*
|
|
114
|
-
* Optional because older Studios may not expose it. When absent, the
|
|
115
|
-
* SDK falls back to localStorage/cookie discovery.
|
|
116
|
-
*/
|
|
117
|
-
token?: TokenSource;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* The project ID for this Studio workspace.
|
|
121
|
-
* Used to derive the localStorage key for studio auth token discovery
|
|
122
|
-
* (`__studio_auth_token_<projectId>`) and for project-specific API hostname requests.
|
|
123
|
-
*/
|
|
124
|
-
projectId?: string;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @public
|
|
128
|
-
*/
|
|
129
|
-
type ReleasePerspective = {
|
|
130
|
-
releaseName: string;
|
|
131
|
-
excludedPerspectives?: StackablePerspective[];
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* @public
|
|
135
|
-
*/
|
|
136
|
-
interface PerspectiveHandle {
|
|
137
|
-
/**
|
|
138
|
-
* The perspective to use for this operation.
|
|
139
|
-
* Note that the SDK stacks perspectives for you when querying.
|
|
140
|
-
* The SDK automatically fetches all of your content releases, and orders them the way the Sanity Studio does: usually by scheduled date, with ASAP releases coming first.
|
|
141
|
-
* @public
|
|
142
|
-
*/
|
|
143
|
-
perspective?: Exclude<ClientPerspective, readonly unknown[]> | ReleasePerspective;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* @public
|
|
147
|
-
*/
|
|
148
|
-
interface ResourceHandle<TProjectId extends string = string, TDataset extends string = string> extends PerspectiveHandle {
|
|
149
|
-
/**
|
|
150
|
-
* Explicit resource object to use for this operation.
|
|
151
|
-
* @public
|
|
152
|
-
*/
|
|
153
|
-
resource: DocumentResource<TProjectId, TDataset>;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Identifies a specific document type within a Sanity dataset and project.
|
|
157
|
-
* Includes `projectId`, `dataset`, and `documentType`.
|
|
158
|
-
* Optionally includes a `documentId` and `liveEdit` flag.
|
|
159
|
-
* @public
|
|
160
|
-
*/
|
|
161
|
-
interface DocumentTypeHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends ResourceHandle<TDataset, TProjectId> {
|
|
162
|
-
documentId?: string;
|
|
163
|
-
documentType: TDocumentType;
|
|
164
|
-
/**
|
|
165
|
-
* Indicates whether this document uses liveEdit mode.
|
|
166
|
-
* When `true`, the document does not use the draft/published model and edits are applied directly to the document.
|
|
167
|
-
* @see https://www.sanity.io/docs/content-lake/drafts#ca0663a8f002
|
|
168
|
-
*/
|
|
169
|
-
liveEdit?: boolean;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Uniquely identifies a specific document within a Sanity dataset and project.
|
|
173
|
-
* Includes `projectId`, `dataset`, `documentType`, and the required `documentId`.
|
|
174
|
-
* Commonly used by document-related hooks and components to reference a document without fetching its full content initially.
|
|
175
|
-
* @public
|
|
176
|
-
*/
|
|
177
|
-
interface DocumentHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentTypeHandle<TDocumentType, TDataset, TProjectId> {
|
|
178
|
-
documentId: string;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* The key used to identify the default resource in a resources map.
|
|
182
|
-
* When no `resource` or `resourceName` is specified, the SDK resolves
|
|
183
|
-
* the resource registered under this name.
|
|
12
|
+
* The resource types the Access API can scope a permission check to.
|
|
184
13
|
*
|
|
14
|
+
* @see https://www.sanity.io/docs/http-reference/access-api
|
|
185
15
|
* @public
|
|
186
16
|
*/
|
|
187
|
-
|
|
17
|
+
type AccessResourceType = 'organization' | 'project' | 'media-library' | 'canvas' | 'dashboard' | 'view';
|
|
188
18
|
/**
|
|
189
|
-
*
|
|
19
|
+
* Fetcher checking whether the current user holds the given permissions on a
|
|
20
|
+
* resource (`GET /access/:resourceType/:resourceId/user-permissions/me/check`),
|
|
21
|
+
* on the shared fetcher cache. Resolves to a map of each requested permission
|
|
22
|
+
* to whether the user has it. The key sorts the permission list, so permission
|
|
23
|
+
* order doesn't create distinct cache entries.
|
|
190
24
|
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* @example Typical React usage
|
|
194
|
-
* ```tsx
|
|
195
|
-
* <SanityApp
|
|
196
|
-
* resources={{ default: { projectId: 'abc123', dataset: 'production' } }}
|
|
197
|
-
* fallback={<Loading />}
|
|
198
|
-
* >
|
|
199
|
-
* <App />
|
|
200
|
-
* </SanityApp>
|
|
201
|
-
* ```
|
|
202
|
-
*
|
|
203
|
-
* The `defaultResource` field is set automatically by the React layer from
|
|
204
|
-
* `resources['default']`. It can also be set directly when using the core
|
|
205
|
-
* SDK without React (e.g. in a Node.js script):
|
|
206
|
-
*
|
|
207
|
-
* @example Direct core usage (without React)
|
|
208
|
-
* ```ts
|
|
209
|
-
* const instance = createSanityInstance({
|
|
210
|
-
* defaultResource: { projectId: 'abc123', dataset: 'production' },
|
|
211
|
-
* })
|
|
212
|
-
* ```
|
|
213
|
-
* @public
|
|
214
|
-
*/
|
|
215
|
-
interface SanityConfig extends PerspectiveHandle {
|
|
216
|
-
/**
|
|
217
|
-
* Authentication configuration for the instance
|
|
218
|
-
*/
|
|
219
|
-
auth?: AuthConfig;
|
|
220
|
-
/**
|
|
221
|
-
* Studio configuration provided by a Sanity Studio workspace.
|
|
222
|
-
* When present, the SDK operates in studio mode and derives auth from the
|
|
223
|
-
* workspace's reactive token source — no manual configuration needed.
|
|
224
|
-
*
|
|
225
|
-
* @remarks Typically set automatically by `SanityApp` when it detects an
|
|
226
|
-
* `SDKStudioContext` provider. Can also be set explicitly for programmatic use.
|
|
227
|
-
*/
|
|
228
|
-
studio?: StudioConfig;
|
|
229
|
-
/**
|
|
230
|
-
* The default document resource for this instance. Used by bound actions
|
|
231
|
-
* when no explicit resource is provided.
|
|
232
|
-
*
|
|
233
|
-
* @public
|
|
234
|
-
*/
|
|
235
|
-
defaultResource?: DocumentResource;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* A document resource identifies where data is stored and queried from.
|
|
239
|
-
* Can be a dataset (project + dataset pair), a media library, or a canvas.
|
|
240
|
-
*
|
|
241
|
-
* @public
|
|
242
|
-
*/
|
|
243
|
-
type DocumentResource<TProjectId extends string = string, TDataset extends string = string> = DatasetResource<TProjectId, TDataset> | MediaLibraryResource | CanvasResource;
|
|
244
|
-
/**
|
|
245
|
-
* A resource that targets a specific project and dataset.
|
|
246
|
-
* @public
|
|
247
|
-
*/
|
|
248
|
-
type DatasetResource<TProjectId extends string = string, TDataset extends string = string> = {
|
|
249
|
-
projectId: TProjectId;
|
|
250
|
-
dataset: TDataset;
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* A resource that targets a media library.
|
|
254
|
-
* @public
|
|
255
|
-
*/
|
|
256
|
-
type MediaLibraryResource = {
|
|
257
|
-
mediaLibraryId: string;
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* A resource that targets a canvas.
|
|
261
|
-
* @public
|
|
262
|
-
*/
|
|
263
|
-
type CanvasResource = {
|
|
264
|
-
canvasId: string;
|
|
265
|
-
};
|
|
266
|
-
/**
|
|
267
|
-
* Type guard that checks whether a {@link DocumentResource} is a {@link DatasetResource}.
|
|
268
|
-
* @public
|
|
269
|
-
*/
|
|
270
|
-
declare function isDatasetResource(resource: DocumentResource): resource is DatasetResource;
|
|
271
|
-
/**
|
|
272
|
-
* Type guard that checks whether a {@link DocumentResource} is a {@link MediaLibraryResource}.
|
|
273
|
-
* @public
|
|
274
|
-
*/
|
|
275
|
-
declare function isMediaLibraryResource(resource: DocumentResource): resource is MediaLibraryResource;
|
|
276
|
-
/**
|
|
277
|
-
* Type guard that checks whether a {@link DocumentResource} is a {@link CanvasResource}.
|
|
278
|
-
* @public
|
|
279
|
-
*/
|
|
280
|
-
declare function isCanvasResource(resource: DocumentResource): resource is CanvasResource;
|
|
281
|
-
/**
|
|
282
|
-
* Represents a Sanity.io resource instance with its own configuration and lifecycle.
|
|
283
|
-
*
|
|
284
|
-
* @public
|
|
285
|
-
*/
|
|
286
|
-
interface SanityInstance {
|
|
287
|
-
/**
|
|
288
|
-
* Unique identifier for this instance
|
|
289
|
-
* @remarks Generated using crypto.randomUUID()
|
|
290
|
-
*/
|
|
291
|
-
readonly instanceId: string;
|
|
292
|
-
/** Resolved configuration for this instance */
|
|
293
|
-
readonly config: SanityConfig;
|
|
294
|
-
/**
|
|
295
|
-
* Checks if the instance has been disposed
|
|
296
|
-
* @returns true if dispose() has been called
|
|
297
|
-
*/
|
|
298
|
-
isDisposed(): boolean;
|
|
299
|
-
/**
|
|
300
|
-
* Disposes the instance and cleans up associated resources
|
|
301
|
-
* @remarks Triggers all registered onDispose callbacks
|
|
302
|
-
*/
|
|
303
|
-
dispose(): void;
|
|
304
|
-
/**
|
|
305
|
-
* Registers a callback to be invoked when the instance is disposed
|
|
306
|
-
* @param cb - Callback to execute on disposal
|
|
307
|
-
* @returns Function to unsubscribe the callback
|
|
308
|
-
*/
|
|
309
|
-
onDispose(cb: () => void): () => void;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Creates a new Sanity resource instance
|
|
313
|
-
* @param config - Configuration for the instance (optional)
|
|
314
|
-
* @returns A configured SanityInstance
|
|
315
|
-
*
|
|
316
|
-
* @public
|
|
317
|
-
*/
|
|
318
|
-
declare function createSanityInstance(config?: SanityConfig): SanityInstance;
|
|
319
|
-
/**
|
|
320
|
-
* Options that all agent actions accept for targeting a specific resource.
|
|
321
|
-
* @alpha
|
|
25
|
+
* @see https://www.sanity.io/docs/http-reference/access-api
|
|
26
|
+
* @internal
|
|
322
27
|
*/
|
|
323
|
-
|
|
324
|
-
resource: DocumentResource;
|
|
325
|
-
}
|
|
28
|
+
declare const checkPermissions: Fetcher<[resourceType: AccessResourceType, resourceId: string, permissions: string[]], Record<string, boolean>>;
|
|
326
29
|
/** @alpha */
|
|
327
30
|
type AgentGenerateOptions = Parameters<SanityClient['observable']['agent']['action']['generate']>[0];
|
|
328
31
|
/** @alpha */
|
|
@@ -350,7 +53,7 @@ type AgentPatchResult = Awaited<ReturnType<SanityClient['agent']['action']['patc
|
|
|
350
53
|
* @returns An Observable emitting the result of the agent generate action.
|
|
351
54
|
* @alpha
|
|
352
55
|
*/
|
|
353
|
-
declare function agentGenerate(instance: SanityInstance, options: AgentGenerateOptions
|
|
56
|
+
declare function agentGenerate(instance: SanityInstance, options: AgentGenerateOptions, resource?: DocumentResource): AgentGenerateResult;
|
|
354
57
|
/**
|
|
355
58
|
* Transforms a document using the agent.
|
|
356
59
|
* @param instance - The Sanity instance.
|
|
@@ -358,7 +61,7 @@ declare function agentGenerate(instance: SanityInstance, options: AgentGenerateO
|
|
|
358
61
|
* @returns An Observable emitting the result of the agent transform action.
|
|
359
62
|
* @alpha
|
|
360
63
|
*/
|
|
361
|
-
declare function agentTransform(instance: SanityInstance, options: AgentTransformOptions
|
|
64
|
+
declare function agentTransform(instance: SanityInstance, options: AgentTransformOptions, resource?: DocumentResource): AgentTransformResult;
|
|
362
65
|
/**
|
|
363
66
|
* Translates a document using the agent.
|
|
364
67
|
* @param instance - The Sanity instance.
|
|
@@ -366,7 +69,7 @@ declare function agentTransform(instance: SanityInstance, options: AgentTransfor
|
|
|
366
69
|
* @returns An Observable emitting the result of the agent translate action.
|
|
367
70
|
* @alpha
|
|
368
71
|
*/
|
|
369
|
-
declare function agentTranslate(instance: SanityInstance, options: AgentTranslateOptions
|
|
72
|
+
declare function agentTranslate(instance: SanityInstance, options: AgentTranslateOptions, resource?: DocumentResource): AgentTranslateResult;
|
|
370
73
|
/**
|
|
371
74
|
* Prompts the agent using the same instruction template format as the other actions, but returns text or json instead of acting on a document.
|
|
372
75
|
* @param instance - The Sanity instance.
|
|
@@ -374,7 +77,7 @@ declare function agentTranslate(instance: SanityInstance, options: AgentTranslat
|
|
|
374
77
|
* @returns An Observable emitting the result of the agent prompt action.
|
|
375
78
|
* @alpha
|
|
376
79
|
*/
|
|
377
|
-
declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptions
|
|
80
|
+
declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptions, resource?: DocumentResource): Observable<AgentPromptResult>;
|
|
378
81
|
/**
|
|
379
82
|
* Patches a document using the agent.
|
|
380
83
|
* @param instance - The Sanity instance.
|
|
@@ -382,192 +85,421 @@ declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptio
|
|
|
382
85
|
* @returns An Observable emitting the result of the agent patch action.
|
|
383
86
|
* @alpha
|
|
384
87
|
*/
|
|
385
|
-
declare function agentPatch(instance: SanityInstance, options: AgentPatchOptions
|
|
88
|
+
declare function agentPatch(instance: SanityInstance, options: AgentPatchOptions, resource?: DocumentResource): Observable<AgentPatchResult>;
|
|
386
89
|
/**
|
|
387
|
-
*
|
|
90
|
+
* A response field that the API embeds only when its `include` token was
|
|
91
|
+
* requested. Given the full set of tokens `All`, the token `Key` this field
|
|
92
|
+
* maps to, and the tokens actually `Requested`, it resolves to:
|
|
93
|
+
*
|
|
94
|
+
* - `unknown` (field absent) when nothing — or nothing matching `Key` — was requested
|
|
95
|
+
* - `Field` (present, as declared) when a literal request list contains `Key`
|
|
96
|
+
* - `Partial<Field>` (optional) when `Requested` is the wide `All` union, i.e.
|
|
97
|
+
* an `include` array whose members aren't known at the type level
|
|
98
|
+
*
|
|
99
|
+
* Absent arms return `unknown` so they vanish under intersection. Mirrors the
|
|
100
|
+
* `boolean extends Flag` trick the organization/project types use, but for an
|
|
101
|
+
* include-token union rather than a boolean flag.
|
|
388
102
|
*
|
|
389
103
|
* @internal
|
|
390
104
|
*/
|
|
391
|
-
|
|
105
|
+
type Included<All extends string, Key extends All, Requested extends All, Field> = [All] extends [Requested] ? Partial<Field> : [Key] extends [Requested] ? Field : unknown;
|
|
392
106
|
/**
|
|
393
|
-
*
|
|
107
|
+
* Whether the requested include tokens intersect a given set — used to decide
|
|
108
|
+
* whether a parent field (e.g. an application's `activeDeployment`) is present,
|
|
109
|
+
* when requesting any of several tokens forces it in.
|
|
394
110
|
*
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
type IncludesAny<Requested extends string, Set extends string> = [Requested & Set] extends [never] ? false : true;
|
|
114
|
+
/**
|
|
115
|
+
* Related data the Applications API can embed in a response. `interfaces`,
|
|
116
|
+
* `workspaces` and `access` are children of the active deployment and are
|
|
117
|
+
* embedded under {@link Application.activeDeployment}; `config.studio` and
|
|
118
|
+
* `config.mfManifest` are embedded under {@link Application.config}.
|
|
119
|
+
*
|
|
120
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
395
121
|
* @public
|
|
396
122
|
*/
|
|
397
|
-
|
|
398
|
-
LOGGED_IN = "logged-in",
|
|
399
|
-
LOGGING_IN = "logging-in",
|
|
400
|
-
ERROR = "error",
|
|
401
|
-
LOGGED_OUT = "logged-out",
|
|
402
|
-
}
|
|
123
|
+
type ApplicationInclude = 'interfaces' | 'workspaces' | 'access' | 'config.studio' | 'config.mfManifest' | 'activeDeployment';
|
|
403
124
|
/**
|
|
404
|
-
*
|
|
125
|
+
* An interface exposed by a deployment, embedded when `interfaces` is included.
|
|
126
|
+
*
|
|
127
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
128
|
+
* @public
|
|
405
129
|
*/
|
|
406
|
-
interface
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
*
|
|
419
|
-
* @remarks
|
|
420
|
-
* When providing a partial object, previous top-level keys not included in
|
|
421
|
-
* the update will be preserved.
|
|
422
|
-
*/
|
|
423
|
-
set: (name: string, updatedState: Partial<TState> | ((s: TState) => Partial<TState>)) => void;
|
|
424
|
-
/**
|
|
425
|
-
* Observable stream of state changes
|
|
426
|
-
* @remarks
|
|
427
|
-
* - Emits immediately with current state on subscription
|
|
428
|
-
* - Shares underlying subscription between observers
|
|
429
|
-
* - Only emits when state reference changes
|
|
430
|
-
* - Completes when store is disposed
|
|
431
|
-
*/
|
|
432
|
-
observable: Observable<TState>;
|
|
130
|
+
interface ApplicationInterface {
|
|
131
|
+
id: string;
|
|
132
|
+
type: 'app' | 'worker' | 'asset_source' | 'panel';
|
|
133
|
+
name: string;
|
|
134
|
+
title: string;
|
|
135
|
+
version: string;
|
|
136
|
+
/** Module federation module ID; resolved from the host mf-manifest at runtime */
|
|
137
|
+
moduleId: string;
|
|
138
|
+
metadata: {
|
|
139
|
+
group?: string;
|
|
140
|
+
priority?: number;
|
|
141
|
+
} | null;
|
|
433
142
|
}
|
|
434
143
|
/**
|
|
435
|
-
*
|
|
144
|
+
* A studio workspace of a deployment, embedded when `workspaces` is included.
|
|
145
|
+
* Studio applications only.
|
|
146
|
+
*
|
|
147
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
148
|
+
* @public
|
|
436
149
|
*/
|
|
437
|
-
interface
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
* @remarks
|
|
449
|
-
* Contains methods for getting/setting state and observing changes
|
|
450
|
-
*/
|
|
451
|
-
state: StoreState<TState>;
|
|
452
|
-
/**
|
|
453
|
-
* The key used to instantiate the store.
|
|
454
|
-
*/
|
|
455
|
-
key: TKey;
|
|
150
|
+
interface ApplicationWorkspace {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
title: string | null;
|
|
154
|
+
subtitle: string | null;
|
|
155
|
+
projectId: string;
|
|
156
|
+
dataset: string;
|
|
157
|
+
schemaDescriptorId: string | null;
|
|
158
|
+
basePath: string | null;
|
|
159
|
+
/** Sanitized SVG icon markup */
|
|
160
|
+
icon: string | null;
|
|
456
161
|
}
|
|
457
162
|
/**
|
|
458
|
-
*
|
|
163
|
+
* A resource an application accesses, embedded when `access` is included.
|
|
164
|
+
*
|
|
165
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
166
|
+
* @public
|
|
459
167
|
*/
|
|
460
|
-
|
|
168
|
+
interface ApplicationAccess {
|
|
169
|
+
id: string;
|
|
170
|
+
resourceType: 'datasets' | 'canvases' | 'dashboards' | 'media-libraries';
|
|
171
|
+
resourceId: string;
|
|
172
|
+
}
|
|
461
173
|
/**
|
|
462
|
-
*
|
|
174
|
+
* Studio configuration, embedded under `config` when `config.studio` is included.
|
|
175
|
+
*
|
|
176
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
177
|
+
* @public
|
|
463
178
|
*/
|
|
464
|
-
|
|
179
|
+
interface ApplicationStudioConfig {
|
|
180
|
+
projectId: string;
|
|
181
|
+
/** Release channel (`next`, `stable`, `latest`) or a pinned semver; null if unset */
|
|
182
|
+
autoUpdatingVersion: string | null;
|
|
183
|
+
}
|
|
465
184
|
/**
|
|
466
|
-
*
|
|
185
|
+
* The active deployment as embedded under {@link Application.activeDeployment}.
|
|
186
|
+
* Its `interfaces`, `workspaces` and `access` children are each present only
|
|
187
|
+
* when the matching {@link ApplicationInclude} token was requested. `workspaces`
|
|
188
|
+
* is omitted (not `null`) for non-studio applications even when requested.
|
|
467
189
|
*
|
|
190
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
468
191
|
* @public
|
|
469
192
|
*/
|
|
470
|
-
type
|
|
193
|
+
type ApplicationDeployment<Include extends ApplicationInclude = never> = {
|
|
194
|
+
id: string;
|
|
195
|
+
applicationId: string;
|
|
196
|
+
size: number | null;
|
|
197
|
+
version: string | null;
|
|
198
|
+
isAutoUpdating: boolean | null;
|
|
199
|
+
isActiveDeployment: boolean;
|
|
200
|
+
deployedBy: string | null;
|
|
201
|
+
createdAt: string;
|
|
202
|
+
updatedAt: string;
|
|
203
|
+
} & Included<ApplicationInclude, 'interfaces', Include, {
|
|
204
|
+
interfaces: ApplicationInterface[];
|
|
205
|
+
}> & Included<ApplicationInclude, 'workspaces', Include, {
|
|
206
|
+
workspaces?: ApplicationWorkspace[];
|
|
207
|
+
}> & Included<ApplicationInclude, 'access', Include, {
|
|
208
|
+
access: ApplicationAccess[];
|
|
209
|
+
}>;
|
|
471
210
|
/**
|
|
472
|
-
*
|
|
211
|
+
* The always-present fields of an org-owned application returned by the
|
|
212
|
+
* Applications API (`/applications`), before any {@link ApplicationInclude}.
|
|
213
|
+
*
|
|
214
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
473
215
|
* @public
|
|
474
216
|
*/
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
217
|
+
interface ApplicationBase {
|
|
218
|
+
id: string;
|
|
219
|
+
type: 'studio' | 'coreApp';
|
|
220
|
+
title: string;
|
|
221
|
+
icon: string | null;
|
|
222
|
+
isSingleton: boolean;
|
|
223
|
+
visibility: 'default' | 'unlisted' | 'disabled';
|
|
224
|
+
slug: string | null;
|
|
225
|
+
externalUrl: string | null;
|
|
226
|
+
organizationId: string;
|
|
227
|
+
createdAt: string;
|
|
228
|
+
updatedAt: string;
|
|
229
|
+
}
|
|
230
|
+
type DeploymentToken = 'activeDeployment' | 'interfaces' | 'workspaces' | 'access';
|
|
231
|
+
type ApplicationConfigShape<Include extends ApplicationInclude> = Included<ApplicationInclude, 'config.studio', Include, {
|
|
232
|
+
config: {
|
|
233
|
+
studio: ApplicationStudioConfig;
|
|
234
|
+
};
|
|
235
|
+
}> & Included<ApplicationInclude, 'config.mfManifest', Include, {
|
|
236
|
+
config: {
|
|
237
|
+
mfManifest: unknown;
|
|
238
|
+
};
|
|
239
|
+
}>;
|
|
240
|
+
type ApplicationDeploymentShape<Include extends ApplicationInclude> = [ApplicationInclude] extends [Include] ? {
|
|
241
|
+
activeDeployment?: ApplicationDeployment<Include> | null;
|
|
242
|
+
} : IncludesAny<Include, DeploymentToken> extends true ? {
|
|
243
|
+
activeDeployment: ApplicationDeployment<Include> | null;
|
|
244
|
+
} : unknown;
|
|
481
245
|
/**
|
|
482
|
-
*
|
|
246
|
+
* An org-owned application as returned by the Applications API
|
|
247
|
+
* (`/applications`). `config` and `activeDeployment` (with its
|
|
248
|
+
* `interfaces`/`workspaces`/`access` children) are present only when the
|
|
249
|
+
* corresponding {@link ApplicationInclude} tokens were requested.
|
|
250
|
+
*
|
|
251
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
483
252
|
* @public
|
|
484
253
|
*/
|
|
485
|
-
type
|
|
486
|
-
type: AuthStateType.LOGGED_OUT;
|
|
487
|
-
isDestroyingSession: boolean;
|
|
488
|
-
};
|
|
254
|
+
type Application<Include extends ApplicationInclude = never> = ApplicationBase & ApplicationConfigShape<Include> & ApplicationDeploymentShape<Include>;
|
|
489
255
|
/**
|
|
490
|
-
*
|
|
256
|
+
* Options for listing an organization's applications.
|
|
257
|
+
*
|
|
258
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
491
259
|
* @public
|
|
492
260
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
261
|
+
interface ApplicationsOptions<Include extends ApplicationInclude = ApplicationInclude> {
|
|
262
|
+
organizationId: string;
|
|
263
|
+
/** Filter by application type */
|
|
264
|
+
type?: string;
|
|
265
|
+
include?: Include[];
|
|
266
|
+
/** Page size (1-100, default 50), or `'none'` to disable pagination */
|
|
267
|
+
limit?: number | 'none';
|
|
268
|
+
/** Cursor from a previous response's `nextCursor` */
|
|
269
|
+
cursor?: string;
|
|
270
|
+
}
|
|
497
271
|
/**
|
|
498
|
-
*
|
|
272
|
+
* The cursor-paginated envelope returned by `GET /applications`.
|
|
273
|
+
*
|
|
274
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
499
275
|
* @public
|
|
500
276
|
*/
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
277
|
+
interface ApplicationsResponse<Include extends ApplicationInclude = never> {
|
|
278
|
+
nextCursor: string | null;
|
|
279
|
+
data: Application<Include>[];
|
|
280
|
+
}
|
|
505
281
|
/**
|
|
506
|
-
*
|
|
282
|
+
* Fetcher for an organization's applications (`GET /applications`), on the
|
|
283
|
+
* shared fetcher cache.
|
|
507
284
|
*
|
|
508
|
-
* @
|
|
285
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
286
|
+
* @internal
|
|
287
|
+
*/
|
|
288
|
+
declare const applications: Fetcher<[options: ApplicationsOptions<ApplicationInclude>], ApplicationsResponse<ApplicationInclude>>;
|
|
289
|
+
/**
|
|
290
|
+
* Fetcher for a single application (`GET /applications/:id`), on the shared
|
|
291
|
+
* fetcher cache. No pre-seeding from {@link applications}: its list keys
|
|
292
|
+
* include the organization, which this fetcher's params can't reconstruct.
|
|
293
|
+
*
|
|
294
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
295
|
+
* @internal
|
|
509
296
|
*/
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
297
|
+
declare const application: Fetcher<[applicationId: string, options?: {
|
|
298
|
+
include?: ApplicationInclude[];
|
|
299
|
+
} | undefined], Application<ApplicationInclude>>;
|
|
300
|
+
/**
|
|
301
|
+
* Confirmation returned by the API's soft-delete endpoints.
|
|
302
|
+
*
|
|
303
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
304
|
+
* @internal
|
|
305
|
+
*/
|
|
306
|
+
interface DeletedResult {
|
|
307
|
+
deleted: boolean;
|
|
514
308
|
}
|
|
515
309
|
/**
|
|
516
|
-
* The
|
|
310
|
+
* Dashboard visibility for an application. The same set of values backs a user
|
|
311
|
+
* application's `dashboardStatus`.
|
|
312
|
+
*
|
|
313
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
517
314
|
* @internal
|
|
518
315
|
*/
|
|
519
|
-
type
|
|
316
|
+
type ApplicationVisibility = ApplicationBase['visibility'];
|
|
520
317
|
/**
|
|
521
|
-
*
|
|
318
|
+
* Mutable properties of an application (`PATCH /applications/:id`) — the
|
|
319
|
+
* writable subset of {@link ApplicationBase}, each optional, keyed by id.
|
|
320
|
+
*
|
|
321
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
322
|
+
* @internal
|
|
522
323
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
324
|
+
type UpdateApplicationInput = {
|
|
325
|
+
applicationId: string;
|
|
326
|
+
} & Partial<Pick<ApplicationBase, 'title' | 'icon' | 'visibility'>>;
|
|
327
|
+
/**
|
|
328
|
+
* Mutation to update an application (`PATCH /applications/:id`). Invalidates the
|
|
329
|
+
* updated application and the list so active entries reconverge on server truth.
|
|
330
|
+
*
|
|
331
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
declare const updateApplication: (instance: import("../_exports").SanityInstance, input: UpdateApplicationInput) => Promise<MutationResult<ApplicationBase>>;
|
|
335
|
+
/**
|
|
336
|
+
* Input for {@link deleteApplication}.
|
|
337
|
+
*
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
interface DeleteApplicationInput {
|
|
341
|
+
applicationId: string;
|
|
539
342
|
}
|
|
540
343
|
/**
|
|
541
|
-
*
|
|
344
|
+
* Mutation to soft-delete an application (`DELETE /applications/:id`).
|
|
345
|
+
* Invalidates the deleted application and the list.
|
|
346
|
+
*
|
|
347
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
348
|
+
* @internal
|
|
542
349
|
*/
|
|
543
|
-
declare const
|
|
350
|
+
declare const deleteApplication: (instance: import("../_exports").SanityInstance, input: DeleteApplicationInput) => Promise<MutationResult<DeletedResult>>;
|
|
544
351
|
/**
|
|
352
|
+
* A deployment of a user application, embedded when `activeDeployment` is
|
|
353
|
+
* included on the User Applications API. Distinct from the org Applications
|
|
354
|
+
* API's {@link ApplicationDeployment} summary.
|
|
355
|
+
*
|
|
356
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
545
357
|
* @public
|
|
546
358
|
*/
|
|
547
|
-
|
|
359
|
+
interface UserApplicationDeployment {
|
|
360
|
+
id: string;
|
|
361
|
+
version: string | null;
|
|
362
|
+
isActiveDeployment: boolean;
|
|
363
|
+
userApplicationId: string;
|
|
364
|
+
isAutoUpdating: boolean | null;
|
|
365
|
+
size: number | null;
|
|
366
|
+
deployedAt: string;
|
|
367
|
+
deployedBy: string | null;
|
|
368
|
+
createdAt: string;
|
|
369
|
+
updatedAt: string;
|
|
370
|
+
manifest: unknown;
|
|
371
|
+
}
|
|
548
372
|
/**
|
|
373
|
+
* A user application (deployed studio or custom app) as returned by
|
|
374
|
+
* `/user-applications`.
|
|
375
|
+
*
|
|
376
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
549
377
|
* @public
|
|
550
378
|
*/
|
|
551
|
-
|
|
379
|
+
interface UserApplication {
|
|
380
|
+
id: string;
|
|
381
|
+
projectId: string | null;
|
|
382
|
+
organizationId: string | null;
|
|
383
|
+
title: string | null;
|
|
384
|
+
type: string;
|
|
385
|
+
urlType: string;
|
|
386
|
+
appHost: string;
|
|
387
|
+
dashboardStatus: string;
|
|
388
|
+
createdAt: string;
|
|
389
|
+
updatedAt: string;
|
|
390
|
+
autoUpdatingVersion: string | null;
|
|
391
|
+
activeDeployment: UserApplicationDeployment | null;
|
|
392
|
+
manifestData: unknown;
|
|
393
|
+
config: Record<string, unknown> | null;
|
|
394
|
+
manifest: unknown;
|
|
395
|
+
}
|
|
552
396
|
/**
|
|
397
|
+
* Options for listing an organization's user applications.
|
|
398
|
+
*
|
|
399
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
553
400
|
* @public
|
|
554
401
|
*/
|
|
555
|
-
|
|
402
|
+
interface UserApplicationsOptions {
|
|
403
|
+
organizationId: string;
|
|
404
|
+
}
|
|
556
405
|
/**
|
|
557
|
-
*
|
|
406
|
+
* Fetcher for an organization's user applications (`GET /user-applications`),
|
|
407
|
+
* on the shared fetcher cache.
|
|
408
|
+
*
|
|
409
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
410
|
+
* @internal
|
|
558
411
|
*/
|
|
559
|
-
declare const
|
|
412
|
+
declare const userApplications: Fetcher<[options: UserApplicationsOptions], UserApplication[]>;
|
|
560
413
|
/**
|
|
561
|
-
*
|
|
562
|
-
* @
|
|
414
|
+
* Fetcher for a single user application (`GET /user-applications/:id`), on the
|
|
415
|
+
* shared fetcher cache. No pre-seeding from {@link userApplications}: its list
|
|
416
|
+
* keys include the organization, which this fetcher's params can't
|
|
417
|
+
* reconstruct.
|
|
418
|
+
*
|
|
419
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
420
|
+
* @internal
|
|
563
421
|
*/
|
|
564
|
-
declare const
|
|
422
|
+
declare const userApplication: Fetcher<[userApplicationId: string], UserApplication>;
|
|
565
423
|
/**
|
|
566
|
-
*
|
|
567
|
-
*
|
|
424
|
+
* Fields you can set when creating or updating a user application.
|
|
425
|
+
*
|
|
426
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
427
|
+
* @internal
|
|
428
|
+
*/
|
|
429
|
+
interface UserApplicationWriteFields {
|
|
430
|
+
/** Human-friendly display name; `null` clears it */
|
|
431
|
+
title?: string | null;
|
|
432
|
+
/** `internal` for Sanity-hosted studios, `external` for externally hosted */
|
|
433
|
+
urlType?: 'internal' | 'external';
|
|
434
|
+
/** Studio subdomain (internal) or full `https` URL (external) */
|
|
435
|
+
appHost?: string;
|
|
436
|
+
/** Internal apps only: make this the default app for the deployment */
|
|
437
|
+
isDefaultForDeployment?: boolean;
|
|
438
|
+
/** Dashboard visibility */
|
|
439
|
+
dashboardStatus?: ApplicationVisibility;
|
|
440
|
+
/** Auto-update channel or a pinned semver */
|
|
441
|
+
autoUpdatingVersion?: string | null;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Input for {@link createUserApplication}: the writable fields, with `urlType`
|
|
445
|
+
* and `appHost` required. `organizationId` and `appType` are sent as query
|
|
446
|
+
* parameters; the rest form the request body.
|
|
447
|
+
*
|
|
448
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
568
449
|
* @internal
|
|
569
450
|
*/
|
|
570
|
-
|
|
451
|
+
interface CreateUserApplicationInput extends UserApplicationWriteFields {
|
|
452
|
+
/** Query param: owning organization */
|
|
453
|
+
organizationId?: string;
|
|
454
|
+
/** Query param: `studio` or `coreApp` */
|
|
455
|
+
appType?: 'studio' | 'coreApp';
|
|
456
|
+
urlType: 'internal' | 'external';
|
|
457
|
+
appHost: string;
|
|
458
|
+
/** Create does not accept a `null` title */
|
|
459
|
+
title?: string;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Mutation to create a user application (`POST /user-applications`). Invalidates
|
|
463
|
+
* the list so it reconverges to include the new entry.
|
|
464
|
+
*
|
|
465
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
466
|
+
* @internal
|
|
467
|
+
*/
|
|
468
|
+
declare const createUserApplication: (instance: import("../_exports").SanityInstance, input: CreateUserApplicationInput) => Promise<MutationResult<UserApplication>>;
|
|
469
|
+
/**
|
|
470
|
+
* Input for {@link updateUserApplication}: the writable fields (all optional),
|
|
471
|
+
* keyed by id.
|
|
472
|
+
*
|
|
473
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
474
|
+
* @internal
|
|
475
|
+
*/
|
|
476
|
+
interface UpdateUserApplicationInput extends UserApplicationWriteFields {
|
|
477
|
+
userApplicationId: string;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Mutation to update a user application (`PATCH /user-applications/:id`).
|
|
481
|
+
* Invalidates the updated entry and the list.
|
|
482
|
+
*
|
|
483
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
484
|
+
* @internal
|
|
485
|
+
*/
|
|
486
|
+
declare const updateUserApplication: (instance: import("../_exports").SanityInstance, input: UpdateUserApplicationInput) => Promise<MutationResult<UserApplication>>;
|
|
487
|
+
/**
|
|
488
|
+
* Input for {@link deleteUserApplication}.
|
|
489
|
+
*
|
|
490
|
+
* @internal
|
|
491
|
+
*/
|
|
492
|
+
interface DeleteUserApplicationInput {
|
|
493
|
+
userApplicationId: string;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Mutation to delete a user application (`DELETE /user-applications/:id`).
|
|
497
|
+
* Invalidates the deleted entry and the list.
|
|
498
|
+
*
|
|
499
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
500
|
+
* @internal
|
|
501
|
+
*/
|
|
502
|
+
declare const deleteUserApplication: (instance: import("../_exports").SanityInstance, input: DeleteUserApplicationInput) => Promise<MutationResult<DeletedResult>>;
|
|
571
503
|
/**
|
|
572
504
|
* Error message returned by the organization verification
|
|
573
505
|
* @public
|
|
@@ -578,7 +510,7 @@ interface OrgVerificationResult {
|
|
|
578
510
|
/**
|
|
579
511
|
* Creates an observable that emits the organization verification state for a given instance.
|
|
580
512
|
* It combines the dashboard organization ID (from auth context) with the
|
|
581
|
-
* project's actual organization ID (fetched via
|
|
513
|
+
* project's actual organization ID (fetched via the project fetcher) and compares them.
|
|
582
514
|
* @public
|
|
583
515
|
*/
|
|
584
516
|
declare function observeOrganizationVerificationState(instance: SanityInstance, projectIds: string[]): Observable<OrgVerificationResult>;
|
|
@@ -590,24 +522,6 @@ declare const handleAuthCallback: BoundStoreAction<AuthStoreState, [locationHref
|
|
|
590
522
|
* @public
|
|
591
523
|
*/
|
|
592
524
|
declare const logout: BoundStoreAction<AuthStoreState, [], Promise<void>>;
|
|
593
|
-
/** @internal */
|
|
594
|
-
type ApiErrorBody = {
|
|
595
|
-
error?: {
|
|
596
|
-
type?: string;
|
|
597
|
-
description?: string;
|
|
598
|
-
};
|
|
599
|
-
type?: string;
|
|
600
|
-
description?: string;
|
|
601
|
-
message?: string;
|
|
602
|
-
};
|
|
603
|
-
/** @internal Extracts the structured API error body from a ClientError, if present. */
|
|
604
|
-
declare function getClientErrorApiBody(error: ClientError): ApiErrorBody | undefined;
|
|
605
|
-
/** @internal Returns the error type string from an API error body, if available. */
|
|
606
|
-
declare function getClientErrorApiType(error: ClientError): string | undefined;
|
|
607
|
-
/** @internal Returns the error description string from an API error body, if available. */
|
|
608
|
-
declare function getClientErrorApiDescription(error: ClientError): string | undefined;
|
|
609
|
-
/** @internal True if the error represents a projectUserNotFoundError. */
|
|
610
|
-
declare function isProjectUserNotFoundClientError(error: ClientError): boolean;
|
|
611
525
|
type AllowedClientConfigKey = 'useCdn' | 'token' | 'perspective' | 'apiHost' | 'proxy' | 'withCredentials' | 'timeout' | 'maxRetries' | 'dataset' | 'projectId' | 'requestTagPrefix' | 'useProjectHostname';
|
|
612
526
|
/**
|
|
613
527
|
* States tracked by the client store
|
|
@@ -615,7 +529,7 @@ type AllowedClientConfigKey = 'useCdn' | 'token' | 'perspective' | 'apiHost' | '
|
|
|
615
529
|
*/
|
|
616
530
|
interface ClientStoreState {
|
|
617
531
|
token: string | null;
|
|
618
|
-
clients: { [TKey in string]?: SanityClient };
|
|
532
|
+
clients: { [TKey in string]?: SanityClient; };
|
|
619
533
|
authMethod?: 'localstorage' | 'cookie';
|
|
620
534
|
}
|
|
621
535
|
/**
|
|
@@ -634,30 +548,22 @@ interface ClientStoreState {
|
|
|
634
548
|
*
|
|
635
549
|
* @public
|
|
636
550
|
*/
|
|
637
|
-
interface ClientOptions extends
|
|
638
|
-
/**
|
|
639
|
-
* Narrows the inherited `perspective` to exclude stackable perspectives,
|
|
640
|
-
* which are not supported by the SDK.
|
|
641
|
-
*/
|
|
642
|
-
'perspective'?: Exclude<ClientPerspective, readonly unknown[]>;
|
|
551
|
+
interface ClientOptions extends Pick<ClientConfig, AllowedClientConfigKey> {
|
|
643
552
|
/**
|
|
644
553
|
* An optional flag to choose between the default client (typically project-level)
|
|
645
554
|
* and the global client ('global'). When set to `'global'`, the global client
|
|
646
555
|
* is used.
|
|
647
556
|
*/
|
|
648
|
-
|
|
557
|
+
scope?: 'default' | 'global';
|
|
649
558
|
/**
|
|
650
559
|
* A required string indicating the API version for the client.
|
|
651
560
|
*/
|
|
652
|
-
|
|
653
|
-
/**
|
|
654
|
-
* @internal
|
|
655
|
-
*/
|
|
656
|
-
'~experimental_resource'?: ClientConfig['~experimental_resource'];
|
|
561
|
+
apiVersion: string;
|
|
657
562
|
/**
|
|
658
563
|
* @internal
|
|
564
|
+
* The SDK resource to use for the client -- this will get transformed into a ClientConfig resource.
|
|
659
565
|
*/
|
|
660
|
-
|
|
566
|
+
resource?: DocumentResource;
|
|
661
567
|
}
|
|
662
568
|
/**
|
|
663
569
|
* Retrieves a Sanity client instance configured with the provided options.
|
|
@@ -680,7 +586,7 @@ declare const getClient: BoundStoreAction<ClientStoreState, [options: ClientOpti
|
|
|
680
586
|
*
|
|
681
587
|
* @public
|
|
682
588
|
*/
|
|
683
|
-
declare const getClientState: BoundStoreAction<ClientStoreState, [options: ClientOptions], StateSource<SanityClient>>;
|
|
589
|
+
declare const getClientState: BoundStoreAction<ClientStoreState, [options: ClientOptions], import("../_exports").StateSource<SanityClient>>;
|
|
684
590
|
/**
|
|
685
591
|
* Message sent from a containing app to an iframe
|
|
686
592
|
* @public
|
|
@@ -738,7 +644,7 @@ declare const destroyController: BoundStoreAction<ComlinkControllerState, [], vo
|
|
|
738
644
|
* an application and the controller.
|
|
739
645
|
* @public
|
|
740
646
|
*/
|
|
741
|
-
declare const getOrCreateChannel: BoundStoreAction<ComlinkControllerState, [options: ChannelInput], ChannelInstance<
|
|
647
|
+
declare const getOrCreateChannel: BoundStoreAction<ComlinkControllerState, [options: ChannelInput], ChannelInstance<import("@sanity/comlink").Message, import("@sanity/comlink").Message>>;
|
|
742
648
|
/**
|
|
743
649
|
* Initializes or fetches a controller to handle communication
|
|
744
650
|
* between an application and iframes.
|
|
@@ -779,7 +685,7 @@ declare const releaseNode: BoundStoreAction<ComlinkNodeState, [name: string], vo
|
|
|
779
685
|
* be created within a frame / window to communicate with the controller.
|
|
780
686
|
* @public
|
|
781
687
|
*/
|
|
782
|
-
declare const getOrCreateNode: BoundStoreAction<ComlinkNodeState, [options: NodeInput], Node<
|
|
688
|
+
declare const getOrCreateNode: BoundStoreAction<ComlinkNodeState, [options: NodeInput], Node<import("@sanity/comlink").Message, import("@sanity/comlink").Message>>;
|
|
783
689
|
/**
|
|
784
690
|
* @public
|
|
785
691
|
*/
|
|
@@ -791,11 +697,10 @@ interface NodeState {
|
|
|
791
697
|
* Provides a subscribable state source for a node by name
|
|
792
698
|
* @param instance - The Sanity instance to get the node state for
|
|
793
699
|
* @param nodeInput - The configuration for the node to get the state for
|
|
794
|
-
|
|
795
700
|
* @returns A subscribable state source for the node
|
|
796
701
|
* @public
|
|
797
702
|
*/
|
|
798
|
-
declare const getNodeState: BoundStoreAction<ComlinkNodeState, [NodeInput], StateSource<NodeState | undefined>>;
|
|
703
|
+
declare const getNodeState: BoundStoreAction<ComlinkNodeState, [NodeInput], import("../../_exports").StateSource<NodeState | undefined>>;
|
|
799
704
|
/**
|
|
800
705
|
* Creates or validates a `DocumentHandle` object.
|
|
801
706
|
* Ensures the provided object conforms to the `DocumentHandle` interface.
|
|
@@ -813,13 +718,21 @@ declare function createDocumentHandle<TDocumentType extends string = string, TDa
|
|
|
813
718
|
*/
|
|
814
719
|
declare function createDocumentTypeHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(handle: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>): DocumentTypeHandle<TDocumentType, TDataset, TProjectId>;
|
|
815
720
|
/**
|
|
816
|
-
* Creates or validates a `
|
|
817
|
-
* Ensures the provided object conforms to the `
|
|
818
|
-
* @param handle - The object containing
|
|
819
|
-
* @returns The validated `
|
|
721
|
+
* Creates or validates a `ProjectHandle` object.
|
|
722
|
+
* Ensures the provided object conforms to the `ProjectHandle` interface.
|
|
723
|
+
* @param handle - The object containing project identification properties.
|
|
724
|
+
* @returns The validated `ProjectHandle` object.
|
|
725
|
+
* @public
|
|
726
|
+
*/
|
|
727
|
+
declare function createProjectHandle<TProjectId extends string = string>(handle: ProjectHandle<TProjectId>): ProjectHandle<TProjectId>;
|
|
728
|
+
/**
|
|
729
|
+
* Creates or validates a `DatasetHandle` object.
|
|
730
|
+
* Ensures the provided object conforms to the `DatasetHandle` interface.
|
|
731
|
+
* @param handle - The object containing dataset identification properties.
|
|
732
|
+
* @returns The validated `DatasetHandle` object.
|
|
820
733
|
* @public
|
|
821
734
|
*/
|
|
822
|
-
declare function
|
|
735
|
+
declare function createDatasetHandle<TDataset extends string = string, TProjectId extends string = string>(handle: DatasetHandle<TDataset, TProjectId>): DatasetHandle<TDataset, TProjectId>;
|
|
823
736
|
/**
|
|
824
737
|
* Logging infrastructure for the Sanity SDK
|
|
825
738
|
*
|
|
@@ -964,9 +877,9 @@ interface LogContext {
|
|
|
964
877
|
interface InstanceContext {
|
|
965
878
|
/** Unique instance ID */
|
|
966
879
|
instanceId?: string;
|
|
967
|
-
/** Project ID
|
|
880
|
+
/** Project ID */
|
|
968
881
|
projectId?: string;
|
|
969
|
-
/** Dataset name
|
|
882
|
+
/** Dataset name */
|
|
970
883
|
dataset?: string;
|
|
971
884
|
}
|
|
972
885
|
/**
|
|
@@ -1092,17 +1005,9 @@ interface Logger {
|
|
|
1092
1005
|
*/
|
|
1093
1006
|
declare function configureLogging(config: LoggerConfig): void;
|
|
1094
1007
|
/** @public */
|
|
1095
|
-
declare const getDatasetsState: BoundStoreAction<FetcherStoreState<[options
|
|
1096
|
-
projectId: string;
|
|
1097
|
-
}], _sanity_client12.DatasetsResponse>, [options: {
|
|
1098
|
-
projectId: string;
|
|
1099
|
-
}], StateSource<_sanity_client12.DatasetsResponse | undefined>>;
|
|
1008
|
+
declare const getDatasetsState: BoundStoreAction<import("../_exports").FetcherStoreState<[options?: ProjectHandle<string> | undefined], import("@sanity/client").DatasetsResponse>, [options?: ProjectHandle<string> | undefined], import("../_exports").StateSource<import("@sanity/client").DatasetsResponse | undefined>>;
|
|
1100
1009
|
/** @public */
|
|
1101
|
-
declare const resolveDatasets: BoundStoreAction<FetcherStoreState<[options
|
|
1102
|
-
projectId: string;
|
|
1103
|
-
}], _sanity_client12.DatasetsResponse>, [options: {
|
|
1104
|
-
projectId: string;
|
|
1105
|
-
}], Promise<_sanity_client12.DatasetsResponse>>;
|
|
1010
|
+
declare const resolveDatasets: BoundStoreAction<import("../_exports").FetcherStoreState<[options?: ProjectHandle<string> | undefined], import("@sanity/client").DatasetsResponse>, [options?: ProjectHandle<string> | undefined], Promise<import("@sanity/client").DatasetsResponse>>;
|
|
1106
1011
|
/**
|
|
1107
1012
|
* Represents an action to create a new document.
|
|
1108
1013
|
* Specifies the document type and optionally a document ID (which will be treated as the published ID).
|
|
@@ -1115,7 +1020,7 @@ interface CreateDocumentAction<TDocumentType extends string = string, TDataset e
|
|
|
1115
1020
|
* These values will be set when the document is created.
|
|
1116
1021
|
* System fields (_id, _type, _rev, _createdAt, _updatedAt) are omitted as they are set automatically.
|
|
1117
1022
|
*/
|
|
1118
|
-
initialValue?: Partial<Omit<SanityDocument$
|
|
1023
|
+
initialValue?: Partial<Omit<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>, '_id' | '_type' | '_rev' | '_createdAt' | '_updatedAt'>>;
|
|
1119
1024
|
}
|
|
1120
1025
|
/**
|
|
1121
1026
|
* Represents an action to delete an existing document.
|
|
@@ -1133,6 +1038,21 @@ interface DeleteDocumentAction<TDocumentType extends string = string, TDataset e
|
|
|
1133
1038
|
interface EditDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1134
1039
|
type: 'document.edit';
|
|
1135
1040
|
patches?: PatchOperations[];
|
|
1041
|
+
/**
|
|
1042
|
+
* When `true`, the given `patches` are forwarded verbatim to the server and
|
|
1043
|
+
* applied as-is locally, instead of being re-derived by diffing document
|
|
1044
|
+
* snapshots. This preserves the operational intent of the patches (e.g.
|
|
1045
|
+
* keyed array inserts/unsets), which lets concurrent edits from other
|
|
1046
|
+
* clients interleave coherently instead of being overwritten by
|
|
1047
|
+
* position-based patches computed from a stale snapshot.
|
|
1048
|
+
*
|
|
1049
|
+
* Use this when the patches were produced by an editor that tracks its own
|
|
1050
|
+
* operations (e.g. a collaborative text editor). During a rebase onto a
|
|
1051
|
+
* changed remote document, preserved patches are re-applied operationally;
|
|
1052
|
+
* if a patch can no longer apply, the transaction is skipped and reported
|
|
1053
|
+
* as a `rebase-error` document event.
|
|
1054
|
+
*/
|
|
1055
|
+
preserveOperations?: boolean;
|
|
1136
1056
|
}
|
|
1137
1057
|
/**
|
|
1138
1058
|
* Represents an action to publish the draft version of a document.
|
|
@@ -1163,6 +1083,12 @@ interface DiscardDocumentAction<TDocumentType extends string = string, TDataset
|
|
|
1163
1083
|
* @beta
|
|
1164
1084
|
*/
|
|
1165
1085
|
type DocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> = CreateDocumentAction<TDocumentType, TDataset, TProjectId> | DeleteDocumentAction<TDocumentType, TDataset, TProjectId> | EditDocumentAction<TDocumentType, TDataset, TProjectId> | PublishDocumentAction<TDocumentType, TDataset, TProjectId> | UnpublishDocumentAction<TDocumentType, TDataset, TProjectId> | DiscardDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1086
|
+
/**
|
|
1087
|
+
* Union of every action accepted by `applyDocumentActions` — both document-
|
|
1088
|
+
* level actions and release-lifecycle actions.
|
|
1089
|
+
* @beta
|
|
1090
|
+
*/
|
|
1091
|
+
type Action<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> = DocumentAction<TDocumentType, TDataset, TProjectId> | ReleaseAction;
|
|
1166
1092
|
/**
|
|
1167
1093
|
* Creates a `CreateDocumentAction` object.
|
|
1168
1094
|
* @param doc - A handle identifying the document type, dataset, and project. An optional `documentId` can be provided.
|
|
@@ -1170,33 +1096,46 @@ type DocumentAction<TDocumentType extends string = string, TDataset extends stri
|
|
|
1170
1096
|
* @returns A `CreateDocumentAction` object ready for dispatch.
|
|
1171
1097
|
* @beta
|
|
1172
1098
|
*/
|
|
1173
|
-
declare function createDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>, initialValue?: Partial<Omit<SanityDocument$
|
|
1099
|
+
declare function createDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>, initialValue?: Partial<Omit<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>, '_id' | '_type' | '_rev' | '_createdAt' | '_updatedAt'>>): CreateDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1174
1100
|
/**
|
|
1175
1101
|
* Creates a `DeleteDocumentAction` object.
|
|
1176
1102
|
* @param doc - A handle uniquely identifying the document to be deleted.
|
|
1177
1103
|
* @returns A `DeleteDocumentAction` object ready for dispatch.
|
|
1178
1104
|
* @beta
|
|
1179
1105
|
*/
|
|
1180
|
-
declare function deleteDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): DeleteDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1106
|
+
declare function deleteDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): DeleteDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1107
|
+
/**
|
|
1108
|
+
* Options for creating an `EditDocumentAction`.
|
|
1109
|
+
* @beta
|
|
1110
|
+
*/
|
|
1111
|
+
interface EditDocumentOptions {
|
|
1112
|
+
/**
|
|
1113
|
+
* Forward the given patches verbatim instead of re-deriving them by
|
|
1114
|
+
* diffing document snapshots. See {@link EditDocumentAction.preserveOperations}.
|
|
1115
|
+
*/
|
|
1116
|
+
preserveOperations?: boolean;
|
|
1117
|
+
}
|
|
1181
1118
|
/**
|
|
1182
1119
|
* Creates an `EditDocumentAction` object with patches for modifying a document.
|
|
1183
1120
|
* Accepts patches in either the standard `PatchOperations` format or as a `SanityMutatePatchMutation` from `@sanity/mutate`.
|
|
1184
1121
|
*
|
|
1185
1122
|
* @param doc - A handle uniquely identifying the document to be edited.
|
|
1186
1123
|
* @param sanityMutatePatch - A patch mutation object from `@sanity/mutate`.
|
|
1124
|
+
* @param options - Options controlling how the patches are processed.
|
|
1187
1125
|
* @returns An `EditDocumentAction` object ready for dispatch.
|
|
1188
1126
|
* @beta
|
|
1189
1127
|
*/
|
|
1190
|
-
declare function editDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>, sanityMutatePatch: PatchMutation): EditDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1128
|
+
declare function editDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>, sanityMutatePatch: PatchMutation, options?: EditDocumentOptions): EditDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1191
1129
|
/**
|
|
1192
1130
|
* Creates an `EditDocumentAction` object with patches for modifying a document.
|
|
1193
1131
|
*
|
|
1194
1132
|
* @param doc - A handle uniquely identifying the document to be edited.
|
|
1195
1133
|
* @param patches - A single patch operation or an array of patch operations.
|
|
1134
|
+
* @param options - Options controlling how the patches are processed.
|
|
1196
1135
|
* @returns An `EditDocumentAction` object ready for dispatch.
|
|
1197
1136
|
* @beta
|
|
1198
1137
|
*/
|
|
1199
|
-
declare function editDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>, patches?: PatchOperations | PatchOperations[]): EditDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1138
|
+
declare function editDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>, patches?: PatchOperations | PatchOperations[], options?: EditDocumentOptions): EditDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1200
1139
|
/**
|
|
1201
1140
|
* Creates a `PublishDocumentAction` object.
|
|
1202
1141
|
* @param doc - A handle uniquely identifying the document to be published.
|
|
@@ -1218,141 +1157,272 @@ declare function unpublishDocument<TDocumentType extends string = string, TDatas
|
|
|
1218
1157
|
* @beta
|
|
1219
1158
|
*/
|
|
1220
1159
|
declare function discardDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): DiscardDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Creates a new release. The `releaseId` must be unique within the current
|
|
1162
|
+
* retention period.
|
|
1163
|
+
* @beta
|
|
1164
|
+
*/
|
|
1165
|
+
interface CreateReleaseAction extends ReleaseHandle {
|
|
1166
|
+
type: 'release.create';
|
|
1167
|
+
metadata: ReleaseDocument$1['metadata'];
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Patches the metadata of an existing release.
|
|
1171
|
+
* @beta
|
|
1172
|
+
*/
|
|
1173
|
+
interface EditReleaseAction extends ReleaseHandle {
|
|
1174
|
+
type: 'release.edit';
|
|
1175
|
+
patch: PatchOperations;
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Publishes all version documents in a release.
|
|
1179
|
+
* @beta
|
|
1180
|
+
*/
|
|
1181
|
+
interface PublishReleaseAction extends ReleaseHandle {
|
|
1182
|
+
type: 'release.publish';
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Schedules a release to be published at the given UTC time. Locks the
|
|
1186
|
+
* version documents server-side until the release is unscheduled or published.
|
|
1187
|
+
* @beta
|
|
1188
|
+
*/
|
|
1189
|
+
interface ScheduleReleaseAction extends ReleaseHandle {
|
|
1190
|
+
type: 'release.schedule';
|
|
1191
|
+
publishAt: string;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Unschedules a release that was previously scheduled, returning it to the
|
|
1195
|
+
* active editable state.
|
|
1196
|
+
* @beta
|
|
1197
|
+
*/
|
|
1198
|
+
interface UnscheduleReleaseAction extends ReleaseHandle {
|
|
1199
|
+
type: 'release.unschedule';
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Archives an active release. Version documents within the release are
|
|
1203
|
+
* removed and no longer queryable, though still recoverable through history
|
|
1204
|
+
* during the retention period.
|
|
1205
|
+
* @beta
|
|
1206
|
+
*/
|
|
1207
|
+
interface ArchiveReleaseAction extends ReleaseHandle {
|
|
1208
|
+
type: 'release.archive';
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Restores an archived release. Only possible during the retention period.
|
|
1212
|
+
* @beta
|
|
1213
|
+
*/
|
|
1214
|
+
interface UnarchiveReleaseAction extends ReleaseHandle {
|
|
1215
|
+
type: 'release.unarchive';
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Permanently deletes an archived or published release. To remove an active
|
|
1219
|
+
* release, use the archive action first.
|
|
1220
|
+
* @beta
|
|
1221
|
+
*/
|
|
1222
|
+
interface DeleteReleaseAction extends ReleaseHandle {
|
|
1223
|
+
type: 'release.delete';
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Union of all release actions that can be dispatched alongside document
|
|
1227
|
+
* actions through `applyDocumentActions`.
|
|
1228
|
+
* @beta
|
|
1229
|
+
*/
|
|
1230
|
+
type ReleaseAction = CreateReleaseAction | EditReleaseAction | PublishReleaseAction | ScheduleReleaseAction | UnscheduleReleaseAction | ArchiveReleaseAction | UnarchiveReleaseAction | DeleteReleaseAction;
|
|
1231
|
+
/** @beta */
|
|
1232
|
+
declare function createRelease(handle: ReleaseHandle, metadata?: ReleaseDocument$1['metadata']): CreateReleaseAction;
|
|
1233
|
+
/** @beta */
|
|
1234
|
+
declare function editRelease(handle: ReleaseHandle, patch: PatchOperations): EditReleaseAction;
|
|
1235
|
+
/** @beta */
|
|
1236
|
+
declare function publishRelease(handle: ReleaseHandle): PublishReleaseAction;
|
|
1237
|
+
/** @beta */
|
|
1238
|
+
declare function scheduleRelease(handle: ReleaseHandle, publishAt: string): ScheduleReleaseAction;
|
|
1239
|
+
/** @beta */
|
|
1240
|
+
declare function unscheduleRelease(handle: ReleaseHandle): UnscheduleReleaseAction;
|
|
1241
|
+
/** @beta */
|
|
1242
|
+
declare function archiveRelease(handle: ReleaseHandle): ArchiveReleaseAction;
|
|
1243
|
+
/** @beta */
|
|
1244
|
+
declare function unarchiveRelease(handle: ReleaseHandle): UnarchiveReleaseAction;
|
|
1245
|
+
/** @beta */
|
|
1246
|
+
declare function deleteRelease(handle: ReleaseHandle): DeleteReleaseAction;
|
|
1247
|
+
/**
|
|
1248
|
+
* Split the entire path string on dots "outside" of any brackets.
|
|
1249
|
+
*
|
|
1250
|
+
* For example:
|
|
1251
|
+
* ```
|
|
1252
|
+
* "friends[0].name"
|
|
1253
|
+
* ```
|
|
1254
|
+
*
|
|
1255
|
+
* becomes:
|
|
1256
|
+
*
|
|
1257
|
+
* ```
|
|
1258
|
+
* [...ParseSegment<"friends[0]">, ...ParseSegment<"name">]
|
|
1259
|
+
* ```
|
|
1260
|
+
*
|
|
1261
|
+
* (We use a simple recursion that splits on the first dot.)
|
|
1262
|
+
*/
|
|
1263
|
+
type PathParts<TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? [Head, ...PathParts<Tail>] : TPath extends '' ? [] : [TPath];
|
|
1264
|
+
/**
|
|
1265
|
+
* Given a type T and an array of "access keys" Parts, recursively index into T.
|
|
1266
|
+
*
|
|
1267
|
+
* If a part is a key, it looks up that property.
|
|
1268
|
+
* If T is an array and the part is a number, it "indexes" into the element type.
|
|
1269
|
+
*/
|
|
1270
|
+
type DeepGet<TValue, TPath extends readonly (string | number)[]> = TPath extends [] ? TValue : TPath extends readonly [infer THead, ...infer TTail] ? DeepGet<TValue extends undefined | null ? undefined : THead extends keyof TValue ? TValue[THead] : THead extends number ? TValue extends readonly (infer TElement)[] ? TElement | undefined : undefined : undefined // Key/index doesn't exist
|
|
1271
|
+
, TTail extends readonly (string | number)[] ? TTail : []> : never;
|
|
1272
|
+
/**
|
|
1273
|
+
* Given a document type TDocument and a JSON Match path string TPath,
|
|
1274
|
+
* compute the type found at that path.
|
|
1275
|
+
* @beta
|
|
1276
|
+
*/
|
|
1277
|
+
type JsonMatch<TDocument, TPath extends string> = DeepGet<TDocument, PathParts<TPath>>;
|
|
1221
1278
|
/**
|
|
1222
1279
|
* Represents a set of document that will go into `applyMutations`. Before
|
|
1223
1280
|
* applying a mutation, it's expected that all relevant documents that the
|
|
1224
1281
|
* mutations affect are included, including those that do not exist yet.
|
|
1225
1282
|
* Documents that don't exist have a `null` value.
|
|
1226
1283
|
*/
|
|
1227
|
-
type DocumentSet<TDocument extends SanityDocument$2 = SanityDocument$2> = { [TDocumentId in string]?: TDocument | null };
|
|
1284
|
+
type DocumentSet<TDocument extends SanityDocument$2 = SanityDocument$2> = { [TDocumentId in string]?: TDocument | null; };
|
|
1285
|
+
type Grant = 'read' | 'update' | 'create' | 'history';
|
|
1228
1286
|
/** @beta */
|
|
1229
|
-
interface
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
previousRevs: {
|
|
1234
|
-
[documentId: string]: string | undefined;
|
|
1235
|
-
};
|
|
1236
|
-
appeared: string[];
|
|
1237
|
-
updated: string[];
|
|
1238
|
-
disappeared: string[];
|
|
1239
|
-
submitted: () => ReturnType<SanityClient['action']>;
|
|
1287
|
+
interface PermissionDeniedReason {
|
|
1288
|
+
type: 'precondition' | 'access';
|
|
1289
|
+
message: string;
|
|
1290
|
+
documentId?: string;
|
|
1240
1291
|
}
|
|
1241
1292
|
/** @beta */
|
|
1242
|
-
|
|
1293
|
+
type DocumentPermissionsResult = {
|
|
1294
|
+
allowed: false;
|
|
1295
|
+
message: string;
|
|
1296
|
+
reasons: PermissionDeniedReason[];
|
|
1297
|
+
} | {
|
|
1298
|
+
allowed: true;
|
|
1299
|
+
message?: undefined;
|
|
1300
|
+
reasons?: undefined;
|
|
1301
|
+
};
|
|
1302
|
+
interface SharedListener {
|
|
1303
|
+
events: Observable<ListenEvent<SanityDocument$1>>;
|
|
1304
|
+
dispose: () => void;
|
|
1305
|
+
}
|
|
1306
|
+
interface DocumentStoreState {
|
|
1307
|
+
documentStates: { [TDocumentId in string]?: DocumentState; };
|
|
1308
|
+
queued: QueuedTransaction[];
|
|
1309
|
+
applied: AppliedTransaction[];
|
|
1310
|
+
outgoing?: OutgoingTransaction;
|
|
1311
|
+
grants?: Record<Grant, ExprNode>;
|
|
1243
1312
|
/**
|
|
1244
|
-
*
|
|
1313
|
+
* The current user's identity (their user ID).
|
|
1245
1314
|
*/
|
|
1246
|
-
|
|
1315
|
+
identity?: string;
|
|
1316
|
+
error?: unknown;
|
|
1317
|
+
sharedListener: SharedListener;
|
|
1318
|
+
fetchDocument: (documentId: string) => Observable<SanityDocument$3 | null>;
|
|
1319
|
+
events: Subject<DocumentEvent>;
|
|
1320
|
+
}
|
|
1321
|
+
interface DocumentState {
|
|
1322
|
+
id: string;
|
|
1247
1323
|
/**
|
|
1248
|
-
*
|
|
1324
|
+
* the "remote" local copy that matches the server. represents the last known
|
|
1325
|
+
* server state. this gets updated every time we confirm remote patches
|
|
1249
1326
|
*/
|
|
1250
|
-
|
|
1327
|
+
remote?: SanityDocument$3 | null;
|
|
1251
1328
|
/**
|
|
1252
|
-
*
|
|
1329
|
+
* the current ephemeral working copy that includes local optimistic changes
|
|
1330
|
+
* that have not yet been confirmed by the server
|
|
1253
1331
|
*/
|
|
1254
|
-
|
|
1332
|
+
local?: SanityDocument$3 | null;
|
|
1255
1333
|
/**
|
|
1256
|
-
*
|
|
1334
|
+
* the revision that our remote document is at
|
|
1257
1335
|
*/
|
|
1258
|
-
|
|
1259
|
-
}
|
|
1260
|
-
/** @beta */
|
|
1261
|
-
declare function applyDocumentActions(instance: SanityInstance, options: ApplyDocumentActionsOptions): Promise<ActionsResult>;
|
|
1262
|
-
/**
|
|
1263
|
-
* Represents a reactive state source that provides synchronized access to store data
|
|
1264
|
-
*
|
|
1265
|
-
* @remarks
|
|
1266
|
-
* Designed to work with React's useSyncExternalStore hook. Provides three ways to access data:
|
|
1267
|
-
* 1. `getCurrent()` for synchronous current value access
|
|
1268
|
-
* 2. `subscribe()` for imperative change notifications
|
|
1269
|
-
* 3. `observable` for reactive stream access
|
|
1270
|
-
*
|
|
1271
|
-
* @public
|
|
1272
|
-
*/
|
|
1273
|
-
interface StateSource<T> {
|
|
1336
|
+
remoteRev?: string | null;
|
|
1274
1337
|
/**
|
|
1275
|
-
*
|
|
1276
|
-
*
|
|
1277
|
-
* @returns Unsubscribe function to clean up the subscription
|
|
1338
|
+
* Array of subscription IDs. This document state will be deleted if there are
|
|
1339
|
+
* no subscribers.
|
|
1278
1340
|
*/
|
|
1279
|
-
|
|
1341
|
+
subscriptions: string[];
|
|
1280
1342
|
/**
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1343
|
+
* An object keyed by transaction ID of revisions sent out but that have not
|
|
1344
|
+
* yet been verified yet. When an applied transaction is transitioned to an
|
|
1345
|
+
* outgoing transaction, it also adds unverified revisions for each document
|
|
1346
|
+
* that is part of that outgoing transaction. Transactions are submitted to
|
|
1347
|
+
* the server with a locally generated transaction ID. This way we can observe
|
|
1348
|
+
* when our transaction comes back through the shared listener. Each listener
|
|
1349
|
+
* event that comes back contains a `previousRev`. If we see our own
|
|
1350
|
+
* transaction with a different `previousRev` than expected, we can rebase our
|
|
1351
|
+
* local transactions on top of this new remote.
|
|
1286
1352
|
*/
|
|
1287
|
-
|
|
1353
|
+
unverifiedRevisions?: { [TTransactionId in string]?: UnverifiedDocumentRevision; };
|
|
1288
1354
|
/**
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
*
|
|
1294
|
-
* - On every relevant state change
|
|
1295
|
-
* - Errors if selector throws
|
|
1355
|
+
* transaction IDs recently submitted by this client for this document,
|
|
1356
|
+
* newest last. used to label `remote-patches` events with the correct
|
|
1357
|
+
* `origin` even after the corresponding `unverifiedRevisions` entry has
|
|
1358
|
+
* been pruned (e.g. by a sync event that raced the listener echo). capped
|
|
1359
|
+
* to the most recent entries.
|
|
1296
1360
|
*/
|
|
1297
|
-
|
|
1361
|
+
recentOwnTransactionIds?: string[];
|
|
1298
1362
|
}
|
|
1299
1363
|
/**
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
1302
|
-
* @remarks
|
|
1303
|
-
* Provides access to both the current state value and the Sanity instance,
|
|
1304
|
-
* allowing selectors to use configuration values when computing derived state.
|
|
1305
|
-
* The context is memoized for each state object and instance combination
|
|
1306
|
-
* to optimize performance and prevent unnecessary recalculations.
|
|
1307
|
-
*
|
|
1308
|
-
* @example
|
|
1309
|
-
* ```ts
|
|
1310
|
-
* // Using both state and instance in a selector (psuedo example)
|
|
1311
|
-
* const getUserByProjectId = createStateSourceAction(
|
|
1312
|
-
* ({ state, instance }: SelectorContext<UsersState>, options?: ResourceHandle) => {
|
|
1313
|
-
* const allUsers = state.users
|
|
1314
|
-
* const projectId = options?.projectId ?? instance.config.defaultResource?.projectId
|
|
1315
|
-
* return allUsers.filter(user => user.projectId === projectId)
|
|
1316
|
-
* }
|
|
1317
|
-
* )
|
|
1318
|
-
* ```
|
|
1364
|
+
* @beta
|
|
1365
|
+
* Options for specifying a document and optionally a path within it.
|
|
1319
1366
|
*/
|
|
1320
|
-
interface
|
|
1321
|
-
|
|
1322
|
-
* The current state object from the store
|
|
1323
|
-
*/
|
|
1324
|
-
state: TState;
|
|
1325
|
-
/**
|
|
1326
|
-
* The Sanity instance associated with this state
|
|
1327
|
-
*/
|
|
1328
|
-
instance: SanityInstance;
|
|
1367
|
+
interface DocumentOptions<TPath extends string | undefined = undefined, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1368
|
+
path?: TPath;
|
|
1329
1369
|
}
|
|
1330
|
-
/**
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1370
|
+
/** @beta */
|
|
1371
|
+
declare function getDocumentState<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: DocumentOptions<undefined, TDocumentType, TDataset, TProjectId>): StateSource<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`> | undefined | null>;
|
|
1372
|
+
/** @beta */
|
|
1373
|
+
declare function getDocumentState<TPath extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: DocumentOptions<TPath, TDocumentType, TDataset, TProjectId>): StateSource<JsonMatch<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined>;
|
|
1374
|
+
/** @beta */
|
|
1375
|
+
declare function getDocumentState<TData>(instance: SanityInstance, options: DocumentOptions<string | undefined>): StateSource<TData | undefined | null>;
|
|
1376
|
+
/** @beta */
|
|
1377
|
+
declare function resolveDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, docHandle: DocumentHandle<TDocumentType, TDataset, TProjectId>): Promise<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`> | null>;
|
|
1378
|
+
/** @beta */
|
|
1379
|
+
declare function resolveDocument<TData extends SanityDocument$3>(instance: SanityInstance, docHandle: DocumentHandle<string, string, string>): Promise<TData | null>;
|
|
1380
|
+
/** @beta */
|
|
1381
|
+
declare const getDocumentSyncStatus: BoundStoreAction<DocumentStoreState, [doc: DocumentHandle<string, string, string>], StateSource<boolean | undefined>>;
|
|
1382
|
+
type PermissionsStateOptions = {
|
|
1383
|
+
resource?: DocumentResource;
|
|
1384
|
+
actions: DocumentAction[];
|
|
1385
|
+
};
|
|
1386
|
+
/** @beta */
|
|
1387
|
+
declare const getPermissionsState: BoundStoreAction<DocumentStoreState, [PermissionsStateOptions], StateSource<DocumentPermissionsResult>>;
|
|
1388
|
+
/** @beta */
|
|
1389
|
+
declare const resolvePermissions: BoundStoreAction<DocumentStoreState, [options: PermissionsStateOptions], Promise<DocumentPermissionsResult>>;
|
|
1390
|
+
/** @beta */
|
|
1391
|
+
declare const subscribeDocumentEvents: BoundStoreAction<DocumentStoreState, [options: {
|
|
1392
|
+
resource?: DocumentResource;
|
|
1393
|
+
eventHandler: (e: DocumentEvent) => void;
|
|
1394
|
+
}], () => void>;
|
|
1335
1395
|
type ActionMap = {
|
|
1336
1396
|
create: 'sanity.action.document.version.create';
|
|
1337
|
-
createLiveEdit: 'sanity.action.document.create';
|
|
1338
1397
|
discard: 'sanity.action.document.version.discard';
|
|
1339
1398
|
unpublish: 'sanity.action.document.unpublish';
|
|
1340
1399
|
delete: 'sanity.action.document.delete';
|
|
1341
1400
|
edit: 'sanity.action.document.edit';
|
|
1342
1401
|
publish: 'sanity.action.document.publish';
|
|
1402
|
+
releaseCreate: 'sanity.action.release.create';
|
|
1403
|
+
releaseEdit: 'sanity.action.release.edit';
|
|
1404
|
+
releasePublish: 'sanity.action.release.publish';
|
|
1405
|
+
releaseSchedule: 'sanity.action.release.schedule';
|
|
1406
|
+
releaseUnschedule: 'sanity.action.release.unschedule';
|
|
1407
|
+
releaseArchive: 'sanity.action.release.archive';
|
|
1408
|
+
releaseUnarchive: 'sanity.action.release.unarchive';
|
|
1409
|
+
releaseDelete: 'sanity.action.release.delete';
|
|
1343
1410
|
};
|
|
1344
1411
|
type OptimisticLock = {
|
|
1345
1412
|
ifDraftRevisionId?: string;
|
|
1346
1413
|
ifPublishedRevisionId?: string;
|
|
1347
1414
|
};
|
|
1415
|
+
interface ReleaseMetadataPayload {
|
|
1416
|
+
title?: string;
|
|
1417
|
+
description?: string;
|
|
1418
|
+
intendedPublishAt?: string;
|
|
1419
|
+
releaseType?: 'asap' | 'scheduled' | 'undecided';
|
|
1420
|
+
cardinality?: 'one' | 'many';
|
|
1421
|
+
}
|
|
1348
1422
|
type HttpAction = {
|
|
1349
1423
|
actionType: ActionMap['create'];
|
|
1350
1424
|
publishedId: string;
|
|
1351
1425
|
attributes: SanityDocumentLike;
|
|
1352
|
-
} | {
|
|
1353
|
-
actionType: ActionMap['createLiveEdit'];
|
|
1354
|
-
publishedId: string;
|
|
1355
|
-
attributes: SanityDocumentLike;
|
|
1356
1426
|
} | {
|
|
1357
1427
|
actionType: ActionMap['discard'];
|
|
1358
1428
|
versionId: string;
|
|
@@ -1374,7 +1444,34 @@ type HttpAction = {
|
|
|
1374
1444
|
actionType: ActionMap['publish'];
|
|
1375
1445
|
draftId: string;
|
|
1376
1446
|
publishedId: string;
|
|
1377
|
-
} & OptimisticLock)
|
|
1447
|
+
} & OptimisticLock) | {
|
|
1448
|
+
actionType: ActionMap['releaseCreate'];
|
|
1449
|
+
releaseId: string;
|
|
1450
|
+
metadata?: ReleaseMetadataPayload;
|
|
1451
|
+
} | {
|
|
1452
|
+
actionType: ActionMap['releaseEdit'];
|
|
1453
|
+
releaseId: string;
|
|
1454
|
+
patch: PatchOperations;
|
|
1455
|
+
} | {
|
|
1456
|
+
actionType: ActionMap['releasePublish'];
|
|
1457
|
+
releaseId: string;
|
|
1458
|
+
} | {
|
|
1459
|
+
actionType: ActionMap['releaseSchedule'];
|
|
1460
|
+
releaseId: string;
|
|
1461
|
+
publishAt: string;
|
|
1462
|
+
} | {
|
|
1463
|
+
actionType: ActionMap['releaseUnschedule'];
|
|
1464
|
+
releaseId: string;
|
|
1465
|
+
} | {
|
|
1466
|
+
actionType: ActionMap['releaseArchive'];
|
|
1467
|
+
releaseId: string;
|
|
1468
|
+
} | {
|
|
1469
|
+
actionType: ActionMap['releaseUnarchive'];
|
|
1470
|
+
releaseId: string;
|
|
1471
|
+
} | {
|
|
1472
|
+
actionType: ActionMap['releaseDelete'];
|
|
1473
|
+
releaseId: string;
|
|
1474
|
+
};
|
|
1378
1475
|
/**
|
|
1379
1476
|
* Represents a transaction that is queued to be applied but has not yet been
|
|
1380
1477
|
* applied. A transaction will remain in a queued state until all required
|
|
@@ -1390,7 +1487,7 @@ interface QueuedTransaction {
|
|
|
1390
1487
|
* actions don't mention draft IDs and is meant to abstract away the draft
|
|
1391
1488
|
* model from users.
|
|
1392
1489
|
*/
|
|
1393
|
-
actions:
|
|
1490
|
+
actions: Action[];
|
|
1394
1491
|
/**
|
|
1395
1492
|
* An optional flag set to disable this transaction from being batched with
|
|
1396
1493
|
* other transactions.
|
|
@@ -1429,7 +1526,7 @@ interface AppliedTransaction extends QueuedTransaction {
|
|
|
1429
1526
|
/**
|
|
1430
1527
|
* the `_rev`s from `previous` document set
|
|
1431
1528
|
*/
|
|
1432
|
-
previousRevs: { [TDocumentId in string]?: string };
|
|
1529
|
+
previousRevs: { [TDocumentId in string]?: string; };
|
|
1433
1530
|
/**
|
|
1434
1531
|
* a timestamp for when this transaction was applied locally
|
|
1435
1532
|
*/
|
|
@@ -1441,9 +1538,9 @@ interface AppliedTransaction extends QueuedTransaction {
|
|
|
1441
1538
|
*/
|
|
1442
1539
|
outgoingActions: HttpAction[];
|
|
1443
1540
|
/**
|
|
1444
|
-
* similar to `outgoingActions` but comprised of mutations instead of
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1541
|
+
* similar to `outgoingActions` but comprised of mutations instead of actions.
|
|
1542
|
+
* Useful for debugging, and is also used by liveEdit documents to send mutations,
|
|
1543
|
+
* since they can't use the Actions API which is pretty dependent on the draft model.
|
|
1447
1544
|
*/
|
|
1448
1545
|
outgoingMutations: Mutation[];
|
|
1449
1546
|
}
|
|
@@ -1463,8 +1560,10 @@ interface UnverifiedDocumentRevision {
|
|
|
1463
1560
|
previousRev: string | undefined;
|
|
1464
1561
|
timestamp: string;
|
|
1465
1562
|
}
|
|
1563
|
+
/** @beta Response body from submitting an outgoing transaction (actions or mutations API). */
|
|
1564
|
+
type DocumentTransactionSubmissionResult = Awaited<ReturnType<SanityClient['action']>> | MultipleMutationResult;
|
|
1466
1565
|
/** @beta */
|
|
1467
|
-
type DocumentEvent = ActionErrorEvent | TransactionRevertedEvent | TransactionAcceptedEvent | DocumentRebaseErrorEvent | DocumentEditedEvent | DocumentCreatedEvent | DocumentDeletedEvent | DocumentPublishedEvent | DocumentUnpublishedEvent | DocumentDiscardedEvent;
|
|
1566
|
+
type DocumentEvent = ActionErrorEvent | TransactionRevertedEvent | TransactionAcceptedEvent | DocumentRebaseErrorEvent | DocumentEditedEvent | DocumentCreatedEvent | DocumentDeletedEvent | DocumentPublishedEvent | DocumentUnpublishedEvent | DocumentDiscardedEvent | DocumentRemotePatchesEvent;
|
|
1468
1567
|
/**
|
|
1469
1568
|
* @beta
|
|
1470
1569
|
* Event emitted when a precondition to applying an action fails.
|
|
@@ -1484,7 +1583,7 @@ interface ActionErrorEvent {
|
|
|
1484
1583
|
interface TransactionAcceptedEvent {
|
|
1485
1584
|
type: 'accepted';
|
|
1486
1585
|
outgoing: OutgoingTransaction;
|
|
1487
|
-
result:
|
|
1586
|
+
result: DocumentTransactionSubmissionResult;
|
|
1488
1587
|
}
|
|
1489
1588
|
/**
|
|
1490
1589
|
* @beta
|
|
@@ -1561,100 +1660,78 @@ interface DocumentDiscardedEvent {
|
|
|
1561
1660
|
documentId: string;
|
|
1562
1661
|
outgoing: OutgoingTransaction;
|
|
1563
1662
|
}
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1663
|
+
/**
|
|
1664
|
+
* @beta
|
|
1665
|
+
* Event emitted when patches for a document are observed through the listener.
|
|
1666
|
+
*
|
|
1667
|
+
* Unlike the whole-document snapshots the store keeps, these are the raw patch
|
|
1668
|
+
* operations from the transaction that produced the change, preserving the
|
|
1669
|
+
* operational intent of the edit (e.g. keyed array inserts/unsets). Consumers
|
|
1670
|
+
* that maintain their own local state, like collaborative text editors, can
|
|
1671
|
+
* apply these directly instead of diffing document snapshots.
|
|
1672
|
+
*
|
|
1673
|
+
* `origin` is `'local'` when the transaction was submitted by this document
|
|
1674
|
+
* store instance (an own edit observed back through the listener) and
|
|
1675
|
+
* `'remote'` when it came from another client.
|
|
1676
|
+
*/
|
|
1677
|
+
interface DocumentRemotePatchesEvent {
|
|
1678
|
+
type: 'remote-patches';
|
|
1679
|
+
/** The ID of the document version the patches apply to (e.g. a draft ID). */
|
|
1680
|
+
documentId: string;
|
|
1681
|
+
/** The transaction ID that carried these patches. */
|
|
1682
|
+
transactionId: string;
|
|
1683
|
+
/** The revision the document was at before this transaction. */
|
|
1684
|
+
previousRev?: string;
|
|
1685
|
+
/** The timestamp of the transaction. */
|
|
1686
|
+
timestamp: string;
|
|
1687
|
+
/** The patch operations, rooted at the document. */
|
|
1688
|
+
patches: PatchOperations[];
|
|
1689
|
+
/** Whether the transaction originated from this client or another one. */
|
|
1690
|
+
origin: 'local' | 'remote';
|
|
1570
1691
|
}
|
|
1571
1692
|
/** @beta */
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
dispose: () => void;
|
|
1584
|
-
}
|
|
1585
|
-
interface DocumentStoreState {
|
|
1586
|
-
documentStates: { [TDocumentId in string]?: DocumentState };
|
|
1587
|
-
queued: QueuedTransaction[];
|
|
1588
|
-
applied: AppliedTransaction[];
|
|
1589
|
-
outgoing?: OutgoingTransaction;
|
|
1590
|
-
grants?: Record<Grant, ExprNode>;
|
|
1591
|
-
error?: unknown;
|
|
1592
|
-
sharedListener: SharedListener;
|
|
1593
|
-
fetchDocument: (documentId: string) => Observable<SanityDocument$2 | null>;
|
|
1594
|
-
events: Subject<DocumentEvent>;
|
|
1693
|
+
interface ActionsResult<TDocument extends SanityDocument$3 = SanityDocument$3> {
|
|
1694
|
+
transactionId: string;
|
|
1695
|
+
documents: DocumentSet<TDocument>;
|
|
1696
|
+
previous: DocumentSet<TDocument>;
|
|
1697
|
+
previousRevs: {
|
|
1698
|
+
[documentId: string]: string | undefined;
|
|
1699
|
+
};
|
|
1700
|
+
appeared: string[];
|
|
1701
|
+
updated: string[];
|
|
1702
|
+
disappeared: string[];
|
|
1703
|
+
submitted: () => Promise<DocumentTransactionSubmissionResult>;
|
|
1595
1704
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
/**
|
|
1599
|
-
* the "remote" local copy that matches the server. represents the last known
|
|
1600
|
-
* server state. this gets updated every time we confirm remote patches
|
|
1601
|
-
*/
|
|
1602
|
-
remote?: SanityDocument$2 | null;
|
|
1705
|
+
/** @beta */
|
|
1706
|
+
interface ApplyDocumentActionsOptions {
|
|
1603
1707
|
/**
|
|
1604
|
-
*
|
|
1605
|
-
*
|
|
1708
|
+
* List of actions to apply. Accepts both document actions and release
|
|
1709
|
+
* lifecycle actions because they share the same transaction pipeline.
|
|
1606
1710
|
*/
|
|
1607
|
-
|
|
1711
|
+
actions: Action[];
|
|
1608
1712
|
/**
|
|
1609
|
-
*
|
|
1713
|
+
* The resource to which the documents being acted on belong.
|
|
1610
1714
|
*/
|
|
1611
|
-
|
|
1612
|
-
/**
|
|
1613
|
-
*
|
|
1614
|
-
* no subscribers.
|
|
1715
|
+
resource?: DocumentResource;
|
|
1716
|
+
/**
|
|
1717
|
+
* Optionally provide an ID to be used as this transaction ID
|
|
1615
1718
|
*/
|
|
1616
|
-
|
|
1719
|
+
transactionId?: string;
|
|
1617
1720
|
/**
|
|
1618
|
-
*
|
|
1619
|
-
* yet been verified yet. When an applied transaction is transitioned to an
|
|
1620
|
-
* outgoing transaction, it also adds unverified revisions for each document
|
|
1621
|
-
* that is part of that outgoing transaction. Transactions are submitted to
|
|
1622
|
-
* the server with a locally generated transaction ID. This way we can observe
|
|
1623
|
-
* when our transaction comes back through the shared listener. Each listener
|
|
1624
|
-
* event that comes back contains a `previousRev`. If we see our own
|
|
1625
|
-
* transaction with a different `previousRev` than expected, we can rebase our
|
|
1626
|
-
* local transactions on top of this new remote.
|
|
1721
|
+
* Set this to true to prevent this action from being batched with others.
|
|
1627
1722
|
*/
|
|
1628
|
-
|
|
1723
|
+
disableBatching?: boolean;
|
|
1629
1724
|
}
|
|
1725
|
+
/** @beta */
|
|
1726
|
+
declare function applyDocumentActions<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ApplyDocumentActionsOptions): Promise<ActionsResult<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
1727
|
+
/** @beta */
|
|
1728
|
+
declare function applyDocumentActions(instance: SanityInstance, options: ApplyDocumentActionsOptions): Promise<ActionsResult>;
|
|
1630
1729
|
/**
|
|
1730
|
+
* Returns the full release document ID for the given release name.
|
|
1731
|
+
* e.g. `getReleaseDocumentId('my-release') === '_.releases.my-release'`
|
|
1631
1732
|
* @beta
|
|
1632
|
-
* Options for specifying a document and optionally a path within it.
|
|
1633
1733
|
*/
|
|
1634
|
-
|
|
1635
|
-
path?: TPath;
|
|
1636
|
-
}
|
|
1637
|
-
/** @beta */
|
|
1638
|
-
declare function getDocumentState<TData>(instance: SanityInstance, options: DocumentOptions<string | undefined>): StateSource<TData | undefined | null>;
|
|
1639
|
-
/** @beta */
|
|
1640
|
-
declare function resolveDocument<TData extends SanityDocument$2>(instance: SanityInstance, docHandle: DocumentHandle): Promise<TData | null>;
|
|
1641
|
-
/** @beta */
|
|
1642
|
-
declare function resolveDocument(instance: SanityInstance, docHandle: DocumentHandle): Promise<SanityDocument$2 | null>;
|
|
1643
|
-
/** @beta */
|
|
1644
|
-
declare const getDocumentSyncStatus: BoundStoreAction<DocumentStoreState, [doc: DocumentHandle<string, string, string>], StateSource<boolean | undefined>>;
|
|
1645
|
-
type PermissionsStateOptions = {
|
|
1646
|
-
resource: DocumentResource;
|
|
1647
|
-
actions: DocumentAction[];
|
|
1648
|
-
};
|
|
1649
|
-
/** @beta */
|
|
1650
|
-
declare const getPermissionsState: BoundStoreAction<DocumentStoreState, [PermissionsStateOptions], StateSource<DocumentPermissionsResult>>;
|
|
1651
|
-
/** @beta */
|
|
1652
|
-
declare const resolvePermissions: BoundStoreAction<DocumentStoreState, [options: PermissionsStateOptions], Promise<DocumentPermissionsResult>>;
|
|
1653
|
-
/** @beta */
|
|
1654
|
-
declare const subscribeDocumentEvents: BoundStoreAction<DocumentStoreState, [options: {
|
|
1655
|
-
resource: DocumentResource;
|
|
1656
|
-
eventHandler: (e: DocumentEvent) => void;
|
|
1657
|
-
}], () => void>;
|
|
1734
|
+
declare function getReleaseDocumentId(releaseId: string): string;
|
|
1658
1735
|
/**
|
|
1659
1736
|
* @public
|
|
1660
1737
|
*/
|
|
@@ -1676,7 +1753,7 @@ interface FavoriteDocumentContext extends DocumentHandle {
|
|
|
1676
1753
|
* @returns A StateSource emitting `{ isFavorited: boolean }`.
|
|
1677
1754
|
* @public
|
|
1678
1755
|
*/
|
|
1679
|
-
declare const getFavoritesState: BoundStoreAction<FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], StateSource<FavoriteStatusResponse | undefined>>;
|
|
1756
|
+
declare const getFavoritesState: BoundStoreAction<import("../_exports").FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], import("../_exports").StateSource<FavoriteStatusResponse | undefined>>;
|
|
1680
1757
|
/**
|
|
1681
1758
|
* Resolves the favorite status for a document.
|
|
1682
1759
|
* @param instance - The Sanity instance.
|
|
@@ -1684,100 +1761,238 @@ declare const getFavoritesState: BoundStoreAction<FetcherStoreState<[FavoriteDoc
|
|
|
1684
1761
|
* @returns A Promise resolving to `{ isFavorited: boolean }`.
|
|
1685
1762
|
* @public
|
|
1686
1763
|
*/
|
|
1687
|
-
declare const resolveFavoritesState: BoundStoreAction<FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], Promise<FavoriteStatusResponse>>;
|
|
1764
|
+
declare const resolveFavoritesState: BoundStoreAction<import("../_exports").FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], Promise<FavoriteStatusResponse>>;
|
|
1688
1765
|
/**
|
|
1766
|
+
* Related data the Installations API can embed in a response. Each token adds
|
|
1767
|
+
* a top-level field to the {@link Installation} item.
|
|
1768
|
+
*
|
|
1769
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1689
1770
|
* @public
|
|
1690
1771
|
*/
|
|
1691
|
-
|
|
1692
|
-
sanityUserId: string;
|
|
1693
|
-
profile: UserProfile;
|
|
1694
|
-
memberships: Membership[];
|
|
1695
|
-
}
|
|
1772
|
+
type InstallationInclude = 'activeConfig' | 'access' | 'interfaces';
|
|
1696
1773
|
/**
|
|
1774
|
+
* A resource an installation accesses, embedded when `access` is included.
|
|
1775
|
+
*
|
|
1776
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1697
1777
|
* @public
|
|
1698
1778
|
*/
|
|
1699
|
-
interface
|
|
1700
|
-
|
|
1701
|
-
resourceType:
|
|
1779
|
+
interface InstallationAccess {
|
|
1780
|
+
id: string;
|
|
1781
|
+
resourceType: 'datasets' | 'canvases' | 'dashboards' | 'media-libraries';
|
|
1702
1782
|
resourceId: string;
|
|
1703
|
-
roleNames: Array<string>;
|
|
1704
|
-
lastSeenAt?: string | null;
|
|
1705
1783
|
}
|
|
1706
1784
|
/**
|
|
1785
|
+
* An interface exposed by an installation, embedded when `interfaces` is
|
|
1786
|
+
* included.
|
|
1787
|
+
*
|
|
1788
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1707
1789
|
* @public
|
|
1708
1790
|
*/
|
|
1709
|
-
interface
|
|
1791
|
+
interface InstallationInterface {
|
|
1710
1792
|
id: string;
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1793
|
+
type: 'app' | 'worker' | 'asset_source' | 'panel';
|
|
1794
|
+
name: string;
|
|
1795
|
+
title: string;
|
|
1796
|
+
version: string;
|
|
1797
|
+
/** Module federation module ID; resolved from the host mf-manifest at runtime */
|
|
1798
|
+
moduleId: string;
|
|
1799
|
+
metadata: {
|
|
1800
|
+
group?: string;
|
|
1801
|
+
priority?: number;
|
|
1802
|
+
} | null;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* The active config of an installation, embedded when `activeConfig` is
|
|
1806
|
+
* included. `null` when nothing is deployed.
|
|
1807
|
+
*
|
|
1808
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1809
|
+
* @public
|
|
1810
|
+
*/
|
|
1811
|
+
interface InstallationActiveConfig {
|
|
1812
|
+
id: string;
|
|
1813
|
+
installationId: string;
|
|
1814
|
+
deployedBy: string | null;
|
|
1815
|
+
version: string;
|
|
1816
|
+
isActive: boolean;
|
|
1719
1817
|
createdAt: string;
|
|
1720
|
-
updatedAt?: string;
|
|
1721
|
-
isCurrentUser?: boolean;
|
|
1722
|
-
providerId?: string;
|
|
1723
1818
|
}
|
|
1724
1819
|
/**
|
|
1820
|
+
* The always-present fields of an active singleton installation returned by the
|
|
1821
|
+
* Installations API (`/installations`), before any {@link InstallationInclude}.
|
|
1822
|
+
*
|
|
1823
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1725
1824
|
* @public
|
|
1726
1825
|
*/
|
|
1727
|
-
interface
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1826
|
+
interface InstallationBase {
|
|
1827
|
+
id: string;
|
|
1828
|
+
applicationId: string;
|
|
1829
|
+
organizationId: string;
|
|
1830
|
+
installedBy: string | null;
|
|
1831
|
+
createdAt: string;
|
|
1832
|
+
updatedAt: string;
|
|
1833
|
+
application: {
|
|
1834
|
+
title: string;
|
|
1835
|
+
slug: string | null;
|
|
1836
|
+
};
|
|
1733
1837
|
}
|
|
1734
1838
|
/**
|
|
1839
|
+
* An active singleton installation as returned by the Installations API
|
|
1840
|
+
* (`/installations`). `activeConfig`, `access` and `interfaces` are top-level
|
|
1841
|
+
* fields, each present only when the matching {@link InstallationInclude} token
|
|
1842
|
+
* was requested.
|
|
1843
|
+
*
|
|
1844
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1735
1845
|
* @public
|
|
1736
1846
|
*/
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1847
|
+
type Installation<Include extends InstallationInclude = never> = InstallationBase & Included<InstallationInclude, 'activeConfig', Include, {
|
|
1848
|
+
activeConfig: InstallationActiveConfig | null;
|
|
1849
|
+
}> & Included<InstallationInclude, 'access', Include, {
|
|
1850
|
+
access: InstallationAccess[];
|
|
1851
|
+
}> & Included<InstallationInclude, 'interfaces', Include, {
|
|
1852
|
+
interfaces: InstallationInterface[];
|
|
1853
|
+
}>;
|
|
1854
|
+
/**
|
|
1855
|
+
* Options for listing an organization's installations.
|
|
1856
|
+
*
|
|
1857
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1858
|
+
* @public
|
|
1859
|
+
*/
|
|
1860
|
+
interface InstallationsOptions<Include extends InstallationInclude = InstallationInclude> {
|
|
1861
|
+
organizationId: string;
|
|
1862
|
+
include?: Include[];
|
|
1863
|
+
/** Page size (1-100, default 50), or `'none'` to disable pagination */
|
|
1864
|
+
limit?: number | 'none';
|
|
1865
|
+
/** Cursor from a previous response's `nextCursor` */
|
|
1866
|
+
cursor?: string;
|
|
1744
1867
|
}
|
|
1745
1868
|
/**
|
|
1869
|
+
* The cursor-paginated envelope returned by `GET /installations`.
|
|
1870
|
+
*
|
|
1871
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1746
1872
|
* @public
|
|
1747
1873
|
*/
|
|
1748
|
-
interface
|
|
1749
|
-
data: SanityUser[];
|
|
1750
|
-
totalCount: number;
|
|
1874
|
+
interface InstallationsResponse<Include extends InstallationInclude = never> {
|
|
1751
1875
|
nextCursor: string | null;
|
|
1876
|
+
data: Installation<Include>[];
|
|
1752
1877
|
}
|
|
1753
1878
|
/**
|
|
1754
|
-
*
|
|
1879
|
+
* Fetcher for an organization's installations (`GET /installations`), on the
|
|
1880
|
+
* shared fetcher cache.
|
|
1881
|
+
*
|
|
1882
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1883
|
+
* @internal
|
|
1755
1884
|
*/
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1885
|
+
declare const installations: Fetcher<[options: InstallationsOptions<InstallationInclude>], InstallationsResponse<InstallationInclude>>;
|
|
1886
|
+
/**
|
|
1887
|
+
* Fetcher for a single installation (`GET /installations/:id`), on the shared
|
|
1888
|
+
* fetcher cache. No pre-seeding from {@link installations}: its list keys
|
|
1889
|
+
* include the organization, which this fetcher's params can't reconstruct.
|
|
1890
|
+
*
|
|
1891
|
+
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1892
|
+
* @internal
|
|
1893
|
+
*/
|
|
1894
|
+
declare const installation: Fetcher<[installationId: string, options?: {
|
|
1895
|
+
include?: InstallationInclude[];
|
|
1896
|
+
} | undefined], Installation<InstallationInclude>>;
|
|
1897
|
+
/** @public */
|
|
1898
|
+
interface OrganizationMember {
|
|
1899
|
+
sanityUserId: string;
|
|
1900
|
+
isCurrentUser: boolean;
|
|
1901
|
+
user: {
|
|
1902
|
+
id: string;
|
|
1903
|
+
displayName: string;
|
|
1904
|
+
familyName: string;
|
|
1905
|
+
givenName: string;
|
|
1906
|
+
middleName: string | null;
|
|
1907
|
+
imageUrl: string | null;
|
|
1908
|
+
email: string;
|
|
1909
|
+
loginProvider: string;
|
|
1910
|
+
};
|
|
1911
|
+
roles: Array<{
|
|
1912
|
+
name: string;
|
|
1913
|
+
title: string;
|
|
1914
|
+
description?: string;
|
|
1915
|
+
}>;
|
|
1759
1916
|
}
|
|
1760
1917
|
/**
|
|
1918
|
+
* The base fields returned from `/organizations/<id>` for every organization.
|
|
1761
1919
|
* @public
|
|
1762
1920
|
*/
|
|
1763
|
-
interface
|
|
1764
|
-
|
|
1921
|
+
interface OrganizationBase {
|
|
1922
|
+
id: string;
|
|
1923
|
+
name: string;
|
|
1924
|
+
slug: string | null;
|
|
1925
|
+
createdAt: string;
|
|
1926
|
+
createdByUserId: string;
|
|
1927
|
+
updatedAt: string;
|
|
1928
|
+
deletedAt: string | null;
|
|
1929
|
+
dashboardStatus: 'enabled' | 'disabled';
|
|
1930
|
+
aiFeaturesStatus: 'enabled' | 'disabled';
|
|
1931
|
+
mediaLibraryStatus: 'enabled' | 'disabled';
|
|
1932
|
+
requestAccessStatus: 'allowed' | 'disabled';
|
|
1933
|
+
telemetryConsentStatus: 'allowed' | 'msa_denied' | 'customer_denied';
|
|
1934
|
+
oauthAppsStatus: 'allowed' | 'blocked';
|
|
1935
|
+
defaultRoleName: string;
|
|
1936
|
+
domains: string[] | null;
|
|
1937
|
+
}
|
|
1938
|
+
/** @public */
|
|
1939
|
+
interface OrganizationOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> {
|
|
1940
|
+
includeMembers?: IncludeMembers;
|
|
1941
|
+
includeFeatures?: IncludeFeatures;
|
|
1942
|
+
organizationId: string;
|
|
1765
1943
|
}
|
|
1766
1944
|
/**
|
|
1945
|
+
* An `Organization` with `members` and/or `features` conditionally included
|
|
1946
|
+
* based on the query options used to fetch it.
|
|
1767
1947
|
* @public
|
|
1768
1948
|
*/
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1949
|
+
type Organization<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = OrganizationBase & (boolean extends IncludeMembers ? {
|
|
1950
|
+
members?: OrganizationMember[];
|
|
1951
|
+
} : IncludeMembers extends true ? {
|
|
1952
|
+
members: OrganizationMember[];
|
|
1953
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1954
|
+
features?: string[];
|
|
1955
|
+
} : IncludeFeatures extends true ? {
|
|
1956
|
+
features: string[];
|
|
1957
|
+
} : unknown);
|
|
1958
|
+
/**
|
|
1959
|
+
* Fetcher for a single organization (`GET /organizations/:id`), on the shared
|
|
1960
|
+
* fetcher cache. No pre-seeding from the organizations list: it returns a
|
|
1961
|
+
* subset of the detail fields, and a partial seed would serve as fresh for
|
|
1962
|
+
* the whole stale window.
|
|
1963
|
+
*
|
|
1964
|
+
* @internal
|
|
1965
|
+
*/
|
|
1966
|
+
declare const organization: Fetcher<[options?: OrganizationOptions<boolean, boolean> | undefined], Organization<boolean, boolean>>;
|
|
1775
1967
|
/**
|
|
1968
|
+
* The list shape returned from `/organizations`, with `members` and/or
|
|
1969
|
+
* `features` conditionally included based on the query options used.
|
|
1776
1970
|
* @public
|
|
1777
1971
|
*/
|
|
1778
|
-
|
|
1779
|
-
|
|
1972
|
+
type Organizations<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = (Pick<OrganizationBase, 'id' | 'name' | 'slug' | 'createdAt' | 'updatedAt' | 'defaultRoleName' | 'dashboardStatus' | 'aiFeaturesStatus'> & (boolean extends IncludeMembers ? {
|
|
1973
|
+
members?: OrganizationMember[];
|
|
1974
|
+
} : IncludeMembers extends true ? {
|
|
1975
|
+
members: OrganizationMember[];
|
|
1976
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1977
|
+
features?: string[];
|
|
1978
|
+
} : IncludeFeatures extends true ? {
|
|
1979
|
+
features: string[];
|
|
1980
|
+
} : unknown))[];
|
|
1981
|
+
/** @public */
|
|
1982
|
+
interface OrganizationsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> extends Omit<OrganizationOptions<IncludeMembers, IncludeFeatures>, 'organizationId'> {
|
|
1983
|
+
/**
|
|
1984
|
+
* When `true`, includes organisations the user has access to via
|
|
1985
|
+
* project-level grants, not just direct organisation memberships.
|
|
1986
|
+
*/
|
|
1987
|
+
includeImplicitMemberships?: boolean;
|
|
1780
1988
|
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Fetcher for the current user's organizations (`GET /organizations`), on the
|
|
1991
|
+
* shared fetcher cache.
|
|
1992
|
+
*
|
|
1993
|
+
* @internal
|
|
1994
|
+
*/
|
|
1995
|
+
declare const organizations: Fetcher<[options?: OrganizationsOptions<boolean, boolean> | undefined], Organizations<boolean, boolean>>;
|
|
1781
1996
|
/** @public */
|
|
1782
1997
|
interface PresenceLocation {
|
|
1783
1998
|
type: 'document';
|
|
@@ -1814,128 +2029,110 @@ interface DisconnectEvent {
|
|
|
1814
2029
|
sessionId: string;
|
|
1815
2030
|
timestamp: string;
|
|
1816
2031
|
}
|
|
1817
|
-
type PresenceStoreState = {
|
|
1818
|
-
locations: Map<string, {
|
|
1819
|
-
userId: string;
|
|
1820
|
-
locations: PresenceLocation[];
|
|
1821
|
-
}>;
|
|
1822
|
-
users: Record<string, SanityUser | undefined>;
|
|
1823
|
-
};
|
|
1824
|
-
/** @public */
|
|
1825
|
-
|
|
1826
2032
|
/** @beta */
|
|
1827
|
-
declare
|
|
2033
|
+
declare function getPresence(instance: SanityInstance, params?: {
|
|
1828
2034
|
resource?: DocumentResource;
|
|
1829
|
-
}
|
|
2035
|
+
}): StateSource<UserPresence[]>;
|
|
1830
2036
|
/**
|
|
1831
|
-
*
|
|
1832
|
-
*
|
|
1833
|
-
*
|
|
1834
|
-
* @internal
|
|
2037
|
+
* @beta
|
|
2038
|
+
* @deprecated This type is deprecated and will be removed in a future release.
|
|
1835
2039
|
*/
|
|
1836
|
-
|
|
2040
|
+
type GetPreviewStateOptions = DocumentHandle;
|
|
1837
2041
|
/**
|
|
1838
|
-
* @
|
|
1839
|
-
*
|
|
2042
|
+
* @beta
|
|
2043
|
+
* @deprecated This function is deprecated and will be removed in a future release.
|
|
1840
2044
|
*/
|
|
1841
|
-
|
|
1842
|
-
data: TValue | null;
|
|
1843
|
-
isPending: boolean;
|
|
1844
|
-
}
|
|
1845
|
-
interface DocumentStatus {
|
|
1846
|
-
lastEditedDraftAt?: string;
|
|
1847
|
-
lastEditedPublishedAt?: string;
|
|
1848
|
-
lastEditedVersionAt?: string;
|
|
1849
|
-
}
|
|
2045
|
+
declare function getPreviewState<TResult extends object>(instance: SanityInstance, options: GetPreviewStateOptions): StateSource<ValuePending<TResult>>;
|
|
1850
2046
|
/**
|
|
1851
|
-
*
|
|
1852
|
-
* @
|
|
2047
|
+
* @beta
|
|
2048
|
+
* @deprecated This function is deprecated and will be removed in a future release.
|
|
1853
2049
|
*/
|
|
1854
|
-
|
|
1855
|
-
_id: string;
|
|
1856
|
-
_type: string;
|
|
1857
|
-
_updatedAt: string;
|
|
1858
|
-
titleCandidates: Record<string, unknown>;
|
|
1859
|
-
subtitleCandidates: Record<string, unknown>;
|
|
1860
|
-
media?: PreviewMedia | null;
|
|
1861
|
-
_status?: DocumentStatus;
|
|
1862
|
-
}
|
|
2050
|
+
declare function getPreviewState(instance: SanityInstance, options: GetPreviewStateOptions): StateSource<ValuePending<PreviewValue>>;
|
|
1863
2051
|
/**
|
|
1864
|
-
*
|
|
1865
|
-
*
|
|
1866
|
-
|
|
2052
|
+
* @beta
|
|
2053
|
+
* @deprecated This type is deprecated and will be removed in a future release.
|
|
2054
|
+
*/
|
|
2055
|
+
type ResolvePreviewOptions = DocumentHandle;
|
|
2056
|
+
/**
|
|
2057
|
+
* @beta
|
|
2058
|
+
* @deprecated This function is deprecated and will be removed in a future release.
|
|
1867
2059
|
*/
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2060
|
+
declare function resolvePreview(instance: SanityInstance, options: ResolvePreviewOptions): Promise<ValuePending<PreviewValue>>;
|
|
2061
|
+
/** @public */
|
|
2062
|
+
interface ProjectMemberRole {
|
|
2063
|
+
name: string;
|
|
2064
|
+
title: string;
|
|
2065
|
+
description: string;
|
|
2066
|
+
}
|
|
2067
|
+
/** @public */
|
|
2068
|
+
interface ProjectMember {
|
|
2069
|
+
id: string;
|
|
2070
|
+
createdAt: string;
|
|
2071
|
+
updatedAt: string;
|
|
2072
|
+
isCurrentUser: boolean;
|
|
2073
|
+
isRobot: boolean;
|
|
2074
|
+
roles: ProjectMemberRole[];
|
|
2075
|
+
}
|
|
2076
|
+
/** @public */
|
|
2077
|
+
interface ProjectMetadata {
|
|
2078
|
+
color?: string;
|
|
2079
|
+
externalStudioHost?: string;
|
|
2080
|
+
initialTemplate?: string;
|
|
2081
|
+
cliInitializedAt?: string;
|
|
2082
|
+
integration: 'manage' | 'cli';
|
|
1872
2083
|
}
|
|
1873
2084
|
/**
|
|
1874
|
-
*
|
|
1875
|
-
* This includes a primary title, a secondary subtitle, an optional piece of media associated
|
|
1876
|
-
* with the document, and the document's status.
|
|
1877
|
-
*
|
|
2085
|
+
* The base fields returned from `/projects` for every project.
|
|
1878
2086
|
* @public
|
|
1879
2087
|
*/
|
|
1880
|
-
interface
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
*/
|
|
1893
|
-
media?: PreviewMedia | null;
|
|
1894
|
-
/**
|
|
1895
|
-
* The status of the document.
|
|
1896
|
-
*/
|
|
1897
|
-
_status?: {
|
|
1898
|
-
/** The date of the last published edit */
|
|
1899
|
-
lastEditedPublishedAt?: string;
|
|
1900
|
-
/** The date of the last draft edit */
|
|
1901
|
-
lastEditedDraftAt?: string;
|
|
1902
|
-
};
|
|
2088
|
+
interface ProjectBase {
|
|
2089
|
+
id: string;
|
|
2090
|
+
displayName: string;
|
|
2091
|
+
studioHost: string | null;
|
|
2092
|
+
organizationId: string;
|
|
2093
|
+
metadata: ProjectMetadata;
|
|
2094
|
+
isBlocked: boolean;
|
|
2095
|
+
isDisabled: boolean;
|
|
2096
|
+
isDisabledByUser: boolean;
|
|
2097
|
+
activityFeedEnabled: boolean;
|
|
2098
|
+
createdAt: string;
|
|
2099
|
+
updatedAt: string;
|
|
1903
2100
|
}
|
|
1904
2101
|
/**
|
|
1905
|
-
*
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
1908
|
-
* The tuple contains a preview value or null, and a boolean indicating if the data is
|
|
1909
|
-
* pending. A `true` value means a fetch is ongoing; `false` indicates that the
|
|
1910
|
-
* currently provided preview value is up-to-date.
|
|
1911
|
-
*
|
|
2102
|
+
* A `Project` with `members` and/or `features` conditionally included
|
|
2103
|
+
* based on the query options used to fetch it.
|
|
1912
2104
|
* @public
|
|
1913
2105
|
*/
|
|
1914
|
-
type
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
2106
|
+
type Project<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> = ProjectBase & (boolean extends IncludeMembers ? {
|
|
2107
|
+
members?: ProjectMember[];
|
|
2108
|
+
} : IncludeMembers extends true ? {
|
|
2109
|
+
members: ProjectMember[];
|
|
2110
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
2111
|
+
features?: string[];
|
|
2112
|
+
} : IncludeFeatures extends true ? {
|
|
2113
|
+
features: string[];
|
|
2114
|
+
} : unknown);
|
|
2115
|
+
/** @public */
|
|
2116
|
+
interface ProjectOptions<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> extends ProjectHandle {
|
|
2117
|
+
includeMembers?: IncludeMembers;
|
|
2118
|
+
includeFeatures?: IncludeFeatures;
|
|
2119
|
+
}
|
|
1918
2120
|
/**
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
2121
|
+
* Fetcher for a single project (`GET /projects/:id`), on the shared fetcher
|
|
2122
|
+
* cache. Pre-seeds from the default {@link projects} list entry when it can
|
|
2123
|
+
* satisfy the read — the default list carries features but not members, so
|
|
2124
|
+
* only `includeMembers: false` reads seed.
|
|
1921
2125
|
*
|
|
1922
|
-
* @param projectionResult - The raw projection result from GROQ
|
|
1923
|
-
* @param instance - The Sanity instance to use for client configuration
|
|
1924
|
-
* @param resource - Data resource for the preview
|
|
1925
2126
|
* @internal
|
|
1926
2127
|
*/
|
|
1927
|
-
declare
|
|
1928
|
-
/** @public */
|
|
1929
|
-
type ProjectHandle = {
|
|
1930
|
-
projectId: string;
|
|
1931
|
-
};
|
|
1932
|
-
/** @public */
|
|
1933
|
-
declare const getProjectState: BoundStoreAction<FetcherStoreState<[options: ProjectHandle], _sanity_client12.SanityProject>, [options: ProjectHandle], StateSource<_sanity_client12.SanityProject | undefined>>;
|
|
1934
|
-
/** @public */
|
|
1935
|
-
declare const resolveProject: BoundStoreAction<FetcherStoreState<[options: ProjectHandle], _sanity_client12.SanityProject>, [options: ProjectHandle], Promise<_sanity_client12.SanityProject>>;
|
|
2128
|
+
declare const project: Fetcher<[options?: ProjectOptions<boolean, boolean> | undefined], Project<boolean, boolean>>;
|
|
1936
2129
|
interface ProjectionOptions<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1937
2130
|
projection: TProjection;
|
|
1938
2131
|
}
|
|
2132
|
+
/**
|
|
2133
|
+
* @beta
|
|
2134
|
+
*/
|
|
2135
|
+
declare function getProjectionState<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): StateSource<ProjectionValuePending<SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>> | undefined>;
|
|
1939
2136
|
/**
|
|
1940
2137
|
* @beta
|
|
1941
2138
|
*/
|
|
@@ -1945,103 +2142,53 @@ declare function getProjectionState<TData extends object>(instance: SanityInstan
|
|
|
1945
2142
|
*/
|
|
1946
2143
|
declare function getProjectionState(instance: SanityInstance, options: ProjectionOptions): StateSource<ProjectionValuePending<Record<string, unknown>> | undefined>;
|
|
1947
2144
|
/** @beta */
|
|
2145
|
+
declare function resolveProjection<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): Promise<ProjectionValuePending<SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
2146
|
+
/** @beta */
|
|
1948
2147
|
declare function resolveProjection<TData extends object>(instance: SanityInstance, options: ProjectionOptions): Promise<ProjectionValuePending<TData>>;
|
|
1949
2148
|
/** @public */
|
|
1950
|
-
|
|
1951
|
-
organizationId?: string;
|
|
1952
|
-
includeMembers?: boolean;
|
|
1953
|
-
} | undefined], Omit<_sanity_client12.SanityProject, "members">[]>, [options?: {
|
|
1954
|
-
organizationId?: string;
|
|
1955
|
-
includeMembers?: boolean;
|
|
1956
|
-
} | undefined], StateSource<Omit<_sanity_client12.SanityProject, "members">[] | undefined>>;
|
|
1957
|
-
/** @public */
|
|
1958
|
-
declare const resolveProjects: BoundStoreAction<FetcherStoreState<[options?: {
|
|
2149
|
+
interface ProjectsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true> {
|
|
1959
2150
|
organizationId?: string;
|
|
1960
|
-
includeMembers?:
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
includeMembers?: boolean;
|
|
1964
|
-
} | undefined], Promise<Omit<_sanity_client12.SanityProject, "members">[]>>;
|
|
1965
|
-
/**
|
|
1966
|
-
* @beta
|
|
1967
|
-
*/
|
|
1968
|
-
interface QueryOptions<TQuery extends string = string, TDataset extends string = string, TProjectId extends string = string> extends Pick<ResponseQueryOptions, 'useCdn' | 'cache' | 'next' | 'cacheMode' | 'tag'>, ResourceHandle<TDataset, TProjectId> {
|
|
1969
|
-
query: TQuery;
|
|
1970
|
-
params?: Record<string, unknown>;
|
|
1971
|
-
}
|
|
1972
|
-
/**
|
|
1973
|
-
* @beta
|
|
1974
|
-
*/
|
|
1975
|
-
interface ResolveQueryOptions<TQuery extends string = string, TDataset extends string = string, TProjectId extends string = string> extends QueryOptions<TQuery, TDataset, TProjectId> {
|
|
1976
|
-
signal?: AbortSignal;
|
|
2151
|
+
includeMembers?: IncludeMembers;
|
|
2152
|
+
includeFeatures?: IncludeFeatures;
|
|
2153
|
+
onlyExplicitMembership?: boolean;
|
|
1977
2154
|
}
|
|
1978
|
-
/** @beta */
|
|
1979
|
-
declare const getQueryKey: (options: QueryOptions) => string;
|
|
1980
|
-
/** @beta */
|
|
1981
|
-
declare const parseQueryKey: (key: string) => QueryOptions;
|
|
1982
2155
|
/**
|
|
1983
|
-
*
|
|
2156
|
+
* Fetcher for the current user's projects (`GET /projects`), on the shared
|
|
2157
|
+
* fetcher cache.
|
|
1984
2158
|
*
|
|
1985
|
-
*
|
|
1986
|
-
* Subscribing to the state source will instruct the SDK to fetch the query (if not already fetched)
|
|
1987
|
-
* and will keep the query live using the Live content API (considering sync tags) to provide up-to-date results.
|
|
1988
|
-
* When the last subscriber is removed, the query state is automatically cleaned up from the store.
|
|
1989
|
-
*
|
|
1990
|
-
* Note: This functionality is for advanced users who want to build their own framework integrations.
|
|
1991
|
-
* Our SDK also provides a React integration (useQuery hook) for convenient usage.
|
|
1992
|
-
*
|
|
1993
|
-
* Note: Automatic cleanup can interfere with React Suspense because if a component suspends while being the only subscriber,
|
|
1994
|
-
* cleanup might occur unexpectedly. In such cases, consider using `resolveQuery` instead.
|
|
1995
|
-
*
|
|
1996
|
-
* @beta
|
|
2159
|
+
* @internal
|
|
1997
2160
|
*/
|
|
1998
|
-
declare
|
|
1999
|
-
/** @beta */
|
|
2000
|
-
declare function getQueryState(instance: SanityInstance, queryOptions: QueryOptions): StateSource<unknown>;
|
|
2161
|
+
declare const projects: Fetcher<[options?: ProjectsOptions<boolean, boolean> | undefined], Project<boolean, boolean>[]>;
|
|
2001
2162
|
/**
|
|
2002
|
-
*
|
|
2003
|
-
*
|
|
2004
|
-
* This function fetches the result of a GROQ query and returns a promise that resolves with the query result.
|
|
2005
|
-
* Unlike `getQueryState`, which registers subscribers to keep the query live and performs automatic cleanup,
|
|
2006
|
-
* `resolveQuery` does not track subscribers. This makes it ideal for use with React Suspense, where the returned
|
|
2007
|
-
* promise is thrown to delay rendering until the query result becomes available.
|
|
2008
|
-
* Once the promise resolves, it is expected that a real subscriber will be added via `getQueryState` to manage ongoing updates.
|
|
2009
|
-
*
|
|
2010
|
-
* Additionally, an optional AbortSignal can be provided to cancel the query and immediately clear the associated state
|
|
2011
|
-
* if there are no active subscribers.
|
|
2012
|
-
*
|
|
2163
|
+
* Lifecycle states a release document can be in. Mirrors the server's
|
|
2164
|
+
* `ReleaseState`.
|
|
2013
2165
|
* @beta
|
|
2014
2166
|
*/
|
|
2015
|
-
|
|
2016
|
-
/**
|
|
2017
|
-
* Represents a document in a Sanity dataset that represents release options.
|
|
2018
|
-
* @internal
|
|
2019
|
-
*/
|
|
2020
|
-
type ReleaseDocument = SanityDocument$2 & {
|
|
2021
|
-
name: string;
|
|
2022
|
-
publishAt?: string;
|
|
2023
|
-
state: 'active' | 'scheduled';
|
|
2024
|
-
metadata: {
|
|
2025
|
-
title: string;
|
|
2026
|
-
releaseType: 'asap' | 'scheduled' | 'undecided';
|
|
2027
|
-
intendedPublishAt?: string;
|
|
2028
|
-
description?: string;
|
|
2029
|
-
};
|
|
2030
|
-
};
|
|
2167
|
+
type ReleaseState = 'active' | 'archiving' | 'unarchiving' | 'archived' | 'published' | 'publishing' | 'scheduled' | 'scheduling';
|
|
2031
2168
|
interface ReleasesStoreState {
|
|
2032
|
-
activeReleases?: ReleaseDocument[];
|
|
2169
|
+
activeReleases?: ReleaseDocument$1[];
|
|
2170
|
+
allReleases?: ReleaseDocument$1[];
|
|
2033
2171
|
error?: unknown;
|
|
2034
2172
|
}
|
|
2035
2173
|
/**
|
|
2036
2174
|
* Get the active releases from the store.
|
|
2037
2175
|
* @internal
|
|
2038
2176
|
*/
|
|
2039
|
-
declare const getActiveReleasesState: (instance: SanityInstance, options
|
|
2040
|
-
resource
|
|
2041
|
-
}) => StateSource<ReleaseDocument[] | undefined>;
|
|
2177
|
+
declare const getActiveReleasesState: (instance: SanityInstance, options?: {
|
|
2178
|
+
resource?: DocumentResource;
|
|
2179
|
+
}) => StateSource<ReleaseDocument$1[] | undefined>;
|
|
2180
|
+
/**
|
|
2181
|
+
* Get every release in the store, including archived and published.
|
|
2182
|
+
* @internal
|
|
2183
|
+
*/
|
|
2184
|
+
declare const getAllReleasesState: (instance: SanityInstance, options?: {
|
|
2185
|
+
resource?: DocumentResource;
|
|
2186
|
+
}) => StateSource<ReleaseDocument$1[] | undefined>;
|
|
2042
2187
|
declare const _getPerspectiveStateSelector: StoreAction<ReleasesStoreState, [_?: (PerspectiveHandle & {
|
|
2188
|
+
projectId?: string;
|
|
2189
|
+
dataset?: string;
|
|
2043
2190
|
resource?: DocumentResource;
|
|
2044
|
-
}) | undefined], StateSource<string[] | "previewDrafts" | "published" | "drafts" | "raw" | undefined>, unknown>;
|
|
2191
|
+
}) | undefined], import("../_exports").StateSource<string[] | "previewDrafts" | "published" | "drafts" | "raw" | undefined>, unknown>;
|
|
2045
2192
|
type OmitFirst<T extends unknown[]> = T extends [unknown, ...infer R] ? R : never;
|
|
2046
2193
|
type SelectorParams = OmitFirst<Parameters<typeof _getPerspectiveStateSelector>>;
|
|
2047
2194
|
type BoundGetPerspectiveState = BoundStoreAction<ReleasesStoreState, SelectorParams, ReturnType<typeof _getPerspectiveStateSelector>>;
|
|
@@ -2058,22 +2205,6 @@ type BoundGetPerspectiveState = BoundStoreAction<ReleasesStoreState, SelectorPar
|
|
|
2058
2205
|
* @public
|
|
2059
2206
|
*/
|
|
2060
2207
|
declare const getPerspectiveState: BoundGetPerspectiveState;
|
|
2061
|
-
/** @internal */
|
|
2062
|
-
declare const getUsersKey: (_instance: SanityInstance, {
|
|
2063
|
-
resourceType,
|
|
2064
|
-
organizationId,
|
|
2065
|
-
batchSize,
|
|
2066
|
-
projectId,
|
|
2067
|
-
userId
|
|
2068
|
-
}?: GetUsersOptions) => string;
|
|
2069
|
-
/** @internal */
|
|
2070
|
-
declare const parseUsersKey: (key: string) => {
|
|
2071
|
-
batchSize: number;
|
|
2072
|
-
resourceType?: "organization" | "project";
|
|
2073
|
-
projectId?: string;
|
|
2074
|
-
organizationId?: string;
|
|
2075
|
-
userId?: string;
|
|
2076
|
-
};
|
|
2077
2208
|
/**
|
|
2078
2209
|
* Returns the state source for users associated with a specific resource.
|
|
2079
2210
|
*
|
|
@@ -2087,7 +2218,7 @@ declare const parseUsersKey: (key: string) => {
|
|
|
2087
2218
|
*
|
|
2088
2219
|
* @beta
|
|
2089
2220
|
*/
|
|
2090
|
-
declare const getUsersState: BoundStoreAction<UsersStoreState, [options?: GetUsersOptions | undefined], StateSource<{
|
|
2221
|
+
declare const getUsersState: BoundStoreAction<UsersStoreState, [options?: GetUsersOptions | undefined], import("../_exports").StateSource<{
|
|
2091
2222
|
data: SanityUser[];
|
|
2092
2223
|
totalCount: number;
|
|
2093
2224
|
hasMore: boolean;
|
|
@@ -2151,7 +2282,7 @@ interface StoreEntry<TParams extends unknown[], TData> {
|
|
|
2151
2282
|
* @public
|
|
2152
2283
|
*/
|
|
2153
2284
|
interface FetcherStoreState<TParams extends unknown[], TData> {
|
|
2154
|
-
stateByParams: { [TSerializedKey in string]?: StoreEntry<TParams, TData
|
|
2285
|
+
stateByParams: { [TSerializedKey in string]?: StoreEntry<TParams, TData>; };
|
|
2155
2286
|
error?: unknown;
|
|
2156
2287
|
}
|
|
2157
2288
|
/**
|
|
@@ -2163,163 +2294,34 @@ interface FetcherStore<TParams extends unknown[], TData> {
|
|
|
2163
2294
|
resolveState: BoundStoreAction<FetcherStoreState<TParams, TData>, TParams, Promise<TData>>;
|
|
2164
2295
|
}
|
|
2165
2296
|
/**
|
|
2166
|
-
* Creates a GROQ search filter string (`[@] match text::query("...")`)
|
|
2167
|
-
* from a raw search query string.
|
|
2168
|
-
*
|
|
2169
|
-
* It applies wildcard ('*') logic to the last eligible token and escapes
|
|
2170
|
-
* double quotes within the search term.
|
|
2171
|
-
*
|
|
2172
|
-
* If the input query is empty or only whitespace, it returns an empty string.
|
|
2173
|
-
*
|
|
2174
|
-
* @param query - The raw input search string.
|
|
2175
|
-
* @returns The GROQ search filter string, or an empty string.
|
|
2176
|
-
* @internal
|
|
2177
|
-
*/
|
|
2178
|
-
declare function createGroqSearchFilter(query: string): string;
|
|
2179
|
-
/**
|
|
2180
|
-
* Filter criteria for intent matching. Can be combined to create more specific intents.
|
|
2181
|
-
*
|
|
2182
|
-
* @example
|
|
2183
|
-
* ```typescript
|
|
2184
|
-
* // matches only geopoints in the travel-project project, production dataset
|
|
2185
|
-
* const filter: IntentFilter = {
|
|
2186
|
-
* projectId: 'travel-project',
|
|
2187
|
-
* dataset: 'production',
|
|
2188
|
-
* types: ['geopoint']
|
|
2189
|
-
* }
|
|
2190
|
-
*
|
|
2191
|
-
* // matches all documents in the travel-project project
|
|
2192
|
-
* const filter: IntentFilter = {
|
|
2193
|
-
* projectId: 'travel-project',
|
|
2194
|
-
* types: ['*']
|
|
2195
|
-
* }
|
|
2196
|
-
*
|
|
2197
|
-
* // matches geopoints in the travel-project production dataset and map pins in all projects in the org
|
|
2198
|
-
* const filters: IntentFilter[] = [
|
|
2199
|
-
* {
|
|
2200
|
-
* projectId: 'travel-project',
|
|
2201
|
-
* dataset: 'production',
|
|
2202
|
-
* types: ['geopoint']
|
|
2203
|
-
* },
|
|
2204
|
-
* {
|
|
2205
|
-
* types: ['map-pin']
|
|
2206
|
-
* }
|
|
2207
|
-
* ]
|
|
2208
|
-
* ```
|
|
2209
|
-
* @public
|
|
2210
|
-
*/
|
|
2211
|
-
interface IntentFilter {
|
|
2212
|
-
/**
|
|
2213
|
-
* Project ID to match against
|
|
2214
|
-
* @remarks When specified, the intent will only match for the specified project.
|
|
2215
|
-
*/
|
|
2216
|
-
projectId?: string;
|
|
2217
|
-
/**
|
|
2218
|
-
* Dataset to match against
|
|
2219
|
-
* @remarks When specified, the intent will only match for the specified dataset. Requires projectId to be specified.
|
|
2220
|
-
*/
|
|
2221
|
-
dataset?: string;
|
|
2222
|
-
/**
|
|
2223
|
-
* Document types that this intent can handle
|
|
2224
|
-
* @remarks This is required for all filters. Use ['*'] to match all document types.
|
|
2225
|
-
*/
|
|
2226
|
-
types: string[];
|
|
2227
|
-
}
|
|
2228
|
-
/**
|
|
2229
|
-
* Intent definition structure for registering user intents
|
|
2230
2297
|
* @public
|
|
2298
|
+
* Extracts the project ID from a CorsOriginError message.
|
|
2299
|
+
* @param error - The error to extract the project ID from.
|
|
2300
|
+
* @returns The project ID or null if the error is not a CorsOriginError.
|
|
2231
2301
|
*/
|
|
2232
|
-
|
|
2233
|
-
/**
|
|
2234
|
-
* Unique identifier for this intent
|
|
2235
|
-
* @remarks Should be unique across all registered intents in an org for proper matching
|
|
2236
|
-
*/
|
|
2237
|
-
id: string;
|
|
2238
|
-
/**
|
|
2239
|
-
* The action that this intent performs
|
|
2240
|
-
* @remarks Examples: "view", "edit", "create", "delete"
|
|
2241
|
-
*/
|
|
2242
|
-
action: 'view' | 'edit' | 'create' | 'delete';
|
|
2243
|
-
/**
|
|
2244
|
-
* Human-readable title for this intent
|
|
2245
|
-
* @remarks Used for display purposes in UI or logs
|
|
2246
|
-
*/
|
|
2247
|
-
title: string;
|
|
2248
|
-
/**
|
|
2249
|
-
* Detailed description of what this intent does
|
|
2250
|
-
* @remarks Helps users understand the purpose and behavior of the intent
|
|
2251
|
-
*/
|
|
2252
|
-
description?: string;
|
|
2253
|
-
/**
|
|
2254
|
-
* Array of filter criteria for intent matching
|
|
2255
|
-
* @remarks At least one filter is required. Use `{types: ['*']}` to match everything
|
|
2256
|
-
*/
|
|
2257
|
-
filters: IntentFilter[];
|
|
2258
|
-
}
|
|
2302
|
+
declare function getCorsErrorProjectId(error: Error): string | null;
|
|
2259
2303
|
/**
|
|
2260
|
-
*
|
|
2261
|
-
*
|
|
2262
|
-
* This utility function provides TypeScript support and validation for intent declarations.
|
|
2263
|
-
* It is also used in the CLI if intents are declared as bare objects in an intents file.
|
|
2304
|
+
* Returns true when the given error looks like a dynamic-import or
|
|
2305
|
+
* code-split chunk-loading failure.
|
|
2264
2306
|
*
|
|
2265
|
-
*
|
|
2266
|
-
*
|
|
2307
|
+
* These errors typically surface when a user has a tab open against a
|
|
2308
|
+
* previously-deployed version of an app and the JavaScript or CSS chunk
|
|
2309
|
+
* filenames have since changed: a fresh deployment removes the hashed assets
|
|
2310
|
+
* the open tab still references. Detecting them lets the SDK trigger an
|
|
2311
|
+
* automatic reload so the user gets the new build without manual intervention.
|
|
2267
2312
|
*
|
|
2268
|
-
*
|
|
2269
|
-
*
|
|
2270
|
-
*
|
|
2271
|
-
*
|
|
2272
|
-
* id: 'viewGeopointInMapApp',
|
|
2273
|
-
* action: 'view',
|
|
2274
|
-
* title: 'View a geopoint in the map app',
|
|
2275
|
-
* description: 'This lets you view a geopoint in the map app',
|
|
2276
|
-
* filters: [
|
|
2277
|
-
* {
|
|
2278
|
-
* projectId: 'travel-project',
|
|
2279
|
-
* dataset: 'production',
|
|
2280
|
-
* types: ['geopoint']
|
|
2281
|
-
* }
|
|
2282
|
-
* ]
|
|
2283
|
-
* })
|
|
2284
|
-
*
|
|
2285
|
-
* export default viewGeopointInMapApp
|
|
2286
|
-
* ```
|
|
2313
|
+
* Recognized shapes (webpack ChunkLoadError, Vite "Failed to fetch
|
|
2314
|
+
* dynamically imported module", Firefox "error loading dynamically imported
|
|
2315
|
+
* module", Safari "Importing a module script failed", and Vite "Unable to
|
|
2316
|
+
* preload CSS").
|
|
2287
2317
|
*
|
|
2288
|
-
*
|
|
2289
|
-
*
|
|
2290
|
-
*
|
|
2291
|
-
* const currentProject = await asyncProjectFunction()
|
|
2292
|
-
* const currentDataset = await asyncDatasetFunction()
|
|
2293
|
-
*
|
|
2294
|
-
* return defineIntent({
|
|
2295
|
-
* id: 'dynamicIntent',
|
|
2296
|
-
* action: 'view',
|
|
2297
|
-
* title: 'Dynamic Intent',
|
|
2298
|
-
* description: 'Intent with dynamically resolved values',
|
|
2299
|
-
* filters: [
|
|
2300
|
-
* {
|
|
2301
|
-
* projectId: currentProject, // Resolved value
|
|
2302
|
-
* dataset: currentDataset, // Resolved value
|
|
2303
|
-
* types: ['document']
|
|
2304
|
-
* }
|
|
2305
|
-
* ]
|
|
2306
|
-
* })
|
|
2307
|
-
* }
|
|
2308
|
-
*
|
|
2309
|
-
* const intent = await createAsyncIntent()
|
|
2310
|
-
* export default intent
|
|
2311
|
-
* ```
|
|
2318
|
+
* @param error - The value to inspect. Anything that is not an Error
|
|
2319
|
+
* instance returns false.
|
|
2320
|
+
* @returns True if the error matches a known import/chunk-load failure.
|
|
2312
2321
|
*
|
|
2313
2322
|
* @public
|
|
2314
2323
|
*/
|
|
2315
|
-
declare function
|
|
2316
|
-
/**
|
|
2317
|
-
* @public
|
|
2318
|
-
* Extracts the project ID from a CorsOriginError message.
|
|
2319
|
-
* @param error - The error to extract the project ID from.
|
|
2320
|
-
* @returns The project ID or null if the error is not a CorsOriginError.
|
|
2321
|
-
*/
|
|
2322
|
-
declare function getCorsErrorProjectId(error: Error): string | null;
|
|
2324
|
+
declare function isImportError(error: unknown): boolean;
|
|
2323
2325
|
/**
|
|
2324
2326
|
* This version is provided by pkg-utils at build time
|
|
2325
2327
|
* @internal
|
|
@@ -2329,4 +2331,5 @@ declare const CORE_SDK_VERSION: {};
|
|
|
2329
2331
|
* @public
|
|
2330
2332
|
*/
|
|
2331
2333
|
type SanityProject = SanityProject$1;
|
|
2332
|
-
export { type ActionErrorEvent, type ActionsResult, type AgentGenerateOptions, type AgentGenerateResult, type AgentPatchOptions, type AgentPatchResult, type AgentPromptOptions, type AgentPromptResult, type
|
|
2334
|
+
export { type AccessResourceType, type Action, type ActionErrorEvent, type ActionsResult, type AgentGenerateOptions, type AgentGenerateResult, type AgentPatchOptions, type AgentPatchResult, type AgentPromptOptions, type AgentPromptResult, type AgentTransformOptions, type AgentTransformResult, type AgentTranslateOptions, type AgentTranslateResult, type ApiErrorBody, type Application, type ApplicationAccess, type ApplicationBase, type ApplicationDeployment, type ApplicationInclude, type ApplicationInterface, type ApplicationStudioConfig, type ApplicationVisibility, type ApplicationWorkspace, type ApplicationsOptions, type ApplicationsResponse, type ApplyDocumentActionsOptions, type ArchiveReleaseAction, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type CanvasResource, type CanvasSource, type ClientOptions, type ClientStoreState as ClientState, type ComlinkControllerState, type ComlinkNodeState, type CreateDocumentAction, type CreateReleaseAction, type CreateUserApplicationInput, type CurrentUser, type DatasetHandle, type DatasetResource, type DatasetSource, type DeleteApplicationInput, type DeleteDocumentAction, type DeleteReleaseAction, type DeleteUserApplicationInput, type DeletedResult, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPublishedEvent, type DocumentRemotePatchesEvent, type DocumentResource, type DocumentSource, type DocumentTransactionSubmissionResult, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type EditDocumentOptions, type EditReleaseAction, type ErrorAuthState, type FavoriteStatusResponse, type FetcherStore, type FetcherStoreState, type FrameMessage, type GetPreviewStateOptions, type GetUserOptions, type GetUsersOptions, type Installation, type InstallationAccess, type InstallationActiveConfig, type InstallationBase, type InstallationInclude, type InstallationInterface, type InstallationsOptions, type InstallationsResponse, type InstanceContext, type JsonMatch, type LogContext, type LogLevel, type LogNamespace, type LoggedInAuthState, type LoggedOutAuthState, type Logger, type LoggerConfig, type LoggingInAuthState, type MediaLibraryResource, type MediaLibrarySource, type Membership, type NewTokenResponseMessage, type NodeState, type OrgVerificationResult, type Organization, type OrganizationBase, type OrganizationMember, type OrganizationOptions, type Organizations, type OrganizationsOptions, PREVIEW_PROJECTION, type PermissionDeniedReason, type PerspectiveHandle, type PresenceLocation, type PreviewMedia, type PreviewQueryResult, type PreviewStoreState, type PreviewValue, type Project, type ProjectBase, type ProjectHandle, type ProjectMember, type ProjectMemberRole, type ProjectMetadata, type ProjectOptions, type ProjectionValuePending, type ProjectsOptions, type PublishDocumentAction, type PublishReleaseAction, type QueryOptions, type ReleaseAction, type ReleaseDocument, type ReleaseHandle, type ReleasePerspective, type ReleaseState, type RequestNewTokenMessage, type ResolvePreviewOptions, type ResolveUserOptions, type ResolveUsersOptions, type Role, type RollCallEvent, type SanityConfig, type SanityDocument, type SanityInstance, SanityProject, type SanityUser, type SanityUserResponse, type ScheduleReleaseAction, type Selector, type StateEvent, type StateSource, type StudioConfig, type TokenSource, type TransactionAcceptedEvent, type TransactionRevertedEvent, type TransportEvent, type UnarchiveReleaseAction, type UnpublishDocumentAction, type UnscheduleReleaseAction, type UpdateApplicationInput, type UpdateUserApplicationInput, type UserApplication, type UserApplicationDeployment, type UserApplicationWriteFields, type UserApplicationsOptions, type UserPresence, type UserProfile, type UsersGroupState, type UsersStoreState, type ValidProjection, type ValuePending, type WindowMessage, agentGenerate, agentPatch, agentPrompt, agentTransform, agentTranslate, application, applications, applyDocumentActions, archiveRelease, checkPermissions, configureLogging, createDatasetHandle, createDocument, createDocumentHandle, createDocumentTypeHandle, createGroqSearchFilter, createProjectHandle, createRelease, createSanityInstance, createUserApplication, deleteApplication, deleteDocument, deleteRelease, deleteUserApplication, destroyController, discardDocument, editDocument, editRelease, getActiveReleasesState, getAllReleasesState, getAuthState, getClient, getClientErrorApiBody, getClientErrorApiDescription, getClientErrorApiType, getClientState, getCorsErrorProjectId, getCurrentUserState, getDashboardOrganizationId, getDatasetsState, getDocumentState, getDocumentSyncStatus, getFavoritesState, getIndexForKey, getIsInDashboardState, getLoginUrlState, getNodeState, getOrCreateChannel, getOrCreateController, getOrCreateNode, getPathDepth, getPermissionsState, getPerspectiveState, getPresence, getPreviewState, getProjectionState, getQueryKey, getQueryState, getReleaseDocumentId, getTokenState, getUserState, getUsersKey, getUsersState, handleAuthCallback, installation, installations, isCanvasResource, isCanvasSource, isDatasetResource, isDatasetSource, isImportError, isMediaLibraryResource, isMediaLibrarySource, isProjectUserNotFoundClientError, isStudioConfig, joinPaths, jsonMatch, loadMoreUsers, logout, observeOrganizationVerificationState, organization, organizations, parseQueryKey, parseUsersKey, project, projects, publishDocument, publishRelease, releaseChannel, releaseNode, resolveDatasets, resolveDocument, resolveFavoritesState, resolvePermissions, resolvePreview, resolveProjection, resolveQuery, resolveUser, resolveUsers, scheduleRelease, setAuthToken, slicePath, stringifyPath, subscribeDocumentEvents, transformProjectionToPreview, unarchiveRelease, unpublishDocument, unscheduleRelease, updateApplication, updateUserApplication, userApplication, userApplications };
|
|
2335
|
+
//# sourceMappingURL=index.d.ts.map
|