-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@whook/example): add GraphQL server
- Loading branch information
Showing
14 changed files
with
2,427 additions
and
4,486 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,12 +146,12 @@ describe('initCreateWhook', () => { | |
await createWhook(); | ||
|
||
expect( | ||
JSON.parse( | ||
writeFile.mock.calls | ||
.find((call) => call[0].toString().endsWith('package.json'))?.[1] | ||
?.toString() || '', | ||
), | ||
).toMatchInlineSnapshot(` | ||
JSON.parse( | ||
writeFile.mock.calls. | ||
find((call) => call[0].toString().endsWith('package.json'))?.[1]?. | ||
toString() || '' | ||
) | ||
).toMatchInlineSnapshot(` | ||
{ | ||
"author": { | ||
"email": "[email protected]", | ||
|
@@ -160,13 +160,16 @@ describe('initCreateWhook', () => { | |
"dependencies": { | ||
"@whook/authorization": "<current_version>", | ||
"@whook/cors": "<current_version>", | ||
"@whook/graphiql": "^15.0.0", | ||
"@whook/graphql": "^15.0.0", | ||
"@whook/http-router": "<current_version>", | ||
"@whook/http-server": "<current_version>", | ||
"@whook/http-transaction": "<current_version>", | ||
"@whook/swagger-ui": "<current_version>", | ||
"@whook/whook": "<current_version>", | ||
"application-services": "^6.0.0", | ||
"common-services": "^16.0.1", | ||
"graphql-tag": "^2.12.6", | ||
"http-auth-utils": "^6.0.0", | ||
"jwt-service": "^10.0.4", | ||
"knifecycle": "^17.0.1", | ||
|
@@ -368,12 +371,12 @@ describe('initCreateWhook', () => { | |
await createWhook(); | ||
|
||
expect( | ||
JSON.parse( | ||
writeFile.mock.calls | ||
.find((call) => call[0].toString().endsWith('package.json'))?.[1] | ||
?.toString() || '', | ||
), | ||
).toMatchInlineSnapshot(` | ||
JSON.parse( | ||
writeFile.mock.calls. | ||
find((call) => call[0].toString().endsWith('package.json'))?.[1]?. | ||
toString() || '' | ||
) | ||
).toMatchInlineSnapshot(` | ||
{ | ||
"author": { | ||
"email": "[email protected]", | ||
|
@@ -382,13 +385,16 @@ describe('initCreateWhook', () => { | |
"dependencies": { | ||
"@whook/authorization": "<current_version>", | ||
"@whook/cors": "<current_version>", | ||
"@whook/graphiql": "^15.0.0", | ||
"@whook/graphql": "^15.0.0", | ||
"@whook/http-router": "<current_version>", | ||
"@whook/http-server": "<current_version>", | ||
"@whook/http-transaction": "<current_version>", | ||
"@whook/swagger-ui": "<current_version>", | ||
"@whook/whook": "<current_version>", | ||
"application-services": "^6.0.0", | ||
"common-services": "^16.0.1", | ||
"graphql-tag": "^2.12.6", | ||
"http-auth-utils": "^6.0.0", | ||
"jwt-service": "^10.0.4", | ||
"knifecycle": "^17.0.1", | ||
|
@@ -575,12 +581,12 @@ describe('initCreateWhook', () => { | |
await createWhook(); | ||
|
||
expect( | ||
JSON.parse( | ||
writeFile.mock.calls | ||
.find((call) => call[0].toString().endsWith('package.json'))?.[1] | ||
?.toString() || '', | ||
), | ||
).toMatchInlineSnapshot(` | ||
JSON.parse( | ||
writeFile.mock.calls. | ||
find((call) => call[0].toString().endsWith('package.json'))?.[1]?. | ||
toString() || '' | ||
) | ||
).toMatchInlineSnapshot(` | ||
{ | ||
"author": { | ||
"email": "[email protected]", | ||
|
@@ -589,13 +595,16 @@ describe('initCreateWhook', () => { | |
"dependencies": { | ||
"@whook/authorization": "<current_version>", | ||
"@whook/cors": "<current_version>", | ||
"@whook/graphiql": "^15.0.0", | ||
"@whook/graphql": "^15.0.0", | ||
"@whook/http-router": "<current_version>", | ||
"@whook/http-server": "<current_version>", | ||
"@whook/http-transaction": "<current_version>", | ||
"@whook/swagger-ui": "<current_version>", | ||
"@whook/whook": "<current_version>", | ||
"application-services": "^6.0.0", | ||
"common-services": "^16.0.1", | ||
"graphql-tag": "^2.12.6", | ||
"http-auth-utils": "^6.0.0", | ||
"jwt-service": "^10.0.4", | ||
"knifecycle": "^17.0.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
initGetGraphQL, | ||
getGraphQLDefinition as baseDefinition, | ||
} from '@whook/graphql'; | ||
import type { WhookAPIHandlerDefinition } from '@whook/whook'; | ||
|
||
// Add authentication to the base getGraphQL endpoints that | ||
// would otherwise be public per default | ||
export const definition: WhookAPIHandlerDefinition = { | ||
...baseDefinition, | ||
operation: { | ||
...baseDefinition.operation, | ||
security: [ | ||
{ | ||
bearerAuth: ['admin'], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
export default initGetGraphQL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
initPostGraphQL, | ||
postGraphQLDefinition as baseDefinition, | ||
} from '@whook/graphql'; | ||
import type { WhookAPIHandlerDefinition } from '@whook/whook'; | ||
|
||
// Add authentication to the base postGraphQL endpoints that | ||
// would otherwise be public per default | ||
export const definition: WhookAPIHandlerDefinition = { | ||
...baseDefinition, | ||
operation: { | ||
...baseDefinition.operation, | ||
security: [ | ||
{ | ||
bearerAuth: ['admin'], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
export default initPostGraphQL; |
Oops, something went wrong.