diff --git a/build/api/react-client-tenant.api.md b/build/api/react-client-tenant.api.md index b4848c62a..32a18a4b2 100644 --- a/build/api/react-client-tenant.api.md +++ b/build/api/react-client-tenant.api.md @@ -4,7 +4,7 @@ ```ts -import type { Fetcher } from 'graphql-ts-client-api'; +import { Fetcher } from 'graphql-ts-client-api'; import { ModelType } from 'graphql-ts-client-api'; export { ModelType } @@ -16,9 +16,6 @@ export const useTenantApi: () => Promise; - -export * from "@contember/graphql-client-tenant"; - // (No @packageDocumentation comment for this package) ``` diff --git a/packages/playground/admin/lib/components/dev/login-panel.tsx b/packages/playground/admin/lib/components/dev/login-panel.tsx index 4a8aee899..878df950e 100644 --- a/packages/playground/admin/lib/components/dev/login-panel.tsx +++ b/packages/playground/admin/lib/components/dev/login-panel.tsx @@ -4,7 +4,8 @@ import { FieldContainer } from '../form' import { Input } from '../ui/input' import { Button } from '../ui/button' import { useSessionTokenWithMeta, useSetSessionToken } from '@contember/react-client' -import * as TenantApi from '@contember/react-client-tenant' +import * as TenantApi from '@contember/graphql-client-tenant' +import { useTenantApi } from '@contember/react-client-tenant' export const LoginWithEmail = () => { const [email, setEmail] = useState('') @@ -12,7 +13,7 @@ export const LoginWithEmail = () => { const addToast = useShowToast() const [isSubmitting, setSubmitting] = useState(false) const setSessionToken = useSetSessionToken() - const api = TenantApi.useTenantApi() + const api = useTenantApi() const submit = useCallback(async (e: SyntheticEvent) => { e.preventDefault() diff --git a/packages/playground/admin/lib/hooks/useInvite.ts b/packages/playground/admin/lib/hooks/useInvite.ts index 443f13263..f95a47891 100644 --- a/packages/playground/admin/lib/hooks/useInvite.ts +++ b/packages/playground/admin/lib/hooks/useInvite.ts @@ -1,4 +1,5 @@ -import * as TenantApi from '@contember/react-client-tenant' +import * as TenantApi from '@contember/graphql-client-tenant' +import { useTenantApi } from '@contember/react-client-tenant' import { useCallback } from 'react' const InviteFetcher = TenantApi.inviteResponse$$ @@ -8,7 +9,7 @@ const InviteFetcher = TenantApi.inviteResponse$$ export type InviteErrorCodes = TenantApi.InviteErrorCode export const useInvite = () => { - const api = TenantApi.useTenantApi() + const api = useTenantApi() return useCallback(async (variables: { email: string, diff --git a/packages/playground/admin/lib/hooks/useInviteUser.tsx b/packages/playground/admin/lib/hooks/useInviteUser.tsx index bcc2b33a1..85aee7de0 100644 --- a/packages/playground/admin/lib/hooks/useInviteUser.tsx +++ b/packages/playground/admin/lib/hooks/useInviteUser.tsx @@ -4,7 +4,7 @@ import { useInvite } from './useInvite' import { ToastContent, useShowToast } from '../components/ui/toast' import { useProjectSlug } from '@contember/react-client' import { EntityAccessor } from '@contember/interface' -import * as TenantApi from '@contember/react-client-tenant' +import * as TenantApi from '@contember/graphql-client-tenant' import { useReferentiallyStableCallback } from '@contember/react-utils' import { dict } from '../dict' diff --git a/packages/react-client-tenant/package.json b/packages/react-client-tenant/package.json index 4a69ced92..0520155c0 100644 --- a/packages/react-client-tenant/package.json +++ b/packages/react-client-tenant/package.json @@ -40,7 +40,6 @@ "directory": "packages/react-client-tenant" }, "dependencies": { - "@contember/graphql-client-tenant": "^1.3.6", "@contember/react-client": "workspace:*", "graphql-ts-client-api": "^3.1.17" }, diff --git a/packages/react-client-tenant/src/index.ts b/packages/react-client-tenant/src/index.ts index 5597ba19c..a9da8fe99 100644 --- a/packages/react-client-tenant/src/index.ts +++ b/packages/react-client-tenant/src/index.ts @@ -1,4 +1,3 @@ export * from './hooks' export type { ModelType } from 'graphql-ts-client-api' -export * from '@contember/graphql-client-tenant' diff --git a/packages/react-identity/package.json b/packages/react-identity/package.json index 6b46376a2..16602c7ae 100644 --- a/packages/react-identity/package.json +++ b/packages/react-identity/package.json @@ -40,6 +40,7 @@ "directory": "packages/react-identity" }, "dependencies": { + "@contember/graphql-client-tenant": "^1.3.6", "@contember/react-binding": "workspace:*", "@contember/react-client": "workspace:*", "@contember/react-client-tenant": "workspace:*", diff --git a/packages/react-identity/src/internal/hooks/useFetchMe.ts b/packages/react-identity/src/internal/hooks/useFetchMe.ts index 38c942dfd..5070e7912 100644 --- a/packages/react-identity/src/internal/hooks/useFetchMe.ts +++ b/packages/react-identity/src/internal/hooks/useFetchMe.ts @@ -1,4 +1,5 @@ -import * as TenantApi from '@contember/react-client-tenant' +import * as TenantApi from '@contember/graphql-client-tenant' +import { ModelType, useTenantApi } from '@contember/react-client-tenant' import { useCallback } from 'react' const identityFragment = TenantApi @@ -11,10 +12,10 @@ const identityFragment = TenantApi ) .permissions(TenantApi.identityGlobalPermissions$$) -export type FetchedIdentity = TenantApi.ModelType +export type FetchedIdentity = ModelType export const useFetchMe = () => { - const executor = TenantApi.useTenantApi() + const executor = useTenantApi() return useCallback(async () => { return (await executor(TenantApi.query$.me(identityFragment))).me }, [executor]) diff --git a/packages/react-identity/src/internal/hooks/useSignOut.ts b/packages/react-identity/src/internal/hooks/useSignOut.ts index 694560096..e065cf82e 100644 --- a/packages/react-identity/src/internal/hooks/useSignOut.ts +++ b/packages/react-identity/src/internal/hooks/useSignOut.ts @@ -1,12 +1,13 @@ -import * as TenantApi from '@contember/react-client-tenant' +import * as TenantApi from '@contember/graphql-client-tenant' +import { ModelType, useTenantApi } from '@contember/react-client-tenant' import { useCallback } from 'react' const signOutFragment = TenantApi.signOutResponse$$.error(TenantApi.signOutError$$) -export type SignOutResult = TenantApi.ModelType +export type SignOutResult = ModelType export const useSignOut = () => { - const api = TenantApi.useTenantApi() + const api = useTenantApi() return useCallback(async () => { return (await api(TenantApi.mutation$.signOut(signOutFragment))).signOut }, [api]) diff --git a/yarn.lock b/yarn.lock index ee6388c2e..b8e8e0732 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1463,7 +1463,6 @@ __metadata: version: 0.0.0-use.local resolution: "@contember/react-client-tenant@workspace:packages/react-client-tenant" dependencies: - "@contember/graphql-client-tenant": ^1.3.6 "@contember/react-client": "workspace:*" graphql-ts-client-api: ^3.1.17 react: ^18.2.0 @@ -1614,6 +1613,7 @@ __metadata: version: 0.0.0-use.local resolution: "@contember/react-identity@workspace:packages/react-identity" dependencies: + "@contember/graphql-client-tenant": ^1.3.6 "@contember/react-binding": "workspace:*" "@contember/react-client": "workspace:*" "@contember/react-client-tenant": "workspace:*"