@sanity/sdk 2.18.0 → 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-dts/createGroqSearchFilter.d.ts +233 -12
- package/dist/_chunks-dts/createGroqSearchFilter.d.ts.map +1 -1
- package/dist/_chunks-es/_internal.js +1 -0
- package/dist/_chunks-es/_internal.js.map +1 -1
- package/dist/_chunks-es/createGroqSearchFilter.js +284 -6
- package/dist/_chunks-es/createGroqSearchFilter.js.map +1 -1
- package/dist/_chunks-es/telemetryManager.js +2 -2
- package/dist/_exports/_internal.d.ts +2 -2
- package/dist/_exports/_internal.d.ts.map +1 -1
- package/dist/_exports/_internal.js +3 -1
- package/dist/index.d.ts +599 -185
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +492 -337
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/_exports/_internal.ts +11 -0
- package/src/_exports/index.ts +57 -12
- package/src/access/checkPermissions.test.ts +55 -0
- package/src/access/checkPermissions.ts +54 -0
- package/src/applications/applications.test-d.ts +83 -0
- package/src/applications/applications.test.ts +130 -0
- package/src/applications/applications.ts +364 -0
- package/src/applications/userApplications.test.ts +126 -0
- package/src/applications/userApplications.ts +261 -0
- package/src/auth/getOrganizationVerificationState.test.ts +7 -7
- package/src/auth/getOrganizationVerificationState.ts +4 -4
- package/src/document/documentStore.concurrency.test.ts +313 -22
- package/src/installations/installations.test-d.ts +68 -0
- package/src/installations/installations.test.ts +62 -0
- package/src/installations/installations.ts +202 -0
- package/src/organization/organization.test-d.ts +18 -84
- package/src/organization/organization.test.ts +11 -11
- package/src/organization/organization.ts +26 -54
- package/src/organizations/organizations.test-d.ts +11 -32
- package/src/organizations/organizations.test.ts +8 -8
- package/src/organizations/organizations.ts +29 -54
- package/src/project/project.test-d.ts +19 -75
- package/src/project/project.test.ts +57 -10
- package/src/project/project.ts +33 -52
- package/src/projects/projects.test-d.ts +15 -21
- package/src/projects/projects.test.ts +8 -8
- package/src/projects/projects.ts +25 -49
- package/src/store/fetcherStore.test-d.ts +121 -0
- package/src/store/fetcherStore.test.ts +299 -0
- package/src/store/fetcherStore.ts +801 -0
- package/src/utils/buildQuery.test.ts +14 -0
- package/src/utils/buildQuery.ts +17 -0
- package/src/utils/includeShape.ts +36 -0
- package/src/utils/setCleanupTimeout.ts +21 -8
- package/dist/_chunks-es/version.js +0 -7
- package/dist/_chunks-es/version.js.map +0 -1
- package/src/utils/defineIntent.test.ts +0 -477
- package/src/utils/defineIntent.ts +0 -244
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as getIsInDashboardState, A as transformProjectionToPreview, At as isDatasetSource, B as getClientErrorApiBody, C as QueryOptions, Ct as ReleasePerspective, D as resolveQuery, Dt as isCanvasResource, E as parseQueryKey, Et as TokenSource, F as ValuePending, G as AuthStoreState, H as getClientErrorApiType, I as ProjectionValuePending, J as LoggedOutAuthState, K as ErrorAuthState, L as ValidProjection, M as PreviewQueryResult, Mt as isMediaLibrarySource, N as PreviewStoreState, Nt as AuthConfig, O as Selector, Ot as isCanvasSource, P as PreviewValue, Pt as AuthProvider, Q as getDashboardOrganizationId, R as PREVIEW_PROJECTION, St as ReleaseHandle, T as getQueryState, Tt as StudioConfig, U as isProjectUserNotFoundClientError, V as getClientErrorApiDescription, W as AuthState, X as getAuthState, Y as LoggingInAuthState, Z as getCurrentUserState, _t as DocumentTypeHandle, a as GetUsersOptions, at as StoreAction, b as MutationResult, bt as PerspectiveHandle, c as ResolveUsersOptions, ct as isStudioConfig, d as UserProfile, dt as DatasetHandle, et as getLoginUrlState, f as UsersGroupState, ft as DatasetResource, g as Fetcher, gt as DocumentSource, ht as DocumentResource, i as GetUserOptions, it as BoundStoreAction, j as PreviewMedia, jt as isMediaLibraryResource, k as StateSource, kt as isDatasetResource, l as SanityUser, lt as CanvasResource, mt as DocumentHandle, n as getUsersKey, nt as setAuthToken, o as Membership, ot as SanityInstance, p as UsersStoreState, pt as DatasetSource, q as LoggedInAuthState, r as parseUsersKey, rt as AuthStateType, s as ResolveUserOptions, st as createSanityInstance, t as createGroqSearchFilter, tt as getTokenState, u as SanityUserResponse, ut as CanvasSource, vt as MediaLibraryResource, w as getQueryKey, wt as SanityConfig, xt as ProjectHandle, yt as MediaLibrarySource, z as ApiErrorBody } from "./_chunks-dts/createGroqSearchFilter.js";
|
|
2
2
|
import { ClientConfig, ListenEvent, MultipleMutationResult, ReleaseDocument, ReleaseDocument as ReleaseDocument$1, SanityClient, SanityDocument as SanityDocument$1, SanityProject as SanityProject$1 } from "@sanity/client";
|
|
3
3
|
import { CurrentUser, Mutation, PatchOperations, Role, SanityDocument, SanityDocument as SanityDocument$2, SanityDocumentLike } from "@sanity/types";
|
|
4
4
|
import { Observable, Subject } from "rxjs";
|
|
@@ -8,6 +8,24 @@ import { PatchMutation } from "@sanity/mutate/_unstable_store";
|
|
|
8
8
|
import { ExprNode } from "groq-js";
|
|
9
9
|
import { CanvasResource as CanvasResource$1, MediaResource, StudioResource } from "@sanity/message-protocol";
|
|
10
10
|
import { getIndexForKey, getPathDepth, joinPaths, jsonMatch, slicePath, stringifyPath } from "@sanity/json-match";
|
|
11
|
+
/**
|
|
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>>;
|
|
11
29
|
/** @alpha */
|
|
12
30
|
type AgentGenerateOptions = Parameters<SanityClient['observable']['agent']['action']['generate']>[0];
|
|
13
31
|
/** @alpha */
|
|
@@ -68,6 +86,420 @@ declare function agentPrompt(instance: SanityInstance, options: AgentPromptOptio
|
|
|
68
86
|
* @alpha
|
|
69
87
|
*/
|
|
70
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>>;
|
|
71
503
|
/**
|
|
72
504
|
* Error message returned by the organization verification
|
|
73
505
|
* @public
|
|
@@ -78,7 +510,7 @@ interface OrgVerificationResult {
|
|
|
78
510
|
/**
|
|
79
511
|
* Creates an observable that emits the organization verification state for a given instance.
|
|
80
512
|
* It combines the dashboard organization ID (from auth context) with the
|
|
81
|
-
* project's actual organization ID (fetched via
|
|
513
|
+
* project's actual organization ID (fetched via the project fetcher) and compares them.
|
|
82
514
|
* @public
|
|
83
515
|
*/
|
|
84
516
|
declare function observeOrganizationVerificationState(instance: SanityInstance, projectIds: string[]): Observable<OrgVerificationResult>;
|
|
@@ -97,7 +529,7 @@ type AllowedClientConfigKey = 'useCdn' | 'token' | 'perspective' | 'apiHost' | '
|
|
|
97
529
|
*/
|
|
98
530
|
interface ClientStoreState {
|
|
99
531
|
token: string | null;
|
|
100
|
-
clients: { [TKey in string]?: SanityClient };
|
|
532
|
+
clients: { [TKey in string]?: SanityClient; };
|
|
101
533
|
authMethod?: 'localstorage' | 'cookie';
|
|
102
534
|
}
|
|
103
535
|
/**
|
|
@@ -265,7 +697,6 @@ interface NodeState {
|
|
|
265
697
|
* Provides a subscribable state source for a node by name
|
|
266
698
|
* @param instance - The Sanity instance to get the node state for
|
|
267
699
|
* @param nodeInput - The configuration for the node to get the state for
|
|
268
|
-
|
|
269
700
|
* @returns A subscribable state source for the node
|
|
270
701
|
* @public
|
|
271
702
|
*/
|
|
@@ -836,8 +1267,8 @@ type PathParts<TPath extends string> = TPath extends `${infer Head}.${infer Tail
|
|
|
836
1267
|
* If a part is a key, it looks up that property.
|
|
837
1268
|
* If T is an array and the part is a number, it "indexes" into the element type.
|
|
838
1269
|
*/
|
|
839
|
-
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
|
|
840
|
-
TTail extends readonly (string | number)[] ? TTail : []> : never;
|
|
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;
|
|
841
1272
|
/**
|
|
842
1273
|
* Given a document type TDocument and a JSON Match path string TPath,
|
|
843
1274
|
* compute the type found at that path.
|
|
@@ -850,7 +1281,7 @@ type JsonMatch<TDocument, TPath extends string> = DeepGet<TDocument, PathParts<T
|
|
|
850
1281
|
* mutations affect are included, including those that do not exist yet.
|
|
851
1282
|
* Documents that don't exist have a `null` value.
|
|
852
1283
|
*/
|
|
853
|
-
type DocumentSet<TDocument extends SanityDocument$2 = SanityDocument$2> = { [TDocumentId in string]?: TDocument | null };
|
|
1284
|
+
type DocumentSet<TDocument extends SanityDocument$2 = SanityDocument$2> = { [TDocumentId in string]?: TDocument | null; };
|
|
854
1285
|
type Grant = 'read' | 'update' | 'create' | 'history';
|
|
855
1286
|
/** @beta */
|
|
856
1287
|
interface PermissionDeniedReason {
|
|
@@ -873,7 +1304,7 @@ interface SharedListener {
|
|
|
873
1304
|
dispose: () => void;
|
|
874
1305
|
}
|
|
875
1306
|
interface DocumentStoreState {
|
|
876
|
-
documentStates: { [TDocumentId in string]?: DocumentState };
|
|
1307
|
+
documentStates: { [TDocumentId in string]?: DocumentState; };
|
|
877
1308
|
queued: QueuedTransaction[];
|
|
878
1309
|
applied: AppliedTransaction[];
|
|
879
1310
|
outgoing?: OutgoingTransaction;
|
|
@@ -919,7 +1350,7 @@ interface DocumentState {
|
|
|
919
1350
|
* transaction with a different `previousRev` than expected, we can rebase our
|
|
920
1351
|
* local transactions on top of this new remote.
|
|
921
1352
|
*/
|
|
922
|
-
unverifiedRevisions?: { [TTransactionId in string]?: UnverifiedDocumentRevision };
|
|
1353
|
+
unverifiedRevisions?: { [TTransactionId in string]?: UnverifiedDocumentRevision; };
|
|
923
1354
|
/**
|
|
924
1355
|
* transaction IDs recently submitted by this client for this document,
|
|
925
1356
|
* newest last. used to label `remote-patches` events with the correct
|
|
@@ -1095,7 +1526,7 @@ interface AppliedTransaction extends QueuedTransaction {
|
|
|
1095
1526
|
/**
|
|
1096
1527
|
* the `_rev`s from `previous` document set
|
|
1097
1528
|
*/
|
|
1098
|
-
previousRevs: { [TDocumentId in string]?: string };
|
|
1529
|
+
previousRevs: { [TDocumentId in string]?: string; };
|
|
1099
1530
|
/**
|
|
1100
1531
|
* a timestamp for when this transaction was applied locally
|
|
1101
1532
|
*/
|
|
@@ -1331,6 +1762,138 @@ declare const getFavoritesState: BoundStoreAction<import("../_exports").FetcherS
|
|
|
1331
1762
|
* @public
|
|
1332
1763
|
*/
|
|
1333
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>>;
|
|
1334
1897
|
/** @public */
|
|
1335
1898
|
interface OrganizationMember {
|
|
1336
1899
|
sanityUserId: string;
|
|
@@ -1393,16 +1956,14 @@ type Organization<IncludeMembers extends boolean = false, IncludeFeatures extend
|
|
|
1393
1956
|
features: string[];
|
|
1394
1957
|
} : unknown);
|
|
1395
1958
|
/**
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
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
|
|
1399
1965
|
*/
|
|
1400
|
-
|
|
1401
|
-
type ResolveOrganization = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => Promise<Organization<IncludeMembers, IncludeFeatures>>;
|
|
1402
|
-
/** @public */
|
|
1403
|
-
declare const getOrganizationState: GetOrganizationState;
|
|
1404
|
-
/** @public */
|
|
1405
|
-
declare const resolveOrganization: ResolveOrganization;
|
|
1966
|
+
declare const organization: Fetcher<[options?: OrganizationOptions<boolean, boolean> | undefined], Organization<boolean, boolean>>;
|
|
1406
1967
|
/**
|
|
1407
1968
|
* The list shape returned from `/organizations`, with `members` and/or
|
|
1408
1969
|
* `features` conditionally included based on the query options used.
|
|
@@ -1426,16 +1987,12 @@ interface OrganizationsOptions<IncludeMembers extends boolean = false, IncludeFe
|
|
|
1426
1987
|
includeImplicitMemberships?: boolean;
|
|
1427
1988
|
}
|
|
1428
1989
|
/**
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1431
|
-
*
|
|
1990
|
+
* Fetcher for the current user's organizations (`GET /organizations`), on the
|
|
1991
|
+
* shared fetcher cache.
|
|
1992
|
+
*
|
|
1993
|
+
* @internal
|
|
1432
1994
|
*/
|
|
1433
|
-
|
|
1434
|
-
type ResolveOrganizations = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(instance: SanityInstance, options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => Promise<Organizations<IncludeMembers, IncludeFeatures>>;
|
|
1435
|
-
/** @public */
|
|
1436
|
-
declare const getOrganizationsState: GetOrganizationsState;
|
|
1437
|
-
/** @public */
|
|
1438
|
-
declare const resolveOrganizations: ResolveOrganizations;
|
|
1995
|
+
declare const organizations: Fetcher<[options?: OrganizationsOptions<boolean, boolean> | undefined], Organizations<boolean, boolean>>;
|
|
1439
1996
|
/** @public */
|
|
1440
1997
|
interface PresenceLocation {
|
|
1441
1998
|
type: 'document';
|
|
@@ -1561,16 +2118,14 @@ interface ProjectOptions<IncludeMembers extends boolean = true, IncludeFeatures
|
|
|
1561
2118
|
includeFeatures?: IncludeFeatures;
|
|
1562
2119
|
}
|
|
1563
2120
|
/**
|
|
1564
|
-
*
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
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
|
|
1567
2127
|
*/
|
|
1568
|
-
|
|
1569
|
-
type ResolveProject = <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => Promise<Project<IncludeMembers, IncludeFeatures>>;
|
|
1570
|
-
/** @public */
|
|
1571
|
-
declare const getProjectState: GetProjectState;
|
|
1572
|
-
/** @public */
|
|
1573
|
-
declare const resolveProject: ResolveProject;
|
|
2128
|
+
declare const project: Fetcher<[options?: ProjectOptions<boolean, boolean> | undefined], Project<boolean, boolean>>;
|
|
1574
2129
|
interface ProjectionOptions<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
|
|
1575
2130
|
projection: TProjection;
|
|
1576
2131
|
}
|
|
@@ -1598,16 +2153,12 @@ interface ProjectsOptions<IncludeMembers extends boolean = false, IncludeFeature
|
|
|
1598
2153
|
onlyExplicitMembership?: boolean;
|
|
1599
2154
|
}
|
|
1600
2155
|
/**
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
2156
|
+
* Fetcher for the current user's projects (`GET /projects`), on the shared
|
|
2157
|
+
* fetcher cache.
|
|
2158
|
+
*
|
|
2159
|
+
* @internal
|
|
1604
2160
|
*/
|
|
1605
|
-
|
|
1606
|
-
type ResolveProjects = <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(instance: SanityInstance, options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => Promise<Project<IncludeMembers, IncludeFeatures>[]>;
|
|
1607
|
-
/** @public */
|
|
1608
|
-
declare const getProjectsState: GetProjectsState;
|
|
1609
|
-
/** @public */
|
|
1610
|
-
declare const resolveProjects: ResolveProjects;
|
|
2161
|
+
declare const projects: Fetcher<[options?: ProjectsOptions<boolean, boolean> | undefined], Project<boolean, boolean>[]>;
|
|
1611
2162
|
/**
|
|
1612
2163
|
* Lifecycle states a release document can be in. Mirrors the server's
|
|
1613
2164
|
* `ReleaseState`.
|
|
@@ -1731,7 +2282,7 @@ interface StoreEntry<TParams extends unknown[], TData> {
|
|
|
1731
2282
|
* @public
|
|
1732
2283
|
*/
|
|
1733
2284
|
interface FetcherStoreState<TParams extends unknown[], TData> {
|
|
1734
|
-
stateByParams: { [TSerializedKey in string]?: StoreEntry<TParams, TData
|
|
2285
|
+
stateByParams: { [TSerializedKey in string]?: StoreEntry<TParams, TData>; };
|
|
1735
2286
|
error?: unknown;
|
|
1736
2287
|
}
|
|
1737
2288
|
/**
|
|
@@ -1742,143 +2293,6 @@ interface FetcherStore<TParams extends unknown[], TData> {
|
|
|
1742
2293
|
getState: BoundStoreAction<FetcherStoreState<TParams, TData>, TParams, StateSource<TData | undefined>>;
|
|
1743
2294
|
resolveState: BoundStoreAction<FetcherStoreState<TParams, TData>, TParams, Promise<TData>>;
|
|
1744
2295
|
}
|
|
1745
|
-
/**
|
|
1746
|
-
* Filter criteria for intent matching. Can be combined to create more specific intents.
|
|
1747
|
-
*
|
|
1748
|
-
* @example
|
|
1749
|
-
* ```typescript
|
|
1750
|
-
* // matches only geopoints in the travel-project project, production dataset
|
|
1751
|
-
* const filter: IntentFilter = {
|
|
1752
|
-
* projectId: 'travel-project',
|
|
1753
|
-
* dataset: 'production',
|
|
1754
|
-
* types: ['geopoint']
|
|
1755
|
-
* }
|
|
1756
|
-
*
|
|
1757
|
-
* // matches all documents in the travel-project project
|
|
1758
|
-
* const filter: IntentFilter = {
|
|
1759
|
-
* projectId: 'travel-project',
|
|
1760
|
-
* types: ['*']
|
|
1761
|
-
* }
|
|
1762
|
-
*
|
|
1763
|
-
* // matches geopoints in the travel-project production dataset and map pins in all projects in the org
|
|
1764
|
-
* const filters: IntentFilter[] = [
|
|
1765
|
-
* {
|
|
1766
|
-
* projectId: 'travel-project',
|
|
1767
|
-
* dataset: 'production',
|
|
1768
|
-
* types: ['geopoint']
|
|
1769
|
-
* },
|
|
1770
|
-
* {
|
|
1771
|
-
* types: ['map-pin']
|
|
1772
|
-
* }
|
|
1773
|
-
* ]
|
|
1774
|
-
* ```
|
|
1775
|
-
* @public
|
|
1776
|
-
*/
|
|
1777
|
-
interface IntentFilter {
|
|
1778
|
-
/**
|
|
1779
|
-
* Project ID to match against
|
|
1780
|
-
* @remarks When specified, the intent will only match for the specified project.
|
|
1781
|
-
*/
|
|
1782
|
-
projectId?: string;
|
|
1783
|
-
/**
|
|
1784
|
-
* Dataset to match against
|
|
1785
|
-
* @remarks When specified, the intent will only match for the specified dataset. Requires projectId to be specified.
|
|
1786
|
-
*/
|
|
1787
|
-
dataset?: string;
|
|
1788
|
-
/**
|
|
1789
|
-
* Document types that this intent can handle
|
|
1790
|
-
* @remarks This is required for all filters. Use ['*'] to match all document types.
|
|
1791
|
-
*/
|
|
1792
|
-
types: string[];
|
|
1793
|
-
}
|
|
1794
|
-
/**
|
|
1795
|
-
* Intent definition structure for registering user intents
|
|
1796
|
-
* @public
|
|
1797
|
-
*/
|
|
1798
|
-
interface Intent {
|
|
1799
|
-
/**
|
|
1800
|
-
* Unique identifier for this intent
|
|
1801
|
-
* @remarks Should be unique across all registered intents in an org for proper matching
|
|
1802
|
-
*/
|
|
1803
|
-
id: string;
|
|
1804
|
-
/**
|
|
1805
|
-
* The action that this intent performs
|
|
1806
|
-
* @remarks Examples: "view", "edit", "create", "delete"
|
|
1807
|
-
*/
|
|
1808
|
-
action: 'view' | 'edit' | 'create' | 'delete';
|
|
1809
|
-
/**
|
|
1810
|
-
* Human-readable title for this intent
|
|
1811
|
-
* @remarks Used for display purposes in UI or logs
|
|
1812
|
-
*/
|
|
1813
|
-
title: string;
|
|
1814
|
-
/**
|
|
1815
|
-
* Detailed description of what this intent does
|
|
1816
|
-
* @remarks Helps users understand the purpose and behavior of the intent
|
|
1817
|
-
*/
|
|
1818
|
-
description?: string;
|
|
1819
|
-
/**
|
|
1820
|
-
* Array of filter criteria for intent matching
|
|
1821
|
-
* @remarks At least one filter is required. Use `{types: ['*']}` to match everything
|
|
1822
|
-
*/
|
|
1823
|
-
filters: IntentFilter[];
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* Creates a properly typed intent definition for registration with the backend.
|
|
1827
|
-
*
|
|
1828
|
-
* This utility function provides TypeScript support and validation for intent declarations.
|
|
1829
|
-
* It is also used in the CLI if intents are declared as bare objects in an intents file.
|
|
1830
|
-
*
|
|
1831
|
-
* @param intent - The intent definition object
|
|
1832
|
-
* @returns The same intent object with proper typing
|
|
1833
|
-
*
|
|
1834
|
-
* @example
|
|
1835
|
-
* ```typescript
|
|
1836
|
-
* // Specific filter for a document type
|
|
1837
|
-
* const viewGeopointInMapApp = defineIntent({
|
|
1838
|
-
* id: 'viewGeopointInMapApp',
|
|
1839
|
-
* action: 'view',
|
|
1840
|
-
* title: 'View a geopoint in the map app',
|
|
1841
|
-
* description: 'This lets you view a geopoint in the map app',
|
|
1842
|
-
* filters: [
|
|
1843
|
-
* {
|
|
1844
|
-
* projectId: 'travel-project',
|
|
1845
|
-
* dataset: 'production',
|
|
1846
|
-
* types: ['geopoint']
|
|
1847
|
-
* }
|
|
1848
|
-
* ]
|
|
1849
|
-
* })
|
|
1850
|
-
*
|
|
1851
|
-
* export default viewGeopointInMapApp
|
|
1852
|
-
* ```
|
|
1853
|
-
*
|
|
1854
|
-
* If your intent is asynchronous, resolve the promise before defining / returning the intent
|
|
1855
|
-
* ```typescript
|
|
1856
|
-
* async function createAsyncIntent() {
|
|
1857
|
-
* const currentProject = await asyncProjectFunction()
|
|
1858
|
-
* const currentDataset = await asyncDatasetFunction()
|
|
1859
|
-
*
|
|
1860
|
-
* return defineIntent({
|
|
1861
|
-
* id: 'dynamicIntent',
|
|
1862
|
-
* action: 'view',
|
|
1863
|
-
* title: 'Dynamic Intent',
|
|
1864
|
-
* description: 'Intent with dynamically resolved values',
|
|
1865
|
-
* filters: [
|
|
1866
|
-
* {
|
|
1867
|
-
* projectId: currentProject, // Resolved value
|
|
1868
|
-
* dataset: currentDataset, // Resolved value
|
|
1869
|
-
* types: ['document']
|
|
1870
|
-
* }
|
|
1871
|
-
* ]
|
|
1872
|
-
* })
|
|
1873
|
-
* }
|
|
1874
|
-
*
|
|
1875
|
-
* const intent = await createAsyncIntent()
|
|
1876
|
-
* export default intent
|
|
1877
|
-
* ```
|
|
1878
|
-
*
|
|
1879
|
-
* @public
|
|
1880
|
-
*/
|
|
1881
|
-
declare function defineIntent(intent: Intent): Intent;
|
|
1882
2296
|
/**
|
|
1883
2297
|
* @public
|
|
1884
2298
|
* Extracts the project ID from a CorsOriginError message.
|
|
@@ -1917,5 +2331,5 @@ declare const CORE_SDK_VERSION: {};
|
|
|
1917
2331
|
* @public
|
|
1918
2332
|
*/
|
|
1919
2333
|
type SanityProject = SanityProject$1;
|
|
1920
|
-
export { type Action, type ActionErrorEvent, type ActionsResult, type AgentGenerateOptions, type AgentGenerateResult, type AgentPatchOptions, type AgentPatchResult, type AgentPromptOptions, type AgentPromptResult, type AgentTransformOptions, type AgentTransformResult, type AgentTranslateOptions, type AgentTranslateResult, type ApiErrorBody, type ApplyDocumentActionsOptions, type ArchiveReleaseAction, type AuthConfig, type AuthProvider, type AuthState, AuthStateType, type AuthStoreState, CORE_SDK_VERSION, type CanvasResource, type CanvasSource, type ClientOptions, type ClientStoreState as ClientState, type ComlinkControllerState, type ComlinkNodeState, type CreateDocumentAction, type CreateReleaseAction, type CurrentUser, type DatasetHandle, type DatasetResource, type DatasetSource, type DeleteDocumentAction, type DeleteReleaseAction, type DiscardDocumentAction, type DisconnectEvent, type DocumentAction, type DocumentCreatedEvent, type DocumentDeletedEvent, type DocumentDiscardedEvent, type DocumentEditedEvent, type DocumentEvent, type DocumentHandle, type DocumentOptions, type DocumentPermissionsResult, type DocumentPublishedEvent, type 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
|
|
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 };
|
|
1921
2335
|
//# sourceMappingURL=index.d.ts.map
|