@newrelic/apollo-server-plugin
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -1,2 +0,3 @@ | ||
import type { ApolloServerPlugin } from "apollo-server-plugin-base"; | ||
import type { ApolloServerPlugin as Base } from 'apollo-server-plugin-base'; | ||
import type { ApolloServerPlugin } from '@apollo/server'; | ||
@@ -10,2 +11,2 @@ export type NRPluginConfig = { | ||
export default function createPlugin(config?: NRPluginConfig): ApolloServerPlugin; | ||
export default function createPlugin<T>(config?: NRPluginConfig): T extends ApolloServerPlugin ? ApolloServerPlugin : Base; |
{ | ||
"name": "@newrelic/apollo-server-plugin", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Apollo Server plugin that adds New Relic Node.js agent instrumentation.", | ||
@@ -8,3 +8,3 @@ "main": "./index.js", | ||
"scripts": { | ||
"integration": "rm -f newrelic_agent.log && time tap --test-regex='(\\/|^tests\\/integration\\/.*\\.test\\.js)$' --no-coverage", | ||
"integration": "rm -f newrelic_agent.log && time c8 -o ./coverage/integration tap --test-regex='(\\/|^tests\\/integration\\/.*\\.test\\.js)$' --no-coverage", | ||
"lint": "eslint *.js lib tests", | ||
@@ -15,9 +15,9 @@ "lint:fix": "eslint --fix *.js lib tests", | ||
"third-party-updates": "oss third-party manifest && oss third-party notices && git add THIRD_PARTY_NOTICES.md third_party_manifest.json", | ||
"unit": "tap --test-regex='(\\/|^tests\\/unit\\/.*\\.test\\.js)$' --no-coverage", | ||
"unit": "c8 -o ./coverage/unit tap --test-regex='(\\/|^tests\\/unit\\/.*\\.test\\.js)$' --no-coverage", | ||
"type-check": "tsd", | ||
"versioned": "npm run versioned:npm7", | ||
"versioned:folder": "versioned-tests --minor --all -i 2", | ||
"versioned:major": "versioned-tests --major --all -i 2 'tests/versioned/*'", | ||
"versioned:npm6": "versioned-tests --minor --samples 15 -i 2 'tests/versioned/*'", | ||
"versioned:npm7": "versioned-tests --minor --all --samples 15 -i 2 'tests/versioned/*'" | ||
"versioned:major": "VERSIONED_MODE=--major npm run versioned:npm7", | ||
"versioned:npm6": "./bin/run-versioned-tests.sh", | ||
"versioned:npm7": "NPM7=1 ./bin/run-versioned-tests.sh" | ||
}, | ||
@@ -43,6 +43,8 @@ "files": [ | ||
"devDependencies": { | ||
"@apollo/server": "^4.1.1", | ||
"@newrelic/eslint-config": "^0.0.2", | ||
"@newrelic/newrelic-oss-cli": "^0.1.2", | ||
"@newrelic/test-utilities": "^6.5.2", | ||
"apollo-server": "^2.18.2", | ||
"apollo-server": "^3.11.1", | ||
"c8": "^7.12.0", | ||
"eslint": "^7.32.0", | ||
@@ -53,3 +55,3 @@ "eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"graphql": "^15.8.0", | ||
"graphql": "^16.6.0", | ||
"husky": "^6.0.0", | ||
@@ -64,3 +66,2 @@ "lint-staged": "^11.0.0", | ||
"peerDependencies": { | ||
"apollo-server-plugin-base": ">=0.10.1", | ||
"newrelic": ">=6.13.0" | ||
@@ -67,0 +68,0 @@ }, |
@@ -1,6 +0,7 @@ | ||
[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus) | ||
[![Community Plus header](https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus) | ||
# New Relic Apollo Server plugin ![Apollo Server Plugin CI](https://github.com/newrelic/newrelic-node-apollo-server-plugin/workflows/Apollo%20Server%20Plugin%20CI/badge.svg) | ||
# New Relic Apollo Server plugin | ||
[![npm status badge][5]][6] [![Apollo Server Plugin CI][1]][2] [![codecov][3]][4] | ||
New Relic's official Apollo Server plugin for use with the [Node.js agent](https://github.com/newrelic/node-newrelic). | ||
New Relic's official Apollo Server plugin for use with the [Node.js agent](https://github.com/newrelic/node-newrelic). The supported Apollo Server version is 2.14 or later. | ||
@@ -46,6 +47,26 @@ This plugin expects the Node.js agent [newrelic npm package](https://www.npmjs.com/package/newrelic) has already been installed in your application. | ||
**Note**: If you are using typescript and `@apollo/server` to load the plugin, you must pass in the appropriate `ApolloServerPlugin` type. | ||
```ts | ||
// index.ts | ||
import { ApolloServerPlugin, ApolloServer } from '@apollo/server'; | ||
import createNewRelicPlugin from '@newrelic/apollo-server-plugin'; | ||
const newRelicPlugin = createNewRelicPlugin<ApolloServerPlugin>({}) | ||
const server = new ApolloServer({ | ||
typeDefs, | ||
resolvers, | ||
plugins: [ | ||
newRelicPlugin, | ||
], | ||
}); | ||
``` | ||
## Usage | ||
The New Relic plugin is known to work with the following Apollo Server modules: | ||
* apollo-server | ||
* @apollo/server | ||
* apollo-server (>= 2.14) | ||
* apollo-server-express | ||
@@ -294,1 +315,8 @@ * apollo-server-hapi | ||
The New Relic Apollo Server plugin also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document. | ||
[1]: https://github.com/newrelic/newrelic-node-apollo-server-plugin/workflows/Apollo%20Server%20Plugin%20CI/badge.svg | ||
[2]: https://github.com/newrelic/newrelic-node-apollo-server-plugin/actions/workflows/ci-workflow.yml | ||
[3]: https://codecov.io/gh/newrelic/newrelic-node-apollo-server-plugin/branch/main/graph/badge.svg?token=89T0ZLX43N | ||
[4]: https://codecov.io/gh/newrelic/newrelic-node-apollo-server-plugin | ||
[5]: https://img.shields.io/npm/v/@newrelic/apollo-server-plugin.svg | ||
[6]: https://www.npmjs.com/package/@newrelic/apollo-server-plugin |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50279
1
532
321
19