/** * Entity-aware config row for the identity_providers_module, which provisions a per-database identity_providers table holding OAuth2 / OIDC (and future SAML) provider definitions. The scope column determines which internal_secrets_module table the rotate proc targets (app_secrets for app scope, platform_secrets for platform scope). When scope = database, the secrets table gets a database_id column. Scoping matrix: scope=app → per-database flat, in-app admin manages scope=platform → platform-wide, platform admin manages (generate:constructive) scope=database → per-database infra, carries database_id * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { useQuery } from '@tanstack/react-query'; import type { UseQueryOptions, UseQueryResult, QueryClient } from '@tanstack/react-query'; import { getClient } from '../client'; import { buildSelectionArgs } from '../selection'; import type { SelectionConfig } from '../selection'; import { identityProvidersModuleKeys } from '../query-keys'; import type { IdentityProvidersModuleSelect, IdentityProvidersModuleWithRelations, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { IdentityProvidersModuleSelect, IdentityProvidersModuleWithRelations, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const identityProvidersModuleQueryKey = identityProvidersModuleKeys.detail; /** * Entity-aware config row for the identity_providers_module, which provisions a per-database identity_providers table holding OAuth2 / OIDC (and future SAML) provider definitions. The scope column determines which internal_secrets_module table the rotate proc targets (app_secrets for app scope, platform_secrets for platform scope). When scope = database, the secrets table gets a database_id column. Scoping matrix: scope=app → per-database flat, in-app admin manages scope=platform → platform-wide, platform admin manages (generate:constructive) scope=database → per-database infra, carries database_id * * @example * ```tsx * const { data, isLoading } = useIdentityProvidersModuleQuery({ * id: 'some-id', * selection: { fields: { id: true, name: true } }, * }); * ``` */ export function useIdentityProvidersModuleQuery< S extends IdentityProvidersModuleSelect, TData = { identityProvidersModule: InferSelectResult | null; }, >( params: { id: string; selection: { fields: S; } & HookStrictSelect, IdentityProvidersModuleSelect>; } & Omit< UseQueryOptions< { identityProvidersModule: InferSelectResult | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useIdentityProvidersModuleQuery( params: { id: string; selection: SelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: identityProvidersModuleKeys.detail(params.id), queryFn: () => getClient() .identityProvidersModule.findOne({ id: params.id, select: args.select, }) .unwrap(), ...queryOptions, }); } /** * Entity-aware config row for the identity_providers_module, which provisions a per-database identity_providers table holding OAuth2 / OIDC (and future SAML) provider definitions. The scope column determines which internal_secrets_module table the rotate proc targets (app_secrets for app scope, platform_secrets for platform scope). When scope = database, the secrets table gets a database_id column. Scoping matrix: scope=app → per-database flat, in-app admin manages scope=platform → platform-wide, platform admin manages (generate:constructive) scope=database → per-database infra, carries database_id * * @example * ```ts * const data = await fetchIdentityProvidersModuleQuery({ * id: 'some-id', * selection: { fields: { id: true } }, * }); * ``` */ export async function fetchIdentityProvidersModuleQuery< S extends IdentityProvidersModuleSelect, >(params: { id: string; selection: { fields: S; } & HookStrictSelect, IdentityProvidersModuleSelect>; }): Promise<{ identityProvidersModule: InferSelectResult | null; }>; export async function fetchIdentityProvidersModuleQuery(params: { id: string; selection: SelectionConfig; }): Promise { const args = buildSelectionArgs(params.selection); return getClient() .identityProvidersModule.findOne({ id: params.id, select: args.select, }) .unwrap(); } /** * Entity-aware config row for the identity_providers_module, which provisions a per-database identity_providers table holding OAuth2 / OIDC (and future SAML) provider definitions. The scope column determines which internal_secrets_module table the rotate proc targets (app_secrets for app scope, platform_secrets for platform scope). When scope = database, the secrets table gets a database_id column. Scoping matrix: scope=app → per-database flat, in-app admin manages scope=platform → platform-wide, platform admin manages (generate:constructive) scope=database → per-database infra, carries database_id * * @example * ```ts * await prefetchIdentityProvidersModuleQuery(queryClient, { id: 'some-id', selection: { fields: { id: true } } }); * ``` */ export async function prefetchIdentityProvidersModuleQuery( queryClient: QueryClient, params: { id: string; selection: { fields: S; } & HookStrictSelect, IdentityProvidersModuleSelect>; } ): Promise; export async function prefetchIdentityProvidersModuleQuery( queryClient: QueryClient, params: { id: string; selection: SelectionConfig; } ): Promise { const args = buildSelectionArgs(params.selection); await queryClient.prefetchQuery({ queryKey: identityProvidersModuleKeys.detail(params.id), queryFn: () => getClient() .identityProvidersModule.findOne({ id: params.id, select: args.select, }) .unwrap(), }); }