@c-rex/services 0.3.0-build.85 → 0.3.0-build.91
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/generated/server-requests.js +1 -1
- package/dist/generated/server-requests.js.map +1 -1
- package/dist/generated/server-requests.mjs +1 -1
- package/dist/generated/server-requests.mjs.map +1 -1
- package/dist/index.js +145 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +156 -62
- package/dist/index.mjs.map +1 -1
- package/dist/read-models/index.js +144 -54
- package/dist/read-models/index.js.map +1 -1
- package/dist/read-models/index.mjs +155 -61
- package/dist/read-models/index.mjs.map +1 -1
- package/dist/vcard/index.js +2 -2
- package/dist/vcard/index.js.map +1 -1
- package/dist/vcard/index.mjs +2 -2
- package/dist/vcard/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ var baseServerRequest = async (endpoint, query) => {
|
|
|
19
19
|
url: endpoint,
|
|
20
20
|
method: "GET",
|
|
21
21
|
params: withGlobalRestriction(query),
|
|
22
|
-
|
|
22
|
+
skipUserSession: requestContext?.skipUserSession,
|
|
23
23
|
authToken: requestContext?.authToken
|
|
24
24
|
});
|
|
25
25
|
return response;
|
|
@@ -1279,7 +1279,7 @@ var getOrganizationProfileById = async (id, query) => {
|
|
|
1279
1279
|
};
|
|
1280
1280
|
var getOrganizationProfileByIdCached = unstable_cache(
|
|
1281
1281
|
async (id, query, context) => withServerRequestContext(
|
|
1282
|
-
{
|
|
1282
|
+
{ skipUserSession: true },
|
|
1283
1283
|
() => fetchOrganizationProfileById(id, query, context)
|
|
1284
1284
|
),
|
|
1285
1285
|
["read-model", "organization-profile-v2"],
|
|
@@ -1576,11 +1576,15 @@ var resolveLocalizedLabel = (labels, uiLanguage) => {
|
|
|
1576
1576
|
language: (item.language || "").trim().toLowerCase(),
|
|
1577
1577
|
value: (item.value || "").trim()
|
|
1578
1578
|
})).filter((item) => item.value.length > 0);
|
|
1579
|
-
const exact = normalized.find(
|
|
1579
|
+
const exact = normalized.find(
|
|
1580
|
+
(item) => item.language === normalizedUiLanguage
|
|
1581
|
+
)?.value;
|
|
1580
1582
|
if (exact) return exact;
|
|
1581
1583
|
const base = normalized.find((item) => item.language === baseLanguage)?.value;
|
|
1582
1584
|
if (base) return base;
|
|
1583
|
-
const english = normalized.find(
|
|
1585
|
+
const english = normalized.find(
|
|
1586
|
+
(item) => item.language === "en" || item.language === "en-us"
|
|
1587
|
+
)?.value;
|
|
1584
1588
|
if (english) return english;
|
|
1585
1589
|
return normalized[0]?.value;
|
|
1586
1590
|
};
|
|
@@ -1639,24 +1643,39 @@ var isNotFoundError = (error) => {
|
|
|
1639
1643
|
return error.message.includes("HTTP error! status: 404");
|
|
1640
1644
|
};
|
|
1641
1645
|
var resolveMissingClassLabels = async (items, uiLanguage) => {
|
|
1642
|
-
const classIds = Array.from(
|
|
1643
|
-
|
|
1644
|
-
|
|
1646
|
+
const classIds = Array.from(
|
|
1647
|
+
new Set(
|
|
1648
|
+
items.map((item) => item.class?.id?.trim()).filter((id) => Boolean(id)).filter(
|
|
1649
|
+
(id) => !resolveLocalizedLabel(
|
|
1650
|
+
items.find((item) => item.class?.id?.trim() === id)?.class?.labels || [],
|
|
1651
|
+
uiLanguage
|
|
1652
|
+
)
|
|
1653
|
+
)
|
|
1654
|
+
)
|
|
1655
|
+
);
|
|
1645
1656
|
const result = {};
|
|
1646
|
-
await Promise.all(
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1657
|
+
await Promise.all(
|
|
1658
|
+
classIds.map(async (classId) => {
|
|
1659
|
+
try {
|
|
1660
|
+
const entity = await withServerRequestContext(
|
|
1661
|
+
{ skipUserSession: true },
|
|
1662
|
+
() => domainEntitiesGetByIdServer(
|
|
1663
|
+
{ id: classId },
|
|
1664
|
+
{ Fields: ["labels"] }
|
|
1665
|
+
)
|
|
1666
|
+
);
|
|
1667
|
+
result[classId] = resolveLocalizedLabel(
|
|
1668
|
+
entity.labels || [],
|
|
1669
|
+
uiLanguage
|
|
1670
|
+
);
|
|
1671
|
+
} catch (error) {
|
|
1672
|
+
if (!isNotFoundError(error)) {
|
|
1673
|
+
throw error;
|
|
1674
|
+
}
|
|
1675
|
+
result[classId] = void 0;
|
|
1656
1676
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}));
|
|
1677
|
+
})
|
|
1678
|
+
);
|
|
1660
1679
|
return result;
|
|
1661
1680
|
};
|
|
1662
1681
|
var deriveParentIds = (entity) => {
|
|
@@ -1675,14 +1694,23 @@ var buildTaxonomyTree = (items, options) => {
|
|
|
1675
1694
|
if (!entityRef) continue;
|
|
1676
1695
|
nodesById[entityRef.id] = {
|
|
1677
1696
|
...entityRef,
|
|
1678
|
-
classRef: toClassRef(
|
|
1697
|
+
classRef: toClassRef(
|
|
1698
|
+
item.class,
|
|
1699
|
+
options.uiLanguage,
|
|
1700
|
+
options.classLabelsById
|
|
1701
|
+
),
|
|
1679
1702
|
parentIds: deriveParentIds(item)
|
|
1680
1703
|
};
|
|
1681
1704
|
}
|
|
1682
1705
|
Object.values(nodesById).forEach((node) => {
|
|
1683
|
-
parentLinks.set(
|
|
1706
|
+
parentLinks.set(
|
|
1707
|
+
node.id,
|
|
1708
|
+
node.parentIds.filter((id) => Boolean(nodesById[id]))
|
|
1709
|
+
);
|
|
1684
1710
|
});
|
|
1685
|
-
const roots = Object.values(nodesById).filter(
|
|
1711
|
+
const roots = Object.values(nodesById).filter(
|
|
1712
|
+
(node) => (parentLinks.get(node.id) || []).length === 0
|
|
1713
|
+
);
|
|
1686
1714
|
if (!options.groupRootsByClass) {
|
|
1687
1715
|
return {
|
|
1688
1716
|
roots: roots.sort((a, b) => a.label.localeCompare(b.label)),
|
|
@@ -1727,10 +1755,13 @@ var createTaxonomyResolver = (options) => {
|
|
|
1727
1755
|
const cached = unstable_cache2(
|
|
1728
1756
|
async (_queryKey, query, uiLanguage) => {
|
|
1729
1757
|
const items = await withServerRequestContext(
|
|
1730
|
-
{
|
|
1758
|
+
{ skipUserSession: true },
|
|
1731
1759
|
() => fetchAllPages(options.fetch, query)
|
|
1732
1760
|
);
|
|
1733
|
-
const classLabelsById = await resolveMissingClassLabels(
|
|
1761
|
+
const classLabelsById = await resolveMissingClassLabels(
|
|
1762
|
+
items,
|
|
1763
|
+
uiLanguage
|
|
1764
|
+
);
|
|
1734
1765
|
const result = buildTaxonomyTree(items, {
|
|
1735
1766
|
...defaultTreeOptions(uiLanguage),
|
|
1736
1767
|
classLabelsById
|
|
@@ -1738,8 +1769,16 @@ var createTaxonomyResolver = (options) => {
|
|
|
1738
1769
|
const bytes = measureSerializedBytes(result);
|
|
1739
1770
|
const limitBytes = resolveMetadataCacheMaxBytes();
|
|
1740
1771
|
if (bytes > limitBytes) {
|
|
1741
|
-
suppressMetadataCacheFamilyRuntime(options.cacheFamily, {
|
|
1742
|
-
|
|
1772
|
+
suppressMetadataCacheFamilyRuntime(options.cacheFamily, {
|
|
1773
|
+
bytes,
|
|
1774
|
+
limitBytes
|
|
1775
|
+
});
|
|
1776
|
+
await logCacheOverflow(
|
|
1777
|
+
options.cacheFamily,
|
|
1778
|
+
bytes,
|
|
1779
|
+
limitBytes,
|
|
1780
|
+
options.cacheKey
|
|
1781
|
+
);
|
|
1743
1782
|
return {
|
|
1744
1783
|
roots: [],
|
|
1745
1784
|
nodesById: {},
|
|
@@ -1762,7 +1801,10 @@ var createTaxonomyResolver = (options) => {
|
|
|
1762
1801
|
);
|
|
1763
1802
|
return async (query) => {
|
|
1764
1803
|
const uiLanguage = await resolveUiLanguage();
|
|
1765
|
-
const normalizedQuery = {
|
|
1804
|
+
const normalizedQuery = {
|
|
1805
|
+
...options.defaultQuery,
|
|
1806
|
+
...query || {}
|
|
1807
|
+
};
|
|
1766
1808
|
const cacheKey = stableSerialize({ normalizedQuery, uiLanguage });
|
|
1767
1809
|
return cached(cacheKey, normalizedQuery, uiLanguage);
|
|
1768
1810
|
};
|
|
@@ -1897,8 +1939,11 @@ var mergeRoleRef = (current, candidate) => {
|
|
|
1897
1939
|
var getPartiesCached = unstable_cache2(
|
|
1898
1940
|
async (_queryKey, query, uiLanguage) => {
|
|
1899
1941
|
const items = await withServerRequestContext(
|
|
1900
|
-
{
|
|
1901
|
-
() => fetchAllPages(
|
|
1942
|
+
{ skipUserSession: true },
|
|
1943
|
+
() => fetchAllPages(
|
|
1944
|
+
partiesGetAllServer,
|
|
1945
|
+
query
|
|
1946
|
+
)
|
|
1902
1947
|
);
|
|
1903
1948
|
const groups = /* @__PURE__ */ new Map();
|
|
1904
1949
|
items.forEach((party) => {
|
|
@@ -1936,7 +1981,12 @@ var getPartiesCached = unstable_cache2(
|
|
|
1936
1981
|
["read-model", "parties"],
|
|
1937
1982
|
{
|
|
1938
1983
|
revalidate: READMODEL_CACHE_POLICY.metadataRevalidateSeconds,
|
|
1939
|
-
tags: [
|
|
1984
|
+
tags: [
|
|
1985
|
+
CREX_API_CACHE_TAG2,
|
|
1986
|
+
CREX_READMODEL_CACHE_TAG2,
|
|
1987
|
+
CREX_READMODEL_CACHE_METADATA_TAG,
|
|
1988
|
+
CREX_READMODEL_CACHE_PARTIES_TAG
|
|
1989
|
+
]
|
|
1940
1990
|
}
|
|
1941
1991
|
);
|
|
1942
1992
|
var getInformationSubjects = async () => {
|
|
@@ -1949,7 +1999,10 @@ var getInformationSubjects = async () => {
|
|
|
1949
1999
|
return categories;
|
|
1950
2000
|
}
|
|
1951
2001
|
} catch (error) {
|
|
1952
|
-
console.warn(
|
|
2002
|
+
console.warn(
|
|
2003
|
+
"[MetadataReadModels] Categories endpoint unavailable, falling back to InformationSubjects.",
|
|
2004
|
+
error
|
|
2005
|
+
);
|
|
1953
2006
|
}
|
|
1954
2007
|
return getInformationSubjectsLegacyCached();
|
|
1955
2008
|
};
|
|
@@ -1967,7 +2020,11 @@ var getParties = async () => {
|
|
|
1967
2020
|
Fields: ["labels", "partyRole", "vcard", "class"],
|
|
1968
2021
|
Sort: ["shortId"]
|
|
1969
2022
|
};
|
|
1970
|
-
return getPartiesCached(
|
|
2023
|
+
return getPartiesCached(
|
|
2024
|
+
stableSerialize({ query, uiLanguage }),
|
|
2025
|
+
query,
|
|
2026
|
+
uiLanguage
|
|
2027
|
+
);
|
|
1971
2028
|
};
|
|
1972
2029
|
var getTopicTypes = async (query) => {
|
|
1973
2030
|
return getTopicTypesCached(query);
|
|
@@ -2221,7 +2278,11 @@ var INFORMATION_UNIT_PROPERTY_PRESENTATION = {
|
|
|
2221
2278
|
|
|
2222
2279
|
// src/read-models/metadata-presentation.ts
|
|
2223
2280
|
import { unstable_cache as unstable_cache3 } from "next/cache";
|
|
2224
|
-
import {
|
|
2281
|
+
import {
|
|
2282
|
+
CREX_API_CACHE_TAG as CREX_API_CACHE_TAG3,
|
|
2283
|
+
CREX_READMODEL_CACHE_METADATA_TAG as CREX_READMODEL_CACHE_METADATA_TAG2,
|
|
2284
|
+
CREX_READMODEL_CACHE_TAG as CREX_READMODEL_CACHE_TAG3
|
|
2285
|
+
} from "@c-rex/core/requests";
|
|
2225
2286
|
var UNKNOWN_SECTION_LABELS = {
|
|
2226
2287
|
en: {
|
|
2227
2288
|
components: "Unknown component",
|
|
@@ -2315,11 +2376,15 @@ var resolveLocalizedLabel2 = (labels, uiLanguage) => {
|
|
|
2315
2376
|
language: (item.language || "").toLowerCase(),
|
|
2316
2377
|
value: item.value || ""
|
|
2317
2378
|
})).filter((item) => item.value.length > 0);
|
|
2318
|
-
const exact = normalized.find(
|
|
2379
|
+
const exact = normalized.find(
|
|
2380
|
+
(item) => item.language === normalizedLanguage
|
|
2381
|
+
)?.value;
|
|
2319
2382
|
if (exact) return exact;
|
|
2320
2383
|
const base = normalized.find((item) => item.language === baseLanguage)?.value;
|
|
2321
2384
|
if (base) return base;
|
|
2322
|
-
const english = normalized.find(
|
|
2385
|
+
const english = normalized.find(
|
|
2386
|
+
(item) => item.language === "en" || item.language === "en-us"
|
|
2387
|
+
)?.value;
|
|
2323
2388
|
if (english) return english;
|
|
2324
2389
|
return normalized[0]?.value;
|
|
2325
2390
|
};
|
|
@@ -2335,7 +2400,7 @@ var getDomainEntitySectionLabelUncached = async (id, uiLanguage) => {
|
|
|
2335
2400
|
};
|
|
2336
2401
|
try {
|
|
2337
2402
|
const entity = await withServerRequestContext(
|
|
2338
|
-
{
|
|
2403
|
+
{ skipUserSession: true },
|
|
2339
2404
|
() => domainEntitiesGetByIdServer({ id }, query)
|
|
2340
2405
|
);
|
|
2341
2406
|
return resolveLocalizedLabel2(entity.labels || [], uiLanguage);
|
|
@@ -2351,7 +2416,11 @@ var getDomainEntitySectionLabelCached = unstable_cache3(
|
|
|
2351
2416
|
["metadata-presentation-domain-entity-label"],
|
|
2352
2417
|
{
|
|
2353
2418
|
revalidate: READMODEL_CACHE_POLICY.metadataRevalidateSeconds,
|
|
2354
|
-
tags: [
|
|
2419
|
+
tags: [
|
|
2420
|
+
CREX_API_CACHE_TAG3,
|
|
2421
|
+
CREX_READMODEL_CACHE_TAG3,
|
|
2422
|
+
CREX_READMODEL_CACHE_METADATA_TAG2
|
|
2423
|
+
]
|
|
2355
2424
|
}
|
|
2356
2425
|
);
|
|
2357
2426
|
var inFlightDomainEntityLabelRequests = /* @__PURE__ */ new Map();
|
|
@@ -2359,15 +2428,23 @@ var getDomainEntitySectionLabel = async (id, uiLanguage) => {
|
|
|
2359
2428
|
const inFlightKey = `${id}::${uiLanguage.toLowerCase()}`;
|
|
2360
2429
|
const existing = inFlightDomainEntityLabelRequests.get(inFlightKey);
|
|
2361
2430
|
if (existing) return existing;
|
|
2362
|
-
const promise = getDomainEntitySectionLabelCached(id, uiLanguage).finally(
|
|
2363
|
-
|
|
2364
|
-
|
|
2431
|
+
const promise = getDomainEntitySectionLabelCached(id, uiLanguage).finally(
|
|
2432
|
+
() => {
|
|
2433
|
+
inFlightDomainEntityLabelRequests.delete(inFlightKey);
|
|
2434
|
+
}
|
|
2435
|
+
);
|
|
2365
2436
|
inFlightDomainEntityLabelRequests.set(inFlightKey, promise);
|
|
2366
2437
|
return promise;
|
|
2367
2438
|
};
|
|
2368
2439
|
var getMetadataFacetPresentation = async (properties, uiLanguage = "en-US", options) => {
|
|
2369
|
-
const defaultProperties = Object.keys(
|
|
2370
|
-
|
|
2440
|
+
const defaultProperties = Object.keys(
|
|
2441
|
+
INFORMATION_UNIT_PROPERTY_PRESENTATION
|
|
2442
|
+
).filter(
|
|
2443
|
+
(property) => INFORMATION_UNIT_PROPERTY_PRESENTATION[property].facet.supported
|
|
2444
|
+
);
|
|
2445
|
+
const propertySet = new Set(
|
|
2446
|
+
properties && properties.length > 0 ? properties : defaultProperties
|
|
2447
|
+
);
|
|
2371
2448
|
const result = {};
|
|
2372
2449
|
const classResolvers = {
|
|
2373
2450
|
components: getComponents,
|
|
@@ -2401,7 +2478,9 @@ var getMetadataFacetPresentation = async (properties, uiLanguage = "en-US", opti
|
|
|
2401
2478
|
const parties = await getParties();
|
|
2402
2479
|
const partyPresentation = {};
|
|
2403
2480
|
parties.groups.forEach((group) => {
|
|
2404
|
-
const hidden = isMetadataGroupDenied("parties", {
|
|
2481
|
+
const hidden = isMetadataGroupDenied("parties", {
|
|
2482
|
+
partyRoleId: group.role.id
|
|
2483
|
+
});
|
|
2405
2484
|
const sectionLabel = group.role.label;
|
|
2406
2485
|
group.parties.forEach((party) => {
|
|
2407
2486
|
if (!party.shortId) return;
|
|
@@ -2435,15 +2514,27 @@ var getMetadataFacetPresentation = async (properties, uiLanguage = "en-US", opti
|
|
|
2435
2514
|
if (property === "topicTypes" || property === "contentLifeCycleStatus") {
|
|
2436
2515
|
const domainEntityId = property === "topicTypes" ? TOPIC_TYPE_DOMAIN_ENTITY_ID : CONTENT_LIFECYCLE_STATUS_DOMAIN_ENTITY_ID;
|
|
2437
2516
|
const sectionLabel = await getDomainEntitySectionLabel(domainEntityId, uiLanguage) || resolveUnknownSectionLabel(property, uiLanguage);
|
|
2438
|
-
const presentation = createClassSectionPresentation(
|
|
2517
|
+
const presentation = createClassSectionPresentation(
|
|
2518
|
+
property,
|
|
2519
|
+
taxonomy.nodesById,
|
|
2520
|
+
uiLanguage
|
|
2521
|
+
);
|
|
2439
2522
|
Object.values(presentation).forEach((entry) => {
|
|
2440
2523
|
entry.sectionLabel = sectionLabel;
|
|
2441
2524
|
});
|
|
2442
2525
|
result[property] = presentation;
|
|
2443
2526
|
return;
|
|
2444
2527
|
}
|
|
2445
|
-
const classLabelsById = await resolveMissingClassLabels2(
|
|
2446
|
-
|
|
2528
|
+
const classLabelsById = await resolveMissingClassLabels2(
|
|
2529
|
+
taxonomy.nodesById,
|
|
2530
|
+
uiLanguage
|
|
2531
|
+
);
|
|
2532
|
+
result[property] = createClassSectionPresentation(
|
|
2533
|
+
property,
|
|
2534
|
+
taxonomy.nodesById,
|
|
2535
|
+
uiLanguage,
|
|
2536
|
+
{ classLabelsById }
|
|
2537
|
+
);
|
|
2447
2538
|
})()
|
|
2448
2539
|
);
|
|
2449
2540
|
}
|
|
@@ -2679,7 +2770,11 @@ var getMetadataDisplayRows = async (data, options) => {
|
|
|
2679
2770
|
};
|
|
2680
2771
|
|
|
2681
2772
|
// src/read-models/version-availability.ts
|
|
2682
|
-
import {
|
|
2773
|
+
import {
|
|
2774
|
+
CREX_API_CACHE_TAG as CREX_API_CACHE_TAG4,
|
|
2775
|
+
CREX_READMODEL_CACHE_METADATA_TAG as CREX_READMODEL_CACHE_METADATA_TAG3,
|
|
2776
|
+
CREX_READMODEL_CACHE_TAG as CREX_READMODEL_CACHE_TAG4
|
|
2777
|
+
} from "@c-rex/core/requests";
|
|
2683
2778
|
import { resolvePreferredLanguage as resolvePreferredLanguage2 } from "@c-rex/utils";
|
|
2684
2779
|
import { unstable_cache as unstable_cache4 } from "next/cache";
|
|
2685
2780
|
var stableSerialize2 = (value) => {
|
|
@@ -2717,7 +2812,7 @@ var normalizeVersionItems = (items, uiLanguage) => {
|
|
|
2717
2812
|
var getAvailableLanguagesByVersionOfCached = unstable_cache4(
|
|
2718
2813
|
async (_cacheKey, query, uiLanguage) => {
|
|
2719
2814
|
const result = await withServerRequestContext(
|
|
2720
|
-
{
|
|
2815
|
+
{ skipUserSession: true },
|
|
2721
2816
|
() => informationUnitsGetAllServer(query)
|
|
2722
2817
|
);
|
|
2723
2818
|
return normalizeVersionItems(result.items || [], uiLanguage);
|
|
@@ -2725,12 +2820,16 @@ var getAvailableLanguagesByVersionOfCached = unstable_cache4(
|
|
|
2725
2820
|
["read-model", "version-availability"],
|
|
2726
2821
|
{
|
|
2727
2822
|
revalidate: READMODEL_CACHE_POLICY.metadataRevalidateSeconds,
|
|
2728
|
-
tags: [
|
|
2823
|
+
tags: [
|
|
2824
|
+
CREX_API_CACHE_TAG4,
|
|
2825
|
+
CREX_READMODEL_CACHE_TAG4,
|
|
2826
|
+
CREX_READMODEL_CACHE_METADATA_TAG3
|
|
2827
|
+
]
|
|
2729
2828
|
}
|
|
2730
2829
|
);
|
|
2731
2830
|
var fetchAvailableLanguagesByVersionOfDirect = async (query, uiLanguage) => {
|
|
2732
2831
|
const result = await withServerRequestContext(
|
|
2733
|
-
{
|
|
2832
|
+
{ skipUserSession: true },
|
|
2734
2833
|
() => informationUnitsGetAllServer(query)
|
|
2735
2834
|
);
|
|
2736
2835
|
return normalizeVersionItems(result.items || [], uiLanguage);
|
|
@@ -2843,12 +2942,8 @@ import {
|
|
|
2843
2942
|
CREX_READMODEL_CACHE_STATIC_PAGES_TAG
|
|
2844
2943
|
} from "@c-rex/core/requests";
|
|
2845
2944
|
import { CrexLogger as CrexLogger2 } from "@c-rex/core/logger";
|
|
2846
|
-
import {
|
|
2847
|
-
|
|
2848
|
-
RENDITION_LINK_RELS,
|
|
2849
|
-
TOKEN_SOURCES
|
|
2850
|
-
} from "@c-rex/constants";
|
|
2851
|
-
import { cookies as cookies2 } from "next/headers";
|
|
2945
|
+
import { RENDITION_LINK_RELS, TOKEN_SOURCES } from "@c-rex/constants";
|
|
2946
|
+
import { getAccessToken } from "@c-rex/core/auth/server";
|
|
2852
2947
|
import { CrexSDK as CrexSDK2 } from "@c-rex/core/sdk";
|
|
2853
2948
|
var DEFAULT_SORT = ["-informationSubjects.id"];
|
|
2854
2949
|
var DEFAULT_PAGE_SIZE = 100;
|
|
@@ -2882,7 +2977,7 @@ var findStaticPageBySlug = (pages, slug) => pages.find(
|
|
|
2882
2977
|
var resolveStaticPageResourceHref = async (shortId) => {
|
|
2883
2978
|
try {
|
|
2884
2979
|
const topic = await withServerRequestContext(
|
|
2885
|
-
{
|
|
2980
|
+
{ skipUserSession: true },
|
|
2886
2981
|
() => topicsGetByIdServer({ id: shortId }, { Fields: ["renditions"] })
|
|
2887
2982
|
);
|
|
2888
2983
|
return resolveViewHref(topic);
|
|
@@ -2973,7 +3068,7 @@ var fetchStaticPages = async (query) => {
|
|
|
2973
3068
|
};
|
|
2974
3069
|
var getStaticPagesCached = unstable_cache5(
|
|
2975
3070
|
async (query) => withServerRequestContext(
|
|
2976
|
-
{
|
|
3071
|
+
{ skipUserSession: true },
|
|
2977
3072
|
() => fetchStaticPages(query)
|
|
2978
3073
|
),
|
|
2979
3074
|
["read-model", "static-pages-v1"],
|
|
@@ -2991,8 +3086,7 @@ var getCurrentUserAuthToken = async () => {
|
|
|
2991
3086
|
try {
|
|
2992
3087
|
const config = new CrexSDK2().getServerConfig();
|
|
2993
3088
|
if (config.OIDC.tokenSource !== TOKEN_SOURCES.USER_LOGIN) return void 0;
|
|
2994
|
-
|
|
2995
|
-
return token || void 0;
|
|
3089
|
+
return (await getAccessToken())?.token || void 0;
|
|
2996
3090
|
} catch {
|
|
2997
3091
|
return void 0;
|
|
2998
3092
|
}
|
|
@@ -3001,7 +3095,7 @@ var getStaticPages = async (query) => {
|
|
|
3001
3095
|
try {
|
|
3002
3096
|
const authToken = await getCurrentUserAuthToken();
|
|
3003
3097
|
const pages = authToken ? await withServerRequestContext(
|
|
3004
|
-
{
|
|
3098
|
+
{ skipUserSession: true, authToken },
|
|
3005
3099
|
() => fetchStaticPages(query)
|
|
3006
3100
|
) : await getStaticPagesCached(query);
|
|
3007
3101
|
return { status: "ok", pages };
|