Skip to content

Commit

Permalink
feat(@whook/example): add GraphQL server
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Oct 21, 2023
1 parent 3cf4ba3 commit e10fe00
Show file tree
Hide file tree
Showing 14 changed files with 2,073 additions and 3,885 deletions.
5,610 changes: 1,727 additions & 3,883 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,16 @@ DEV_MODE=1
"dependencies": {
"@whook/authorization": "<current_version>",
"@whook/cors": "<current_version>",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@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": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down Expand Up @@ -477,13 +480,16 @@ DEV_MODE=1
"dependencies": {
"@whook/authorization": "<current_version>",
"@whook/cors": "<current_version>",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@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": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down Expand Up @@ -849,13 +855,16 @@ DEV_MODE=1
"dependencies": {
"@whook/authorization": "<current_version>",
"@whook/cors": "<current_version>",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@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": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down Expand Up @@ -1204,13 +1213,16 @@ DEV_MODE=1
"dependencies": {
"@whook/authorization": "<current_version>",
"@whook/cors": "<current_version>",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@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": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/whook-create/src/services/createWhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,16 @@ describe('initCreateWhook', () => {
"dependencies": {
"@whook/authorization": "<current_version>",
"@whook/cors": "<current_version>",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@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": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down Expand Up @@ -382,13 +385,16 @@ describe('initCreateWhook', () => {
"dependencies": {
"@whook/authorization": "<current_version>",
"@whook/cors": "<current_version>",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@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": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down Expand Up @@ -589,13 +595,16 @@ describe('initCreateWhook', () => {
"dependencies": {
"@whook/authorization": "<current_version>",
"@whook/cors": "<current_version>",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@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": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down
3 changes: 3 additions & 0 deletions packages/whook-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@
"dependencies": {
"@whook/authorization": "^13.2.1",
"@whook/cors": "^13.2.1",
"@whook/graphiql": "^13.2.1",
"@whook/graphql": "^13.2.1",
"@whook/http-router": "^13.2.0",
"@whook/http-server": "^13.2.0",
"@whook/http-transaction": "^13.2.0",
"@whook/swagger-ui": "^13.2.1",
"@whook/whook": "^13.2.1",
"application-services": "^4.0.0",
"common-services": "^15.0.0",
"graphql-tag": "^2.12.6",
"http-auth-utils": "^5.0.1",
"jwt-service": "^10.0.4",
"knifecycle": "^17.0.1",
Expand Down
3 changes: 3 additions & 0 deletions packages/whook-example/src/__snapshots__/cli.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ exports[`commands should work with ls 1`] = `
- printEnv: A command printing every env values
# Provided by "@whook/graphql": none
# Provided by "@whook/whook": 8 commands
- config: A simple program that returns the queryed config value
- create: A command helping to create new Whook files easily
Expand Down
4 changes: 4 additions & 0 deletions packages/whook-example/src/config/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ const CONFIG: Omit<AppConfig, 'HOST'> = {
'User-Agent',
].join(','),
},
GRAPHIQL: {
path: '/graphiql',
defaultQuery: '{ hello }',
},
};

export default CONFIG;
1 change: 1 addition & 0 deletions packages/whook-example/src/config/local/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Finally the configuration file for a given environnment
const CONFIG: AppConfig = {
...COMMON_CONFIG,
HOST: 'localhost',
DEV_ACCESS_MECHANISM: 'Fake',
DEV_ACCESS_TOKEN: 'admin|1|1',
DEFAULT_MECHANISM: 'Fake',
OPEN_API_TYPES_CONFIG: {
Expand Down
21 changes: 21 additions & 0 deletions packages/whook-example/src/handlers/getGraphQL.ts
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;
21 changes: 21 additions & 0 deletions packages/whook-example/src/handlers/postGraphQL.ts
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;
Loading

0 comments on commit e10fe00

Please sign in to comment.