Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
chore(deps): update all (#401)
Browse files Browse the repository at this point in the history
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Wojciech Trocki <[email protected]>
  • Loading branch information
3 people authored Jun 5, 2020
1 parent 44bfe50 commit 7bc032b
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 95 deletions.
34 changes: 17 additions & 17 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
"dependencies": {
"@apollo/react-hooks": "3.1.5",
"@capacitor/core": "2.1.2",
"@ionic/react": "5.0.7",
"@ionic/react-router": "5.0.7",
"@testing-library/jest-dom": "5.3.0",
"@testing-library/react": "10.0.2",
"@testing-library/user-event": "10.0.1",
"@types/jest": "25.1.4",
"@types/node": "12.12.34",
"@types/react": "16.9.29",
"@types/react-dom": "16.9.5",
"@types/react-router": "5.1.4",
"@types/react-router-dom": "5.1.3",
"@ionic/react": "5.1.1",
"@ionic/react-router": "5.1.1",
"@testing-library/jest-dom": "5.9.0",
"@testing-library/react": "10.2.0",
"@testing-library/user-event": "10.4.1",
"@types/jest": "25.2.3",
"@types/node": "12.12.44",
"@types/react": "16.9.35",
"@types/react-dom": "16.9.8",
"@types/react-router": "5.1.7",
"@types/react-router-dom": "5.1.5",
"apollo-link-context": "1.0.20",
"apollo-link-ws": "1.0.20",
"graphql": "14.6.0",
"graphql-tag": "2.10.3",
"ionicons": "5.0.1",
"keycloak-js": "10.0.2",
"offix-cache": "0.15.0",
"offix-client": "0.15.0",
"offix-cache": "0.15.1",
"offix-client": "0.15.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-offix-hooks": "0.15.0",
"react-offix-hooks": "0.15.1",
"react-router": "5.2.0",
"react-router-dom": "5.2.0",
"react-scripts": "3.4.1",
"subscriptions-transport-ws": "0.9.16",
"typescript": "3.8.3",
"typescript": "3.9.5",
"uniforms-ionic": "0.0.11",
"uniforms": "3.0.0-alpha.3",
"uniforms-bridge-simple-schema-2": "3.0.0-alpha.3"
"uniforms": "3.0.0-alpha.4",
"uniforms-bridge-simple-schema-2": "3.0.0-alpha.4"
},
"scripts": {
"start": "npm run build && cap serve",
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/NetworkBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { IonBadge } from '@ionic/react';

export const NetworkBadge: React.FC<{ isOnline: boolean}> = ({ isOnline }) => {
export const NetworkBadge: React.FC<{ isOnline?: boolean}> = ({ isOnline }) => {

return (isOnline)
?<IonBadge class="network-badge" color="secondary">Online</IonBadge>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"description": "Mono repository for DataSync Starter",
"main": "index.js",
"devDependencies": {
"del-cli": "3.0.0",
"@graphback/codegen-offix": "0.11.4",
"graphback-cli": "0.11.4"
"del-cli": "3.0.1",
"@graphback/codegen-offix": "0.12.1",
"graphback-cli": "0.12.1"
},
"scripts": {
"start:server": "cd server && yarn start",
Expand All @@ -26,6 +26,6 @@
"server"
],
"resolutions": {
"@types/react": "16.9.34"
"@types/react": "16.9.35"
}
}
18 changes: 9 additions & 9 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@
"license": "MIT",
"devDependencies": {
"@types/cors": "2.8.6",
"@types/express": "4.17.3",
"@types/node": "13.9.8",
"@types/express": "4.17.6",
"@types/node": "13.13.10",
"graphql": "14.6.0",
"keycloak-request-token": "0.1.0",
"ts-node": "8.8.1",
"ts-node": "8.10.2",
"ts-node-dev": "1.0.0-pre.44",
"tslint": "6.1.0",
"typescript": "3.8.3"
"tslint": "6.1.2",
"typescript": "3.9.5"
},
"dependencies": {
"@graphql-toolkit/file-loading": "0.10.7",
"@aerogear/graphql-mqtt-subscriptions": "1.1.3",
"@graphback/runtime-mongo": "0.11.4",
"mongodb": "3.5.5",
"@types/react": "16.9.29",
"@graphback/runtime-mongo": "0.12.1",
"mongodb": "3.5.8",
"@types/react": "16.9.35",
"apollo-server-express": "2.14.2",
"cors": "2.8.5",
"dotenv": "8.2.0",
"express": "4.17.1",
"express-session": "1.17.0",
"express-session": "1.17.1",
"graphql-tag": "2.10.3",
"keycloak-connect": "10.0.2",
"keycloak-connect-graphql": "0.6.0",
Expand Down
89 changes: 42 additions & 47 deletions server/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Express } from "express";
import { config } from './config/config';

import {
import {
KeycloakTypeDefs,
KeycloakSchemaDirectives,
KeycloakSubscriptionContext,
Expand All @@ -13,55 +13,50 @@ const session = require('express-session')
const Keycloak = require('keycloak-connect')

export function buildKeycloakApolloConfig(app: Express, apolloConfig: any) {
if (config.keycloakConfig) {
const graphqlPath = `/graphql`;
console.log("Using keycloak configuration")

const memoryStore = new session.MemoryStore()
app.use(session({
secret: process.env.SESSION_SECRET_STRING || 'this should be a long secret',
resave: false,
saveUninitialized: true,
store: memoryStore
}))

const keycloak = new Keycloak({
store: memoryStore
}, config.keycloakConfig);
const keycloakSubscriptionHandler = new KeycloakSubscriptionHandler({ keycloak })

app.use(keycloak.middleware())

app.use(graphqlPath, keycloak.protect());

return {
typeDefs: [KeycloakTypeDefs, apolloConfig.typeDefs], // 1. Add the Keycloak Type Defs
schemaDirectives: KeycloakSchemaDirectives,
resolvers: apolloConfig.resolvers,
playground: apolloConfig.playground,
path: graphqlPath,
context: ({ req }) => {
const graphqlPath = `/graphql`;
console.log("Using keycloak configuration")

const memoryStore = new session.MemoryStore()
app.use(session({
secret: process.env.SESSION_SECRET_STRING || 'this should be a long secret',
resave: false,
saveUninitialized: true,
store: memoryStore
}))

const keycloak = new Keycloak({
store: memoryStore
}, config.keycloakConfig);
const keycloakSubscriptionHandler = new KeycloakSubscriptionHandler({ keycloak })

app.use(keycloak.middleware())

app.use(graphqlPath, keycloak.protect());

return {
typeDefs: [KeycloakTypeDefs, apolloConfig.typeDefs], // 1. Add the Keycloak Type Defs
schemaDirectives: KeycloakSchemaDirectives,
resolvers: apolloConfig.resolvers,
playground: apolloConfig.playground,
path: graphqlPath,
context: ({ req }) => {
return {
...apolloConfig.context,
kauth: new KeycloakContext({ req }) // 3. add the KeycloakContext to `kauth`
}
},
subscriptions: {
onConnect: async (connectionParams, websocket, connectionContext) => {
const token = await keycloakSubscriptionHandler.onSubscriptionConnect(connectionParams)
if (!token) {
throw new Error("Cannot build keycloak token. Connection will be terminated")
}
return {
...apolloConfig.context,
kauth: new KeycloakContext({ req }) // 3. add the KeycloakContext to `kauth`
}
},
subscriptions: {
onConnect: async (connectionParams, websocket, connectionContext) => {
const token = await keycloakSubscriptionHandler.onSubscriptionConnect(connectionParams)
if (!token) {
throw new Error("Cannot build keycloak token. Connection will be terminated")
}
return {
...apolloConfig.context,
kauth: new KeycloakSubscriptionContext(token)
}
kauth: new KeycloakSubscriptionContext(token)
}
},
}
} else {
console.log("Keycloak not configured. Auth will be disabled");
return apolloConfig;
}
},
}
}

Expand Down
39 changes: 22 additions & 17 deletions server/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Express } from "express";
import { buildKeycloakApolloConfig } from './auth';
import { createKeycloakRuntimeContext } from '@graphback/keycloak-authz';
import { authConfig } from './config/auth';
import { OffixMongoDBDataProvider } from '@graphback/runtime-mongo';
import { OffixMongoDBDataProvider, createOffixMongoCRUDRuntimeContext } from '@graphback/runtime-mongo';
import { AMQCRUDService } from './AMQCrudService'

/**
Expand All @@ -23,26 +23,31 @@ export const createApolloServer = async function (app: Express, config: Config)

const typeDefs = loadSchemaFiles(join(__dirname, '/schema/')).join('\n');
const schema = buildSchema(typeDefs, { assumeValid: true });
let context;

const context = createKeycloakRuntimeContext({
models,
schema,
db,
pubSub,
authConfig,
dataProvider: OffixMongoDBDataProvider,
crudService: AMQCRUDService
})
let apolloConfig;

let apolloConfig = {
typeDefs: typeDefs,
resolvers,
playground: true,
context: context
if (config.keycloakConfig) {
context = createKeycloakRuntimeContext({
models,
schema,
db,
pubSub,
authConfig,
dataProvider: OffixMongoDBDataProvider,
crudService: AMQCRUDService
})
apolloConfig = buildKeycloakApolloConfig(app, apolloConfig)
} else {
context = createOffixMongoCRUDRuntimeContext(models, schema, db, pubSub);
apolloConfig = {
typeDefs: typeDefs,
resolvers,
playground: true,
context: context
}
}

apolloConfig = buildKeycloakApolloConfig(app, apolloConfig)

const apolloServer = new ApolloServer(apolloConfig)
apolloServer.applyMiddleware({ app });

Expand Down

0 comments on commit 7bc032b

Please sign in to comment.