@dotcms/client 1.5.5-next.2290 → 1.5.5-next.2294

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/index.cjs.js CHANGED
@@ -112,7 +112,7 @@ class FetchHttpClient extends types.BaseHttpClient {
112
112
  }
113
113
  }
114
114
 
115
- /******************************************************************************
115
+ /*! *****************************************************************************
116
116
  Copyright (c) Microsoft Corporation.
117
117
 
118
118
  Permission to use, copy, modify, and/or distribute this software for any
@@ -126,7 +126,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
126
126
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
127
127
  PERFORMANCE OF THIS SOFTWARE.
128
128
  ***************************************************************************** */
129
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
129
+ /* global Reflect, Promise */
130
130
 
131
131
 
132
132
  function __classPrivateFieldGet(receiver, state, kind, f) {
@@ -140,12 +140,7 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
140
140
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
141
141
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
142
142
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
143
- }
144
-
145
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
146
- var e = new Error(message);
147
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
148
- };
143
+ }
149
144
 
150
145
  /**
151
146
  * Utility functions for AI search parameter mapping and processing
@@ -2542,7 +2537,9 @@ class PageClient extends BaseApiClient {
2542
2537
  query: completeQuery,
2543
2538
  variables: requestVariables
2544
2539
  },
2545
- errors: response.errors?.length ? response.errors : undefined,
2540
+ // Always return an array (never `undefined`) so the response stays JSON-serializable
2541
+ // for consumers like Next.js Pages Router (getServerSideProps/getStaticProps throw on undefined).
2542
+ errors: response.errors?.length ? response.errors : [],
2546
2543
  ...(styleEditorSchemas?.length && { styleEditorSchemas })
2547
2544
  };
2548
2545
  }
package/index.esm.js CHANGED
@@ -110,7 +110,7 @@ class FetchHttpClient extends BaseHttpClient {
110
110
  }
111
111
  }
112
112
 
113
- /******************************************************************************
113
+ /*! *****************************************************************************
114
114
  Copyright (c) Microsoft Corporation.
115
115
 
116
116
  Permission to use, copy, modify, and/or distribute this software for any
@@ -124,7 +124,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
124
124
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
125
125
  PERFORMANCE OF THIS SOFTWARE.
126
126
  ***************************************************************************** */
127
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
127
+ /* global Reflect, Promise */
128
128
 
129
129
 
130
130
  function __classPrivateFieldGet(receiver, state, kind, f) {
@@ -138,12 +138,7 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
138
138
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
139
139
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
140
140
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
141
- }
142
-
143
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
144
- var e = new Error(message);
145
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
146
- };
141
+ }
147
142
 
148
143
  /**
149
144
  * Utility functions for AI search parameter mapping and processing
@@ -2540,7 +2535,9 @@ class PageClient extends BaseApiClient {
2540
2535
  query: completeQuery,
2541
2536
  variables: requestVariables
2542
2537
  },
2543
- errors: response.errors?.length ? response.errors : undefined,
2538
+ // Always return an array (never `undefined`) so the response stays JSON-serializable
2539
+ // for consumers like Next.js Pages Router (getServerSideProps/getStaticProps throw on undefined).
2540
+ errors: response.errors?.length ? response.errors : [],
2544
2541
  ...(styleEditorSchemas?.length && { styleEditorSchemas })
2545
2542
  };
2546
2543
  }
package/internal.cjs.js CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
4
3
  /**
5
4
  * Transforms a GraphQL Page response to a Page Entity.
6
5
  *
@@ -19,7 +18,12 @@ const graphqlToPageEntity = (page) => {
19
18
  }
20
19
  const { layout, template, containers, urlContentMap, viewAs, host, vanityUrl, runningExperimentId, numberContents, _map, ...pageAsset } = page;
21
20
  const data = (_map || {});
22
- const typedPageAsset = pageAsset;
21
+ // styleEditorSchemas comes back as null from GraphQL outside EDIT_MODE. Separate it from the
22
+ // rest of the page fields so it can be omitted entirely when it has no value. Emitting
23
+ // `undefined` (the previous behaviour) breaks JSON serialization for consumers like Next.js
24
+ // Pages Router (getServerSideProps/getStaticProps), while omitting the key keeps the optional
25
+ // DotCMSPage.styleEditorSchemas type accurate.
26
+ const { styleEditorSchemas, ...typedPageAsset } = pageAsset;
23
27
  // Merge all urlContentMap keys into _map, except _map itself
24
28
  const mergedUrlContentMap = {
25
29
  ...(urlContentMap?._map || {}),
@@ -43,9 +47,8 @@ const graphqlToPageEntity = (page) => {
43
47
  page: {
44
48
  ...data,
45
49
  ...typedPageAsset,
46
- // GQL returns null when not in EDIT_MODE; normalize to undefined so the
47
- // DotCMSPage type (StyleEditorFormSchema[], non-null) remains accurate.
48
- styleEditorSchemas: typedPageAsset.styleEditorSchemas ?? undefined
50
+ // Only re-add styleEditorSchemas when it actually has a value (see destructure above).
51
+ ...(styleEditorSchemas ? { styleEditorSchemas } : {})
49
52
  }
50
53
  };
51
54
  };
package/internal.esm.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  /**
3
2
  * Transforms a GraphQL Page response to a Page Entity.
4
3
  *
@@ -17,7 +16,12 @@ const graphqlToPageEntity = (page) => {
17
16
  }
18
17
  const { layout, template, containers, urlContentMap, viewAs, host, vanityUrl, runningExperimentId, numberContents, _map, ...pageAsset } = page;
19
18
  const data = (_map || {});
20
- const typedPageAsset = pageAsset;
19
+ // styleEditorSchemas comes back as null from GraphQL outside EDIT_MODE. Separate it from the
20
+ // rest of the page fields so it can be omitted entirely when it has no value. Emitting
21
+ // `undefined` (the previous behaviour) breaks JSON serialization for consumers like Next.js
22
+ // Pages Router (getServerSideProps/getStaticProps), while omitting the key keeps the optional
23
+ // DotCMSPage.styleEditorSchemas type accurate.
24
+ const { styleEditorSchemas, ...typedPageAsset } = pageAsset;
21
25
  // Merge all urlContentMap keys into _map, except _map itself
22
26
  const mergedUrlContentMap = {
23
27
  ...(urlContentMap?._map || {}),
@@ -41,9 +45,8 @@ const graphqlToPageEntity = (page) => {
41
45
  page: {
42
46
  ...data,
43
47
  ...typedPageAsset,
44
- // GQL returns null when not in EDIT_MODE; normalize to undefined so the
45
- // DotCMSPage type (StyleEditorFormSchema[], non-null) remains accurate.
46
- styleEditorSchemas: typedPageAsset.styleEditorSchemas ?? undefined
48
+ // Only re-add styleEditorSchemas when it actually has a value (see destructure above).
49
+ ...(styleEditorSchemas ? { styleEditorSchemas } : {})
47
50
  }
48
51
  };
49
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/client",
3
- "version": "1.5.5-next.2290",
3
+ "version": "1.5.5-next.2294",
4
4
  "description": "Official JavaScript library for interacting with DotCMS REST APIs.",
5
5
  "repository": {
6
6
  "type": "git",