@sanity/sdk-react 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_exports/dashboard-internal.d.ts +2 -0
- package/dist/_exports/dashboard-internal.js +2 -0
- package/dist/_exports/dashboard.d.ts +457 -7
- package/dist/_exports/dashboard.d.ts.map +1 -1
- package/dist/_exports/dashboard.js +623 -2
- package/dist/_exports/dashboard.js.map +1 -1
- package/dist/index.d.ts +90 -87
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/{useStudioWorkspacesByProjectIdDataset-DxUlukmF.js → useStudioWorkspacesByProjectIdDataset-BZ_Ud887.js} +53 -56
- package/dist/useStudioWorkspacesByProjectIdDataset-BZ_Ud887.js.map +1 -0
- package/package.json +34 -32
- package/src/_exports/dashboard-internal.ts +1 -0
- package/src/_exports/dashboard.test-d.ts +64 -0
- package/src/_exports/dashboard.ts +70 -0
- package/src/_exports/index.ts +1 -1
- package/src/components/auth/AuthBoundary.test.tsx +34 -0
- package/src/components/auth/AuthBoundary.tsx +1 -2
- package/src/context/DashboardTokenRefresh.test.tsx +124 -22
- package/src/context/DashboardTokenRefresh.tsx +31 -15
- package/src/dashboard/createRemoteInstance.test.ts +168 -0
- package/src/dashboard/createRemoteInstance.ts +123 -0
- package/src/dashboard/module.ts +39 -0
- package/src/dashboard/remoteClientState.ts +27 -0
- package/src/dashboard/urlFor.test.ts +246 -0
- package/src/dashboard/urlFor.ts +462 -0
- package/src/hooks/applications/useApplication.test-d.ts +1 -1
- package/src/hooks/dashboard/useApplication.test.tsx +59 -0
- package/src/hooks/dashboard/useApplication.ts +22 -0
- package/src/hooks/dashboard/useApplicationConfig.test.tsx +106 -0
- package/src/hooks/dashboard/useApplicationConfig.ts +45 -0
- package/src/hooks/dashboard/useApplicationConfigs.test.tsx +89 -0
- package/src/hooks/dashboard/useApplicationConfigs.ts +26 -0
- package/src/hooks/dashboard/useApplicationForegroundId.test.tsx +54 -0
- package/src/hooks/dashboard/useApplicationForegroundId.ts +22 -0
- package/src/hooks/dashboard/useApplications.test.tsx +249 -0
- package/src/hooks/dashboard/useApplications.ts +128 -0
- package/src/hooks/dashboard/useEmit.test.tsx +124 -0
- package/src/hooks/dashboard/useEmit.ts +78 -0
- package/src/hooks/dashboard/useNavigate.ts +1 -3
- package/src/hooks/dashboard/useRemoteClient.test.tsx +88 -0
- package/src/hooks/dashboard/useRemoteClient.ts +10 -0
- package/src/hooks/dashboard/useTopic.test.tsx +200 -0
- package/src/hooks/dashboard/useTopic.ts +29 -0
- package/src/hooks/dashboard/useUpdateFavorite.test.tsx +8 -1
- package/src/hooks/document/useApplyDocumentActions.ts +3 -4
- package/src/hooks/document/useCreateDocument.ts +2 -3
- package/src/hooks/document/useDocument.ts +11 -6
- package/src/hooks/document/useEditDocument.ts +5 -5
- package/src/hooks/projection/useDocumentProjection.ts +6 -7
- package/src/hooks/query/useQuery.ts +3 -4
- package/dist/useStudioWorkspacesByProjectIdDataset-DxUlukmF.js.map +0 -1
- package/src/context/dashboardToken.ts +0 -63
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { DatasetsResponse, DatasetsResponse as DatasetsResponse$1, SanityProjectMember } from "@sanity/client";
|
|
2
|
-
import { AccessResourceType, ActionsResult, Application, ApplicationInclude, ApplicationsOptions, ApplicationsResponse, AuthState, ClientOptions, Comment, CommentThread, CommentsOptions, CreateCommentOptions, CurrentUser, DatasetHandle, DocumentAction, DocumentEvent, DocumentHandle as DocumentHandle$1, DocumentOptions, DocumentPermissionsResult, DocumentPresence, DocumentResource, DocumentTypeHandle as DocumentTypeHandle$1, FavoriteStatusResponse, GetUserOptions, GetUsersOptions, Installation, InstallationInclude, InstallationsOptions, InstallationsResponse, JsonMatch, Organization, OrganizationOptions, Organizations, OrganizationsOptions, PresenceSelection, PreviewValue, Project, ProjectHandle, ProjectOptions, ProjectsOptions, QueryOptions, ReleaseAction, ReleaseDocument, RemoveCommentOptions, ReplyToCommentOptions, SanityConfig, SanityInstance, SanityUser, SetCommentStatusOptions, TokenSource, UpdateCommentOptions, UserPresence } from "@sanity/sdk";
|
|
2
|
+
import { AccessResourceType, ActionsResult, Application, ApplicationInclude, ApplicationsOptions, ApplicationsResponse, AuthState, ClientOptions, Comment, CommentThread, CommentsOptions, CreateCommentOptions, CurrentUser, DatasetHandle, DocumentAction, DocumentEvent, DocumentHandle as DocumentHandle$1, DocumentOptions, DocumentPermissionsResult, DocumentPresence, DocumentResource, DocumentTypeHandle as DocumentTypeHandle$1, FavoriteStatusResponse, GetUserOptions, GetUsersOptions, Installation, InstallationInclude, InstallationsOptions, InstallationsResponse, JsonMatch, Organization, OrganizationOptions, Organizations, OrganizationsOptions, PresenceSelection, PreviewValue, Project, ProjectHandle, ProjectOptions, ProjectsOptions, QueryOptions, ReleaseAction, ReleaseDocument, RemoveCommentOptions, ReplyToCommentOptions, ResolveDocument, ResolveProjectionResult, ResolveQueryResult, SanityConfig, SanityInstance, SanityUser, SetCommentStatusOptions, TokenSource, UpdateCommentOptions, UserPresence } from "@sanity/sdk";
|
|
3
3
|
import "@sanity/sdk/_internal";
|
|
4
4
|
import React$1, { PropsWithChildren, ReactElement, ReactNode } from "react";
|
|
5
5
|
import { FallbackProps } from "react-error-boundary";
|
|
6
6
|
import { CanvasResource, MediaResource, StudioResource } from "@sanity/message-protocol";
|
|
7
7
|
import { FrameMessage, WindowMessage } from "@sanity/sdk/comlink";
|
|
8
|
-
import "xstate";
|
|
9
8
|
import { AgentGenerateOptions, AgentPatchOptions, AgentPatchResult, AgentPromptOptions, AgentPromptResult, AgentTransformOptions, AgentTranslateOptions } from "@sanity/sdk/agent";
|
|
10
|
-
import { SanityDocument as SanityDocument$1, SanityProjectionResult, SanityQueryResult } from "groq";
|
|
11
9
|
import { Path, SanityDocument, SortOrderingItem, SortOrderingItem as SortOrderingItem$1 } from "@sanity/types";
|
|
12
10
|
export * from "@sanity/sdk";
|
|
13
11
|
/**
|
|
@@ -80,7 +78,7 @@ interface AuthBoundaryProps {
|
|
|
80
78
|
*
|
|
81
79
|
* @internal
|
|
82
80
|
*/
|
|
83
|
-
declare function AuthBoundary({ LoginErrorComponent, ...props }: AuthBoundaryProps): React.ReactNode;
|
|
81
|
+
export declare function AuthBoundary({ LoginErrorComponent, ...props }: AuthBoundaryProps): React.ReactNode;
|
|
84
82
|
/**
|
|
85
83
|
* @public
|
|
86
84
|
* @category Types
|
|
@@ -190,7 +188,7 @@ interface SanityAppProps {
|
|
|
190
188
|
* }
|
|
191
189
|
* ```
|
|
192
190
|
*/
|
|
193
|
-
declare function SanityApp({ children, fallback, config: configProp, ...props }: SanityAppProps): ReactElement;
|
|
191
|
+
export declare function SanityApp({ children, fallback, config: configProp, ...props }: SanityAppProps): ReactElement;
|
|
194
192
|
/**
|
|
195
193
|
* @internal
|
|
196
194
|
*/
|
|
@@ -207,7 +205,7 @@ interface SDKProviderProps extends AuthBoundaryProps {
|
|
|
207
205
|
*
|
|
208
206
|
* Top-level context provider that provides access to the Sanity SDK.
|
|
209
207
|
*/
|
|
210
|
-
declare function SDKProvider({ children, config, fallback, inferMediaLibraryAndCanvas, ...props }: SDKProviderProps): ReactElement;
|
|
208
|
+
export declare function SDKProvider({ children, config, fallback, inferMediaLibraryAndCanvas, ...props }: SDKProviderProps): ReactElement;
|
|
211
209
|
/**
|
|
212
210
|
* React SDK resource handle — extends the core DatasetHandle with `resourceName`
|
|
213
211
|
* for context-based resource resolution.
|
|
@@ -249,7 +247,7 @@ interface DocumentHandle<TDocumentType extends string = string, TDataset extends
|
|
|
249
247
|
* It is used to automatically request a new token on 401 error if enabled.
|
|
250
248
|
* @public
|
|
251
249
|
*/
|
|
252
|
-
declare const ComlinkTokenRefreshProvider: React$1.FC<PropsWithChildren>;
|
|
250
|
+
export declare const ComlinkTokenRefreshProvider: React$1.FC<PropsWithChildren>;
|
|
253
251
|
interface RenderSanitySDKAppOptions {
|
|
254
252
|
reactStrictMode?: boolean;
|
|
255
253
|
}
|
|
@@ -260,7 +258,7 @@ interface NamedSources {
|
|
|
260
258
|
[key: string]: SanityConfig;
|
|
261
259
|
}
|
|
262
260
|
/** @internal */
|
|
263
|
-
declare function renderSanityApp(rootElement: HTMLElement | null, namedSources: NamedSources, options: RenderSanitySDKAppOptions, children: React.ReactNode): () => void;
|
|
261
|
+
export declare function renderSanityApp(rootElement: HTMLElement | null, namedSources: NamedSources, options: RenderSanitySDKAppOptions, children: React.ReactNode): () => void;
|
|
264
262
|
/**
|
|
265
263
|
* Props for the ResourceProvider component
|
|
266
264
|
* @internal
|
|
@@ -294,7 +292,7 @@ interface ResourceProviderProps extends SanityConfig {
|
|
|
294
292
|
* </ResourceProvider>
|
|
295
293
|
* ```
|
|
296
294
|
*/
|
|
297
|
-
declare function ResourceProvider({ children, fallback, resource, ...config }: ResourceProviderProps): React.ReactNode;
|
|
295
|
+
export declare function ResourceProvider({ children, fallback, resource, ...config }: ResourceProviderProps): React.ReactNode;
|
|
298
296
|
/**
|
|
299
297
|
* Props for the SanityInstanceProvider component
|
|
300
298
|
* @public
|
|
@@ -349,7 +347,7 @@ interface SanityInstanceProviderProps {
|
|
|
349
347
|
*
|
|
350
348
|
* @category Components
|
|
351
349
|
*/
|
|
352
|
-
declare function SanityInstanceProvider({ instance, fallback, children }: SanityInstanceProviderProps): React.ReactNode;
|
|
350
|
+
export declare function SanityInstanceProvider({ instance, fallback, children }: SanityInstanceProviderProps): React.ReactNode;
|
|
353
351
|
/**
|
|
354
352
|
* Minimal duck-typed interface representing a Sanity Studio workspace.
|
|
355
353
|
* The Studio's `Workspace` type satisfies this naturally — no import
|
|
@@ -415,7 +413,7 @@ interface StudioWorkspaceHandle {
|
|
|
415
413
|
*
|
|
416
414
|
* @public
|
|
417
415
|
*/
|
|
418
|
-
declare const SDKStudioContext: import("react").Context<StudioWorkspaceHandle | null>;
|
|
416
|
+
export declare const SDKStudioContext: import("react").Context<StudioWorkspaceHandle | null>;
|
|
419
417
|
/**
|
|
420
418
|
* The value returned by a fetcher-backed hook. The hook suspends until the
|
|
421
419
|
* first fetch succeeds, so `data` is always present once your component renders.
|
|
@@ -445,7 +443,7 @@ interface FetcherHookResult<TData> {
|
|
|
445
443
|
* @param permissions - The permission names to check.
|
|
446
444
|
* @returns The result envelope `{data, isFetching, error, refetch}`.
|
|
447
445
|
*/
|
|
448
|
-
declare const useCheckPermissions: <Permission extends string>(resourceType: AccessResourceType, resourceId: string, permissions: Permission[]) => FetcherHookResult<Record<Permission, boolean>>;
|
|
446
|
+
export declare const useCheckPermissions: <Permission extends string>(resourceType: AccessResourceType, resourceId: string, permissions: Permission[]) => FetcherHookResult<Record<Permission, boolean>>;
|
|
449
447
|
interface Subscription {
|
|
450
448
|
unsubscribe(): void;
|
|
451
449
|
}
|
|
@@ -525,7 +523,7 @@ interface Subscribable<T> {
|
|
|
525
523
|
*
|
|
526
524
|
* @category Agent Actions
|
|
527
525
|
*/
|
|
528
|
-
declare function useAgentGenerate(resourceHandle?: ResourceHandle): (options: AgentGenerateOptions) => Subscribable<unknown>;
|
|
526
|
+
export declare function useAgentGenerate(resourceHandle?: ResourceHandle): (options: AgentGenerateOptions) => Subscribable<unknown>;
|
|
529
527
|
/**
|
|
530
528
|
* @alpha
|
|
531
529
|
* Transforms an existing document or selected fields using Sanity Agent Actions.
|
|
@@ -597,7 +595,7 @@ declare function useAgentGenerate(resourceHandle?: ResourceHandle): (options: Ag
|
|
|
597
595
|
*
|
|
598
596
|
* @category Agent Actions
|
|
599
597
|
*/
|
|
600
|
-
declare function useAgentTransform(resourceHandle?: ResourceHandle): (options: AgentTransformOptions) => Subscribable<unknown>;
|
|
598
|
+
export declare function useAgentTransform(resourceHandle?: ResourceHandle): (options: AgentTransformOptions) => Subscribable<unknown>;
|
|
601
599
|
/**
|
|
602
600
|
* @alpha
|
|
603
601
|
* Translates documents or fields using Sanity Agent Actions.
|
|
@@ -688,7 +686,7 @@ declare function useAgentTransform(resourceHandle?: ResourceHandle): (options: A
|
|
|
688
686
|
*
|
|
689
687
|
* @category Agent Actions
|
|
690
688
|
*/
|
|
691
|
-
declare function useAgentTranslate(resourceHandle?: ResourceHandle): (options: AgentTranslateOptions) => Subscribable<unknown>;
|
|
689
|
+
export declare function useAgentTranslate(resourceHandle?: ResourceHandle): (options: AgentTranslateOptions) => Subscribable<unknown>;
|
|
692
690
|
/**
|
|
693
691
|
* @alpha
|
|
694
692
|
* Prompts the Content Agent using the same instruction template format as other agent actions.
|
|
@@ -783,7 +781,7 @@ declare function useAgentTranslate(resourceHandle?: ResourceHandle): (options: A
|
|
|
783
781
|
*
|
|
784
782
|
* @category Agent Actions
|
|
785
783
|
*/
|
|
786
|
-
declare function useAgentPrompt(resourceHandle?: ResourceHandle): (options: AgentPromptOptions) => Promise<AgentPromptResult>;
|
|
784
|
+
export declare function useAgentPrompt(resourceHandle?: ResourceHandle): (options: AgentPromptOptions) => Promise<AgentPromptResult>;
|
|
787
785
|
/**
|
|
788
786
|
* @alpha
|
|
789
787
|
* Schema-aware patching with Sanity Agent Actions.
|
|
@@ -933,7 +931,7 @@ declare function useAgentPrompt(resourceHandle?: ResourceHandle): (options: Agen
|
|
|
933
931
|
*
|
|
934
932
|
* @category Agent Actions
|
|
935
933
|
*/
|
|
936
|
-
declare function useAgentPatch(resourceHandle?: ResourceHandle): (options: AgentPatchOptions) => Promise<AgentPatchResult>;
|
|
934
|
+
export declare function useAgentPatch(resourceHandle?: ResourceHandle): (options: AgentPatchOptions) => Promise<AgentPatchResult>;
|
|
937
935
|
/**
|
|
938
936
|
* Returns a single application by id.
|
|
939
937
|
*
|
|
@@ -946,7 +944,7 @@ declare function useAgentPatch(resourceHandle?: ResourceHandle): (options: Agent
|
|
|
946
944
|
* @param options - Optional `include` list to expand related resources.
|
|
947
945
|
* @returns The result envelope `{data, isFetching, error, refetch}`.
|
|
948
946
|
*/
|
|
949
|
-
declare const useApplication: <Include extends ApplicationInclude = never>(applicationId: string, options?: {
|
|
947
|
+
export declare const useApplication: <Include extends ApplicationInclude = never>(applicationId: string, options?: {
|
|
950
948
|
include?: Include[];
|
|
951
949
|
}) => FetcherHookResult<Application<Include>>;
|
|
952
950
|
/**
|
|
@@ -960,7 +958,7 @@ declare const useApplication: <Include extends ApplicationInclude = never>(appli
|
|
|
960
958
|
* @param options - Filter and include options for the applications list.
|
|
961
959
|
* @returns The result envelope `{data, isFetching, error, refetch}`.
|
|
962
960
|
*/
|
|
963
|
-
declare const useApplications: <Include extends ApplicationInclude = never>(options: ApplicationsOptions<Include>) => FetcherHookResult<ApplicationsResponse<Include>>;
|
|
961
|
+
export declare const useApplications: <Include extends ApplicationInclude = never>(options: ApplicationsOptions<Include>) => FetcherHookResult<ApplicationsResponse<Include>>;
|
|
964
962
|
/**
|
|
965
963
|
* The value returned by a mutation-backed hook. The write-side counterpart to
|
|
966
964
|
* {@link FetcherHookResult}: local `{mutate, isPending, error, data, reset}`
|
|
@@ -991,14 +989,14 @@ interface MutationHookResult<TInput, TResult> {
|
|
|
991
989
|
* @internal
|
|
992
990
|
* @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
|
|
993
991
|
*/
|
|
994
|
-
declare const useDeleteApplication: () => MutationHookResult<import("@sanity/sdk").DeleteApplicationInput, import("@sanity/sdk").DeletedResult>;
|
|
992
|
+
export declare const useDeleteApplication: () => MutationHookResult<import("@sanity/sdk").DeleteApplicationInput, import("@sanity/sdk").DeletedResult>;
|
|
995
993
|
/**
|
|
996
994
|
* Updates an application's mutable properties (title, icon, visibility).
|
|
997
995
|
*
|
|
998
996
|
* @internal
|
|
999
997
|
* @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
|
|
1000
998
|
*/
|
|
1001
|
-
declare const useUpdateApplication: () => MutationHookResult<import("@sanity/sdk").UpdateApplicationInput, import("@sanity/sdk").ApplicationBase>;
|
|
999
|
+
export declare const useUpdateApplication: () => MutationHookResult<import("@sanity/sdk").UpdateApplicationInput, import("@sanity/sdk").ApplicationBase>;
|
|
1002
1000
|
/**
|
|
1003
1001
|
* @internal
|
|
1004
1002
|
* A React hook that subscribes to authentication state changes.
|
|
@@ -1020,13 +1018,13 @@ declare const useUpdateApplication: () => MutationHookResult<import("@sanity/sdk
|
|
|
1020
1018
|
* }
|
|
1021
1019
|
* ```
|
|
1022
1020
|
*/
|
|
1023
|
-
declare const useAuthState: () => AuthState;
|
|
1021
|
+
export declare const useAuthState: () => AuthState;
|
|
1024
1022
|
/**
|
|
1025
1023
|
* Hook to get the currently logged in user
|
|
1026
1024
|
* @internal
|
|
1027
1025
|
* @returns The current user or null if not authenticated
|
|
1028
1026
|
*/
|
|
1029
|
-
declare const useAuthToken: () => string | null;
|
|
1027
|
+
export declare const useAuthToken: () => string | null;
|
|
1030
1028
|
type UseCurrentUser = {
|
|
1031
1029
|
/**
|
|
1032
1030
|
* @public
|
|
@@ -1055,7 +1053,7 @@ type UseCurrentUser = {
|
|
|
1055
1053
|
* @function
|
|
1056
1054
|
* @TODO This should not return null — users of a custom app will always be authenticated via Core
|
|
1057
1055
|
*/
|
|
1058
|
-
declare const useCurrentUser: UseCurrentUser;
|
|
1056
|
+
export declare const useCurrentUser: UseCurrentUser;
|
|
1059
1057
|
/**
|
|
1060
1058
|
* @internal
|
|
1061
1059
|
* A React hook that returns a function for handling authentication callbacks.
|
|
@@ -1096,17 +1094,17 @@ declare const useCurrentUser: UseCurrentUser;
|
|
|
1096
1094
|
* @returns A callback handler function that processes OAuth redirects
|
|
1097
1095
|
* @public
|
|
1098
1096
|
*/
|
|
1099
|
-
declare const useHandleAuthCallback: () => (locationHref?: string | undefined) => Promise<string | false>;
|
|
1097
|
+
export declare const useHandleAuthCallback: () => (locationHref?: string | undefined) => Promise<string | false>;
|
|
1100
1098
|
/**
|
|
1101
1099
|
* @internal
|
|
1102
1100
|
*/
|
|
1103
|
-
declare function useLoginUrl(): string;
|
|
1101
|
+
export declare function useLoginUrl(): string;
|
|
1104
1102
|
/**
|
|
1105
1103
|
* Hook to log out of the current session
|
|
1106
1104
|
* @internal
|
|
1107
1105
|
* @returns A function to log out of the current session
|
|
1108
1106
|
*/
|
|
1109
|
-
declare const useLogOut: () => () => Promise<void>;
|
|
1107
|
+
export declare const useLogOut: () => () => Promise<void>;
|
|
1110
1108
|
/**
|
|
1111
1109
|
* Hook that verifies the current projects belongs to the organization ID specified in the dashboard context.
|
|
1112
1110
|
*
|
|
@@ -1127,7 +1125,7 @@ declare const useLogOut: () => () => Promise<void>;
|
|
|
1127
1125
|
* }
|
|
1128
1126
|
* ```
|
|
1129
1127
|
*/
|
|
1130
|
-
declare function useVerifyOrgProjects(disabled?: boolean, projectIds?: string[]): string | null;
|
|
1128
|
+
export declare function useVerifyOrgProjects(disabled?: boolean, projectIds?: string[]): string | null;
|
|
1131
1129
|
/**
|
|
1132
1130
|
* A React hook that provides a client that subscribes to changes in your application,
|
|
1133
1131
|
*
|
|
@@ -1155,7 +1153,12 @@ declare function useVerifyOrgProjects(disabled?: boolean, projectIds?: string[])
|
|
|
1155
1153
|
* @public
|
|
1156
1154
|
* @function
|
|
1157
1155
|
*/
|
|
1158
|
-
declare const useClient: (options: ClientOptions) => import("@sanity/client").SanityClient;
|
|
1156
|
+
export declare const useClient: (options: ClientOptions) => import("@sanity/client").SanityClient;
|
|
1157
|
+
declare global {
|
|
1158
|
+
interface SymbolConstructor {
|
|
1159
|
+
readonly observable: symbol;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1159
1162
|
/**
|
|
1160
1163
|
* @public
|
|
1161
1164
|
*/
|
|
@@ -1195,7 +1198,7 @@ interface FrameConnection<TFrameMessage extends FrameMessage> {
|
|
|
1195
1198
|
/**
|
|
1196
1199
|
* @internal
|
|
1197
1200
|
*/
|
|
1198
|
-
declare function useFrameConnection<TFrameMessage extends FrameMessage, TWindowMessage extends WindowMessage>(options: UseFrameConnectionOptions<TWindowMessage>): FrameConnection<TFrameMessage>;
|
|
1201
|
+
export declare function useFrameConnection<TFrameMessage extends FrameMessage, TWindowMessage extends WindowMessage>(options: UseFrameConnectionOptions<TWindowMessage>): FrameConnection<TFrameMessage>;
|
|
1199
1202
|
/**
|
|
1200
1203
|
* @internal
|
|
1201
1204
|
*/
|
|
@@ -1230,7 +1233,7 @@ interface WindowConnection<TMessage extends WindowMessage> {
|
|
|
1230
1233
|
* Generally not to be used directly, but to be used as a dependency of
|
|
1231
1234
|
* Comlink-powered hooks like `useStudioWorkspacesByProjectIdDataset`.
|
|
1232
1235
|
*/
|
|
1233
|
-
declare function useWindowConnection<TWindowMessage extends WindowMessage, TFrameMessage extends FrameMessage>({ name, connectTo, onMessage }: UseWindowConnectionOptions<TFrameMessage>): WindowConnection<TWindowMessage>;
|
|
1236
|
+
export declare function useWindowConnection<TWindowMessage extends WindowMessage, TFrameMessage extends FrameMessage>({ name, connectTo, onMessage }: UseWindowConnectionOptions<TFrameMessage>): WindowConnection<TWindowMessage>;
|
|
1234
1237
|
/**
|
|
1235
1238
|
* Adds React hook support (resourceName resolution) to core types.
|
|
1236
1239
|
* Prefer using the React-layer handle types (ResourceHandle, DocumentHandle)
|
|
@@ -1302,7 +1305,7 @@ interface CommentActions {
|
|
|
1302
1305
|
*
|
|
1303
1306
|
* @public
|
|
1304
1307
|
*/
|
|
1305
|
-
declare function useCommentActions(): CommentActions;
|
|
1308
|
+
export declare function useCommentActions(): CommentActions;
|
|
1306
1309
|
/**
|
|
1307
1310
|
* @public
|
|
1308
1311
|
* @category Types
|
|
@@ -1346,7 +1349,7 @@ interface UseCommentsResult {
|
|
|
1346
1349
|
*
|
|
1347
1350
|
* @public
|
|
1348
1351
|
*/
|
|
1349
|
-
declare function useComments(options: WithResourceNameSupport<CommentsOptions>): UseCommentsResult;
|
|
1352
|
+
export declare function useComments(options: WithResourceNameSupport<CommentsOptions>): UseCommentsResult;
|
|
1350
1353
|
/**
|
|
1351
1354
|
* @public
|
|
1352
1355
|
* @category Types
|
|
@@ -1397,7 +1400,7 @@ interface UseCommentThreadsResult {
|
|
|
1397
1400
|
*
|
|
1398
1401
|
* @public
|
|
1399
1402
|
*/
|
|
1400
|
-
declare function useCommentThreads(options: WithResourceNameSupport<CommentsOptions>): UseCommentThreadsResult;
|
|
1403
|
+
export declare function useCommentThreads(options: WithResourceNameSupport<CommentsOptions>): UseCommentThreadsResult;
|
|
1401
1404
|
/**
|
|
1402
1405
|
* Returns the currently active `DocumentResource` for the nearest resource context.
|
|
1403
1406
|
*
|
|
@@ -1415,7 +1418,7 @@ declare function useCommentThreads(options: WithResourceNameSupport<CommentsOpti
|
|
|
1415
1418
|
* console.log(resource?.projectId, resource?.dataset)
|
|
1416
1419
|
* ```
|
|
1417
1420
|
*/
|
|
1418
|
-
declare function useResource(): DocumentResource | undefined;
|
|
1421
|
+
export declare function useResource(): DocumentResource | undefined;
|
|
1419
1422
|
/**
|
|
1420
1423
|
* Retrieves the current Sanity instance from context
|
|
1421
1424
|
*
|
|
@@ -1436,7 +1439,7 @@ declare function useResource(): DocumentResource | undefined;
|
|
|
1436
1439
|
*
|
|
1437
1440
|
* @throws Error if no SanityInstance is found in context
|
|
1438
1441
|
*/
|
|
1439
|
-
declare const useSanityInstance: () => SanityInstance;
|
|
1442
|
+
export declare const useSanityInstance: () => SanityInstance;
|
|
1440
1443
|
/**
|
|
1441
1444
|
* Props shared by {@link useFavorite} and {@link useUpdateFavorite}: a document
|
|
1442
1445
|
* handle plus the resource it lives in.
|
|
@@ -1474,7 +1477,7 @@ interface UseFavoriteProps extends DocumentHandle$1 {
|
|
|
1474
1477
|
* }
|
|
1475
1478
|
* ```
|
|
1476
1479
|
*/
|
|
1477
|
-
declare function useFavorite(props: UseFavoriteProps): boolean;
|
|
1480
|
+
export declare function useFavorite(props: UseFavoriteProps): boolean;
|
|
1478
1481
|
interface DocumentInteractionHistory {
|
|
1479
1482
|
recordEvent: (eventType: 'viewed' | 'edited' | 'created' | 'deleted') => void;
|
|
1480
1483
|
}
|
|
@@ -1531,7 +1534,7 @@ interface UseRecordDocumentHistoryEventProps extends DocumentHandle$1 {
|
|
|
1531
1534
|
* }
|
|
1532
1535
|
* ```
|
|
1533
1536
|
*/
|
|
1534
|
-
declare function useRecordDocumentHistoryEvent({ documentId, documentType, resourceType, resourceId, schemaName }: UseRecordDocumentHistoryEventProps): DocumentInteractionHistory;
|
|
1537
|
+
export declare function useRecordDocumentHistoryEvent({ documentId, documentType, resourceType, resourceId, schemaName }: UseRecordDocumentHistoryEventProps): DocumentInteractionHistory;
|
|
1535
1538
|
interface DashboardResource {
|
|
1536
1539
|
id: string;
|
|
1537
1540
|
name: string;
|
|
@@ -1584,7 +1587,7 @@ interface StudioWorkspacesResult {
|
|
|
1584
1587
|
* }
|
|
1585
1588
|
* ```
|
|
1586
1589
|
*/
|
|
1587
|
-
declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult;
|
|
1590
|
+
export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult;
|
|
1588
1591
|
/**
|
|
1589
1592
|
* The value returned by {@link useUpdateFavorite}.
|
|
1590
1593
|
*
|
|
@@ -1641,7 +1644,7 @@ interface UpdateFavorite {
|
|
|
1641
1644
|
* }
|
|
1642
1645
|
* ```
|
|
1643
1646
|
*/
|
|
1644
|
-
declare function useUpdateFavorite(props: UseFavoriteProps): UpdateFavorite;
|
|
1647
|
+
export declare function useUpdateFavorite(props: UseFavoriteProps): UpdateFavorite;
|
|
1645
1648
|
/**
|
|
1646
1649
|
* Returns metadata for each dataset the current user has access to.
|
|
1647
1650
|
*
|
|
@@ -1672,12 +1675,12 @@ declare function useUpdateFavorite(props: UseFavoriteProps): UpdateFavorite;
|
|
|
1672
1675
|
* 4. `instance.config`.
|
|
1673
1676
|
* @public
|
|
1674
1677
|
*/
|
|
1675
|
-
declare function useDatasets(options?: ProjectHandle): FetcherHookResult<DatasetsResponse$1>;
|
|
1678
|
+
export declare function useDatasets(options?: ProjectHandle): FetcherHookResult<DatasetsResponse$1>;
|
|
1676
1679
|
/**
|
|
1677
1680
|
* @public
|
|
1678
1681
|
*/
|
|
1679
1682
|
interface UseApplyDocumentActions {
|
|
1680
|
-
(): <TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(action: DocumentAction<TDocumentType, TDataset, TProjectId> | DocumentAction<TDocumentType, TDataset, TProjectId>[], options?: ResourceHandle) => Promise<ActionsResult<
|
|
1683
|
+
(): <TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(action: DocumentAction<TDocumentType, TDataset, TProjectId> | DocumentAction<TDocumentType, TDataset, TProjectId>[], options?: ResourceHandle) => Promise<ActionsResult<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
1681
1684
|
}
|
|
1682
1685
|
/**
|
|
1683
1686
|
* @public
|
|
@@ -1855,14 +1858,14 @@ interface UseApplyDocumentActions {
|
|
|
1855
1858
|
* perspective: {releaseName: 'summer-drop'},
|
|
1856
1859
|
* })
|
|
1857
1860
|
*
|
|
1858
|
-
* apply(editDocument(docHandle, {title: 'Updated for release'}))
|
|
1861
|
+
* apply(editDocument(docHandle, {set: {title: 'Updated for release'}}))
|
|
1859
1862
|
* }
|
|
1860
1863
|
*
|
|
1861
1864
|
* return <button onClick={handleEdit}>Edit in Release</button>
|
|
1862
1865
|
* }
|
|
1863
1866
|
* ```
|
|
1864
1867
|
*/
|
|
1865
|
-
declare const useApplyDocumentActions: UseApplyDocumentActions;
|
|
1868
|
+
export declare const useApplyDocumentActions: UseApplyDocumentActions;
|
|
1866
1869
|
type IgnoredKey = '_id' | '_type' | '_rev' | '_createdAt' | '_updatedAt';
|
|
1867
1870
|
/**
|
|
1868
1871
|
* Optional per-call overrides for {@link useCreateDocument}'s create function.
|
|
@@ -1883,7 +1886,7 @@ interface CreateDocumentOverrides {
|
|
|
1883
1886
|
* @returns A function that creates the document. It accepts optional initial field values and an optional `{documentId}` override,
|
|
1884
1887
|
* and resolves to the {@link DocumentHandle} of the created document (carrying the generated or supplied id).
|
|
1885
1888
|
*/
|
|
1886
|
-
declare function useCreateDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>): (initialValue?: Partial<Omit<
|
|
1889
|
+
export declare function useCreateDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>): (initialValue?: Partial<Omit<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, IgnoredKey>>, overrides?: CreateDocumentOverrides) => Promise<DocumentHandle<TDocumentType, TDataset, TProjectId>>;
|
|
1887
1890
|
/**
|
|
1888
1891
|
* @public
|
|
1889
1892
|
* Create a new document with an explicit type `TData`.
|
|
@@ -1892,18 +1895,18 @@ declare function useCreateDocument<TDocumentType extends string = string, TDatas
|
|
|
1892
1895
|
* @returns A function that creates the document. It accepts optional initial field values (typed against `TData`) and an
|
|
1893
1896
|
* optional `{documentId}` override, and resolves to the {@link DocumentHandle} of the created document.
|
|
1894
1897
|
*/
|
|
1895
|
-
declare function useCreateDocument<TData extends Record<string, unknown>>(options: DocumentTypeHandle): (initialValue?: Partial<Omit<TData, IgnoredKey>>, overrides?: CreateDocumentOverrides) => Promise<DocumentHandle>;
|
|
1898
|
+
export declare function useCreateDocument<TData extends Record<string, unknown>>(options: DocumentTypeHandle): (initialValue?: Partial<Omit<TData, IgnoredKey>>, overrides?: CreateDocumentOverrides) => Promise<DocumentHandle>;
|
|
1896
1899
|
type UseDocumentOptions<TPath extends string | undefined = undefined, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> = DocumentHandle<TDocumentType, TDataset, TProjectId> & {
|
|
1897
1900
|
path?: TPath;
|
|
1898
1901
|
};
|
|
1899
1902
|
interface UseDocument {
|
|
1900
1903
|
/** @internal */
|
|
1901
1904
|
<TDocumentType extends string, TDataset extends string, TProjectId extends string = string>(options: UseDocumentOptions<undefined, TDocumentType, TDataset, TProjectId>): {
|
|
1902
|
-
data:
|
|
1905
|
+
data: ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`> | null;
|
|
1903
1906
|
};
|
|
1904
1907
|
/** @internal */
|
|
1905
1908
|
<TPath extends string, TDocumentType extends string, TDataset extends string = string, TProjectId extends string = string>(options: UseDocumentOptions<TPath, TDocumentType>): {
|
|
1906
|
-
data: JsonMatch<
|
|
1909
|
+
data: JsonMatch<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined;
|
|
1907
1910
|
};
|
|
1908
1911
|
/** @internal */
|
|
1909
1912
|
<TData>(options: DocumentOptions<undefined>): {
|
|
@@ -1976,9 +1979,9 @@ interface UseDocument {
|
|
|
1976
1979
|
* @inlineType DocumentOptions
|
|
1977
1980
|
*/
|
|
1978
1981
|
<TPath extends string | undefined = undefined, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: UseDocumentOptions<TPath, TDocumentType>): TPath extends string ? {
|
|
1979
|
-
data: JsonMatch<
|
|
1982
|
+
data: JsonMatch<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined;
|
|
1980
1983
|
} : {
|
|
1981
|
-
data:
|
|
1984
|
+
data: ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`> | null;
|
|
1982
1985
|
};
|
|
1983
1986
|
/**
|
|
1984
1987
|
* @public
|
|
@@ -2075,7 +2078,7 @@ interface UseDocument {
|
|
|
2075
2078
|
*
|
|
2076
2079
|
* @function
|
|
2077
2080
|
*/
|
|
2078
|
-
declare const useDocument: UseDocument;
|
|
2081
|
+
export declare const useDocument: UseDocument;
|
|
2079
2082
|
/**
|
|
2080
2083
|
* @public
|
|
2081
2084
|
*/
|
|
@@ -2137,7 +2140,7 @@ interface UseDocumentEventOptions<TDataset extends string = string, TProjectId e
|
|
|
2137
2140
|
* }
|
|
2138
2141
|
* ```
|
|
2139
2142
|
*/
|
|
2140
|
-
declare function useDocumentEvent<TDataset extends string = string, TProjectId extends string = string>(options: UseDocumentEventOptions<TDataset, TProjectId>): void;
|
|
2143
|
+
export declare function useDocumentEvent<TDataset extends string = string, TProjectId extends string = string>(options: UseDocumentEventOptions<TDataset, TProjectId>): void;
|
|
2141
2144
|
/**
|
|
2142
2145
|
*
|
|
2143
2146
|
* @public
|
|
@@ -2215,7 +2218,7 @@ declare function useDocumentEvent<TDataset extends string = string, TProjectId e
|
|
|
2215
2218
|
* }
|
|
2216
2219
|
* ```
|
|
2217
2220
|
*/
|
|
2218
|
-
declare function useDocumentPermissions(actionOrActions: WithResourceNameSupport<DocumentAction> | WithResourceNameSupport<DocumentAction>[]): DocumentPermissionsResult;
|
|
2221
|
+
export declare function useDocumentPermissions(actionOrActions: WithResourceNameSupport<DocumentAction> | WithResourceNameSupport<DocumentAction>[]): DocumentPermissionsResult;
|
|
2219
2222
|
type UseDocumentSyncStatus = {
|
|
2220
2223
|
/**
|
|
2221
2224
|
* Exposes the document's sync status between local and remote document states.
|
|
@@ -2255,7 +2258,7 @@ type UseDocumentSyncStatus = {
|
|
|
2255
2258
|
* @public
|
|
2256
2259
|
* @function
|
|
2257
2260
|
*/
|
|
2258
|
-
declare const useDocumentSyncStatus: UseDocumentSyncStatus;
|
|
2261
|
+
export declare const useDocumentSyncStatus: UseDocumentSyncStatus;
|
|
2259
2262
|
type Updater<TValue> = TValue | ((currentValue: TValue) => TValue);
|
|
2260
2263
|
/**
|
|
2261
2264
|
* @public
|
|
@@ -2265,7 +2268,7 @@ type Updater<TValue> = TValue | ((currentValue: TValue) => TValue);
|
|
|
2265
2268
|
* @returns A stable function to update the document state. Accepts either the new document state or an updater function `(currentValue) => nextValue`.
|
|
2266
2269
|
* Returns a promise resolving to the {@link ActionsResult}.
|
|
2267
2270
|
*/
|
|
2268
|
-
declare function useEditDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentOptions<undefined, TDocumentType, TDataset, TProjectId>): (nextValue: Updater<
|
|
2271
|
+
export declare function useEditDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentOptions<undefined, TDocumentType, TDataset, TProjectId>): (nextValue: Updater<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>) => Promise<ActionsResult<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
2269
2272
|
/**
|
|
2270
2273
|
* @public
|
|
2271
2274
|
* Edit a specific path within a document, relying on Typegen for the type.
|
|
@@ -2274,7 +2277,7 @@ declare function useEditDocument<TDocumentType extends string = string, TDataset
|
|
|
2274
2277
|
* @returns A stable function to update the value at the specified path. Accepts either the new value or an updater function `(currentValue) => nextValue`.
|
|
2275
2278
|
* Returns a promise resolving to the {@link ActionsResult}.
|
|
2276
2279
|
*/
|
|
2277
|
-
declare function useEditDocument<TPath extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentOptions<TPath, TDocumentType, TDataset, TProjectId>): (nextValue: Updater<JsonMatch<
|
|
2280
|
+
export declare function useEditDocument<TPath extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentOptions<TPath, TDocumentType, TDataset, TProjectId>): (nextValue: Updater<JsonMatch<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, TPath>>) => Promise<ActionsResult<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>>;
|
|
2278
2281
|
/**
|
|
2279
2282
|
* @public
|
|
2280
2283
|
* Edit an entire document with an explicit type `TData`.
|
|
@@ -2283,7 +2286,7 @@ declare function useEditDocument<TPath extends string = string, TDocumentType ex
|
|
|
2283
2286
|
* @returns A stable function to update the document state. Accepts either the new document state (`TData`) or an updater function `(currentValue: TData) => nextValue: TData`.
|
|
2284
2287
|
* Returns a promise resolving to the {@link ActionsResult}.
|
|
2285
2288
|
*/
|
|
2286
|
-
declare function useEditDocument<TData>(options: DocumentOptions<undefined>): (nextValue: Updater<TData>) => Promise<ActionsResult>;
|
|
2289
|
+
export declare function useEditDocument<TData>(options: DocumentOptions<undefined>): (nextValue: Updater<TData>) => Promise<ActionsResult>;
|
|
2287
2290
|
/**
|
|
2288
2291
|
* @public
|
|
2289
2292
|
* Edit a specific path within a document with an explicit type `TData`.
|
|
@@ -2292,7 +2295,7 @@ declare function useEditDocument<TData>(options: DocumentOptions<undefined>): (n
|
|
|
2292
2295
|
* @returns A stable function to update the value at the specified path. Accepts either the new value (`TData`) or an updater function `(currentValue: TData) => nextValue: TData`.
|
|
2293
2296
|
* Returns a promise resolving to the {@link ActionsResult}.
|
|
2294
2297
|
*/
|
|
2295
|
-
declare function useEditDocument<TData>(options: DocumentOptions<string>): (nextValue: Updater<TData>) => Promise<ActionsResult>;
|
|
2298
|
+
export declare function useEditDocument<TData>(options: DocumentOptions<string>): (nextValue: Updater<TData>) => Promise<ActionsResult>;
|
|
2296
2299
|
/**
|
|
2297
2300
|
* Configuration options for the useDocuments hook
|
|
2298
2301
|
*
|
|
@@ -2459,7 +2462,7 @@ interface DocumentsResponse<TDocumentType extends string = string, TDataset exte
|
|
|
2459
2462
|
* }
|
|
2460
2463
|
* ```
|
|
2461
2464
|
*/
|
|
2462
|
-
declare function useDocuments<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>({ batchSize, params, search, filter, orderings, documentType, ...rawOptions }: DocumentsOptions<TDocumentType, TDataset, TProjectId>): DocumentsResponse<TDocumentType, TDataset, TProjectId>;
|
|
2465
|
+
export declare function useDocuments<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>({ batchSize, params, search, filter, orderings, documentType, ...rawOptions }: DocumentsOptions<TDocumentType, TDataset, TProjectId>): DocumentsResponse<TDocumentType, TDataset, TProjectId>;
|
|
2463
2466
|
/**
|
|
2464
2467
|
* Returns a single installation by id.
|
|
2465
2468
|
*
|
|
@@ -2472,7 +2475,7 @@ declare function useDocuments<TDocumentType extends string = string, TDataset ex
|
|
|
2472
2475
|
* @param options - Optional `include` list to expand related resources.
|
|
2473
2476
|
* @returns The result envelope `{data, isFetching, error, refetch}`.
|
|
2474
2477
|
*/
|
|
2475
|
-
declare const useInstallation: <Include extends InstallationInclude = never>(installationId: string, options?: {
|
|
2478
|
+
export declare const useInstallation: <Include extends InstallationInclude = never>(installationId: string, options?: {
|
|
2476
2479
|
include?: Include[];
|
|
2477
2480
|
}) => FetcherHookResult<Installation<Include>>;
|
|
2478
2481
|
/**
|
|
@@ -2486,7 +2489,7 @@ declare const useInstallation: <Include extends InstallationInclude = never>(ins
|
|
|
2486
2489
|
* @param options - Filter and include options for the installations list.
|
|
2487
2490
|
* @returns The result envelope `{data, isFetching, error, refetch}`.
|
|
2488
2491
|
*/
|
|
2489
|
-
declare const useInstallations: <Include extends InstallationInclude = never>(options: InstallationsOptions<Include>) => FetcherHookResult<InstallationsResponse<Include>>;
|
|
2492
|
+
export declare const useInstallations: <Include extends InstallationInclude = never>(options: InstallationsOptions<Include>) => FetcherHookResult<InstallationsResponse<Include>>;
|
|
2490
2493
|
/**
|
|
2491
2494
|
* Returns metadata for a given organisation.
|
|
2492
2495
|
*
|
|
@@ -2511,7 +2514,7 @@ declare const useInstallations: <Include extends InstallationInclude = never>(op
|
|
|
2511
2514
|
* @public
|
|
2512
2515
|
* @function
|
|
2513
2516
|
*/
|
|
2514
|
-
declare const useOrganization: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Organization<IncludeMembers, IncludeFeatures>>;
|
|
2517
|
+
export declare const useOrganization: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Organization<IncludeMembers, IncludeFeatures>>;
|
|
2515
2518
|
/**
|
|
2516
2519
|
* Returns metadata for each organisation the current user has access to.
|
|
2517
2520
|
*
|
|
@@ -2541,7 +2544,7 @@ declare const useOrganization: <IncludeMembers extends boolean = false, IncludeF
|
|
|
2541
2544
|
* @public
|
|
2542
2545
|
* @function
|
|
2543
2546
|
*/
|
|
2544
|
-
declare const useOrganizations: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Organizations<IncludeMembers, IncludeFeatures>>;
|
|
2547
|
+
export declare const useOrganizations: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Organizations<IncludeMembers, IncludeFeatures>>;
|
|
2545
2548
|
/**
|
|
2546
2549
|
* Configuration options for the usePaginatedDocuments hook
|
|
2547
2550
|
*
|
|
@@ -2740,7 +2743,7 @@ interface PaginatedDocumentsResponse<TDocumentType extends string = string, TDat
|
|
|
2740
2743
|
* // <PaginatedDocumentList dataset={myDatasetHandle} documentType="post" />
|
|
2741
2744
|
* ```
|
|
2742
2745
|
*/
|
|
2743
|
-
declare function usePaginatedDocuments<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>({ documentType, filter, pageSize, params, orderings, search, ...rawOptions }: PaginatedDocumentsOptions<TDocumentType, TDataset, TProjectId>): PaginatedDocumentsResponse<TDocumentType, TDataset, TProjectId>;
|
|
2746
|
+
export declare function usePaginatedDocuments<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>({ documentType, filter, pageSize, params, orderings, search, ...rawOptions }: PaginatedDocumentsOptions<TDocumentType, TDataset, TProjectId>): PaginatedDocumentsResponse<TDocumentType, TDataset, TProjectId>;
|
|
2744
2747
|
/**
|
|
2745
2748
|
* Every participant in the current project and dataset, or Canvas.
|
|
2746
2749
|
*
|
|
@@ -2758,7 +2761,7 @@ declare function usePaginatedDocuments<TDocumentType extends string = string, TD
|
|
|
2758
2761
|
*
|
|
2759
2762
|
* @public
|
|
2760
2763
|
*/
|
|
2761
|
-
declare function usePresence(options?: ResourceHandle): {
|
|
2764
|
+
export declare function usePresence(options?: ResourceHandle): {
|
|
2762
2765
|
locations: UserPresence[];
|
|
2763
2766
|
};
|
|
2764
2767
|
/** @beta */
|
|
@@ -2808,7 +2811,7 @@ interface UsePresenceForDocumentOptions extends DocumentHandle {
|
|
|
2808
2811
|
*
|
|
2809
2812
|
* @beta
|
|
2810
2813
|
*/
|
|
2811
|
-
declare function usePresenceForDocument(options: UsePresenceForDocumentOptions): {
|
|
2814
|
+
export declare function usePresenceForDocument(options: UsePresenceForDocumentOptions): {
|
|
2812
2815
|
presence: DocumentPresence[];
|
|
2813
2816
|
};
|
|
2814
2817
|
/** @beta */
|
|
@@ -2874,7 +2877,7 @@ interface UseReportPresenceOptions extends DocumentHandle {
|
|
|
2874
2877
|
*
|
|
2875
2878
|
* @beta
|
|
2876
2879
|
*/
|
|
2877
|
-
declare function useReportPresence(options: UseReportPresenceOptions): void;
|
|
2880
|
+
export declare function useReportPresence(options: UseReportPresenceOptions): void;
|
|
2878
2881
|
/**
|
|
2879
2882
|
* @public
|
|
2880
2883
|
* @category Types
|
|
@@ -2952,7 +2955,7 @@ interface useDocumentPreviewResults {
|
|
|
2952
2955
|
* )
|
|
2953
2956
|
* ```
|
|
2954
2957
|
*/
|
|
2955
|
-
declare function useDocumentPreview({ ref, ...docHandle }: useDocumentPreviewOptions): useDocumentPreviewResults;
|
|
2958
|
+
export declare function useDocumentPreview({ ref, ...docHandle }: useDocumentPreviewOptions): useDocumentPreviewResults;
|
|
2956
2959
|
/**
|
|
2957
2960
|
* @public
|
|
2958
2961
|
* @category Types
|
|
@@ -3000,19 +3003,19 @@ interface useDocumentProjectionResults<TData> {
|
|
|
3000
3003
|
* @param options - Options including the document handle properties (`documentId`, `documentType`, etc.) and the `projection`.
|
|
3001
3004
|
* @returns The projected data, typed based on Typegen.
|
|
3002
3005
|
*
|
|
3003
|
-
* @example Using Typegen for a book preview
|
|
3006
|
+
* @example Using an existing experimental Typegen file for a book preview
|
|
3004
3007
|
* ```tsx
|
|
3005
3008
|
* // ProjectionComponent.tsx
|
|
3006
|
-
* import {useDocumentProjection, type DocumentHandle} from '@sanity/sdk-react'
|
|
3009
|
+
* import {defineProjection, useDocumentProjection, type DocumentHandle} from '@sanity/sdk-react'
|
|
3007
3010
|
* import {useRef} from 'react'
|
|
3008
|
-
* import {defineProjection} from 'groq'
|
|
3009
3011
|
*
|
|
3010
3012
|
* // Define props using DocumentHandle with the specific document type
|
|
3011
3013
|
* type ProjectionComponentProps = {
|
|
3012
3014
|
* doc: DocumentHandle<'book'> // Typegen knows 'book'
|
|
3013
3015
|
* }
|
|
3014
3016
|
*
|
|
3015
|
-
* //
|
|
3017
|
+
* // Keep the projection string identical to its entry in the existing generated file.
|
|
3018
|
+
* // Current Typegen does not scan defineProjection imported from the SDK.
|
|
3016
3019
|
* const myProjection = defineProjection(`{
|
|
3017
3020
|
* title,
|
|
3018
3021
|
* 'coverImage': cover.asset->url,
|
|
@@ -3048,7 +3051,7 @@ interface useDocumentProjectionResults<TData> {
|
|
|
3048
3051
|
* // </Suspense>
|
|
3049
3052
|
* ```
|
|
3050
3053
|
*/
|
|
3051
|
-
declare function useDocumentProjection<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: useDocumentProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): useDocumentProjectionResults<
|
|
3054
|
+
export declare function useDocumentProjection<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: useDocumentProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): useDocumentProjectionResults<ResolveProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>>;
|
|
3052
3055
|
/**
|
|
3053
3056
|
* @public
|
|
3054
3057
|
* Fetch a projection with an explicitly defined return type `TData`.
|
|
@@ -3094,7 +3097,7 @@ declare function useDocumentProjection<TProjection extends string = string, TDoc
|
|
|
3094
3097
|
* // </Suspense>
|
|
3095
3098
|
* ```
|
|
3096
3099
|
*/
|
|
3097
|
-
declare function useDocumentProjection<TData extends object>(options: useDocumentProjectionOptions): useDocumentProjectionResults<TData>;
|
|
3100
|
+
export declare function useDocumentProjection<TData extends object>(options: useDocumentProjectionOptions): useDocumentProjectionResults<TData>;
|
|
3098
3101
|
/**
|
|
3099
3102
|
* Returns metadata for a given project.
|
|
3100
3103
|
*
|
|
@@ -3131,7 +3134,7 @@ declare function useDocumentProjection<TData extends object>(options: useDocumen
|
|
|
3131
3134
|
* @public
|
|
3132
3135
|
* @function
|
|
3133
3136
|
*/
|
|
3134
|
-
declare const useProject: <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>>;
|
|
3137
|
+
export declare const useProject: <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>>;
|
|
3135
3138
|
/**
|
|
3136
3139
|
* Returns metadata for each project you have access to.
|
|
3137
3140
|
*
|
|
@@ -3163,7 +3166,7 @@ declare const useProject: <IncludeMembers extends boolean = true, IncludeFeature
|
|
|
3163
3166
|
* @public
|
|
3164
3167
|
* @function
|
|
3165
3168
|
*/
|
|
3166
|
-
declare const useProjects: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>[]>;
|
|
3169
|
+
export declare const useProjects: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>[]>;
|
|
3167
3170
|
/**
|
|
3168
3171
|
* Hook options for useQuery, supporting both direct resource and resourceName.
|
|
3169
3172
|
* @beta
|
|
@@ -3224,9 +3227,9 @@ type UseQueryOptions<TQuery extends string = string, TDataset extends string = s
|
|
|
3224
3227
|
* }
|
|
3225
3228
|
* ```
|
|
3226
3229
|
*/
|
|
3227
|
-
declare function useQuery<TQuery extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: UseQueryOptions<TQuery, TDataset, TProjectId>): {
|
|
3230
|
+
export declare function useQuery<TQuery extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: UseQueryOptions<TQuery, TDataset, TProjectId>): {
|
|
3228
3231
|
/** The query result, typed based on the GROQ query string */
|
|
3229
|
-
data:
|
|
3232
|
+
data: ResolveQueryResult<TQuery, `${TProjectId}.${TDataset}`>;
|
|
3230
3233
|
/** True if a query transition is in progress */
|
|
3231
3234
|
isPending: boolean;
|
|
3232
3235
|
};
|
|
@@ -3258,7 +3261,7 @@ declare function useQuery<TQuery extends string = string, TDataset extends strin
|
|
|
3258
3261
|
* }
|
|
3259
3262
|
* ```
|
|
3260
3263
|
*/
|
|
3261
|
-
declare function useQuery<TData>(options: WithResourceNameSupport<QueryOptions>): {
|
|
3264
|
+
export declare function useQuery<TData>(options: WithResourceNameSupport<QueryOptions>): {
|
|
3262
3265
|
/** The query result, cast to the provided type TData */
|
|
3263
3266
|
data: TData;
|
|
3264
3267
|
/** True if another query is resolving in the background (suspense handles the initial loading state) */
|
|
@@ -3280,7 +3283,7 @@ declare function useQuery<TData>(options: WithResourceNameSupport<QueryOptions>)
|
|
|
3280
3283
|
* const activeReleases = useActiveReleases()
|
|
3281
3284
|
* ```
|
|
3282
3285
|
*/
|
|
3283
|
-
declare function useActiveReleases(options?: WithResourceNameSupport<DatasetHandle> | undefined): ReleaseDocument[];
|
|
3286
|
+
export declare function useActiveReleases(options?: WithResourceNameSupport<DatasetHandle> | undefined): ReleaseDocument[];
|
|
3284
3287
|
/**
|
|
3285
3288
|
* @public
|
|
3286
3289
|
* @function
|
|
@@ -3306,7 +3309,7 @@ declare function useActiveReleases(options?: WithResourceNameSupport<DatasetHand
|
|
|
3306
3309
|
* const releases = useAllReleases()
|
|
3307
3310
|
* ```
|
|
3308
3311
|
*/
|
|
3309
|
-
declare function useAllReleases(options?: WithResourceNameSupport<DatasetHandle> | undefined): ReleaseDocument[];
|
|
3312
|
+
export declare function useAllReleases(options?: WithResourceNameSupport<DatasetHandle> | undefined): ReleaseDocument[];
|
|
3310
3313
|
/**
|
|
3311
3314
|
* @public
|
|
3312
3315
|
*/
|
|
@@ -3380,12 +3383,12 @@ interface UseApplyReleaseActions {
|
|
|
3380
3383
|
* }
|
|
3381
3384
|
* ```
|
|
3382
3385
|
*/
|
|
3383
|
-
declare const useApplyReleaseActions: UseApplyReleaseActions;
|
|
3386
|
+
export declare const useApplyReleaseActions: UseApplyReleaseActions;
|
|
3384
3387
|
/**
|
|
3385
3388
|
* @public
|
|
3386
3389
|
* @function
|
|
3387
3390
|
*/
|
|
3388
|
-
declare function usePerspective(perspectiveHandle?: ResourceHandle): string | string[];
|
|
3391
|
+
export declare function usePerspective(perspectiveHandle?: ResourceHandle): string | string[];
|
|
3389
3392
|
/**
|
|
3390
3393
|
* @public
|
|
3391
3394
|
* @category Types
|
|
@@ -3432,7 +3435,7 @@ interface UserResult {
|
|
|
3432
3435
|
* )
|
|
3433
3436
|
* ```
|
|
3434
3437
|
*/
|
|
3435
|
-
declare function useUser(options: GetUserOptions): UserResult;
|
|
3438
|
+
export declare function useUser(options: GetUserOptions): UserResult;
|
|
3436
3439
|
/**
|
|
3437
3440
|
* @public
|
|
3438
3441
|
* @category Types
|
|
@@ -3493,11 +3496,11 @@ interface UsersResult {
|
|
|
3493
3496
|
* 3. The active resource (`ResourceProvider`/`SDKProvider`)
|
|
3494
3497
|
* 4. `instance.config`.
|
|
3495
3498
|
*/
|
|
3496
|
-
declare function useUsers(options?: GetUsersOptions): UsersResult;
|
|
3499
|
+
export declare function useUsers(options?: GetUsersOptions): UsersResult;
|
|
3497
3500
|
/**
|
|
3498
3501
|
* This version is provided by pkg-utils at build time
|
|
3499
3502
|
* @internal
|
|
3500
3503
|
*/
|
|
3501
|
-
declare const REACT_SDK_VERSION: {};
|
|
3502
|
-
export {
|
|
3504
|
+
export declare const REACT_SDK_VERSION: {};
|
|
3505
|
+
export type { AuthBoundaryProps, Status as ComlinkStatus, CommentActions, CreateDocumentOverrides, DatasetsResponse, DocumentHandle, DocumentTypeHandle, DocumentsOptions, DocumentsResponse, FetcherHookResult, FrameConnection, FrameMessageHandler as MessageHandler, MutationHookResult, PaginatedDocumentsOptions, PaginatedDocumentsResponse, ResourceHandle, ResourceProviderProps, SDKProviderProps, SanityAppProps, SanityDocument, SanityInstanceProviderProps, SanityProjectMember, SortOrderingItem, StudioWorkspaceHandle, UseCommentThreadsResult, UseCommentsResult, UseFrameConnectionOptions, UsePresenceForDocumentOptions, UseReportPresenceOptions, UseWindowConnectionOptions, UserResult, UsersResult, WindowConnection, WindowMessageHandler, useDocumentPreviewOptions, useDocumentPreviewResults, useDocumentProjectionOptions, useDocumentProjectionResults };
|
|
3503
3506
|
//# sourceMappingURL=index.d.ts.map
|