@sitecore-content-sdk/core 0.2.0-beta.1 → 0.2.0-beta.2

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.
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEdgeProxyFormsUrl = exports.getEdgeProxyContentUrl = void 0;
4
4
  const constants_1 = require("../constants");
5
+ const normalizeUrl = (url) => (url.endsWith('/') ? url.slice(0, -1) : url);
5
6
  /**
6
7
  * Generates a URL for accessing Sitecore Edge Platform Content using the provided endpoint and context ID.
7
8
  * @param {string} sitecoreEdgeContextId - The unique context id.
8
9
  * @param {string} [sitecoreEdgeUrl] - The base endpoint URL for the Edge Platform. Default is https://edge-platform.sitecorecloud.io
9
10
  * @returns {string} The complete URL for accessing content through the Edge Platform.
10
11
  */
11
- const getEdgeProxyContentUrl = (sitecoreEdgeContextId, sitecoreEdgeUrl = constants_1.SITECORE_EDGE_URL_DEFAULT) => `${sitecoreEdgeUrl}/v1/content/api/graphql/v1?sitecoreContextId=${sitecoreEdgeContextId}`;
12
+ const getEdgeProxyContentUrl = (sitecoreEdgeContextId, sitecoreEdgeUrl = constants_1.SITECORE_EDGE_URL_DEFAULT) => `${normalizeUrl(sitecoreEdgeUrl)}/v1/content/api/graphql/v1?sitecoreContextId=${sitecoreEdgeContextId}`;
12
13
  exports.getEdgeProxyContentUrl = getEdgeProxyContentUrl;
13
14
  /**
14
15
  * Generates a URL for accessing Sitecore Edge Platform Forms using the provided form ID and context ID.
@@ -17,5 +18,5 @@ exports.getEdgeProxyContentUrl = getEdgeProxyContentUrl;
17
18
  * @param {string} [sitecoreEdgeUrl] - The base endpoint URL for the Edge Platform. Default is https://edge-platform.sitecorecloud.io
18
19
  * @returns {string} The complete URL for accessing forms through the Edge Platform.
19
20
  */
20
- const getEdgeProxyFormsUrl = (sitecoreEdgeContextId, formId, sitecoreEdgeUrl = constants_1.SITECORE_EDGE_URL_DEFAULT) => `${sitecoreEdgeUrl}/v1/forms/publisher/${formId}?sitecoreContextId=${sitecoreEdgeContextId}`;
21
+ const getEdgeProxyFormsUrl = (sitecoreEdgeContextId, formId, sitecoreEdgeUrl = constants_1.SITECORE_EDGE_URL_DEFAULT) => `${normalizeUrl(sitecoreEdgeUrl)}/v1/forms/publisher/${formId}?sitecoreContextId=${sitecoreEdgeContextId}`;
21
22
  exports.getEdgeProxyFormsUrl = getEdgeProxyFormsUrl;
@@ -1,11 +1,12 @@
1
1
  import { SITECORE_EDGE_URL_DEFAULT } from '../constants';
2
+ const normalizeUrl = (url) => (url.endsWith('/') ? url.slice(0, -1) : url);
2
3
  /**
3
4
  * Generates a URL for accessing Sitecore Edge Platform Content using the provided endpoint and context ID.
4
5
  * @param {string} sitecoreEdgeContextId - The unique context id.
5
6
  * @param {string} [sitecoreEdgeUrl] - The base endpoint URL for the Edge Platform. Default is https://edge-platform.sitecorecloud.io
6
7
  * @returns {string} The complete URL for accessing content through the Edge Platform.
7
8
  */
8
- export const getEdgeProxyContentUrl = (sitecoreEdgeContextId, sitecoreEdgeUrl = SITECORE_EDGE_URL_DEFAULT) => `${sitecoreEdgeUrl}/v1/content/api/graphql/v1?sitecoreContextId=${sitecoreEdgeContextId}`;
9
+ export const getEdgeProxyContentUrl = (sitecoreEdgeContextId, sitecoreEdgeUrl = SITECORE_EDGE_URL_DEFAULT) => `${normalizeUrl(sitecoreEdgeUrl)}/v1/content/api/graphql/v1?sitecoreContextId=${sitecoreEdgeContextId}`;
9
10
  /**
10
11
  * Generates a URL for accessing Sitecore Edge Platform Forms using the provided form ID and context ID.
11
12
  * @param {string} sitecoreEdgeContextId - The unique context id.
@@ -13,4 +14,4 @@ export const getEdgeProxyContentUrl = (sitecoreEdgeContextId, sitecoreEdgeUrl =
13
14
  * @param {string} [sitecoreEdgeUrl] - The base endpoint URL for the Edge Platform. Default is https://edge-platform.sitecorecloud.io
14
15
  * @returns {string} The complete URL for accessing forms through the Edge Platform.
15
16
  */
16
- export const getEdgeProxyFormsUrl = (sitecoreEdgeContextId, formId, sitecoreEdgeUrl = SITECORE_EDGE_URL_DEFAULT) => `${sitecoreEdgeUrl}/v1/forms/publisher/${formId}?sitecoreContextId=${sitecoreEdgeContextId}`;
17
+ export const getEdgeProxyFormsUrl = (sitecoreEdgeContextId, formId, sitecoreEdgeUrl = SITECORE_EDGE_URL_DEFAULT) => `${normalizeUrl(sitecoreEdgeUrl)}/v1/forms/publisher/${formId}?sitecoreContextId=${sitecoreEdgeContextId}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/core",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.2",
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": "8e550fe21d487b1d8d2004b33bda0b131a3d094a",
80
+ "gitHead": "6414b2a03a72e9a7c96a4a20de79ede4bafb0290",
81
81
  "files": [
82
82
  "dist",
83
83
  "types",