@sanity/sdk 3.0.0-rc.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/_exports/_internal.d.ts +71 -3
- package/dist/_exports/_internal.d.ts.map +1 -1
- package/dist/_exports/_internal.js +332 -24
- package/dist/_exports/_internal.js.map +1 -1
- package/dist/_exports/agent.d.ts +65 -0
- package/dist/_exports/agent.d.ts.map +1 -0
- package/dist/_exports/agent.js +71 -0
- package/dist/_exports/agent.js.map +1 -0
- package/dist/_exports/comlink.d.ts +118 -0
- package/dist/_exports/comlink.d.ts.map +1 -0
- package/dist/_exports/comlink.js +69 -0
- package/dist/_exports/comlink.js.map +1 -0
- package/dist/authStore-C0o1NOxW.d.ts +3165 -0
- package/dist/authStore-C0o1NOxW.d.ts.map +1 -0
- package/dist/authStore-CtE9bLHW.js +754 -0
- package/dist/authStore-CtE9bLHW.js.map +1 -0
- package/dist/clientStore-BtE2-q2i.js +90 -0
- package/dist/clientStore-BtE2-q2i.js.map +1 -0
- package/dist/createSanityInstance-DUI1bGIg.d.ts +278 -0
- package/dist/createSanityInstance-DUI1bGIg.d.ts.map +1 -0
- package/dist/createStateSourceAction-BOKtqFNm.js +300 -0
- package/dist/createStateSourceAction-BOKtqFNm.js.map +1 -0
- package/dist/getEnv-D5RGkQLu.js +8 -0
- package/dist/getEnv-D5RGkQLu.js.map +1 -0
- package/dist/getNodeState-CR3__B2D.js +67 -0
- package/dist/getNodeState-CR3__B2D.js.map +1 -0
- package/dist/index.d.ts +3 -2335
- package/dist/index.js +4048 -3878
- package/dist/index.js.map +1 -1
- package/dist/logger-DAtJb5RQ.js +173 -0
- package/dist/logger-DAtJb5RQ.js.map +1 -0
- package/dist/object-CxXlSVg7.js +83 -0
- package/dist/object-CxXlSVg7.js.map +1 -0
- package/dist/queryStore-C7yMHPUI.js +1346 -0
- package/dist/queryStore-C7yMHPUI.js.map +1 -0
- package/dist/rolldown-runtime-vyAXikos.js +9 -0
- package/dist/setCleanupTimeout-BiM6q1KF.js +31 -0
- package/dist/setCleanupTimeout-BiM6q1KF.js.map +1 -0
- package/dist/telemetryManager-UIEiMtC0.js +127 -0
- package/dist/telemetryManager-UIEiMtC0.js.map +1 -0
- package/dist/version-D8RP_Q59.js +9 -0
- package/dist/version-D8RP_Q59.js.map +1 -0
- package/package.json +11 -17
- package/src/_exports/_internal.ts +1 -0
- package/src/_exports/agent.ts +19 -0
- package/src/_exports/comlink.ts +16 -0
- package/src/_exports/index.ts +45 -90
- package/src/applications/applications.test-d.ts +5 -0
- package/src/applications/applications.ts +5 -2
- package/src/auth/authMode.test.ts +0 -25
- package/src/auth/authMode.ts +3 -6
- package/src/auth/authStore.test.ts +1 -1
- package/src/auth/authStore.ts +0 -1
- package/src/comments/addonDatasetStore.test.ts +215 -0
- package/src/comments/addonDatasetStore.ts +249 -0
- package/src/comments/buildCommentThreads.test.ts +83 -0
- package/src/comments/buildCommentThreads.ts +54 -0
- package/src/comments/commentActions.test.ts +540 -0
- package/src/comments/commentActions.ts +555 -0
- package/src/comments/commentFieldPath.test.ts +40 -0
- package/src/comments/commentFieldPath.ts +44 -0
- package/src/comments/commentsConstants.ts +80 -0
- package/src/comments/commentsStore.test.ts +419 -0
- package/src/comments/commentsStore.ts +483 -0
- package/src/comments/normalizeComment.test.ts +116 -0
- package/src/comments/normalizeComment.ts +45 -0
- package/src/comments/observeComments.test.ts +193 -0
- package/src/comments/observeComments.ts +113 -0
- package/src/comments/reducers.test.ts +277 -0
- package/src/comments/reducers.ts +316 -0
- package/src/comments/types.ts +249 -0
- package/src/comments/weakenReferences.test.ts +47 -0
- package/src/comments/weakenReferences.ts +29 -0
- package/src/config/sanityConfig.ts +3 -75
- package/src/datasets/datasets.test.ts +44 -9
- package/src/datasets/datasets.ts +24 -23
- package/src/document/applyDocumentActions.test.ts +8 -12
- package/src/document/documentConstants.ts +17 -0
- package/src/document/documentStore.test.ts +173 -19
- package/src/document/documentStore.ts +36 -5
- package/src/document/patchOperations.test.ts +27 -0
- package/src/document/patchOperations.ts +10 -1
- package/src/document/permissions.test.ts +3 -1
- package/src/document/reducers.test.ts +357 -0
- package/src/document/reducers.ts +125 -27
- package/src/document/util.test.ts +46 -0
- package/src/document/util.ts +37 -1
- package/src/favorites/favorites.test.ts +64 -24
- package/src/favorites/favorites.ts +73 -22
- package/src/installations/installations.test-d.ts +5 -0
- package/src/installations/installations.ts +4 -0
- package/src/presence/bifurTransport.test.ts +155 -3
- package/src/presence/bifurTransport.ts +79 -12
- package/src/presence/paths.test.ts +70 -0
- package/src/presence/paths.ts +41 -0
- package/src/presence/presenceStore.test.ts +822 -2
- package/src/presence/presenceStore.ts +518 -102
- package/src/presence/types.ts +175 -3
- package/src/preview/types.ts +0 -25
- package/src/projection/projectionStore.test.ts +0 -8
- package/src/projection/types.ts +0 -8
- package/src/query/queryStore.ts +7 -6
- package/src/store/createActionBinder.test.ts +51 -29
- package/src/store/createActionBinder.ts +16 -62
- package/src/store/createSanityInstance.test.ts +0 -68
- package/src/store/createSanityInstance.ts +0 -63
- package/src/store/createStateSourceAction.ts +1 -1
- package/src/store/fetcherStore.test.ts +23 -1
- package/src/store/fetcherStore.ts +3 -3
- package/src/users/reducers.test.ts +0 -3
- package/dist/_chunks-dts/createGroqSearchFilter.d.ts +0 -1147
- package/dist/_chunks-dts/createGroqSearchFilter.d.ts.map +0 -1
- package/dist/_chunks-es/_internal.js +0 -134
- package/dist/_chunks-es/_internal.js.map +0 -1
- package/dist/_chunks-es/createGroqSearchFilter.js +0 -1864
- package/dist/_chunks-es/createGroqSearchFilter.js.map +0 -1
- package/dist/_chunks-es/telemetryManager.js +0 -93
- package/dist/_chunks-es/telemetryManager.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/src/applications/userApplications.test.ts +0 -126
- package/src/applications/userApplications.ts +0 -261
- package/src/preview/getPreviewState.test.ts +0 -137
- package/src/preview/getPreviewState.ts +0 -69
- package/src/preview/resolvePreview.test.ts +0 -64
- package/src/preview/resolvePreview.ts +0 -43
- package/src/utils/createFetcherStore.test.ts +0 -171
- package/src/utils/createFetcherStore.ts +0 -284
package/dist/index.d.ts
CHANGED
|
@@ -1,2335 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
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 "@sanity/mutate/_unstable_store";
|
|
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
|
-
/**
|
|
12
|
-
* The resource types the Access API can scope a permission check to.
|
|
13
|
-
*
|
|
14
|
-
* @see https://www.sanity.io/docs/http-reference/access-api
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
type AccessResourceType = 'organization' | 'project' | 'media-library' | 'canvas' | 'dashboard' | 'view';
|
|
18
|
-
/**
|
|
19
|
-
* Fetcher checking whether the current user holds the given permissions on a
|
|
20
|
-
* resource (`GET /access/:resourceType/:resourceId/user-permissions/me/check`),
|
|
21
|
-
* on the shared fetcher cache. Resolves to a map of each requested permission
|
|
22
|
-
* to whether the user has it. The key sorts the permission list, so permission
|
|
23
|
-
* order doesn't create distinct cache entries.
|
|
24
|
-
*
|
|
25
|
-
* @see https://www.sanity.io/docs/http-reference/access-api
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
declare const checkPermissions: Fetcher<[resourceType: AccessResourceType, resourceId: string, permissions: string[]], Record<string, boolean>>;
|
|
29
|
-
/** @alpha */
|
|
30
|
-
type AgentGenerateOptions = Parameters<SanityClient['observable']['agent']['action']['generate']>[0];
|
|
31
|
-
/** @alpha */
|
|
32
|
-
type AgentTransformOptions = Parameters<SanityClient['observable']['agent']['action']['transform']>[0];
|
|
33
|
-
/** @alpha */
|
|
34
|
-
type AgentTranslateOptions = Parameters<SanityClient['observable']['agent']['action']['translate']>[0];
|
|
35
|
-
/** @alpha */
|
|
36
|
-
type AgentPromptOptions = Parameters<SanityClient['agent']['action']['prompt']>[0];
|
|
37
|
-
/** @alpha */
|
|
38
|
-
type AgentPatchOptions = Parameters<SanityClient['agent']['action']['patch']>[0];
|
|
39
|
-
/** @alpha */
|
|
40
|
-
type AgentGenerateResult = Awaited<ReturnType<SanityClient['observable']['agent']['action']['generate']>>;
|
|
41
|
-
/** @alpha */
|
|
42
|
-
type AgentTransformResult = Awaited<ReturnType<SanityClient['observable']['agent']['action']['transform']>>;
|
|
43
|
-
/** @alpha */
|
|
44
|
-
type AgentTranslateResult = Awaited<ReturnType<SanityClient['observable']['agent']['action']['translate']>>;
|
|
45
|
-
/** @alpha */
|
|
46
|
-
type AgentPromptResult = Awaited<ReturnType<SanityClient['agent']['action']['prompt']>>;
|
|
47
|
-
/** @alpha */
|
|
48
|
-
type AgentPatchResult = Awaited<ReturnType<SanityClient['agent']['action']['patch']>>;
|
|
49
|
-
/**
|
|
50
|
-
* Generates a new document using the agent.
|
|
51
|
-
* @param instance - The Sanity instance.
|
|
52
|
-
* @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.
|
|
53
|
-
* @returns An Observable emitting the result of the agent generate action.
|
|
54
|
-
* @alpha
|
|
55
|
-
*/
|
|
56
|
-
declare function agentGenerate(instance: SanityInstance, options: AgentGenerateOptions, resource?: DocumentResource): AgentGenerateResult;
|
|
57
|
-
/**
|
|
58
|
-
* Transforms a document using the agent.
|
|
59
|
-
* @param instance - The Sanity instance.
|
|
60
|
-
* @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.
|
|
61
|
-
* @returns An Observable emitting the result of the agent transform action.
|
|
62
|
-
* @alpha
|
|
63
|
-
*/
|
|
64
|
-
declare function agentTransform(instance: SanityInstance, options: AgentTransformOptions, resource?: DocumentResource): AgentTransformResult;
|
|
65
|
-
/**
|
|
66
|
-
* Translates a document using the agent.
|
|
67
|
-
* @param instance - The Sanity instance.
|
|
68
|
-
* @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.
|
|
69
|
-
* @returns An Observable emitting the result of the agent translate action.
|
|
70
|
-
* @alpha
|
|
71
|
-
*/
|
|
72
|
-
declare function agentTranslate(instance: SanityInstance, options: AgentTranslateOptions, resource?: DocumentResource): AgentTranslateResult;
|
|
73
|
-
/**
|
|
74
|
-
* Prompts the agent using the same instruction template format as the other actions, but returns text or json instead of acting on a document.
|
|
75
|
-
* @param instance - The Sanity instance.
|
|
76
|
-
* @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.
|
|
77
|
-
* @returns An Observable emitting the result of the agent prompt action.
|
|
78
|
-
* @alpha
|
|
79
|
-
*/
|
|
80
|
-
declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptions, resource?: DocumentResource): Observable<AgentPromptResult>;
|
|
81
|
-
/**
|
|
82
|
-
* Patches a document using the agent.
|
|
83
|
-
* @param instance - The Sanity instance.
|
|
84
|
-
* @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.
|
|
85
|
-
* @returns An Observable emitting the result of the agent patch action.
|
|
86
|
-
* @alpha
|
|
87
|
-
*/
|
|
88
|
-
declare function agentPatch(instance: SanityInstance, options: AgentPatchOptions, resource?: DocumentResource): Observable<AgentPatchResult>;
|
|
89
|
-
/**
|
|
90
|
-
* A response field that the API embeds only when its `include` token was
|
|
91
|
-
* requested. Given the full set of tokens `All`, the token `Key` this field
|
|
92
|
-
* maps to, and the tokens actually `Requested`, it resolves to:
|
|
93
|
-
*
|
|
94
|
-
* - `unknown` (field absent) when nothing — or nothing matching `Key` — was requested
|
|
95
|
-
* - `Field` (present, as declared) when a literal request list contains `Key`
|
|
96
|
-
* - `Partial<Field>` (optional) when `Requested` is the wide `All` union, i.e.
|
|
97
|
-
* an `include` array whose members aren't known at the type level
|
|
98
|
-
*
|
|
99
|
-
* Absent arms return `unknown` so they vanish under intersection. Mirrors the
|
|
100
|
-
* `boolean extends Flag` trick the organization/project types use, but for an
|
|
101
|
-
* include-token union rather than a boolean flag.
|
|
102
|
-
*
|
|
103
|
-
* @internal
|
|
104
|
-
*/
|
|
105
|
-
type Included<All extends string, Key extends All, Requested extends All, Field> = [All] extends [Requested] ? Partial<Field> : [Key] extends [Requested] ? Field : unknown;
|
|
106
|
-
/**
|
|
107
|
-
* Whether the requested include tokens intersect a given set — used to decide
|
|
108
|
-
* whether a parent field (e.g. an application's `activeDeployment`) is present,
|
|
109
|
-
* when requesting any of several tokens forces it in.
|
|
110
|
-
*
|
|
111
|
-
* @internal
|
|
112
|
-
*/
|
|
113
|
-
type IncludesAny<Requested extends string, Set extends string> = [Requested & Set] extends [never] ? false : true;
|
|
114
|
-
/**
|
|
115
|
-
* Related data the Applications API can embed in a response. `interfaces`,
|
|
116
|
-
* `workspaces` and `access` are children of the active deployment and are
|
|
117
|
-
* embedded under {@link Application.activeDeployment}; `config.studio` and
|
|
118
|
-
* `config.mfManifest` are embedded under {@link Application.config}.
|
|
119
|
-
*
|
|
120
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
|
-
type ApplicationInclude = 'interfaces' | 'workspaces' | 'access' | 'config.studio' | 'config.mfManifest' | 'activeDeployment';
|
|
124
|
-
/**
|
|
125
|
-
* An interface exposed by a deployment, embedded when `interfaces` is included.
|
|
126
|
-
*
|
|
127
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
interface ApplicationInterface {
|
|
131
|
-
id: string;
|
|
132
|
-
type: 'app' | 'worker' | 'asset_source' | 'panel';
|
|
133
|
-
name: string;
|
|
134
|
-
title: string;
|
|
135
|
-
version: string;
|
|
136
|
-
/** Module federation module ID; resolved from the host mf-manifest at runtime */
|
|
137
|
-
moduleId: string;
|
|
138
|
-
metadata: {
|
|
139
|
-
group?: string;
|
|
140
|
-
priority?: number;
|
|
141
|
-
} | null;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* A studio workspace of a deployment, embedded when `workspaces` is included.
|
|
145
|
-
* Studio applications only.
|
|
146
|
-
*
|
|
147
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
148
|
-
* @public
|
|
149
|
-
*/
|
|
150
|
-
interface ApplicationWorkspace {
|
|
151
|
-
id: string;
|
|
152
|
-
name: string;
|
|
153
|
-
title: string | null;
|
|
154
|
-
subtitle: string | null;
|
|
155
|
-
projectId: string;
|
|
156
|
-
dataset: string;
|
|
157
|
-
schemaDescriptorId: string | null;
|
|
158
|
-
basePath: string | null;
|
|
159
|
-
/** Sanitized SVG icon markup */
|
|
160
|
-
icon: string | null;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* A resource an application accesses, embedded when `access` is included.
|
|
164
|
-
*
|
|
165
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
166
|
-
* @public
|
|
167
|
-
*/
|
|
168
|
-
interface ApplicationAccess {
|
|
169
|
-
id: string;
|
|
170
|
-
resourceType: 'datasets' | 'canvases' | 'dashboards' | 'media-libraries';
|
|
171
|
-
resourceId: string;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Studio configuration, embedded under `config` when `config.studio` is included.
|
|
175
|
-
*
|
|
176
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
177
|
-
* @public
|
|
178
|
-
*/
|
|
179
|
-
interface ApplicationStudioConfig {
|
|
180
|
-
projectId: string;
|
|
181
|
-
/** Release channel (`next`, `stable`, `latest`) or a pinned semver; null if unset */
|
|
182
|
-
autoUpdatingVersion: string | null;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* The active deployment as embedded under {@link Application.activeDeployment}.
|
|
186
|
-
* Its `interfaces`, `workspaces` and `access` children are each present only
|
|
187
|
-
* when the matching {@link ApplicationInclude} token was requested. `workspaces`
|
|
188
|
-
* is omitted (not `null`) for non-studio applications even when requested.
|
|
189
|
-
*
|
|
190
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
191
|
-
* @public
|
|
192
|
-
*/
|
|
193
|
-
type ApplicationDeployment<Include extends ApplicationInclude = never> = {
|
|
194
|
-
id: string;
|
|
195
|
-
applicationId: string;
|
|
196
|
-
size: number | null;
|
|
197
|
-
version: string | null;
|
|
198
|
-
isAutoUpdating: boolean | null;
|
|
199
|
-
isActiveDeployment: boolean;
|
|
200
|
-
deployedBy: string | null;
|
|
201
|
-
createdAt: string;
|
|
202
|
-
updatedAt: string;
|
|
203
|
-
} & Included<ApplicationInclude, 'interfaces', Include, {
|
|
204
|
-
interfaces: ApplicationInterface[];
|
|
205
|
-
}> & Included<ApplicationInclude, 'workspaces', Include, {
|
|
206
|
-
workspaces?: ApplicationWorkspace[];
|
|
207
|
-
}> & Included<ApplicationInclude, 'access', Include, {
|
|
208
|
-
access: ApplicationAccess[];
|
|
209
|
-
}>;
|
|
210
|
-
/**
|
|
211
|
-
* The always-present fields of an org-owned application returned by the
|
|
212
|
-
* Applications API (`/applications`), before any {@link ApplicationInclude}.
|
|
213
|
-
*
|
|
214
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
215
|
-
* @public
|
|
216
|
-
*/
|
|
217
|
-
interface ApplicationBase {
|
|
218
|
-
id: string;
|
|
219
|
-
type: 'studio' | 'coreApp';
|
|
220
|
-
title: string;
|
|
221
|
-
icon: string | null;
|
|
222
|
-
isSingleton: boolean;
|
|
223
|
-
visibility: 'default' | 'unlisted' | 'disabled';
|
|
224
|
-
slug: string | null;
|
|
225
|
-
externalUrl: string | null;
|
|
226
|
-
organizationId: string;
|
|
227
|
-
createdAt: string;
|
|
228
|
-
updatedAt: string;
|
|
229
|
-
}
|
|
230
|
-
type DeploymentToken = 'activeDeployment' | 'interfaces' | 'workspaces' | 'access';
|
|
231
|
-
type ApplicationConfigShape<Include extends ApplicationInclude> = Included<ApplicationInclude, 'config.studio', Include, {
|
|
232
|
-
config: {
|
|
233
|
-
studio: ApplicationStudioConfig;
|
|
234
|
-
};
|
|
235
|
-
}> & Included<ApplicationInclude, 'config.mfManifest', Include, {
|
|
236
|
-
config: {
|
|
237
|
-
mfManifest: unknown;
|
|
238
|
-
};
|
|
239
|
-
}>;
|
|
240
|
-
type ApplicationDeploymentShape<Include extends ApplicationInclude> = [ApplicationInclude] extends [Include] ? {
|
|
241
|
-
activeDeployment?: ApplicationDeployment<Include> | null;
|
|
242
|
-
} : IncludesAny<Include, DeploymentToken> extends true ? {
|
|
243
|
-
activeDeployment: ApplicationDeployment<Include> | null;
|
|
244
|
-
} : unknown;
|
|
245
|
-
/**
|
|
246
|
-
* An org-owned application as returned by the Applications API
|
|
247
|
-
* (`/applications`). `config` and `activeDeployment` (with its
|
|
248
|
-
* `interfaces`/`workspaces`/`access` children) are present only when the
|
|
249
|
-
* corresponding {@link ApplicationInclude} tokens were requested.
|
|
250
|
-
*
|
|
251
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
252
|
-
* @public
|
|
253
|
-
*/
|
|
254
|
-
type Application<Include extends ApplicationInclude = never> = ApplicationBase & ApplicationConfigShape<Include> & ApplicationDeploymentShape<Include>;
|
|
255
|
-
/**
|
|
256
|
-
* Options for listing an organization's applications.
|
|
257
|
-
*
|
|
258
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
259
|
-
* @public
|
|
260
|
-
*/
|
|
261
|
-
interface ApplicationsOptions<Include extends ApplicationInclude = ApplicationInclude> {
|
|
262
|
-
organizationId: string;
|
|
263
|
-
/** Filter by application type */
|
|
264
|
-
type?: string;
|
|
265
|
-
include?: Include[];
|
|
266
|
-
/** Page size (1-100, default 50), or `'none'` to disable pagination */
|
|
267
|
-
limit?: number | 'none';
|
|
268
|
-
/** Cursor from a previous response's `nextCursor` */
|
|
269
|
-
cursor?: string;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* The cursor-paginated envelope returned by `GET /applications`.
|
|
273
|
-
*
|
|
274
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
275
|
-
* @public
|
|
276
|
-
*/
|
|
277
|
-
interface ApplicationsResponse<Include extends ApplicationInclude = never> {
|
|
278
|
-
nextCursor: string | null;
|
|
279
|
-
data: Application<Include>[];
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Fetcher for an organization's applications (`GET /applications`), on the
|
|
283
|
-
* shared fetcher cache.
|
|
284
|
-
*
|
|
285
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
286
|
-
* @internal
|
|
287
|
-
*/
|
|
288
|
-
declare const applications: Fetcher<[options: ApplicationsOptions<ApplicationInclude>], ApplicationsResponse<ApplicationInclude>>;
|
|
289
|
-
/**
|
|
290
|
-
* Fetcher for a single application (`GET /applications/:id`), on the shared
|
|
291
|
-
* fetcher cache. No pre-seeding from {@link applications}: its list keys
|
|
292
|
-
* include the organization, which this fetcher's params can't reconstruct.
|
|
293
|
-
*
|
|
294
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
295
|
-
* @internal
|
|
296
|
-
*/
|
|
297
|
-
declare const application: Fetcher<[applicationId: string, options?: {
|
|
298
|
-
include?: ApplicationInclude[];
|
|
299
|
-
} | undefined], Application<ApplicationInclude>>;
|
|
300
|
-
/**
|
|
301
|
-
* Confirmation returned by the API's soft-delete endpoints.
|
|
302
|
-
*
|
|
303
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
304
|
-
* @internal
|
|
305
|
-
*/
|
|
306
|
-
interface DeletedResult {
|
|
307
|
-
deleted: boolean;
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Dashboard visibility for an application. The same set of values backs a user
|
|
311
|
-
* application's `dashboardStatus`.
|
|
312
|
-
*
|
|
313
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
314
|
-
* @internal
|
|
315
|
-
*/
|
|
316
|
-
type ApplicationVisibility = ApplicationBase['visibility'];
|
|
317
|
-
/**
|
|
318
|
-
* Mutable properties of an application (`PATCH /applications/:id`) — the
|
|
319
|
-
* writable subset of {@link ApplicationBase}, each optional, keyed by id.
|
|
320
|
-
*
|
|
321
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
322
|
-
* @internal
|
|
323
|
-
*/
|
|
324
|
-
type UpdateApplicationInput = {
|
|
325
|
-
applicationId: string;
|
|
326
|
-
} & Partial<Pick<ApplicationBase, 'title' | 'icon' | 'visibility'>>;
|
|
327
|
-
/**
|
|
328
|
-
* Mutation to update an application (`PATCH /applications/:id`). Invalidates the
|
|
329
|
-
* updated application and the list so active entries reconverge on server truth.
|
|
330
|
-
*
|
|
331
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
332
|
-
* @internal
|
|
333
|
-
*/
|
|
334
|
-
declare const updateApplication: (instance: import("../_exports").SanityInstance, input: UpdateApplicationInput) => Promise<MutationResult<ApplicationBase>>;
|
|
335
|
-
/**
|
|
336
|
-
* Input for {@link deleteApplication}.
|
|
337
|
-
*
|
|
338
|
-
* @internal
|
|
339
|
-
*/
|
|
340
|
-
interface DeleteApplicationInput {
|
|
341
|
-
applicationId: string;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Mutation to soft-delete an application (`DELETE /applications/:id`).
|
|
345
|
-
* Invalidates the deleted application and the list.
|
|
346
|
-
*
|
|
347
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
348
|
-
* @internal
|
|
349
|
-
*/
|
|
350
|
-
declare const deleteApplication: (instance: import("../_exports").SanityInstance, input: DeleteApplicationInput) => Promise<MutationResult<DeletedResult>>;
|
|
351
|
-
/**
|
|
352
|
-
* A deployment of a user application, embedded when `activeDeployment` is
|
|
353
|
-
* included on the User Applications API. Distinct from the org Applications
|
|
354
|
-
* API's {@link ApplicationDeployment} summary.
|
|
355
|
-
*
|
|
356
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
357
|
-
* @public
|
|
358
|
-
*/
|
|
359
|
-
interface UserApplicationDeployment {
|
|
360
|
-
id: string;
|
|
361
|
-
version: string | null;
|
|
362
|
-
isActiveDeployment: boolean;
|
|
363
|
-
userApplicationId: string;
|
|
364
|
-
isAutoUpdating: boolean | null;
|
|
365
|
-
size: number | null;
|
|
366
|
-
deployedAt: string;
|
|
367
|
-
deployedBy: string | null;
|
|
368
|
-
createdAt: string;
|
|
369
|
-
updatedAt: string;
|
|
370
|
-
manifest: unknown;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* A user application (deployed studio or custom app) as returned by
|
|
374
|
-
* `/user-applications`.
|
|
375
|
-
*
|
|
376
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
377
|
-
* @public
|
|
378
|
-
*/
|
|
379
|
-
interface UserApplication {
|
|
380
|
-
id: string;
|
|
381
|
-
projectId: string | null;
|
|
382
|
-
organizationId: string | null;
|
|
383
|
-
title: string | null;
|
|
384
|
-
type: string;
|
|
385
|
-
urlType: string;
|
|
386
|
-
appHost: string;
|
|
387
|
-
dashboardStatus: string;
|
|
388
|
-
createdAt: string;
|
|
389
|
-
updatedAt: string;
|
|
390
|
-
autoUpdatingVersion: string | null;
|
|
391
|
-
activeDeployment: UserApplicationDeployment | null;
|
|
392
|
-
manifestData: unknown;
|
|
393
|
-
config: Record<string, unknown> | null;
|
|
394
|
-
manifest: unknown;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Options for listing an organization's user applications.
|
|
398
|
-
*
|
|
399
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
400
|
-
* @public
|
|
401
|
-
*/
|
|
402
|
-
interface UserApplicationsOptions {
|
|
403
|
-
organizationId: string;
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Fetcher for an organization's user applications (`GET /user-applications`),
|
|
407
|
-
* on the shared fetcher cache.
|
|
408
|
-
*
|
|
409
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
410
|
-
* @internal
|
|
411
|
-
*/
|
|
412
|
-
declare const userApplications: Fetcher<[options: UserApplicationsOptions], UserApplication[]>;
|
|
413
|
-
/**
|
|
414
|
-
* Fetcher for a single user application (`GET /user-applications/:id`), on the
|
|
415
|
-
* shared fetcher cache. No pre-seeding from {@link userApplications}: its list
|
|
416
|
-
* keys include the organization, which this fetcher's params can't
|
|
417
|
-
* reconstruct.
|
|
418
|
-
*
|
|
419
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
420
|
-
* @internal
|
|
421
|
-
*/
|
|
422
|
-
declare const userApplication: Fetcher<[userApplicationId: string], UserApplication>;
|
|
423
|
-
/**
|
|
424
|
-
* Fields you can set when creating or updating a user application.
|
|
425
|
-
*
|
|
426
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
427
|
-
* @internal
|
|
428
|
-
*/
|
|
429
|
-
interface UserApplicationWriteFields {
|
|
430
|
-
/** Human-friendly display name; `null` clears it */
|
|
431
|
-
title?: string | null;
|
|
432
|
-
/** `internal` for Sanity-hosted studios, `external` for externally hosted */
|
|
433
|
-
urlType?: 'internal' | 'external';
|
|
434
|
-
/** Studio subdomain (internal) or full `https` URL (external) */
|
|
435
|
-
appHost?: string;
|
|
436
|
-
/** Internal apps only: make this the default app for the deployment */
|
|
437
|
-
isDefaultForDeployment?: boolean;
|
|
438
|
-
/** Dashboard visibility */
|
|
439
|
-
dashboardStatus?: ApplicationVisibility;
|
|
440
|
-
/** Auto-update channel or a pinned semver */
|
|
441
|
-
autoUpdatingVersion?: string | null;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Input for {@link createUserApplication}: the writable fields, with `urlType`
|
|
445
|
-
* and `appHost` required. `organizationId` and `appType` are sent as query
|
|
446
|
-
* parameters; the rest form the request body.
|
|
447
|
-
*
|
|
448
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
449
|
-
* @internal
|
|
450
|
-
*/
|
|
451
|
-
interface CreateUserApplicationInput extends UserApplicationWriteFields {
|
|
452
|
-
/** Query param: owning organization */
|
|
453
|
-
organizationId?: string;
|
|
454
|
-
/** Query param: `studio` or `coreApp` */
|
|
455
|
-
appType?: 'studio' | 'coreApp';
|
|
456
|
-
urlType: 'internal' | 'external';
|
|
457
|
-
appHost: string;
|
|
458
|
-
/** Create does not accept a `null` title */
|
|
459
|
-
title?: string;
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Mutation to create a user application (`POST /user-applications`). Invalidates
|
|
463
|
-
* the list so it reconverges to include the new entry.
|
|
464
|
-
*
|
|
465
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
466
|
-
* @internal
|
|
467
|
-
*/
|
|
468
|
-
declare const createUserApplication: (instance: import("../_exports").SanityInstance, input: CreateUserApplicationInput) => Promise<MutationResult<UserApplication>>;
|
|
469
|
-
/**
|
|
470
|
-
* Input for {@link updateUserApplication}: the writable fields (all optional),
|
|
471
|
-
* keyed by id.
|
|
472
|
-
*
|
|
473
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
474
|
-
* @internal
|
|
475
|
-
*/
|
|
476
|
-
interface UpdateUserApplicationInput extends UserApplicationWriteFields {
|
|
477
|
-
userApplicationId: string;
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Mutation to update a user application (`PATCH /user-applications/:id`).
|
|
481
|
-
* Invalidates the updated entry and the list.
|
|
482
|
-
*
|
|
483
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
484
|
-
* @internal
|
|
485
|
-
*/
|
|
486
|
-
declare const updateUserApplication: (instance: import("../_exports").SanityInstance, input: UpdateUserApplicationInput) => Promise<MutationResult<UserApplication>>;
|
|
487
|
-
/**
|
|
488
|
-
* Input for {@link deleteUserApplication}.
|
|
489
|
-
*
|
|
490
|
-
* @internal
|
|
491
|
-
*/
|
|
492
|
-
interface DeleteUserApplicationInput {
|
|
493
|
-
userApplicationId: string;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Mutation to delete a user application (`DELETE /user-applications/:id`).
|
|
497
|
-
* Invalidates the deleted entry and the list.
|
|
498
|
-
*
|
|
499
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
500
|
-
* @internal
|
|
501
|
-
*/
|
|
502
|
-
declare const deleteUserApplication: (instance: import("../_exports").SanityInstance, input: DeleteUserApplicationInput) => Promise<MutationResult<DeletedResult>>;
|
|
503
|
-
/**
|
|
504
|
-
* Error message returned by the organization verification
|
|
505
|
-
* @public
|
|
506
|
-
*/
|
|
507
|
-
interface OrgVerificationResult {
|
|
508
|
-
error: string | null;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Creates an observable that emits the organization verification state for a given instance.
|
|
512
|
-
* It combines the dashboard organization ID (from auth context) with the
|
|
513
|
-
* project's actual organization ID (fetched via the project fetcher) and compares them.
|
|
514
|
-
* @public
|
|
515
|
-
*/
|
|
516
|
-
declare function observeOrganizationVerificationState(instance: SanityInstance, projectIds: string[]): Observable<OrgVerificationResult>;
|
|
517
|
-
/**
|
|
518
|
-
* @public
|
|
519
|
-
*/
|
|
520
|
-
declare const handleAuthCallback: BoundStoreAction<AuthStoreState, [locationHref?: string | undefined], Promise<string | false>>;
|
|
521
|
-
/**
|
|
522
|
-
* @public
|
|
523
|
-
*/
|
|
524
|
-
declare const logout: BoundStoreAction<AuthStoreState, [], Promise<void>>;
|
|
525
|
-
type AllowedClientConfigKey = 'useCdn' | 'token' | 'perspective' | 'apiHost' | 'proxy' | 'withCredentials' | 'timeout' | 'maxRetries' | 'dataset' | 'projectId' | 'requestTagPrefix' | 'useProjectHostname';
|
|
526
|
-
/**
|
|
527
|
-
* States tracked by the client store
|
|
528
|
-
* @public
|
|
529
|
-
*/
|
|
530
|
-
interface ClientStoreState {
|
|
531
|
-
token: string | null;
|
|
532
|
-
clients: { [TKey in string]?: SanityClient; };
|
|
533
|
-
authMethod?: 'localstorage' | 'cookie';
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Options used when retrieving a client instance from the client store.
|
|
537
|
-
*
|
|
538
|
-
* This interface extends the base {@link ClientConfig} and adds:
|
|
539
|
-
*
|
|
540
|
-
* - **apiVersion:** A required string indicating the API version for the client.
|
|
541
|
-
* - **scope:** An optional flag to choose between the project-specific client
|
|
542
|
-
* ('project') and the global client ('global'). When set to `'global'`, the
|
|
543
|
-
* global client is used.
|
|
544
|
-
*
|
|
545
|
-
* These options are utilized by `getClient` and `getClientState` to configure and
|
|
546
|
-
* return appropriate client instances that automatically handle authentication
|
|
547
|
-
* updates and configuration changes.
|
|
548
|
-
*
|
|
549
|
-
* @public
|
|
550
|
-
*/
|
|
551
|
-
interface ClientOptions extends Pick<ClientConfig, AllowedClientConfigKey> {
|
|
552
|
-
/**
|
|
553
|
-
* An optional flag to choose between the default client (typically project-level)
|
|
554
|
-
* and the global client ('global'). When set to `'global'`, the global client
|
|
555
|
-
* is used.
|
|
556
|
-
*/
|
|
557
|
-
scope?: 'default' | 'global';
|
|
558
|
-
/**
|
|
559
|
-
* A required string indicating the API version for the client.
|
|
560
|
-
*/
|
|
561
|
-
apiVersion: string;
|
|
562
|
-
/**
|
|
563
|
-
* @internal
|
|
564
|
-
* The SDK resource to use for the client -- this will get transformed into a ClientConfig resource.
|
|
565
|
-
*/
|
|
566
|
-
resource?: DocumentResource;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Retrieves a Sanity client instance configured with the provided options.
|
|
570
|
-
*
|
|
571
|
-
* This function returns a client instance configured for the project or as a
|
|
572
|
-
* global client based on the options provided. It ensures efficient reuse of
|
|
573
|
-
* client instances by returning the same instance for the same options.
|
|
574
|
-
* For automatic handling of authentication token updates, consider using
|
|
575
|
-
* `getClientState`.
|
|
576
|
-
*
|
|
577
|
-
* @public
|
|
578
|
-
*/
|
|
579
|
-
declare const getClient: BoundStoreAction<ClientStoreState, [options: ClientOptions], SanityClient>;
|
|
580
|
-
/**
|
|
581
|
-
* Returns a state source for the Sanity client instance.
|
|
582
|
-
*
|
|
583
|
-
* This function provides a subscribable state source that emits updated client
|
|
584
|
-
* instances whenever relevant configurations change (such as authentication tokens).
|
|
585
|
-
* Use this when you need to react to client configuration changes in your application.
|
|
586
|
-
*
|
|
587
|
-
* @public
|
|
588
|
-
*/
|
|
589
|
-
declare const getClientState: BoundStoreAction<ClientStoreState, [options: ClientOptions], import("../_exports").StateSource<SanityClient>>;
|
|
590
|
-
/**
|
|
591
|
-
* Message sent from a containing app to an iframe
|
|
592
|
-
* @public
|
|
593
|
-
*/
|
|
594
|
-
type FrameMessage = Message;
|
|
595
|
-
/**
|
|
596
|
-
* Message sent from an iframe to a containing app
|
|
597
|
-
* @public
|
|
598
|
-
*/
|
|
599
|
-
type WindowMessage = Message;
|
|
600
|
-
/**
|
|
601
|
-
* Message from SDK (iframe) to Parent (dashboard) to request a new token
|
|
602
|
-
* @internal
|
|
603
|
-
*/
|
|
604
|
-
type RequestNewTokenMessage = {
|
|
605
|
-
type: 'dashboard/v1/auth/tokens/create';
|
|
606
|
-
payload?: undefined;
|
|
607
|
-
};
|
|
608
|
-
/**
|
|
609
|
-
* Message from Parent (dashboard) to SDK (iframe) with the new token
|
|
610
|
-
* @internal
|
|
611
|
-
*/
|
|
612
|
-
type NewTokenResponseMessage = {
|
|
613
|
-
type: 'dashboard/v1/auth/tokens/create';
|
|
614
|
-
payload: {
|
|
615
|
-
token: string | null;
|
|
616
|
-
error?: string;
|
|
617
|
-
};
|
|
618
|
-
};
|
|
619
|
-
/**
|
|
620
|
-
* Individual channel with its relevant options
|
|
621
|
-
* @public
|
|
622
|
-
*/
|
|
623
|
-
interface ChannelEntry {
|
|
624
|
-
channel: ChannelInstance<FrameMessage, WindowMessage>;
|
|
625
|
-
options: ChannelInput;
|
|
626
|
-
refCount: number;
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* Internal state tracking comlink connections
|
|
630
|
-
* @public
|
|
631
|
-
*/
|
|
632
|
-
interface ComlinkControllerState {
|
|
633
|
-
controller: Controller | null;
|
|
634
|
-
controllerOrigin: string | null;
|
|
635
|
-
channels: Map<string, ChannelEntry>;
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
* Calls the destroy method on the controller and resets the controller state.
|
|
639
|
-
* @public
|
|
640
|
-
*/
|
|
641
|
-
declare const destroyController: BoundStoreAction<ComlinkControllerState, [], void>;
|
|
642
|
-
/**
|
|
643
|
-
* Retrieve or create a channel to be used for communication between
|
|
644
|
-
* an application and the controller.
|
|
645
|
-
* @public
|
|
646
|
-
*/
|
|
647
|
-
declare const getOrCreateChannel: BoundStoreAction<ComlinkControllerState, [options: ChannelInput], ChannelInstance<import("@sanity/comlink").Message, import("@sanity/comlink").Message>>;
|
|
648
|
-
/**
|
|
649
|
-
* Initializes or fetches a controller to handle communication
|
|
650
|
-
* between an application and iframes.
|
|
651
|
-
* @public
|
|
652
|
-
*/
|
|
653
|
-
declare const getOrCreateController: BoundStoreAction<ComlinkControllerState, [targetOrigin: string], Controller>;
|
|
654
|
-
/**
|
|
655
|
-
* Signals to the store that the consumer has stopped using the channel
|
|
656
|
-
* @public
|
|
657
|
-
*/
|
|
658
|
-
declare const releaseChannel: BoundStoreAction<ComlinkControllerState, [name: string], void>;
|
|
659
|
-
/**
|
|
660
|
-
* Individual node with its relevant options
|
|
661
|
-
* @public
|
|
662
|
-
*/
|
|
663
|
-
interface NodeEntry {
|
|
664
|
-
node: Node<WindowMessage, FrameMessage>;
|
|
665
|
-
options: NodeInput;
|
|
666
|
-
status: Status;
|
|
667
|
-
statusUnsub?: () => void;
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Internal state tracking comlink connections
|
|
671
|
-
* @public
|
|
672
|
-
*/
|
|
673
|
-
interface ComlinkNodeState {
|
|
674
|
-
nodes: Map<string, NodeEntry>;
|
|
675
|
-
subscriptions: Map<string, Set<symbol>>;
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Signals to the store that the consumer has stopped using the node
|
|
679
|
-
* @public
|
|
680
|
-
*/
|
|
681
|
-
declare const releaseNode: BoundStoreAction<ComlinkNodeState, [name: string], void>;
|
|
682
|
-
/**
|
|
683
|
-
* Retrieve or create a node to be used for communication between
|
|
684
|
-
* an application and the controller -- specifically, a node should
|
|
685
|
-
* be created within a frame / window to communicate with the controller.
|
|
686
|
-
* @public
|
|
687
|
-
*/
|
|
688
|
-
declare const getOrCreateNode: BoundStoreAction<ComlinkNodeState, [options: NodeInput], Node<import("@sanity/comlink").Message, import("@sanity/comlink").Message>>;
|
|
689
|
-
/**
|
|
690
|
-
* @public
|
|
691
|
-
*/
|
|
692
|
-
interface NodeState {
|
|
693
|
-
node: Node<WindowMessage, FrameMessage>;
|
|
694
|
-
status: Status | undefined;
|
|
695
|
-
}
|
|
696
|
-
/**
|
|
697
|
-
* Provides a subscribable state source for a node by name
|
|
698
|
-
* @param instance - The Sanity instance to get the node state for
|
|
699
|
-
* @param nodeInput - The configuration for the node to get the state for
|
|
700
|
-
* @returns A subscribable state source for the node
|
|
701
|
-
* @public
|
|
702
|
-
*/
|
|
703
|
-
declare const getNodeState: BoundStoreAction<ComlinkNodeState, [NodeInput], import("../../_exports").StateSource<NodeState | undefined>>;
|
|
704
|
-
/**
|
|
705
|
-
* Creates or validates a `DocumentHandle` object.
|
|
706
|
-
* Ensures the provided object conforms to the `DocumentHandle` interface.
|
|
707
|
-
* @param handle - The object containing document identification properties.
|
|
708
|
-
* @returns The validated `DocumentHandle` object.
|
|
709
|
-
* @public
|
|
710
|
-
*/
|
|
711
|
-
declare function createDocumentHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(handle: DocumentHandle<TDocumentType, TDataset, TProjectId>): DocumentHandle<TDocumentType, TDataset, TProjectId>;
|
|
712
|
-
/**
|
|
713
|
-
* Creates or validates a `DocumentTypeHandle` object.
|
|
714
|
-
* Ensures the provided object conforms to the `DocumentTypeHandle` interface.
|
|
715
|
-
* @param handle - The object containing document type identification properties.
|
|
716
|
-
* @returns The validated `DocumentTypeHandle` object.
|
|
717
|
-
* @public
|
|
718
|
-
*/
|
|
719
|
-
declare function createDocumentTypeHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(handle: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>): DocumentTypeHandle<TDocumentType, TDataset, TProjectId>;
|
|
720
|
-
/**
|
|
721
|
-
* Creates or validates a `ProjectHandle` object.
|
|
722
|
-
* Ensures the provided object conforms to the `ProjectHandle` interface.
|
|
723
|
-
* @param handle - The object containing project identification properties.
|
|
724
|
-
* @returns The validated `ProjectHandle` object.
|
|
725
|
-
* @public
|
|
726
|
-
*/
|
|
727
|
-
declare function createProjectHandle<TProjectId extends string = string>(handle: ProjectHandle<TProjectId>): ProjectHandle<TProjectId>;
|
|
728
|
-
/**
|
|
729
|
-
* Creates or validates a `DatasetHandle` object.
|
|
730
|
-
* Ensures the provided object conforms to the `DatasetHandle` interface.
|
|
731
|
-
* @param handle - The object containing dataset identification properties.
|
|
732
|
-
* @returns The validated `DatasetHandle` object.
|
|
733
|
-
* @public
|
|
734
|
-
*/
|
|
735
|
-
declare function createDatasetHandle<TDataset extends string = string, TProjectId extends string = string>(handle: DatasetHandle<TDataset, TProjectId>): DatasetHandle<TDataset, TProjectId>;
|
|
736
|
-
/**
|
|
737
|
-
* Logging infrastructure for the Sanity SDK
|
|
738
|
-
*
|
|
739
|
-
* Provides multi-level, namespace-based logging for both SDK users and maintainers.
|
|
740
|
-
* In production builds, all logging can be stripped via tree-shaking.
|
|
741
|
-
*
|
|
742
|
-
* @example SDK User
|
|
743
|
-
* ```ts
|
|
744
|
-
* import {configureLogging} from '@sanity/sdk'
|
|
745
|
-
*
|
|
746
|
-
* configureLogging({
|
|
747
|
-
* level: 'info',
|
|
748
|
-
* namespaces: ['auth', 'document']
|
|
749
|
-
* })
|
|
750
|
-
* ```
|
|
751
|
-
*
|
|
752
|
-
* @example SDK Maintainer
|
|
753
|
-
* ```ts
|
|
754
|
-
* configureLogging({
|
|
755
|
-
* level: 'trace',
|
|
756
|
-
* namespaces: ['*'],
|
|
757
|
-
* internal: true
|
|
758
|
-
* })
|
|
759
|
-
* ```
|
|
760
|
-
*/
|
|
761
|
-
/**
|
|
762
|
-
* Log levels in order of verbosity (least to most)
|
|
763
|
-
* - error: Critical failures that prevent operation
|
|
764
|
-
* - warn: Issues that may cause problems but don't stop execution
|
|
765
|
-
* - info: High-level informational messages (SDK user level)
|
|
766
|
-
* - debug: Detailed debugging information (maintainer level)
|
|
767
|
-
* - trace: Very detailed tracing (maintainer level, includes RxJS streams)
|
|
768
|
-
* @public
|
|
769
|
-
*/
|
|
770
|
-
type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
|
771
|
-
/**
|
|
772
|
-
* Log namespaces organize logs by functional domain
|
|
773
|
-
*
|
|
774
|
-
* @remarks
|
|
775
|
-
* This is an extensible string type. As logging is added to more modules,
|
|
776
|
-
* additional namespaces will be recognized. Currently implemented namespaces
|
|
777
|
-
* will be documented as they are added.
|
|
778
|
-
* @internal
|
|
779
|
-
*/
|
|
780
|
-
type LogNamespace = string;
|
|
781
|
-
/**
|
|
782
|
-
* Configuration for the logging system
|
|
783
|
-
* @public
|
|
784
|
-
*/
|
|
785
|
-
interface LoggerConfig {
|
|
786
|
-
/**
|
|
787
|
-
* Minimum log level to output
|
|
788
|
-
* @defaultValue 'warn'
|
|
789
|
-
*/
|
|
790
|
-
level?: LogLevel;
|
|
791
|
-
/**
|
|
792
|
-
* Namespaces to enable. Use ['*'] for all namespaces
|
|
793
|
-
* @defaultValue []
|
|
794
|
-
* @remarks
|
|
795
|
-
* Available namespaces depend on which modules have logging integrated.
|
|
796
|
-
* Check the SDK documentation for the current list of instrumented modules.
|
|
797
|
-
* @example ['auth', 'document']
|
|
798
|
-
*/
|
|
799
|
-
namespaces?: string[];
|
|
800
|
-
/**
|
|
801
|
-
* Enable internal/maintainer-level logging
|
|
802
|
-
* Shows RxJS streams, store internals, etc.
|
|
803
|
-
* @defaultValue false
|
|
804
|
-
*/
|
|
805
|
-
internal?: boolean;
|
|
806
|
-
/**
|
|
807
|
-
* Custom log handler (for testing or custom output)
|
|
808
|
-
* @defaultValue console methods
|
|
809
|
-
*/
|
|
810
|
-
handler?: LogHandler;
|
|
811
|
-
/**
|
|
812
|
-
* Enable timestamps in log output
|
|
813
|
-
* @defaultValue true
|
|
814
|
-
*/
|
|
815
|
-
timestamps?: boolean;
|
|
816
|
-
/**
|
|
817
|
-
* Enable in production builds
|
|
818
|
-
* @defaultValue false
|
|
819
|
-
*/
|
|
820
|
-
enableInProduction?: boolean;
|
|
821
|
-
}
|
|
822
|
-
/**
|
|
823
|
-
* Custom log handler interface
|
|
824
|
-
*
|
|
825
|
-
* @internal
|
|
826
|
-
*/
|
|
827
|
-
interface LogHandler {
|
|
828
|
-
error: (message: string, context?: LogContext) => void;
|
|
829
|
-
warn: (message: string, context?: LogContext) => void;
|
|
830
|
-
info: (message: string, context?: LogContext) => void;
|
|
831
|
-
debug: (message: string, context?: LogContext) => void;
|
|
832
|
-
trace: (message: string, context?: LogContext) => void;
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Context object attached to log messages
|
|
836
|
-
*
|
|
837
|
-
* This interface allows you to attach arbitrary contextual data to log messages.
|
|
838
|
-
* The index signature `[key: string]: unknown` enables you to add any custom
|
|
839
|
-
* properties relevant to your log entry (e.g., `userId`, `documentId`, `action`, etc.).
|
|
840
|
-
*
|
|
841
|
-
* **Sensitive data sanitization:**
|
|
842
|
-
* Top-level keys containing sensitive names (`token`, `password`, `secret`, `apiKey`,
|
|
843
|
-
* `authorization`) are automatically redacted to `[REDACTED]` in log output.
|
|
844
|
-
*
|
|
845
|
-
* @example
|
|
846
|
-
* ```ts
|
|
847
|
-
* logger.info('User logged in', {
|
|
848
|
-
* userId: '123', // Custom context
|
|
849
|
-
* action: 'login', // Custom context
|
|
850
|
-
* token: 'secret' // Will be redacted to [REDACTED]
|
|
851
|
-
* })
|
|
852
|
-
* ```
|
|
853
|
-
*
|
|
854
|
-
* @internal
|
|
855
|
-
*/
|
|
856
|
-
interface LogContext {
|
|
857
|
-
/**
|
|
858
|
-
* Custom context properties that provide additional information about the log entry.
|
|
859
|
-
* Any key-value pairs can be added here (e.g., userId, documentId, requestId, etc.).
|
|
860
|
-
* Keys with sensitive names (token, password, secret, apiKey, authorization) are
|
|
861
|
-
* automatically sanitized.
|
|
862
|
-
*/
|
|
863
|
-
[key: string]: unknown;
|
|
864
|
-
/** Error object if logging an error */
|
|
865
|
-
error?: Error | unknown;
|
|
866
|
-
/** Duration in milliseconds for timed operations */
|
|
867
|
-
duration?: number;
|
|
868
|
-
/** Stack trace for debugging */
|
|
869
|
-
stack?: string;
|
|
870
|
-
/** Instance context (automatically added when available) */
|
|
871
|
-
instanceContext?: InstanceContext;
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
* Instance context information automatically added to logs
|
|
875
|
-
* @internal
|
|
876
|
-
*/
|
|
877
|
-
interface InstanceContext {
|
|
878
|
-
/** Unique instance ID */
|
|
879
|
-
instanceId?: string;
|
|
880
|
-
/** Project ID */
|
|
881
|
-
projectId?: string;
|
|
882
|
-
/** Dataset name */
|
|
883
|
-
dataset?: string;
|
|
884
|
-
}
|
|
885
|
-
/**
|
|
886
|
-
* Logger instance for a specific namespace
|
|
887
|
-
* @internal
|
|
888
|
-
*/
|
|
889
|
-
interface Logger {
|
|
890
|
-
readonly namespace: string;
|
|
891
|
-
error: (message: string, context?: LogContext) => void;
|
|
892
|
-
warn: (message: string, context?: LogContext) => void;
|
|
893
|
-
info: (message: string, context?: LogContext) => void;
|
|
894
|
-
debug: (message: string, context?: LogContext) => void;
|
|
895
|
-
trace: (message: string, context?: LogContext) => void;
|
|
896
|
-
/** Check if a log level is enabled (for performance-sensitive code) */
|
|
897
|
-
isLevelEnabled: (level: LogLevel) => boolean;
|
|
898
|
-
/** Create a child logger with extended context */
|
|
899
|
-
child: (context: LogContext) => Logger;
|
|
900
|
-
/** Get the instance context if available */
|
|
901
|
-
getInstanceContext: () => InstanceContext | undefined;
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* Configure logging for the Sanity SDK
|
|
905
|
-
*
|
|
906
|
-
* This function allows you to control what logs are output by the SDK,
|
|
907
|
-
* making it easier to debug issues in development or production.
|
|
908
|
-
*
|
|
909
|
-
* @remarks
|
|
910
|
-
* **Zero-Config via Environment Variable (Recommended):**
|
|
911
|
-
*
|
|
912
|
-
* The SDK automatically reads the `DEBUG` environment variable, making it
|
|
913
|
-
* easy to enable logging without code changes:
|
|
914
|
-
*
|
|
915
|
-
* ```bash
|
|
916
|
-
* # Enable all SDK logging at debug level
|
|
917
|
-
* DEBUG=sanity:* npm start
|
|
918
|
-
*
|
|
919
|
-
* # Enable specific namespaces
|
|
920
|
-
* DEBUG=sanity:auth,sanity:document npm start
|
|
921
|
-
*
|
|
922
|
-
* # Enable trace level for all namespaces
|
|
923
|
-
* DEBUG=sanity:trace:* npm start
|
|
924
|
-
*
|
|
925
|
-
* # Enable internal/maintainer logs
|
|
926
|
-
* DEBUG=sanity:*:internal npm start
|
|
927
|
-
* ```
|
|
928
|
-
*
|
|
929
|
-
* This matches the pattern used by Sanity CLI and Studio, making it familiar
|
|
930
|
-
* and easy for support teams to help troubleshoot issues.
|
|
931
|
-
*
|
|
932
|
-
* **Programmatic Configuration (Advanced):**
|
|
933
|
-
*
|
|
934
|
-
* For more control (custom handlers, dynamic configuration), call this function
|
|
935
|
-
* explicitly. Programmatic configuration overrides environment variables.
|
|
936
|
-
*
|
|
937
|
-
* **For Application Developers:**
|
|
938
|
-
* Use `info`, `warn`, or `error` levels to see high-level SDK activity
|
|
939
|
-
* without being overwhelmed by internal details.
|
|
940
|
-
*
|
|
941
|
-
* **For SDK Maintainers:**
|
|
942
|
-
* Use `debug` or `trace` levels with `internal: true` to see detailed
|
|
943
|
-
* information about store operations, RxJS streams, and state transitions.
|
|
944
|
-
*
|
|
945
|
-
* **Instance Context:**
|
|
946
|
-
* Logs automatically include instance information (projectId, dataset, instanceId)
|
|
947
|
-
* when available, making it easier to debug multi-instance scenarios:
|
|
948
|
-
* ```
|
|
949
|
-
* [INFO] [auth] [project:abc] [dataset:production] User logged in
|
|
950
|
-
* ```
|
|
951
|
-
*
|
|
952
|
-
* **Available Namespaces:**
|
|
953
|
-
* - `sdk` - SDK initialization, configuration, and lifecycle
|
|
954
|
-
* - `auth` - Authentication and authorization (when instrumented in the future)
|
|
955
|
-
* - And more as logging is added to modules
|
|
956
|
-
*
|
|
957
|
-
* @example Zero-config via environment variable (recommended for debugging)
|
|
958
|
-
* ```bash
|
|
959
|
-
* # Just set DEBUG and run your app - no code changes needed!
|
|
960
|
-
* DEBUG=sanity:* npm start
|
|
961
|
-
* ```
|
|
962
|
-
*
|
|
963
|
-
* @example Programmatic configuration (application developer)
|
|
964
|
-
* ```ts
|
|
965
|
-
* import {configureLogging} from '@sanity/sdk'
|
|
966
|
-
*
|
|
967
|
-
* // Log warnings and errors for auth and document operations
|
|
968
|
-
* configureLogging({
|
|
969
|
-
* level: 'warn',
|
|
970
|
-
* namespaces: ['auth', 'document']
|
|
971
|
-
* })
|
|
972
|
-
* ```
|
|
973
|
-
*
|
|
974
|
-
* @example Programmatic configuration (SDK maintainer)
|
|
975
|
-
* ```ts
|
|
976
|
-
* import {configureLogging} from '@sanity/sdk'
|
|
977
|
-
*
|
|
978
|
-
* // Enable all logs including internal traces
|
|
979
|
-
* configureLogging({
|
|
980
|
-
* level: 'trace',
|
|
981
|
-
* namespaces: ['*'],
|
|
982
|
-
* internal: true
|
|
983
|
-
* })
|
|
984
|
-
* ```
|
|
985
|
-
*
|
|
986
|
-
* @example Custom handler (for testing)
|
|
987
|
-
* ```ts
|
|
988
|
-
* import {configureLogging} from '@sanity/sdk'
|
|
989
|
-
*
|
|
990
|
-
* const logs: string[] = []
|
|
991
|
-
* configureLogging({
|
|
992
|
-
* level: 'info',
|
|
993
|
-
* namespaces: ['*'],
|
|
994
|
-
* handler: {
|
|
995
|
-
* error: (msg) => logs.push(msg),
|
|
996
|
-
* warn: (msg) => logs.push(msg),
|
|
997
|
-
* info: (msg) => logs.push(msg),
|
|
998
|
-
* debug: (msg) => logs.push(msg),
|
|
999
|
-
* trace: (msg) => logs.push(msg),
|
|
1000
|
-
* }
|
|
1001
|
-
* })
|
|
1002
|
-
* ```
|
|
1003
|
-
*
|
|
1004
|
-
* @public
|
|
1005
|
-
*/
|
|
1006
|
-
declare function configureLogging(config: LoggerConfig): void;
|
|
1007
|
-
/** @public */
|
|
1008
|
-
declare const getDatasetsState: BoundStoreAction<import("../_exports").FetcherStoreState<[options?: ProjectHandle<string> | undefined], import("@sanity/client").DatasetsResponse>, [options?: ProjectHandle<string> | undefined], import("../_exports").StateSource<import("@sanity/client").DatasetsResponse | undefined>>;
|
|
1009
|
-
/** @public */
|
|
1010
|
-
declare const resolveDatasets: BoundStoreAction<import("../_exports").FetcherStoreState<[options?: ProjectHandle<string> | undefined], import("@sanity/client").DatasetsResponse>, [options?: ProjectHandle<string> | undefined], Promise<import("@sanity/client").DatasetsResponse>>;
|
|
1011
|
-
/**
|
|
1012
|
-
* Represents an action to create a new document.
|
|
1013
|
-
* Specifies the document type and optionally a document ID (which will be treated as the published ID).
|
|
1014
|
-
* @beta
|
|
1015
|
-
*/
|
|
1016
|
-
interface CreateDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentTypeHandle<TDocumentType, TDataset, TProjectId> {
|
|
1017
|
-
type: 'document.create';
|
|
1018
|
-
/**
|
|
1019
|
-
* Optional initial field values for the document.
|
|
1020
|
-
* These values will be set when the document is created.
|
|
1021
|
-
* System fields (_id, _type, _rev, _createdAt, _updatedAt) are omitted as they are set automatically.
|
|
1022
|
-
*/
|
|
1023
|
-
initialValue?: Partial<Omit<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>, '_id' | '_type' | '_rev' | '_createdAt' | '_updatedAt'>>;
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Represents an action to delete an existing document.
|
|
1027
|
-
* Requires the full document handle including the document ID.
|
|
1028
|
-
* @beta
|
|
1029
|
-
*/
|
|
1030
|
-
interface DeleteDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1031
|
-
type: 'document.delete';
|
|
1032
|
-
}
|
|
1033
|
-
/**
|
|
1034
|
-
* Represents an action to edit an existing document using patches.
|
|
1035
|
-
* Requires the full document handle and an array of patch operations.
|
|
1036
|
-
* @beta
|
|
1037
|
-
*/
|
|
1038
|
-
interface EditDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1039
|
-
type: 'document.edit';
|
|
1040
|
-
patches?: PatchOperations[];
|
|
1041
|
-
/**
|
|
1042
|
-
* When `true`, the given `patches` are forwarded verbatim to the server and
|
|
1043
|
-
* applied as-is locally, instead of being re-derived by diffing document
|
|
1044
|
-
* snapshots. This preserves the operational intent of the patches (e.g.
|
|
1045
|
-
* keyed array inserts/unsets), which lets concurrent edits from other
|
|
1046
|
-
* clients interleave coherently instead of being overwritten by
|
|
1047
|
-
* position-based patches computed from a stale snapshot.
|
|
1048
|
-
*
|
|
1049
|
-
* Use this when the patches were produced by an editor that tracks its own
|
|
1050
|
-
* operations (e.g. a collaborative text editor). During a rebase onto a
|
|
1051
|
-
* changed remote document, preserved patches are re-applied operationally;
|
|
1052
|
-
* if a patch can no longer apply, the transaction is skipped and reported
|
|
1053
|
-
* as a `rebase-error` document event.
|
|
1054
|
-
*/
|
|
1055
|
-
preserveOperations?: boolean;
|
|
1056
|
-
}
|
|
1057
|
-
/**
|
|
1058
|
-
* Represents an action to publish the draft version of a document.
|
|
1059
|
-
* Requires the full document handle.
|
|
1060
|
-
* @beta
|
|
1061
|
-
*/
|
|
1062
|
-
interface PublishDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1063
|
-
type: 'document.publish';
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* Represents an action to unpublish a document, moving its published content to a draft.
|
|
1067
|
-
* Requires the full document handle.
|
|
1068
|
-
* @beta
|
|
1069
|
-
*/
|
|
1070
|
-
interface UnpublishDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1071
|
-
type: 'document.unpublish';
|
|
1072
|
-
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Represents an action to discard the draft changes of a document.
|
|
1075
|
-
* Requires the full document handle.
|
|
1076
|
-
* @beta
|
|
1077
|
-
*/
|
|
1078
|
-
interface DiscardDocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1079
|
-
type: 'document.discard';
|
|
1080
|
-
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Union type representing all possible document actions within the SDK.
|
|
1083
|
-
* @beta
|
|
1084
|
-
*/
|
|
1085
|
-
type DocumentAction<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> = CreateDocumentAction<TDocumentType, TDataset, TProjectId> | DeleteDocumentAction<TDocumentType, TDataset, TProjectId> | EditDocumentAction<TDocumentType, TDataset, TProjectId> | PublishDocumentAction<TDocumentType, TDataset, TProjectId> | UnpublishDocumentAction<TDocumentType, TDataset, TProjectId> | DiscardDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1086
|
-
/**
|
|
1087
|
-
* Union of every action accepted by `applyDocumentActions` — both document-
|
|
1088
|
-
* level actions and release-lifecycle actions.
|
|
1089
|
-
* @beta
|
|
1090
|
-
*/
|
|
1091
|
-
type Action<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> = DocumentAction<TDocumentType, TDataset, TProjectId> | ReleaseAction;
|
|
1092
|
-
/**
|
|
1093
|
-
* Creates a `CreateDocumentAction` object.
|
|
1094
|
-
* @param doc - A handle identifying the document type, dataset, and project. An optional `documentId` can be provided.
|
|
1095
|
-
* @param initialValue - Optional initial field values for the document. (System fields are omitted as they are set automatically.)
|
|
1096
|
-
* @returns A `CreateDocumentAction` object ready for dispatch.
|
|
1097
|
-
* @beta
|
|
1098
|
-
*/
|
|
1099
|
-
declare function createDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>, initialValue?: Partial<Omit<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>, '_id' | '_type' | '_rev' | '_createdAt' | '_updatedAt'>>): CreateDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Creates a `DeleteDocumentAction` object.
|
|
1102
|
-
* @param doc - A handle uniquely identifying the document to be deleted.
|
|
1103
|
-
* @returns A `DeleteDocumentAction` object ready for dispatch.
|
|
1104
|
-
* @beta
|
|
1105
|
-
*/
|
|
1106
|
-
declare function deleteDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): DeleteDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1107
|
-
/**
|
|
1108
|
-
* Options for creating an `EditDocumentAction`.
|
|
1109
|
-
* @beta
|
|
1110
|
-
*/
|
|
1111
|
-
interface EditDocumentOptions {
|
|
1112
|
-
/**
|
|
1113
|
-
* Forward the given patches verbatim instead of re-deriving them by
|
|
1114
|
-
* diffing document snapshots. See {@link EditDocumentAction.preserveOperations}.
|
|
1115
|
-
*/
|
|
1116
|
-
preserveOperations?: boolean;
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Creates an `EditDocumentAction` object with patches for modifying a document.
|
|
1120
|
-
* Accepts patches in either the standard `PatchOperations` format or as a `SanityMutatePatchMutation` from `@sanity/mutate`.
|
|
1121
|
-
*
|
|
1122
|
-
* @param doc - A handle uniquely identifying the document to be edited.
|
|
1123
|
-
* @param sanityMutatePatch - A patch mutation object from `@sanity/mutate`.
|
|
1124
|
-
* @param options - Options controlling how the patches are processed.
|
|
1125
|
-
* @returns An `EditDocumentAction` object ready for dispatch.
|
|
1126
|
-
* @beta
|
|
1127
|
-
*/
|
|
1128
|
-
declare function editDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>, sanityMutatePatch: PatchMutation, options?: EditDocumentOptions): EditDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1129
|
-
/**
|
|
1130
|
-
* Creates an `EditDocumentAction` object with patches for modifying a document.
|
|
1131
|
-
*
|
|
1132
|
-
* @param doc - A handle uniquely identifying the document to be edited.
|
|
1133
|
-
* @param patches - A single patch operation or an array of patch operations.
|
|
1134
|
-
* @param options - Options controlling how the patches are processed.
|
|
1135
|
-
* @returns An `EditDocumentAction` object ready for dispatch.
|
|
1136
|
-
* @beta
|
|
1137
|
-
*/
|
|
1138
|
-
declare function editDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>, patches?: PatchOperations | PatchOperations[], options?: EditDocumentOptions): EditDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1139
|
-
/**
|
|
1140
|
-
* Creates a `PublishDocumentAction` object.
|
|
1141
|
-
* @param doc - A handle uniquely identifying the document to be published.
|
|
1142
|
-
* @returns A `PublishDocumentAction` object ready for dispatch.
|
|
1143
|
-
* @beta
|
|
1144
|
-
*/
|
|
1145
|
-
declare function publishDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): PublishDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1146
|
-
/**
|
|
1147
|
-
* Creates an `UnpublishDocumentAction` object.
|
|
1148
|
-
* @param doc - A handle uniquely identifying the document to be unpublished.
|
|
1149
|
-
* @returns An `UnpublishDocumentAction` object ready for dispatch.
|
|
1150
|
-
* @beta
|
|
1151
|
-
*/
|
|
1152
|
-
declare function unpublishDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): UnpublishDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1153
|
-
/**
|
|
1154
|
-
* Creates a `DiscardDocumentAction` object.
|
|
1155
|
-
* @param doc - A handle uniquely identifying the document whose draft changes are to be discarded.
|
|
1156
|
-
* @returns A `DiscardDocumentAction` object ready for dispatch.
|
|
1157
|
-
* @beta
|
|
1158
|
-
*/
|
|
1159
|
-
declare function discardDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(doc: DocumentHandle<TDocumentType, TDataset, TProjectId>): DiscardDocumentAction<TDocumentType, TDataset, TProjectId>;
|
|
1160
|
-
/**
|
|
1161
|
-
* Creates a new release. The `releaseId` must be unique within the current
|
|
1162
|
-
* retention period.
|
|
1163
|
-
* @beta
|
|
1164
|
-
*/
|
|
1165
|
-
interface CreateReleaseAction extends ReleaseHandle {
|
|
1166
|
-
type: 'release.create';
|
|
1167
|
-
metadata: ReleaseDocument$1['metadata'];
|
|
1168
|
-
}
|
|
1169
|
-
/**
|
|
1170
|
-
* Patches the metadata of an existing release.
|
|
1171
|
-
* @beta
|
|
1172
|
-
*/
|
|
1173
|
-
interface EditReleaseAction extends ReleaseHandle {
|
|
1174
|
-
type: 'release.edit';
|
|
1175
|
-
patch: PatchOperations;
|
|
1176
|
-
}
|
|
1177
|
-
/**
|
|
1178
|
-
* Publishes all version documents in a release.
|
|
1179
|
-
* @beta
|
|
1180
|
-
*/
|
|
1181
|
-
interface PublishReleaseAction extends ReleaseHandle {
|
|
1182
|
-
type: 'release.publish';
|
|
1183
|
-
}
|
|
1184
|
-
/**
|
|
1185
|
-
* Schedules a release to be published at the given UTC time. Locks the
|
|
1186
|
-
* version documents server-side until the release is unscheduled or published.
|
|
1187
|
-
* @beta
|
|
1188
|
-
*/
|
|
1189
|
-
interface ScheduleReleaseAction extends ReleaseHandle {
|
|
1190
|
-
type: 'release.schedule';
|
|
1191
|
-
publishAt: string;
|
|
1192
|
-
}
|
|
1193
|
-
/**
|
|
1194
|
-
* Unschedules a release that was previously scheduled, returning it to the
|
|
1195
|
-
* active editable state.
|
|
1196
|
-
* @beta
|
|
1197
|
-
*/
|
|
1198
|
-
interface UnscheduleReleaseAction extends ReleaseHandle {
|
|
1199
|
-
type: 'release.unschedule';
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Archives an active release. Version documents within the release are
|
|
1203
|
-
* removed and no longer queryable, though still recoverable through history
|
|
1204
|
-
* during the retention period.
|
|
1205
|
-
* @beta
|
|
1206
|
-
*/
|
|
1207
|
-
interface ArchiveReleaseAction extends ReleaseHandle {
|
|
1208
|
-
type: 'release.archive';
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Restores an archived release. Only possible during the retention period.
|
|
1212
|
-
* @beta
|
|
1213
|
-
*/
|
|
1214
|
-
interface UnarchiveReleaseAction extends ReleaseHandle {
|
|
1215
|
-
type: 'release.unarchive';
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Permanently deletes an archived or published release. To remove an active
|
|
1219
|
-
* release, use the archive action first.
|
|
1220
|
-
* @beta
|
|
1221
|
-
*/
|
|
1222
|
-
interface DeleteReleaseAction extends ReleaseHandle {
|
|
1223
|
-
type: 'release.delete';
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* Union of all release actions that can be dispatched alongside document
|
|
1227
|
-
* actions through `applyDocumentActions`.
|
|
1228
|
-
* @beta
|
|
1229
|
-
*/
|
|
1230
|
-
type ReleaseAction = CreateReleaseAction | EditReleaseAction | PublishReleaseAction | ScheduleReleaseAction | UnscheduleReleaseAction | ArchiveReleaseAction | UnarchiveReleaseAction | DeleteReleaseAction;
|
|
1231
|
-
/** @beta */
|
|
1232
|
-
declare function createRelease(handle: ReleaseHandle, metadata?: ReleaseDocument$1['metadata']): CreateReleaseAction;
|
|
1233
|
-
/** @beta */
|
|
1234
|
-
declare function editRelease(handle: ReleaseHandle, patch: PatchOperations): EditReleaseAction;
|
|
1235
|
-
/** @beta */
|
|
1236
|
-
declare function publishRelease(handle: ReleaseHandle): PublishReleaseAction;
|
|
1237
|
-
/** @beta */
|
|
1238
|
-
declare function scheduleRelease(handle: ReleaseHandle, publishAt: string): ScheduleReleaseAction;
|
|
1239
|
-
/** @beta */
|
|
1240
|
-
declare function unscheduleRelease(handle: ReleaseHandle): UnscheduleReleaseAction;
|
|
1241
|
-
/** @beta */
|
|
1242
|
-
declare function archiveRelease(handle: ReleaseHandle): ArchiveReleaseAction;
|
|
1243
|
-
/** @beta */
|
|
1244
|
-
declare function unarchiveRelease(handle: ReleaseHandle): UnarchiveReleaseAction;
|
|
1245
|
-
/** @beta */
|
|
1246
|
-
declare function deleteRelease(handle: ReleaseHandle): DeleteReleaseAction;
|
|
1247
|
-
/**
|
|
1248
|
-
* Split the entire path string on dots "outside" of any brackets.
|
|
1249
|
-
*
|
|
1250
|
-
* For example:
|
|
1251
|
-
* ```
|
|
1252
|
-
* "friends[0].name"
|
|
1253
|
-
* ```
|
|
1254
|
-
*
|
|
1255
|
-
* becomes:
|
|
1256
|
-
*
|
|
1257
|
-
* ```
|
|
1258
|
-
* [...ParseSegment<"friends[0]">, ...ParseSegment<"name">]
|
|
1259
|
-
* ```
|
|
1260
|
-
*
|
|
1261
|
-
* (We use a simple recursion that splits on the first dot.)
|
|
1262
|
-
*/
|
|
1263
|
-
type PathParts<TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? [Head, ...PathParts<Tail>] : TPath extends '' ? [] : [TPath];
|
|
1264
|
-
/**
|
|
1265
|
-
* Given a type T and an array of "access keys" Parts, recursively index into T.
|
|
1266
|
-
*
|
|
1267
|
-
* If a part is a key, it looks up that property.
|
|
1268
|
-
* If T is an array and the part is a number, it "indexes" into the element type.
|
|
1269
|
-
*/
|
|
1270
|
-
type DeepGet<TValue, TPath extends readonly (string | number)[]> = TPath extends [] ? TValue : TPath extends readonly [infer THead, ...infer TTail] ? DeepGet<TValue extends undefined | null ? undefined : THead extends keyof TValue ? TValue[THead] : THead extends number ? TValue extends readonly (infer TElement)[] ? TElement | undefined : undefined : undefined // Key/index doesn't exist
|
|
1271
|
-
, TTail extends readonly (string | number)[] ? TTail : []> : never;
|
|
1272
|
-
/**
|
|
1273
|
-
* Given a document type TDocument and a JSON Match path string TPath,
|
|
1274
|
-
* compute the type found at that path.
|
|
1275
|
-
* @beta
|
|
1276
|
-
*/
|
|
1277
|
-
type JsonMatch<TDocument, TPath extends string> = DeepGet<TDocument, PathParts<TPath>>;
|
|
1278
|
-
/**
|
|
1279
|
-
* Represents a set of document that will go into `applyMutations`. Before
|
|
1280
|
-
* applying a mutation, it's expected that all relevant documents that the
|
|
1281
|
-
* mutations affect are included, including those that do not exist yet.
|
|
1282
|
-
* Documents that don't exist have a `null` value.
|
|
1283
|
-
*/
|
|
1284
|
-
type DocumentSet<TDocument extends SanityDocument$2 = SanityDocument$2> = { [TDocumentId in string]?: TDocument | null; };
|
|
1285
|
-
type Grant = 'read' | 'update' | 'create' | 'history';
|
|
1286
|
-
/** @beta */
|
|
1287
|
-
interface PermissionDeniedReason {
|
|
1288
|
-
type: 'precondition' | 'access';
|
|
1289
|
-
message: string;
|
|
1290
|
-
documentId?: string;
|
|
1291
|
-
}
|
|
1292
|
-
/** @beta */
|
|
1293
|
-
type DocumentPermissionsResult = {
|
|
1294
|
-
allowed: false;
|
|
1295
|
-
message: string;
|
|
1296
|
-
reasons: PermissionDeniedReason[];
|
|
1297
|
-
} | {
|
|
1298
|
-
allowed: true;
|
|
1299
|
-
message?: undefined;
|
|
1300
|
-
reasons?: undefined;
|
|
1301
|
-
};
|
|
1302
|
-
interface SharedListener {
|
|
1303
|
-
events: Observable<ListenEvent<SanityDocument$1>>;
|
|
1304
|
-
dispose: () => void;
|
|
1305
|
-
}
|
|
1306
|
-
interface DocumentStoreState {
|
|
1307
|
-
documentStates: { [TDocumentId in string]?: DocumentState; };
|
|
1308
|
-
queued: QueuedTransaction[];
|
|
1309
|
-
applied: AppliedTransaction[];
|
|
1310
|
-
outgoing?: OutgoingTransaction;
|
|
1311
|
-
grants?: Record<Grant, ExprNode>;
|
|
1312
|
-
/**
|
|
1313
|
-
* The current user's identity (their user ID).
|
|
1314
|
-
*/
|
|
1315
|
-
identity?: string;
|
|
1316
|
-
error?: unknown;
|
|
1317
|
-
sharedListener: SharedListener;
|
|
1318
|
-
fetchDocument: (documentId: string) => Observable<SanityDocument$3 | null>;
|
|
1319
|
-
events: Subject<DocumentEvent>;
|
|
1320
|
-
}
|
|
1321
|
-
interface DocumentState {
|
|
1322
|
-
id: string;
|
|
1323
|
-
/**
|
|
1324
|
-
* the "remote" local copy that matches the server. represents the last known
|
|
1325
|
-
* server state. this gets updated every time we confirm remote patches
|
|
1326
|
-
*/
|
|
1327
|
-
remote?: SanityDocument$3 | null;
|
|
1328
|
-
/**
|
|
1329
|
-
* the current ephemeral working copy that includes local optimistic changes
|
|
1330
|
-
* that have not yet been confirmed by the server
|
|
1331
|
-
*/
|
|
1332
|
-
local?: SanityDocument$3 | null;
|
|
1333
|
-
/**
|
|
1334
|
-
* the revision that our remote document is at
|
|
1335
|
-
*/
|
|
1336
|
-
remoteRev?: string | null;
|
|
1337
|
-
/**
|
|
1338
|
-
* Array of subscription IDs. This document state will be deleted if there are
|
|
1339
|
-
* no subscribers.
|
|
1340
|
-
*/
|
|
1341
|
-
subscriptions: string[];
|
|
1342
|
-
/**
|
|
1343
|
-
* An object keyed by transaction ID of revisions sent out but that have not
|
|
1344
|
-
* yet been verified yet. When an applied transaction is transitioned to an
|
|
1345
|
-
* outgoing transaction, it also adds unverified revisions for each document
|
|
1346
|
-
* that is part of that outgoing transaction. Transactions are submitted to
|
|
1347
|
-
* the server with a locally generated transaction ID. This way we can observe
|
|
1348
|
-
* when our transaction comes back through the shared listener. Each listener
|
|
1349
|
-
* event that comes back contains a `previousRev`. If we see our own
|
|
1350
|
-
* transaction with a different `previousRev` than expected, we can rebase our
|
|
1351
|
-
* local transactions on top of this new remote.
|
|
1352
|
-
*/
|
|
1353
|
-
unverifiedRevisions?: { [TTransactionId in string]?: UnverifiedDocumentRevision; };
|
|
1354
|
-
/**
|
|
1355
|
-
* transaction IDs recently submitted by this client for this document,
|
|
1356
|
-
* newest last. used to label `remote-patches` events with the correct
|
|
1357
|
-
* `origin` even after the corresponding `unverifiedRevisions` entry has
|
|
1358
|
-
* been pruned (e.g. by a sync event that raced the listener echo). capped
|
|
1359
|
-
* to the most recent entries.
|
|
1360
|
-
*/
|
|
1361
|
-
recentOwnTransactionIds?: string[];
|
|
1362
|
-
}
|
|
1363
|
-
/**
|
|
1364
|
-
* @beta
|
|
1365
|
-
* Options for specifying a document and optionally a path within it.
|
|
1366
|
-
*/
|
|
1367
|
-
interface DocumentOptions<TPath extends string | undefined = undefined, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1368
|
-
path?: TPath;
|
|
1369
|
-
}
|
|
1370
|
-
/** @beta */
|
|
1371
|
-
declare function getDocumentState<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: DocumentOptions<undefined, TDocumentType, TDataset, TProjectId>): StateSource<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`> | undefined | null>;
|
|
1372
|
-
/** @beta */
|
|
1373
|
-
declare function getDocumentState<TPath extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: DocumentOptions<TPath, TDocumentType, TDataset, TProjectId>): StateSource<JsonMatch<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined>;
|
|
1374
|
-
/** @beta */
|
|
1375
|
-
declare function getDocumentState<TData>(instance: SanityInstance, options: DocumentOptions<string | undefined>): StateSource<TData | undefined | null>;
|
|
1376
|
-
/** @beta */
|
|
1377
|
-
declare function resolveDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, docHandle: DocumentHandle<TDocumentType, TDataset, TProjectId>): Promise<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`> | null>;
|
|
1378
|
-
/** @beta */
|
|
1379
|
-
declare function resolveDocument<TData extends SanityDocument$3>(instance: SanityInstance, docHandle: DocumentHandle<string, string, string>): Promise<TData | null>;
|
|
1380
|
-
/** @beta */
|
|
1381
|
-
declare const getDocumentSyncStatus: BoundStoreAction<DocumentStoreState, [doc: DocumentHandle<string, string, string>], StateSource<boolean | undefined>>;
|
|
1382
|
-
type PermissionsStateOptions = {
|
|
1383
|
-
resource?: DocumentResource;
|
|
1384
|
-
actions: DocumentAction[];
|
|
1385
|
-
};
|
|
1386
|
-
/** @beta */
|
|
1387
|
-
declare const getPermissionsState: BoundStoreAction<DocumentStoreState, [PermissionsStateOptions], StateSource<DocumentPermissionsResult>>;
|
|
1388
|
-
/** @beta */
|
|
1389
|
-
declare const resolvePermissions: BoundStoreAction<DocumentStoreState, [options: PermissionsStateOptions], Promise<DocumentPermissionsResult>>;
|
|
1390
|
-
/** @beta */
|
|
1391
|
-
declare const subscribeDocumentEvents: BoundStoreAction<DocumentStoreState, [options: {
|
|
1392
|
-
resource?: DocumentResource;
|
|
1393
|
-
eventHandler: (e: DocumentEvent) => void;
|
|
1394
|
-
}], () => void>;
|
|
1395
|
-
type ActionMap = {
|
|
1396
|
-
create: 'sanity.action.document.version.create';
|
|
1397
|
-
discard: 'sanity.action.document.version.discard';
|
|
1398
|
-
unpublish: 'sanity.action.document.unpublish';
|
|
1399
|
-
delete: 'sanity.action.document.delete';
|
|
1400
|
-
edit: 'sanity.action.document.edit';
|
|
1401
|
-
publish: 'sanity.action.document.publish';
|
|
1402
|
-
releaseCreate: 'sanity.action.release.create';
|
|
1403
|
-
releaseEdit: 'sanity.action.release.edit';
|
|
1404
|
-
releasePublish: 'sanity.action.release.publish';
|
|
1405
|
-
releaseSchedule: 'sanity.action.release.schedule';
|
|
1406
|
-
releaseUnschedule: 'sanity.action.release.unschedule';
|
|
1407
|
-
releaseArchive: 'sanity.action.release.archive';
|
|
1408
|
-
releaseUnarchive: 'sanity.action.release.unarchive';
|
|
1409
|
-
releaseDelete: 'sanity.action.release.delete';
|
|
1410
|
-
};
|
|
1411
|
-
type OptimisticLock = {
|
|
1412
|
-
ifDraftRevisionId?: string;
|
|
1413
|
-
ifPublishedRevisionId?: string;
|
|
1414
|
-
};
|
|
1415
|
-
interface ReleaseMetadataPayload {
|
|
1416
|
-
title?: string;
|
|
1417
|
-
description?: string;
|
|
1418
|
-
intendedPublishAt?: string;
|
|
1419
|
-
releaseType?: 'asap' | 'scheduled' | 'undecided';
|
|
1420
|
-
cardinality?: 'one' | 'many';
|
|
1421
|
-
}
|
|
1422
|
-
type HttpAction = {
|
|
1423
|
-
actionType: ActionMap['create'];
|
|
1424
|
-
publishedId: string;
|
|
1425
|
-
attributes: SanityDocumentLike;
|
|
1426
|
-
} | {
|
|
1427
|
-
actionType: ActionMap['discard'];
|
|
1428
|
-
versionId: string;
|
|
1429
|
-
purge?: boolean;
|
|
1430
|
-
} | {
|
|
1431
|
-
actionType: ActionMap['unpublish'];
|
|
1432
|
-
draftId: string;
|
|
1433
|
-
publishedId: string;
|
|
1434
|
-
} | {
|
|
1435
|
-
actionType: ActionMap['delete'];
|
|
1436
|
-
publishedId: string;
|
|
1437
|
-
includeDrafts?: string[];
|
|
1438
|
-
} | {
|
|
1439
|
-
actionType: ActionMap['edit'];
|
|
1440
|
-
draftId: string;
|
|
1441
|
-
publishedId: string;
|
|
1442
|
-
patch: PatchOperations;
|
|
1443
|
-
} | ({
|
|
1444
|
-
actionType: ActionMap['publish'];
|
|
1445
|
-
draftId: string;
|
|
1446
|
-
publishedId: string;
|
|
1447
|
-
} & OptimisticLock) | {
|
|
1448
|
-
actionType: ActionMap['releaseCreate'];
|
|
1449
|
-
releaseId: string;
|
|
1450
|
-
metadata?: ReleaseMetadataPayload;
|
|
1451
|
-
} | {
|
|
1452
|
-
actionType: ActionMap['releaseEdit'];
|
|
1453
|
-
releaseId: string;
|
|
1454
|
-
patch: PatchOperations;
|
|
1455
|
-
} | {
|
|
1456
|
-
actionType: ActionMap['releasePublish'];
|
|
1457
|
-
releaseId: string;
|
|
1458
|
-
} | {
|
|
1459
|
-
actionType: ActionMap['releaseSchedule'];
|
|
1460
|
-
releaseId: string;
|
|
1461
|
-
publishAt: string;
|
|
1462
|
-
} | {
|
|
1463
|
-
actionType: ActionMap['releaseUnschedule'];
|
|
1464
|
-
releaseId: string;
|
|
1465
|
-
} | {
|
|
1466
|
-
actionType: ActionMap['releaseArchive'];
|
|
1467
|
-
releaseId: string;
|
|
1468
|
-
} | {
|
|
1469
|
-
actionType: ActionMap['releaseUnarchive'];
|
|
1470
|
-
releaseId: string;
|
|
1471
|
-
} | {
|
|
1472
|
-
actionType: ActionMap['releaseDelete'];
|
|
1473
|
-
releaseId: string;
|
|
1474
|
-
};
|
|
1475
|
-
/**
|
|
1476
|
-
* Represents a transaction that is queued to be applied but has not yet been
|
|
1477
|
-
* applied. A transaction will remain in a queued state until all required
|
|
1478
|
-
* documents for the transactions are available locally.
|
|
1479
|
-
*/
|
|
1480
|
-
interface QueuedTransaction {
|
|
1481
|
-
/**
|
|
1482
|
-
* the ID of this transaction. this is generated client-side.
|
|
1483
|
-
*/
|
|
1484
|
-
transactionId: string;
|
|
1485
|
-
/**
|
|
1486
|
-
* the high-level actions associated with this transaction. note that these
|
|
1487
|
-
* actions don't mention draft IDs and is meant to abstract away the draft
|
|
1488
|
-
* model from users.
|
|
1489
|
-
*/
|
|
1490
|
-
actions: Action[];
|
|
1491
|
-
/**
|
|
1492
|
-
* An optional flag set to disable this transaction from being batched with
|
|
1493
|
-
* other transactions.
|
|
1494
|
-
*/
|
|
1495
|
-
disableBatching?: boolean;
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Represents a transaction that has been applied locally but has not been
|
|
1499
|
-
* committed/transitioned-to-outgoing. These transactions are visible to the
|
|
1500
|
-
* user but may be rebased upon a new working document set. Applied transactions
|
|
1501
|
-
* also contain the resulting `outgoingActions` that will be submitted to
|
|
1502
|
-
* Content Lake. These `outgoingActions` depend on the state of the working
|
|
1503
|
-
* documents so they are recomputed on rebase and are only relevant to applied
|
|
1504
|
-
* actions (we cannot compute `outgoingActions` for queued transactions because
|
|
1505
|
-
* we haven't resolved the set of documents the actions are dependent on yet).
|
|
1506
|
-
*
|
|
1507
|
-
* In order to support better conflict resolution, the original `previous` set
|
|
1508
|
-
* is saved as the `base` set.
|
|
1509
|
-
*/
|
|
1510
|
-
interface AppliedTransaction extends QueuedTransaction {
|
|
1511
|
-
/**
|
|
1512
|
-
* the resulting set of documents after the actions have been applied
|
|
1513
|
-
*/
|
|
1514
|
-
working: DocumentSet;
|
|
1515
|
-
/**
|
|
1516
|
-
* the previous set of documents before the action was applied
|
|
1517
|
-
*/
|
|
1518
|
-
previous: DocumentSet;
|
|
1519
|
-
/**
|
|
1520
|
-
* the original `previous` document set captured when this action was
|
|
1521
|
-
* originally applied. this is used as a reference point to do a 3-way merge
|
|
1522
|
-
* if this applied transaction ever needs to be reapplied on a different
|
|
1523
|
-
* set of documents.
|
|
1524
|
-
*/
|
|
1525
|
-
base: DocumentSet;
|
|
1526
|
-
/**
|
|
1527
|
-
* the `_rev`s from `previous` document set
|
|
1528
|
-
*/
|
|
1529
|
-
previousRevs: { [TDocumentId in string]?: string; };
|
|
1530
|
-
/**
|
|
1531
|
-
* a timestamp for when this transaction was applied locally
|
|
1532
|
-
*/
|
|
1533
|
-
timestamp: string;
|
|
1534
|
-
/**
|
|
1535
|
-
* the resulting HTTP actions derived from the state of the `working` document
|
|
1536
|
-
* set. these are sent to Content Lake as-is when this transaction is batched
|
|
1537
|
-
* and transitioned into an outgoing transaction.
|
|
1538
|
-
*/
|
|
1539
|
-
outgoingActions: HttpAction[];
|
|
1540
|
-
/**
|
|
1541
|
-
* similar to `outgoingActions` but comprised of mutations instead of actions.
|
|
1542
|
-
* Useful for debugging, and is also used by liveEdit documents to send mutations,
|
|
1543
|
-
* since they can't use the Actions API which is pretty dependent on the draft model.
|
|
1544
|
-
*/
|
|
1545
|
-
outgoingMutations: Mutation[];
|
|
1546
|
-
}
|
|
1547
|
-
/**
|
|
1548
|
-
* Represents a set of applied transactions batched into a single outgoing
|
|
1549
|
-
* transaction. An outgoing transaction is the result of batching many applied
|
|
1550
|
-
* actions. An outgoing transaction may be reverted locally if the server
|
|
1551
|
-
* does not accept it.
|
|
1552
|
-
*/
|
|
1553
|
-
interface OutgoingTransaction extends AppliedTransaction {
|
|
1554
|
-
disableBatching: boolean;
|
|
1555
|
-
batchedTransactionIds: string[];
|
|
1556
|
-
}
|
|
1557
|
-
interface UnverifiedDocumentRevision {
|
|
1558
|
-
transactionId: string;
|
|
1559
|
-
documentId: string;
|
|
1560
|
-
previousRev: string | undefined;
|
|
1561
|
-
timestamp: string;
|
|
1562
|
-
}
|
|
1563
|
-
/** @beta Response body from submitting an outgoing transaction (actions or mutations API). */
|
|
1564
|
-
type DocumentTransactionSubmissionResult = Awaited<ReturnType<SanityClient['action']>> | MultipleMutationResult;
|
|
1565
|
-
/** @beta */
|
|
1566
|
-
type DocumentEvent = ActionErrorEvent | TransactionRevertedEvent | TransactionAcceptedEvent | DocumentRebaseErrorEvent | DocumentEditedEvent | DocumentCreatedEvent | DocumentDeletedEvent | DocumentPublishedEvent | DocumentUnpublishedEvent | DocumentDiscardedEvent | DocumentRemotePatchesEvent;
|
|
1567
|
-
/**
|
|
1568
|
-
* @beta
|
|
1569
|
-
* Event emitted when a precondition to applying an action fails.
|
|
1570
|
-
* (For example: when trying to edit a document that no longer exists.)
|
|
1571
|
-
*/
|
|
1572
|
-
interface ActionErrorEvent {
|
|
1573
|
-
type: 'error';
|
|
1574
|
-
documentId: string;
|
|
1575
|
-
transactionId: string;
|
|
1576
|
-
message: string;
|
|
1577
|
-
error: unknown;
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* @beta
|
|
1581
|
-
* Event emitted when a transaction is accepted.
|
|
1582
|
-
*/
|
|
1583
|
-
interface TransactionAcceptedEvent {
|
|
1584
|
-
type: 'accepted';
|
|
1585
|
-
outgoing: OutgoingTransaction;
|
|
1586
|
-
result: DocumentTransactionSubmissionResult;
|
|
1587
|
-
}
|
|
1588
|
-
/**
|
|
1589
|
-
* @beta
|
|
1590
|
-
* Event emitted when a transaction is reverted.
|
|
1591
|
-
*/
|
|
1592
|
-
interface TransactionRevertedEvent {
|
|
1593
|
-
type: 'reverted';
|
|
1594
|
-
message: string;
|
|
1595
|
-
error: unknown;
|
|
1596
|
-
outgoing: OutgoingTransaction;
|
|
1597
|
-
}
|
|
1598
|
-
/**
|
|
1599
|
-
* @beta
|
|
1600
|
-
* Event emitted when an attempt to apply local changes to a modified remote document fails.
|
|
1601
|
-
*/
|
|
1602
|
-
interface DocumentRebaseErrorEvent {
|
|
1603
|
-
type: 'rebase-error';
|
|
1604
|
-
documentId: string;
|
|
1605
|
-
transactionId: string;
|
|
1606
|
-
message: string;
|
|
1607
|
-
error: unknown;
|
|
1608
|
-
}
|
|
1609
|
-
/**
|
|
1610
|
-
* @beta
|
|
1611
|
-
* Event emitted when a document is edited.
|
|
1612
|
-
*/
|
|
1613
|
-
interface DocumentEditedEvent {
|
|
1614
|
-
type: 'edited';
|
|
1615
|
-
documentId: string;
|
|
1616
|
-
outgoing: OutgoingTransaction;
|
|
1617
|
-
}
|
|
1618
|
-
/**
|
|
1619
|
-
* @beta
|
|
1620
|
-
* Event emitted when a document is created.
|
|
1621
|
-
*/
|
|
1622
|
-
interface DocumentCreatedEvent {
|
|
1623
|
-
type: 'created';
|
|
1624
|
-
documentId: string;
|
|
1625
|
-
outgoing: OutgoingTransaction;
|
|
1626
|
-
}
|
|
1627
|
-
/**
|
|
1628
|
-
* @beta
|
|
1629
|
-
* Event emitted when a document is deleted.
|
|
1630
|
-
*/
|
|
1631
|
-
interface DocumentDeletedEvent {
|
|
1632
|
-
type: 'deleted';
|
|
1633
|
-
documentId: string;
|
|
1634
|
-
outgoing: OutgoingTransaction;
|
|
1635
|
-
}
|
|
1636
|
-
/**
|
|
1637
|
-
* @beta
|
|
1638
|
-
* Event emitted when a document is published.
|
|
1639
|
-
*/
|
|
1640
|
-
interface DocumentPublishedEvent {
|
|
1641
|
-
type: 'published';
|
|
1642
|
-
documentId: string;
|
|
1643
|
-
outgoing: OutgoingTransaction;
|
|
1644
|
-
}
|
|
1645
|
-
/**
|
|
1646
|
-
* @beta
|
|
1647
|
-
* Event emitted when a document is unpublished.
|
|
1648
|
-
*/
|
|
1649
|
-
interface DocumentUnpublishedEvent {
|
|
1650
|
-
type: 'unpublished';
|
|
1651
|
-
documentId: string;
|
|
1652
|
-
outgoing: OutgoingTransaction;
|
|
1653
|
-
}
|
|
1654
|
-
/**
|
|
1655
|
-
* @beta
|
|
1656
|
-
* Event emitted when a document version is discarded.
|
|
1657
|
-
*/
|
|
1658
|
-
interface DocumentDiscardedEvent {
|
|
1659
|
-
type: 'discarded';
|
|
1660
|
-
documentId: string;
|
|
1661
|
-
outgoing: OutgoingTransaction;
|
|
1662
|
-
}
|
|
1663
|
-
/**
|
|
1664
|
-
* @beta
|
|
1665
|
-
* Event emitted when patches for a document are observed through the listener.
|
|
1666
|
-
*
|
|
1667
|
-
* Unlike the whole-document snapshots the store keeps, these are the raw patch
|
|
1668
|
-
* operations from the transaction that produced the change, preserving the
|
|
1669
|
-
* operational intent of the edit (e.g. keyed array inserts/unsets). Consumers
|
|
1670
|
-
* that maintain their own local state, like collaborative text editors, can
|
|
1671
|
-
* apply these directly instead of diffing document snapshots.
|
|
1672
|
-
*
|
|
1673
|
-
* `origin` is `'local'` when the transaction was submitted by this document
|
|
1674
|
-
* store instance (an own edit observed back through the listener) and
|
|
1675
|
-
* `'remote'` when it came from another client.
|
|
1676
|
-
*/
|
|
1677
|
-
interface DocumentRemotePatchesEvent {
|
|
1678
|
-
type: 'remote-patches';
|
|
1679
|
-
/** The ID of the document version the patches apply to (e.g. a draft ID). */
|
|
1680
|
-
documentId: string;
|
|
1681
|
-
/** The transaction ID that carried these patches. */
|
|
1682
|
-
transactionId: string;
|
|
1683
|
-
/** The revision the document was at before this transaction. */
|
|
1684
|
-
previousRev?: string;
|
|
1685
|
-
/** The timestamp of the transaction. */
|
|
1686
|
-
timestamp: string;
|
|
1687
|
-
/** The patch operations, rooted at the document. */
|
|
1688
|
-
patches: PatchOperations[];
|
|
1689
|
-
/** Whether the transaction originated from this client or another one. */
|
|
1690
|
-
origin: 'local' | 'remote';
|
|
1691
|
-
}
|
|
1692
|
-
/** @beta */
|
|
1693
|
-
interface ActionsResult<TDocument extends SanityDocument$3 = SanityDocument$3> {
|
|
1694
|
-
transactionId: string;
|
|
1695
|
-
documents: DocumentSet<TDocument>;
|
|
1696
|
-
previous: DocumentSet<TDocument>;
|
|
1697
|
-
previousRevs: {
|
|
1698
|
-
[documentId: string]: string | undefined;
|
|
1699
|
-
};
|
|
1700
|
-
appeared: string[];
|
|
1701
|
-
updated: string[];
|
|
1702
|
-
disappeared: string[];
|
|
1703
|
-
submitted: () => Promise<DocumentTransactionSubmissionResult>;
|
|
1704
|
-
}
|
|
1705
|
-
/** @beta */
|
|
1706
|
-
interface ApplyDocumentActionsOptions {
|
|
1707
|
-
/**
|
|
1708
|
-
* List of actions to apply. Accepts both document actions and release
|
|
1709
|
-
* lifecycle actions because they share the same transaction pipeline.
|
|
1710
|
-
*/
|
|
1711
|
-
actions: Action[];
|
|
1712
|
-
/**
|
|
1713
|
-
* The resource to which the documents being acted on belong.
|
|
1714
|
-
*/
|
|
1715
|
-
resource?: DocumentResource;
|
|
1716
|
-
/**
|
|
1717
|
-
* Optionally provide an ID to be used as this transaction ID
|
|
1718
|
-
*/
|
|
1719
|
-
transactionId?: string;
|
|
1720
|
-
/**
|
|
1721
|
-
* Set this to true to prevent this action from being batched with others.
|
|
1722
|
-
*/
|
|
1723
|
-
disableBatching?: boolean;
|
|
1724
|
-
}
|
|
1725
|
-
/** @beta */
|
|
1726
|
-
declare function applyDocumentActions<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ApplyDocumentActionsOptions): Promise<ActionsResult<SanityDocument$3<TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
1727
|
-
/** @beta */
|
|
1728
|
-
declare function applyDocumentActions(instance: SanityInstance, options: ApplyDocumentActionsOptions): Promise<ActionsResult>;
|
|
1729
|
-
/**
|
|
1730
|
-
* Returns the full release document ID for the given release name.
|
|
1731
|
-
* e.g. `getReleaseDocumentId('my-release') === '_.releases.my-release'`
|
|
1732
|
-
* @beta
|
|
1733
|
-
*/
|
|
1734
|
-
declare function getReleaseDocumentId(releaseId: string): string;
|
|
1735
|
-
/**
|
|
1736
|
-
* @public
|
|
1737
|
-
*/
|
|
1738
|
-
interface FavoriteStatusResponse {
|
|
1739
|
-
isFavorited: boolean;
|
|
1740
|
-
}
|
|
1741
|
-
/**
|
|
1742
|
-
* @public
|
|
1743
|
-
*/
|
|
1744
|
-
interface FavoriteDocumentContext extends DocumentHandle {
|
|
1745
|
-
resourceId: string;
|
|
1746
|
-
resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource$1['type'];
|
|
1747
|
-
schemaName?: string;
|
|
1748
|
-
}
|
|
1749
|
-
/**
|
|
1750
|
-
* Gets a StateSource for the favorite status of a document.
|
|
1751
|
-
* @param instance - The Sanity instance.
|
|
1752
|
-
* @param context - The document context including ID, type, and resource information.
|
|
1753
|
-
* @returns A StateSource emitting `{ isFavorited: boolean }`.
|
|
1754
|
-
* @public
|
|
1755
|
-
*/
|
|
1756
|
-
declare const getFavoritesState: BoundStoreAction<import("../_exports").FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], import("../_exports").StateSource<FavoriteStatusResponse | undefined>>;
|
|
1757
|
-
/**
|
|
1758
|
-
* Resolves the favorite status for a document.
|
|
1759
|
-
* @param instance - The Sanity instance.
|
|
1760
|
-
* @param context - The document context including ID, type, and resource information.
|
|
1761
|
-
* @returns A Promise resolving to `{ isFavorited: boolean }`.
|
|
1762
|
-
* @public
|
|
1763
|
-
*/
|
|
1764
|
-
declare const resolveFavoritesState: BoundStoreAction<import("../_exports").FetcherStoreState<[FavoriteDocumentContext], FavoriteStatusResponse>, [FavoriteDocumentContext], Promise<FavoriteStatusResponse>>;
|
|
1765
|
-
/**
|
|
1766
|
-
* Related data the Installations API can embed in a response. Each token adds
|
|
1767
|
-
* a top-level field to the {@link Installation} item.
|
|
1768
|
-
*
|
|
1769
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1770
|
-
* @public
|
|
1771
|
-
*/
|
|
1772
|
-
type InstallationInclude = 'activeConfig' | 'access' | 'interfaces';
|
|
1773
|
-
/**
|
|
1774
|
-
* A resource an installation accesses, embedded when `access` is included.
|
|
1775
|
-
*
|
|
1776
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1777
|
-
* @public
|
|
1778
|
-
*/
|
|
1779
|
-
interface InstallationAccess {
|
|
1780
|
-
id: string;
|
|
1781
|
-
resourceType: 'datasets' | 'canvases' | 'dashboards' | 'media-libraries';
|
|
1782
|
-
resourceId: string;
|
|
1783
|
-
}
|
|
1784
|
-
/**
|
|
1785
|
-
* An interface exposed by an installation, embedded when `interfaces` is
|
|
1786
|
-
* included.
|
|
1787
|
-
*
|
|
1788
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1789
|
-
* @public
|
|
1790
|
-
*/
|
|
1791
|
-
interface InstallationInterface {
|
|
1792
|
-
id: string;
|
|
1793
|
-
type: 'app' | 'worker' | 'asset_source' | 'panel';
|
|
1794
|
-
name: string;
|
|
1795
|
-
title: string;
|
|
1796
|
-
version: string;
|
|
1797
|
-
/** Module federation module ID; resolved from the host mf-manifest at runtime */
|
|
1798
|
-
moduleId: string;
|
|
1799
|
-
metadata: {
|
|
1800
|
-
group?: string;
|
|
1801
|
-
priority?: number;
|
|
1802
|
-
} | null;
|
|
1803
|
-
}
|
|
1804
|
-
/**
|
|
1805
|
-
* The active config of an installation, embedded when `activeConfig` is
|
|
1806
|
-
* included. `null` when nothing is deployed.
|
|
1807
|
-
*
|
|
1808
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1809
|
-
* @public
|
|
1810
|
-
*/
|
|
1811
|
-
interface InstallationActiveConfig {
|
|
1812
|
-
id: string;
|
|
1813
|
-
installationId: string;
|
|
1814
|
-
deployedBy: string | null;
|
|
1815
|
-
version: string;
|
|
1816
|
-
isActive: boolean;
|
|
1817
|
-
createdAt: string;
|
|
1818
|
-
}
|
|
1819
|
-
/**
|
|
1820
|
-
* The always-present fields of an active singleton installation returned by the
|
|
1821
|
-
* Installations API (`/installations`), before any {@link InstallationInclude}.
|
|
1822
|
-
*
|
|
1823
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1824
|
-
* @public
|
|
1825
|
-
*/
|
|
1826
|
-
interface InstallationBase {
|
|
1827
|
-
id: string;
|
|
1828
|
-
applicationId: string;
|
|
1829
|
-
organizationId: string;
|
|
1830
|
-
installedBy: string | null;
|
|
1831
|
-
createdAt: string;
|
|
1832
|
-
updatedAt: string;
|
|
1833
|
-
application: {
|
|
1834
|
-
title: string;
|
|
1835
|
-
slug: string | null;
|
|
1836
|
-
};
|
|
1837
|
-
}
|
|
1838
|
-
/**
|
|
1839
|
-
* An active singleton installation as returned by the Installations API
|
|
1840
|
-
* (`/installations`). `activeConfig`, `access` and `interfaces` are top-level
|
|
1841
|
-
* fields, each present only when the matching {@link InstallationInclude} token
|
|
1842
|
-
* was requested.
|
|
1843
|
-
*
|
|
1844
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1845
|
-
* @public
|
|
1846
|
-
*/
|
|
1847
|
-
type Installation<Include extends InstallationInclude = never> = InstallationBase & Included<InstallationInclude, 'activeConfig', Include, {
|
|
1848
|
-
activeConfig: InstallationActiveConfig | null;
|
|
1849
|
-
}> & Included<InstallationInclude, 'access', Include, {
|
|
1850
|
-
access: InstallationAccess[];
|
|
1851
|
-
}> & Included<InstallationInclude, 'interfaces', Include, {
|
|
1852
|
-
interfaces: InstallationInterface[];
|
|
1853
|
-
}>;
|
|
1854
|
-
/**
|
|
1855
|
-
* Options for listing an organization's installations.
|
|
1856
|
-
*
|
|
1857
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1858
|
-
* @public
|
|
1859
|
-
*/
|
|
1860
|
-
interface InstallationsOptions<Include extends InstallationInclude = InstallationInclude> {
|
|
1861
|
-
organizationId: string;
|
|
1862
|
-
include?: Include[];
|
|
1863
|
-
/** Page size (1-100, default 50), or `'none'` to disable pagination */
|
|
1864
|
-
limit?: number | 'none';
|
|
1865
|
-
/** Cursor from a previous response's `nextCursor` */
|
|
1866
|
-
cursor?: string;
|
|
1867
|
-
}
|
|
1868
|
-
/**
|
|
1869
|
-
* The cursor-paginated envelope returned by `GET /installations`.
|
|
1870
|
-
*
|
|
1871
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1872
|
-
* @public
|
|
1873
|
-
*/
|
|
1874
|
-
interface InstallationsResponse<Include extends InstallationInclude = never> {
|
|
1875
|
-
nextCursor: string | null;
|
|
1876
|
-
data: Installation<Include>[];
|
|
1877
|
-
}
|
|
1878
|
-
/**
|
|
1879
|
-
* Fetcher for an organization's installations (`GET /installations`), on the
|
|
1880
|
-
* shared fetcher cache.
|
|
1881
|
-
*
|
|
1882
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1883
|
-
* @internal
|
|
1884
|
-
*/
|
|
1885
|
-
declare const installations: Fetcher<[options: InstallationsOptions<InstallationInclude>], InstallationsResponse<InstallationInclude>>;
|
|
1886
|
-
/**
|
|
1887
|
-
* Fetcher for a single installation (`GET /installations/:id`), on the shared
|
|
1888
|
-
* fetcher cache. No pre-seeding from {@link installations}: its list keys
|
|
1889
|
-
* include the organization, which this fetcher's params can't reconstruct.
|
|
1890
|
-
*
|
|
1891
|
-
* @see https://www.sanity.io/docs/http-reference/applications-api
|
|
1892
|
-
* @internal
|
|
1893
|
-
*/
|
|
1894
|
-
declare const installation: Fetcher<[installationId: string, options?: {
|
|
1895
|
-
include?: InstallationInclude[];
|
|
1896
|
-
} | undefined], Installation<InstallationInclude>>;
|
|
1897
|
-
/** @public */
|
|
1898
|
-
interface OrganizationMember {
|
|
1899
|
-
sanityUserId: string;
|
|
1900
|
-
isCurrentUser: boolean;
|
|
1901
|
-
user: {
|
|
1902
|
-
id: string;
|
|
1903
|
-
displayName: string;
|
|
1904
|
-
familyName: string;
|
|
1905
|
-
givenName: string;
|
|
1906
|
-
middleName: string | null;
|
|
1907
|
-
imageUrl: string | null;
|
|
1908
|
-
email: string;
|
|
1909
|
-
loginProvider: string;
|
|
1910
|
-
};
|
|
1911
|
-
roles: Array<{
|
|
1912
|
-
name: string;
|
|
1913
|
-
title: string;
|
|
1914
|
-
description?: string;
|
|
1915
|
-
}>;
|
|
1916
|
-
}
|
|
1917
|
-
/**
|
|
1918
|
-
* The base fields returned from `/organizations/<id>` for every organization.
|
|
1919
|
-
* @public
|
|
1920
|
-
*/
|
|
1921
|
-
interface OrganizationBase {
|
|
1922
|
-
id: string;
|
|
1923
|
-
name: string;
|
|
1924
|
-
slug: string | null;
|
|
1925
|
-
createdAt: string;
|
|
1926
|
-
createdByUserId: string;
|
|
1927
|
-
updatedAt: string;
|
|
1928
|
-
deletedAt: string | null;
|
|
1929
|
-
dashboardStatus: 'enabled' | 'disabled';
|
|
1930
|
-
aiFeaturesStatus: 'enabled' | 'disabled';
|
|
1931
|
-
mediaLibraryStatus: 'enabled' | 'disabled';
|
|
1932
|
-
requestAccessStatus: 'allowed' | 'disabled';
|
|
1933
|
-
telemetryConsentStatus: 'allowed' | 'msa_denied' | 'customer_denied';
|
|
1934
|
-
oauthAppsStatus: 'allowed' | 'blocked';
|
|
1935
|
-
defaultRoleName: string;
|
|
1936
|
-
domains: string[] | null;
|
|
1937
|
-
}
|
|
1938
|
-
/** @public */
|
|
1939
|
-
interface OrganizationOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> {
|
|
1940
|
-
includeMembers?: IncludeMembers;
|
|
1941
|
-
includeFeatures?: IncludeFeatures;
|
|
1942
|
-
organizationId: string;
|
|
1943
|
-
}
|
|
1944
|
-
/**
|
|
1945
|
-
* An `Organization` with `members` and/or `features` conditionally included
|
|
1946
|
-
* based on the query options used to fetch it.
|
|
1947
|
-
* @public
|
|
1948
|
-
*/
|
|
1949
|
-
type Organization<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = OrganizationBase & (boolean extends IncludeMembers ? {
|
|
1950
|
-
members?: OrganizationMember[];
|
|
1951
|
-
} : IncludeMembers extends true ? {
|
|
1952
|
-
members: OrganizationMember[];
|
|
1953
|
-
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1954
|
-
features?: string[];
|
|
1955
|
-
} : IncludeFeatures extends true ? {
|
|
1956
|
-
features: string[];
|
|
1957
|
-
} : unknown);
|
|
1958
|
-
/**
|
|
1959
|
-
* Fetcher for a single organization (`GET /organizations/:id`), on the shared
|
|
1960
|
-
* fetcher cache. No pre-seeding from the organizations list: it returns a
|
|
1961
|
-
* subset of the detail fields, and a partial seed would serve as fresh for
|
|
1962
|
-
* the whole stale window.
|
|
1963
|
-
*
|
|
1964
|
-
* @internal
|
|
1965
|
-
*/
|
|
1966
|
-
declare const organization: Fetcher<[options?: OrganizationOptions<boolean, boolean> | undefined], Organization<boolean, boolean>>;
|
|
1967
|
-
/**
|
|
1968
|
-
* The list shape returned from `/organizations`, with `members` and/or
|
|
1969
|
-
* `features` conditionally included based on the query options used.
|
|
1970
|
-
* @public
|
|
1971
|
-
*/
|
|
1972
|
-
type Organizations<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> = (Pick<OrganizationBase, 'id' | 'name' | 'slug' | 'createdAt' | 'updatedAt' | 'defaultRoleName' | 'dashboardStatus' | 'aiFeaturesStatus'> & (boolean extends IncludeMembers ? {
|
|
1973
|
-
members?: OrganizationMember[];
|
|
1974
|
-
} : IncludeMembers extends true ? {
|
|
1975
|
-
members: OrganizationMember[];
|
|
1976
|
-
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
1977
|
-
features?: string[];
|
|
1978
|
-
} : IncludeFeatures extends true ? {
|
|
1979
|
-
features: string[];
|
|
1980
|
-
} : unknown))[];
|
|
1981
|
-
/** @public */
|
|
1982
|
-
interface OrganizationsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false> extends Omit<OrganizationOptions<IncludeMembers, IncludeFeatures>, 'organizationId'> {
|
|
1983
|
-
/**
|
|
1984
|
-
* When `true`, includes organisations the user has access to via
|
|
1985
|
-
* project-level grants, not just direct organisation memberships.
|
|
1986
|
-
*/
|
|
1987
|
-
includeImplicitMemberships?: boolean;
|
|
1988
|
-
}
|
|
1989
|
-
/**
|
|
1990
|
-
* Fetcher for the current user's organizations (`GET /organizations`), on the
|
|
1991
|
-
* shared fetcher cache.
|
|
1992
|
-
*
|
|
1993
|
-
* @internal
|
|
1994
|
-
*/
|
|
1995
|
-
declare const organizations: Fetcher<[options?: OrganizationsOptions<boolean, boolean> | undefined], Organizations<boolean, boolean>>;
|
|
1996
|
-
/** @public */
|
|
1997
|
-
interface PresenceLocation {
|
|
1998
|
-
type: 'document';
|
|
1999
|
-
documentId: string;
|
|
2000
|
-
path: string[];
|
|
2001
|
-
lastActiveAt: string;
|
|
2002
|
-
}
|
|
2003
|
-
/** @public */
|
|
2004
|
-
interface UserPresence {
|
|
2005
|
-
user: SanityUser;
|
|
2006
|
-
locations: PresenceLocation[];
|
|
2007
|
-
sessionId: string;
|
|
2008
|
-
}
|
|
2009
|
-
/** @public */
|
|
2010
|
-
type TransportEvent = RollCallEvent | StateEvent | DisconnectEvent;
|
|
2011
|
-
/** @public */
|
|
2012
|
-
interface RollCallEvent {
|
|
2013
|
-
type: 'rollCall';
|
|
2014
|
-
userId: string;
|
|
2015
|
-
sessionId: string;
|
|
2016
|
-
}
|
|
2017
|
-
/** @public */
|
|
2018
|
-
interface StateEvent {
|
|
2019
|
-
type: 'state';
|
|
2020
|
-
userId: string;
|
|
2021
|
-
sessionId: string;
|
|
2022
|
-
timestamp: string;
|
|
2023
|
-
locations: PresenceLocation[];
|
|
2024
|
-
}
|
|
2025
|
-
/** @public */
|
|
2026
|
-
interface DisconnectEvent {
|
|
2027
|
-
type: 'disconnect';
|
|
2028
|
-
userId: string;
|
|
2029
|
-
sessionId: string;
|
|
2030
|
-
timestamp: string;
|
|
2031
|
-
}
|
|
2032
|
-
/** @beta */
|
|
2033
|
-
declare function getPresence(instance: SanityInstance, params?: {
|
|
2034
|
-
resource?: DocumentResource;
|
|
2035
|
-
}): StateSource<UserPresence[]>;
|
|
2036
|
-
/**
|
|
2037
|
-
* @beta
|
|
2038
|
-
* @deprecated This type is deprecated and will be removed in a future release.
|
|
2039
|
-
*/
|
|
2040
|
-
type GetPreviewStateOptions = DocumentHandle;
|
|
2041
|
-
/**
|
|
2042
|
-
* @beta
|
|
2043
|
-
* @deprecated This function is deprecated and will be removed in a future release.
|
|
2044
|
-
*/
|
|
2045
|
-
declare function getPreviewState<TResult extends object>(instance: SanityInstance, options: GetPreviewStateOptions): StateSource<ValuePending<TResult>>;
|
|
2046
|
-
/**
|
|
2047
|
-
* @beta
|
|
2048
|
-
* @deprecated This function is deprecated and will be removed in a future release.
|
|
2049
|
-
*/
|
|
2050
|
-
declare function getPreviewState(instance: SanityInstance, options: GetPreviewStateOptions): StateSource<ValuePending<PreviewValue>>;
|
|
2051
|
-
/**
|
|
2052
|
-
* @beta
|
|
2053
|
-
* @deprecated This type is deprecated and will be removed in a future release.
|
|
2054
|
-
*/
|
|
2055
|
-
type ResolvePreviewOptions = DocumentHandle;
|
|
2056
|
-
/**
|
|
2057
|
-
* @beta
|
|
2058
|
-
* @deprecated This function is deprecated and will be removed in a future release.
|
|
2059
|
-
*/
|
|
2060
|
-
declare function resolvePreview(instance: SanityInstance, options: ResolvePreviewOptions): Promise<ValuePending<PreviewValue>>;
|
|
2061
|
-
/** @public */
|
|
2062
|
-
interface ProjectMemberRole {
|
|
2063
|
-
name: string;
|
|
2064
|
-
title: string;
|
|
2065
|
-
description: string;
|
|
2066
|
-
}
|
|
2067
|
-
/** @public */
|
|
2068
|
-
interface ProjectMember {
|
|
2069
|
-
id: string;
|
|
2070
|
-
createdAt: string;
|
|
2071
|
-
updatedAt: string;
|
|
2072
|
-
isCurrentUser: boolean;
|
|
2073
|
-
isRobot: boolean;
|
|
2074
|
-
roles: ProjectMemberRole[];
|
|
2075
|
-
}
|
|
2076
|
-
/** @public */
|
|
2077
|
-
interface ProjectMetadata {
|
|
2078
|
-
color?: string;
|
|
2079
|
-
externalStudioHost?: string;
|
|
2080
|
-
initialTemplate?: string;
|
|
2081
|
-
cliInitializedAt?: string;
|
|
2082
|
-
integration: 'manage' | 'cli';
|
|
2083
|
-
}
|
|
2084
|
-
/**
|
|
2085
|
-
* The base fields returned from `/projects` for every project.
|
|
2086
|
-
* @public
|
|
2087
|
-
*/
|
|
2088
|
-
interface ProjectBase {
|
|
2089
|
-
id: string;
|
|
2090
|
-
displayName: string;
|
|
2091
|
-
studioHost: string | null;
|
|
2092
|
-
organizationId: string;
|
|
2093
|
-
metadata: ProjectMetadata;
|
|
2094
|
-
isBlocked: boolean;
|
|
2095
|
-
isDisabled: boolean;
|
|
2096
|
-
isDisabledByUser: boolean;
|
|
2097
|
-
activityFeedEnabled: boolean;
|
|
2098
|
-
createdAt: string;
|
|
2099
|
-
updatedAt: string;
|
|
2100
|
-
}
|
|
2101
|
-
/**
|
|
2102
|
-
* A `Project` with `members` and/or `features` conditionally included
|
|
2103
|
-
* based on the query options used to fetch it.
|
|
2104
|
-
* @public
|
|
2105
|
-
*/
|
|
2106
|
-
type Project<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> = ProjectBase & (boolean extends IncludeMembers ? {
|
|
2107
|
-
members?: ProjectMember[];
|
|
2108
|
-
} : IncludeMembers extends true ? {
|
|
2109
|
-
members: ProjectMember[];
|
|
2110
|
-
} : unknown) & (boolean extends IncludeFeatures ? {
|
|
2111
|
-
features?: string[];
|
|
2112
|
-
} : IncludeFeatures extends true ? {
|
|
2113
|
-
features: string[];
|
|
2114
|
-
} : unknown);
|
|
2115
|
-
/** @public */
|
|
2116
|
-
interface ProjectOptions<IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true> extends ProjectHandle {
|
|
2117
|
-
includeMembers?: IncludeMembers;
|
|
2118
|
-
includeFeatures?: IncludeFeatures;
|
|
2119
|
-
}
|
|
2120
|
-
/**
|
|
2121
|
-
* Fetcher for a single project (`GET /projects/:id`), on the shared fetcher
|
|
2122
|
-
* cache. Pre-seeds from the default {@link projects} list entry when it can
|
|
2123
|
-
* satisfy the read — the default list carries features but not members, so
|
|
2124
|
-
* only `includeMembers: false` reads seed.
|
|
2125
|
-
*
|
|
2126
|
-
* @internal
|
|
2127
|
-
*/
|
|
2128
|
-
declare const project: Fetcher<[options?: ProjectOptions<boolean, boolean> | undefined], Project<boolean, boolean>>;
|
|
2129
|
-
interface ProjectionOptions<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
2130
|
-
projection: TProjection;
|
|
2131
|
-
}
|
|
2132
|
-
/**
|
|
2133
|
-
* @beta
|
|
2134
|
-
*/
|
|
2135
|
-
declare function getProjectionState<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): StateSource<ProjectionValuePending<SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>> | undefined>;
|
|
2136
|
-
/**
|
|
2137
|
-
* @beta
|
|
2138
|
-
*/
|
|
2139
|
-
declare function getProjectionState<TData extends object>(instance: SanityInstance, options: ProjectionOptions): StateSource<ProjectionValuePending<TData> | undefined>;
|
|
2140
|
-
/**
|
|
2141
|
-
* @beta
|
|
2142
|
-
*/
|
|
2143
|
-
declare function getProjectionState(instance: SanityInstance, options: ProjectionOptions): StateSource<ProjectionValuePending<Record<string, unknown>> | undefined>;
|
|
2144
|
-
/** @beta */
|
|
2145
|
-
declare function resolveProjection<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(instance: SanityInstance, options: ProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): Promise<ProjectionValuePending<SanityProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
2146
|
-
/** @beta */
|
|
2147
|
-
declare function resolveProjection<TData extends object>(instance: SanityInstance, options: ProjectionOptions): Promise<ProjectionValuePending<TData>>;
|
|
2148
|
-
/** @public */
|
|
2149
|
-
interface ProjectsOptions<IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true> {
|
|
2150
|
-
organizationId?: string;
|
|
2151
|
-
includeMembers?: IncludeMembers;
|
|
2152
|
-
includeFeatures?: IncludeFeatures;
|
|
2153
|
-
onlyExplicitMembership?: boolean;
|
|
2154
|
-
}
|
|
2155
|
-
/**
|
|
2156
|
-
* Fetcher for the current user's projects (`GET /projects`), on the shared
|
|
2157
|
-
* fetcher cache.
|
|
2158
|
-
*
|
|
2159
|
-
* @internal
|
|
2160
|
-
*/
|
|
2161
|
-
declare const projects: Fetcher<[options?: ProjectsOptions<boolean, boolean> | undefined], Project<boolean, boolean>[]>;
|
|
2162
|
-
/**
|
|
2163
|
-
* Lifecycle states a release document can be in. Mirrors the server's
|
|
2164
|
-
* `ReleaseState`.
|
|
2165
|
-
* @beta
|
|
2166
|
-
*/
|
|
2167
|
-
type ReleaseState = 'active' | 'archiving' | 'unarchiving' | 'archived' | 'published' | 'publishing' | 'scheduled' | 'scheduling';
|
|
2168
|
-
interface ReleasesStoreState {
|
|
2169
|
-
activeReleases?: ReleaseDocument$1[];
|
|
2170
|
-
allReleases?: ReleaseDocument$1[];
|
|
2171
|
-
error?: unknown;
|
|
2172
|
-
}
|
|
2173
|
-
/**
|
|
2174
|
-
* Get the active releases from the store.
|
|
2175
|
-
* @internal
|
|
2176
|
-
*/
|
|
2177
|
-
declare const getActiveReleasesState: (instance: SanityInstance, options?: {
|
|
2178
|
-
resource?: DocumentResource;
|
|
2179
|
-
}) => StateSource<ReleaseDocument$1[] | undefined>;
|
|
2180
|
-
/**
|
|
2181
|
-
* Get every release in the store, including archived and published.
|
|
2182
|
-
* @internal
|
|
2183
|
-
*/
|
|
2184
|
-
declare const getAllReleasesState: (instance: SanityInstance, options?: {
|
|
2185
|
-
resource?: DocumentResource;
|
|
2186
|
-
}) => StateSource<ReleaseDocument$1[] | undefined>;
|
|
2187
|
-
declare const _getPerspectiveStateSelector: StoreAction<ReleasesStoreState, [_?: (PerspectiveHandle & {
|
|
2188
|
-
projectId?: string;
|
|
2189
|
-
dataset?: string;
|
|
2190
|
-
resource?: DocumentResource;
|
|
2191
|
-
}) | undefined], import("../_exports").StateSource<string[] | "previewDrafts" | "published" | "drafts" | "raw" | undefined>, unknown>;
|
|
2192
|
-
type OmitFirst<T extends unknown[]> = T extends [unknown, ...infer R] ? R : never;
|
|
2193
|
-
type SelectorParams = OmitFirst<Parameters<typeof _getPerspectiveStateSelector>>;
|
|
2194
|
-
type BoundGetPerspectiveState = BoundStoreAction<ReleasesStoreState, SelectorParams, ReturnType<typeof _getPerspectiveStateSelector>>;
|
|
2195
|
-
/**
|
|
2196
|
-
* Provides a subscribable state source for a "perspective" for the Sanity client,
|
|
2197
|
-
* which is used to fetch documents as though certain Content Releases are active.
|
|
2198
|
-
*
|
|
2199
|
-
* @param instance - The Sanity instance to get the perspective for
|
|
2200
|
-
* @param options - The options for the perspective -- usually a release name
|
|
2201
|
-
*
|
|
2202
|
-
* @returns A subscribable perspective value, usually a list of applicable release names,
|
|
2203
|
-
* or a single release name / default perspective (such as 'drafts').
|
|
2204
|
-
*
|
|
2205
|
-
* @public
|
|
2206
|
-
*/
|
|
2207
|
-
declare const getPerspectiveState: BoundGetPerspectiveState;
|
|
2208
|
-
/**
|
|
2209
|
-
* Returns the state source for users associated with a specific resource.
|
|
2210
|
-
*
|
|
2211
|
-
* This function returns a state source that represents the current list of users for a given
|
|
2212
|
-
* resource. Subscribing to the state source will instruct the SDK to fetch the users (if not
|
|
2213
|
-
* already fetched) and will load more from this state source as well. When the last subscriber is
|
|
2214
|
-
* removed, the users state is automatically cleaned up from the store after a delay.
|
|
2215
|
-
*
|
|
2216
|
-
* Note: This functionality is for advanced users who want to build their own framework
|
|
2217
|
-
* integrations. Our SDK also provides a React integration for convenient usage.
|
|
2218
|
-
*
|
|
2219
|
-
* @beta
|
|
2220
|
-
*/
|
|
2221
|
-
declare const getUsersState: BoundStoreAction<UsersStoreState, [options?: GetUsersOptions | undefined], import("../_exports").StateSource<{
|
|
2222
|
-
data: SanityUser[];
|
|
2223
|
-
totalCount: number;
|
|
2224
|
-
hasMore: boolean;
|
|
2225
|
-
} | undefined>>;
|
|
2226
|
-
/**
|
|
2227
|
-
* Resolves the users for a specific resource without registering a lasting subscriber.
|
|
2228
|
-
*
|
|
2229
|
-
* This function fetches the users for a given resource and returns a promise that resolves with
|
|
2230
|
-
* the users result. Unlike `getUsersState`, which registers subscribers to keep the data live and
|
|
2231
|
-
* performs automatic cleanup, `resolveUsers` does not track subscribers. This makes it ideal for
|
|
2232
|
-
* use with React Suspense, where the returned promise is thrown to delay rendering until the users
|
|
2233
|
-
* result becomes available. Once the promise resolves, it is expected that a real subscriber will
|
|
2234
|
-
* be added via `getUsersState` to manage ongoing updates.
|
|
2235
|
-
*
|
|
2236
|
-
* Additionally, an optional AbortSignal can be provided to cancel the request and immediately
|
|
2237
|
-
* clear the associated state if there are no active subscribers.
|
|
2238
|
-
*
|
|
2239
|
-
* @beta
|
|
2240
|
-
*/
|
|
2241
|
-
declare const resolveUsers: BoundStoreAction<UsersStoreState, [ResolveUsersOptions], Promise<{
|
|
2242
|
-
data: SanityUser[];
|
|
2243
|
-
totalCount: number;
|
|
2244
|
-
hasMore: boolean;
|
|
2245
|
-
}>>;
|
|
2246
|
-
/**
|
|
2247
|
-
* Loads more users for a specific resource.
|
|
2248
|
-
*
|
|
2249
|
-
* This function triggers a request to fetch the next page of users for a given resource. It
|
|
2250
|
-
* requires that users have already been loaded for the resource (via `resolveUsers` or
|
|
2251
|
-
* `getUsersState`), and that there are more users available to load (as indicated by the `hasMore`
|
|
2252
|
-
* property).
|
|
2253
|
-
*
|
|
2254
|
-
* The function returns a promise that resolves when the next page of users has been loaded.
|
|
2255
|
-
*
|
|
2256
|
-
* @beta
|
|
2257
|
-
*/
|
|
2258
|
-
declare const loadMoreUsers: BoundStoreAction<UsersStoreState, [options?: GetUsersOptions | undefined], Promise<{
|
|
2259
|
-
data: SanityUser[];
|
|
2260
|
-
totalCount: number;
|
|
2261
|
-
hasMore: boolean;
|
|
2262
|
-
}>>;
|
|
2263
|
-
/**
|
|
2264
|
-
* @beta
|
|
2265
|
-
*/
|
|
2266
|
-
declare const getUserState: BoundStoreAction<UsersStoreState, [GetUserOptions], Observable<SanityUser | undefined>>;
|
|
2267
|
-
/**
|
|
2268
|
-
* @beta
|
|
2269
|
-
*/
|
|
2270
|
-
declare const resolveUser: BoundStoreAction<UsersStoreState, [ResolveUserOptions], Promise<SanityUser>>;
|
|
2271
|
-
interface StoreEntry<TParams extends unknown[], TData> {
|
|
2272
|
-
params: TParams;
|
|
2273
|
-
instance: SanityInstance;
|
|
2274
|
-
key: string;
|
|
2275
|
-
data?: TData;
|
|
2276
|
-
error?: unknown;
|
|
2277
|
-
subscriptions: string[];
|
|
2278
|
-
lastFetchInitiatedAt?: string;
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Internal helper type
|
|
2282
|
-
* @public
|
|
2283
|
-
*/
|
|
2284
|
-
interface FetcherStoreState<TParams extends unknown[], TData> {
|
|
2285
|
-
stateByParams: { [TSerializedKey in string]?: StoreEntry<TParams, TData>; };
|
|
2286
|
-
error?: unknown;
|
|
2287
|
-
}
|
|
2288
|
-
/**
|
|
2289
|
-
* Internal helper type
|
|
2290
|
-
* @public
|
|
2291
|
-
*/
|
|
2292
|
-
interface FetcherStore<TParams extends unknown[], TData> {
|
|
2293
|
-
getState: BoundStoreAction<FetcherStoreState<TParams, TData>, TParams, StateSource<TData | undefined>>;
|
|
2294
|
-
resolveState: BoundStoreAction<FetcherStoreState<TParams, TData>, TParams, Promise<TData>>;
|
|
2295
|
-
}
|
|
2296
|
-
/**
|
|
2297
|
-
* @public
|
|
2298
|
-
* Extracts the project ID from a CorsOriginError message.
|
|
2299
|
-
* @param error - The error to extract the project ID from.
|
|
2300
|
-
* @returns The project ID or null if the error is not a CorsOriginError.
|
|
2301
|
-
*/
|
|
2302
|
-
declare function getCorsErrorProjectId(error: Error): string | null;
|
|
2303
|
-
/**
|
|
2304
|
-
* Returns true when the given error looks like a dynamic-import or
|
|
2305
|
-
* code-split chunk-loading failure.
|
|
2306
|
-
*
|
|
2307
|
-
* These errors typically surface when a user has a tab open against a
|
|
2308
|
-
* previously-deployed version of an app and the JavaScript or CSS chunk
|
|
2309
|
-
* filenames have since changed: a fresh deployment removes the hashed assets
|
|
2310
|
-
* the open tab still references. Detecting them lets the SDK trigger an
|
|
2311
|
-
* automatic reload so the user gets the new build without manual intervention.
|
|
2312
|
-
*
|
|
2313
|
-
* Recognized shapes (webpack ChunkLoadError, Vite "Failed to fetch
|
|
2314
|
-
* dynamically imported module", Firefox "error loading dynamically imported
|
|
2315
|
-
* module", Safari "Importing a module script failed", and Vite "Unable to
|
|
2316
|
-
* preload CSS").
|
|
2317
|
-
*
|
|
2318
|
-
* @param error - The value to inspect. Anything that is not an Error
|
|
2319
|
-
* instance returns false.
|
|
2320
|
-
* @returns True if the error matches a known import/chunk-load failure.
|
|
2321
|
-
*
|
|
2322
|
-
* @public
|
|
2323
|
-
*/
|
|
2324
|
-
declare function isImportError(error: unknown): boolean;
|
|
2325
|
-
/**
|
|
2326
|
-
* This version is provided by pkg-utils at build time
|
|
2327
|
-
* @internal
|
|
2328
|
-
*/
|
|
2329
|
-
declare const CORE_SDK_VERSION: {};
|
|
2330
|
-
/**
|
|
2331
|
-
* @public
|
|
2332
|
-
*/
|
|
2333
|
-
type SanityProject = SanityProject$1;
|
|
2334
|
-
export { type AccessResourceType, type Action, type ActionErrorEvent, type ActionsResult, type AgentGenerateOptions, type AgentGenerateResult, type AgentPatchOptions, type AgentPatchResult, type AgentPromptOptions, type AgentPromptResult, type AgentTransformOptions, type AgentTransformResult, type AgentTranslateOptions, type AgentTranslateResult, type ApiErrorBody, type Application, type ApplicationAccess, type ApplicationBase, type ApplicationDeployment, type ApplicationInclude, type ApplicationInterface, type ApplicationStudioConfig, type ApplicationVisibility, type ApplicationWorkspace, type ApplicationsOptions, type ApplicationsResponse, type ApplyDocumentActionsOptions, type ArchiveReleaseAction, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type CanvasResource, type CanvasSource, type ClientOptions, type ClientStoreState as ClientState, type ComlinkControllerState, type ComlinkNodeState, type CreateDocumentAction, type CreateReleaseAction, type CreateUserApplicationInput, type CurrentUser, type DatasetHandle, type DatasetResource, type DatasetSource, type DeleteApplicationInput, type DeleteDocumentAction, type DeleteReleaseAction, type DeleteUserApplicationInput, type DeletedResult, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPublishedEvent, type DocumentRemotePatchesEvent, type DocumentResource, type DocumentSource, type DocumentTransactionSubmissionResult, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type EditDocumentOptions, type EditReleaseAction, type ErrorAuthState, type FavoriteStatusResponse, type FetcherStore, type FetcherStoreState, type FrameMessage, type GetPreviewStateOptions, type GetUserOptions, type GetUsersOptions, type Installation, type InstallationAccess, type InstallationActiveConfig, type InstallationBase, type InstallationInclude, type InstallationInterface, type InstallationsOptions, type InstallationsResponse, type InstanceContext, type JsonMatch, type LogContext, type LogLevel, type LogNamespace, type LoggedInAuthState, type LoggedOutAuthState, type Logger, type LoggerConfig, type LoggingInAuthState, type MediaLibraryResource, type MediaLibrarySource, type Membership, type NewTokenResponseMessage, type NodeState, type OrgVerificationResult, type Organization, type OrganizationBase, type OrganizationMember, type OrganizationOptions, type Organizations, type OrganizationsOptions, PREVIEW_PROJECTION, type PermissionDeniedReason, type PerspectiveHandle, type PresenceLocation, type PreviewMedia, type PreviewQueryResult, type PreviewStoreState, type PreviewValue, type Project, type ProjectBase, type ProjectHandle, type ProjectMember, type ProjectMemberRole, type ProjectMetadata, type ProjectOptions, type ProjectionValuePending, type ProjectsOptions, type PublishDocumentAction, type PublishReleaseAction, type QueryOptions, type ReleaseAction, type ReleaseDocument, type ReleaseHandle, type ReleasePerspective, type ReleaseState, type RequestNewTokenMessage, type ResolvePreviewOptions, type ResolveUserOptions, type ResolveUsersOptions, type Role, type RollCallEvent, type SanityConfig, type SanityDocument, type SanityInstance, SanityProject, type SanityUser, type SanityUserResponse, type ScheduleReleaseAction, type Selector, type StateEvent, type StateSource, type StudioConfig, type TokenSource, type TransactionAcceptedEvent, type TransactionRevertedEvent, type TransportEvent, type UnarchiveReleaseAction, type UnpublishDocumentAction, type UnscheduleReleaseAction, type UpdateApplicationInput, type UpdateUserApplicationInput, type UserApplication, type UserApplicationDeployment, type UserApplicationWriteFields, type UserApplicationsOptions, type UserPresence, type UserProfile, type UsersGroupState, type UsersStoreState, type ValidProjection, type ValuePending, type WindowMessage, agentGenerate, agentPatch, agentPrompt, agentTransform, agentTranslate, application, applications, applyDocumentActions, archiveRelease, checkPermissions, configureLogging, createDatasetHandle, createDocument, createDocumentHandle, createDocumentTypeHandle, createGroqSearchFilter, createProjectHandle, createRelease, createSanityInstance, createUserApplication, deleteApplication, deleteDocument, deleteRelease, deleteUserApplication, destroyController, discardDocument, editDocument, editRelease, getActiveReleasesState, getAllReleasesState, getAuthState, getClient, getClientErrorApiBody, getClientErrorApiDescription, getClientErrorApiType, getClientState, getCorsErrorProjectId, getCurrentUserState, getDashboardOrganizationId, getDatasetsState, getDocumentState, getDocumentSyncStatus, getFavoritesState, getIndexForKey, getIsInDashboardState, getLoginUrlState, getNodeState, getOrCreateChannel, getOrCreateController, getOrCreateNode, getPathDepth, getPermissionsState, getPerspectiveState, getPresence, getPreviewState, getProjectionState, getQueryKey, getQueryState, getReleaseDocumentId, getTokenState, getUserState, getUsersKey, getUsersState, handleAuthCallback, installation, installations, isCanvasResource, isCanvasSource, isDatasetResource, isDatasetSource, isImportError, isMediaLibraryResource, isMediaLibrarySource, isProjectUserNotFoundClientError, isStudioConfig, joinPaths, jsonMatch, loadMoreUsers, logout, observeOrganizationVerificationState, organization, organizations, parseQueryKey, parseUsersKey, project, projects, publishDocument, publishRelease, releaseChannel, releaseNode, resolveDatasets, resolveDocument, resolveFavoritesState, resolvePermissions, resolvePreview, resolveProjection, resolveQuery, resolveUser, resolveUsers, scheduleRelease, setAuthToken, slicePath, stringifyPath, subscribeDocumentEvents, transformProjectionToPreview, unarchiveRelease, unpublishDocument, unscheduleRelease, updateApplication, updateUserApplication, userApplication, userApplications };
|
|
2335
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { _ as isCanvasResource, a as DatasetResource, b as AuthConfig, c as DocumentTypeHandle, d as ProjectHandle, f as ReleaseHandle, g as TokenSource, h as StudioConfig, i as DatasetHandle, l as MediaLibraryResource, m as SanityConfig, n as createSanityInstance, o as DocumentHandle, p as ReleasePerspective, r as CanvasResource, s as DocumentResource, t as SanityInstance, u as PerspectiveHandle, v as isDatasetResource, x as AuthProvider, y as isMediaLibraryResource } from "./createSanityInstance-DUI1bGIg.js";
|
|
2
|
+
import { $ as PreviewMedia, $n as unpublishDocument, $r as ApplicationInterface, $t as ApplyDocumentActionsOptions, A as loadMoreUsers, An as DocumentAction, Ar as updateComment, At as organizations, Bn as UnscheduleReleaseAction, Br as ClientStoreState, Bt as InstallationInclude, C as slicePath, Ci as Selector, Cn as Action, Cr as ReplyToCommentOptions, Ct as SanityUser, D as getCorsErrorProjectId, Dn as DeleteDocumentAction, Dr as removeComment, Dt as UsersStoreState, E as isImportError, En as CreateReleaseAction, Er as createComment, Et as UsersGroupState, F as getActiveReleasesState, Fn as PublishReleaseAction, Fr as CommentStatus, Ft as organization, G as getProjectionState, Gn as deleteRelease, Gr as observeOrganizationVerificationState, Gt as installations, H as ProjectsOptions, Hn as createDocument, Hr as getClientState, Ht as InstallationsOptions, I as getAllReleasesState, In as ReleaseAction, Ir as CommentTextSelection, It as Installation, J as ProjectMember, Jn as editRelease, Jr as Application, Jt as SetFavoriteInput, K as Project, Kn as discardDocument, Kr as OrgVerificationResult, Kt as FavoriteDocumentContext, L as QueryOptions, Ln as ScheduleReleaseAction, Lr as CommentTextSelectionItem, Lt as InstallationAccess, M as resolveUsers, Mn as EditDocumentOptions, Mr as CommentLocalState, Mt as OrganizationBase, N as getPerspectiveState, Nn as EditReleaseAction, Nr as CommentMessage, Nt as OrganizationMember, O as getUserState, On as DeleteReleaseAction, Or as replyToComment, Ot as Organizations, P as ReleaseState, Pn as PublishDocumentAction, Pr as CommentReaction, Pt as OrganizationOptions, Q as project, Qn as unarchiveRelease, Qr as ApplicationInclude, Qt as ActionsResult, Rn as UnarchiveReleaseAction, Rr as CommentThread, Rt as InstallationActiveConfig, S as jsonMatch, Sn as JsonMatch, Sr as RemoveCommentOptions, St as ResolveUsersOptions, T as CORE_SDK_VERSION, Tn as CreateDocumentAction, Tr as UpdateCommentOptions, Tt as UserProfile, U as projects, Un as createRelease, Ur as logout, Ut as InstallationsResponse, V as resolveQuery, Vn as archiveRelease, Vr as getClient, Vt as InstallationInterface, W as resolveProjection, Wn as deleteDocument, Wr as handleAuthCallback, Wt as installation, X as ProjectMetadata, Xn as publishRelease, Xr as ApplicationBase, Xt as setFavorite, Y as ProjectMemberRole, Yn as publishDocument, Yr as ApplicationAccess, Yt as favorites, Z as ProjectOptions, Zn as scheduleRelease, Zr as ApplicationDeployment, Zt as getReleaseDocumentId, _ as SanityDocument, _n as resolveDocument, _r as getCommentsState, _t as UserPresence, a as LoggedOutAuthState, ai as DeleteApplicationInput, an as DocumentEditedEvent, ar as LogLevel, at as reportPresence, b as getPathDepth, bn as DocumentPermissionsResult, br as resolveComments, bt as Membership, c as getCurrentUserState, ci as application, cn as DocumentRemotePatchesEvent, cr as LoggerConfig, ct as DocumentPresenceOptions, d as getLoginUrlState, di as updateApplication, dn as TransactionAcceptedEvent, dr as createDocumentTypeHandle, dt as PresenceSelection, ei as ApplicationStudioConfig, en as applyDocumentActions, er as unscheduleRelease, et as PreviewQueryResult, f as getTokenState, fi as AccessResourceType, fn as TransactionRevertedEvent, fr as createProjectHandle, ft as PresenceSelectionPoint, g as Role, gn as getPermissionsState, gt as TransportEvent, h as ReleaseDocument, hn as getDocumentSyncStatus, hr as getCommentThreadsState, ht as StateEvent, i as LoggedInAuthState, ii as ApplicationsResponse, in as DocumentDiscardedEvent, ir as LogContext, it as getPresence, j as resolveUser, jn as EditDocumentAction, jr as Comment, jt as Organization, k as getUsersState, kn as DiscardDocumentAction, kr as setCommentStatus, kt as OrganizationsOptions, l as getDashboardOrganizationId, li as applications, ln as DocumentTransactionSubmissionResult, lr as createDatasetHandle, lt as PresenceLocation, m as CurrentUser, mn as getDocumentState, mr as ResolveCommentsOptions, mt as RollCallEvent, n as AuthStoreState, ni as ApplicationWorkspace, nn as DocumentCreatedEvent, nr as configureLogging, nt as ProjectionValuePending, o as LoggingInAuthState, oi as DeletedResult, on as DocumentEvent, or as LogNamespace, ot as DisconnectEvent, p as setAuthToken, pi as checkPermissions, pn as DocumentOptions, pr as CommentsOptions, pt as ReportPresenceOptions, q as ProjectBase, qn as editDocument, qr as AuthStateType, qt as FavoriteStatusResponse, r as ErrorAuthState, ri as ApplicationsOptions, rn as DocumentDeletedEvent, rr as InstanceContext, rt as getDocumentPresence, s as getAuthState, si as UpdateApplicationInput, sn as DocumentPublishedEvent, sr as Logger, st as DocumentPresence, t as AuthState, ti as ApplicationVisibility, tn as ActionErrorEvent, tr as datasets, tt as PreviewValue, u as getIsInDashboardState, ui as deleteApplication, un as DocumentUnpublishedEvent, ur as createDocumentHandle, ut as PresencePerspectiveOptions, v as SanityProject, vn as resolvePermissions, vt as GetUserOptions, w as stringifyPath, wi as StateSource, wn as ArchiveReleaseAction, wr as SetCommentStatusOptions, wt as SanityUserResponse, x as joinPaths, xn as PermissionDeniedReason, xr as CreateCommentOptions, xt as ResolveUserOptions, y as getIndexForKey, yn as subscribeDocumentEvents, yr as resolveCommentThreads, yt as GetUsersOptions, z as getQueryState, zn as UnpublishDocumentAction, zr as ClientOptions, zt as InstallationBase } from "./authStore-C0o1NOxW.js";
|
|
3
|
+
export { type AccessResourceType, type Action, type ActionErrorEvent, type ActionsResult, type Application, type ApplicationAccess, type ApplicationBase, type ApplicationDeployment, type ApplicationInclude, type ApplicationInterface, type ApplicationStudioConfig, type ApplicationVisibility, type ApplicationWorkspace, type ApplicationsOptions, type ApplicationsResponse, type ApplyDocumentActionsOptions, type ArchiveReleaseAction, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type CanvasResource, type ClientOptions, type ClientStoreState as ClientState, type Comment, type CommentLocalState, type CommentMessage, type CommentReaction, type CommentStatus, type CommentTextSelection, type CommentTextSelectionItem, type CommentThread, type CommentsOptions, type CreateCommentOptions, type CreateDocumentAction, type CreateReleaseAction, type CurrentUser, type DatasetHandle, type DatasetResource, type DeleteApplicationInput, type DeleteDocumentAction, type DeleteReleaseAction, type DeletedResult, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPresence, type DocumentPresenceOptions, type DocumentPublishedEvent, type DocumentRemotePatchesEvent, type DocumentResource, type DocumentTransactionSubmissionResult, type DocumentTypeHandle, type DocumentUnpublishedEvent, type EditDocumentAction, type EditDocumentOptions, type EditReleaseAction, type ErrorAuthState, type FavoriteDocumentContext, type FavoriteStatusResponse, type GetUserOptions, type GetUsersOptions, type Installation, type InstallationAccess, type InstallationActiveConfig, type InstallationBase, type InstallationInclude, type InstallationInterface, type InstallationsOptions, type InstallationsResponse, type InstanceContext, type JsonMatch, type LogContext, type LogLevel, type LogNamespace, type LoggedInAuthState, type LoggedOutAuthState, type Logger, type LoggerConfig, type LoggingInAuthState, type MediaLibraryResource, type Membership, type OrgVerificationResult, type Organization, type OrganizationBase, type OrganizationMember, type OrganizationOptions, type Organizations, type OrganizationsOptions, type PermissionDeniedReason, type PerspectiveHandle, type PresenceLocation, type PresencePerspectiveOptions, type PresenceSelection, type PresenceSelectionPoint, type PreviewMedia, type PreviewQueryResult, 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 RemoveCommentOptions, type ReplyToCommentOptions, type ReportPresenceOptions, type ResolveCommentsOptions, type ResolveUserOptions, type ResolveUsersOptions, type Role, type RollCallEvent, type SanityConfig, type SanityDocument, type SanityInstance, SanityProject, type SanityUser, type SanityUserResponse, type ScheduleReleaseAction, type Selector, type SetCommentStatusOptions, type SetFavoriteInput, type StateEvent, type StateSource, type StudioConfig, type TokenSource, type TransactionAcceptedEvent, type TransactionRevertedEvent, type TransportEvent, type UnarchiveReleaseAction, type UnpublishDocumentAction, type UnscheduleReleaseAction, type UpdateApplicationInput, type UpdateCommentOptions, type UserPresence, type UserProfile, type UsersGroupState, type UsersStoreState, application, applications, applyDocumentActions, archiveRelease, checkPermissions, configureLogging, createComment, createDatasetHandle, createDocument, createDocumentHandle, createDocumentTypeHandle, createProjectHandle, createRelease, createSanityInstance, datasets, deleteApplication, deleteDocument, deleteRelease, discardDocument, editDocument, editRelease, favorites, getActiveReleasesState, getAllReleasesState, getAuthState, getClient, getClientState, getCommentThreadsState, getCommentsState, getCorsErrorProjectId, getCurrentUserState, getDashboardOrganizationId, getDocumentPresence, getDocumentState, getDocumentSyncStatus, getIndexForKey, getIsInDashboardState, getLoginUrlState, getPathDepth, getPermissionsState, getPerspectiveState, getPresence, getProjectionState, getQueryState, getReleaseDocumentId, getTokenState, getUserState, getUsersState, handleAuthCallback, installation, installations, isCanvasResource, isDatasetResource, isImportError, isMediaLibraryResource, joinPaths, jsonMatch, loadMoreUsers, logout, observeOrganizationVerificationState, organization, organizations, project, projects, publishDocument, publishRelease, removeComment, replyToComment, reportPresence, resolveCommentThreads, resolveComments, resolveDocument, resolvePermissions, resolveProjection, resolveQuery, resolveUser, resolveUsers, scheduleRelease, setAuthToken, setCommentStatus, setFavorite, slicePath, stringifyPath, subscribeDocumentEvents, unarchiveRelease, unpublishDocument, unscheduleRelease, updateApplication, updateComment };
|