@sitecore-content-sdk/nextjs 2.4.0 → 2.4.1-canary.20260910091702
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/cjs/cache/sitecore-cache-tags.js +4 -10
- package/dist/cjs/route-handler/sitecore-revalidate-route-handler.js +2 -2
- package/dist/esm/cache/sitecore-cache-tags.js +4 -10
- package/dist/esm/route-handler/sitecore-revalidate-route-handler.js +2 -2
- package/package.json +1 -1
- package/types/cache/sitecore-cache-tags.d.ts +2 -6
- package/types/cache/sitecore-cache-tags.d.ts.map +1 -1
- package/types/cache/sitecore-page-cache-tags.d.ts +2 -2
- package/types/route-handler/sitecore-revalidate-route-handler.d.ts +2 -2
|
@@ -50,16 +50,13 @@ function buildSitecoreRouteCacheTag(params) {
|
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Tag for a layout/route item (and anything else keyed the same way). Use for item-level invalidation.
|
|
53
|
-
* @param {BuildSitecoreItemCacheTagParams} params - Item id
|
|
53
|
+
* @param {BuildSitecoreItemCacheTagParams} params - Item id and locale.
|
|
54
54
|
* @internal
|
|
55
55
|
*/
|
|
56
56
|
function buildSitecoreItemCacheTag(params) {
|
|
57
57
|
const id = normalizeSitecoreItemIdForCacheTag(params.itemId);
|
|
58
58
|
const locale = sanitizeSitecoreCacheTagSegment(params.locale);
|
|
59
|
-
|
|
60
|
-
? `v${Math.trunc(params.version)}`
|
|
61
|
-
: 'latest';
|
|
62
|
-
return `${exports.SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}:${ver}`;
|
|
59
|
+
return `${exports.SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}`;
|
|
63
60
|
}
|
|
64
61
|
/**
|
|
65
62
|
* Tag for dictionary data scoped to site + locale.
|
|
@@ -97,7 +94,7 @@ function buildSitecoreDictionaryCacheTagsFromSites(params) {
|
|
|
97
94
|
* Prefers `itemLanguage` from Sitecore when set; otherwise uses `fallbackLocale`.
|
|
98
95
|
* Accepts the same `RouteData` shape returned by the layout service (e.g. `page.layout.sitecore.route`,
|
|
99
96
|
* which is `RouteData | null`) or `undefined` when the page did not resolve.
|
|
100
|
-
* @param {RouteData | null | undefined} route - Route node from layout (item id
|
|
97
|
+
* @param {RouteData | null | undefined} route - Route node from layout (item id and language).
|
|
101
98
|
* @param {string} fallbackLocale - Locale used when `route.itemLanguage` is not set.
|
|
102
99
|
* @returns `null` when `route` is missing or `route.itemId` is not set.
|
|
103
100
|
* @internal
|
|
@@ -110,10 +107,7 @@ function buildSitecoreItemCacheTagFromRouteData(route, fallbackLocale) {
|
|
|
110
107
|
? sanitizeSitecoreCacheTagSegment(route.itemLanguage)
|
|
111
108
|
: sanitizeSitecoreCacheTagSegment(fallbackLocale);
|
|
112
109
|
const id = normalizeSitecoreItemIdForCacheTag(route.itemId);
|
|
113
|
-
|
|
114
|
-
? `v${Math.trunc(route.itemVersion)}`
|
|
115
|
-
: 'latest';
|
|
116
|
-
return `${exports.SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}:${ver}`;
|
|
110
|
+
return `${exports.SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}`;
|
|
117
111
|
}
|
|
118
112
|
/**
|
|
119
113
|
* Deduplicates tag strings while preserving first-seen order.
|
|
@@ -28,11 +28,11 @@ function resolveConfiguredRevalidateSecret(secretOption, envValue) {
|
|
|
28
28
|
* The body is expected to be a JSON object that resolves to at least one Sitecore cache tag:
|
|
29
29
|
*
|
|
30
30
|
* - **`updates[]`** — Sitecore publish-event rows. Each row's `identifier` (with `-media` / `-layout`
|
|
31
|
-
* suffix stripped) maps to an `sc:item:<id>:<locale
|
|
31
|
+
* suffix stripped) maps to an `sc:item:<id>:<locale>` tag, using `entity_culture` for locale
|
|
32
32
|
* (falling back to the handler's `defaultLocale`).
|
|
33
33
|
* - **`tags[]`** — pass-through and convenience array:
|
|
34
34
|
* - Strings already starting with `sc:` are used verbatim (e.g. `sc:route:...`, `sc:item:...`, `sc:dict:...`).
|
|
35
|
-
* - Bare values are treated as Sitecore item ids and mapped to `sc:item:<id>:<defaultLocale
|
|
35
|
+
* - Bare values are treated as Sitecore item ids and mapped to `sc:item:<id>:<defaultLocale>`.
|
|
36
36
|
*
|
|
37
37
|
* When **`sites`** is configured, the handler also appends one `sc:dict:<site>:<locale>` tag per
|
|
38
38
|
* site so dictionary updates flow through the same call.
|
|
@@ -39,16 +39,13 @@ export function buildSitecoreRouteCacheTag(params) {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Tag for a layout/route item (and anything else keyed the same way). Use for item-level invalidation.
|
|
42
|
-
* @param {BuildSitecoreItemCacheTagParams} params - Item id
|
|
42
|
+
* @param {BuildSitecoreItemCacheTagParams} params - Item id and locale.
|
|
43
43
|
* @internal
|
|
44
44
|
*/
|
|
45
45
|
export function buildSitecoreItemCacheTag(params) {
|
|
46
46
|
const id = normalizeSitecoreItemIdForCacheTag(params.itemId);
|
|
47
47
|
const locale = sanitizeSitecoreCacheTagSegment(params.locale);
|
|
48
|
-
|
|
49
|
-
? `v${Math.trunc(params.version)}`
|
|
50
|
-
: 'latest';
|
|
51
|
-
return `${SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}:${ver}`;
|
|
48
|
+
return `${SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}`;
|
|
52
49
|
}
|
|
53
50
|
/**
|
|
54
51
|
* Tag for dictionary data scoped to site + locale.
|
|
@@ -86,7 +83,7 @@ export function buildSitecoreDictionaryCacheTagsFromSites(params) {
|
|
|
86
83
|
* Prefers `itemLanguage` from Sitecore when set; otherwise uses `fallbackLocale`.
|
|
87
84
|
* Accepts the same `RouteData` shape returned by the layout service (e.g. `page.layout.sitecore.route`,
|
|
88
85
|
* which is `RouteData | null`) or `undefined` when the page did not resolve.
|
|
89
|
-
* @param {RouteData | null | undefined} route - Route node from layout (item id
|
|
86
|
+
* @param {RouteData | null | undefined} route - Route node from layout (item id and language).
|
|
90
87
|
* @param {string} fallbackLocale - Locale used when `route.itemLanguage` is not set.
|
|
91
88
|
* @returns `null` when `route` is missing or `route.itemId` is not set.
|
|
92
89
|
* @internal
|
|
@@ -99,10 +96,7 @@ export function buildSitecoreItemCacheTagFromRouteData(route, fallbackLocale) {
|
|
|
99
96
|
? sanitizeSitecoreCacheTagSegment(route.itemLanguage)
|
|
100
97
|
: sanitizeSitecoreCacheTagSegment(fallbackLocale);
|
|
101
98
|
const id = normalizeSitecoreItemIdForCacheTag(route.itemId);
|
|
102
|
-
|
|
103
|
-
? `v${Math.trunc(route.itemVersion)}`
|
|
104
|
-
: 'latest';
|
|
105
|
-
return `${SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}:${ver}`;
|
|
99
|
+
return `${SITECORE_CONTENT_CACHE_TAG_PREFIX}:item:${id}:${locale}`;
|
|
106
100
|
}
|
|
107
101
|
/**
|
|
108
102
|
* Deduplicates tag strings while preserving first-seen order.
|
|
@@ -22,11 +22,11 @@ function resolveConfiguredRevalidateSecret(secretOption, envValue) {
|
|
|
22
22
|
* The body is expected to be a JSON object that resolves to at least one Sitecore cache tag:
|
|
23
23
|
*
|
|
24
24
|
* - **`updates[]`** — Sitecore publish-event rows. Each row's `identifier` (with `-media` / `-layout`
|
|
25
|
-
* suffix stripped) maps to an `sc:item:<id>:<locale
|
|
25
|
+
* suffix stripped) maps to an `sc:item:<id>:<locale>` tag, using `entity_culture` for locale
|
|
26
26
|
* (falling back to the handler's `defaultLocale`).
|
|
27
27
|
* - **`tags[]`** — pass-through and convenience array:
|
|
28
28
|
* - Strings already starting with `sc:` are used verbatim (e.g. `sc:route:...`, `sc:item:...`, `sc:dict:...`).
|
|
29
|
-
* - Bare values are treated as Sitecore item ids and mapped to `sc:item:<id>:<defaultLocale
|
|
29
|
+
* - Bare values are treated as Sitecore item ids and mapped to `sc:item:<id>:<defaultLocale>`.
|
|
30
30
|
*
|
|
31
31
|
* When **`sites`** is configured, the handler also appends one `sc:dict:<site>:<locale>` tag per
|
|
32
32
|
* site so dictionary updates flow through the same call.
|
package/package.json
CHANGED
|
@@ -44,14 +44,10 @@ export declare function buildSitecoreRouteCacheTag(params: BuildSitecoreRouteCac
|
|
|
44
44
|
export type BuildSitecoreItemCacheTagParams = {
|
|
45
45
|
itemId: string;
|
|
46
46
|
locale: string;
|
|
47
|
-
/**
|
|
48
|
-
* Published version number, or omit / `undefined` for "latest".
|
|
49
|
-
*/
|
|
50
|
-
version?: number;
|
|
51
47
|
};
|
|
52
48
|
/**
|
|
53
49
|
* Tag for a layout/route item (and anything else keyed the same way). Use for item-level invalidation.
|
|
54
|
-
* @param {BuildSitecoreItemCacheTagParams} params - Item id
|
|
50
|
+
* @param {BuildSitecoreItemCacheTagParams} params - Item id and locale.
|
|
55
51
|
* @internal
|
|
56
52
|
*/
|
|
57
53
|
export declare function buildSitecoreItemCacheTag(params: BuildSitecoreItemCacheTagParams): string;
|
|
@@ -93,7 +89,7 @@ export declare function buildSitecoreDictionaryCacheTagsFromSites(params: BuildS
|
|
|
93
89
|
* Prefers `itemLanguage` from Sitecore when set; otherwise uses `fallbackLocale`.
|
|
94
90
|
* Accepts the same `RouteData` shape returned by the layout service (e.g. `page.layout.sitecore.route`,
|
|
95
91
|
* which is `RouteData | null`) or `undefined` when the page did not resolve.
|
|
96
|
-
* @param {RouteData | null | undefined} route - Route node from layout (item id
|
|
92
|
+
* @param {RouteData | null | undefined} route - Route node from layout (item id and language).
|
|
97
93
|
* @param {string} fallbackLocale - Locale used when `route.itemLanguage` is not set.
|
|
98
94
|
* @returns `null` when `route` is missing or `route.itemId` is not set.
|
|
99
95
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitecore-cache-tags.d.ts","sourceRoot":"","sources":["../../src/cache/sitecore-cache-tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;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+BAA+B,GAAG;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,+BAA+B,GAAG,MAAM,CAIzF;AAED;;;GAGG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qCAAqC,GAC5C,MAAM,CAIR;AAED;;;GAGG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,uDAAuD;IACvD,KAAK,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,yCAAyC,CACvD,MAAM,EAAE,+CAA+C,GACtD,MAAM,EAAE,CAcV;AAED;;;;;;;;;GASG;AACH,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EACnC,cAAc,EAAE,MAAM,GACrB,MAAM,GAAG,IAAI,CASf;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAUhE"}
|
|
@@ -12,8 +12,8 @@ export type CollectSitecorePageCacheTagsParams = {
|
|
|
12
12
|
path?: string;
|
|
13
13
|
/**
|
|
14
14
|
* Route node from a Sitecore layout response (e.g. `page.layout.sitecore.route`, which is
|
|
15
|
-
* `RouteData | null`). Optional because the page may not resolve; only `itemId
|
|
16
|
-
*
|
|
15
|
+
* `RouteData | null`). Optional because the page may not resolve; only `itemId` and `itemLanguage`
|
|
16
|
+
* are read when present.
|
|
17
17
|
*/
|
|
18
18
|
route?: RouteData | null;
|
|
19
19
|
};
|
|
@@ -41,11 +41,11 @@ export type SitecoreRevalidateRouteHandlerOptions = {
|
|
|
41
41
|
* The body is expected to be a JSON object that resolves to at least one Sitecore cache tag:
|
|
42
42
|
*
|
|
43
43
|
* - **`updates[]`** — Sitecore publish-event rows. Each row's `identifier` (with `-media` / `-layout`
|
|
44
|
-
* suffix stripped) maps to an `sc:item:<id>:<locale
|
|
44
|
+
* suffix stripped) maps to an `sc:item:<id>:<locale>` tag, using `entity_culture` for locale
|
|
45
45
|
* (falling back to the handler's `defaultLocale`).
|
|
46
46
|
* - **`tags[]`** — pass-through and convenience array:
|
|
47
47
|
* - Strings already starting with `sc:` are used verbatim (e.g. `sc:route:...`, `sc:item:...`, `sc:dict:...`).
|
|
48
|
-
* - Bare values are treated as Sitecore item ids and mapped to `sc:item:<id>:<defaultLocale
|
|
48
|
+
* - Bare values are treated as Sitecore item ids and mapped to `sc:item:<id>:<defaultLocale>`.
|
|
49
49
|
*
|
|
50
50
|
* When **`sites`** is configured, the handler also appends one `sc:dict:<site>:<locale>` tag per
|
|
51
51
|
* site so dictionary updates flow through the same call.
|