@nestjs/apollo 14.0.1 → 14.0.3

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.
@@ -21,5 +21,6 @@ export declare abstract class ApolloBaseDriver<T extends Record<string, any> = A
21
21
  private createTransformHttpErrorFn;
22
22
  private wrapContextResolver;
23
23
  private assignReqProperty;
24
+ private cloneContext;
24
25
  }
25
26
  //# sourceMappingURL=apollo-base.driver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apollo-base.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo-base.driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAU5D,8BAAsB,gBAAgB,CACpC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAClD,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IAChC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAElD,IAAI,QAAQ,IAAI,YAAY,CAAC,WAAW,CAAC,CAExC;IAEY,KAAK,CAAC,aAAa,EAAE,CAAC;IAa5B,IAAI;IAIE,mBAAmB,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAyDxD,OAAO,CAAC,0BAA0B;IAkB3B,sBAAsB,CAC3B,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,CACR,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,GAAG,KACT,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC/B,sBAAsB,EAAE,QAAQ,IAExB,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAC3C,GAAG,MA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G,EACZ,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,GAAG,KACT,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC/B,sBAAsB,EAAE,QAAQ,IAExB,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAC3C,GAAG,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,KAC/C,GAAG;cAMQ,eAAe,CAC7B,OAAO,EAAE,CAAC,EACV,EAAE,YAAY,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;cAmDtC,eAAe,CAC7B,OAAO,EAAE,CAAC,EACV,EAAE,YAAY,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;IAwCtD,OAAO,CAAC,iCAAiC;IAyCzC,OAAO,CAAC,8BAA8B;IA4BtC,OAAO,CAAC,iBAAiB;IAuBzB,OAAO,CAAC,0BAA0B;IA0ClC,OAAO,CAAC,mBAAmB;IA+B3B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,YAAY;CAYrB"}
@@ -286,7 +286,8 @@ export class ApolloBaseDriver extends AbstractGraphQLDriver {
286
286
  }
287
287
  else {
288
288
  targetOptions.context = async (contextOrRequest) => {
289
- return this.assignReqProperty(originalOptions.context, contextOrRequest.req ?? contextOrRequest);
289
+ // The object is shared by all requests, so each one gets its own copy
290
+ return this.assignReqProperty(this.cloneContext(originalOptions.context), contextOrRequest.req ?? contextOrRequest);
290
291
  };
291
292
  }
292
293
  }
@@ -298,7 +299,13 @@ export class ApolloBaseDriver extends AbstractGraphQLDriver {
298
299
  (ctx && ctx.req && typeof ctx.req === 'object')) {
299
300
  return ctx;
300
301
  }
301
- ctx.req = req;
302
- return ctx;
302
+ // Never assign onto `ctx`: when the same object is returned for every
303
+ // request, all of them would see the `req` of the first one.
304
+ return this.cloneContext(ctx, { req });
305
+ }
306
+ cloneContext(ctx, properties) {
307
+ // Keeps the prototype (and so the methods of class-based contexts), just
308
+ // like the copy Apollo Server makes of the context for every operation.
309
+ return Object.assign(Object.create(Object.getPrototypeOf(ctx)), ctx, properties);
303
310
  }
304
311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/apollo",
3
- "version": "14.0.1",
3
+ "version": "14.0.3",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@apollo)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -35,14 +35,14 @@
35
35
  "@apollo/gateway": "2.14.4",
36
36
  "@apollo/server": "5.5.1",
37
37
  "@apollo/server-plugin-response-cache": "5.0.0",
38
- "@apollo/subgraph": "2.14.4",
38
+ "@apollo/subgraph": "2.15.1",
39
39
  "@as-integrations/express5": "^1.1.2",
40
40
  "@as-integrations/fastify": "3.1.0",
41
- "@nestjs/common": "12.0.3",
42
- "@nestjs/core": "12.0.3",
43
- "@nestjs/platform-express": "12.0.3",
44
- "@nestjs/platform-fastify": "12.0.3",
45
- "@nestjs/testing": "12.0.3",
41
+ "@nestjs/common": "12.1.0",
42
+ "@nestjs/core": "12.1.0",
43
+ "@nestjs/platform-express": "12.1.0",
44
+ "@nestjs/platform-fastify": "12.1.0",
45
+ "@nestjs/testing": "12.1.0",
46
46
  "apollo-cache-inmemory": "1.6.6",
47
47
  "apollo-client": "2.6.10"
48
48
  },
@@ -75,5 +75,5 @@
75
75
  "optional": true
76
76
  }
77
77
  },
78
- "gitHead": "2f093da088290b936631d7e0a68b368222c2a9f0"
78
+ "gitHead": "9814413530852cf12a9fc160bb8a240491c654c0"
79
79
  }