@faststore/core 4.11.0 → 4.11.1-dev.1

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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @faststore/core@4.10.3 generate /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@4.11.1-dev.0 generate /home/runner/work/faststore/faststore/packages/core
3
3
  > pnpm run gen-types && pnpm run cache-graphql
4
4
 
5
5
 
6
- > @faststore/core@4.10.3 gen-types /home/runner/work/faststore/faststore/packages/core
6
+ > @faststore/core@4.11.1-dev.0 gen-types /home/runner/work/faststore/faststore/packages/core
7
7
  > node ../cli/bin/run generate-types .
8
8
 
9
9
  [STARTED] Parse Configuration
@@ -19,7 +19,7 @@
19
19
  [COMPLETED] Generate to @generated/
20
20
  [COMPLETED] Generate outputs
21
21
 
22
- > @faststore/core@4.10.3 cache-graphql /home/runner/work/faststore/faststore/packages/core
22
+ > @faststore/core@4.11.1-dev.0 cache-graphql /home/runner/work/faststore/faststore/packages/core
23
23
  > node ../cli/bin/run cache-graphql --config=./discovery.config.default.js --queries=./@generated/persisted-documents.json
24
24
 
25
25
  [Info] - Config file location: /home/runner/work/faststore/faststore/packages/core/discovery.config.default.js
@@ -1,5 +1,5 @@
1
1
 
2
- > @faststore/core@4.10.3 test /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@4.11.1-dev.0 test /home/runner/work/faststore/faststore/packages/core
3
3
  > vitest run
4
4
 
5
5
 
@@ -10,29 +10,23 @@ Not implemented: navigation to another Document
10
10
  Browserslist: browsers data (caniuse-lite) is 9 months old. Please run:
11
11
  npx update-browserslist-db@latest
12
12
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
13
- ✓  browser  test/sdk/ui/useScrollRestoration.browser.test.ts (43 tests) 1171ms
14
- ✓  browser  test/components/account/cards/MyAccountListCards.browser.test.tsx (16 tests) 2623ms
15
- ✓ shows the tab bar and renders Personal cards by default  1219ms
16
- ✓ paginates when there are more than 25 cards  315ms
17
- ✓  browser  test/components/account/ContractSwitcher.browser.test.tsx (22 tests) 3935ms
18
- ✓ shows an error state when the list fails to load  855ms
19
- ✓ requires selecting a contract before Confirm is enabled, then switches (REQ-03)  474ms
20
- ✓ keeps Confirm disabled when switching is unavailable  336ms
21
- ✓ falls back to English defaults when CMS labels are blank  306ms
22
- ✓  browser  test/components/account/orders/BuyingPolicyAlert.browser.test.tsx (13 tests) 2674ms
23
- ✓ opens the reject confirmation modal with the default English copy  836ms
24
- ✓ opens the reject confirmation modal with CMS-provided labels  363ms
25
- ✓ shows the default English toast when a policy is rejected  361ms
26
- ✓  browser  test/components/account/OrganizationDrawer.browser.test.tsx (10 tests) 1885ms
27
- ✓ renders the menu view with contract details and manage footer  1096ms
28
- ✓ opens the contract switcher and returns to the menu on back  305ms
29
- ✓  browser  test/components/ui/RichText/RichText.browser.test.tsx (8 tests) 330ms
30
- ✓  browser  test/sdk/product/usePageProductsQuery.browser.test.ts (9 tests) 165ms
31
- ✓  browser  test/components/CartRecommendationShelf/CartRecommendationShelf.browser.test.tsx (13 tests) 255ms
32
- ✓  browser  test/sdk/localization/useBindingSelector.browser.test.tsx (9 tests) 102ms
33
- ✓  browser  test/sdk/session/reconcileSessionLocale.browser.test.ts (6 tests) 20ms
34
- ✓  browser  test/components/ui/ProductGallery/GalleryPageHeightLock.browser.test.tsx (8 tests) 144ms
35
- ✓  browser  test/sdk/recommendations/useRecommendationShelf.browser.test.tsx (12 tests) 106ms
13
+ ✓  browser  test/sdk/ui/useScrollRestoration.browser.test.ts (43 tests) 1054ms
14
+ ✓  browser  test/components/account/cards/MyAccountListCards.browser.test.tsx (16 tests) 2269ms
15
+ ✓ shows the tab bar and renders Personal cards by default  916ms
16
+ ✓ paginates when there are more than 25 cards  353ms
17
+ ✓  browser  test/components/account/ContractSwitcher.browser.test.tsx (22 tests) 3227ms
18
+ ✓ shows an error state when the list fails to load  710ms
19
+ ✓ requires selecting a contract before Confirm is enabled, then switches (REQ-03)  426ms
20
+ ✓  browser  test/components/account/orders/BuyingPolicyAlert.browser.test.tsx (13 tests) 2121ms
21
+ ✓ opens the reject confirmation modal with the default English copy  773ms
22
+ ✓  browser  test/components/ui/RichText/RichText.browser.test.tsx (8 tests) 246ms
23
+ ✓  browser  test/components/account/OrganizationDrawer.browser.test.tsx (10 tests) 1590ms
24
+ ✓ renders the menu view with contract details and manage footer  871ms
25
+ ✓  browser  test/sdk/product/usePageProductsQuery.browser.test.ts (9 tests) 128ms
26
+ ✓  browser  test/components/CartRecommendationShelf/CartRecommendationShelf.browser.test.tsx (13 tests) 126ms
27
+ ✓  browser  test/sdk/localization/useBindingSelector.browser.test.tsx (9 tests) 58ms
28
+ ✓  browser  test/sdk/session/reconcileSessionLocale.browser.test.ts (6 tests) 15ms
29
+ ✓  browser  test/components/ui/ProductGallery/GalleryPageHeightLock.browser.test.tsx (8 tests) 95ms
36
30
  stderr | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx
37
31
  Error in optimistic validation: TypeError: Failed to parse URL from /api/graphql?operationName=ValidateCartMutation&operationHash=3c71b0d3fc2bade14df68abfa271858beb361b12
38
32
   at node:internal/deps/undici/undici:16416:13
@@ -62,11 +56,13 @@ Browserslist: browsers data (caniuse-lite) is 9 months old. Please run:
62
56
  stderr | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx > RecommendationShelf > renders nothing when there is an error
