Skip to content

Commit

Permalink
Merge pull request #101 from osstotalsoft/feature/UpdateGqlVersion
Browse files Browse the repository at this point in the history
update graphql to v16
  • Loading branch information
DCosti committed Nov 4, 2022
2 parents 5472501 + 298f54d commit 71ab769
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 25 deletions.
7 changes: 3 additions & 4 deletions generators/app/templates/infrastructure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@
<%_}_%>
"apollo-datasource": "^3.3.2",
"apollo-datasource-rest": "^3.6.1",
"apollo-server": "^3.10.0",
"apollo-server": "^3.11.1",
"apollo-server-core": "^3.10.0",
"apollo-server-koa": "^3.10.0",
"async-mutex": "^0.3.2",
"bluebird": "3.7.2",
"colors": "^1.4.0",
"console-stamp": "^3.0.6",
"dotenv": "16.0.1",
"graphql": "15.8.0",
"graphql": "16.6.0",
<%_ if(addSubscriptions){ _%>
"graphql-redis-subscriptions": "^2.5.0",
"graphql-subscriptions": "^2.0.0",
Expand All @@ -93,14 +93,13 @@
<%_}_%>
<%_ if(withRights){ _%>
"graphql-middleware": "^6.1.33",
"graphql-shield": "^7.5.0",
"graphql-shield": "7.6.4",
<%_}_%>
"graphql-upload": "^13.0.0",
"humps": "^2.0.1",
<%_ if(addTracing){ _%>
"jaeger-client": "^3.19.0",
"opentracing": "^0.14.7",
"apollo-opentracing": "^2.1.76",
"@totalsoft/opentracing": "^1.1.0",
"@totalsoft/pino-opentracing": "^1.1.0",
<%_}_%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const {
isAdmin,
canViewDashboard
} = require('../rules')
const { isRuleFunction } = require('graphql-shield/dist/utils')
const { isRuleFunction } = require('graphql-shield/esm/utils')

describe('Test permission rules to be valid rule functions', () => {
test('isAuthenticated is valid rule function', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const sources = loadTypedefsSync(join(__dirname, '../**/*.graphql'), {
loaders: [new GraphQLFileLoader()]
})
const typeDefs = sources.map(source => source.document)
const resolvers = mergeResolvers(join(__dirname, '../**/*resolvers.{js,ts}'), { globOptions: { caseSensitiveMatch: false } })
const resolvers = mergeResolvers(loadFilesSync(join(__dirname, '../**/*resolvers.{js,ts}'), { globOptions: { caseSensitiveMatch: false } }))

<%_ if(withRights){ _%>
module.exports = applyMiddleware(makeExecutableSchema({ typeDefs, resolvers }), permissionsMiddleware)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { default: isAsyncIterable } = require("graphql/jsutils/isAsyncIterable");
const { default: mapAsyncIterator } = require("graphql/subscription/mapAsyncIterator");
const { isAsyncIterable } = require("graphql/jsutils/isAsyncIterable");
const { mapAsyncIterator } = require("graphql/execution/mapAsyncIterator");
const { execute, createSourceEventStream, GraphQLError } = require("graphql");
const { pipelineBuilder } = require("../utils/pipeline");

Expand Down Expand Up @@ -36,21 +36,6 @@ function subscribe({ middleware, filter }) {
);
};
}
/**
* This function checks if the error is a GraphQLError. If it is, report it as
* an ExecutionResult, containing only errors and no data. Otherwise treat the
* error as a system-class error and re-throw it.
*/

function reportGraphQLError(error) {
if (error instanceof GraphQLError) {
return {
errors: [error]
};
}

throw error;
}

function filterAsyncIterable(asyncIterable, predicate) {
return {
Expand Down Expand Up @@ -118,8 +103,7 @@ function subscribeImpl(args, pipeline, filter) {
return isAsyncIterable(resultOrStream)
? mapAsyncIterator(
filter ? filterAsyncIterable(resultOrStream, filter(contextValue)) : resultOrStream,
mapSourceToResponse,
reportGraphQLError
mapSourceToResponse
)
: resultOrStream;
});
Expand Down

0 comments on commit 71ab769

Please sign in to comment.