Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump @babel/traverse from 7.15.4 to 7.23.3 #61

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/src/read-schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'apollo-server-express';
import { gql } from 'graphql-tag';
import { readFileSync } from 'fs';
import { DocumentNode } from 'graphql';
import { resolve } from 'path';
Expand Down
6 changes: 4 additions & 2 deletions example/src/start-server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ApolloServer } from 'apollo-server-express';
import { ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4';
import express from 'express';
import { json } from 'body-parser';

import { createPrometheusExporterPlugin } from '../../lib/src';

Expand All @@ -23,7 +25,7 @@ export async function startServer(port: number = 4000, hostname: string = '0.0.0

await server.start();

server.applyMiddleware({ app, path: '/' });
app.use('/', json(), expressMiddleware(server));

try {
app.listen(port, hostname, () => {
Expand Down
12 changes: 6 additions & 6 deletions lib/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
GraphQLRequestContextExecutionDidStart,
GraphQLRequestContextParsingDidStart,
GraphQLRequestContextValidationDidStart,
GraphQLRequestContextWillSendResponse
} from 'apollo-server-plugin-base';
import { GraphQLFieldResolverParams } from 'apollo-server-types';
GraphQLRequestContextWillSendResponse,
GraphQLFieldResolverParams
} from '@apollo/server';
import { Express } from 'express';
import { DefaultMetricsCollectorConfiguration, LabelValues, register, Registry } from 'prom-client';

Expand All @@ -32,7 +32,7 @@ export interface Args {
[p: string]: any;
}

export interface SkipMetricsMap<C = AppContext, S = Source, A = Args> {
export interface SkipMetricsMap<C extends BaseContext = AppContext, S = Source, A = Args> {
[MetricsNames.SERVER_STARTING]: SkipFn<ServerLabels>;
[MetricsNames.SERVER_CLOSING]: SkipFn<ServerLabels>;
[MetricsNames.QUERY_STARTED]: SkipFnWithContext<QueryLabels, GraphQLRequestContext<C>>;
Expand All @@ -55,7 +55,7 @@ export interface SkipMetricsMap<C = AppContext, S = Source, A = Args> {
>;
}

export interface Context<C = AppContext, S = Source, A = Args> {
export interface Context<C extends BaseContext = AppContext, S = Source, A = Args> {
app: Express;
defaultLabels: LabelValues<string>;
defaultMetrics: boolean;
Expand All @@ -70,7 +70,7 @@ export interface Context<C = AppContext, S = Source, A = Args> {
skipMetrics: SkipMetricsMap<C, S, A>;
}

export function generateContext<C = BaseContext, S = Source, A = Args>(
export function generateContext<C extends AppContext = BaseContext, S = Source, A = Args>(
options: PluginOptions<C, S, A>
): Context<C, S, A> {
const context: Context<C, S, A> = {
Expand Down
6 changes: 2 additions & 4 deletions lib/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import apolloPackageJson from 'apollo-server-express/package.json';
import { ApolloServerPlugin } from 'apollo-server-plugin-base';
import { GraphQLFieldResolverParams } from 'apollo-server-types';
import { ApolloServerPlugin, GraphQLFieldResolverParams } from '@apollo/server';
import { Path } from 'graphql/jsutils/Path';
import { Counter, Gauge, Histogram, LabelValues } from 'prom-client';

Expand All @@ -26,7 +24,7 @@ export function countFieldAncestors(path: Path | undefined): string {
}

export function getApolloServerVersion(): string | undefined {
return apolloPackageJson.version ? `v${apolloPackageJson.version}` : undefined;
return undefined;
}

export function getLabelsFromFieldResolver({
Expand Down
8 changes: 4 additions & 4 deletions lib/src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
GraphQLRequestContextExecutionDidStart,
GraphQLRequestContextParsingDidStart,
GraphQLRequestContextValidationDidStart,
GraphQLRequestContextWillSendResponse
} from 'apollo-server-plugin-base';
import { GraphQLFieldResolverParams } from 'apollo-server-types';
GraphQLRequestContextWillSendResponse,
GraphQLFieldResolverParams
} from '@apollo/server';
import { Counter, Gauge, Histogram, LabelValues, Metric, Registry } from 'prom-client';

import { AppContext, Args, Context, Source } from './context';
Expand Down Expand Up @@ -188,7 +188,7 @@ export type Metrics = {
};
};

export function generateMetrics<C = AppContext, S = Source, A = Args>(
export function generateMetrics<C extends BaseContext = AppContext, S = Source, A = Args>(
register: Registry,
{ durationHistogramsBuckets, skipMetrics }: Context<C, S, A>
): Metrics {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApolloServerPlugin, BaseContext } from 'apollo-server-plugin-base';
import { ApolloServerPlugin, BaseContext } from '@apollo/server';
import { hostname } from 'os';
import { collectDefaultMetrics, Registry } from 'prom-client';

Expand All @@ -18,7 +18,7 @@ export type PluginOptions<C extends BaseContext = BaseContext, S = any, A = { [p
}
>;

export function toggleDefaultMetrics<C = AppContext, S = Source, A = Args>(
export function toggleDefaultMetrics<C extends BaseContext = AppContext, S = Source, A = Args>(
register: Registry,
{ defaultMetrics, defaultMetricsOptions }: Context<C, S, A>
) {
Expand All @@ -30,7 +30,7 @@ export function toggleDefaultMetrics<C = AppContext, S = Source, A = Args>(
}
}

export function setDefaultLabels<C = AppContext, S = Source, A = Args>(
export function setDefaultLabels<C extends BaseContext = AppContext, S = Source, A = Args>(
register: Registry,
{ defaultLabels, hostnameLabel, hostnameLabelName }: Context<C, S, A>
) {
Expand All @@ -42,7 +42,7 @@ export function setDefaultLabels<C = AppContext, S = Source, A = Args>(
register.setDefaultLabels(labels);
}

export function toggleEndpoint<C = AppContext, S = Source, A = Args>(
export function toggleEndpoint<C extends BaseContext = AppContext, S = Source, A = Args>(
register: Registry,
{ metricsEndpoint, app, metricsEndpointPath }: Context<C, S, A>
) {
Expand All @@ -55,7 +55,7 @@ export function toggleEndpoint<C = AppContext, S = Source, A = Args>(
}
}

export function createPlugin<C = AppContext, S = Source, A = Args>(
export function createPlugin<C extends BaseContext = AppContext, S = Source, A = Args>(
options: PluginOptions<C, S, A>
): ApolloServerPlugin {
const context = generateContext<C, S, A>(options);
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,20 @@
"lib:release": "semantic-release"
},
"devDependencies": {
"@graphql-codegen/cli": "^2.2.1",
"@graphql-codegen/typescript": "^2.2.4",
"@graphql-codegen/typescript-resolvers": "^2.3.2",
"@apollo/server": "^4.0.2",
"@graphql-codegen/cli": "^2.13.7",
"@graphql-codegen/typescript": "^2.7.5",
"@graphql-codegen/typescript-resolvers": "^2.7.5",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@types/node": "^16.11.3",
"@types/uuid": "^8.3.1",
"apollo-server-express": "^3.4.0",
"apollo-server-plugin-base": "^3.3.0",
"apollo-server-types": "^3.3.0",
"artillery": "^1.7.9",
"body-parser": "^1.20.1",
"copyfiles": "^2.4.1",
"express": "^4.17.1",
"graphql": "^15.6.1",
"graphql-tools": "^8.2.0",
"graphql": "^16.6.0",
"graphql-tag": "^2.12.6",
"husky": "^7.0.4",
"lint-staged": "^11.2.3",
"nodemon": "^2.0.14",
Expand All @@ -59,8 +58,9 @@
"prom-client": "^14.0.0",
"rimraf": "^3.0.2",
"semantic-release": "^18.0.0",
"ts-node": "^10.3.1",
"typescript": "^4.4.4",
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"uuid": "^8.3.2"
}
},
"dependencies": {}
}
Loading