/** * Cache invalidation helpers * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ // ============================================================================ // Type-safe cache invalidation utilities // // Features: // - Simple invalidation helpers per entity // - Cascade invalidation for parent-child relationships // - Remove helpers for delete operations // ============================================================================ import type { QueryClient } from '@tanstack/react-query'; import { appLimitCapKeys, appLimitCapsDefaultKeys, appLimitKeys, appLimitCreditCodeKeys, appLimitCreditCodeItemKeys, appLimitCreditKeys, appLimitCreditRedemptionKeys, appLimitDefaultKeys, appLimitEventKeys, appLimitWarningKeys, orgLimitAggregateKeys, orgLimitCapKeys, orgLimitCapsDefaultKeys, orgLimitKeys, orgLimitCreditKeys, orgLimitDefaultKeys, orgLimitEventKeys, orgLimitWarningKeys, } from './query-keys'; /** // ============================================================================ // Invalidation Helpers // ============================================================================ * Type-safe query invalidation helpers * * @example * ```ts * // Invalidate all user queries * invalidate.user.all(queryClient); * * // Invalidate user lists * invalidate.user.lists(queryClient); * * // Invalidate specific user * invalidate.user.detail(queryClient, userId); * ``` */ export const invalidate = { /** Invalidate appLimitCap queries */ appLimitCap: { /** Invalidate all appLimitCap queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCapKeys.all, }), /** Invalidate appLimitCap list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCapKeys.lists(), }), /** Invalidate a specific appLimitCap */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitCapKeys.detail(id), }), }, /** Invalidate appLimitCapsDefault queries */ appLimitCapsDefault: { /** Invalidate all appLimitCapsDefault queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCapsDefaultKeys.all, }), /** Invalidate appLimitCapsDefault list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCapsDefaultKeys.lists(), }), /** Invalidate a specific appLimitCapsDefault */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitCapsDefaultKeys.detail(id), }), }, /** Invalidate appLimit queries */ appLimit: { /** Invalidate all appLimit queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitKeys.all, }), /** Invalidate appLimit list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitKeys.lists(), }), /** Invalidate a specific appLimit */ detail: (queryClient: QueryClient, id: string | number) => queryClient.invalidateQueries({ queryKey: appLimitKeys.detail(id), }), }, /** Invalidate appLimitCreditCode queries */ appLimitCreditCode: { /** Invalidate all appLimitCreditCode queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditCodeKeys.all, }), /** Invalidate appLimitCreditCode list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditCodeKeys.lists(), }), /** Invalidate a specific appLimitCreditCode */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitCreditCodeKeys.detail(id), }), }, /** Invalidate appLimitCreditCodeItem queries */ appLimitCreditCodeItem: { /** Invalidate all appLimitCreditCodeItem queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditCodeItemKeys.all, }), /** Invalidate appLimitCreditCodeItem list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditCodeItemKeys.lists(), }), /** Invalidate a specific appLimitCreditCodeItem */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitCreditCodeItemKeys.detail(id), }), }, /** Invalidate appLimitCredit queries */ appLimitCredit: { /** Invalidate all appLimitCredit queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditKeys.all, }), /** Invalidate appLimitCredit list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditKeys.lists(), }), /** Invalidate a specific appLimitCredit */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitCreditKeys.detail(id), }), }, /** Invalidate appLimitCreditRedemption queries */ appLimitCreditRedemption: { /** Invalidate all appLimitCreditRedemption queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditRedemptionKeys.all, }), /** Invalidate appLimitCreditRedemption list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitCreditRedemptionKeys.lists(), }), /** Invalidate a specific appLimitCreditRedemption */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitCreditRedemptionKeys.detail(id), }), }, /** Invalidate appLimitDefault queries */ appLimitDefault: { /** Invalidate all appLimitDefault queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitDefaultKeys.all, }), /** Invalidate appLimitDefault list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitDefaultKeys.lists(), }), /** Invalidate a specific appLimitDefault */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitDefaultKeys.detail(id), }), }, /** Invalidate appLimitEvent queries */ appLimitEvent: { /** Invalidate all appLimitEvent queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitEventKeys.all, }), /** Invalidate appLimitEvent list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitEventKeys.lists(), }), /** Invalidate a specific appLimitEvent */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitEventKeys.detail(id), }), }, /** Invalidate appLimitWarning queries */ appLimitWarning: { /** Invalidate all appLimitWarning queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitWarningKeys.all, }), /** Invalidate appLimitWarning list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: appLimitWarningKeys.lists(), }), /** Invalidate a specific appLimitWarning */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: appLimitWarningKeys.detail(id), }), }, /** Invalidate orgLimitAggregate queries */ orgLimitAggregate: { /** Invalidate all orgLimitAggregate queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitAggregateKeys.all, }), /** Invalidate orgLimitAggregate list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitAggregateKeys.lists(), }), /** Invalidate a specific orgLimitAggregate */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: orgLimitAggregateKeys.detail(id), }), }, /** Invalidate orgLimitCap queries */ orgLimitCap: { /** Invalidate all orgLimitCap queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitCapKeys.all, }), /** Invalidate orgLimitCap list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitCapKeys.lists(), }), /** Invalidate a specific orgLimitCap */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: orgLimitCapKeys.detail(id), }), }, /** Invalidate orgLimitCapsDefault queries */ orgLimitCapsDefault: { /** Invalidate all orgLimitCapsDefault queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitCapsDefaultKeys.all, }), /** Invalidate orgLimitCapsDefault list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitCapsDefaultKeys.lists(), }), /** Invalidate a specific orgLimitCapsDefault */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: orgLimitCapsDefaultKeys.detail(id), }), }, /** Invalidate orgLimit queries */ orgLimit: { /** Invalidate all orgLimit queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitKeys.all, }), /** Invalidate orgLimit list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitKeys.lists(), }), /** Invalidate a specific orgLimit */ detail: (queryClient: QueryClient, id: string | number) => queryClient.invalidateQueries({ queryKey: orgLimitKeys.detail(id), }), }, /** Invalidate orgLimitCredit queries */ orgLimitCredit: { /** Invalidate all orgLimitCredit queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitCreditKeys.all, }), /** Invalidate orgLimitCredit list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitCreditKeys.lists(), }), /** Invalidate a specific orgLimitCredit */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: orgLimitCreditKeys.detail(id), }), }, /** Invalidate orgLimitDefault queries */ orgLimitDefault: { /** Invalidate all orgLimitDefault queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitDefaultKeys.all, }), /** Invalidate orgLimitDefault list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitDefaultKeys.lists(), }), /** Invalidate a specific orgLimitDefault */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: orgLimitDefaultKeys.detail(id), }), }, /** Invalidate orgLimitEvent queries */ orgLimitEvent: { /** Invalidate all orgLimitEvent queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitEventKeys.all, }), /** Invalidate orgLimitEvent list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitEventKeys.lists(), }), /** Invalidate a specific orgLimitEvent */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: orgLimitEventKeys.detail(id), }), }, /** Invalidate orgLimitWarning queries */ orgLimitWarning: { /** Invalidate all orgLimitWarning queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitWarningKeys.all, }), /** Invalidate orgLimitWarning list queries */ lists: (queryClient: QueryClient) => queryClient.invalidateQueries({ queryKey: orgLimitWarningKeys.lists(), }), /** Invalidate a specific orgLimitWarning */ detail: ( queryClient: QueryClient, id: string | number ) => queryClient.invalidateQueries({ queryKey: orgLimitWarningKeys.detail(id), }), }, } as const; /** // ============================================================================ // Remove Helpers (for delete operations) // ============================================================================ * Remove queries from cache (for delete operations) * * Use these when an entity is deleted to remove it from cache * instead of just invalidating (which would trigger a refetch). */ export const remove = { /** Remove appLimitCap from cache */ appLimitCap: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitCapKeys.detail(id), }); }, /** Remove appLimitCapsDefault from cache */ appLimitCapsDefault: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitCapsDefaultKeys.detail(id), }); }, /** Remove appLimit from cache */ appLimit: (queryClient: QueryClient, id: string | number) => { queryClient.removeQueries({ queryKey: appLimitKeys.detail(id), }); }, /** Remove appLimitCreditCode from cache */ appLimitCreditCode: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitCreditCodeKeys.detail(id), }); }, /** Remove appLimitCreditCodeItem from cache */ appLimitCreditCodeItem: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitCreditCodeItemKeys.detail(id), }); }, /** Remove appLimitCredit from cache */ appLimitCredit: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitCreditKeys.detail(id), }); }, /** Remove appLimitCreditRedemption from cache */ appLimitCreditRedemption: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitCreditRedemptionKeys.detail(id), }); }, /** Remove appLimitDefault from cache */ appLimitDefault: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitDefaultKeys.detail(id), }); }, /** Remove appLimitEvent from cache */ appLimitEvent: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitEventKeys.detail(id), }); }, /** Remove appLimitWarning from cache */ appLimitWarning: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: appLimitWarningKeys.detail(id), }); }, /** Remove orgLimitAggregate from cache */ orgLimitAggregate: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: orgLimitAggregateKeys.detail(id), }); }, /** Remove orgLimitCap from cache */ orgLimitCap: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: orgLimitCapKeys.detail(id), }); }, /** Remove orgLimitCapsDefault from cache */ orgLimitCapsDefault: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: orgLimitCapsDefaultKeys.detail(id), }); }, /** Remove orgLimit from cache */ orgLimit: (queryClient: QueryClient, id: string | number) => { queryClient.removeQueries({ queryKey: orgLimitKeys.detail(id), }); }, /** Remove orgLimitCredit from cache */ orgLimitCredit: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: orgLimitCreditKeys.detail(id), }); }, /** Remove orgLimitDefault from cache */ orgLimitDefault: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: orgLimitDefaultKeys.detail(id), }); }, /** Remove orgLimitEvent from cache */ orgLimitEvent: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: orgLimitEventKeys.detail(id), }); }, /** Remove orgLimitWarning from cache */ orgLimitWarning: ( queryClient: QueryClient, id: string | number ) => { queryClient.removeQueries({ queryKey: orgLimitWarningKeys.detail(id), }); }, } as const;