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

fix: get builds and tests working #210

Merged
merged 7 commits into from
Dec 2, 2019
Merged
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
2 changes: 1 addition & 1 deletion examples/audit_logging/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const typeDefs = gql`
`

// Resolver functions. This is our business logic
let resolvers = {
const resolvers = {
Query: {
hello: (obj, args, context, info) => {
context.auditLog('CUSTOM_LOG_TYPE', 'this is a custom audit log', obj, args, context, info)
Expand Down
1,391 changes: 0 additions & 1,391 deletions examples/keycloak/package-lock.json

This file was deleted.

22 changes: 0 additions & 22 deletions examples/keycloak/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion examples/metrics/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const typeDefs = gql`
`

// Resolver functions. This is our business logic
let resolvers = {
const resolvers = {
Query: {
hello: (obj, args, context, info) => {
return `Hello world from ${context.serverName}`
Expand Down
28 changes: 14 additions & 14 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"compile": "exit 0",
"watch": "exit 0",
"compile:clean": "exit 0",
"test-examples": "ava --concurrency=1 test/*.test.js",
"test-examples": "rm -rf ../packages/*/node_modules/graphql && ava --concurrency=1 test/*.test.js",
"push-basic": "TAG=\"$npm_package_version\" ./push-script.sh basic",
"push-keycloak": "TAG=\"$npm_package_version\" ./push-script.sh keycloak",
"push-audit_logging": "TAG=\"$npm_package_version\" ./push-script.sh audit_logging",
Expand All @@ -25,24 +25,24 @@
"@aerogear/voyager-server": "^0.7.1",
"@aerogear/voyager-subscriptions": "^0.7.1",
"@aerogear/voyager-tools": "^0.7.1",
"axios": "^0.18.0",
"express": "^4.16.4",
"graphql": "0.13.2",
"axios": "^0.19.0",
"express": "^4.17.1",
"graphql": "14.5.8",
"graphql-subscriptions": "1.1.0",
"graphql-tools": "^4.0.3"
"graphql-tools": "^4.0.6"
},
"devDependencies": {
"@types/graphql": "^14.0.3",
"apollo-cache-inmemory": "^1.5.1",
"apollo-client": "^2.5.1",
"apollo-link": "^1.2.11",
"apollo-link-http": "^1.5.14",
"apollo-link-ws": "^1.0.17",
"apollo-utilities": "^1.2.1",
"@types/graphql": "14.5.0",
"apollo-cache-inmemory": "1.6.3",
"apollo-client": "2.6.4",
"apollo-link": "1.2.13",
"apollo-link-http": "1.5.16",
"apollo-link-ws": "1.0.19",
"apollo-utilities": "1.3.2",
"ava": "^1.0.1",
"graphql-tag": "^2.10.1",
"node-fetch": "^2.5.0",
"node-fetch": "^2.6.0",
"subscriptions-transport-ws": "^0.9.16",
"ws": "^7.0.0"
"ws": "^7.2.0"
}
}
2 changes: 1 addition & 1 deletion examples/test/auditLogging.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function sendQuery () {
method: 'POST',
url: `http://localhost:${port}${server.graphqlPath}`,
data: {
'query': '{ hello }'
query: '{ hello }'
},
headers: { 'Content-Type': 'application/json' }
})
Expand Down
4 changes: 2 additions & 2 deletions examples/test/conflicts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function sendQuery (query) {
method: 'POST',
url: `http://localhost:${port}${server.graphqlPath}`,
data: {
'query': query
query: query
},
headers: { 'Content-Type': 'application/json' }
})
Expand All @@ -41,7 +41,7 @@ test.serial('Sending a mutation with correct version number should not return er
}
})

test.serial(`Sending a query should return the new version of greeting response`, async t => {
test.serial('Sending a query should return the new version of greeting response', async t => {
try {
const res = await sendQuery(testQueries.greeting)
t.deepEqual(res.status, 200)
Expand Down
4 changes: 2 additions & 2 deletions examples/test/keycloak.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ function modifyKeycloakServerUrl (url) {
function sendQuery (token, maxRedirects) {
const headers = { 'Content-Type': 'application/json' }
if (token) {
headers['Authorization'] = token
headers.Authorization = token
}
return axios({
method: 'POST',
url: `http://localhost:${exampleAppPort}${exampleAppGraphqlPath}`,
data: {
'query': '{ hello }'
query: '{ hello }'
},
headers,
maxRedirects
Expand Down
2 changes: 1 addition & 1 deletion examples/test/metrics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function sendQuery () {
method: 'POST',
url: `http://localhost:${port}${server.graphqlPath}`,
data: {
'query': '{ hello }'
query: '{ hello }'
},
headers: { 'Content-Type': 'application/json' }
})
Expand Down
2 changes: 1 addition & 1 deletion examples/test/subscriptions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('Sending a request to basic example app should return OK status code and no
})

test('Basic Subscricption will return a result', async t => {
let subscription = clientWrapper.subscribe(gql`
const subscription = clientWrapper.subscribe(gql`
subscription s1 {
hello
}
Expand Down
26 changes: 13 additions & 13 deletions examples/test/util/configureKeycloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ async function authenticateKeycloak () {
url: `${config.authServerUrl}/realms/${config.adminRealmName}/protocol/openid-connect/token`,
data: `client_id=${config.resource}&username=${config.username}&password=${config.password}&grant_type=password`
}).catch((err) => { return console.error(err) })
return `Bearer ${res.data['access_token']}`
return `Bearer ${res.data.access_token}`
}

async function importRealm () {
await axios({
method: 'POST',
url: `${config.authServerUrl}/admin/realms`,
data: realmToImport,
headers: { 'Authorization': config.token, 'Content-Type': 'application/json' }
headers: { Authorization: config.token, 'Content-Type': 'application/json' }
}).catch((err) => { return console.error(err) })
}

async function getRealmRoles () {
const res = await axios({
method: 'GET',
url: `${config.authServerUrl}/admin/realms/${config.appRealmName}/roles`,
headers: { 'Authorization': config.token }
headers: { Authorization: config.token }
}).catch((err) => { return console.error(err) })

return res.data
Expand All @@ -50,7 +50,7 @@ async function getClients () {
const res = await axios({
method: 'GET',
url: `${config.authServerUrl}/admin/realms/${config.appRealmName}/clients`,
headers: { 'Authorization': config.token }
headers: { Authorization: config.token }
}).catch((err) => { return console.error(err) })

return res.data
Expand All @@ -60,7 +60,7 @@ async function getClientRoles (client) {
const res = await axios({
method: 'GET',
url: `${config.authServerUrl}/admin/realms/${config.appRealmName}/clients/${client.id}/roles`,
headers: { 'Authorization': config.token }
headers: { Authorization: config.token }
}).catch((err) => { return console.error(err) })
return res.data
}
Expand All @@ -70,11 +70,11 @@ async function createUser (name, password) {
method: 'post',
url: `${config.authServerUrl}/admin/realms/${config.appRealmName}/users`,
data: {
'username': name,
'credentials': [{ 'type': 'password', 'value': password, 'temporary': false }],
'enabled': true
username: name,
credentials: [{ type: 'password', value: password, temporary: false }],
enabled: true
},
headers: { 'Authorization': config.token, 'Content-Type': 'application/json' }
headers: { Authorization: config.token, 'Content-Type': 'application/json' }
})
if (res) {
return res.headers.location
Expand All @@ -86,7 +86,7 @@ async function assignRealmRoleToUser (userIdUrl, role) {
method: 'POST',
url: `${userIdUrl}/role-mappings/realm`,
data: [role],
headers: { 'Authorization': config.token, 'Content-Type': 'application/json' }
headers: { Authorization: config.token, 'Content-Type': 'application/json' }
}).catch((err) => { return console.error(err) })

return res.data
Expand All @@ -97,7 +97,7 @@ async function assignClientRoleToUser (userIdUrl, client, role) {
method: 'POST',
url: `${userIdUrl}/role-mappings/clients/${client.id}`,
data: [role],
headers: { 'Authorization': config.token, 'Content-Type': 'application/json' }
headers: { Authorization: config.token, 'Content-Type': 'application/json' }
}).catch((err) => { return console.error(err) })
return res.data
}
Expand All @@ -109,7 +109,7 @@ async function prepareKeycloak (authServerUrl, testPassword) {
const realmRoles = await getRealmRoles()
const clients = await getClients()

for (let user of usersConfiguration) {
for (const user of usersConfiguration) {
// Create a new user
const userIdUrl = await createUser(user.name, testPassword)
// Assign realm role to user
Expand All @@ -131,7 +131,7 @@ async function resetKeycloakConfiguration () {
await axios({
method: 'DELETE',
url: `${config.authServerUrl}/admin/realms/${config.appRealmName}`,
headers: { 'Authorization': config.token }
headers: { Authorization: config.token }
}).catch((err) => { return console.error(err) })
}

Expand Down
2 changes: 1 addition & 1 deletion examples/test/util/getAuthToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ async function getAuthToken (keycloakConfig, username, password) {
url: `${keycloakConfig['auth-server-url']}/realms/${keycloakConfig.realm}/protocol/openid-connect/token`,
data: `client_id=${keycloakConfig.resource}&username=${username}&password=${password}&grant_type=password`
})
return `Bearer ${res.data['access_token']}`
return `Bearer ${res.data.access_token}`
}

module.exports = getAuthToken
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dependencies": {},
"devDependencies": {
"@types/express-session": "1.15.16",
"@types/graphql": "14.2.3",
"@types/graphql": "14.5.0",
"@types/joi": "14.3.4",
"@types/keycloak-connect": "4.5.1",
"@types/node": "10.17.6",
Expand All @@ -49,5 +49,10 @@
"exclude": [
"**/*.test.ts"
]
},
"standard": {
"ignore": [
"/doc/**/*.js"
]
}
}
2 changes: 1 addition & 1 deletion packages/voyager-audit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"typescript": "3.7.2"
},
"peerDependencies": {
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
"graphql": "^0.13.0 || ^14.0.0"
},
"ava": {
"compileEnhancements": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/voyager-conflicts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"typescript": "3.7.2"
},
"peerDependencies": {
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
"graphql": "^0.13.0 || ^14.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions packages/voyager-keycloak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
"keycloak-connect-graphql": "0.2.2"
},
"devDependencies": {
"@types/express": "4.17.2",
"@types/express": "4.16.1",
"@types/express-session": "1.15.16",
"@types/keycloak-connect": "4.5.1",
"@types/node": "10.17.6",
"@types/node": "12.12.14",
"ava": "2.4.0",
"ts-node": "8.5.4",
"typescript": "3.7.2"
},
"peerDependencies": {
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
"graphql": "^0.13.0 || ^14.0.0"
},
"ava": {
"compileEnhancements": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/voyager-keycloak/src/KeycloakSecurityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class KeycloakSecurityService implements SecurityService {
resave: false,
saveUninitialized: true,
store: memoryStore
}))
}) as any)

if (!this.keycloak) {
this.keycloak = new Keycloak({
Expand Down
2 changes: 1 addition & 1 deletion packages/voyager-keycloak/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "./dist"
},
"include": ["src/**/*"],
"exclude": []
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/voyager-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@
]
},
"peerDependencies": {
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
"graphql": "^0.13.0 || ^14.0.0"
}
}
5 changes: 4 additions & 1 deletion packages/voyager-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"outDir": "./dist"
},
"include": ["src/**/*"],
"exclude": []
"exclude": [
"src/integration_test",
"**/*.test.ts"
]
}
2 changes: 1 addition & 1 deletion packages/voyager-subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"typescript": "3.7.2"
},
"peerDependencies": {
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
"graphql": "^0.13.0 || ^14.0.0"
},
"publishConfig": {
"access": "public"
Expand Down