Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/graphql ws #233

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
},
"dependencies": {
"dataloader": "^2.0.0",
"graphql": "^14.7.0",
"graphql": "^15.8.0",
"graphql-tag": "^2.11.0"
},
"devDependencies": {
Expand Down Expand Up @@ -144,16 +144,16 @@
"@babel/preset-typescript": "^7.7.7",
"@babel/register": "^7.7.7",
"@babel/runtime": "^7.7.7",
"@graphql-codegen/add": "^2.0.2",
"@graphql-codegen/cli": "^1.21.8",
"@graphql-codegen/fragment-matcher": "^2.0.1",
"@graphql-codegen/import-types-preset": "^1.18.6",
"@graphql-codegen/near-operation-file-preset": "^1.18.6",
"@graphql-codegen/typescript": "^1.23.0",
"@graphql-codegen/typescript-graphql-files-modules": "^1.18.1",
"@graphql-codegen/typescript-operations": "^1.18.4",
"@graphql-codegen/typescript-react-apollo": "^2.3.1",
"@graphql-codegen/typescript-resolvers": "^1.20.0",
"@graphql-codegen/add": "^3.1.1",
"@graphql-codegen/cli": "^2.6.1",
"@graphql-codegen/fragment-matcher": "^3.2.1",
"@graphql-codegen/import-types-preset": "^2.1.10",
"@graphql-codegen/near-operation-file-preset": "^2.2.4",
"@graphql-codegen/typescript": "^2.4.3",
"@graphql-codegen/typescript-graphql-files-modules": "^2.1.1",
"@graphql-codegen/typescript-operations": "^2.3.0",
"@graphql-codegen/typescript-react-apollo": "^3.2.5",
"@graphql-codegen/typescript-resolvers": "^2.5.0",
"@hot-loader/react-dom": "^17.0.0",
"@larix/zen": "0.1.37",
"@open-wc/building-rollup": "^1.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as Apollo from '@apollo/client';
import * as React from 'react';
import * as ApolloReactComponents from '@apollo/client/react/components';
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
const defaultOptions = {}
const defaultOptions = {} as const;

export const AddCounterStateDocument = gql`
mutation addCounterState($amount: Int!) {
Expand Down
114 changes: 25 additions & 89 deletions packages-modules/counter/browser/src/generated-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { GraphQLResolveInfo } from 'graphql';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
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 RequireFields<T, K extends keyof T> = { [X in Exclude<keyof T, K>]?: T[X] } & { [P in K]-?: NonNullable<T[P]> };
const defaultOptions = {}
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
const defaultOptions = {} as const;
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
Expand Down Expand Up @@ -42,7 +43,7 @@ export type Mutation = {


export type MutationAddCounterArgs = {
amount?: Maybe<Scalars['Int']>;
amount?: InputMaybe<Scalars['Int']>;
};


Expand All @@ -52,7 +53,7 @@ export type MutationAddCounterStateArgs = {


export type MutationAddMoleculerCounterArgs = {
amount?: Maybe<Scalars['Int']>;
amount?: InputMaybe<Scalars['Int']>;
};

export type Query = {
Expand All @@ -78,91 +79,46 @@ export type AddCounterStateMutationVariables = Exact<{
}>;


export type AddCounterStateMutation = (
{ __typename?: 'Mutation' }
& { addCounterState?: Maybe<(
{ __typename?: 'ClientCounter' }
& Pick<ClientCounter, 'counter'>
)> }
);
export type AddCounterStateMutation = { __typename?: 'Mutation', addCounterState?: { __typename?: 'ClientCounter', counter?: number | null } | null };

export type AddCounterMutationVariables = Exact<{
amount: Scalars['Int'];
}>;


export type AddCounterMutation = (
{ __typename?: 'Mutation' }
& { addCounter?: Maybe<(
{ __typename?: 'Counter' }
& Pick<Counter, 'amount'>
)> }
);
export type AddCounterMutation = { __typename?: 'Mutation', addCounter?: { __typename?: 'Counter', amount: number } | null };

export type AddCounter_WsMutationVariables = Exact<{
amount: Scalars['Int'];
}>;


export type AddCounter_WsMutation = (
{ __typename?: 'Mutation' }
& { addCounter?: Maybe<(
{ __typename?: 'Counter' }
& Pick<Counter, 'amount'>
)> }
);
export type AddCounter_WsMutation = { __typename?: 'Mutation', addCounter?: { __typename?: 'Counter', amount: number } | null };

export type SyncCachedCounterMutationVariables = Exact<{ [key: string]: never; }>;


export type SyncCachedCounterMutation = (
{ __typename?: 'Mutation' }
& Pick<Mutation, 'syncCachedCounter'>
);
export type SyncCachedCounterMutation = { __typename?: 'Mutation', syncCachedCounter?: boolean | null };

export type CounterCacheQueryQueryVariables = Exact<{ [key: string]: never; }>;


export type CounterCacheQueryQuery = (
{ __typename?: 'Query' }
& { counterCache?: Maybe<(
{ __typename?: 'Counter' }
& Pick<Counter, 'amount'>
)> }
);
export type CounterCacheQueryQuery = { __typename?: 'Query', counterCache?: { __typename?: 'Counter', amount: number } | null };

export type CounterStateQueryVariables = Exact<{ [key: string]: never; }>;


export type CounterStateQuery = (
{ __typename?: 'Query' }
& { counterState?: Maybe<(
{ __typename?: 'ClientCounter' }
& Pick<ClientCounter, 'counter'>
)> }
);
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?: Maybe<(
{ __typename?: 'Counter' }
& Pick<Counter, 'amount'>
)> }
);
export type CounterQueryQuery = { __typename?: 'Query', counter?: { __typename?: 'Counter', amount: number } | null };

export type OnCounterUpdatedSubscriptionVariables = Exact<{ [key: string]: never; }>;


export type OnCounterUpdatedSubscription = (
{ __typename?: 'Subscription' }
& { counterUpdated?: Maybe<(
{ __typename?: 'Counter' }
& Pick<Counter, 'amount'>
)> }
);
export type OnCounterUpdatedSubscription = { __typename?: 'Subscription', counterUpdated?: { __typename?: 'Counter', amount: number } | null };



Expand All @@ -172,21 +128,7 @@ export type ResolverTypeWrapper<T> = Promise<T> | T;
export type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};

export type LegacyStitchingResolver<TResult, TParent, TContext, TArgs> = {
fragment: string;
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};

export type NewStitchingResolver<TResult, TParent, TContext, TArgs> = {
selectionSet: string;
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
};
export type StitchingResolver<TResult, TParent, TContext, TArgs> = LegacyStitchingResolver<TResult, TParent, TContext, TArgs> | NewStitchingResolver<TResult, TParent, TContext, TArgs>;
export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> =
| ResolverFn<TResult, TParent, TContext, TArgs>
| ResolverWithResolve<TResult, TParent, TContext, TArgs>
| StitchingResolver<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,
Expand All @@ -200,7 +142,7 @@ export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => AsyncIterator<TResult> | Promise<AsyncIterator<TResult>>;
) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;

export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
Expand Down Expand Up @@ -247,26 +189,26 @@ export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs

/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = {
Query: ResolverTypeWrapper<{}>;
Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
ClientCounter: ResolverTypeWrapper<ClientCounter>;
Counter: ResolverTypeWrapper<Counter>;
Int: ResolverTypeWrapper<Scalars['Int']>;
ClientCounter: ResolverTypeWrapper<ClientCounter>;
Mutation: ResolverTypeWrapper<{}>;
Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
Subscription: ResolverTypeWrapper<{}>;
Query: ResolverTypeWrapper<{}>;
String: ResolverTypeWrapper<Scalars['String']>;
Subscription: ResolverTypeWrapper<{}>;
};

/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
Query: {};
Boolean: Scalars['Boolean'];
ClientCounter: ClientCounter;
Counter: Counter;
Int: Scalars['Int'];
ClientCounter: ClientCounter;
Mutation: {};
Boolean: Scalars['Boolean'];
Subscription: {};
Query: {};
String: Scalars['String'];
Subscription: {};
};

export type ClientCounterResolvers<ContextType = any, ParentType extends ResolversParentTypes['ClientCounter'] = ResolversParentTypes['ClientCounter']> = {
Expand All @@ -280,9 +222,9 @@ export type CounterResolvers<ContextType = any, ParentType extends ResolversPare
};

export type MutationResolvers<ContextType = any, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = {
addCounter?: Resolver<Maybe<ResolversTypes['Counter']>, ParentType, ContextType, RequireFields<MutationAddCounterArgs, never>>;
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, RequireFields<MutationAddMoleculerCounterArgs, never>>;
addMoleculerCounter?: Resolver<Maybe<ResolversTypes['Counter']>, ParentType, ContextType, Partial<MutationAddMoleculerCounterArgs>>;
syncCachedCounter?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>;
};

Expand All @@ -307,12 +249,6 @@ export type Resolvers<ContextType = any> = {
};


/**
* @deprecated
* Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config.
*/
export type IResolvers<ContextType = any> = Resolvers<ContextType>;


export const AddCounterStateDocument = gql`
mutation addCounterState($amount: Int!) {
Expand Down
5 changes: 2 additions & 3 deletions portable-devices/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"apollo-link-debounce": "^2.1.0",
"apollo-link-logger": "^1.2.3",
"apollo-logger": "^0.3.3",
"aws-sdk": "^2.880.0",
"check-internet-connected": "^2.0.5",
"classnames": "^2.2.6",
"connected-react-router": "^6.9.1",
Expand All @@ -81,7 +80,7 @@
"fela-plugin-unit": "^11.6.0",
"fela-plugin-validator": "^11.6.0",
"fela-preset-web": "^11.6.0",
"graphql": "^14.7.0",
"graphql": "^15.8.0",
"graphql-tag": "^2.11.0",
"history": "^4.10.1",
"immutability-helper": "^3.0.1",
Expand Down Expand Up @@ -115,7 +114,7 @@
"rxjs-hooks": "^0.5.2",
"source-map-support": "^0.5.19",
"sqlite3": "^5.0.2",
"subscriptions-transport-ws": "0.9.18",
"subscriptions-transport-ws": "0.11.0",
"typeorm": "^0.2.32"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion portable-devices/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"rxjs-compat": "^6.5.3",
"rxjs-hooks": "^0.5.2",
"sentry-expo": "~4.0.0",
"subscriptions-transport-ws": "0.9.18"
"subscriptions-transport-ws": "0.11.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",
Expand Down
30 changes: 16 additions & 14 deletions servers/backend-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,22 @@
"@common-stack/core": "0.1.19",
"@common-stack/server-core": "0.1.19",
"@common-stack/store-mongo": "0.1.19",
"@graphql-tools/links": "^7.0.0",
"@graphql-tools/links": "^8.2.0",
"@graphql-tools/stitch": "^8.4.3",
"@sample-stack/core": "link:../../packages/sample-core",
"@sample-stack/counter-module-server": "link:../../packages-modules/counter/server",
"@sample-stack/platform-server": "link:../../packages/sample-platform/server",
"@sample-stack/store": "link:../../packages/sample-store",
"apollo-datasource": "^0.7.0",
"apollo-datasource-rest": "^0.8.0",
"apollo-datasource": "^3.3.1",
"apollo-datasource-rest": "^3.3.1",
"apollo-errors": "^1.9.0",
"apollo-logger": "^0.3.3",
"apollo-server-cache-memcached": "^0.6.7",
"apollo-server-cache-redis": "^1.2.3",
"apollo-server-caching": "^0.5.3",
"apollo-server-core": "^2.21.1",
"apollo-server-express": "^2.21.1",
"apollo-server-plugin-response-cache": "^0.6.0",
"apollo-server-cache-memcached": "^3.3.1",
"apollo-server-cache-redis": "^3.3.1",
"apollo-server-caching": "^3.3.0",
"apollo-server-core": "^3.6.3",
"apollo-server-express": "^3.6.3",
"apollo-server-plugin-response-cache": "^3.5.1",
"app-root-path": "^3.0.0",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
Expand All @@ -86,11 +87,12 @@
"envalid": "^7.2.2",
"esm": "^3.2.25",
"express": "^4.17.1",
"graphql": "^14.7.0",
"graphql": "^15.8.0",
"graphql-ws": "^5.5.5",
"graphql-bigint": "^1.0.0",
"graphql-nats-subscriptions": "^1.5.0",
"graphql-subscriptions": "^1.2.0",
"graphql-tools": "^6.0.0",
"graphql-subscriptions": "^2.0.0",
"graphql-tools": "^8.0.0",
"graphql-type-json": "^0.3.1",
"inversify": "^5.0.1",
"ioredis": "^4.14.0",
Expand All @@ -106,9 +108,9 @@
"reflect-metadata": "^0.1.13",
"rxjs": "^6.5.3",
"rxjs-compat": "^6.5.3",
"subscriptions-transport-ws": "0.9.18",
"subscriptions-transport-ws": "0.11.0",
"universal-cookie-express": "^4.0.1",
"ws": "^7.2.1"
"ws": "^8.5.0"
},
"devDependencies": {
"cross-env": "^6.0.3",
Expand Down
Loading