Skip to content

Commit f416982

Browse files
committed
Rename instruments to instrumentation
1 parent 7251f5f commit f416982

File tree

6 files changed

+30
-15
lines changed

6 files changed

+30
-15
lines changed

.changeset/vast-spies-joke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-mesh/utils': patch
3+
---
4+
5+
Rename instruments to instrumentation

packages/legacy/utils/CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- [#8456](https://github.com/ardatan/graphql-mesh/pull/8456)
88
[`4528794`](https://github.com/ardatan/graphql-mesh/commit/45287948dbfbe07c3f60f9c36253099c549207d9)
99
Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Add compatibility with new
10-
`Instruments` API of Hive Gateway. See
11-
[Hive Gateway documentation](https://the-guild.dev/graphql/hive/docs/gateway/other-features/custom-plugins#instruments)
10+
`instrumentation` API of Hive Gateway. See
11+
[Hive Gateway documentation](https://the-guild.dev/graphql/hive/docs/gateway/other-features/custom-plugins#instrumentation)
1212
for more details.
1313

1414
### Patch Changes
@@ -17,7 +17,7 @@
1717
[`4528794`](https://github.com/ardatan/graphql-mesh/commit/45287948dbfbe07c3f60f9c36253099c549207d9)
1818
Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
1919
- Added dependency
20-
[`@envelop/instruments@^1.0.0` ↗︎](https://www.npmjs.com/package/@envelop/instruments/v/1.0.0)
20+
[`@envelop/instrumentation@^1.0.0` ↗︎](https://www.npmjs.com/package/@envelop/instrumentation/v/1.0.0)
2121
(to `dependencies`)
2222
- Updated dependencies []:
2323
- @graphql-mesh/types@0.104.0

packages/legacy/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"graphql": "*"
3636
},
3737
"dependencies": {
38-
"@envelop/instruments": "^1.0.0",
38+
"@envelop/instrumentation": "^1.0.0",
3939
"@graphql-mesh/cross-helpers": "^0.4.10",
4040
"@graphql-mesh/string-interpolation": "^0.5.8",
4141
"@graphql-mesh/types": "^0.104.0",

packages/legacy/utils/src/wrapFetchWithHooks.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getInstrumented } from '@envelop/instruments';
1+
import { getInstrumented } from '@envelop/instrumentation';
22
import type { Logger, MeshFetch, OnFetchHook, OnFetchHookDone } from '@graphql-mesh/types';
33
import { type ExecutionRequest, type MaybePromise } from '@graphql-tools/utils';
44
import { handleMaybePromise, iterateAsync } from '@whatwg-node/promise-helpers';
@@ -7,7 +7,7 @@ import { DefaultLogger } from './logger.js';
77
export const requestIdByRequest = new WeakMap<Request, string>();
88
export const loggerForExecutionRequest = new WeakMap<ExecutionRequest, Logger>();
99

10-
export type FetchInstruments = {
10+
export type FetchInstrumentation = {
1111
fetch?: (
1212
payload: { executionRequest: ExecutionRequest },
1313
wrapped: () => MaybePromise<void>,
@@ -16,7 +16,7 @@ export type FetchInstruments = {
1616

1717
export function wrapFetchWithHooks<TContext>(
1818
onFetchHooks: OnFetchHook<TContext>[],
19-
instruments?: () => FetchInstruments | undefined,
19+
instrumentation?: () => FetchInstrumentation | undefined,
2020
): MeshFetch {
2121
let wrappedFetchFn = function wrappedFetchFn(url, options, context, info) {
2222
let fetchFn: MeshFetch;
@@ -103,10 +103,10 @@ export function wrapFetchWithHooks<TContext>(
103103
);
104104
} as MeshFetch;
105105

106-
if (instruments) {
106+
if (instrumentation) {
107107
const originalWrappedFetch = wrappedFetchFn;
108108
wrappedFetchFn = function wrappedFetchFn(url, options, context, info) {
109-
const fetchInstrument = instruments()?.fetch;
109+
const fetchInstrument = instrumentation()?.fetch;
110110
const instrumentedFetch = fetchInstrument
111111
? getInstrumented({
112112
get executionRequest() {

packages/legacy/utils/test/fetch-instruments.spec.ts renamed to packages/legacy/utils/test/fetch-instrumentation.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { GraphQLResolveInfo } from 'graphql';
22
import { createServerAdapter, Response } from '@whatwg-node/server';
3-
import { wrapFetchWithHooks, type FetchInstruments } from '../src/wrapFetchWithHooks';
3+
import { wrapFetchWithHooks, type FetchInstrumentation } from '../src/wrapFetchWithHooks';
44

5-
describe('Fetch instruments', () => {
6-
it('should wrap fetch instruments', async () => {
5+
describe('Fetch instrumentation', () => {
6+
it('should wrap fetch instrumentation', async () => {
77
await using adapter = createServerAdapter(() => Response.json({ hello: 'world' }));
88
let receivedExecutionRequest;
9-
const fetchInstruments: FetchInstruments = {
9+
const fetchInstrumentation: FetchInstrumentation = {
1010
fetch: async ({ executionRequest }, wrapped) => {
1111
receivedExecutionRequest = executionRequest;
1212
await wrapped();
@@ -18,7 +18,7 @@ describe('Fetch instruments', () => {
1818
setFetchFn(adapter.fetch);
1919
},
2020
],
21-
() => fetchInstruments,
21+
() => fetchInstrumentation,
2222
);
2323
const executionRequest = {};
2424
const res = await wrappedFetch('http://localhost:4000', {}, {}, {

yarn.lock

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4080,6 +4080,16 @@ __metadata:
40804080
languageName: node
40814081
linkType: hard
40824082

4083+
"@envelop/instrumentation@npm:^1.0.0":
4084+
version: 1.0.0
4085+
resolution: "@envelop/instrumentation@npm:1.0.0"
4086+
dependencies:
4087+
"@whatwg-node/promise-helpers": "npm:^1.2.1"
4088+
tslib: "npm:^2.5.0"
4089+
checksum: 10c0/134df1ac481fb392aafc4522a22bcdc6ef0701f2d15d51b16207f3c9a4c7d3760adfa5f5bcc84f0c0ec7b011d84bcd40fff671eb471bed54bd928c165994b4e3
4090+
languageName: node
4091+
linkType: hard
4092+
40834093
"@envelop/instruments@npm:1.0.0, @envelop/instruments@npm:^1.0.0":
40844094
version: 1.0.0
40854095
resolution: "@envelop/instruments@npm:1.0.0"
@@ -7982,7 +7992,7 @@ __metadata:
79827992
resolution: "@graphql-mesh/utils@workspace:packages/legacy/utils"
79837993
dependencies:
79847994
"@apollo/server": "npm:4.11.3"
7985-
"@envelop/instruments": "npm:^1.0.0"
7995+
"@envelop/instrumentation": "npm:^1.0.0"
79867996
"@graphql-mesh/cross-helpers": "npm:^0.4.10"
79877997
"@graphql-mesh/string-interpolation": "npm:^0.5.8"
79887998
"@graphql-mesh/types": "npm:^0.104.0"

0 commit comments

Comments
 (0)