From bfd89297b0fe4dbdd0fecff8c35c316e874b9a56 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Mon, 25 Nov 2024 23:53:07 +0300 Subject: [PATCH] enhance(utils/runtime): move `getInContextSDK` to utils --- .changeset/metal-buses-reflect.md | 6 ++++++ packages/legacy/runtime/src/get-mesh.ts | 2 +- packages/legacy/runtime/src/index.ts | 2 +- packages/legacy/utils/package.json | 2 ++ packages/legacy/{runtime => utils}/src/in-context-sdk.ts | 5 +++-- packages/legacy/utils/src/index.ts | 1 + yarn.lock | 2 ++ 7 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .changeset/metal-buses-reflect.md rename packages/legacy/{runtime => utils}/src/in-context-sdk.ts (98%) diff --git a/.changeset/metal-buses-reflect.md b/.changeset/metal-buses-reflect.md new file mode 100644 index 0000000000000..b65cc80b5a2fc --- /dev/null +++ b/.changeset/metal-buses-reflect.md @@ -0,0 +1,6 @@ +--- +'@graphql-mesh/runtime': patch +'@graphql-mesh/utils': patch +--- + +Move \`getInContextSDK\` from runtime to utils diff --git a/packages/legacy/runtime/src/get-mesh.ts b/packages/legacy/runtime/src/get-mesh.ts index 948d7515d590b..f3dcc5b7f3008 100644 --- a/packages/legacy/runtime/src/get-mesh.ts +++ b/packages/legacy/runtime/src/get-mesh.ts @@ -40,8 +40,8 @@ import { } from '@graphql-tools/utils'; import { wrapSchema } from '@graphql-tools/wrap'; import { fetch as defaultFetchFn } from '@whatwg-node/fetch'; +import { getInContextSDK } from '../../utils/src/in-context-sdk.js'; import { MESH_CONTEXT_SYMBOL } from './constants.js'; -import { getInContextSDK } from './in-context-sdk.js'; import type { ExecuteMeshFn, GetMeshOptions, MeshExecutor, SubscribeMeshFn } from './types.js'; import { getOriginalError } from './utils.js'; diff --git a/packages/legacy/runtime/src/index.ts b/packages/legacy/runtime/src/index.ts index 2fcd262793f27..270f88466e372 100644 --- a/packages/legacy/runtime/src/index.ts +++ b/packages/legacy/runtime/src/index.ts @@ -1,3 +1,3 @@ export * from './get-mesh.js'; export type * from './types.js'; -export * from './in-context-sdk.js'; +export { getInContextSDK } from '@graphql-mesh/utils'; diff --git a/packages/legacy/utils/package.json b/packages/legacy/utils/package.json index c75aadbb17631..ede29a20015fc 100644 --- a/packages/legacy/utils/package.json +++ b/packages/legacy/utils/package.json @@ -40,7 +40,9 @@ }, "dependencies": { "@graphql-mesh/string-interpolation": "^0.5.6", + "@graphql-tools/batch-delegate": "^9.0.16", "@graphql-tools/delegate": "^10.0.28", + "@graphql-tools/wrap": "^10.0.18", "@whatwg-node/disposablestack": "^0.0.5", "@whatwg-node/fetch": "^0.10.0", "dset": "^3.1.2", diff --git a/packages/legacy/runtime/src/in-context-sdk.ts b/packages/legacy/utils/src/in-context-sdk.ts similarity index 98% rename from packages/legacy/runtime/src/in-context-sdk.ts rename to packages/legacy/utils/src/in-context-sdk.ts index 00c15403f085b..f1a4154e9a75b 100644 --- a/packages/legacy/runtime/src/in-context-sdk.ts +++ b/packages/legacy/utils/src/in-context-sdk.ts @@ -18,7 +18,6 @@ import type { SelectionSetParam, SelectionSetParamOrFactory, } from '@graphql-mesh/types'; -import { iterateAsync, parseWithCache } from '@graphql-mesh/utils'; import type { BatchDelegateOptions } from '@graphql-tools/batch-delegate'; import { batchDelegateToSchema } from '@graphql-tools/batch-delegate'; import type { @@ -34,7 +33,9 @@ import { memoize1, } from '@graphql-tools/utils'; import { WrapQuery } from '@graphql-tools/wrap'; -import { MESH_API_CONTEXT_SYMBOL } from './constants.js'; +import { MESH_API_CONTEXT_SYMBOL } from '../../runtime/src/constants.js'; +import { iterateAsync } from './iterateAsync.js'; +import { parseWithCache } from './parseAndPrintWithCache.js'; export function getInContextSDK( unifiedSchema: GraphQLSchema, diff --git a/packages/legacy/utils/src/index.ts b/packages/legacy/utils/src/index.ts index 4443b06fd152a..c86386c93dd5d 100644 --- a/packages/legacy/utils/src/index.ts +++ b/packages/legacy/utils/src/index.ts @@ -25,3 +25,4 @@ export * from './registerTerminateHandler.js'; export * from './getAdditionalResolversFromTypeDefs.js'; export * from './get-def-directives.js'; export * from './disposable.js'; +export * from './in-context-sdk.js'; diff --git a/yarn.lock b/yarn.lock index ed9575366e4a7..a5642802fb187 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7323,7 +7323,9 @@ __metadata: dependencies: "@apollo/server": "npm:4.11.2" "@graphql-mesh/string-interpolation": "npm:^0.5.6" + "@graphql-tools/batch-delegate": "npm:^9.0.16" "@graphql-tools/delegate": "npm:^10.0.28" + "@graphql-tools/wrap": "npm:^10.0.18" "@types/js-yaml": "npm:4.0.9" "@types/lodash.topath": "npm:4.5.9" "@types/object-hash": "npm:3.0.6"