@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.
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -2
- package/dist/index.mjs.map +1 -1
- package/dist/read-models/index.d.mts +4 -1
- package/dist/read-models/index.d.ts +4 -1
- package/dist/read-models/index.js +17 -1
- package/dist/read-models/index.js.map +1 -1
- package/dist/read-models/index.mjs +22 -2
- package/dist/read-models/index.mjs.map +1 -1
- package/dist/toc-structure.d.mts +17 -2
- package/dist/toc-structure.d.ts +17 -2
- package/dist/toc-structure.js +21 -0
- package/dist/toc-structure.js.map +1 -1
- package/dist/toc-structure.mjs +18 -0
- package/dist/toc-structure.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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 {
|
|
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
|
|
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();
|