@c-rex/services 0.3.0-build.51 → 0.3.0-build.52

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.
@@ -1516,7 +1516,13 @@ import {
1516
1516
  CREX_READMODEL_CACHE_STATIC_PAGES_TAG
1517
1517
  } from "@c-rex/core/requests";
1518
1518
  import { CrexLogger as CrexLogger2 } from "@c-rex/core/logger";
1519
- import { RENDITION_LINK_RELS } from "@c-rex/constants";
1519
+ import {
1520
+ CREX_TOKEN_HEADER_KEY,
1521
+ RENDITION_LINK_RELS,
1522
+ TOKEN_SOURCES
1523
+ } from "@c-rex/constants";
1524
+ import { cookies as cookies2 } from "next/headers";
1525
+ import { CrexSDK as CrexSDK2 } from "@c-rex/core/sdk";
1520
1526
  var DEFAULT_SORT = ["-informationSubjects.id"];
1521
1527
  var DEFAULT_PAGE_SIZE = 100;
1522
1528
  var RENDITION_FETCH_TIMEOUT_MS = 5e3;
@@ -1654,9 +1660,23 @@ var getStaticPagesCached = unstable_cache4(
1654
1660
  ]
1655
1661
  }
1656
1662
  );
1663
+ var getCurrentUserAuthToken = async () => {
1664
+ try {
1665
+ const config = new CrexSDK2().getServerConfig();
1666
+ if (config.OIDC.tokenSource !== TOKEN_SOURCES.USER_LOGIN) return void 0;
1667
+ const token = (await cookies2()).get(CREX_TOKEN_HEADER_KEY)?.value.trim();
1668
+ return token || void 0;
1669
+ } catch {
1670
+ return void 0;
1671
+ }
1672
+ };
1657
1673
  var getStaticPages = async (query) => {
1658
1674
  try {
1659
- const pages = await getStaticPagesCached(query);
1675
+ const authToken = await getCurrentUserAuthToken();
1676
+ const pages = authToken ? await withServerRequestContext(
1677
+ { skipCookieTokenLookup: true, authToken },
1678
+ () => fetchStaticPages(query)
1679
+ ) : await getStaticPagesCached(query);
1660
1680
  return { status: "ok", pages };
1661
1681
  } catch (error) {
1662
1682
  const logger = new CrexLogger2();