63
57
  Error fetching recommendations undefined boom for campaign vrn:recommendations:acc:rec-top-items-v2:campaign-1
64
58
 
65
- ✓  browser  test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx (8 tests) 191ms
66
- ✓  browser  test/components/CartSidebar/CartSidebar.browser.test.tsx (5 tests) 162ms
67
- ✓  browser  test/sdk/product/useProductQuery.browser.test.ts (5 tests) 379ms
68
- ✓  browser  test/components/sections/Account/AccountOrderDetails.browser.test.tsx (4 tests) 188ms
69
- ✓  browser  test/sdk/session/getInitialSession.browser.test.ts (7 tests) 17ms
59
+ ✓  browser  test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx (8 tests) 72ms
60
+ ✓  browser  test/sdk/recommendations/useRecommendationShelf.browser.test.tsx (12 tests) 46ms
61
+ ✓  browser  test/components/CartSidebar/CartSidebar.browser.test.tsx (5 tests) 54ms
62
+ ✓  browser  test/sdk/product/useProductQuery.browser.test.ts (5 tests) 346ms
63
+ ✓  browser  test/sdk/session/getInitialSession.browser.test.ts (7 tests) 8ms
64
+ ✓  browser  test/components/sections/Account/AccountOrderDetails.browser.test.tsx (4 tests) 109ms
65
+ ✓  browser  test/components/navigation/Navbar.browser.test.tsx (3 tests) 85ms
70
66
  stderr | test/sdk/session/validateSession.browser.test.ts
71
67
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
72
68
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -75,8 +71,7 @@ Browserslist: browsers data (caniuse-lite) is 9 months old. Please run:
75
71
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
76
72
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
77
73
 
78
- ✓  browser  test/sdk/session/validateSession.browser.test.ts (9 tests) 28ms
79
- ✓  browser  test/components/navigation/Navbar.browser.test.tsx (3 tests) 70ms
74
+ ✓  browser  test/sdk/session/validateSession.browser.test.ts (9 tests) 19ms
80
75
  stderr | test/pages/password-protection.browser.test.tsx > PasswordProtectionLogin > posts the password and redirects to the requested return path
81
76
  Warning: An update to PasswordProtectionLogin inside a test was not wrapped in act(...).
82
77
 
