- Updated dev dependencies.
- Simplified the
executemiddleware using a new private functionassertKoaContextRequestGraphQL. - Improved
executemiddleware related types:- The middleware no longer requires the Koa context to have a
request.bodytype of[key: string]: unknown. - Option
overridenow has a more accurate type for function argument 1context.
- The middleware no longer requires the Koa context to have a
- Tweaked formatting in tests.
- Updated dependencies.
- Fixed TypeScript types for the class
GraphQLAggregateErrorproperties that were unintentionallyany.
- Updated dependencies.
- Use the
node:URL scheme for Node.js builtin module imports in tests. - Revamped the readme:
- Removed the badges.
- Added information about TypeScript config and optimal JavaScript module design.
- Added the
GraphQLAggregateError.mjsmodule to the packageexportsfield.
- Updated Node.js support to
^14.17.0 || ^16.0.0 || >= 18.0.0. - Updated dev dependencies, some of which require newer Node.js versions than previously supported.
- Public modules are now individually listed in the package
filesandexportsfields. - Removed
./packagefrom the packageexportsfield; the fullpackage.jsonfilename must be used in arequirepath. - Removed the package main index module; deep imports must be used.
- Shortened public module deep import paths, removing the
/public/. - The
errorHandlerKoa middleware no longer exposes errorlocationsandpathproperties within the GraphQL response bodyerrorsarray for errors that aren’t GraphQL validation or execution errors. - Implemented TypeScript types via JSDoc comments.
- Updated dependencies.
- Removed the
isobjectdependency. - Simplified dev dependencies and config for ESLint.
- Removed the
jsdoc-mddev dependency and the packagedocs-updateanddocs-checkscripts, replacing the readme “API” section with a manually written “Exports” section. - Check TypeScript types via a new package
typesscript. - Simplified package scripts.
- Updated GitHub Actions CI config:
- Run tests with Node.js v14, v16, v18.
- Updated
actions/checkoutto v3. - Updated
actions/setup-nodeto v3.
- Reorganized the test file structure.
- Improved tests and test helpers.
- Stopped using deprecated
GraphQLErrorconstructor parameters in tests. - Updated the
executeKoa middleware to throw an appropriate HTTP error when the GraphQL operationoperationNameis invalid. - Implemented a more reliable system based on a new
GraphQLAggregateErrorclass for throwing a GraphQL validation or execution aggregate error in theexecuteKoa middleware for special handling in theerrorHandlerKoa middleware. - Updated the
errorHandlerKoa middleware to overwrite an existing Koa contextresponse.bodyif it’s not a suitable object when handling an error. - Configured Prettier option
singleQuoteto the default,false. - Improved documentation.
- Added a
license.mdMIT License file.
- Updated Node.js support to
^12.20.0 || ^14.13.1 || >= 16.0.0. - Updated dev dependencies, some of which require newer Node.js versions than previously supported.
- Updated the
graphqlpeer dependency to^16.0.0. - Updated the
errorHandlerKoa middleware to avoid theformatErrorfunction deprecated ingraphqlv16, using the newGraphQLError.toJSONmethod.
- Also run GitHub Actions CI with Node.js v17.
- Updated Node.js support to
^12.20 || >= 14.13. - Updated dependencies, some of which require newer Node.js versions than previously supported.
- The API is now ESM in
.mjsfiles instead of CJS in.jsfiles, accessible viaimportbut notrequire. - Replaced the the
package.jsonexportsfield public subpath folder mapping (deprecated by Node.js) with a subpath pattern.
- Added a package
sideEffectsfield.
- Stop using
hard-rejectionto detect unhandledPromiserejections in tests, as Node.js v15+ does this natively. - Updated GitHub Actions CI config:
- Updated the tested Node.js versions to v12, v14, v16.
- Updated
actions/checkoutto v2. - Updated
actions/setup-nodeto v2. - Simplify config with the
npm install-testcommand. - Don’t specify the
CIenvironment variable as it’s set by default.
- Removed
npm-debug.logfrom the.gitignorefile as npm v4.2.0+ doesn’t create it in the current working directory. - Simplified JSDoc related package scripts now that
jsdoc-mdv10 automatically generates a Prettier formatted readme. - Added a package
test:jsdocscript that checks the readme API docs are up to date with the source JSDoc. - Readme tweaks.
- Added a package
exportsfield with conditional exports to support native ESM in Node.js and keep internal code private, whilst avoiding the dual package hazard. Published files have been reorganized, so previously undocumented deep imports will need to be rewritten according to the newly documented paths. - Use the
application/graphql+jsoncontent-type instead ofapplication/jsonfor GraphQL requests and responses. This content-type is being standardized in the GraphQL over HTTP specification.
- Updated dev dependencies.
- Updated the EditorConfig URL.
- Stopped testing with Node.js v13.
- Prettier format JSDoc example code.
- Added ESM related keywords to the package
keywordsfield.
- Improved
executemiddleware errors:- More specific error when the operation field
queryisn’t a string. - Use GraphQL errors when the query can’t be parsed due to syntax errors and expose the location of the syntax error to the client.
- More specific error when the operation field
- Updated dev dependencies.
- Updated Node.js support to
^10.13.0 || ^12.0.0 || >= 13.7.0. - Updated dev dependencies, some of which require newer Node.js versions than previously supported.
- Updated the
graphqlpeer dependency to0.13.1 - 15. - Also run GitHub Actions with Node.js v14.
-
Updated dev dependencies.
-
Updated Prettier related package scripts.
-
Configured Prettier option
semito the default,true. -
Ensure GitHub Actions run on pull request.
-
Minor v0.1.0 changelog entry tweak.
-
For clarity, manually specify a
500HTTP status code even though it’s the default when throwing errors viahttp-errors. -
Changed the error that the
executeKoa middleware throws when there are GraphQL execution errors:-
The error is no longer created using
http-errors, which doesn’t easily accept a200status. This allowed the removal of thecreateHttpErrorfunction workaround. -
Changed the error message (an internal change as this message is not exposed to the client by the
errorHandlerKoa middleware):- GraphQL errors. + GraphQL execution errors.
-
-
Updated the
errorHandlerKoa middleware, fixing #8:- It can now handle a non enumerable object error, e.g.
null. - The
extensionsproperty of an error is now always exposed to the client in the payloaderrorsarray, even if the error message is not exposed via anexposeproperty. - Added new
ErrorKoaMiddlewareandErrorGraphQLResolverJSDoc typedefs to better document the special properties errors may have for theerrorHandlerKoa middleware to use to determine how the error appears in the response payloaderrorsarray and the response HTTP status code. - Documented that additional custom Koa middleware can be used to customize the response.
- It can now handle a non enumerable object error, e.g.
-
Renamed the
startServertest helper tolisten.
- Updated dev dependencies.
- Use
isobjectfor checking if values are enumerable, non-array objects. - Destructure GraphQL execute results.
- Added a new overridable
executemiddleware optionexecute, to optionally replace GraphQL.jsexecute. This adds support forgraphql-jit.
- Updated dev dependencies.
- Added a new
hard-rejectiondev dependency to ensure unhandled rejections in tests exit the process with an error. - Reorganized the test files.
- Simplified
test/index.js. - Tweaked some test names.
- Reduced the
executemiddleware per request validation work. - Better handling of invalid GraphQL operation
variablesand GraphQL execution errors.
- ESM is no longer published, due to CJS/ESM compatibility issues across recent Node.js versions.
- The file structure and non-index file exports have changed. This should only affect projects using undocumented deep imports.
- Stop testing the
statusCodeproperty of HTTP errors; they are inconsequential as Koa uses thestatusproperty.
- Updated Node.js support from v8.5+ to v10+.
- Updated dev dependencies, some of which require newer Node.js versions that v8.5.
- Added a package
modulefield. - Setup GitHub Sponsors funding:
- Added
.github/funding.ymlto display a sponsor button in GitHub. - Added a
package.jsonfundingfield to enable npm CLI funding features.
- Added
- Removed the now redundant
eslint-plugin-import-order-alphabeticaldev dependency. - Stop using
huskyandlint-staged. - Replaced the
tapdev dependency withtest-directorandcoverage-node, and refactored tests accordingly. - Added a new
babel-plugin-transform-require-extensionsdev dependency and ensured ESM import specifiers in both source and published.mjsfiles contain file names with extensions, which are mandatory in the final Node.js ESM implementation. Published CJS.jsfiles now also have file extensions inrequirepaths. - Updated the package description and keywords.
- Updated code examples to use CJS instead of ESM.
- Removed
package-lock.jsonfrom.gitignoreand.prettierignoreas it’s disabled in.npmrcanyway. - Use strict mode for scripts.
- Use GitHub Actions instead of Travis for CI.
- Use jsDelivr for the readme logo instead of RawGit as they are shutting down.
- Added a new
executemiddlewarevalidationRulesoption.
- Updated dev dependencies.
- Ensure only desired
executemiddleware options apply to the GraphQLexecutefunction. - Move tests to files adjacent to source files.
- Renamed the
isPlainObjecthelper toisEnumerableObjectand added tests. - Moved
isEnumerableObjectchecks into thecheckOptionshelper and added tests. - Renamed the
checkSchemahelper tocheckGraphQLSchemaand added tests. - Tweaked option related error messages.
- Significantly simplified test assertions using
t.throwsandt.match. - Moved JSDoc type defs into
src/index.js. - Renamed the
MiddlewareOptionsOverrideJSDoc type toExecuteOptionsOverride. - Tweaked JSDoc descriptions.
- Consistent JSDoc syntax style for array types.
- Prettier
errorHandlerJSDoc example source code formatting. - Moved an
executemiddleware constant from function to module scope. - Added “Minor” and “Patch” subheadings to old changelog entries.
executemiddleware now throws an appropriate error when theschemaoption is undefined, without an override.
- Updated dependencies.
- Cleaner readme “API” section table of contents with “See” and “Examples” headings excluded, thanks to
jsdoc-mdv3.1.0. - Removed the
watchscript andwatchdev dependency. - Redid the test scripts and added a
.nycrc.jsonfile for improved reporting and code coverage. - Simplified the
prepublishOnlyscript. - Reduced the size of the published
package.jsonby moving dev tool config to files. - Removed the package
modulefield. By default webpack resolves extensionless paths the same way Node.js (prior to v12) in--experimental-modulesmode does;.mjsfiles are preferred. Tools misconfigured or unable to resolve.mjscan get confused whenmodulepoints to an.mjsESM file and they attempt to resolve named imports from.jsCJS files. - Enforced 100% code coverage for tests.
- Test
errorHandlermiddleware handles an error correctly afterctx.response.bodywas set. - Added the Open Graph image design to the logo Sketch file.
- Errors thrown in resolvers without an
expose: trueproperty have their message masked byInternal Server Errorin the response body to prevent client exposure. Koa app listeners and middleware still have access to the original errors.
- Fix event listeners added in v1.1.1 to be compatible with Node.js < v10.
- Downgrade
node-fetchto fix--experimental-modulestests for Node.js < v10.2.0 (see bitinn/node-fetch#502).
- Updated dependencies.
- Updated package scripts and config for the new
huskyversion. - Silence the
http-errors deprecated non-error status code; use only 4xx or 5xx status codeswarnings that appear (due to jshttp/http-errors#50) when there are GraphQL errors. - Expanded the source into separate files for easier code navigation.
- Add a project logo.
- Support
graphqlv14.
- Updated dependencies.
- Stopped using
npm-run-allfor package scripts. - Configured Prettier to lint
.ymlfiles. - Ensure the readme Travis build status badge only tracks
masterbranch. - Use Badgen for the readme npm version badge.
- Updated dependencies.
- Lint fixes following dependency updates.
- Use
jsdoc-mdinstead ofdocumentationto generate readme API docs. - Removed a temporary workaround for a fixed Babel CLI bug.
- Updated package description and tags.
- Updated dependencies.
- Simplified ESLint config with
eslint-config-env.
- Refactored package scripts to use
prepareto support installation via Git (e.g.npm install jaydenseric/graphql-api-koa).
- Corrected an
errorHandlermiddleware example in the readme. - Compact package
repositoryfield.
- Set Node.js support as v8.5+.
- Avoided using a Koa context response shortcut.
- Fixed test snapshot consistency between Node.js versions (see tapjs/node-tap#450).
- Manually test error properties instead of using snapshots.
- Added
errorHandlermiddleware tests. - Readme badge changes to deal with shields.io unreliability:
- Used the more reliable build status badge provided by Travis and placed it first as it loads the quickest.
- Removed the licence badge. The licence can be found in
package.jsonand rarely changes. - Removed the Github issues and stars badges. The readme is most viewed on Github anyway.
- Improved documentation.
Initial release.