@cedarjs/vite 5.0.0-canary.2498 → 5.0.0-canary.2500

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.
@@ -263,15 +263,31 @@ async function generateGraphQLModule(distPath) {
263
263
  authDecoder: graphqlOptions ? graphqlOptions.authDecoder : undefined,
264
264
  });
265
265
  const event = await requestToLegacyEvent(request, cedarContext);
266
- const response = await yoga.handle(request, { request, cedarContext, event, requestContext: undefined });
267
- // GraphQL Yoga returns a PonyfillResponse from @whatwg-node/fetch
268
- // which is not an instanceof the native Response class. Netlify's
269
- // bootstrap checks instanceof Response, so we wrap it.
270
- return new Response(response.body, {
271
- status: response.status,
272
- statusText: response.statusText,
273
- headers: response.headers,
274
- });
266
+ // Wrap yoga.handle in an AsyncLocalStorage run so directive
267
+ // validators can read from the global @cedarjs/context. Without
268
+ // this, the auth plugin's setContext() call writes to a store
269
+ // that's only visible inside the plugin's own callback \u2014 not
270
+ // during directive validation.
271
+ const { getAsyncStoreInstance } = await import('@cedarjs/context/dist/store')
272
+ const store = getAsyncStoreInstance()
273
+
274
+ return store.run(new Map(), () => {
275
+ return yoga.handle(request, {
276
+ request,
277
+ cedarContext,
278
+ event,
279
+ requestContext: undefined,
280
+ })
281
+ }).then((response) => {
282
+ // GraphQL Yoga returns a PonyfillResponse from @whatwg-node/fetch
283
+ // which is not an instanceof the native Response class. Netlify's
284
+ // bootstrap checks instanceof Response, so we wrap it.
285
+ return new Response(response.body, {
286
+ status: response.status,
287
+ statusText: response.statusText,
288
+ headers: response.headers,
289
+ })
290
+ })
275
291
  }
276
292
  };
277
293
  `;
@@ -230,15 +230,31 @@ async function generateGraphQLModule(distPath) {
230
230
  authDecoder: graphqlOptions ? graphqlOptions.authDecoder : undefined,
231
231
  });
232
232
  const event = await requestToLegacyEvent(request, cedarContext);
233
- const response = await yoga.handle(request, { request, cedarContext, event, requestContext: undefined });
234
- // GraphQL Yoga returns a PonyfillResponse from @whatwg-node/fetch
235
- // which is not an instanceof the native Response class. Netlify's
236
- // bootstrap checks instanceof Response, so we wrap it.
237
- return new Response(response.body, {
238
- status: response.status,
239
- statusText: response.statusText,
240
- headers: response.headers,
241
- });
233
+ // Wrap yoga.handle in an AsyncLocalStorage run so directive
234
+ // validators can read from the global @cedarjs/context. Without
235
+ // this, the auth plugin's setContext() call writes to a store
236
+ // that's only visible inside the plugin's own callback \u2014 not
237
+ // during directive validation.
238
+ const { getAsyncStoreInstance } = await import('@cedarjs/context/dist/store')
239
+ const store = getAsyncStoreInstance()
240
+
241
+ return store.run(new Map(), () => {
242
+ return yoga.handle(request, {
243
+ request,
244
+ cedarContext,
245
+ event,
246
+ requestContext: undefined,
247
+ })
248
+ }).then((response) => {
249
+ // GraphQL Yoga returns a PonyfillResponse from @whatwg-node/fetch
250
+ // which is not an instanceof the native Response class. Netlify's
251
+ // bootstrap checks instanceof Response, so we wrap it.
252
+ return new Response(response.body, {
253
+ status: response.status,
254
+ statusText: response.statusText,
255
+ headers: response.headers,
256
+ })
257
+ })
242
258
  }
243
259
  };
244
260
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "5.0.0-canary.2498",
3
+ "version": "5.0.0-canary.2500",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -69,17 +69,17 @@
69
69
  "@babel/generator": "7.29.1",
70
70
  "@babel/parser": "7.29.3",
71
71
  "@babel/traverse": "7.29.0",
72
- "@cedarjs/api": "5.0.0-canary.2498",
73
- "@cedarjs/auth": "5.0.0-canary.2498",
74
- "@cedarjs/babel-config": "5.0.0-canary.2498",
75
- "@cedarjs/context": "5.0.0-canary.2498",
76
- "@cedarjs/cookie-jar": "5.0.0-canary.2498",
77
- "@cedarjs/graphql-server": "5.0.0-canary.2498",
78
- "@cedarjs/internal": "5.0.0-canary.2498",
79
- "@cedarjs/project-config": "5.0.0-canary.2498",
80
- "@cedarjs/server-store": "5.0.0-canary.2498",
81
- "@cedarjs/testing": "5.0.0-canary.2498",
82
- "@cedarjs/web": "5.0.0-canary.2498",
72
+ "@cedarjs/api": "5.0.0-canary.2500",
73
+ "@cedarjs/auth": "5.0.0-canary.2500",
74
+ "@cedarjs/babel-config": "5.0.0-canary.2500",
75
+ "@cedarjs/context": "5.0.0-canary.2500",
76
+ "@cedarjs/cookie-jar": "5.0.0-canary.2500",
77
+ "@cedarjs/graphql-server": "5.0.0-canary.2500",
78
+ "@cedarjs/internal": "5.0.0-canary.2500",
79
+ "@cedarjs/project-config": "5.0.0-canary.2500",
80
+ "@cedarjs/server-store": "5.0.0-canary.2500",
81
+ "@cedarjs/testing": "5.0.0-canary.2500",
82
+ "@cedarjs/web": "5.0.0-canary.2500",
83
83
  "@fastify/url-data": "6.0.3",
84
84
  "@swc/core": "1.15.41",
85
85
  "@universal-deploy/store": "^0.2.1",