@sitecore-content-sdk/core 0.1.0-beta.42 → 0.1.0-beta.43

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.
@@ -230,6 +230,9 @@ class SitecoreClient {
230
230
  try {
231
231
  const fetcher = new native_fetcher_1.NativeDataFetcher();
232
232
  const xmlResponse = await fetcher.fetch(sitemapPath);
233
+ if (!xmlResponse.data) {
234
+ throw new Error('REDIRECT_404');
235
+ }
233
236
  return xmlResponse.data;
234
237
  }
235
238
  catch (error) {
@@ -59,8 +59,17 @@ class GraphQLSitemapXmlService {
59
59
  * @returns {string | undefined} the sitemap file path or undefined if one doesn't exist
60
60
  */
61
61
  async getSitemap(id) {
62
- const normalizedId = (id === null || id === void 0 ? void 0 : id.startsWith('-')) ? id.slice(1) : id || '';
63
- const searchSitemap = `${PREFIX_NAME_SITEMAP}${normalizedId ? `-${normalizedId}` : ''}.xml`;
62
+ let searchSitemap;
63
+ if (id === undefined) {
64
+ return undefined;
65
+ }
66
+ else if (id === '') {
67
+ searchSitemap = `${PREFIX_NAME_SITEMAP}.xml`;
68
+ }
69
+ else {
70
+ const normalizedId = id.startsWith('-') ? id.slice(1) : id;
71
+ searchSitemap = `${PREFIX_NAME_SITEMAP}-${normalizedId}.xml`;
72
+ }
64
73
  const sitemaps = await this.fetchSitemaps();
65
74
  return sitemaps.find((sitemap) => sitemap.includes(searchSitemap));
66
75
  }
@@ -227,6 +227,9 @@ export class SitecoreClient {
227
227
  try {
228
228
  const fetcher = new NativeDataFetcher();
229
229
  const xmlResponse = await fetcher.fetch(sitemapPath);
230
+ if (!xmlResponse.data) {
231
+ throw new Error('REDIRECT_404');
232
+ }
230
233
  return xmlResponse.data;
231
234
  }
232
235
  catch (error) {
@@ -53,8 +53,17 @@ export class GraphQLSitemapXmlService {
53
53
  * @returns {string | undefined} the sitemap file path or undefined if one doesn't exist
54
54
  */
55
55
  async getSitemap(id) {
56
- const normalizedId = (id === null || id === void 0 ? void 0 : id.startsWith('-')) ? id.slice(1) : id || '';
57
- const searchSitemap = `${PREFIX_NAME_SITEMAP}${normalizedId ? `-${normalizedId}` : ''}.xml`;
56
+ let searchSitemap;
57
+ if (id === undefined) {
58
+ return undefined;
59
+ }
60
+ else if (id === '') {
61
+ searchSitemap = `${PREFIX_NAME_SITEMAP}.xml`;
62
+ }
63
+ else {
64
+ const normalizedId = id.startsWith('-') ? id.slice(1) : id;
65
+ searchSitemap = `${PREFIX_NAME_SITEMAP}-${normalizedId}.xml`;
66
+ }
58
67
  const sitemaps = await this.fetchSitemaps();
59
68
  return sitemaps.find((sitemap) => sitemap.includes(searchSitemap));
60
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/core",
3
- "version": "0.1.0-beta.42",
3
+ "version": "0.1.0-beta.43",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "description": "",
79
79
  "types": "types/index.d.ts",
80
- "gitHead": "c97ebab276a02f09b12de66fa29866cf814b3a0e",
80
+ "gitHead": "0323779a3d465a0030c35e5db65cb89a08485ed8",
81
81
  "files": [
82
82
  "dist",
83
83
  "types",