@sanity/sdk-react 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/index.d.ts +267 -112
- package/dist/index.js +131 -89
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
- package/src/_exports/sdk-react.ts +14 -1
- package/src/components/auth/AuthBoundary.tsx +10 -5
- package/src/context/WorkbenchTokenRefresh.test.tsx +106 -0
- package/src/context/WorkbenchTokenRefresh.tsx +61 -0
- package/src/context/workbenchToken.ts +63 -0
- package/src/hooks/access/useCheckPermissions.test-d.ts +15 -0
- package/src/hooks/access/useCheckPermissions.test.tsx +53 -0
- package/src/hooks/access/useCheckPermissions.ts +24 -0
- package/src/hooks/applications/useApplication.test-d.ts +30 -0
- package/src/hooks/applications/useApplication.ts +22 -0
- package/src/hooks/applications/useApplications.test-d.ts +31 -0
- package/src/hooks/applications/useApplications.ts +25 -0
- package/src/hooks/applications/useCreateUserApplication.test-d.ts +14 -0
- package/src/hooks/applications/useCreateUserApplication.ts +11 -0
- package/src/hooks/applications/useDeleteApplication.test-d.ts +12 -0
- package/src/hooks/applications/useDeleteApplication.ts +11 -0
- package/src/hooks/applications/useDeleteUserApplication.test-d.ts +14 -0
- package/src/hooks/applications/useDeleteUserApplication.ts +11 -0
- package/src/hooks/applications/useUpdateApplication.test-d.ts +12 -0
- package/src/hooks/applications/useUpdateApplication.ts +11 -0
- package/src/hooks/applications/useUpdateUserApplication.test-d.ts +14 -0
- package/src/hooks/applications/useUpdateUserApplication.ts +11 -0
- package/src/hooks/applications/useUserApplication.test-d.ts +11 -0
- package/src/hooks/applications/useUserApplication.ts +14 -0
- package/src/hooks/applications/useUserApplications.test-d.ts +11 -0
- package/src/hooks/applications/useUserApplications.ts +14 -0
- package/src/hooks/helpers/createFetcherHook.test.tsx +180 -0
- package/src/hooks/helpers/createFetcherHook.ts +69 -0
- package/src/hooks/helpers/createMutationHook.test.tsx +125 -0
- package/src/hooks/helpers/createMutationHook.tsx +93 -0
- package/src/hooks/installations/useInstallation.test-d.ts +19 -0
- package/src/hooks/installations/useInstallation.ts +22 -0
- package/src/hooks/installations/useInstallations.test-d.ts +26 -0
- package/src/hooks/installations/useInstallations.ts +25 -0
- package/src/hooks/organizations/useOrganization.test-d.ts +19 -12
- package/src/hooks/organizations/useOrganization.test.ts +50 -52
- package/src/hooks/organizations/useOrganization.ts +13 -19
- package/src/hooks/organizations/useOrganizations.test-d.ts +26 -13
- package/src/hooks/organizations/useOrganizations.test.ts +49 -71
- package/src/hooks/organizations/useOrganizations.ts +14 -20
- package/src/hooks/projects/useProject.test-d.ts +18 -11
- package/src/hooks/projects/useProject.test.tsx +29 -23
- package/src/hooks/projects/useProject.ts +12 -16
- package/src/hooks/projects/useProjects.test-d.ts +22 -11
- package/src/hooks/projects/useProjects.test.ts +45 -98
- package/src/hooks/projects/useProjects.ts +16 -17
- package/src/hooks/dashboard/useDispatchIntent.test.ts +0 -251
- package/src/hooks/dashboard/useDispatchIntent.ts +0 -157
- package/src/hooks/dashboard/utils/useResourceIdFromDocumentHandle.test.ts +0 -128
- package/src/hooks/dashboard/utils/useResourceIdFromDocumentHandle.ts +0 -42
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { ClientError, CorsOriginError } from "@sanity/client";
|
|
4
|
-
import { getAuthState, getNodeState, getIsInDashboardState, isStudioConfig, setAuthToken, AuthStateType, getLoginUrlState, observeOrganizationVerificationState, handleAuthCallback, logout, isProjectUserNotFoundClientError, getClientErrorApiDescription, getClientErrorApiBody, isImportError, getCorsErrorProjectId, getDashboardOrganizationId, getClientState, isDatasetResource, createSanityInstance, agentGenerate, agentPatch, agentPrompt, agentTransform, agentTranslate, getTokenState, getCurrentUserState, getOrCreateController, getOrCreateChannel, releaseChannel,
|
|
4
|
+
import { getAuthState, getNodeState, getIsInDashboardState, isStudioConfig, setAuthToken, AuthStateType, getLoginUrlState, observeOrganizationVerificationState, handleAuthCallback, logout, isProjectUserNotFoundClientError, getClientErrorApiDescription, getClientErrorApiBody, isImportError, getCorsErrorProjectId, getDashboardOrganizationId, getClientState, isDatasetResource, createSanityInstance, checkPermissions, agentGenerate, agentPatch, agentPrompt, agentTransform, agentTranslate, application, applications, createUserApplication, deleteApplication, deleteUserApplication, updateApplication, updateUserApplication, userApplication, userApplications, getTokenState, getCurrentUserState, getOrCreateController, getOrCreateChannel, releaseChannel, getFavoritesState, resolveFavoritesState, resolveDatasets, getDatasetsState, applyDocumentActions, createDocument, resolveDocument, getDocumentState, subscribeDocumentEvents, getPermissionsState, getDocumentSyncStatus, editDocument, getQueryKey, parseQueryKey, getQueryState, resolveQuery, createGroqSearchFilter, installation, installations, organization, organizations, isMediaLibraryResource, getPresence, getProjectionState, resolveProjection, PREVIEW_PROJECTION, transformProjectionToPreview, project, projects, getActiveReleasesState, getAllReleasesState, getPerspectiveState, getUsersKey, parseUsersKey, getUsersState, resolveUsers, loadMoreUsers } from "@sanity/sdk";
|
|
5
5
|
export * from "@sanity/sdk";
|
|
6
6
|
import { createContext, useContext, useSyncExternalStore, useRef, useEffect, useState, Suspense, use, StrictMode, useCallback, useMemo, useInsertionEffect, useTransition } from "react";
|
|
7
7
|
import { getErrorMessage, ErrorBoundary } from "react-error-boundary";
|
|
8
8
|
import { SDK_CHANNEL_NAME, SDK_NODE_NAME } from "@sanity/message-protocol";
|
|
9
|
-
import { firstValueFrom, filter, identity, Observable, startWith, distinctUntilChanged, switchMap, EMPTY } from "rxjs";
|
|
9
|
+
import { firstValueFrom, filter, from, of, identity, Observable, startWith, distinctUntilChanged, switchMap as switchMap$1, EMPTY } from "rxjs";
|
|
10
|
+
import { switchMap, catchError } from "rxjs/operators";
|
|
10
11
|
import { initTelemetry, isDeepEqual, trackHookMounted, pickProperties } from "@sanity/sdk/_internal";
|
|
11
12
|
import { createRoot } from "react-dom/client";
|
|
12
13
|
const SanityInstanceContext = createContext(null), warnedCallers = /* @__PURE__ */ new Set(), useSanityInstance = (config) => {
|
|
@@ -141,6 +142,55 @@ const ComlinkTokenRefreshProvider = (t0) => {
|
|
|
141
142
|
return $[0] !== children ? (t1 = /* @__PURE__ */ jsx(DashboardTokenRefresh, { children }), $[0] = children, $[1] = t1) : t1 = $[1], t1;
|
|
142
143
|
}
|
|
143
144
|
return children;
|
|
145
|
+
}, OS_BUS_KEY = /* @__PURE__ */ Symbol.for("sanity.os.bus");
|
|
146
|
+
function isWorkbenchEnvironment() {
|
|
147
|
+
return typeof globalThis == "object" && OS_BUS_KEY in globalThis;
|
|
148
|
+
}
|
|
149
|
+
function observeWorkbenchToken() {
|
|
150
|
+
if (isWorkbenchEnvironment())
|
|
151
|
+
return from(import("@sanity/workbench")).pipe(
|
|
152
|
+
switchMap(({
|
|
153
|
+
os
|
|
154
|
+
}) => os.subscribe("auth.token")),
|
|
155
|
+
// Any failure (importing the host bundle, or the subscription) means "no OS token".
|
|
156
|
+
catchError(() => of(null))
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
function refreshWorkbenchToken() {
|
|
160
|
+
isWorkbenchEnvironment() && import("@sanity/workbench").then(({
|
|
161
|
+
os
|
|
162
|
+
}) => os.emit("auth.token.refresh", void 0), () => {
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function WorkbenchTokenRefresh(t0) {
|
|
166
|
+
const $ = c(8), {
|
|
167
|
+
children
|
|
168
|
+
} = t0, instance = useSanityInstance(), authState = useAuthState(), processed401ErrorRef = useRef(null);
|
|
169
|
+
let t1, t2;
|
|
170
|
+
$[0] !== instance ? (t1 = () => {
|
|
171
|
+
const token$ = observeWorkbenchToken();
|
|
172
|
+
if (!token$)
|
|
173
|
+
return;
|
|
174
|
+
const subscription = token$.subscribe((token) => setAuthToken(instance, token));
|
|
175
|
+
return () => subscription.unsubscribe();
|
|
176
|
+
}, t2 = [instance], $[0] = instance, $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2);
|
|
177
|
+
let t3;
|
|
178
|
+
$[3] !== authState.error || $[4] !== authState.type ? (t3 = () => {
|
|
179
|
+
const has401Error = authState.type === AuthStateType.ERROR && authState.error?.statusCode === 401;
|
|
180
|
+
has401Error && processed401ErrorRef.current !== authState.error ? (processed401ErrorRef.current = authState.error, refreshWorkbenchToken()) : has401Error || (processed401ErrorRef.current = null);
|
|
181
|
+
}, $[3] = authState.error, $[4] = authState.type, $[5] = t3) : t3 = $[5];
|
|
182
|
+
let t4;
|
|
183
|
+
return $[6] !== authState ? (t4 = [authState], $[6] = authState, $[7] = t4) : t4 = $[7], useEffect(t3, t4), children;
|
|
184
|
+
}
|
|
185
|
+
const WorkbenchTokenRefreshProvider = (t0) => {
|
|
186
|
+
const $ = c(2), {
|
|
187
|
+
children
|
|
188
|
+
} = t0;
|
|
189
|
+
if (isWorkbenchEnvironment()) {
|
|
190
|
+
let t1;
|
|
191
|
+
return $[0] !== children ? (t1 = /* @__PURE__ */ jsx(WorkbenchTokenRefresh, { children }), $[0] = children, $[1] = t1) : t1 = $[1], t1;
|
|
192
|
+
}
|
|
193
|
+
return children;
|
|
144
194
|
};
|
|
145
195
|
function useLoginUrl() {
|
|
146
196
|
const $ = c(2), instance = useSanityInstance();
|
|
@@ -441,7 +491,7 @@ function AuthBoundary(t0) {
|
|
|
441
491
|
let t4;
|
|
442
492
|
$[7] !== props ? (t4 = /* @__PURE__ */ jsx(AuthSwitch, { ...props }), $[7] = props, $[8] = t4) : t4 = $[8];
|
|
443
493
|
let t5;
|
|
444
|
-
return $[9] !== FallbackComponent || $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(ComlinkTokenRefreshProvider, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent, resetKeys: t3, children: t4 }) }), $[9] = FallbackComponent, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
|
|
494
|
+
return $[9] !== FallbackComponent || $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(ComlinkTokenRefreshProvider, { children: /* @__PURE__ */ jsx(WorkbenchTokenRefreshProvider, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent, resetKeys: t3, children: t4 }) }) }), $[9] = FallbackComponent, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
|
|
445
495
|
}
|
|
446
496
|
function AuthSwitch(t0) {
|
|
447
497
|
const $ = c(16);
|
|
@@ -459,7 +509,7 @@ function AuthSwitch(t0) {
|
|
|
459
509
|
const isStudio = t3, disableVerifyOrg = !verifyOrganization || isStudio || authState.type !== AuthStateType.LOGGED_IN, orgError = useVerifyOrgProjects(disableVerifyOrg, projectIds), isLoggedOut = authState.type === AuthStateType.LOGGED_OUT && !authState.isDestroyingSession, loginUrl = useLoginUrl();
|
|
460
510
|
let t4, t5;
|
|
461
511
|
if ($[8] !== isLoggedOut || $[9] !== isStudio || $[10] !== loginUrl ? (t4 = () => {
|
|
462
|
-
isLoggedOut && !isInIframe() && !isStudio && (window.location.href = loginUrl);
|
|
512
|
+
isLoggedOut && !isInIframe() && !isStudio && !isWorkbenchEnvironment() && (window.location.href = loginUrl);
|
|
463
513
|
}, t5 = [isLoggedOut, loginUrl, isStudio], $[8] = isLoggedOut, $[9] = isStudio, $[10] = loginUrl, $[11] = t4, $[12] = t5) : (t4 = $[11], t5 = $[12]), useEffect(t4, t5), verifyOrganization && orgError)
|
|
464
514
|
throw new ConfigurationError({
|
|
465
515
|
message: orgError
|
|
@@ -807,6 +857,26 @@ function renderSanityApp(rootElement, namedSources, options, children) {
|
|
|
807
857
|
} = options, root = createRoot(rootElement), config = Object.values(namedSources);
|
|
808
858
|
return root.render(reactStrictMode ? /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(SanityApp, { config, fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children }) }) : /* @__PURE__ */ jsx(SanityApp, { config, fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children })), () => root.unmount();
|
|
809
859
|
}
|
|
860
|
+
function createFetcherHook(fetcher) {
|
|
861
|
+
return function(...params) {
|
|
862
|
+
const instance = useSanityInstance(), source = fetcher.getState(instance, ...params);
|
|
863
|
+
if (source.getCurrent().status === "pending")
|
|
864
|
+
throw fetcher.resolveState(instance, ...params);
|
|
865
|
+
const previous = useRef(null), snapshot = useSyncExternalStore(source.subscribe, () => {
|
|
866
|
+
const next = source.getCurrent(), prev = previous.current;
|
|
867
|
+
return prev && isDeepEqual(prev, next) ? prev : (previous.current = next, next);
|
|
868
|
+
});
|
|
869
|
+
if (snapshot.status !== "success")
|
|
870
|
+
throw snapshot.status === "error" ? snapshot.error : fetcher.resolveState(instance, ...params);
|
|
871
|
+
return {
|
|
872
|
+
data: snapshot.data,
|
|
873
|
+
isFetching: snapshot.isFetching,
|
|
874
|
+
error: snapshot.error,
|
|
875
|
+
refetch: () => fetcher.refetch(instance, ...params)
|
|
876
|
+
};
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
const useCheckPermissions = createFetcherHook(checkPermissions);
|
|
810
880
|
function normalizeResourceOptions(options, resources, contextResource, contextPerspective) {
|
|
811
881
|
const {
|
|
812
882
|
resourceName,
|
|
@@ -967,7 +1037,46 @@ function useAgentResourceContext(options) {
|
|
|
967
1037
|
updateContext();
|
|
968
1038
|
}, t3 = [updateContext], $[6] = updateContext, $[7] = t2, $[8] = t3) : (t2 = $[7], t3 = $[8]), useEffect(t2, t3);
|
|
969
1039
|
}
|
|
970
|
-
const
|
|
1040
|
+
const useApplication = createFetcherHook(application), useApplications = createFetcherHook(applications);
|
|
1041
|
+
function createMutationHook(mutation) {
|
|
1042
|
+
const idle = {
|
|
1043
|
+
status: "idle",
|
|
1044
|
+
data: void 0,
|
|
1045
|
+
error: void 0
|
|
1046
|
+
};
|
|
1047
|
+
return function() {
|
|
1048
|
+
const instance = useSanityInstance(), [state, setState] = useState(idle), callId = useRef(0), mutate = useCallback((input) => {
|
|
1049
|
+
const id = ++callId.current;
|
|
1050
|
+
return setState((prev) => ({
|
|
1051
|
+
status: "pending",
|
|
1052
|
+
data: prev.data,
|
|
1053
|
+
error: void 0
|
|
1054
|
+
})), mutation(instance, input).then(({
|
|
1055
|
+
data
|
|
1056
|
+
}) => (id === callId.current && setState({
|
|
1057
|
+
status: "success",
|
|
1058
|
+
data,
|
|
1059
|
+
error: void 0
|
|
1060
|
+
}), data), (error) => {
|
|
1061
|
+
throw id === callId.current && setState((prev) => ({
|
|
1062
|
+
status: "error",
|
|
1063
|
+
data: prev.data,
|
|
1064
|
+
error
|
|
1065
|
+
})), error;
|
|
1066
|
+
});
|
|
1067
|
+
}, [instance]), reset = useCallback(() => {
|
|
1068
|
+
callId.current++, setState(idle);
|
|
1069
|
+
}, []);
|
|
1070
|
+
return {
|
|
1071
|
+
mutate,
|
|
1072
|
+
isPending: state.status === "pending",
|
|
1073
|
+
error: state.error,
|
|
1074
|
+
data: state.data,
|
|
1075
|
+
reset
|
|
1076
|
+
};
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
const useCreateUserApplication = createMutationHook(createUserApplication), useDeleteApplication = createMutationHook(deleteApplication), useDeleteUserApplication = createMutationHook(deleteUserApplication), useUpdateApplication = createMutationHook(updateApplication), useUpdateUserApplication = createMutationHook(updateUserApplication), useUserApplication = createFetcherHook(userApplication), useUserApplications = createFetcherHook(userApplications), useAuthToken = createStateSourceHook(getTokenState), useCurrentUser = createStateSourceHook(getCurrentUserState), useClient = createStateSourceHook({
|
|
971
1080
|
getState: (instance, options) => {
|
|
972
1081
|
if (!options || typeof options != "object")
|
|
973
1082
|
throw new Error('useClient() requires a configuration object with at least an "apiVersion" property. Example: useClient({ apiVersion: "2024-11-12" })');
|
|
@@ -1040,68 +1149,6 @@ function useDashboardNavigate(navigateFn) {
|
|
|
1040
1149
|
}
|
|
1041
1150
|
}, $[0] = navigateFn, $[1] = t0) : t0 = $[1], useWindowConnection(t0);
|
|
1042
1151
|
}
|
|
1043
|
-
function useResourceIdFromDocumentHandle(documentHandle) {
|
|
1044
|
-
const $ = c(3), options = useNormalizedResourceOptions(documentHandle), {
|
|
1045
|
-
resource
|
|
1046
|
-
} = options;
|
|
1047
|
-
let resourceId = "", resourceType;
|
|
1048
|
-
resource && (isDatasetResource(resource) ? (resourceId = `${resource.projectId}.${resource.dataset}`, resourceType = void 0) : isMediaLibraryResource(resource) ? (resourceId = resource.mediaLibraryId, resourceType = "media-library") : isCanvasResource(resource) && (resourceId = resource.canvasId, resourceType = "canvas"));
|
|
1049
|
-
let t0;
|
|
1050
|
-
return $[0] !== resourceId || $[1] !== resourceType ? (t0 = {
|
|
1051
|
-
id: resourceId,
|
|
1052
|
-
type: resourceType
|
|
1053
|
-
}, $[0] = resourceId, $[1] = resourceType, $[2] = t0) : t0 = $[2], t0;
|
|
1054
|
-
}
|
|
1055
|
-
function useDispatchIntent(params) {
|
|
1056
|
-
const {
|
|
1057
|
-
action,
|
|
1058
|
-
intentId,
|
|
1059
|
-
documentHandle,
|
|
1060
|
-
parameters
|
|
1061
|
-
} = params, {
|
|
1062
|
-
sendMessage
|
|
1063
|
-
} = useWindowConnection({
|
|
1064
|
-
name: SDK_NODE_NAME,
|
|
1065
|
-
connectTo: SDK_CHANNEL_NAME
|
|
1066
|
-
}), resource = useResourceIdFromDocumentHandle(documentHandle);
|
|
1067
|
-
return {
|
|
1068
|
-
dispatchIntent: useCallback(() => {
|
|
1069
|
-
try {
|
|
1070
|
-
if (!action && !intentId)
|
|
1071
|
-
throw new Error("useDispatchIntent: Either `action` or `intentId` must be provided.");
|
|
1072
|
-
if (action && intentId && console.warn("useDispatchIntent: Both `action` and `intentId` were provided. Using `intentId` and ignoring `action`."), !resource.id)
|
|
1073
|
-
throw new Error("useDispatchIntent: Unable to determine resource. Either `resource`, `resourceName`, or both `projectId` and `dataset` must be provided in documentHandle.");
|
|
1074
|
-
const message = {
|
|
1075
|
-
type: "dashboard/v1/events/intents/dispatch-intent",
|
|
1076
|
-
data: {
|
|
1077
|
-
...action && !intentId ? {
|
|
1078
|
-
action
|
|
1079
|
-
} : {},
|
|
1080
|
-
...intentId ? {
|
|
1081
|
-
intentId
|
|
1082
|
-
} : {},
|
|
1083
|
-
document: {
|
|
1084
|
-
id: documentHandle.documentId,
|
|
1085
|
-
type: documentHandle.documentType
|
|
1086
|
-
},
|
|
1087
|
-
resource: {
|
|
1088
|
-
id: resource.id,
|
|
1089
|
-
...resource.type ? {
|
|
1090
|
-
type: resource.type
|
|
1091
|
-
} : {}
|
|
1092
|
-
},
|
|
1093
|
-
...parameters && Object.keys(parameters).length > 0 ? {
|
|
1094
|
-
parameters
|
|
1095
|
-
} : {}
|
|
1096
|
-
}
|
|
1097
|
-
};
|
|
1098
|
-
sendMessage(message.type, message.data);
|
|
1099
|
-
} catch (error) {
|
|
1100
|
-
throw console.error("Failed to dispatch intent:", error), error;
|
|
1101
|
-
}
|
|
1102
|
-
}, [action, intentId, documentHandle, parameters, sendMessage, resource.id, resource.type])
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
1152
|
function useManageFavorite({
|
|
1106
1153
|
documentId,
|
|
1107
1154
|
documentType,
|
|
@@ -1696,15 +1743,7 @@ function _temp2(str) {
|
|
|
1696
1743
|
function _temp(i) {
|
|
1697
1744
|
return typeof i == "string";
|
|
1698
1745
|
}
|
|
1699
|
-
const useOrganization =
|
|
1700
|
-
getState: getOrganizationState,
|
|
1701
|
-
shouldSuspend: (instance, ...params) => getOrganizationState(instance, ...params).getCurrent() === void 0,
|
|
1702
|
-
suspender: resolveOrganization
|
|
1703
|
-
}), useOrganizations = createStateSourceHook({
|
|
1704
|
-
getState: getOrganizationsState,
|
|
1705
|
-
shouldSuspend: (instance, ...params) => getOrganizationsState(instance, ...params).getCurrent() === void 0,
|
|
1706
|
-
suspender: resolveOrganizations
|
|
1707
|
-
});
|
|
1746
|
+
const useInstallation = createFetcherHook(installation), useInstallations = createFetcherHook(installations), useOrganization = createFetcherHook(organization), useOrganizations = createFetcherHook(organizations);
|
|
1708
1747
|
function usePaginatedDocuments({
|
|
1709
1748
|
documentType,
|
|
1710
1749
|
filter: filter2 = "",
|
|
@@ -1837,7 +1876,7 @@ function useDocumentProjection(t0) {
|
|
|
1837
1876
|
threshold: 0
|
|
1838
1877
|
});
|
|
1839
1878
|
return ref?.current && ref.current instanceof HTMLElement ? intersectionObserver.observe(ref.current) : observer.next(!0), () => intersectionObserver.disconnect();
|
|
1840
|
-
}).pipe(startWith(!1), distinctUntilChanged(), switchMap((isVisible) => isVisible ? new Observable((obs) => (obs.next(), stateSource.subscribe(() => obs.next()))) : EMPTY)).subscribe({
|
|
1879
|
+
}).pipe(startWith(!1), distinctUntilChanged(), switchMap$1((isVisible) => isVisible ? new Observable((obs) => (obs.next(), stateSource.subscribe(() => obs.next()))) : EMPTY)).subscribe({
|
|
1841
1880
|
next: onStoreChanged
|
|
1842
1881
|
});
|
|
1843
1882
|
return () => subscription.unsubscribe();
|
|
@@ -1869,21 +1908,13 @@ function useDocumentPreview(t0) {
|
|
|
1869
1908
|
isPending: projectionResult.isPending
|
|
1870
1909
|
}, $[10] = previewValue, $[11] = projectionResult.isPending, $[12] = t3) : t3 = $[12], t3;
|
|
1871
1910
|
}
|
|
1872
|
-
const useProjectBase =
|
|
1873
|
-
getState: getProjectState,
|
|
1874
|
-
shouldSuspend: (instance, ...params) => getProjectState(instance, ...params).getCurrent() === void 0,
|
|
1875
|
-
suspender: resolveProject
|
|
1876
|
-
}), useProject = (options) => {
|
|
1911
|
+
const useProjectBase = createFetcherHook(project), useProject = (options) => {
|
|
1877
1912
|
const projectId = useResolvedProjectId(options);
|
|
1878
1913
|
return useProjectBase(projectId ? {
|
|
1879
1914
|
...options,
|
|
1880
1915
|
projectId
|
|
1881
1916
|
} : options);
|
|
1882
|
-
}, useProjects = createStateSourceHook({
|
|
1883
|
-
getState: getProjectsState,
|
|
1884
|
-
shouldSuspend: (instance, ...params) => getProjectsState(instance, ...params).getCurrent() === void 0,
|
|
1885
|
-
suspender: resolveProjects
|
|
1886
|
-
}), useActiveReleasesValue = createStateSourceHook({
|
|
1917
|
+
}, useProjects = createFetcherHook(projects), useActiveReleasesValue = createStateSourceHook({
|
|
1887
1918
|
getState: getActiveReleasesState,
|
|
1888
1919
|
shouldSuspend: (instance, options) => getActiveReleasesState(instance, options ?? {}).getCurrent() === void 0,
|
|
1889
1920
|
suspender: (instance, options) => firstValueFrom(getActiveReleasesState(instance, options ?? {}).observable.pipe(filter(Boolean)))
|
|
@@ -2015,7 +2046,7 @@ function useUsers(options) {
|
|
|
2015
2046
|
loadMore
|
|
2016
2047
|
}, $[20] = data, $[21] = hasMore, $[22] = isPending, $[23] = loadMore, $[24] = t8) : t8 = $[24], t8;
|
|
2017
2048
|
}
|
|
2018
|
-
var version = "
|
|
2049
|
+
var version = "3.0.0-rc.1";
|
|
2019
2050
|
function getEnv(key) {
|
|
2020
2051
|
if (typeof import.meta < "u" && import.meta.env)
|
|
2021
2052
|
return import.meta.env[key];
|
|
@@ -2043,17 +2074,22 @@ export {
|
|
|
2043
2074
|
useAgentTransform,
|
|
2044
2075
|
useAgentTranslate,
|
|
2045
2076
|
useAllReleases,
|
|
2077
|
+
useApplication,
|
|
2078
|
+
useApplications,
|
|
2046
2079
|
useApplyDocumentActions,
|
|
2047
2080
|
useApplyReleaseActions,
|
|
2048
2081
|
useAuthState,
|
|
2049
2082
|
useAuthToken,
|
|
2083
|
+
useCheckPermissions,
|
|
2050
2084
|
useClient,
|
|
2051
2085
|
useCreateDocument,
|
|
2086
|
+
useCreateUserApplication,
|
|
2052
2087
|
useCurrentUser,
|
|
2053
2088
|
useDashboardNavigate,
|
|
2054
2089
|
useDashboardOrganizationId,
|
|
2055
2090
|
useDatasets,
|
|
2056
|
-
|
|
2091
|
+
useDeleteApplication,
|
|
2092
|
+
useDeleteUserApplication,
|
|
2057
2093
|
useDocument,
|
|
2058
2094
|
useDocumentEvent,
|
|
2059
2095
|
useDocumentPermissions,
|
|
@@ -2064,6 +2100,8 @@ export {
|
|
|
2064
2100
|
useEditDocument,
|
|
2065
2101
|
useFrameConnection,
|
|
2066
2102
|
useHandleAuthCallback,
|
|
2103
|
+
useInstallation,
|
|
2104
|
+
useInstallations,
|
|
2067
2105
|
useLogOut,
|
|
2068
2106
|
useLoginUrl,
|
|
2069
2107
|
useManageFavorite,
|
|
@@ -2080,7 +2118,11 @@ export {
|
|
|
2080
2118
|
useResource,
|
|
2081
2119
|
useSanityInstance,
|
|
2082
2120
|
useStudioWorkspacesByProjectIdDataset,
|
|
2121
|
+
useUpdateApplication,
|
|
2122
|
+
useUpdateUserApplication,
|
|
2083
2123
|
useUser,
|
|
2124
|
+
useUserApplication,
|
|
2125
|
+
useUserApplications,
|
|
2084
2126
|
useUsers,
|
|
2085
2127
|
useVerifyOrgProjects,
|
|
2086
2128
|
useWindowConnection,
|