@sanity/sdk 2.13.0 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-dts/createGroqSearchFilter.d.ts +925 -0
- package/dist/_chunks-dts/createGroqSearchFilter.d.ts.map +1 -0
- package/dist/_chunks-es/createGroqSearchFilter.js +261 -225
- package/dist/_chunks-es/createGroqSearchFilter.js.map +1 -1
- package/dist/_chunks-es/version.js +1 -1
- package/dist/_exports/_internal.d.ts +3 -2
- package/dist/_exports/_internal.d.ts.map +1 -0
- package/dist/index.d.ts +1856 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -28
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/auth/authLogger.ts +30 -0
- package/src/auth/authStore.test.ts +96 -1
- package/src/auth/authStore.ts +55 -24
- package/src/auth/handleAuthCallback.test.ts +23 -1
- package/src/auth/handleAuthCallback.ts +25 -6
- package/src/auth/logout.test.ts +68 -1
- package/src/auth/logout.ts +22 -3
- package/src/auth/refreshStampedToken.test.ts +15 -0
- package/src/auth/refreshStampedToken.ts +12 -1
- package/src/auth/subscribeToStateAndFetchCurrentUser.test.ts +17 -2
- package/src/auth/subscribeToStateAndFetchCurrentUser.ts +9 -0
- package/dist/_chunks-dts/utils.d.ts +0 -2778
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,1856 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
|
|
1
|
+
import { $ as isStudioConfig, A as ApiErrorBody, B as LoggingInAuthState, C as PreviewQueryResult, Ct as isMediaLibrarySource, D as ProjectionValuePending, E as ValuePending, F as AuthState, G as getLoginUrlState, H as getCurrentUserState, I as AuthStoreState, J as AuthStateType, K as getTokenState, L as ErrorAuthState, M as getClientErrorApiDescription, N as getClientErrorApiType, O as ValidProjection, P as isProjectUserNotFoundClientError, Q as createSanityInstance, R as LoggedInAuthState, S as PreviewMedia, St as isMediaLibraryResource, T as PreviewValue, Tt as AuthProvider, U as getDashboardOrganizationId, V as getAuthState, W as getIsInDashboardState, X as StoreAction, Y as BoundStoreAction, Z as SanityInstance, _ as parseQueryKey, _t as TokenSource, a as GetUsersOptions, at as DocumentHandle, b as StateSource, bt as isDatasetResource, c as ResolveUsersOptions, ct as DocumentTypeHandle, d as UserProfile, dt as PerspectiveHandle, et as CanvasResource, f as UsersGroupState, ft as ProjectHandle, g as getQueryState, gt as StudioConfig, h as getQueryKey, ht as SanityConfig, i as GetUserOptions, it as DatasetSource, j as getClientErrorApiBody, k as PREVIEW_PROJECTION, l as SanityUser, lt as MediaLibraryResource, m as QueryOptions, mt as ReleasePerspective, n as getUsersKey, nt as DatasetHandle, o as Membership, ot as DocumentResource, p as UsersStoreState, pt as ReleaseHandle, q as setAuthToken, r as parseUsersKey, rt as DatasetResource, s as ResolveUserOptions, st as DocumentSource, t as createGroqSearchFilter, tt as CanvasSource, u as SanityUserResponse, ut as MediaLibrarySource, v as resolveQuery, vt as isCanvasResource, w as PreviewStoreState, wt as AuthConfig, x as transformProjectionToPreview, xt as isDatasetSource, y as Selector, yt as isCanvasSource, z as LoggedOutAuthState } 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";
|
|
4
|
+
import { Observable, Subject } from "rxjs";
|
|
5
|
+
import { SanityDocument as SanityDocument$3, SanityProjectionResult } from "groq";
|
|
6
|
+
import { ChannelInput, ChannelInstance, Controller, Message, Node, NodeInput, Status } from "@sanity/comlink";
|
|
7
|
+
import { PatchMutation } from "/home/runner/work/sdk/sdk/node_modules/.pnpm/@sanity+mutate@0.18.0_xstate@5.31.1/node_modules/@sanity/mutate/dist/_unstable_store.js";
|
|
8
|
+
import { ExprNode } from "groq-js";
|
|
9
|
+
import { CanvasResource as CanvasResource$1, MediaResource, StudioResource } from "@sanity/message-protocol";
|
|
10
|
+
import { getIndexForKey, getPathDepth, joinPaths, jsonMatch, slicePath, stringifyPath } from "@sanity/json-match";
|
|
11
|
+
/** @alpha */
|
|
12
|
+
type AgentGenerateOptions = Parameters<SanityClient['observable']['agent']['action']['generate']>[0];
|
|
13
|
+
/** @alpha */
|
|
14
|
+
type AgentTransformOptions = Parameters<SanityClient['observable']['agent']['action']['transform']>[0];
|
|
15
|
+
/** @alpha */
|
|
16
|
+
type AgentTranslateOptions = Parameters<SanityClient['observable']['agent']['action']['translate']>[0];
|
|
17
|
+
/** @alpha */
|
|
18
|
+
type AgentPromptOptions = Parameters<SanityClient['agent']['action']['prompt']>[0];
|
|
19
|
+
/** @alpha */
|
|
20
|
+
type AgentPatchOptions = Parameters<SanityClient['agent']['action']['patch']>[0];
|
|
21
|
+
/** @alpha */
|
|
22
|
+
type AgentGenerateResult = Awaited<ReturnType<SanityClient['observable']['agent']['action']['generate']>>;
|
|
23
|
+
/** @alpha */
|
|
24
|
+
type AgentTransformResult = Awaited<ReturnType<SanityClient['observable']['agent']['action']['transform']>>;
|
|
25
|
+
/** @alpha */
|
|
26
|
+
type AgentTranslateResult = Awaited<ReturnType<SanityClient['observable']['agent']['action']['translate']>>;
|
|
27
|
+
/** @alpha */
|
|
28
|
+
type AgentPromptResult = Awaited<ReturnType<SanityClient['agent']['action']['prompt']>>;
|
|
29
|
+
/** @alpha */
|
|
30
|
+
type AgentPatchResult = Awaited<ReturnType<SanityClient['agent']['action']['patch']>>;
|
|
31
|
+
/**
|
|
32
|
+
* Generates a new document using the agent.
|
|
33
|
+
* @param instance - The Sanity instance.
|
|
34
|
+
* @param options - The options for the agent generate action. See the [Agent Actions API](https://www.sanity.io/docs/agent-actions/introduction) for more details.
|
|
35
|
+
* @returns An Observable emitting the result of the agent generate action.
|
|
36
|
+
* @alpha
|
|
37
|
+
*/
|
|
38
|
+
declare function agentGenerate(instance: SanityInstance, options: AgentGenerateOptions, resource?: DocumentResource): AgentGenerateResult;
|
|
39
|
+
/**
|
|
40
|
+
* Transforms a document using the agent.
|
|
41
|
+
* @param instance - The Sanity instance.
|
|
42
|
+
* @param options - The options for the agent transform action. See the [Agent Actions API](https://www.sanity.io/docs/agent-actions/introduction) for more details.
|
|
43
|
+
* @returns An Observable emitting the result of the agent transform action.
|
|
44
|
+
* @alpha
|
|
45
|
+
*/
|
|
46
|
+
declare function agentTransform(instance: SanityInstance, options: AgentTransformOptions, resource?: DocumentResource): AgentTransformResult;
|
|
47
|
+
/**
|
|
48
|
+
* Translates a document using the agent.
|
|
49
|
+
* @param instance - The Sanity instance.
|
|
50
|
+
* @param options - The options for the agent translate action. See the [Agent Actions API](https://www.sanity.io/docs/agent-actions/introduction) for more details.
|
|
51
|
+
* @returns An Observable emitting the result of the agent translate action.
|
|
52
|
+
* @alpha
|
|
53
|
+
*/
|
|
54
|
+
declare function agentTranslate(instance: SanityInstance, options: AgentTranslateOptions, resource?: DocumentResource): AgentTranslateResult;
|
|
55
|
+
/**
|
|
56
|
+
* Prompts the agent using the same instruction template format as the other actions, but returns text or json instead of acting on a document.
|
|
57
|
+
* @param instance - The Sanity instance.
|
|
58
|
+
* @param options - The options for the agent prompt action. See the [Agent Actions API](https://www.sanity.io/docs/agent-actions/introduction) for more details.
|
|
59
|
+
* @returns An Observable emitting the result of the agent prompt action.
|
|
60
|
+
* @alpha
|
|
61
|
+
*/
|
|
62
|
+
declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptions, resource?: DocumentResource): Observable<AgentPromptResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Patches a document using the agent.
|
|
65
|
+
* @param instance - The Sanity instance.
|
|
66
|
+
* @param options - The options for the agent patch action. See the [Agent Actions API](https://www.sanity.io/docs/agent-actions/introduction) for more details.
|
|
67
|
+
* @returns An Observable emitting the result of the agent patch action.
|
|
68
|
+
* @alpha
|
|
69
|
+
*/
|
|
70
|
+
declare function agentPatch(instance: SanityInstance, options: AgentPatchOptions, resource?: DocumentResource): Observable<AgentPatchResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Error message returned by the organization verification
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
interface OrgVerificationResult {
|
|
76
|
+
error: string | null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Creates an observable that emits the organization verification state for a given instance.
|
|
80
|
+
* It combines the dashboard organization ID (from auth context) with the
|
|
81
|
+
* project's actual organization ID (fetched via getProjectState) and compares them.
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
declare function observeOrganizationVerificationState(instance: SanityInstance, projectIds: string[]): Observable<OrgVerificationResult>;
|
|
85
|
+
/**
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
declare const handleAuthCallback: BoundStoreAction<AuthStoreState, [locationHref?: string | undefined], Promise<string | false>>;
|
|
89
|
+
/**
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
declare const logout: BoundStoreAction<AuthStoreState, [], Promise<void>>;
|
|
93
|
+
type AllowedClientConfigKey = 'useCdn' | 'token' | 'perspective' | 'apiHost' | 'proxy' | 'withCredentials' | 'timeout' | 'maxRetries' | 'dataset' | 'projectId' | 'requestTagPrefix' | 'useProjectHostname';
|
|
94
|
+
/**
|
|
95
|
+
* States tracked by the client store
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
interface ClientStoreState {
|
|
99
|
+
token: string | null;
|
|
100
|
+
clients: { [TKey in string]?: SanityClient };
|
|
101
|
+
authMethod?: 'localstorage' | 'cookie';
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Options used when retrieving a client instance from the client store.
|
|
105
|
+
*
|
|
106
|
+
* This interface extends the base {@link ClientConfig} and adds:
|
|
107
|
+
*
|
|
108
|
+
* - **apiVersion:** A required string indicating the API version for the client.
|
|
109
|
+
* - **scope:** An optional flag to choose between the project-specific client
|
|
110
|
+
* ('project') and the global client ('global'). When set to `'global'`, the
|
|
111
|
+
* global client is used.
|
|
112
|
+
*
|
|
113
|
+
* These options are utilized by `getClient` and `getClientState` to configure and
|
|
114
|
+
* return appropriate client instances that automatically handle authentication
|
|
115
|
+
* updates and configuration changes.
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
interface ClientOptions extends Pick<ClientConfig, AllowedClientConfigKey> {
|
|
120
|
+
/**
|
|
121
|
+
* An optional flag to choose between the default client (typically project-level)
|
|
122
|
+
* and the global client ('global'). When set to `'global'`, the global client
|
|
123
|
+
* is used.
|
|
124
|
+
*/
|
|
125
|
+
scope?: 'default' | 'global';
|
|
126
|
+
/**
|
|
127
|
+
* A required string indicating the API version for the client.
|
|
128
|
+
*/
|
|
129
|
+
apiVersion: string;
|
|
130
|
+
/**
|
|
131
|
+
* @internal
|
|
132
|
+
* The SDK resource to use for the client -- this will get transformed into a ClientConfig resource.
|
|
133
|
+
*/
|
|
134
|
+
resource?: DocumentResource;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Retrieves a Sanity client instance configured with the provided options.
|
|
138
|
+
*
|
|
139
|
+
* This function returns a client instance configured for the project or as a
|
|
140
|
+
* global client based on the options provided. It ensures efficient reuse of
|
|
141
|
+
* client instances by returning the same instance for the same options.
|
|
142
|
+
* For automatic handling of authentication token updates, consider using
|
|
143
|
+
* `getClientState`.
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
declare const getClient: BoundStoreAction<ClientStoreState, [options: ClientOptions], SanityClient>;
|
|
148
|
+
/**
|
|
149
|
+
* Returns a state source for the Sanity client instance.
|
|
150
|
+
*
|
|
151
|
+
* This function provides a subscribable state source that emits updated client
|
|
152
|
+
* instances whenever relevant configurations change (such as authentication tokens).
|
|
153
|
+
* Use this when you need to react to client configuration changes in your application.
|
|
154
|
+
*
|
|
155
|
+
* @public
|
|
156
|
+
*/
|
|
157
|
+
declare const getClientState: BoundStoreAction<ClientStoreState, [options: ClientOptions], import("../_exports").StateSource<SanityClient>>;
|
|
158
|
+
/**
|
|
159
|
+
* Message sent from a containing app to an iframe
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
type FrameMessage = Message;
|
|
163
|
+
/**
|
|
164
|
+
* Message sent from an iframe to a containing app
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
type WindowMessage = Message;
|
|
168
|
+
/**
|
|
169
|
+
* Message from SDK (iframe) to Parent (dashboard) to request a new token
|
|
170
|
+
* @internal
|
|
171
|
+
*/
|
|
172
|
+
type RequestNewTokenMessage = {
|
|
173
|
+
type: 'dashboard/v1/auth/tokens/create';
|
|
174
|
+
payload?: undefined;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Message from Parent (dashboard) to SDK (iframe) with the new token
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
type NewTokenResponseMessage = {
|
|
181
|
+
type: 'dashboard/v1/auth/tokens/create';
|
|
182
|
+
payload: {
|
|
183
|
+
token: string | null;
|
|
184
|
+
error?: string;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Individual channel with its relevant options
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
191
|
+
interface ChannelEntry {
|
|
192
|
+
channel: ChannelInstance<FrameMessage, WindowMessage>;
|
|
193
|
+
options: ChannelInput;
|
|
194
|
+
refCount: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Internal state tracking comlink connections
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
interface ComlinkControllerState {
|
|
201
|
+
controller: Controller | null;
|
|
202
|
+
controllerOrigin: string | null;
|
|
203
|
+
channels: Map<string, ChannelEntry>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Calls the destroy method on the controller and resets the controller state.
|
|
207
|
+
* @public
|
|
208
|
+
*/
|
|
209
|
+
declare const destroyController: BoundStoreAction<ComlinkControllerState, [], void>;
|
|
210
|
+
/**
|
|
211
|
+
* Retrieve or create a channel to be used for communication between
|
|
212
|
+
* an application and the controller.
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
declare const getOrCreateChannel: BoundStoreAction<ComlinkControllerState, [options: ChannelInput], ChannelInstance<import("@sanity/comlink").Message, import("@sanity/comlink").Message>>;
|
|
216
|
+
/**
|
|
217
|
+
* Initializes or fetches a controller to handle communication
|
|
218
|
+
* between an application and iframes.
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
221
|
+
declare const getOrCreateController: BoundStoreAction<ComlinkControllerState, [targetOrigin: string], Controller>;
|
|
222
|
+
/**
|
|
223
|
+
* Signals to the store that the consumer has stopped using the channel
|
|
224
|
+
* @public
|
|
225
|
+
*/
|
|
226
|
+
declare const releaseChannel: BoundStoreAction<ComlinkControllerState, [name: string], void>;
|
|
227
|
+
/**
|
|
228
|
+
* Individual node with its relevant options
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
231
|
+
interface NodeEntry {
|
|
232
|
+
node: Node<WindowMessage, FrameMessage>;
|
|
233
|
+
options: NodeInput;
|
|
234
|
+
status: Status;
|
|
235
|
+
statusUnsub?: () => void;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Internal state tracking comlink connections
|
|
239
|
+
* @public
|
|
240
|
+
*/
|
|
241
|
+
interface ComlinkNodeState {
|
|
242
|
+
nodes: Map<string, NodeEntry>;
|
|
243
|
+
subscriptions: Map<string, Set<symbol>>;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Signals to the store that the consumer has stopped using the node
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
249
|
+
declare const releaseNode: BoundStoreAction<ComlinkNodeState, [name: string], void>;
|
|
250
|
+
/**
|
|
251
|
+
* Retrieve or create a node to be used for communication between
|
|
252
|
+
* an application and the controller -- specifically, a node should
|
|
253
|
+
* be created within a frame / window to communicate with the controller.
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
declare const getOrCreateNode: BoundStoreAction<ComlinkNodeState, [options: NodeInput], Node<import("@sanity/comlink").Message, import("@sanity/comlink").Message>>;
|
|
257
|
+
/**
|
|
258
|
+
* @public
|
|
259
|
+
*/
|
|
260
|
+
interface NodeState {
|
|
261
|
+
node: Node<WindowMessage, FrameMessage>;
|
|
262
|
+
status: Status | undefined;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Provides a subscribable state source for a node by name
|
|
266
|
+
* @param instance - The Sanity instance to get the node state for
|
|
267
|
+
* @param nodeInput - The configuration for the node to get the state for
|
|
268
|
+
|
|
269
|
+
* @returns A subscribable state source for the node
|
|
270
|
+
* @public
|
|
271
|
+
*/
|
|
272
|
+
declare const getNodeState: BoundStoreAction<ComlinkNodeState, [NodeInput], import("../../_exports").StateSource<NodeState | undefined>>;
|
|
273
|
+
/**
|
|
274
|
+
* Creates or validates a `DocumentHandle` object.
|
|
275
|
+
* Ensures the provided object conforms to the `DocumentHandle` interface.
|
|
276
|
+
* @param handle - The object containing document identification properties.
|
|
277
|
+
* @returns The validated `DocumentHandle` object.
|
|
278
|
+
* @public
|
|
279
|
+
*/
|
|
280
|
+
declare function createDocumentHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(handle: DocumentHandle<TDocumentType, TDataset, TProjectId>): DocumentHandle<TDocumentType, TDataset, TProjectId>;
|
|
281
|
+
/**
|
|
282
|
+
* Creates or validates a `DocumentTypeHandle` object.
|
|
283
|
+
* Ensures the provided object conforms to the `DocumentTypeHandle` interface.
|
|
284
|
+
* @param handle - The object containing document type identification properties.
|
|
285
|
+
* @returns The validated `DocumentTypeHandle` object.
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
declare function createDocumentTypeHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(handle: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>): DocumentTypeHandle<TDocumentType, TDataset, TProjectId>;
|
|
289
|
+
/**
|
|
290
|
+
* Creates or validates a `ProjectHandle` object.
|
|
291
|
+
* Ensures the provided object conforms to the `ProjectHandle` interface.
|
|
292
|
+
* @param handle - The object containing project identification properties.
|
|
293
|
+
* @returns The validated `ProjectHandle` object.
|
|
294
|
+
* @public
|
|
295
|
+
*/
|
|
296
|
+
declare function createProjectHandle<TProjectId extends string = string>(handle: ProjectHandle<TProjectId>): ProjectHandle<TProjectId>;
|
|
297
|
+
/**
|
|
298
|
+
* Creates or validates a `DatasetHandle` object.
|
|
299
|
+
* Ensures the provided object conforms to the `DatasetHandle` interface.
|
|
300
|
+
* @param handle - The object containing dataset identification properties.
|
|
301
|
+
* @returns The validated `DatasetHandle` object.
|
|
302
|
+
* @public
|
|
303
|
+
*/
|
|
304
|
+
declare function createDatasetHandle<TDataset extends string = string, TProjectId extends string = string>(handle: DatasetHandle<TDataset, TProjectId>): DatasetHandle<TDataset, TProjectId>;
|
|
305
|
+
/**
|
|
306
|
+
* Logging infrastructure for the Sanity SDK
|
|
307
|
+
*
|
|
308
|
+
* Provides multi-level, namespace-based logging for both SDK users and maintainers.
|
|
309
|
+
* In production builds, all logging can be stripped via tree-shaking.
|
|
310
|
+
*
|
|
311
|
+
* @example SDK User
|
|
312
|
+
* ```ts
|
|
313
|
+
* import {configureLogging} from '@sanity/sdk'
|
|
314
|
+
*
|
|
315
|
+
* configureLogging({
|
|
316
|
+
* level: 'info',
|
|
317
|
+
* namespaces: ['auth', 'document']
|
|
318
|
+
* })
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* @example SDK Maintainer
|
|
322
|
+
* ```ts
|
|
323
|
+
* configureLogging({
|
|
324
|
+
* level: 'trace',
|
|
325
|
+
* namespaces: ['*'],
|
|
326
|
+
* internal: true
|
|
327
|
+
* })
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
/**
|
|
331
|
+
* Log levels in order of verbosity (least to most)
|
|
332
|
+
* - error: Critical failures that prevent operation
|
|
333
|
+
* - warn: Issues that may cause problems but don't stop execution
|
|
334
|
+
* - info: High-level informational messages (SDK user level)
|
|
335
|
+
* - debug: Detailed debugging information (maintainer level)
|
|
336
|
+
* - trace: Very detailed tracing (maintainer level, includes RxJS streams)
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
|
340
|
+
/**
|
|
341
|
+
* Log namespaces organize logs by functional domain
|
|
342
|
+
*
|
|
343
|
+
* @remarks
|
|
344
|
+
* This is an extensible string type. As logging is added to more modules,
|
|
345
|
+
* additional namespaces will be recognized. Currently implemented namespaces
|
|
346
|
+
* will be documented as they are added.
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
type LogNamespace = string;
|
|
350
|
+
/**
|
|
351
|
+
* Configuration for the logging system
|
|
352
|
+
* @public
|
|
353
|
+
*/
|
|
354
|
+
interface LoggerConfig {
|
|
355
|
+
/**
|
|
356
|
+
* Minimum log level to output
|
|
357
|
+
* @defaultValue 'warn'
|
|
358
|
+
*/
|
|
359
|
+
level?: LogLevel;
|
|
360
|
+
/**
|
|
361
|
+
* Namespaces to enable. Use ['*'] for all namespaces
|
|
362
|
+
* @defaultValue []
|
|
363
|
+
* @remarks
|
|
364
|
+
* Available namespaces depend on which modules have logging integrated.
|
|
365
|
+
* Check the SDK documentation for the current list of instrumented modules.
|
|
366
|
+
* @example ['auth', 'document']
|
|
367
|
+
*/
|
|
368
|
+
namespaces?: string[];
|
|
369
|
+
/**
|
|
370
|
+
* Enable internal/maintainer-level logging
|
|
371
|
+
* Shows RxJS streams, store internals, etc.
|
|
372
|
+
* @defaultValue false
|
|
373
|
+
*/
|
|
374
|
+
internal?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Custom log handler (for testing or custom output)
|
|
377
|
+
* @defaultValue console methods
|
|
378
|
+
*/
|
|
379
|
+
handler?: LogHandler;
|
|
380
|
+
/**
|
|
381
|
+
* Enable timestamps in log output
|
|
382
|
+
* @defaultValue true
|
|
383
|
+
*/
|
|
384
|
+
timestamps?: boolean;
|
|
385
|
+
/**
|
|
386
|
+
* Enable in production builds
|
|
387
|
+
* @defaultValue false
|
|
388
|
+
*/
|
|
389
|
+
enableInProduction?: boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Custom log handler interface
|
|
393
|
+
*
|
|
394
|
+
* @internal
|
|
395
|
+
*/
|
|
396
|
+
interface LogHandler {
|
|
397
|
+
error: (message: string, context?: LogContext) => void;
|
|
398
|
+
warn: (message: string, context?: LogContext) => void;
|
|
399
|
+
info: (message: string, context?: LogContext) => void;
|
|
400
|
+
debug: (message: string, context?: LogContext) => void;
|
|
401
|
+
trace: (message: string, context?: LogContext) => void;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Context object attached to log messages
|
|
405
|
+
*
|
|
406
|
+
* This interface allows you to attach arbitrary contextual data to log messages.
|
|
407
|
+
* The index signature `[key: string]: unknown` enables you to add any custom
|
|
408
|
+
* properties relevant to your log entry (e.g., `userId`, `documentId`, `action`, etc.).
|
|
409
|
+
*
|
|
410
|
+
* **Sensitive data sanitization:**
|
|
411
|
+
* Top-level keys containing sensitive names (`token`, `password`, `secret`, `apiKey`,
|
|
412
|
+
* `authorization`) are automatically redacted to `[REDACTED]` in log output.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```ts
|
|
416
|
+
* logger.info('User logged in', {
|
|
417
|
+
* userId: '123', // Custom context
|
|
418
|
+
* action: 'login', // Custom context
|
|
419
|
+
* token: 'secret' // Will be redacted to [REDACTED]
|
|
420
|
+
* })
|
|
421
|
+
* ```
|
|
422
|
+
*
|
|
423
|
+
* @internal
|
|
424
|
+
*/
|
|
425
|
+
interface LogContext {
|
|
426
|
+
/**
|
|
427
|
+
* Custom context properties that provide additional information about the log entry.
|
|
428
|
+
* Any key-value pairs can be added here (e.g., userId, documentId, requestId, etc.).
|
|
429
|
+
* Keys with sensitive names (token, password, secret, apiKey, authorization) are
|
|
430
|
+
* automatically sanitized.
|
|
431
|
+
*/
|
|
432
|
+
[key: string]: unknown;
|
|
433
|
+
/** Error object if logging an error */
|
|
434
|
+
error?: Error | unknown;
|
|
435
|
+
/** Duration in milliseconds for timed operations */
|
|
436
|
+
duration?: number;
|
|
437
|
+
/** Stack trace for debugging */
|
|
438
|
+
stack?: string;
|
|
439
|
+
/** Instance context (automatically added when available) */
|
|
440
|
+
instanceContext?: InstanceContext;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Instance context information automatically added to logs
|
|
444
|
+
* @internal
|
|
445
|
+
*/
|
|
446
|
+
interface InstanceContext {
|
|
447
|
+
/** Unique instance ID */
|
|
448
|
+
instanceId?: string;
|
|
449
|
+
/** Project ID */
|
|
450
|
+
projectId?: string;
|
|
451
|
+
/** Dataset name */
|
|
452
|
+
dataset?: string;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Logger instance for a specific namespace
|
|
456
|
+
* @internal
|
|
457
|
+
*/
|
|
458
|
+
interface Logger {
|
|
459
|
+
readonly namespace: string;
|
|
460
|
+
error: (message: string, context?: LogContext) => void;
|
|
461
|
+
warn: (message: string, context?: LogContext) => void;
|
|
462
|
+
info: (message: string, context?: LogContext) => void;
|
|
463
|
+
debug: (message: string, context?: LogContext) => void;
|
|
464
|
+
trace: (message: string, context?: LogContext) => void;
|
|
465
|
+
/** Check if a log level is enabled (for performance-sensitive code) */
|
|
466
|
+
isLevelEnabled: (level: LogLevel) => boolean;
|
|
467
|
+
/** Create a child logger with extended context */
|
|
468
|
+
child: (context: LogContext) => Logger;
|
|
469
|
+
/** Get the instance context if available */
|
|
470
|
+
getInstanceContext: () => InstanceContext | undefined;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Configure logging for the Sanity SDK
|
|
474
|
+
*
|
|
475
|
+
* This function allows you to control what logs are output by the SDK,
|
|
476
|
+
* making it easier to debug issues in development or production.
|
|
477
|
+
*
|
|
478
|
+
* @remarks
|
|
479
|
+
* **Zero-Config via Environment Variable (Recommended):**
|
|
480
|
+
*
|
|
481
|
+
* The SDK automatically reads the `DEBUG` environment variable, making it
|
|
482
|
+
* easy to enable logging without code changes:
|
|
483
|
+
*
|
|
484
|
+
* ```bash
|
|
485
|
+
* # Enable all SDK logging at debug level
|
|
486
|
+
* DEBUG=sanity:* npm start
|
|
487
|
+
*
|
|
488
|
+
* # Enable specific namespaces
|
|
489
|
+
* DEBUG=sanity:auth,sanity:document npm start
|
|
490
|
+
*
|
|
491
|
+
* # Enable trace level for all namespaces
|
|
492
|
+
* DEBUG=sanity:trace:* npm start
|
|
493
|
+
*
|
|
494
|
+
* # Enable internal/maintainer logs
|
|
495
|
+
* DEBUG=sanity:*:internal npm start
|
|
496
|
+
* ```
|
|
497
|
+
*
|
|
498
|
+
* This matches the pattern used by Sanity CLI and Studio, making it familiar
|
|
499
|
+
* and easy for support teams to help troubleshoot issues.
|
|
500
|
+
*
|
|
501
|
+
* **Programmatic Configuration (Advanced):**
|
|
502
|
+
*
|
|
503
|
+
* For more control (custom handlers, dynamic configuration), call this function
|
|
504
|
+
* explicitly. Programmatic configuration overrides environment variables.
|
|
505
|
+
*
|
|
506
|
+
* **For Application Developers:**
|
|
507
|
+
* Use `info`, `warn`, or `error` levels to see high-level SDK activity
|
|
508
|
+
* without being overwhelmed by internal details.
|
|
509
|
+
*
|
|
510
|
+
* **For SDK Maintainers:**
|
|
511
|
+
* Use `debug` or `trace` levels with `internal: true` to see detailed
|
|
512
|
+
* information about store operations, RxJS streams, and state transitions.
|
|
513
|
+
*
|
|
514
|
+
* **Instance Context:**
|
|
515
|
+
* Logs automatically include instance information (projectId, dataset, instanceId)
|
|
516
|
+
* when available, making it easier to debug multi-instance scenarios:
|
|
517
|
+
* ```
|
|
518
|
+
* [INFO] [auth] [project:abc] [dataset:production] User logged in
|
|
519
|
+
* ```
|
|
520
|
+
*
|
|
521
|
+
* **Available Namespaces:**
|
|
522
|
+
* - `sdk` - SDK initialization, configuration, and lifecycle
|
|
523
|
+
* - `auth` - Authentication and authorization (when instrumented in the future)
|
|
524
|
+
* - And more as logging is added to modules
|
|
525
|
+
*
|
|
526
|
+
* @example Zero-config via environment variable (recommended for debugging)
|
|
527
|
+
* ```bash
|
|
528
|
+
* # Just set DEBUG and run your app - no code changes needed!
|
|
529
|
+
* DEBUG=sanity:* npm start
|
|
530
|
+
* ```
|
|
531
|
+
*
|
|
532
|
+
* @example Programmatic configuration (application developer)
|
|
533
|
+
* ```ts
|
|
534
|
+
* import {configureLogging} from '@sanity/sdk'
|
|
535
|
+
*
|
|
536
|
+
* // Log warnings and errors for auth and document operations
|
|
537
|
+
* configureLogging({
|
|
538
|
+
* level: 'warn',
|
|
539
|
+
* namespaces: ['auth', 'document']
|
|
540
|
+
* })
|
|
541
|
+
* ```
|
|
542
|
+
*
|
|
543
|
+
* @example Programmatic configuration (SDK maintainer)
|
|
544
|
+
* ```ts
|
|
545
|
+
* import {configureLogging} from '@sanity/sdk'
|
|
546
|
+
*
|
|
547
|
+
* // Enable all logs including internal traces
|
|
548
|
+
* configureLogging({
|
|
549
|
+
* level: 'trace',
|
|
550
|
+
* namespaces: ['*'],
|
|
551
|
+
* internal: true
|
|
552
|
+
* })
|
|
553
|
+
* ```
|
|
554
|
+
*
|
|
555
|
+
* @example Custom handler (for testing)
|
|
556
|
+
* ```ts
|
|
557
|
+
* import {configureLogging} from '@sanity/sdk'
|
|
558
|
+
*
|
|
559
|
+
* const logs: string[] = []
|
|
560
|
+
* configureLogging({
|
|
561
|
+
* level: 'info',
|
|
562
|
+
* namespaces: ['*'],
|
|
563
|
+
* handler: {
|
|
564
|
+
* error: (msg) => logs.push(msg),
|
|
565
|
+
* warn: (msg) => logs.push(msg),
|
|
566
|
+
* info: (msg) => logs.push(msg),
|
|
567
|
+
* debug: (msg) => logs.push(msg),
|
|
568
|
+
* trace: (msg) => logs.push(msg),
|
|
569
|
+
* }
|
|
570
|
+
* })
|
|
571
|
+
* ```
|
|
572
|
+
*
|
|
573
|
+
* @public
|
|
574
|
+
*/
|
|
575
|
+
declare function configureLogging(config: LoggerConfig): void;
|
|
576
|
+
/** @public */
|
|
577
|
+
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>>;
|
|
578
|
+
/** @public */
|
|
579
|
+
declare const resolveDatasets: BoundStoreAction<import("../_exports").FetcherStoreState<[options?: ProjectHandle<string> | undefined], import("@sanity/client").DatasetsResponse>, [options?: ProjectHandle<string> | undefined], Promise<import("@sanity/client").DatasetsResponse>>;
|
|
580
|
+
/**
|
|
581
|
+
* Represents an action to create a new document.
|
|
582
|
+
* Specifies the document type and optionally a document ID (which will be treated as the published ID).
|
|
583
|
+
* @beta
|
|
584
|
+
*/
|
|
585
|
+
interface CreateDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentTypeHandle<TDocumentType, TDataset, TProjectId> {
|
|
586
|
+
type: 'document.create';
|
|
587
|
+
/**
|
|
588
|
+
* Optional initial field values for the document.
|
|
589
|
+
* These values will be set when the document is created.
|
|
590
|
+
* System fields (_id, _type, _rev, _createdAt, _updatedAt) are omitted as they are set automatically.
|
|
591
|
+
*/
|
|
592
|
+
initialValue?: Partial<Omit<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>, '_id' | '_type' | '_rev' | '_createdAt' | '_updatedAt'>>;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Represents an action to delete an existing document.
|
|
596
|
+
* Requires the full document handle including the document ID.
|
|
597
|
+
* @beta
|
|
598
|
+
*/
|
|
599
|
+
interface DeleteDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
600
|
+
type: 'document.delete';
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Represents an action to edit an existing document using patches.
|
|
604
|
+
* Requires the full document handle and an array of patch operations.
|
|
605
|
+
* @beta
|
|
606
|
+
*/
|
|
607
|
+
interface EditDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
608
|
+
type: 'document.edit';
|
|
609
|
+
patches?: PatchOperations[];
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Represents an action to publish the draft version of a document.
|
|
613
|
+
* Requires the full document handle.
|
|
614
|
+
* @beta
|
|
615
|
+
*/
|
|
616
|
+
interface PublishDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
617
|
+
type: 'document.publish';
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Represents an action to unpublish a document, moving its published content to a draft.
|
|
621
|
+
* Requires the full document handle.
|
|
622
|
+
* @beta
|
|
623
|
+
*/
|
|
624
|
+
interface UnpublishDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
625
|
+
type: 'document.unpublish';
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Represents an action to discard the draft changes of a document.
|
|
629
|
+
* Requires the full document handle.
|
|
630
|
+
* @beta
|
|
631
|
+
*/
|
|
632
|
+
interface DiscardDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
633
|
+
type: 'document.discard';
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Union type representing all possible document actions within the SDK.
|
|
637
|
+
* @beta
|
|
638
|
+
*/
|
|
639
|
+
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>;
|
|
640
|
+
/**
|
|
641
|
+
* Union of every action accepted by `applyDocumentActions` — both document-
|
|
642
|
+
* level actions and release-lifecycle actions.
|
|
643
|
+
* @beta
|
|
644
|
+
*/
|
|
645
|
+
type Action<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> = DocumentAction<TDocumentType, TDataset, TProjectId> | ReleaseAction;
|
|
646
|
+
/**
|
|
647
|
+
* Creates a `CreateDocumentAction` object.
|
|
648
|
+
* @param doc - A handle identifying the document type, dataset, and project. An optional `documentId` can be provided.
|
|
649
|
+
* @param initialValue - Optional initial field values for the document. (System fields are omitted as they are set automatically.)
|
|
650
|
+
* @returns A `CreateDocumentAction` object ready for dispatch.
|
|
651
|
+
* @beta
|
|
652
|
+
*/
|
|
653
|
+
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>;
|
|
654
|
+
/**
|
|
655
|
+
* Creates a `DeleteDocumentAction` object.
|
|
656
|
+
* @param doc - A handle uniquely identifying the document to be deleted.
|
|
657
|
+
* @returns A `DeleteDocumentAction` object ready for dispatch.
|
|
658
|
+
* @beta
|
|
659
|
+
*/
|
|
660
|
+
declare function deleteDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): DeleteDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
661
|
+
/**
|
|
662
|
+
* Creates an `EditDocumentAction` object with patches for modifying a document.
|
|
663
|
+
* Accepts patches in either the standard `PatchOperations` format or as a `SanityMutatePatchMutation` from `@sanity/mutate`.
|
|
664
|
+
*
|
|
665
|
+
* @param doc - A handle uniquely identifying the document to be edited.
|
|
666
|
+
* @param sanityMutatePatch - A patch mutation object from `@sanity/mutate`.
|
|
667
|
+
* @returns An `EditDocumentAction` object ready for dispatch.
|
|
668
|
+
* @beta
|
|
669
|
+
*/
|
|
670
|
+
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>;
|
|
671
|
+
/**
|
|
672
|
+
* Creates an `EditDocumentAction` object with patches for modifying a document.
|
|
673
|
+
*
|
|
674
|
+
* @param doc - A handle uniquely identifying the document to be edited.
|
|
675
|
+
* @param patches - A single patch operation or an array of patch operations.
|
|
676
|
+
* @returns An `EditDocumentAction` object ready for dispatch.
|
|
677
|
+
* @beta
|
|
678
|
+
*/
|
|
679
|
+
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>;
|
|
680
|
+
/**
|
|
681
|
+
* Creates a `PublishDocumentAction` object.
|
|
682
|
+
* @param doc - A handle uniquely identifying the document to be published.
|
|
683
|
+
* @returns A `PublishDocumentAction` object ready for dispatch.
|
|
684
|
+
* @beta
|
|
685
|
+
*/
|
|
686
|
+
declare function publishDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): PublishDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
687
|
+
/**
|
|
688
|
+
* Creates an `UnpublishDocumentAction` object.
|
|
689
|
+
* @param doc - A handle uniquely identifying the document to be unpublished.
|
|
690
|
+
* @returns An `UnpublishDocumentAction` object ready for dispatch.
|
|
691
|
+
* @beta
|
|
692
|
+
*/
|
|
693
|
+
declare function unpublishDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): UnpublishDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
694
|
+
/**
|
|
695
|
+
* Creates a `DiscardDocumentAction` object.
|
|
696
|
+
* @param doc - A handle uniquely identifying the document whose draft changes are to be discarded.
|
|
697
|
+
* @returns A `DiscardDocumentAction` object ready for dispatch.
|
|
698
|
+
* @beta
|
|
699
|
+
*/
|
|
700
|
+
declare function discardDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): DiscardDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
701
|
+
/**
|
|
702
|
+
* Creates a new release. The `releaseId` must be unique within the current
|
|
703
|
+
* retention period.
|
|
704
|
+
* @beta
|
|
705
|
+
*/
|
|
706
|
+
interface CreateReleaseAction extends ReleaseHandle {
|
|
707
|
+
type: 'release.create';
|
|
708
|
+
metadata: ReleaseDocument$1['metadata'];
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Patches the metadata of an existing release.
|
|
712
|
+
* @beta
|
|
713
|
+
*/
|
|
714
|
+
interface EditReleaseAction extends ReleaseHandle {
|
|
715
|
+
type: 'release.edit';
|
|
716
|
+
patch: PatchOperations;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Publishes all version documents in a release.
|
|
720
|
+
* @beta
|
|
721
|
+
*/
|
|
722
|
+
interface PublishReleaseAction extends ReleaseHandle {
|
|
723
|
+
type: 'release.publish';
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Schedules a release to be published at the given UTC time. Locks the
|
|
727
|
+
* version documents server-side until the release is unscheduled or published.
|
|
728
|
+
* @beta
|
|
729
|
+
*/
|
|
730
|
+
interface ScheduleReleaseAction extends ReleaseHandle {
|
|
731
|
+
type: 'release.schedule';
|
|
732
|
+
publishAt: string;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Unschedules a release that was previously scheduled, returning it to the
|
|
736
|
+
* active editable state.
|
|
737
|
+
* @beta
|
|
738
|
+
*/
|
|
739
|
+
interface UnscheduleReleaseAction extends ReleaseHandle {
|
|
740
|
+
type: 'release.unschedule';
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Archives an active release. Version documents within the release are
|
|
744
|
+
* removed and no longer queryable, though still recoverable through history
|
|
745
|
+
* during the retention period.
|
|
746
|
+
* @beta
|
|
747
|
+
*/
|
|
748
|
+
interface ArchiveReleaseAction extends ReleaseHandle {
|
|
749
|
+
type: 'release.archive';
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Restores an archived release. Only possible during the retention period.
|
|
753
|
+
* @beta
|
|
754
|
+
*/
|
|
755
|
+
interface UnarchiveReleaseAction extends ReleaseHandle {
|
|
756
|
+
type: 'release.unarchive';
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Permanently deletes an archived or published release. To remove an active
|
|
760
|
+
* release, use the archive action first.
|
|
761
|
+
* @beta
|
|
762
|
+
*/
|
|
763
|
+
interface DeleteReleaseAction extends ReleaseHandle {
|
|
764
|
+
type: 'release.delete';
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Union of all release actions that can be dispatched alongside document
|
|
768
|
+
* actions through `applyDocumentActions`.
|
|
769
|
+
* @beta
|
|
770
|
+
*/
|
|
771
|
+
type ReleaseAction = CreateReleaseAction | EditReleaseAction | PublishReleaseAction | ScheduleReleaseAction | UnscheduleReleaseAction | ArchiveReleaseAction | UnarchiveReleaseAction | DeleteReleaseAction;
|
|
772
|
+
/** @beta */
|
|
773
|
+
declare function createRelease(handle: ReleaseHandle, metadata?: ReleaseDocument$1['metadata']): CreateReleaseAction;
|
|
774
|
+
/** @beta */
|
|
775
|
+
declare function editRelease(handle: ReleaseHandle, patch: PatchOperations): EditReleaseAction;
|
|
776
|
+
/** @beta */
|
|
777
|
+
declare function publishRelease(handle: ReleaseHandle): PublishReleaseAction;
|
|
778
|
+
/** @beta */
|
|
779
|
+
declare function scheduleRelease(handle: ReleaseHandle, publishAt: string): ScheduleReleaseAction;
|
|
780
|
+
/** @beta */
|
|
781
|
+
declare function unscheduleRelease(handle: ReleaseHandle): UnscheduleReleaseAction;
|
|
782
|
+
/** @beta */
|
|
783
|
+
declare function archiveRelease(handle: ReleaseHandle): ArchiveReleaseAction;
|
|
784
|
+
/** @beta */
|
|
785
|
+
declare function unarchiveRelease(handle: ReleaseHandle): UnarchiveReleaseAction;
|
|
786
|
+
/** @beta */
|
|
787
|
+
declare function deleteRelease(handle: ReleaseHandle): DeleteReleaseAction;
|
|
788
|
+
/**
|
|
789
|
+
* Split the entire path string on dots "outside" of any brackets.
|
|
790
|
+
*
|
|
791
|
+
* For example:
|
|
792
|
+
* ```
|
|
793
|
+
* "friends[0].name"
|
|
794
|
+
* ```
|
|
795
|
+
*
|
|
796
|
+
* becomes:
|
|
797
|
+
*
|
|
798
|
+
* ```
|
|
799
|
+
* [...ParseSegment<"friends[0]">, ...ParseSegment<"name">]
|
|
800
|
+
* ```
|
|
801
|
+
*
|
|
802
|
+
* (We use a simple recursion that splits on the first dot.)
|
|
803
|
+
*/
|
|
804
|
+
type PathParts<TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? [Head, ...PathParts<Tail>] : TPath extends '' ? [] : [TPath];
|
|
805
|
+
/**
|
|
806
|
+
* Given a type T and an array of "access keys" Parts, recursively index into T.
|
|
807
|
+
*
|
|
808
|
+
* If a part is a key, it looks up that property.
|
|
809
|
+
* If T is an array and the part is a number, it "indexes" into the element type.
|
|
810
|
+
*/
|
|
811
|
+
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
|
|
812
|
+
TTail extends readonly (string | number)[] ? TTail : []> : never;
|
|
813
|
+
/**
|
|
814
|
+
* Given a document type TDocument and a JSON Match path string TPath,
|
|
815
|
+
* compute the type found at that path.
|
|
816
|
+
* @beta
|
|
817
|
+
*/
|
|
818
|
+
type JsonMatch<TDocument, TPath extends string> = DeepGet<TDocument, PathParts<TPath>>;
|
|
819
|
+
/**
|
|
820
|
+
* Represents a set of document that will go into `applyMutations`. Before
|
|
821
|
+
* applying a mutation, it's expected that all relevant documents that the
|
|
822
|
+
* mutations affect are included, including those that do not exist yet.
|
|
823
|
+
* Documents that don't exist have a `null` value.
|
|
824
|
+
*/
|
|
825
|
+
type DocumentSet<TDocument extends SanityDocument$2 = SanityDocument$2> = { [TDocumentId in string]?: TDocument | null };
|
|
826
|
+
type Grant = 'read' | 'update' | 'create' | 'history';
|
|
827
|
+
/** @beta */
|
|
828
|
+
interface PermissionDeniedReason {
|
|
829
|
+
type: 'precondition' | 'access';
|
|
830
|
+
message: string;
|
|
831
|
+
documentId?: string;
|
|
832
|
+
}
|
|
833
|
+
/** @beta */
|
|
834
|
+
type DocumentPermissionsResult = {
|
|
835
|
+
allowed: false;
|
|
836
|
+
message: string;
|
|
837
|
+
reasons: PermissionDeniedReason[];
|
|
838
|
+
} | {
|
|
839
|
+
allowed: true;
|
|
840
|
+
message?: undefined;
|
|
841
|
+
reasons?: undefined;
|
|
842
|
+
};
|
|
843
|
+
interface SharedListener {
|
|
844
|
+
events: Observable<ListenEvent<SanityDocument$1>>;
|
|
845
|
+
dispose: () => void;
|
|
846
|
+
}
|
|
847
|
+
interface DocumentStoreState {
|
|
848
|
+
documentStates: { [TDocumentId in string]?: DocumentState };
|
|
849
|
+
queued: QueuedTransaction[];
|
|
850
|
+
applied: AppliedTransaction[];
|
|
851
|
+
outgoing?: OutgoingTransaction;
|
|
852
|
+
grants?: Record<Grant, ExprNode>;
|
|
853
|
+
/**
|
|
854
|
+
* The current user's identity (their user ID).
|
|
855
|
+
*/
|
|
856
|
+
identity?: string;
|
|
857
|
+
error?: unknown;
|
|
858
|
+
sharedListener: SharedListener;
|
|
859
|
+
fetchDocument: (documentId: string) => Observable<SanityDocument$3 | null>;
|
|
860
|
+
events: Subject<DocumentEvent>;
|
|
861
|
+
}
|
|
862
|
+
interface DocumentState {
|
|
863
|
+
id: string;
|
|
864
|
+
/**
|
|
865
|
+
* the "remote" local copy that matches the server. represents the last known
|
|
866
|
+
* server state. this gets updated every time we confirm remote patches
|
|
867
|
+
*/
|
|
868
|
+
remote?: SanityDocument$3 | null;
|
|
869
|
+
/**
|
|
870
|
+
* the current ephemeral working copy that includes local optimistic changes
|
|
871
|
+
* that have not yet been confirmed by the server
|
|
872
|
+
*/
|
|
873
|
+
local?: SanityDocument$3 | null;
|
|
874
|
+
/**
|
|
875
|
+
* the revision that our remote document is at
|
|
876
|
+
*/
|
|
877
|
+
remoteRev?: string | null;
|
|
878
|
+
/**
|
|
879
|
+
* Array of subscription IDs. This document state will be deleted if there are
|
|
880
|
+
* no subscribers.
|
|
881
|
+
*/
|
|
882
|
+
subscriptions: string[];
|
|
883
|
+
/**
|
|
884
|
+
* An object keyed by transaction ID of revisions sent out but that have not
|
|
885
|
+
* yet been verified yet. When an applied transaction is transitioned to an
|
|
886
|
+
* outgoing transaction, it also adds unverified revisions for each document
|
|
887
|
+
* that is part of that outgoing transaction. Transactions are submitted to
|
|
888
|
+
* the server with a locally generated transaction ID. This way we can observe
|
|
889
|
+
* when our transaction comes back through the shared listener. Each listener
|
|
890
|
+
* event that comes back contains a `previousRev`. If we see our own
|
|
891
|
+
* transaction with a different `previousRev` than expected, we can rebase our
|
|
892
|
+
* local transactions on top of this new remote.
|
|
893
|
+
*/
|
|
894
|
+
unverifiedRevisions?: { [TTransactionId in string]?: UnverifiedDocumentRevision };
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* @beta
|
|
898
|
+
* Options for specifying a document and optionally a path within it.
|
|
899
|
+
*/
|
|
900
|
+
interface DocumentOptions<TPath extends string | undefined = undefined, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
901
|
+
path?: TPath;
|
|
902
|
+
}
|
|
903
|
+
/** @beta */
|
|
904
|
+
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>;
|
|
905
|
+
/** @beta */
|
|
906
|
+
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>;
|
|
907
|
+
/** @beta */
|
|
908
|
+
declare function getDocumentState<TData>(instance: SanityInstance, options: DocumentOptions<string | undefined>): StateSource<TData | undefined | null>;
|
|
909
|
+
/** @beta */
|
|
910
|
+
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>;
|
|
911
|
+
/** @beta */
|
|
912
|
+
declare function resolveDocument<TData extends SanityDocument$3>(instance: SanityInstance, docHandle: DocumentHandle<string, string, string>): Promise<TData | null>;
|
|
913
|
+
/** @beta */
|
|
914
|
+
declare const getDocumentSyncStatus: BoundStoreAction<DocumentStoreState, [doc: DocumentHandle<string, string, string>], StateSource<boolean | undefined>>;
|
|
915
|
+
type PermissionsStateOptions = {
|
|
916
|
+
resource?: DocumentResource;
|
|
917
|
+
actions: DocumentAction[];
|
|
918
|
+
};
|
|
919
|
+
/** @beta */
|
|
920
|
+
declare const getPermissionsState: BoundStoreAction<DocumentStoreState, [PermissionsStateOptions], StateSource<DocumentPermissionsResult>>;
|
|
921
|
+
/** @beta */
|
|
922
|
+
declare const resolvePermissions: BoundStoreAction<DocumentStoreState, [options: PermissionsStateOptions], Promise<DocumentPermissionsResult>>;
|
|
923
|
+
/** @beta */
|
|
924
|
+
declare const subscribeDocumentEvents: BoundStoreAction<DocumentStoreState, [options: {
|
|
925
|
+
resource?: DocumentResource;
|
|
926
|
+
eventHandler: (e: DocumentEvent) => void;
|
|
927
|
+
}], () => void>;
|
|
928
|
+
type ActionMap = {
|
|
929
|
+
create: 'sanity.action.document.version.create';
|
|
930
|
+
discard: 'sanity.action.document.version.discard';
|
|
931
|
+
unpublish: 'sanity.action.document.unpublish';
|
|
932
|
+
delete: 'sanity.action.document.delete';
|
|
933
|
+
edit: 'sanity.action.document.edit';
|
|
934
|
+
publish: 'sanity.action.document.publish';
|
|
935
|
+
releaseCreate: 'sanity.action.release.create';
|
|
936
|
+
releaseEdit: 'sanity.action.release.edit';
|
|
937
|
+
releasePublish: 'sanity.action.release.publish';
|
|
938
|
+
releaseSchedule: 'sanity.action.release.schedule';
|
|
939
|
+
releaseUnschedule: 'sanity.action.release.unschedule';
|
|
940
|
+
releaseArchive: 'sanity.action.release.archive';
|
|
941
|
+
releaseUnarchive: 'sanity.action.release.unarchive';
|
|
942
|
+
releaseDelete: 'sanity.action.release.delete';
|
|
943
|
+
};
|
|
944
|
+
type OptimisticLock = {
|
|
945
|
+
ifDraftRevisionId?: string;
|
|
946
|
+
ifPublishedRevisionId?: string;
|
|
947
|
+
};
|
|
948
|
+
interface ReleaseMetadataPayload {
|
|
949
|
+
title?: string;
|
|
950
|
+
description?: string;
|
|
951
|
+
intendedPublishAt?: string;
|
|
952
|
+
releaseType?: 'asap' | 'scheduled' | 'undecided';
|
|
953
|
+
cardinality?: 'one' | 'many';
|
|
954
|
+
}
|
|
955
|
+
type HttpAction = {
|
|
956
|
+
actionType: ActionMap['create'];
|
|
957
|
+
publishedId: string;
|
|
958
|
+
attributes: SanityDocumentLike;
|
|
959
|
+
} | {
|
|
960
|
+
actionType: ActionMap['discard'];
|
|
961
|
+
versionId: string;
|
|
962
|
+
purge?: boolean;
|
|
963
|
+
} | {
|
|
964
|
+
actionType: ActionMap['unpublish'];
|
|
965
|
+
draftId: string;
|
|
966
|
+
publishedId: string;
|
|
967
|
+
} | {
|
|
968
|
+
actionType: ActionMap['delete'];
|
|
969
|
+
publishedId: string;
|
|
970
|
+
includeDrafts?: string[];
|
|
971
|
+
} | {
|
|
972
|
+
actionType: ActionMap['edit'];
|
|
973
|
+
draftId: string;
|
|
974
|
+
publishedId: string;
|
|
975
|
+
patch: PatchOperations;
|
|
976
|
+
} | ({
|
|
977
|
+
actionType: ActionMap['publish'];
|
|
978
|
+
draftId: string;
|
|
979
|
+
publishedId: string;
|
|
980
|
+
} & OptimisticLock) | {
|
|
981
|
+
actionType: ActionMap['releaseCreate'];
|
|
982
|
+
releaseId: string;
|
|
983
|
+
metadata?: ReleaseMetadataPayload;
|
|
984
|
+
} | {
|
|
985
|
+
actionType: ActionMap['releaseEdit'];
|
|
986
|
+
releaseId: string;
|
|
987
|
+
patch: PatchOperations;
|
|
988
|
+
} | {
|
|
989
|
+
actionType: ActionMap['releasePublish'];
|
|
990
|
+
releaseId: string;
|
|
991
|
+
} | {
|
|
992
|
+
actionType: ActionMap['releaseSchedule'];
|
|
993
|
+
releaseId: string;
|
|
994
|
+
publishAt: string;
|
|
995
|
+
} | {
|
|
996
|
+
actionType: ActionMap['releaseUnschedule'];
|
|
997
|
+
releaseId: string;
|
|
998
|
+
} | {
|
|
999
|
+
actionType: ActionMap['releaseArchive'];
|
|
1000
|
+
releaseId: string;
|
|
1001
|
+
} | {
|
|
1002
|
+
actionType: ActionMap['releaseUnarchive'];
|
|
1003
|
+
releaseId: string;
|
|
1004
|
+
} | {
|
|
1005
|
+
actionType: ActionMap['releaseDelete'];
|
|
1006
|
+
releaseId: string;
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* Represents a transaction that is queued to be applied but has not yet been
|
|
1010
|
+
* applied. A transaction will remain in a queued state until all required
|
|
1011
|
+
* documents for the transactions are available locally.
|
|
1012
|
+
*/
|
|
1013
|
+
interface QueuedTransaction {
|
|
1014
|
+
/**
|
|
1015
|
+
* the ID of this transaction. this is generated client-side.
|
|
1016
|
+
*/
|
|
1017
|
+
transactionId: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* the high-level actions associated with this transaction. note that these
|
|
1020
|
+
* actions don't mention draft IDs and is meant to abstract away the draft
|
|
1021
|
+
* model from users.
|
|
1022
|
+
*/
|
|
1023
|
+
actions: Action[];
|
|
1024
|
+
/**
|
|
1025
|
+
* An optional flag set to disable this transaction from being batched with
|
|
1026
|
+
* other transactions.
|
|
1027
|
+
*/
|
|
1028
|
+
disableBatching?: boolean;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Represents a transaction that has been applied locally but has not been
|
|
1032
|
+
* committed/transitioned-to-outgoing. These transactions are visible to the
|
|
1033
|
+
* user but may be rebased upon a new working document set. Applied transactions
|
|
1034
|
+
* also contain the resulting `outgoingActions` that will be submitted to
|
|
1035
|
+
* Content Lake. These `outgoingActions` depend on the state of the working
|
|
1036
|
+
* documents so they are recomputed on rebase and are only relevant to applied
|
|
1037
|
+
* actions (we cannot compute `outgoingActions` for queued transactions because
|
|
1038
|
+
* we haven't resolved the set of documents the actions are dependent on yet).
|
|
1039
|
+
*
|
|
1040
|
+
* In order to support better conflict resolution, the original `previous` set
|
|
1041
|
+
* is saved as the `base` set.
|
|
1042
|
+
*/
|
|
1043
|
+
interface AppliedTransaction extends QueuedTransaction {
|
|
1044
|
+
/**
|
|
1045
|
+
* the resulting set of documents after the actions have been applied
|
|
1046
|
+
*/
|
|
1047
|
+
working: DocumentSet;
|
|
1048
|
+
/**
|
|
1049
|
+
* the previous set of documents before the action was applied
|
|
1050
|
+
*/
|
|
1051
|
+
previous: DocumentSet;
|
|
1052
|
+
/**
|
|
1053
|
+
* the original `previous` document set captured when this action was
|
|
1054
|
+
* originally applied. this is used as a reference point to do a 3-way merge
|
|
1055
|
+
* if this applied transaction ever needs to be reapplied on a different
|
|
1056
|
+
* set of documents.
|
|
1057
|
+
*/
|
|
1058
|
+
base: DocumentSet;
|
|
1059
|
+
/**
|
|
1060
|
+
* the `_rev`s from `previous` document set
|
|
1061
|
+
*/
|
|
1062
|
+
previousRevs: { [TDocumentId in string]?: string };
|
|
1063
|
+
/**
|
|
1064
|
+
* a timestamp for when this transaction was applied locally
|
|
1065
|
+
*/
|
|
1066
|
+
timestamp: string;
|
|
1067
|
+
/**
|
|
1068
|
+
* the resulting HTTP actions derived from the state of the `working` document
|
|
1069
|
+
* set. these are sent to Content Lake as-is when this transaction is batched
|
|
1070
|
+
* and transitioned into an outgoing transaction.
|
|
1071
|
+
*/
|
|
1072
|
+
outgoingActions: HttpAction[];
|
|
1073
|
+
/**
|
|
1074
|
+
* similar to `outgoingActions` but comprised of mutations instead of actions.
|
|
1075
|
+
* Useful for debugging, and is also used by liveEdit documents to send mutations,
|
|
1076
|
+
* since they can't use the Actions API which is pretty dependent on the draft model.
|
|
1077
|
+
*/
|
|
1078
|
+
outgoingMutations: Mutation[];
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Represents a set of applied transactions batched into a single outgoing
|
|
1082
|
+
* transaction. An outgoing transaction is the result of batching many applied
|
|
1083
|
+
* actions. An outgoing transaction may be reverted locally if the server
|
|
1084
|
+
* does not accept it.
|
|
1085
|
+
*/
|
|
1086
|
+
interface OutgoingTransaction extends AppliedTransaction {
|
|
1087
|
+
disableBatching: boolean;
|
|
1088
|
+
batchedTransactionIds: string[];
|
|
1089
|
+
}
|
|
1090
|
+
interface UnverifiedDocumentRevision {
|
|
1091
|
+
transactionId: string;
|
|
1092
|
+
documentId: string;
|
|
1093
|
+
previousRev: string | undefined;
|
|
1094
|
+
timestamp: string;
|
|
1095
|
+
}
|
|
1096
|
+
/** @beta Response body from submitting an outgoing transaction (actions or mutations API). */
|
|
1097
|
+
type DocumentTransactionSubmissionResult = Awaited<ReturnType<SanityClient['action']>> | MultipleMutationResult;
|
|
1098
|
+
/** @beta */
|
|
1099
|
+
type DocumentEvent = ActionErrorEvent | TransactionRevertedEvent | TransactionAcceptedEvent | DocumentRebaseErrorEvent | DocumentEditedEvent | DocumentCreatedEvent | DocumentDeletedEvent | DocumentPublishedEvent | DocumentUnpublishedEvent | DocumentDiscardedEvent;
|
|
1100
|
+
/**
|
|
1101
|
+
* @beta
|
|
1102
|
+
* Event emitted when a precondition to applying an action fails.
|
|
1103
|
+
* (For example: when trying to edit a document that no longer exists.)
|
|
1104
|
+
*/
|
|
1105
|
+
interface ActionErrorEvent {
|
|
1106
|
+
type: 'error';
|
|
1107
|
+
documentId: string;
|
|
1108
|
+
transactionId: string;
|
|
1109
|
+
message: string;
|
|
1110
|
+
error: unknown;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* @beta
|
|
1114
|
+
* Event emitted when a transaction is accepted.
|
|
1115
|
+
*/
|
|
1116
|
+
interface TransactionAcceptedEvent {
|
|
1117
|
+
type: 'accepted';
|
|
1118
|
+
outgoing: OutgoingTransaction;
|
|
1119
|
+
result: DocumentTransactionSubmissionResult;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* @beta
|
|
1123
|
+
* Event emitted when a transaction is reverted.
|
|
1124
|
+
*/
|
|
1125
|
+
interface TransactionRevertedEvent {
|
|
1126
|
+
type: 'reverted';
|
|
1127
|
+
message: string;
|
|
1128
|
+
error: unknown;
|
|
1129
|
+
outgoing: OutgoingTransaction;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* @beta
|
|
1133
|
+
* Event emitted when an attempt to apply local changes to a modified remote document fails.
|
|
1134
|
+
*/
|
|
1135
|
+
interface DocumentRebaseErrorEvent {
|
|
1136
|
+
type: 'rebase-error';
|
|
1137
|
+
documentId: string;
|
|
1138
|
+
transactionId: string;
|
|
1139
|
+
message: string;
|
|
1140
|
+
error: unknown;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* @beta
|
|
1144
|
+
* Event emitted when a document is edited.
|
|
1145
|
+
*/
|
|
1146
|
+
interface DocumentEditedEvent {
|
|
1147
|
+
type: 'edited';
|
|
1148
|
+
documentId: string;
|
|
1149
|
+
outgoing: OutgoingTransaction;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* @beta
|
|
1153
|
+
* Event emitted when a document is created.
|
|
1154
|
+
*/
|
|
1155
|
+
interface DocumentCreatedEvent {
|
|
1156
|
+
type: 'created';
|
|
1157
|
+
documentId: string;
|
|
1158
|
+
outgoing: OutgoingTransaction;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* @beta
|
|
1162
|
+
* Event emitted when a document is deleted.
|
|
1163
|
+
*/
|
|
1164
|
+
interface DocumentDeletedEvent {
|
|
1165
|
+
type: 'deleted';
|
|
1166
|
+
documentId: string;
|
|
1167
|
+
outgoing: OutgoingTransaction;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* @beta
|
|
1171
|
+
* Event emitted when a document is published.
|
|
1172
|
+
*/
|
|
1173
|
+
interface DocumentPublishedEvent {
|
|
1174
|
+
type: 'published';
|
|
1175
|
+
documentId: string;
|
|
1176
|
+
outgoing: OutgoingTransaction;
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* @beta
|
|
1180
|
+
* Event emitted when a document is unpublished.
|
|
1181
|
+
*/
|
|
1182
|
+
interface DocumentUnpublishedEvent {
|
|
1183
|
+
type: 'unpublished';
|
|
1184
|
+
documentId: string;
|
|
1185
|
+
outgoing: OutgoingTransaction;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* @beta
|
|
1189
|
+
* Event emitted when a document version is discarded.
|
|
1190
|
+
*/
|
|
1191
|
+
interface DocumentDiscardedEvent {
|
|
1192
|
+
type: 'discarded';
|
|
1193
|
+
documentId: string;
|
|
1194
|
+
outgoing: OutgoingTransaction;
|
|
1195
|
+
}
|
|
1196
|
+
/** @beta */
|
|
1197
|
+
interface ActionsResult<TDocument extends SanityDocument$3 = SanityDocument$3> {
|
|
1198
|
+
transactionId: string;
|
|
1199
|
+
documents: DocumentSet<TDocument>;
|
|
1200
|
+
previous: DocumentSet<TDocument>;
|
|
1201
|
+
previousRevs: {
|
|
1202
|
+
[documentId: string]: string | undefined;
|
|
1203
|
+
};
|
|
1204
|
+
appeared: string[];
|
|
1205
|
+
updated: string[];
|
|
1206
|
+
disappeared: string[];
|
|
1207
|
+
submitted: () => Promise<DocumentTransactionSubmissionResult>;
|
|
1208
|
+
}
|
|
1209
|
+
/** @beta */
|
|
1210
|
+
interface ApplyDocumentActionsOptions {
|
|
1211
|
+
/**
|
|
1212
|
+
* List of actions to apply. Accepts both document actions and release
|
|
1213
|
+
* lifecycle actions because they share the same transaction pipeline.
|
|
1214
|
+
*/
|
|
1215
|
+
actions: Action[];
|
|
1216
|
+
/**
|
|
1217
|
+
* The resource to which the documents being acted on belong.
|
|
1218
|
+
*/
|
|
1219
|
+
resource?: DocumentResource;
|
|
1220
|
+
/**
|
|
1221
|
+
* Optionally provide an ID to be used as this transaction ID
|
|
1222
|
+
*/
|
|
1223
|
+
transactionId?: string;
|
|
1224
|
+
/**
|
|
1225
|
+
* Set this to true to prevent this action from being batched with others.
|
|
1226
|
+
*/
|
|
1227
|
+
disableBatching?: boolean;
|
|
1228
|
+
}
|
|
1229
|
+
/** @beta */
|
|
1230
|
+
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}`>>>;
|
|
1231
|
+
/** @beta */
|
|
1232
|
+
declare function applyDocumentActions(instance: SanityInstance, options: ApplyDocumentActionsOptions): Promise<ActionsResult>;
|
|
1233
|
+
/**
|
|
1234
|
+
* Returns the full release document ID for the given release name.
|
|
1235
|
+
* e.g. `getReleaseDocumentId('my-release') === '_.releases.my-release'`
|
|
1236
|
+
* @beta
|
|
1237
|
+
*/
|
|
1238
|
+
declare function getReleaseDocumentId(releaseId: string): string;
|
|
1239
|
+
/**
|
|
1240
|
+
* @public
|
|
1241
|
+
*/
|
|
1242
|
+
interface FavoriteStatusResponse {
|
|
1243
|
+
isFavorited: boolean;
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* @public
|
|
1247
|
+
*/
|
|
1248
|
+
interface FavoriteDocumentContext extends DocumentHandle {
|
|
1249
|
+
resourceId: string;
|
|
1250
|
+
resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource$1['type'];
|
|
1251
|
+
schemaName?: string;
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Gets a StateSource for the favorite status of a document.
|
|
1255
|
+
* @param instance - The Sanity instance.
|
|
1256
|
+
* @param context - The document context including ID, type, and resource information.
|
|
1257
|
+
* @returns A StateSource emitting `{ isFavorited: boolean }`.
|
|
1258
|
+
* @public
|
|
1259
|
+
*/
|
|
1260
|
+
declare const getFavoritesState: BoundStoreAction<import("../_exports").FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], import("../_exports").StateSource<FavoriteStatusResponse | undefined>>;
|
|
1261
|
+
/**
|
|
1262
|
+
* Resolves the favorite status for a document.
|
|
1263
|
+
* @param instance - The Sanity instance.
|
|
1264
|
+
* @param context - The document context including ID, type, and resource information.
|
|
1265
|
+
* @returns A Promise resolving to `{ isFavorited: boolean }`.
|
|
1266
|
+
* @public
|
|
1267
|
+
*/
|
|
1268
|
+
declare const resolveFavoritesState: BoundStoreAction<import("../_exports").FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], Promise<FavoriteStatusResponse>>;
|
|
1269
|
+
/** @public */
|
|
1270
|
+
interface OrganizationMember {
|
|
1271
|
+
sanityUserId: string;
|
|
1272
|
+
isCurrentUser: boolean;
|
|
1273
|
+
user: {
|
|
1274
|
+
id: string;
|
|
1275
|
+
displayName: string;
|
|
1276
|
+
familyName: string;
|
|
1277
|
+
givenName: string;
|
|
1278
|
+
middleName: string | null;
|
|
1279
|
+
imageUrl: string | null;
|
|
1280
|
+
email: string;
|
|
1281
|
+
loginProvider: string;
|
|
1282
|
+
};
|
|
1283
|
+
roles: Array<{
|
|
1284
|
+
name: string;
|
|
1285
|
+
title: string;
|
|
1286
|
+
description?: string;
|
|
1287
|
+
}>;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* The base fields returned from `/organizations/<id>` for every organization.
|
|
1291
|
+
* @public
|
|
1292
|
+
*/
|
|
1293
|
+
interface OrganizationBase {
|
|
1294
|
+
id: string;
|
|
1295
|
+
name: string;
|
|
1296
|
+
slug: string | null;
|
|
1297
|
+
createdAt: string;
|
|
1298
|
+
createdByUserId: string;
|
|
1299
|
+
updatedAt: string;
|
|
1300
|
+
deletedAt: string | null;
|
|
1301
|
+
dashboardStatus: 'enabled' | 'disabled';
|
|
1302
|
+
aiFeaturesStatus: 'enabled' | 'disabled';
|
|
1303
|
+
mediaLibraryStatus: 'enabled' | 'disabled';
|
|
1304
|
+
requestAccessStatus: 'allowed' | 'disabled';
|
|
1305
|
+
telemetryConsentStatus: 'allowed' | 'msa_denied' | 'customer_denied';
|
|
1306
|
+
oauthAppsStatus: 'allowed' | 'blocked';
|
|
1307
|
+
defaultRoleName: string;
|
|
1308
|
+
domains: string[] | null;
|
|
1309
|
+
}
|
|
1310
|
+
/** @public */
|
|
1311
|
+
interface OrganizationOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> {
|
|
1312
|
+
includeMembers?: IncludeMembers;
|
|
1313
|
+
includeFeatures?: IncludeFeatures;
|
|
1314
|
+
organizationId: string;
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* An `Organization` with `members` and/or `features` conditionally included
|
|
1318
|
+
* based on the query options used to fetch it.
|
|
1319
|
+
* @public
|
|
1320
|
+
*/
|
|
1321
|
+
type Organization<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = OrganizationBase & (boolean extends IncludeMembers ? {
|
|
1322
|
+
members?: OrganizationMember[];
|
|
1323
|
+
} : IncludeMembers extends true ? {
|
|
1324
|
+
members: OrganizationMember[];
|
|
1325
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1326
|
+
features?: string[];
|
|
1327
|
+
} : IncludeFeatures extends true ? {
|
|
1328
|
+
features: string[];
|
|
1329
|
+
} : unknown);
|
|
1330
|
+
/**
|
|
1331
|
+
* Public signature for the organization state source. The conditional generics
|
|
1332
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
1333
|
+
* and assign the (already-correct) runtime function to it.
|
|
1334
|
+
*/
|
|
1335
|
+
type GetOrganizationState = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => StateSource<Organization<IncludeMembers, IncludeFeatures> | undefined>;
|
|
1336
|
+
type ResolveOrganization = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => Promise<Organization<IncludeMembers, IncludeFeatures>>;
|
|
1337
|
+
/** @public */
|
|
1338
|
+
declare const getOrganizationState: GetOrganizationState;
|
|
1339
|
+
/** @public */
|
|
1340
|
+
declare const resolveOrganization: ResolveOrganization;
|
|
1341
|
+
/**
|
|
1342
|
+
* The list shape returned from `/organizations`, with `members` and/or
|
|
1343
|
+
* `features` conditionally included based on the query options used.
|
|
1344
|
+
* @public
|
|
1345
|
+
*/
|
|
1346
|
+
type Organizations<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = (Pick<OrganizationBase, 'id' | 'name' | 'slug' | 'createdAt' | 'updatedAt' | 'defaultRoleName' | 'dashboardStatus' | 'aiFeaturesStatus'> & (boolean extends IncludeMembers ? {
|
|
1347
|
+
members?: OrganizationMember[];
|
|
1348
|
+
} : IncludeMembers extends true ? {
|
|
1349
|
+
members: OrganizationMember[];
|
|
1350
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1351
|
+
features?: string[];
|
|
1352
|
+
} : IncludeFeatures extends true ? {
|
|
1353
|
+
features: string[];
|
|
1354
|
+
} : unknown))[];
|
|
1355
|
+
/** @public */
|
|
1356
|
+
interface OrganizationsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> extends Omit<OrganizationOptions<IncludeMembers, IncludeFeatures>, 'organizationId'> {
|
|
1357
|
+
/**
|
|
1358
|
+
* When `true`, includes organisations the user has access to via
|
|
1359
|
+
* project-level grants, not just direct organisation memberships.
|
|
1360
|
+
*/
|
|
1361
|
+
includeImplicitMemberships?: boolean;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Public signature for the organization state source. The conditional generics
|
|
1365
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
1366
|
+
* and assign the (already-correct) runtime function to it.
|
|
1367
|
+
*/
|
|
1368
|
+
type GetOrganizationsState = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => StateSource<Organizations<IncludeMembers, IncludeFeatures> | undefined>;
|
|
1369
|
+
type ResolveOrganizations = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => Promise<Organizations<IncludeMembers, IncludeFeatures>>;
|
|
1370
|
+
/** @public */
|
|
1371
|
+
declare const getOrganizationsState: GetOrganizationsState;
|
|
1372
|
+
/** @public */
|
|
1373
|
+
declare const resolveOrganizations: ResolveOrganizations;
|
|
1374
|
+
/** @public */
|
|
1375
|
+
interface PresenceLocation {
|
|
1376
|
+
type: 'document';
|
|
1377
|
+
documentId: string;
|
|
1378
|
+
path: string[];
|
|
1379
|
+
lastActiveAt: string;
|
|
1380
|
+
}
|
|
1381
|
+
/** @public */
|
|
1382
|
+
interface UserPresence {
|
|
1383
|
+
user: SanityUser;
|
|
1384
|
+
locations: PresenceLocation[];
|
|
1385
|
+
sessionId: string;
|
|
1386
|
+
}
|
|
1387
|
+
/** @public */
|
|
1388
|
+
type TransportEvent = RollCallEvent | StateEvent | DisconnectEvent;
|
|
1389
|
+
/** @public */
|
|
1390
|
+
interface RollCallEvent {
|
|
1391
|
+
type: 'rollCall';
|
|
1392
|
+
userId: string;
|
|
1393
|
+
sessionId: string;
|
|
1394
|
+
}
|
|
1395
|
+
/** @public */
|
|
1396
|
+
interface StateEvent {
|
|
1397
|
+
type: 'state';
|
|
1398
|
+
userId: string;
|
|
1399
|
+
sessionId: string;
|
|
1400
|
+
timestamp: string;
|
|
1401
|
+
locations: PresenceLocation[];
|
|
1402
|
+
}
|
|
1403
|
+
/** @public */
|
|
1404
|
+
interface DisconnectEvent {
|
|
1405
|
+
type: 'disconnect';
|
|
1406
|
+
userId: string;
|
|
1407
|
+
sessionId: string;
|
|
1408
|
+
timestamp: string;
|
|
1409
|
+
}
|
|
1410
|
+
/** @beta */
|
|
1411
|
+
declare function getPresence(instance: SanityInstance, params?: {
|
|
1412
|
+
resource?: DocumentResource;
|
|
1413
|
+
}): StateSource<UserPresence[]>;
|
|
1414
|
+
/**
|
|
1415
|
+
* @beta
|
|
1416
|
+
* @deprecated This type is deprecated and will be removed in a future release.
|
|
1417
|
+
*/
|
|
1418
|
+
type GetPreviewStateOptions = DocumentHandle;
|
|
1419
|
+
/**
|
|
1420
|
+
* @beta
|
|
1421
|
+
* @deprecated This function is deprecated and will be removed in a future release.
|
|
1422
|
+
*/
|
|
1423
|
+
declare function getPreviewState<TResult extends object>(instance: SanityInstance, options: GetPreviewStateOptions): StateSource<ValuePending<TResult>>;
|
|
1424
|
+
/**
|
|
1425
|
+
* @beta
|
|
1426
|
+
* @deprecated This function is deprecated and will be removed in a future release.
|
|
1427
|
+
*/
|
|
1428
|
+
declare function getPreviewState(instance: SanityInstance, options: GetPreviewStateOptions): StateSource<ValuePending<PreviewValue>>;
|
|
1429
|
+
/**
|
|
1430
|
+
* @beta
|
|
1431
|
+
* @deprecated This type is deprecated and will be removed in a future release.
|
|
1432
|
+
*/
|
|
1433
|
+
type ResolvePreviewOptions = DocumentHandle;
|
|
1434
|
+
/**
|
|
1435
|
+
* @beta
|
|
1436
|
+
* @deprecated This function is deprecated and will be removed in a future release.
|
|
1437
|
+
*/
|
|
1438
|
+
declare function resolvePreview(instance: SanityInstance, options: ResolvePreviewOptions): Promise<ValuePending<PreviewValue>>;
|
|
1439
|
+
/** @public */
|
|
1440
|
+
interface ProjectMemberRole {
|
|
1441
|
+
name: string;
|
|
1442
|
+
title: string;
|
|
1443
|
+
description: string;
|
|
1444
|
+
}
|
|
1445
|
+
/** @public */
|
|
1446
|
+
interface ProjectMember {
|
|
1447
|
+
id: string;
|
|
1448
|
+
createdAt: string;
|
|
1449
|
+
updatedAt: string;
|
|
1450
|
+
isCurrentUser: boolean;
|
|
1451
|
+
isRobot: boolean;
|
|
1452
|
+
roles: ProjectMemberRole[];
|
|
1453
|
+
}
|
|
1454
|
+
/** @public */
|
|
1455
|
+
interface ProjectMetadata {
|
|
1456
|
+
color?: string;
|
|
1457
|
+
externalStudioHost?: string;
|
|
1458
|
+
initialTemplate?: string;
|
|
1459
|
+
cliInitializedAt?: string;
|
|
1460
|
+
integration: 'manage' | 'cli';
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* The base fields returned from `/projects` for every project.
|
|
1464
|
+
* @public
|
|
1465
|
+
*/
|
|
1466
|
+
interface ProjectBase {
|
|
1467
|
+
id: string;
|
|
1468
|
+
displayName: string;
|
|
1469
|
+
studioHost: string | null;
|
|
1470
|
+
organizationId: string;
|
|
1471
|
+
metadata: ProjectMetadata;
|
|
1472
|
+
isBlocked: boolean;
|
|
1473
|
+
isDisabled: boolean;
|
|
1474
|
+
isDisabledByUser: boolean;
|
|
1475
|
+
activityFeedEnabled: boolean;
|
|
1476
|
+
createdAt: string;
|
|
1477
|
+
updatedAt: string;
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* A `Project` with `members` and/or `features` conditionally included
|
|
1481
|
+
* based on the query options used to fetch it.
|
|
1482
|
+
* @public
|
|
1483
|
+
*/
|
|
1484
|
+
type Project<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> = ProjectBase & (boolean extends IncludeMembers ? {
|
|
1485
|
+
members?: ProjectMember[];
|
|
1486
|
+
} : IncludeMembers extends true ? {
|
|
1487
|
+
members: ProjectMember[];
|
|
1488
|
+
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1489
|
+
features?: string[];
|
|
1490
|
+
} : IncludeFeatures extends true ? {
|
|
1491
|
+
features: string[];
|
|
1492
|
+
} : unknown);
|
|
1493
|
+
/** @public */
|
|
1494
|
+
interface ProjectOptions<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> extends ProjectHandle {
|
|
1495
|
+
includeMembers?: IncludeMembers;
|
|
1496
|
+
includeFeatures?: IncludeFeatures;
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Public signature for the project state source. The conditional generics
|
|
1500
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
1501
|
+
* and assign the (already-correct) runtime function to it.
|
|
1502
|
+
*/
|
|
1503
|
+
type GetProjectState = <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => StateSource<Project<IncludeMembers, IncludeFeatures> | undefined>;
|
|
1504
|
+
type ResolveProject = <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => Promise<Project<IncludeMembers, IncludeFeatures>>;
|
|
1505
|
+
/** @public */
|
|
1506
|
+
declare const getProjectState: GetProjectState;
|
|
1507
|
+
/** @public */
|
|
1508
|
+
declare const resolveProject: ResolveProject;
|
|
1509
|
+
interface ProjectionOptions<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1510
|
+
projection: TProjection;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* @beta
|
|
1514
|
+
*/
|
|
1515
|
+
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>;
|
|
1516
|
+
/**
|
|
1517
|
+
* @beta
|
|
1518
|
+
*/
|
|
1519
|
+
declare function getProjectionState<TData extends object>(instance: SanityInstance, options: ProjectionOptions): StateSource<ProjectionValuePending<TData> | undefined>;
|
|
1520
|
+
/**
|
|
1521
|
+
* @beta
|
|
1522
|
+
*/
|
|
1523
|
+
declare function getProjectionState(instance: SanityInstance, options: ProjectionOptions): StateSource<ProjectionValuePending<Record<string, unknown>> | undefined>;
|
|
1524
|
+
/** @beta */
|
|
1525
|
+
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}`>>>;
|
|
1526
|
+
/** @beta */
|
|
1527
|
+
declare function resolveProjection<TData extends object>(instance: SanityInstance, options: ProjectionOptions): Promise<ProjectionValuePending<TData>>;
|
|
1528
|
+
/** @public */
|
|
1529
|
+
interface ProjectsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true> {
|
|
1530
|
+
organizationId?: string;
|
|
1531
|
+
includeMembers?: IncludeMembers;
|
|
1532
|
+
includeFeatures?: IncludeFeatures;
|
|
1533
|
+
onlyExplicitMembership?: boolean;
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Public signature for the projects state source. The conditional generics
|
|
1537
|
+
* cannot flow through `BoundStoreAction`, so we declare the signature here
|
|
1538
|
+
* and assign the (already-correct) runtime function to it.
|
|
1539
|
+
*/
|
|
1540
|
+
type GetProjectsState = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => StateSource<Project<IncludeMembers, IncludeFeatures>[] | undefined>;
|
|
1541
|
+
type ResolveProjects = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => Promise<Project<IncludeMembers, IncludeFeatures>[]>;
|
|
1542
|
+
/** @public */
|
|
1543
|
+
declare const getProjectsState: GetProjectsState;
|
|
1544
|
+
/** @public */
|
|
1545
|
+
declare const resolveProjects: ResolveProjects;
|
|
1546
|
+
/**
|
|
1547
|
+
* Lifecycle states a release document can be in. Mirrors the server's
|
|
1548
|
+
* `ReleaseState`.
|
|
1549
|
+
* @beta
|
|
1550
|
+
*/
|
|
1551
|
+
type ReleaseState = 'active' | 'archiving' | 'unarchiving' | 'archived' | 'published' | 'publishing' | 'scheduled' | 'scheduling';
|
|
1552
|
+
interface ReleasesStoreState {
|
|
1553
|
+
activeReleases?: ReleaseDocument$1[];
|
|
1554
|
+
allReleases?: ReleaseDocument$1[];
|
|
1555
|
+
error?: unknown;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Get the active releases from the store.
|
|
1559
|
+
* @internal
|
|
1560
|
+
*/
|
|
1561
|
+
declare const getActiveReleasesState: (instance: SanityInstance, options?: {
|
|
1562
|
+
resource?: DocumentResource;
|
|
1563
|
+
}) => StateSource<ReleaseDocument$1[] | undefined>;
|
|
1564
|
+
/**
|
|
1565
|
+
* Get every release in the store, including archived and published.
|
|
1566
|
+
* @internal
|
|
1567
|
+
*/
|
|
1568
|
+
declare const getAllReleasesState: (instance: SanityInstance, options?: {
|
|
1569
|
+
resource?: DocumentResource;
|
|
1570
|
+
}) => StateSource<ReleaseDocument$1[] | undefined>;
|
|
1571
|
+
declare const _getPerspectiveStateSelector: StoreAction<ReleasesStoreState, [_?: (PerspectiveHandle & {
|
|
1572
|
+
projectId?: string;
|
|
1573
|
+
dataset?: string;
|
|
1574
|
+
resource?: DocumentResource;
|
|
1575
|
+
}) | undefined], import("../_exports").StateSource<string[] | "previewDrafts" | "published" | "drafts" | "raw" | undefined>, unknown>;
|
|
1576
|
+
type OmitFirst<T extends unknown[]> = T extends [unknown, ...infer R] ? R : never;
|
|
1577
|
+
type SelectorParams = OmitFirst<Parameters<typeof _getPerspectiveStateSelector>>;
|
|
1578
|
+
type BoundGetPerspectiveState = BoundStoreAction<ReleasesStoreState, SelectorParams, ReturnType<typeof _getPerspectiveStateSelector>>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Provides a subscribable state source for a "perspective" for the Sanity client,
|
|
1581
|
+
* which is used to fetch documents as though certain Content Releases are active.
|
|
1582
|
+
*
|
|
1583
|
+
* @param instance - The Sanity instance to get the perspective for
|
|
1584
|
+
* @param options - The options for the perspective -- usually a release name
|
|
1585
|
+
*
|
|
1586
|
+
* @returns A subscribable perspective value, usually a list of applicable release names,
|
|
1587
|
+
* or a single release name / default perspective (such as 'drafts').
|
|
1588
|
+
*
|
|
1589
|
+
* @public
|
|
1590
|
+
*/
|
|
1591
|
+
declare const getPerspectiveState: BoundGetPerspectiveState;
|
|
1592
|
+
/**
|
|
1593
|
+
* Returns the state source for users associated with a specific resource.
|
|
1594
|
+
*
|
|
1595
|
+
* This function returns a state source that represents the current list of users for a given
|
|
1596
|
+
* resource. Subscribing to the state source will instruct the SDK to fetch the users (if not
|
|
1597
|
+
* already fetched) and will load more from this state source as well. When the last subscriber is
|
|
1598
|
+
* removed, the users state is automatically cleaned up from the store after a delay.
|
|
1599
|
+
*
|
|
1600
|
+
* Note: This functionality is for advanced users who want to build their own framework
|
|
1601
|
+
* integrations. Our SDK also provides a React integration for convenient usage.
|
|
1602
|
+
*
|
|
1603
|
+
* @beta
|
|
1604
|
+
*/
|
|
1605
|
+
declare const getUsersState: BoundStoreAction<UsersStoreState, [options?: GetUsersOptions | undefined], import("../_exports").StateSource<{
|
|
1606
|
+
data: SanityUser[];
|
|
1607
|
+
totalCount: number;
|
|
1608
|
+
hasMore: boolean;
|
|
1609
|
+
} | undefined>>;
|
|
1610
|
+
/**
|
|
1611
|
+
* Resolves the users for a specific resource without registering a lasting subscriber.
|
|
1612
|
+
*
|
|
1613
|
+
* This function fetches the users for a given resource and returns a promise that resolves with
|
|
1614
|
+
* the users result. Unlike `getUsersState`, which registers subscribers to keep the data live and
|
|
1615
|
+
* performs automatic cleanup, `resolveUsers` does not track subscribers. This makes it ideal for
|
|
1616
|
+
* use with React Suspense, where the returned promise is thrown to delay rendering until the users
|
|
1617
|
+
* result becomes available. Once the promise resolves, it is expected that a real subscriber will
|
|
1618
|
+
* be added via `getUsersState` to manage ongoing updates.
|
|
1619
|
+
*
|
|
1620
|
+
* Additionally, an optional AbortSignal can be provided to cancel the request and immediately
|
|
1621
|
+
* clear the associated state if there are no active subscribers.
|
|
1622
|
+
*
|
|
1623
|
+
* @beta
|
|
1624
|
+
*/
|
|
1625
|
+
declare const resolveUsers: BoundStoreAction<UsersStoreState, [ResolveUsersOptions], Promise<{
|
|
1626
|
+
data: SanityUser[];
|
|
1627
|
+
totalCount: number;
|
|
1628
|
+
hasMore: boolean;
|
|
1629
|
+
}>>;
|
|
1630
|
+
/**
|
|
1631
|
+
* Loads more users for a specific resource.
|
|
1632
|
+
*
|
|
1633
|
+
* This function triggers a request to fetch the next page of users for a given resource. It
|
|
1634
|
+
* requires that users have already been loaded for the resource (via `resolveUsers` or
|
|
1635
|
+
* `getUsersState`), and that there are more users available to load (as indicated by the `hasMore`
|
|
1636
|
+
* property).
|
|
1637
|
+
*
|
|
1638
|
+
* The function returns a promise that resolves when the next page of users has been loaded.
|
|
1639
|
+
*
|
|
1640
|
+
* @beta
|
|
1641
|
+
*/
|
|
1642
|
+
declare const loadMoreUsers: BoundStoreAction<UsersStoreState, [options?: GetUsersOptions | undefined], Promise<{
|
|
1643
|
+
data: SanityUser[];
|
|
1644
|
+
totalCount: number;
|
|
1645
|
+
hasMore: boolean;
|
|
1646
|
+
}>>;
|
|
1647
|
+
/**
|
|
1648
|
+
* @beta
|
|
1649
|
+
*/
|
|
1650
|
+
declare const getUserState: BoundStoreAction<UsersStoreState, [GetUserOptions], Observable<SanityUser | undefined>>;
|
|
1651
|
+
/**
|
|
1652
|
+
* @beta
|
|
1653
|
+
*/
|
|
1654
|
+
declare const resolveUser: BoundStoreAction<UsersStoreState, [ResolveUserOptions], Promise<SanityUser>>;
|
|
1655
|
+
interface StoreEntry<TParams extends unknown[], TData> {
|
|
1656
|
+
params: TParams;
|
|
1657
|
+
instance: SanityInstance;
|
|
1658
|
+
key: string;
|
|
1659
|
+
data?: TData;
|
|
1660
|
+
error?: unknown;
|
|
1661
|
+
subscriptions: string[];
|
|
1662
|
+
lastFetchInitiatedAt?: string;
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Internal helper type
|
|
1666
|
+
* @public
|
|
1667
|
+
*/
|
|
1668
|
+
interface FetcherStoreState<TParams extends unknown[], TData> {
|
|
1669
|
+
stateByParams: { [TSerializedKey in string]?: StoreEntry<TParams, TData> };
|
|
1670
|
+
error?: unknown;
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Internal helper type
|
|
1674
|
+
* @public
|
|
1675
|
+
*/
|
|
1676
|
+
interface FetcherStore<TParams extends unknown[], TData> {
|
|
1677
|
+
getState: BoundStoreAction<FetcherStoreState<TParams, TData>, TParams, StateSource<TData | undefined>>;
|
|
1678
|
+
resolveState: BoundStoreAction<FetcherStoreState<TParams, TData>, TParams, Promise<TData>>;
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Filter criteria for intent matching. Can be combined to create more specific intents.
|
|
1682
|
+
*
|
|
1683
|
+
* @example
|
|
1684
|
+
* ```typescript
|
|
1685
|
+
* // matches only geopoints in the travel-project project, production dataset
|
|
1686
|
+
* const filter: IntentFilter = {
|
|
1687
|
+
* projectId: 'travel-project',
|
|
1688
|
+
* dataset: 'production',
|
|
1689
|
+
* types: ['geopoint']
|
|
1690
|
+
* }
|
|
1691
|
+
*
|
|
1692
|
+
* // matches all documents in the travel-project project
|
|
1693
|
+
* const filter: IntentFilter = {
|
|
1694
|
+
* projectId: 'travel-project',
|
|
1695
|
+
* types: ['*']
|
|
1696
|
+
* }
|
|
1697
|
+
*
|
|
1698
|
+
* // matches geopoints in the travel-project production dataset and map pins in all projects in the org
|
|
1699
|
+
* const filters: IntentFilter[] = [
|
|
1700
|
+
* {
|
|
1701
|
+
* projectId: 'travel-project',
|
|
1702
|
+
* dataset: 'production',
|
|
1703
|
+
* types: ['geopoint']
|
|
1704
|
+
* },
|
|
1705
|
+
* {
|
|
1706
|
+
* types: ['map-pin']
|
|
1707
|
+
* }
|
|
1708
|
+
* ]
|
|
1709
|
+
* ```
|
|
1710
|
+
* @public
|
|
1711
|
+
*/
|
|
1712
|
+
interface IntentFilter {
|
|
1713
|
+
/**
|
|
1714
|
+
* Project ID to match against
|
|
1715
|
+
* @remarks When specified, the intent will only match for the specified project.
|
|
1716
|
+
*/
|
|
1717
|
+
projectId?: string;
|
|
1718
|
+
/**
|
|
1719
|
+
* Dataset to match against
|
|
1720
|
+
* @remarks When specified, the intent will only match for the specified dataset. Requires projectId to be specified.
|
|
1721
|
+
*/
|
|
1722
|
+
dataset?: string;
|
|
1723
|
+
/**
|
|
1724
|
+
* Document types that this intent can handle
|
|
1725
|
+
* @remarks This is required for all filters. Use ['*'] to match all document types.
|
|
1726
|
+
*/
|
|
1727
|
+
types: string[];
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Intent definition structure for registering user intents
|
|
1731
|
+
* @public
|
|
1732
|
+
*/
|
|
1733
|
+
interface Intent {
|
|
1734
|
+
/**
|
|
1735
|
+
* Unique identifier for this intent
|
|
1736
|
+
* @remarks Should be unique across all registered intents in an org for proper matching
|
|
1737
|
+
*/
|
|
1738
|
+
id: string;
|
|
1739
|
+
/**
|
|
1740
|
+
* The action that this intent performs
|
|
1741
|
+
* @remarks Examples: "view", "edit", "create", "delete"
|
|
1742
|
+
*/
|
|
1743
|
+
action: 'view' | 'edit' | 'create' | 'delete';
|
|
1744
|
+
/**
|
|
1745
|
+
* Human-readable title for this intent
|
|
1746
|
+
* @remarks Used for display purposes in UI or logs
|
|
1747
|
+
*/
|
|
1748
|
+
title: string;
|
|
1749
|
+
/**
|
|
1750
|
+
* Detailed description of what this intent does
|
|
1751
|
+
* @remarks Helps users understand the purpose and behavior of the intent
|
|
1752
|
+
*/
|
|
1753
|
+
description?: string;
|
|
1754
|
+
/**
|
|
1755
|
+
* Array of filter criteria for intent matching
|
|
1756
|
+
* @remarks At least one filter is required. Use `{types: ['*']}` to match everything
|
|
1757
|
+
*/
|
|
1758
|
+
filters: IntentFilter[];
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Creates a properly typed intent definition for registration with the backend.
|
|
1762
|
+
*
|
|
1763
|
+
* This utility function provides TypeScript support and validation for intent declarations.
|
|
1764
|
+
* It is also used in the CLI if intents are declared as bare objects in an intents file.
|
|
1765
|
+
*
|
|
1766
|
+
* @param intent - The intent definition object
|
|
1767
|
+
* @returns The same intent object with proper typing
|
|
1768
|
+
*
|
|
1769
|
+
* @example
|
|
1770
|
+
* ```typescript
|
|
1771
|
+
* // Specific filter for a document type
|
|
1772
|
+
* const viewGeopointInMapApp = defineIntent({
|
|
1773
|
+
* id: 'viewGeopointInMapApp',
|
|
1774
|
+
* action: 'view',
|
|
1775
|
+
* title: 'View a geopoint in the map app',
|
|
1776
|
+
* description: 'This lets you view a geopoint in the map app',
|
|
1777
|
+
* filters: [
|
|
1778
|
+
* {
|
|
1779
|
+
* projectId: 'travel-project',
|
|
1780
|
+
* dataset: 'production',
|
|
1781
|
+
* types: ['geopoint']
|
|
1782
|
+
* }
|
|
1783
|
+
* ]
|
|
1784
|
+
* })
|
|
1785
|
+
*
|
|
1786
|
+
* export default viewGeopointInMapApp
|
|
1787
|
+
* ```
|
|
1788
|
+
*
|
|
1789
|
+
* If your intent is asynchronous, resolve the promise before defining / returning the intent
|
|
1790
|
+
* ```typescript
|
|
1791
|
+
* async function createAsyncIntent() {
|
|
1792
|
+
* const currentProject = await asyncProjectFunction()
|
|
1793
|
+
* const currentDataset = await asyncDatasetFunction()
|
|
1794
|
+
*
|
|
1795
|
+
* return defineIntent({
|
|
1796
|
+
* id: 'dynamicIntent',
|
|
1797
|
+
* action: 'view',
|
|
1798
|
+
* title: 'Dynamic Intent',
|
|
1799
|
+
* description: 'Intent with dynamically resolved values',
|
|
1800
|
+
* filters: [
|
|
1801
|
+
* {
|
|
1802
|
+
* projectId: currentProject, // Resolved value
|
|
1803
|
+
* dataset: currentDataset, // Resolved value
|
|
1804
|
+
* types: ['document']
|
|
1805
|
+
* }
|
|
1806
|
+
* ]
|
|
1807
|
+
* })
|
|
1808
|
+
* }
|
|
1809
|
+
*
|
|
1810
|
+
* const intent = await createAsyncIntent()
|
|
1811
|
+
* export default intent
|
|
1812
|
+
* ```
|
|
1813
|
+
*
|
|
1814
|
+
* @public
|
|
1815
|
+
*/
|
|
1816
|
+
declare function defineIntent(intent: Intent): Intent;
|
|
1817
|
+
/**
|
|
1818
|
+
* @public
|
|
1819
|
+
* Extracts the project ID from a CorsOriginError message.
|
|
1820
|
+
* @param error - The error to extract the project ID from.
|
|
1821
|
+
* @returns The project ID or null if the error is not a CorsOriginError.
|
|
1822
|
+
*/
|
|
1823
|
+
declare function getCorsErrorProjectId(error: Error): string | null;
|
|
1824
|
+
/**
|
|
1825
|
+
* Returns true when the given error looks like a dynamic-import or
|
|
1826
|
+
* code-split chunk-loading failure.
|
|
1827
|
+
*
|
|
1828
|
+
* These errors typically surface when a user has a tab open against a
|
|
1829
|
+
* previously-deployed version of an app and the JavaScript or CSS chunk
|
|
1830
|
+
* filenames have since changed: a fresh deployment removes the hashed assets
|
|
1831
|
+
* the open tab still references. Detecting them lets the SDK trigger an
|
|
1832
|
+
* automatic reload so the user gets the new build without manual intervention.
|
|
1833
|
+
*
|
|
1834
|
+
* Recognized shapes (webpack ChunkLoadError, Vite "Failed to fetch
|
|
1835
|
+
* dynamically imported module", Firefox "error loading dynamically imported
|
|
1836
|
+
* module", Safari "Importing a module script failed", and Vite "Unable to
|
|
1837
|
+
* preload CSS").
|
|
1838
|
+
*
|
|
1839
|
+
* @param error - The value to inspect. Anything that is not an Error
|
|
1840
|
+
* instance returns false.
|
|
1841
|
+
* @returns True if the error matches a known import/chunk-load failure.
|
|
1842
|
+
*
|
|
1843
|
+
* @public
|
|
1844
|
+
*/
|
|
1845
|
+
declare function isImportError(error: unknown): boolean;
|
|
1846
|
+
/**
|
|
1847
|
+
* This version is provided by pkg-utils at build time
|
|
1848
|
+
* @internal
|
|
1849
|
+
*/
|
|
1850
|
+
declare const CORE_SDK_VERSION: {};
|
|
1851
|
+
/**
|
|
1852
|
+
* @public
|
|
1853
|
+
*/
|
|
1854
|
+
type SanityProject = SanityProject$1;
|
|
1855
|
+
export { 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 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 CurrentUser, type DatasetHandle, type DatasetResource, type DatasetSource, type DeleteDocumentAction, type DeleteReleaseAction, 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 DocumentResource, type DocumentSource, type DocumentTransactionSubmissionResult, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type EditReleaseAction, type ErrorAuthState, type FavoriteStatusResponse, type FetcherStore, type FetcherStoreState, type FrameMessage, type GetPreviewStateOptions, type GetUserOptions, type GetUsersOptions, type InstanceContext, type Intent, type IntentFilter, 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 UserPresence, type UserProfile, type UsersGroupState, type UsersStoreState, type ValidProjection, type ValuePending, type WindowMessage, agentGenerate, agentPatch, agentPrompt, agentTransform, agentTranslate, applyDocumentActions, archiveRelease, configureLogging, createDatasetHandle, createDocument, createDocumentHandle, createDocumentTypeHandle, createGroqSearchFilter, createProjectHandle, createRelease, createSanityInstance, defineIntent, deleteDocument, deleteRelease, 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, getOrganizationState, getOrganizationsState, getPathDepth, getPermissionsState, getPerspectiveState, getPresence, getPreviewState, getProjectState, getProjectionState, getProjectsState, getQueryKey, getQueryState, getReleaseDocumentId, getTokenState, getUserState, getUsersKey, getUsersState, handleAuthCallback, isCanvasResource, isCanvasSource, isDatasetResource, isDatasetSource, isImportError, isMediaLibraryResource, isMediaLibrarySource, isProjectUserNotFoundClientError, isStudioConfig, joinPaths, jsonMatch, loadMoreUsers, logout, observeOrganizationVerificationState, parseQueryKey, parseUsersKey, publishDocument, publishRelease, releaseChannel, releaseNode, resolveDatasets, resolveDocument, resolveFavoritesState, resolveOrganization, resolveOrganizations, resolvePermissions, resolvePreview, resolveProject, resolveProjection, resolveProjects, resolveQuery, resolveUser, resolveUsers, scheduleRelease, setAuthToken, slicePath, stringifyPath, subscribeDocumentEvents, transformProjectionToPreview, unarchiveRelease, unpublishDocument, unscheduleRelease };
|
|
1856
|
+
//# sourceMappingURL=index.d.ts.map
|