@cedarjs/vite 5.0.0-canary.2497 → 5.0.0-canary.2499

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,20 @@ 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, {
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
+ return store.run(new Map(), () =>
274
+ yoga.handle(request, { request, cedarContext, event, requestContext: undefined })
275
+ ).then((response) => new Response(response.body, {
271
276
  status: response.status,
272
277
  statusText: response.statusText,
273
278
  headers: response.headers,
274
- });
279
+ }));
275
280
  }
276
281
  };
277
282
  `;
@@ -230,15 +230,20 @@ 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, {
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
+ return store.run(new Map(), () =>
241
+ yoga.handle(request, { request, cedarContext, event, requestContext: undefined })
242
+ ).then((response) => new Response(response.body, {
238
243
  status: response.status,
239
244
  statusText: response.statusText,
240
245
  headers: response.headers,
241
- });
246
+ }));
242
247
  }
243
248
  };
244
249
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "5.0.0-canary.2497",
3
+ "version": "5.0.0-canary.2499",
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.2497",
73
- "@cedarjs/auth": "5.0.0-canary.2497",
74
- "@cedarjs/babel-config": "5.0.0-canary.2497",
75
- "@cedarjs/context": "5.0.0-canary.2497",
76
- "@cedarjs/cookie-jar": "5.0.0-canary.2497",
77
- "@cedarjs/graphql-server": "5.0.0-canary.2497",
78
- "@cedarjs/internal": "5.0.0-canary.2497",
79
- "@cedarjs/project-config": "5.0.0-canary.2497",
80
- "@cedarjs/server-store": "5.0.0-canary.2497",
81
- "@cedarjs/testing": "5.0.0-canary.2497",
82
- "@cedarjs/web": "5.0.0-canary.2497",
72
+ "@cedarjs/api": "5.0.0-canary.2499",
73
+ "@cedarjs/auth": "5.0.0-canary.2499",
74
+ "@cedarjs/babel-config": "5.0.0-canary.2499",
75
+ "@cedarjs/context": "5.0.0-canary.2499",
76
+ "@cedarjs/cookie-jar": "5.0.0-canary.2499",
77
+ "@cedarjs/graphql-server": "5.0.0-canary.2499",
78
+ "@cedarjs/internal": "5.0.0-canary.2499",
79
+ "@cedarjs/project-config": "5.0.0-canary.2499",
80
+ "@cedarjs/server-store": "5.0.0-canary.2499",
81
+ "@cedarjs/testing": "5.0.0-canary.2499",
82
+ "@cedarjs/web": "5.0.0-canary.2499",
83
83
  "@fastify/url-data": "6.0.3",
84
84
  "@swc/core": "1.15.41",
85
85
  "@universal-deploy/store": "^0.2.1",