UNPKG

@sample-stack/counter-module-browser

Version:

Sample core for higher packages to depend on

461 lines 22.8 kB
import { GraphQLResolveInfo } from 'graphql'; import { DocumentNode } from 'graphql'; import * as Apollo from '@apollo/client/index.js'; export type Maybe<T> = T | null; export type InputMaybe<T> = Maybe<T>; export type Exact<T extends { [key: string]: unknown; }> = { [K in keyof T]: T[K]; }; export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]>; }; export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]>; }; export type MakeEmpty<T extends { [key: string]: unknown; }, K extends keyof T> = { [_ in K]?: never; }; export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never; }; export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]>; }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: { input: string; output: string; }; String: { input: string; output: string; }; Boolean: { input: boolean; output: boolean; }; Int: { input: number; output: number; }; Float: { input: number; output: number; }; }; export type ClientCounter = { __typename?: 'ClientCounter'; counter?: Maybe<Scalars['Int']['output']>; }; /** Database counter */ export type Counter = { __typename?: 'Counter'; /** Current amount */ amount: Scalars['Int']['output']; }; export type Mutation = { __typename?: 'Mutation'; /** Increase counter value returns current counter amount */ addCounter?: Maybe<Counter>; addCounterState?: Maybe<ClientCounter>; /** add Counter */ addMoleculerCounter?: Maybe<Counter>; /** sync cached counter with current value */ syncCachedCounter?: Maybe<Scalars['Boolean']['output']>; }; export type MutationAddCounterArgs = { amount?: InputMaybe<Scalars['Int']['input']>; }; export type MutationAddCounterStateArgs = { amount: Scalars['Int']['input']; }; export type MutationAddMoleculerCounterArgs = { amount?: InputMaybe<Scalars['Int']['input']>; }; export type Query = { __typename?: 'Query'; /** Counter */ counter?: Maybe<Counter>; /** Counter from Datasource */ counterCache?: Maybe<Counter>; counterState?: Maybe<ClientCounter>; /** Moleculer Counter */ moleculerCounter?: Maybe<Counter>; }; export type Subscription = { __typename?: 'Subscription'; /** Subscription fired when anyone increases counter */ counterUpdated?: Maybe<Counter>; moleculerCounterUpdate?: Maybe<Counter>; }; export type AddCounterStateMutationVariables = Exact<{ amount: Scalars['Int']['input']; }>; export type AddCounterStateMutation = { __typename?: 'Mutation'; addCounterState?: { __typename?: 'ClientCounter'; counter?: number | null; } | null; }; export type AddCounterMutationVariables = Exact<{ amount: Scalars['Int']['input']; }>; export type AddCounterMutation = { __typename?: 'Mutation'; addCounter?: { __typename?: 'Counter'; amount: number; } | null; }; export type AddCounter_WsMutationVariables = Exact<{ amount: Scalars['Int']['input']; }>; export type AddCounter_WsMutation = { __typename?: 'Mutation'; addCounter?: { __typename?: 'Counter'; amount: number; } | null; }; export type SyncCachedCounterMutationVariables = Exact<{ [key: string]: never; }>; export type SyncCachedCounterMutation = { __typename?: 'Mutation'; syncCachedCounter?: boolean | null; }; export type CounterCacheQueryQueryVariables = Exact<{ [key: string]: never; }>; export type CounterCacheQueryQuery = { __typename?: 'Query'; counterCache?: { __typename?: 'Counter'; amount: number; } | null; }; export type CounterStateQueryVariables = Exact<{ [key: string]: never; }>; export type CounterStateQuery = { __typename?: 'Query'; counterState?: { __typename?: 'ClientCounter'; counter?: number | null; } | null; }; export type CounterQueryQueryVariables = Exact<{ [key: string]: never; }>; export type CounterQueryQuery = { __typename?: 'Query'; counter?: { __typename?: 'Counter'; amount: number; } | null; }; export type OnCounterUpdatedSubscriptionVariables = Exact<{ [key: string]: never; }>; export type OnCounterUpdatedSubscription = { __typename?: 'Subscription'; counterUpdated?: { __typename?: 'Counter'; amount: number; } | null; }; export type ResolverTypeWrapper<T> = Promise<T> | T; export type ResolverWithResolve<TResult, TParent, TContext, TArgs> = { resolve: ResolverFn<TResult, TParent, TContext, TArgs>; }; export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>; export type ResolverFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => Promise<TResult> | TResult; export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>; export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult | Promise<TResult>; export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> { subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult; }, TParent, TContext, TArgs>; resolve?: SubscriptionResolveFn<TResult, { [key in TKey]: TResult; }, TContext, TArgs>; } export interface SubscriptionResolverObject<TResult, TParent, TContext, TArgs> { subscribe: SubscriptionSubscribeFn<any, TParent, TContext, TArgs>; resolve: SubscriptionResolveFn<TResult, any, TContext, TArgs>; } export type SubscriptionObject<TResult, TKey extends string, TParent, TContext, TArgs> = SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs> | SubscriptionResolverObject<TResult, TParent, TContext, TArgs>; export type SubscriptionResolver<TResult, TKey extends string, TParent = {}, TContext = {}, TArgs = {}> = ((...args: any[]) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>) | SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>; export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = (parent: TParent, context: TContext, info: GraphQLResolveInfo) => Maybe<TTypes> | Promise<Maybe<TTypes>>; export type IsTypeOfResolverFn<T = {}, TContext = {}> = (obj: T, context: TContext, info: GraphQLResolveInfo) => boolean | Promise<boolean>; export type NextResolverFn<T> = () => Promise<T>; export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs = {}> = (next: NextResolverFn<TResult>, parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult | Promise<TResult>; /** Mapping between all available schema types and the resolvers types */ export type ResolversTypes = { Boolean: ResolverTypeWrapper<Scalars['Boolean']['output']>; ClientCounter: ResolverTypeWrapper<ClientCounter>; Counter: ResolverTypeWrapper<Counter>; Int: ResolverTypeWrapper<Scalars['Int']['output']>; Mutation: ResolverTypeWrapper<{}>; Query: ResolverTypeWrapper<{}>; String: ResolverTypeWrapper<Scalars['String']['output']>; Subscription: ResolverTypeWrapper<{}>; }; /** Mapping between all available schema types and the resolvers parents */ export type ResolversParentTypes = { Boolean: Scalars['Boolean']['output']; ClientCounter: ClientCounter; Counter: Counter; Int: Scalars['Int']['output']; Mutation: {}; Query: {}; String: Scalars['String']['output']; Subscription: {}; }; export type ClientCounterResolvers<ContextType = any, ParentType extends ResolversParentTypes['ClientCounter'] = ResolversParentTypes['ClientCounter']> = { counter?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>; }; export type CounterResolvers<ContextType = any, ParentType extends ResolversParentTypes['Counter'] = ResolversParentTypes['Counter']> = { amount?: Resolver<ResolversTypes['Int'], ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>; }; export type MutationResolvers<ContextType = any, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = { addCounter?: Resolver<Maybe<ResolversTypes['Counter']>, ParentType, ContextType, Partial<MutationAddCounterArgs>>; addCounterState?: Resolver<Maybe<ResolversTypes['ClientCounter']>, ParentType, ContextType, RequireFields<MutationAddCounterStateArgs, 'amount'>>; addMoleculerCounter?: Resolver<Maybe<ResolversTypes['Counter']>, ParentType, ContextType, Partial<MutationAddMoleculerCounterArgs>>; syncCachedCounter?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>; }; export type QueryResolvers<ContextType = any, ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']> = { counter?: Resolver<Maybe<ResolversTypes['Counter']>, ParentType, ContextType>; counterCache?: Resolver<Maybe<ResolversTypes['Counter']>, ParentType, ContextType>; counterState?: Resolver<Maybe<ResolversTypes['ClientCounter']>, ParentType, ContextType>; moleculerCounter?: Resolver<Maybe<ResolversTypes['Counter']>, ParentType, ContextType>; }; export type SubscriptionResolvers<ContextType = any, ParentType extends ResolversParentTypes['Subscription'] = ResolversParentTypes['Subscription']> = { counterUpdated?: SubscriptionResolver<Maybe<ResolversTypes['Counter']>, "counterUpdated", ParentType, ContextType>; moleculerCounterUpdate?: SubscriptionResolver<Maybe<ResolversTypes['Counter']>, "moleculerCounterUpdate", ParentType, ContextType>; }; export type Resolvers<ContextType = any> = { ClientCounter?: ClientCounterResolvers<ContextType>; Counter?: CounterResolvers<ContextType>; Mutation?: MutationResolvers<ContextType>; Query?: QueryResolvers<ContextType>; Subscription?: SubscriptionResolvers<ContextType>; }; export declare const AddCounterStateDocument: DocumentNode; /** * __useAddCounterStateMutation__ * * To run a mutation, you first call `useAddCounterStateMutation` within a React component and pass it any options that fit your needs. * When your component renders, `useAddCounterStateMutation` returns a tuple that includes: * - A mutate function that you can call at any time to execute the mutation * - An object with fields that represent the current status of the mutation's execution * * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; * * @example * const [addCounterStateMutation, { data, loading, error }] = useAddCounterStateMutation({ * variables: { * amount: // value for 'amount' * }, * }); */ export declare function useAddCounterStateMutation(baseOptions?: Apollo.MutationHookOptions<AddCounterStateMutation, AddCounterStateMutationVariables>): Apollo.MutationTuple<AddCounterStateMutation, Exact<{ amount: Scalars["Int"]["input"]; }>, Apollo.DefaultContext, Apollo.ApolloCache<any>>; export type AddCounterStateMutationHookResult = ReturnType<typeof useAddCounterStateMutation>; export type AddCounterStateMutationResult = Apollo.MutationResult<AddCounterStateMutation>; export type AddCounterStateMutationOptions = Apollo.BaseMutationOptions<AddCounterStateMutation, AddCounterStateMutationVariables>; export declare const AddCounterDocument: DocumentNode; /** * __useAddCounterMutation__ * * To run a mutation, you first call `useAddCounterMutation` within a React component and pass it any options that fit your needs. * When your component renders, `useAddCounterMutation` returns a tuple that includes: * - A mutate function that you can call at any time to execute the mutation * - An object with fields that represent the current status of the mutation's execution * * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; * * @example * const [addCounterMutation, { data, loading, error }] = useAddCounterMutation({ * variables: { * amount: // value for 'amount' * }, * }); */ export declare function useAddCounterMutation(baseOptions?: Apollo.MutationHookOptions<AddCounterMutation, AddCounterMutationVariables>): Apollo.MutationTuple<AddCounterMutation, Exact<{ amount: Scalars["Int"]["input"]; }>, Apollo.DefaultContext, Apollo.ApolloCache<any>>; export type AddCounterMutationHookResult = ReturnType<typeof useAddCounterMutation>; export type AddCounterMutationResult = Apollo.MutationResult<AddCounterMutation>; export type AddCounterMutationOptions = Apollo.BaseMutationOptions<AddCounterMutation, AddCounterMutationVariables>; export declare const AddCounter_WsDocument: DocumentNode; /** * __useAddCounter_WsMutation__ * * To run a mutation, you first call `useAddCounter_WsMutation` within a React component and pass it any options that fit your needs. * When your component renders, `useAddCounter_WsMutation` returns a tuple that includes: * - A mutate function that you can call at any time to execute the mutation * - An object with fields that represent the current status of the mutation's execution * * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; * * @example * const [addCounterWsMutation, { data, loading, error }] = useAddCounter_WsMutation({ * variables: { * amount: // value for 'amount' * }, * }); */ export declare function useAddCounter_WsMutation(baseOptions?: Apollo.MutationHookOptions<AddCounter_WsMutation, AddCounter_WsMutationVariables>): Apollo.MutationTuple<AddCounter_WsMutation, Exact<{ amount: Scalars["Int"]["input"]; }>, Apollo.DefaultContext, Apollo.ApolloCache<any>>; export type AddCounter_WsMutationHookResult = ReturnType<typeof useAddCounter_WsMutation>; export type AddCounter_WsMutationResult = Apollo.MutationResult<AddCounter_WsMutation>; export type AddCounter_WsMutationOptions = Apollo.BaseMutationOptions<AddCounter_WsMutation, AddCounter_WsMutationVariables>; export declare const SyncCachedCounterDocument: DocumentNode; /** * __useSyncCachedCounterMutation__ * * To run a mutation, you first call `useSyncCachedCounterMutation` within a React component and pass it any options that fit your needs. * When your component renders, `useSyncCachedCounterMutation` returns a tuple that includes: * - A mutate function that you can call at any time to execute the mutation * - An object with fields that represent the current status of the mutation's execution * * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; * * @example * const [syncCachedCounterMutation, { data, loading, error }] = useSyncCachedCounterMutation({ * variables: { * }, * }); */ export declare function useSyncCachedCounterMutation(baseOptions?: Apollo.MutationHookOptions<SyncCachedCounterMutation, SyncCachedCounterMutationVariables>): Apollo.MutationTuple<SyncCachedCounterMutation, Exact<{ [key: string]: never; }>, Apollo.DefaultContext, Apollo.ApolloCache<any>>; export type SyncCachedCounterMutationHookResult = ReturnType<typeof useSyncCachedCounterMutation>; export type SyncCachedCounterMutationResult = Apollo.MutationResult<SyncCachedCounterMutation>; export type SyncCachedCounterMutationOptions = Apollo.BaseMutationOptions<SyncCachedCounterMutation, SyncCachedCounterMutationVariables>; export declare const CounterCacheQueryDocument: DocumentNode; /** * __useCounterCacheQueryQuery__ * * To run a query within a React component, call `useCounterCacheQueryQuery` and pass it any options that fit your needs. * When your component renders, `useCounterCacheQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example * const { data, loading, error } = useCounterCacheQueryQuery({ * variables: { * }, * }); */ export declare function useCounterCacheQueryQuery(baseOptions?: Apollo.QueryHookOptions<CounterCacheQueryQuery, CounterCacheQueryQueryVariables>): Apollo.QueryResult<CounterCacheQueryQuery, Exact<{ [key: string]: never; }>>; export declare function useCounterCacheQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<CounterCacheQueryQuery, CounterCacheQueryQueryVariables>): Apollo.LazyQueryResultTuple<CounterCacheQueryQuery, Exact<{ [key: string]: never; }>>; export declare function useCounterCacheQuerySuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<CounterCacheQueryQuery, CounterCacheQueryQueryVariables>): Apollo.UseSuspenseQueryResult<CounterCacheQueryQuery, Exact<{ [key: string]: never; }>>; export type CounterCacheQueryQueryHookResult = ReturnType<typeof useCounterCacheQueryQuery>; export type CounterCacheQueryLazyQueryHookResult = ReturnType<typeof useCounterCacheQueryLazyQuery>; export type CounterCacheQuerySuspenseQueryHookResult = ReturnType<typeof useCounterCacheQuerySuspenseQuery>; export type CounterCacheQueryQueryResult = Apollo.QueryResult<CounterCacheQueryQuery, CounterCacheQueryQueryVariables>; export declare const CounterStateDocument: DocumentNode; /** * __useCounterStateQuery__ * * To run a query within a React component, call `useCounterStateQuery` and pass it any options that fit your needs. * When your component renders, `useCounterStateQuery` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example * const { data, loading, error } = useCounterStateQuery({ * variables: { * }, * }); */ export declare function useCounterStateQuery(baseOptions?: Apollo.QueryHookOptions<CounterStateQuery, CounterStateQueryVariables>): Apollo.QueryResult<CounterStateQuery, Exact<{ [key: string]: never; }>>; export declare function useCounterStateLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<CounterStateQuery, CounterStateQueryVariables>): Apollo.LazyQueryResultTuple<CounterStateQuery, Exact<{ [key: string]: never; }>>; export declare function useCounterStateSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<CounterStateQuery, CounterStateQueryVariables>): Apollo.UseSuspenseQueryResult<CounterStateQuery, Exact<{ [key: string]: never; }>>; export type CounterStateQueryHookResult = ReturnType<typeof useCounterStateQuery>; export type CounterStateLazyQueryHookResult = ReturnType<typeof useCounterStateLazyQuery>; export type CounterStateSuspenseQueryHookResult = ReturnType<typeof useCounterStateSuspenseQuery>; export type CounterStateQueryResult = Apollo.QueryResult<CounterStateQuery, CounterStateQueryVariables>; export declare const CounterQueryDocument: DocumentNode; /** * __useCounterQueryQuery__ * * To run a query within a React component, call `useCounterQueryQuery` and pass it any options that fit your needs. * When your component renders, `useCounterQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example * const { data, loading, error } = useCounterQueryQuery({ * variables: { * }, * }); */ export declare function useCounterQueryQuery(baseOptions?: Apollo.QueryHookOptions<CounterQueryQuery, CounterQueryQueryVariables>): Apollo.QueryResult<CounterQueryQuery, Exact<{ [key: string]: never; }>>; export declare function useCounterQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<CounterQueryQuery, CounterQueryQueryVariables>): Apollo.LazyQueryResultTuple<CounterQueryQuery, Exact<{ [key: string]: never; }>>; export declare function useCounterQuerySuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<CounterQueryQuery, CounterQueryQueryVariables>): Apollo.UseSuspenseQueryResult<CounterQueryQuery, Exact<{ [key: string]: never; }>>; export type CounterQueryQueryHookResult = ReturnType<typeof useCounterQueryQuery>; export type CounterQueryLazyQueryHookResult = ReturnType<typeof useCounterQueryLazyQuery>; export type CounterQuerySuspenseQueryHookResult = ReturnType<typeof useCounterQuerySuspenseQuery>; export type CounterQueryQueryResult = Apollo.QueryResult<CounterQueryQuery, CounterQueryQueryVariables>; export declare const OnCounterUpdatedDocument: DocumentNode; /** * __useOnCounterUpdatedSubscription__ * * To run a query within a React component, call `useOnCounterUpdatedSubscription` and pass it any options that fit your needs. * When your component renders, `useOnCounterUpdatedSubscription` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example * const { data, loading, error } = useOnCounterUpdatedSubscription({ * variables: { * }, * }); */ export declare function useOnCounterUpdatedSubscription(baseOptions?: Apollo.SubscriptionHookOptions<OnCounterUpdatedSubscription, OnCounterUpdatedSubscriptionVariables>): { restart(): void; loading: boolean; data?: OnCounterUpdatedSubscription; error?: Apollo.ApolloError; variables?: Exact<{ [key: string]: never; }>; }; export type OnCounterUpdatedSubscriptionHookResult = ReturnType<typeof useOnCounterUpdatedSubscription>; export type OnCounterUpdatedSubscriptionResult = Apollo.SubscriptionResult<OnCounterUpdatedSubscription>; //# sourceMappingURL=generated-models.d.ts.map