generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
errorFormatter
relative to project root and improved merging o…
…f protocol config (#129) * Create a symlink to self to enable test projects to require `@cap-js/graphql` * Revert "Create a symlink to self to enable test projects to require `@cap-js/graphql`" This reverts commit 60d7d0f. * Add dev dependency to self * Re-add self requires in tests * Configure protocol path in test project `package.json` * Improve merging of protocol configuration with plugin defaults * Replace more programmatic with declarative configs * Load custom `errorFormatter` relative to CDS project root * Single quotes instead of double quotes * Remove `impl` from config * Improve readability of loading error formatter * Another declarative instead of programmatic config * Simpler programmatic config that points to module name * Reorder imports
- Loading branch information
Showing
17 changed files
with
55 additions
and
48 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const cds = require('@sap/cds') | ||
require('./lib/api').registerCompileTargets() | ||
const defaults = { path: '/graphql', impl: '@cap-js/graphql' } | ||
const protocols = cds.env.protocols ??= {} | ||
if (!protocols.graphql) protocols.graphql = { | ||
path: "/graphql", impl: "@cap-js/graphql" | ||
} | ||
protocols.graphql ??= {} | ||
protocols.graphql = { ...defaults, ...protocols.graphql} |
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,12 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
}, | ||
"cds": { | ||
"protocols": { | ||
"graphql": { | ||
"path": "/custom-graphql-path" | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "../../.." | ||
"@cap-js/graphql": "*" | ||
}, | ||
"cds": { | ||
"requires": { | ||
|
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
} | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
} | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
}, | ||
"cds": { | ||
"protocols": { | ||
"graphql": { | ||
"path": "/graphql", | ||
"errorFormatter": "customErrorFormatter" | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
const cds = require('@sap/cds') | ||
const path = require('path') | ||
// Programmatic configuration of GraphQL protocol adapter | ||
const protocols = cds.env.protocols ??= {} | ||
if (!protocols.graphql) protocols.graphql = { | ||
path: '/graphql', impl: path.join(__dirname, '../../../index.js') | ||
} | ||
protocols.graphql = { path: '/graphql', impl: '@cap-js/graphql' } |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
}, | ||
"cds": { | ||
"requires": { | ||
"db": { | ||
|
This file was deleted.
Oops, something went wrong.