@promster/apollo 1.0.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
2
1
  import type { TPromsterOptions } from '@promster/types';
3
2
  import type { TRequestRecorder } from '@promster/metrics';
4
3
  declare const getRequestRecorder: () => TRequestRecorder;
@@ -7,5 +6,5 @@ declare const signalIsNotUp: () => void;
7
6
  type TPluginOptions = {
8
7
  options?: TPromsterOptions;
9
8
  };
10
- declare const createPlugin: ({ options }?: TPluginOptions) => ApolloServerPlugin<import("apollo-server-types").BaseContext>;
9
+ declare const createPlugin: ({ options }?: TPluginOptions) => ApolloServerPlugin;
11
10
  export { createPlugin, getRequestRecorder, signalIsUp, signalIsNotUp };
@@ -74,13 +74,13 @@ const createPlugin = ({
74
74
  const labels = getDefaultLabelsOrSkipMeasurement(parsingRequestContext);
75
75
  if (parseDurationSeconds !== undefined) {
76
76
  var _graphQlMetrics$graph;
77
- (_graphQlMetrics$graph = graphQlMetrics.graphQlParseDuration) === null || _graphQlMetrics$graph === void 0 ? void 0 : _graphQlMetrics$graph.forEach(metric => {
77
+ (_graphQlMetrics$graph = graphQlMetrics.graphQlParseDuration) === null || _graphQlMetrics$graph === void 0 || _graphQlMetrics$graph.forEach(metric => {
78
78
  metric.observe(labels, parseDurationSeconds);
79
79
  });
80
80
  }
81
81
  if (error) {
82
82
  var _graphQlMetrics$graph2;
83
- (_graphQlMetrics$graph2 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph2 === void 0 ? void 0 : _graphQlMetrics$graph2.forEach(metric => {
83
+ (_graphQlMetrics$graph2 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph2 === void 0 || _graphQlMetrics$graph2.forEach(metric => {
84
84
  metric.inc(Object.assign({}, labels, {
85
85
  phase: 'parsing'
86
86
  }));
@@ -97,13 +97,13 @@ const createPlugin = ({
97
97
  const labels = getDefaultLabelsOrSkipMeasurement(validationRequestContext);
98
98
  if (validationDurationSeconds !== undefined) {
99
99
  var _graphQlMetrics$graph3;
100
- (_graphQlMetrics$graph3 = graphQlMetrics.graphQlValidationDuration) === null || _graphQlMetrics$graph3 === void 0 ? void 0 : _graphQlMetrics$graph3.forEach(metric => {
100
+ (_graphQlMetrics$graph3 = graphQlMetrics.graphQlValidationDuration) === null || _graphQlMetrics$graph3 === void 0 || _graphQlMetrics$graph3.forEach(metric => {
101
101
  metric.observe(labels, validationDurationSeconds);
102
102
  });
103
103
  }
104
104
  if (error) {
105
105
  var _graphQlMetrics$graph4;
106
- (_graphQlMetrics$graph4 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph4 === void 0 ? void 0 : _graphQlMetrics$graph4.forEach(metric => {
106
+ (_graphQlMetrics$graph4 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph4 === void 0 || _graphQlMetrics$graph4.forEach(metric => {
107
107
  metric.inc(Object.assign({}, labels, {
108
108
  phase: 'validation'
109
109
  }));
@@ -127,13 +127,13 @@ const createPlugin = ({
127
127
  });
128
128
  if (fieldResolveDurationSeconds !== undefined) {
129
129
  var _graphQlMetrics$graph5;
130
- (_graphQlMetrics$graph5 = graphQlMetrics.graphQlResolveFieldDuration) === null || _graphQlMetrics$graph5 === void 0 ? void 0 : _graphQlMetrics$graph5.forEach(metric => {
130
+ (_graphQlMetrics$graph5 = graphQlMetrics.graphQlResolveFieldDuration) === null || _graphQlMetrics$graph5 === void 0 || _graphQlMetrics$graph5.forEach(metric => {
131
131
  metric.observe(labels, fieldResolveDurationSeconds);
132
132
  });
133
133
  }
134
134
  if (error) {
135
135
  var _graphQlMetrics$graph6;
136
- (_graphQlMetrics$graph6 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph6 === void 0 ? void 0 : _graphQlMetrics$graph6.forEach(metric => {
136
+ (_graphQlMetrics$graph6 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph6 === void 0 || _graphQlMetrics$graph6.forEach(metric => {
137
137
  metric.inc(Object.assign({}, labels, {
138
138
  phase: 'execution'
139
139
  }));
@@ -150,7 +150,7 @@ const createPlugin = ({
150
150
  const labels = getDefaultLabelsOrSkipMeasurement(responseRequestContext);
151
151
  if (requestDurationSeconds !== undefined) {
152
152
  var _graphQlMetrics$graph7;
153
- (_graphQlMetrics$graph7 = graphQlMetrics.graphQlRequestDuration) === null || _graphQlMetrics$graph7 === void 0 ? void 0 : _graphQlMetrics$graph7.forEach(metric => {
153
+ (_graphQlMetrics$graph7 = graphQlMetrics.graphQlRequestDuration) === null || _graphQlMetrics$graph7 === void 0 || _graphQlMetrics$graph7.forEach(metric => {
154
154
  metric.observe(labels, requestDurationSeconds);
155
155
  });
156
156
  }
@@ -74,13 +74,13 @@ const createPlugin = ({
74
74
  const labels = getDefaultLabelsOrSkipMeasurement(parsingRequestContext);
75
75
  if (parseDurationSeconds !== undefined) {
76
76
  var _graphQlMetrics$graph;
77
- (_graphQlMetrics$graph = graphQlMetrics.graphQlParseDuration) === null || _graphQlMetrics$graph === void 0 ? void 0 : _graphQlMetrics$graph.forEach(metric => {
77
+ (_graphQlMetrics$graph = graphQlMetrics.graphQlParseDuration) === null || _graphQlMetrics$graph === void 0 || _graphQlMetrics$graph.forEach(metric => {
78
78
  metric.observe(labels, parseDurationSeconds);
79
79
  });
80
80
  }
81
81
  if (error) {
82
82
  var _graphQlMetrics$graph2;
83
- (_graphQlMetrics$graph2 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph2 === void 0 ? void 0 : _graphQlMetrics$graph2.forEach(metric => {
83
+ (_graphQlMetrics$graph2 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph2 === void 0 || _graphQlMetrics$graph2.forEach(metric => {
84
84
  metric.inc(Object.assign({}, labels, {
85
85
  phase: 'parsing'
86
86
  }));
@@ -97,13 +97,13 @@ const createPlugin = ({
97
97
  const labels = getDefaultLabelsOrSkipMeasurement(validationRequestContext);
98
98
  if (validationDurationSeconds !== undefined) {
99
99
  var _graphQlMetrics$graph3;
100
- (_graphQlMetrics$graph3 = graphQlMetrics.graphQlValidationDuration) === null || _graphQlMetrics$graph3 === void 0 ? void 0 : _graphQlMetrics$graph3.forEach(metric => {
100
+ (_graphQlMetrics$graph3 = graphQlMetrics.graphQlValidationDuration) === null || _graphQlMetrics$graph3 === void 0 || _graphQlMetrics$graph3.forEach(metric => {
101
101
  metric.observe(labels, validationDurationSeconds);
102
102
  });
103
103
  }
104
104
  if (error) {
105
105
  var _graphQlMetrics$graph4;
106
- (_graphQlMetrics$graph4 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph4 === void 0 ? void 0 : _graphQlMetrics$graph4.forEach(metric => {
106
+ (_graphQlMetrics$graph4 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph4 === void 0 || _graphQlMetrics$graph4.forEach(metric => {
107
107
  metric.inc(Object.assign({}, labels, {
108
108
  phase: 'validation'
109
109
  }));
@@ -127,13 +127,13 @@ const createPlugin = ({
127
127
  });
128
128
  if (fieldResolveDurationSeconds !== undefined) {
129
129
  var _graphQlMetrics$graph5;
130
- (_graphQlMetrics$graph5 = graphQlMetrics.graphQlResolveFieldDuration) === null || _graphQlMetrics$graph5 === void 0 ? void 0 : _graphQlMetrics$graph5.forEach(metric => {
130
+ (_graphQlMetrics$graph5 = graphQlMetrics.graphQlResolveFieldDuration) === null || _graphQlMetrics$graph5 === void 0 || _graphQlMetrics$graph5.forEach(metric => {
131
131
  metric.observe(labels, fieldResolveDurationSeconds);
132
132
  });
133
133
  }
134
134
  if (error) {
135
135
  var _graphQlMetrics$graph6;
136
- (_graphQlMetrics$graph6 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph6 === void 0 ? void 0 : _graphQlMetrics$graph6.forEach(metric => {
136
+ (_graphQlMetrics$graph6 = graphQlMetrics.graphQlErrorsTotal) === null || _graphQlMetrics$graph6 === void 0 || _graphQlMetrics$graph6.forEach(metric => {
137
137
  metric.inc(Object.assign({}, labels, {
138
138
  phase: 'execution'
139
139
  }));
@@ -150,7 +150,7 @@ const createPlugin = ({
150
150
  const labels = getDefaultLabelsOrSkipMeasurement(responseRequestContext);
151
151
  if (requestDurationSeconds !== undefined) {
152
152
  var _graphQlMetrics$graph7;
153
- (_graphQlMetrics$graph7 = graphQlMetrics.graphQlRequestDuration) === null || _graphQlMetrics$graph7 === void 0 ? void 0 : _graphQlMetrics$graph7.forEach(metric => {
153
+ (_graphQlMetrics$graph7 = graphQlMetrics.graphQlRequestDuration) === null || _graphQlMetrics$graph7 === void 0 || _graphQlMetrics$graph7.forEach(metric => {
154
154
  metric.observe(labels, requestDurationSeconds);
155
155
  });
156
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promster/apollo",
3
- "version": "1.0.8",
3
+ "version": "2.0.0",
4
4
  "description": "Apollo server integrations of promster",
5
5
  "main": "dist/promster-apollo.cjs.js",
6
6
  "typings": "dist/promster-apollo.cjs.d.ts",
@@ -13,8 +13,8 @@
13
13
  "modules/**"
14
14
  ],
15
15
  "engines": {
16
- "node": ">=14",
17
- "npm": ">=6"
16
+ "node": ">=16",
17
+ "npm": ">=8"
18
18
  },
19
19
  "publishConfig": {
20
20
  "access": "public"
@@ -36,17 +36,18 @@
36
36
  "prometheus"
37
37
  ],
38
38
  "dependencies": {
39
- "@promster/metrics": "^9.1.6",
40
- "apollo-server-plugin-base": "3.7.1",
39
+ "@apollo/server": "4.9.1",
40
+ "@promster/metrics": "^10.0.0",
41
41
  "merge-options": "3.0.4",
42
42
  "tslib": "2.4.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@graphql-tools/schema": "9.0.12",
46
- "@graphql-tools/utils": "9.1.3",
47
- "apollo-server": "3.11.1",
48
- "graphql": "16.6.0",
49
- "node-fetch": "2.6.7",
50
- "parse-prometheus-text-format": "1.1.1"
45
+ "@graphql-tools/schema": "9.0.19",
46
+ "@graphql-tools/utils": "9.2.1",
47
+ "apollo-server": "3.12.0",
48
+ "graphql": "16.7.1",
49
+ "node-fetch": "2.6.11",
50
+ "parse-prometheus-text-format": "1.1.1",
51
+ "@promster/server": "8.0.0"
51
52
  }
52
- }
53
+ }