Skip to content

Commit

Permalink
upgrade to pnpm v9 (#3249)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Cocaud <[email protected]>
  • Loading branch information
YassinEldeeb and EmrysMyrddin authored May 27, 2024
1 parent 00cdff8 commit 7df6fb1
Show file tree
Hide file tree
Showing 5 changed files with 21,464 additions and 17,327 deletions.
1 change: 1 addition & 0 deletions examples/gcp-cloud-run/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": "",
"author": "",
"license": "MIT",
"private": true,
"main": "src/index.js",
"scripts": {
"start": "node ."
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
],
"license": "MIT",
"private": true,
"packageManager": "pnpm@8.6.1",
"packageManager": "pnpm@9.1.3",
"engines": {
"node": ">=18.0.0",
"pnpm": ">=8.6.1"
"pnpm": ">=9.1.3"
},
"keywords": [
"graphql",
Expand Down
69 changes: 63 additions & 6 deletions packages/plugins/sofa/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ExecutionArgs, ExecutionResult, SubscriptionArgs } from 'graphql';
import { Plugin, YogaInitialContext, YogaServerInstance } from 'graphql-yoga';
import { useSofa as createSofaHandler } from 'sofa-api';
import { SofaHandler } from './types.js';
Expand Down Expand Up @@ -37,19 +38,75 @@ export function useSofa(config: SofaPluginConfig): Plugin {
envelopedByContext.set(contextValue as YogaInitialContext, enveloped);
return contextValue;
},
execute(args) {
const enveloped = envelopedByContext.get(args.contextValue as YogaInitialContext);
execute(
...args:
| [ExecutionArgs]
| [
schema: ExecutionArgs['schema'],
document: ExecutionArgs['document'],
rootValue?: ExecutionArgs['rootValue'],
contextValue?: ExecutionArgs['contextValue'],
variableValues?: ExecutionArgs['variableValues'],
operationName?: ExecutionArgs['operationName'],
fieldResolver?: ExecutionArgs['fieldResolver'],
typeResolver?: ExecutionArgs['typeResolver'],
]
): Promise<ExecutionResult> {
const executionArgs =
args.length === 1
? args[0]
: {
schema: args[0],
document: args[1],
rootValue: args[2],
contextValue: args[3],
variableValues: args[4],
operationName: args[5],
fieldResolver: args[6],
typeResolver: args[7],
};
const enveloped = envelopedByContext.get(
executionArgs.contextValue as YogaInitialContext,
);
if (!enveloped) {
throw new TypeError('Illegal invocation.');
}
return enveloped.execute(args);
return enveloped.execute(executionArgs);
},
subscribe(args) {
const enveloped = envelopedByContext.get(args.contextValue as YogaInitialContext);
subscribe(
...args:
| [SubscriptionArgs | ExecutionArgs]
| [
schema: SubscriptionArgs['schema'],
document: SubscriptionArgs['document'],
rootValue?: SubscriptionArgs['rootValue'],
contextValue?: SubscriptionArgs['contextValue'],
variableValues?: SubscriptionArgs['variableValues'],
operationName?: SubscriptionArgs['operationName'],
fieldResolver?: SubscriptionArgs['fieldResolver'],
subscribeFieldResolver?: SubscriptionArgs['subscribeFieldResolver'],
]
) {
const subscriptionArgs =
args.length === 1
? args[0]
: {
schema: args[0],
document: args[1],
rootValue: args[2],
contextValue: args[3],
variableValues: args[4],
operationName: args[5],
fieldResolver: args[6],
subscribeFieldResolver: args[7],
};
const enveloped = envelopedByContext.get(
subscriptionArgs.contextValue as YogaInitialContext,
);
if (!enveloped) {
throw new TypeError('Illegal invocation.');
}
return enveloped.subscribe(args);
return enveloped.subscribe(subscriptionArgs);
},
});
},
Expand Down
38,715 changes: 21,397 additions & 17,318 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/override-graphql-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fs.writeFileSync(pkgPath, JSON.stringify(pkg, undefined, ' ') + '\n');
// disable apollo federation and sofa testing with <16 versions
const graphql15AndLess = parseInt(graphqlVersion.split('.')[0]) <= 15;

for (const testPath of [`examples/apollo-federation`, 'examples/sofa']) {
for (const testPath of [`examples/apollo-federation`]) {
if (graphql15AndLess) {
// disable
const testPathAbs = path.resolve(__dirname, '..', testPath, '__integration-tests__');
Expand Down

0 comments on commit 7df6fb1

Please sign in to comment.