@@ -306,8 +301,10 @@ act(() => {
306
301
  This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
307
302
  at PasswordProtectionLogin (/home/runner/work/faststore/faststore/packages/core/src/pages/password-protection/index.tsx:19:69)
308
303
 
309
- ✓  browser  test/pages/password-protection.browser.test.tsx (6 tests) 831ms
310
- ✓ renders the password protection form  459ms
304
+ ✓  browser  test/pages/password-protection.browser.test.tsx (6 tests) 751ms
305
+ ✓ renders the password protection form  310ms
306
+ ✓  browser  test/components/account/OrganizationDrawerFooter.browser.test.tsx (8 tests) 464ms
307
+ ✓  browser  test/sdk/account/useSwitchContract.browser.test.ts (5 tests) 37ms
311
308
  stderr | test/components/cms/RenderSections.browser.test.tsx
312
309
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
313
310
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -316,11 +313,9 @@ This ensures that you're testing the behavior the user would see in the browser.
316
313
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
317
314
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
318
315
 
319
- ✓  browser  test/sdk/account/useSwitchContract.browser.test.ts (5 tests) 49ms
320
- ✓  browser  test/components/account/OrganizationDrawerFooter.browser.test.tsx (8 tests) 391ms
321
- ✓  browser  test/components/cms/RenderSections.browser.test.tsx (5 tests) 75ms
322
- ✓  browser  test/sdk/product/usePageProductsQuery.deliveryPromise.browser.test.ts (3 tests) 38ms
323
- ✓  browser  test/components/navigation/NavbarSlider.browser.test.tsx (2 tests) 47ms
316
+ ✓  browser  test/components/cms/RenderSections.browser.test.tsx (5 tests) 66ms
317
+ ✓  browser  test/components/navigation/NavbarSlider.browser.test.tsx (2 tests) 33ms
318
+ ✓  browser  test/sdk/product/usePageProductsQuery.deliveryPromise.browser.test.ts (3 tests) 27ms
324
319
  stderr | test/sdk/localization/store-url.browser.test.ts
325
320
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
326
321
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -329,10 +324,10 @@ This ensures that you're testing the behavior the user would see in the browser.
329
324
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
330
325
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
331
326
 
332
- ✓  browser  test/sdk/localization/store-url.browser.test.ts (3 tests) 6ms
333
- ✓  browser  test/components/account/Menu.browser.test.tsx (6 tests) 373ms
334
- ✓  browser  test/sdk/account/useAvailableContracts.browser.test.ts (6 tests) 31ms
335
- ✓  browser  test/components/templates/SearchPage/SearchWrapper.browser.test.tsx (3 tests) 40ms
327
+ ✓  browser  test/sdk/localization/store-url.browser.test.ts (3 tests) 4ms
328
+ ✓  browser  test/sdk/account/useAvailableContracts.browser.test.ts (6 tests) 29ms
329
+ ✓  browser  test/components/account/Menu.browser.test.tsx (6 tests) 246ms
330
+ ✓  browser  test/components/templates/SearchPage/SearchWrapper.browser.test.tsx (3 tests) 22ms
336
331
  stderr | test/sdk/session/refreshTokenRoute.browser.test.ts
337
332
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
338
333
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -341,12 +336,12 @@ This ensures that you're testing the behavior the user would see in the browser.
341
336
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
342
337
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
343
338
 
344
- ✓  browser  test/sdk/recommendations/useRecommendationShelf.sessionFallback.browser.test.tsx (2 tests) 138ms
345
- ✓  browser  test/sdk/session/refreshTokenRoute.browser.test.ts (3 tests) 10ms
346
- ✓  browser  test/components/sections/Account/AccountListQuotes.browser.test.tsx (4 tests) 135ms
347
- ✓  browser  test/components/CartRecommendationShelf/CartRecommendationProductCard.browser.test.tsx (3 tests) 73ms
348
- ✓  browser  test/components/navigation/NavbarAccountArea.browser.test.tsx (4 tests) 74ms
349
- ✓  browser  test/sdk/account/changeContractToken.browser.test.ts (9 tests) 23ms
339
+ ✓  browser  test/sdk/session/refreshTokenRoute.browser.test.ts (3 tests) 6ms
340
+ ✓  browser  test/sdk/recommendations/useRecommendationShelf.sessionFallback.browser.test.tsx (2 tests) 125ms
341
+ ✓  browser  test/components/sections/Account/AccountListQuotes.browser.test.tsx (4 tests) 101ms
342
+ ✓  browser  test/components/navigation/NavbarAccountArea.browser.test.tsx (4 tests) 46ms
343
+ ✓  browser  test/components/CartRecommendationShelf/CartRecommendationProductCard.browser.test.tsx (3 tests) 36ms
344
+ ✓  browser  test/sdk/account/changeContractToken.browser.test.ts (9 tests) 16ms
350
345
  stderr | test/components/account/doLogout.browser.test.ts
351
346
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
352
347
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -355,11 +350,11 @@ This ensures that you're testing the behavior the user would see in the browser.
355
350
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
356
351
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
357
352
 
358
- ✓  browser  test/components/account/doLogout.browser.test.ts (1 test) 41ms
359
- ✓  browser  test/components/account/OrganizationDrawerHeader.browser.test.tsx (5 tests) 384ms
360
- ✓  browser  test/sdk/product/useProductNotFoundRedirect.browser.test.ts (7 tests) 51ms
361
- ✓  browser  test/sdk/account/useRefreshToken.browser.test.ts (4 tests) 144ms
362
- ✓  browser  test/components/ui/LocalizationButton.browser.test.tsx (3 tests) 49ms
353
+ ✓  browser  test/components/account/doLogout.browser.test.ts (1 test) 55ms
354
+ ✓  browser  test/components/account/OrganizationDrawerHeader.browser.test.tsx (5 tests) 264ms
355
+ ✓  browser  test/sdk/product/useProductNotFoundRedirect.browser.test.ts (7 tests) 25ms
356
+ ✓  browser  test/sdk/account/useRefreshToken.browser.test.ts (4 tests) 133ms
357
+ ✓  browser  test/components/ui/LocalizationButton.browser.test.tsx (3 tests) 33ms
363
358
  stderr | test/sdk/account/clearPersistedSessionState.browser.test.ts
364
359
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
365
360
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -368,14 +363,15 @@ This ensures that you're testing the behavior the user would see in the browser.
368
363
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
369
364
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
370
365
 
371
- ✓  browser  test/components/account/OrganizationSignInButton.browser.test.tsx (4 tests) 293ms
372
- ✓  browser  test/sdk/account/clearPersistedSessionState.browser.test.ts (4 tests) 21ms
373
- ✓  browser  test/components/sections/Account/AccountOrderDelivery.browser.test.tsx (2 tests) 107ms
374
- ✓  browser  test/components/account/orders/DeliveryOptionAccordion.browser.test.tsx (2 tests) 106ms
375
- ✓  browser  test/components/sections/Account/AccountOrderStatus.browser.test.tsx (3 tests) 101ms
376
- ✓  browser  test/components/region/useRegion.browser.test.ts (1 test) 27ms
377
- ✓  browser  test/components/sections/Account/AccountListCards.browser.test.tsx (3 tests) 85ms
378
- ✓  browser  test/components/sections/Account/AccountOrdersList.browser.test.tsx (2 tests) 25ms
366
+ ✓  browser  test/sdk/account/clearPersistedSessionState.browser.test.ts (4 tests) 15ms
367
+ ✓  browser  test/components/account/OrganizationSignInButton.browser.test.tsx (4 tests) 240ms
368
+ ✓  browser  test/components/sections/Account/AccountOrderDelivery.browser.test.tsx (2 tests) 61ms
369
+ ✓  browser  test/components/account/orders/DeliveryOptionAccordion.browser.test.tsx (2 tests) 87ms
370
+ ✓  browser  test/components/sections/Account/AccountOrderStatus.browser.test.tsx (3 tests) 98ms
371
+ ✓  browser  test/components/sections/Account/AccountListCards.browser.test.tsx (3 tests) 66ms
372
+ ✓  browser  test/components/region/useRegion.browser.test.ts (1 test) 19ms
373
+ ✓  browser  test/components/sections/Account/AccountOrdersList.browser.test.tsx (2 tests) 20ms
374
+ ✓  browser  test/components/account/orders/SummaryCard.browser.test.tsx (2 tests) 69ms
379
375
  stderr | test/sdk/session/sessionStore.browser.test.ts
380
376
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
381
377
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -384,10 +380,9 @@ This ensures that you're testing the behavior the user would see in the browser.
384
380
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
385
381
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
386
382
 
387
- ✓  browser  test/sdk/session/sessionStore.browser.test.ts (2 tests) 9ms
388
- ✓  browser  test/components/account/orders/SummaryCard.browser.test.tsx (2 tests) 88ms
389
- ✓  browser  test/components/account/orders/DeliveryOptionAccordionDeliveryInfo.browser.test.tsx (1 test) 68ms
390
- ✓  browser  test/utils/shouldBypassRefreshToken.browser.test.ts (5 tests) 7ms
383
+ ✓  browser  test/sdk/session/sessionStore.browser.test.ts (2 tests) 6ms
384
+ ✓  browser  test/components/account/orders/DeliveryOptionAccordionDeliveryInfo.browser.test.tsx (1 test) 32ms
385
+ ✓  browser  test/utils/shouldBypassRefreshToken.browser.test.ts (5 tests) 5ms
391
386
  stderr | test/sdk/account/refreshToken.browser.test.ts
392
387
  Error in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
393
388
  at waitForSessionValidated (/home/runner/work/faststore/faststore/packages/core/src/sdk/cart/waitForSessionValidated.ts:16:32)
@@ -396,18 +391,18 @@ This ensures that you're testing the behavior the user would see in the browser.
396
391
  at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
397
392
   at processTicksAndRejections (node:internal/process/task_queues:103:5)
398
393
 
399
- ✓  browser  test/sdk/account/refreshToken.browser.test.ts (2 tests) 6ms
400
- ✓  browser  test/components/account/orders/StatusCard.browser.test.tsx (2 tests) 119ms
394
+ ✓  browser  test/sdk/account/refreshToken.browser.test.ts (2 tests) 4ms
401
395
  ✓  browser  test/sdk/session/reconcileSessionLocale.disabled.browser.test.ts (1 test) 3ms
402
- ✓  browser  test/components/account/orders/DeliveryCard.browser.test.tsx (1 test) 48ms
403
- ✓  browser  test/components/account/orders/DeliveryOptionAccordionProducts.browser.test.tsx (1 test) 50ms
404
- ✓  browser  test/components/skeletons/ProductGridSkeleton.browser.test.tsx (2 tests) 42ms
405
- ✓  node  test/pages/api/switch-contract.test.ts (61 tests) 149ms
406
- ✓  node  test/utils/localization/bindingPaths.test.ts (71 tests) 32ms
407
- ✓  browser  test/components/account/orders/FilterFacetPendingApproval.browser.test.tsx (1 test) 225ms
408
- ✓  node  test/server/password-protection-service.test.ts (22 tests) 49ms
409
- ✓  node  test/server/content/service.test.ts (27 tests) 39ms
410
- ✓  node  test/sdk/localization/useBindingSelector.test.tsx (22 tests) 20ms
396
+ ✓  browser  test/components/account/orders/StatusCard.browser.test.tsx (2 tests) 81ms
397
+ ✓  browser  test/components/account/orders/DeliveryCard.browser.test.tsx (1 test) 39ms
398
+ ✓  browser  test/components/account/orders/DeliveryOptionAccordionProducts.browser.test.tsx (1 test) 33ms
399
+ ✓  browser  test/components/skeletons/ProductGridSkeleton.browser.test.tsx (2 tests) 30ms
400
+ ✓  node  test/pages/api/switch-contract.test.ts (61 tests) 131ms
401
+ ✓  node  test/utils/localization/bindingPaths.test.ts (71 tests) 21ms
402
+ ✓  node  test/server/password-protection-service.test.ts (22 tests) 27ms
403
+ ✓  browser  test/components/account/orders/FilterFacetPendingApproval.browser.test.tsx (1 test) 161ms
404
+ ✓  node  test/server/content/service.test.ts (27 tests) 32ms
405
+ ✓  node  test/sdk/localization/useBindingSelector.test.tsx (22 tests) 9ms
411
406
  stderr | test/sdk/deliveryPromise/provider.effect.test.tsx > DeliveryPromiseProvider pickup fetch > clears the loading flag after a failed request and retries on the next update
412
407
  Failed to fetch pickup points: Error: network
413
408
  at /home/runner/work/faststore/faststore/packages/core/test/sdk/deliveryPromise/provider.effect.test.tsx:250:30
@@ -434,7 +429,7 @@ This ensures that you're testing the behavior the user would see in the browser.
434
429
  at trace (file:///home/runner/work/faststore/faststore/node_modules/.pnpm/vitest@4.0.18_@opentelemetry+api@1.9.0_@types+node@20.19.13_jiti@2.6.1_jsdom@27.4.0_sas_13be941c57d55f08f06eeaf1c180ddfe/node_modules/vitest/dist/chunks/test.B8ej_ZHS.js:239:21)
435
430
  at runTest (file:///home/runner/work/faststore/faststore/node_modules/.pnpm/@vitest+runner@4.0.18/node_modules/@vitest/runner/dist/index.js:1653:12)
436
431
 
437
- ✓  node  test/sdk/deliveryPromise/provider.effect.test.tsx (9 tests) 95ms
432
+ ✓  node  test/sdk/deliveryPromise/provider.effect.test.tsx (9 tests) 73ms
438
433
  stderr | test/pages/api/graphql.test.ts > /api/graphql error status propagation > propagates the upstream 400 from a wrapped BadRequestError instead of 500
439
434
  Graphql execution returned with error: [
440
435
  {
@@ -544,7 +539,6 @@ This ensures that you're testing the behavior the user would see in the browser.
544
539
  at trace (file:///home/runner/work/faststore/faststore/node_modules/.pnpm/vitest@4.0.18_@opentelemetry+api@1.9.0_@types+node@20.19.13_jiti@2.6.1_jsdom@27.4.0_sas_13be941c57d55f08f06eeaf1c180ddfe/node_modules/vitest/dist/chunks/test.B8ej_ZHS.js:239:21)
545
540
  at runTest (file:///home/runner/work/faststore/faststore/node_modules/.pnpm/@vitest+runner@4.0.18/node_modules/@vitest/runner/dist/index.js:1653:12)
546
541
 
547
- ✓  node  test/utils/match-url.test.ts (10 tests) 12ms
548
542
  stderr | test/pages/api/graphql.test.ts > /api/graphql ValidateSession refresh-token bypass > forces a 401 on the production host brandless.vtex.app
549
543
  Something unexpected occurred querying Graphql endpoint:
550
544
  le [FastStoreError]: Unauthorized: Token expired. Please login again or refresh the page.
@@ -577,9 +571,10 @@ This ensures that you're testing the behavior the user would see in the browser.
577
571
  extensions: { status: 401, type: 'UnauthorizedError' }
578
572
  }
579
573
 
580
- ✓  node  test/pages/api/graphql.test.ts (30 tests) 35ms
581
- ✓  node  test/pages/api/unlock.test.ts (15 tests) 144ms
582
- ✓  node  test/sdk/session/syncSalesChannelFromOrderForm.test.ts (14 tests) 14ms
574
+ ✓  node  test/pages/api/graphql.test.ts (30 tests) 32ms
575
+ ✓  node  test/utils/match-url.test.ts (10 tests) 9ms
576
+ ✓  node  test/pages/api/unlock.test.ts (15 tests) 113ms
577
+ ✓  node  test/sdk/session/syncSalesChannelFromOrderForm.test.ts (14 tests) 9ms
583
578
  ✓  node  test/sdk/localization/bindingSelector.test.ts (18 tests) 8ms
584
579
  stderr | test/components/search/SearchInputComponent.test.tsx
585
580
  Warning: forwardRef render functions accept exactly two parameters: props and ref. Did you forget to use the ref parameter?
@@ -644,98 +639,105 @@ Warning: React does not recognize the `providerProps` prop on a DOM element. If
644
639
  at Suspense
645
640
  at Wrapper (/home/runner/work/faststore/faststore/packages/core/test/components/search/SearchInputComponent.test.tsx:106:20)
646
641
 
647
- ✓  node  test/components/search/SearchInputComponent.test.tsx (6 tests) 65ms
642
+ ✓  node  test/components/search/SearchInputComponent.test.tsx (6 tests) 70ms
648
643
  ✓  node  test/sdk/account/refreshToken.test.ts (21 tests) 13ms
649
- ✓  node  test/components/quotes/MyAccountListQuotesTable.test.tsx (15 tests) 475ms
650
- ✓  node  test/sdk/search/useSearchHistory.test.ts (13 tests) 49ms
644
+ ✓  node  test/components/quotes/MyAccountListQuotesTable.test.tsx (15 tests) 333ms
645
+ ✓  node  test/sdk/search/useSearchHistory.test.ts (13 tests) 35ms
651
646
  stderr | test/pages/pvt/account/cards/index.test.ts > Cards page getServerSideProps > redirects to /pvt/account/403 when the query fails with 401/403
652
647
  { extensions: { status: 401 } }
653
648
 
654
649
  stderr | test/pages/pvt/account/cards/index.test.ts > Cards page getServerSideProps > renders the error state (no redirect) when the query fails with a non-auth status
655
650
  { extensions: { status: 502 } }
656
651
 
657
- ✓  node  test/pages/pvt/account/cards/index.test.ts (8 tests) 10ms
658
- ✓  node  test/components/quotes/quoteFilters.test.ts (26 tests) 26ms
659
- ✓  node  test/utils/productJsonLd.test.ts (36 tests) 10ms
660
- ✓  node  test/components/quotes/MyAccountListQuotes.test.tsx (11 tests) 845ms
661
- ✓ navigates with the search term on blur  360ms
662
- ✓ navigates without a label param when the search is cleared  361ms
663
- ✓  node  test/utils/cookieCacheBusting.test.ts (10 tests) 19ms
652
+ ✓  node  test/pages/pvt/account/cards/index.test.ts (8 tests) 7ms
653
+ ✓  node  test/components/quotes/quoteFilters.test.ts (26 tests) 20ms
654
+ ✓  node  test/utils/productJsonLd.test.ts (36 tests) 7ms
655
+ ✓  node  test/utils/cookieCacheBusting.test.ts (10 tests) 9ms
664
656
  ✓  node  test/experimental/myAccountCmsServerSideProps.test.ts (5 tests) 7ms
665
- ✓  node  test/utils/clearCookies.test.ts (20 tests) 22ms
666
- ✓  node  test/utils/multipleTemplates.test.ts (8 tests) 8ms
657
+ ✓  node  test/components/quotes/MyAccountListQuotes.test.tsx (11 tests) 811ms
658
+ ✓ navigates with the search term on blur  359ms
659
+ ✓ navigates without a label param when the search is cleared  356ms
660
+ ✓  node  test/utils/clearCookies.test.ts (20 tests) 16ms
661
+ ✓  node  test/utils/multipleTemplates.test.ts (8 tests) 5ms
662
+ ✓  node  test/sdk/orderEntry/useOrderEntryOperation.test.ts (8 tests) 36ms
667
663
  stderr | test/sdk/account/useSetPassword.test.ts > useSetPassword > maps wrongcredentials error responses to the existing message
668
664
  Set password request failed: Bad Request
669
665
 
670
- ✓  node  test/sdk/account/useSetPassword.test.ts (6 tests) 46ms
671
- ✓  node  test/sdk/orderEntry/useOrderEntryOperation.test.ts (8 tests) 45ms
672
- ✓  node  test/utils/localization/localizeRedirectDestination.test.ts (11 tests) 7ms
673
- ✓  node  test/components/quotes/MyAccountQuotesFilterSlider.test.tsx (8 tests) 175ms
666
+ ✓  node  test/sdk/account/useSetPassword.test.ts (6 tests) 36ms
667
+ ✓  node  test/utils/localization/localizeRedirectDestination.test.ts (11 tests) 4ms
668
+ ✓  node  test/components/quotes/MyAccountQuotesFilterSlider.test.tsx (8 tests) 126ms
674
669
  ✓  node  test/utils/localization/hreflang.test.ts (8 tests) 5ms
675
- ✓  node  test/components/quotes/MyAccountQuotesStatusSelector.test.tsx (14 tests) 221ms
676
- ✓  node  test/sdk/account/getMyAccountRoutes.test.ts (13 tests) 10ms
677
- ✓  node  test/components/quotes/MyAccountQuotesSelectedTags.test.tsx (10 tests) 124ms
678
- ✓  node  test/server/cms/index.test.ts (7 tests) 10ms
679
- ✓  node  test/server/content/promiseCache.test.ts (10 tests) 17ms
680
- ✓  node  test/sdk/redirects/index.test.ts (7 tests) 56ms
681
- ✓  node  test/sdk/orderEntry/useOrderEntryUpload.test.ts (8 tests) 49ms
682
- ✓  node  test/proxy.localization.test.ts (5 tests) 66ms
683
- ✓  node  test/sdk/orderEntry/useOrderEntry.test.ts (8 tests) 56ms
684
- ✓  node  test/utils/trustedForwardedHost.test.ts (36 tests) 12ms
685
- ✓  node  test/components/account/orders/getDeliveryOptionLabel.test.ts (21 tests) 8ms
686
- ✓  node  test/sdk/graphql/retryPolicy.test.ts (18 tests) 29ms
687
- ✓  node  test/server/cms/myAccountDefaultSections.test.ts (9 tests) 11ms
688
- ✓  node  test/utils/productJsonLdRendering.test.tsx (5 tests) 15ms
689
- ✓  node  test/server/index.test.ts (7 tests) 892ms
690
- ✓ should return a valid merged GraphQL schema  307ms
691
- ✓ should handle options and execute  331ms
692
- ✓  node  test/proxy.test.ts (4 tests) 21ms
693
- ✓  node  test/sdk/analytics/useStartRecommendationSession.test.ts (6 tests) 57ms
694
- ✓  node  test/pages/api/logout.test.ts (4 tests) 32ms
695
- ✓  node  test/sdk/orderEntry/useOrderFormItems.test.ts (7 tests) 36ms
670
+ ✓  node  test/components/quotes/MyAccountQuotesStatusSelector.test.tsx (14 tests) 122ms
671
+ ✓  node  test/sdk/account/getMyAccountRoutes.test.ts (13 tests) 5ms
672
+ ✓  node  test/components/quotes/MyAccountQuotesSelectedTags.test.tsx (10 tests) 96ms
673
+ ✓  node  test/server/cms/index.test.ts (7 tests) 8ms
674
+ ✓  node  test/server/content/promiseCache.test.ts (10 tests) 12ms
675
+ ✓  node  test/sdk/redirects/index.test.ts (7 tests) 41ms
676
+ ✓  node  test/sdk/orderEntry/useOrderEntryUpload.test.ts (8 tests) 46ms
677
+ ✓  node  test/sdk/orderEntry/useOrderEntry.test.ts (8 tests) 41ms
678
+ ✓  node  test/proxy.localization.test.ts (5 tests) 35ms
679
+ ✓  node  test/utils/trustedForwardedHost.test.ts (36 tests) 7ms
680
+ ✓  node  test/components/account/orders/getDeliveryOptionLabel.test.ts (21 tests) 6ms
681
+ ✓  node  test/server/cms/myAccountDefaultSections.test.ts (9 tests) 6ms
682
+ ✓  node  test/sdk/graphql/retryPolicy.test.ts (18 tests) 15ms
683
+ ✓  node  test/utils/productJsonLdRendering.test.tsx (5 tests) 8ms
684
+ ✓  node  test/server/index.test.ts (7 tests) 694ms
685
+ ✓ should handle options and execute  337ms
686
+ ✓  node  test/proxy.test.ts (4 tests) 16ms
687
+ ✓  node  test/sdk/analytics/useStartRecommendationSession.test.ts (6 tests) 32ms
688
+ ✓  node  test/pages/api/logout.test.ts (4 tests) 27ms
696
689
  ✓  node  test/utils/shouldBypassRefreshToken.test.ts (14 tests) 6ms
690
+ ✓  node  test/sdk/orderEntry/useOrderFormItems.test.ts (7 tests) 32ms
697
691
  ✓  node  test/server/webops-api.test.ts (9 tests) 12ms
698
- ✓  node  test/components/account/orders/StatusCard.test.ts (3 tests) 32ms
699
- ✓  node  test/sdk/deliveryPromise/queries.test.ts (4 tests) 11ms
700
- ✓  node  test/sdk/localization/store-url.test.ts (4 tests) 5ms
701
- ✓  node  test/sdk/cart/waitForSessionValidated.test.ts (5 tests) 13ms
702
- ✓  node  test/server/cms/global.test.ts (3 tests) 7ms
703
- ✓  node  test/sdk/deliveryPromise/provider.test.ts (11 tests) 6ms
704
- ✓  node  test/sdk/auth/useAuth.test.ts (5 tests) 51ms
705
- ✓  node  test/utils/getRequestHostname.test.ts (12 tests) 8ms
706
- ✓  node  test/components/account/Layout.test.tsx (6 tests) 80ms
707
- ✓  node  test/server/rootSpan.test.ts (4 tests) 32ms
708
- ✓  node  test/pages/api/preview.test.ts (2 tests) 13ms
709
- ✓  node  test/components/search/SearchInput.test.ts (6 tests) 8ms
710
- ✓  node  test/utils/validateSessionRefreshToken.test.ts (6 tests) 6ms
711
- ✓  node  test/pages/pvt/account/403.test.ts (5 tests) 8ms
712
- ✓  node  test/components/region/useRegion.test.ts (1 test) 28ms
713
- ✓  node  test/sdk/recommendations/vrn.test.ts (5 tests) 6ms
692
+ ✓  node  test/components/account/orders/StatusCard.test.ts (3 tests) 15ms
693
+ ✓  node  test/sdk/deliveryPromise/queries.test.ts (4 tests) 6ms
694
+ ✓  node  test/sdk/localization/store-url.test.ts (4 tests) 4ms
695
+ ✓  node  test/sdk/cart/waitForSessionValidated.test.ts (5 tests) 8ms
696
+ ✓  node  test/server/cms/global.test.ts (3 tests) 5ms
697
+ ✓  node  test/sdk/deliveryPromise/provider.test.ts (11 tests) 5ms
698
+ ✓  node  test/sdk/auth/useAuth.test.ts (5 tests) 35ms
699
+ stderr | test/server/storeDirectives.test.ts > store directives through the core server > applies @auth from a store field and validates the session once
700
+ https://storeframework.vtexcommercestable.com.br/api/vtexid/credential/validate {
701
+ headers: { 'content-type': 'application/json', 'X-FORWARDED-HOST': '' },
702
+ body: '[redacted]',
703
+ method: 'POST'
704
+ } { status: 401, statusText: 'Unauthorized', headers: {} }
705
+
706
+ ✓  node  test/server/storeDirectives.test.ts (2 tests) 80ms
707
+ ✓  node  test/utils/getRequestHostname.test.ts (12 tests) 10ms
708
+ ✓  node  test/server/rootSpan.test.ts (4 tests) 33ms
709
+ ✓  node  test/pages/api/preview.test.ts (2 tests) 7ms
710
+ ✓  node  test/components/search/SearchInput.test.ts (6 tests) 4ms
711
+ ✓  node  test/components/account/Layout.test.tsx (6 tests) 45ms
712
+ ✓  node  test/utils/validateSessionRefreshToken.test.ts (6 tests) 5ms
713
+ ✓  node  test/pages/pvt/account/403.test.ts (5 tests) 4ms
714
+ ✓  node  test/components/region/useRegion.test.ts (1 test) 19ms
715
+ ✓  node  test/sdk/recommendations/vrn.test.ts (5 tests) 4ms
714
716
  ✓  node  test/utils/retry.test.ts (5 tests) 12ms
715
- ✓  node  test/sdk/account/getIsB2BBuyer.test.ts (7 tests) 7ms
716
- ✓  node  test/sdk/account/getB2BSessionClaims.test.ts (4 tests) 4ms
717
- ✓  node  test/sdk/recommendations/useRecommendationUserId.test.ts (4 tests) 192ms
717
+ ✓  node  test/sdk/account/getIsB2BBuyer.test.ts (7 tests) 5ms
718
+ ✓  node  test/sdk/account/getB2BSessionClaims.test.ts (4 tests) 3ms
719
+ ✓  node  test/sdk/recommendations/useRecommendationUserId.test.ts (4 tests) 185ms
718
720
  ✓  node  test/utils/userOrderStatus.test.ts (4 tests) 5ms
719
- ✓  node  test/utils/unlockResponse.test.ts (11 tests) 6ms
720
- ✓  node  test/sdk/recommendations/useRecommendations.test.ts (2 tests) 6ms
721
- ✓  node  test/components/account/OrganizationDrawerBody.test.tsx (3 tests) 55ms
722
- ✓  node  test/sdk/deliveryPromise/reducer.test.ts (2 tests) 5ms
723
- ✓  node  test/utils/isLocalHost.test.ts (7 tests) 5ms
724
- ✓  node  test/sdk/session/toSessionInput.test.ts (3 tests) 5ms
725
- ✓  node  test/components/quotes/MyAccountQuoteStatusBadge.test.tsx (4 tests) 41ms
726
- ✓  node  test/components/account/orders/listOrdersLabels.test.ts (2 tests) 4ms
721
+ ✓  node  test/utils/unlockResponse.test.ts (11 tests) 3ms
722
+ ✓  node  test/sdk/recommendations/useRecommendations.test.ts (2 tests) 3ms
723
+ ✓  node  test/components/account/OrganizationDrawerBody.test.tsx (3 tests) 41ms
724
+ ✓  node  test/sdk/deliveryPromise/reducer.test.ts (2 tests) 3ms
725
+ ✓  node  test/components/quotes/MyAccountQuoteStatusBadge.test.tsx (4 tests) 36ms
726
+ ✓  node  test/utils/isLocalHost.test.ts (7 tests) 3ms
727
+ ✓  node  test/sdk/session/toSessionInput.test.ts (3 tests) 4ms
727
728
  ✓  node  test/components/account/orders/getOrderTotalLabel.test.ts (6 tests) 4ms
728
- ✓  node  test/sdk/session/isSignInAreaResolved.test.ts (3 tests) 4ms
729
+ ✓  node  test/components/account/orders/listOrdersLabels.test.ts (2 tests) 3ms
730
+ ✓  node  test/components/auth/ProfileChallenge.test.tsx (3 tests) 31ms
729
731
  ✓  node  test/utils/getCookie.test.ts (4 tests) 4ms
730
- ✓  node  test/components/auth/ProfileChallenge.test.tsx (3 tests) 45ms
731
- ✓  node  test/utils/filterChannel.test.ts (2 tests) 5ms
732
- ✓  node  test/sdk/analytics/utils.test.ts (2 tests) 5ms
733
- ✓  node  test/instrumentation.test.ts (3 tests) 5ms
734
- ✓  node  test/components/account/orders/orderDetailsLabels.test.ts (1 test) 3ms
735
- ✓  node  test/sdk/account/clearPersistedSessionState.test.ts (1 test) 11ms
736
-
737
-  Test Files  146 passed (146)
738
-  Tests  1249 passed (1249)
739
-  Start at  13:48:44
740
-  Duration  69.97s (transform 15.08s, setup 0ms, import 63.53s, tests 23.79s, environment 85.27s)
732
+ ✓  node  test/sdk/session/isSignInAreaResolved.test.ts (3 tests) 3ms
733
+ ✓  node  test/utils/filterChannel.test.ts (2 tests) 3ms
734
+ ✓  node  test/sdk/analytics/utils.test.ts (2 tests) 3ms
735
+ ✓  node  test/instrumentation.test.ts (3 tests) 4ms
736
+ ✓  node  test/components/account/orders/orderDetailsLabels.test.ts (1 test) 2ms
737
+ ✓  node  test/sdk/account/clearPersistedSessionState.test.ts (1 test) 9ms
738
+
739
+  Test Files  147 passed (147)
740
+  Tests  1251 passed (1251)
741
+  Start at  14:51:41
742
+  Duration  53.68s (transform 11.67s, setup 0ms, import 48.07s, tests 19.18s, environment 64.85s)
741
743
 
@@ -56,7 +56,6 @@ export type Scalars = {
56
56
  */
57
57
  FormattedVariants: { input: any; output: any; }
58
58
  JSONObject: { input: any; output: any; }
59
- /** A string or the string representation of an object (a stringified object). */
60
59
  ObjectOrString: { input: any; output: any; }
61
60
  /**
62
61
  * Example:
@@ -691,9 +691,6 @@ type Mutation {
691
691
  startRecommendationSession: Boolean!
692
692
  }
693
693
 
694
- """
695
- A string or the string representation of an object (a stringified object).
696
- """
697
694
  scalar ObjectOrString
698
695
 
699
696
  """Newsletter information."""
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.11.1-dev.1](https://github.com/vtex/faststore/compare/v4.11.1-dev.0...v4.11.1-dev.1) (2026-11-04)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **api:** apply [@auth](https://github.com/auth) and [@cache](https://github.com/cache)Control to store schema extensions ([#3524](https://github.com/vtex/faststore/issues/3524)) ([f6abd0d](https://github.com/vtex/faststore/commit/f6abd0d4f7312794a4195ce693526b539550275e)), closes [#3111](https://github.com/vtex/faststore/issues/3111) [/github.com/vtex/faststore/pull/3524#issuecomment-6258456970](https://github.com//github.com/vtex/faststore/pull/3524/issues/issuecomment-6258456970) [#3111](https://github.com/vtex/faststore/issues/3111) [#3063](https://github.com/vtex/faststore/issues/3063)
11
+
12
+ ## [4.11.1-dev.0](https://github.com/vtex/faststore/compare/v4.11.0...v4.11.1-dev.0) (2026-11-03)
13
+
14
+ ## [4.10.3-dev.1](https://github.com/vtex/faststore/compare/v4.10.3-dev.0...v4.10.3-dev.1) (2026-10-29)
15
+
16
+ ## [4.10.3-dev.0](https://github.com/vtex/faststore/compare/v4.10.2...v4.10.3-dev.0) (2026-10-29)
17
+
18
+ **Note:** Version bump only for package @faststore/core
19
+
20
+ ## [4.10.3-dev.1](https://github.com/vtex/faststore/compare/v4.10.3-dev.0...v4.10.3-dev.1) (2026-10-29)
21
+
22
+ **Note:** Version bump only for package @faststore/core
23
+
24
+ ## [4.10.3-dev.0](https://github.com/vtex/faststore/compare/v4.10.2...v4.10.3-dev.0) (2026-10-29)
25
+
6
26
  # [4.11.0](https://github.com/vtex/faststore/compare/v4.10.3...v4.11.0) (2026-11-03)
7
27
 
8
28
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "4.11.0",
3
+ "version": "4.11.1-dev.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -71,11 +71,11 @@
71
71
  "style-loader": "^3.3.1",
72
72
  "swr": "^2.2.5",
73
73
  "use-sync-external-store": "^1.6.0",
74
- "@faststore/api": "4.11.0",
75
- "@faststore/diagnostics": "4.11.0",
76
- "@faststore/sdk": "4.11.0",
77
- "@faststore/lighthouse": "4.11.0",
78
- "@faststore/ui": "4.11.0"
74
+ "@faststore/diagnostics": "4.11.1-dev.1",
75
+ "@faststore/sdk": "4.11.1-dev.1",
76
+ "@faststore/api": "4.11.1-dev.1",
77
+ "@faststore/ui": "4.11.1-dev.1",
78
+ "@faststore/lighthouse": "4.11.1-dev.1"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@cypress/code-coverage": "^3.12.1",
@@ -15,6 +15,7 @@ import {
15
15
  GraphqlVtexContextFactory,
16
16
  GraphqlVtexSchema,
17
17
  isFastStoreError,
18
+ platformTypeDefs,
18
19
  } from '@faststore/api'
19
20
  import { OTELAPI } from '@faststore/diagnostics'
20
21
  import { loadFilesSync } from '@graphql-tools/load-files'
@@ -57,10 +58,11 @@ function loadGeneratedSchema(): TypeSource {
57
58
  }
58
59
 
59
60
  export function getFinalAPISchema() {
60
- const finalTypeDefs = mergeTypeDefs([
61
- GraphqlVtexSchema(),
62
- loadGeneratedSchema(),
63
- ])
61
+ // `platformTypeDefs` is the native SDL plus the directive definitions.
62
+ // Building `GraphqlVtexSchema()` here would run the transformers and throw
63
+ // the result away: this value is only merged as type definitions, and the
64
+ // call below applies the transformers once.
65
+ const finalTypeDefs = mergeTypeDefs([platformTypeDefs, loadGeneratedSchema()])
64
66
 
65
67
  const schema = makeExecutableSchema({
66
68
  typeDefs: finalTypeDefs,
@@ -0,0 +1,89 @@
1
+ import { stringifyCacheControl } from '@faststore/api'
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest'
3
+
4
+ import { execute } from '../../src/server'
5
+
6
+ const probeResolvers = vi.hoisted(() => ({
7
+ Query: {
8
+ probeAuth: vi.fn(() => 'auth-ok'),
9
+ probeCache: vi.fn(() => 'cache-ok'),
10
+ },
11
+ }))
12
+
13
+ const fetchMock = vi.hoisted(() => vi.fn())
14
+
15
+ vi.mock('../../src/customizations/src/graphql/thirdParty/resolvers', () => ({
16
+ default: probeResolvers,
17
+ }))
18
+
19
+ vi.mock('isomorphic-unfetch', () => ({
20
+ default: (...args: unknown[]) => fetchMock(...args),
21
+ }))
22
+
23
+ vi.mock('@graphql-tools/load-files', () => ({
24
+ loadFilesSync: () => [
25
+ /* GraphQL */ `
26
+ extend type Query {
27
+ probeAuth: String @auth
28
+ probeCache: String
29
+ @cacheControl(scope: "private", sMaxAge: 7, staleWhileRevalidate: 11)
30
+ }
31
+ `,
32
+ ],
33
+ }))
34
+
35
+ const operation = (operationName: string, query: string) => ({
36
+ variables: {},
37
+ query,
38
+ operation: {
39
+ __meta__: { operationName, operationHash: operationName },
40
+ },
41
+ })
42
+
43
+ describe('store directives through the core server', () => {
44
+ beforeEach(() => {
45
+ probeResolvers.Query.probeAuth.mockClear()
46
+ probeResolvers.Query.probeCache.mockClear()
47
+ fetchMock.mockReset()
48
+ fetchMock.mockResolvedValue({
49
+ ok: false,
50
+ status: 401,
51
+ statusText: 'Unauthorized',
52
+ headers: new Headers(),
53
+ text: async () => 'unauthorized',
54
+ json: async () => ({}),
55
+ })
56
+ })
57
+
58
+ it('applies @cacheControl from a store field to the response extensions', async () => {
59
+ const result = await execute(
60
+ operation('ProbeCacheQuery', 'query ProbeCacheQuery { probeCache }')
61
+ )
62
+
63
+ expect(result.errors).toBeUndefined()
64
+ expect(result.data).toEqual({ probeCache: 'cache-ok' })
65
+ expect(result.extensions.cacheControl).toEqual({
66
+ scope: 'private',
67
+ sMaxAge: 7,
68
+ staleWhileRevalidate: 11,
69
+ })
70
+ expect(
71
+ stringifyCacheControl(result.extensions.cacheControl ?? {}, false)
72
+ ).toBe('private, s-maxage=7, stale-while-revalidate=11')
73
+ })
74
+
75
+ it('applies @auth from a store field and validates the session once', async () => {
76
+ const result = await execute(
77
+ operation('ProbeAuthQuery', 'query ProbeAuthQuery { probeAuth }')
78
+ )
79
+
80
+ expect(result.data).toEqual({ probeAuth: null })
81
+ expect(result.errors?.length).toBeGreaterThan(0)
82
+ expect(probeResolvers.Query.probeAuth).not.toHaveBeenCalled()
83
+ expect(
84
+ fetchMock.mock.calls.filter(([url]) =>
85
+ String(url).includes('/api/vtexid/credential/validate')
86
+ )
87
+ ).toHaveLength(1)
88
+ })
89
+ })