@contentful/experiences-core 3.3.0 → 3.3.1-dev-20250821T1304-a31a6e8.0

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/index.js CHANGED
@@ -4656,6 +4656,19 @@ const sideloadPrebindingDefaultValues = (patternEntry) => {
4656
4656
  return sideloadedCount;
4657
4657
  };
4658
4658
 
4659
+ /**
4660
+ * Run additional checks on the references used in the experience entry and
4661
+ * process data required for prebinding. This must be used after fetching an
4662
+ * experience entry.
4663
+ *
4664
+ * The changes made to the passed experience entry are done inplace.
4665
+ **/
4666
+ const prepareExperienceEntry = (experienceEntry) => {
4667
+ removeCircularPatternReferences(experienceEntry);
4668
+ removeSelfReferencingDataSource(experienceEntry);
4669
+ sideloadPrebindingDefaultValues(experienceEntry);
4670
+ };
4671
+
4659
4672
  const errorMessagesWhileFetching$1 = {
4660
4673
  experience: 'Failed to fetch experience',
4661
4674
  experienceReferences: 'Failed to fetch entities, referenced in experience',
@@ -4689,9 +4702,7 @@ async function fetchBySlug({ client, experienceTypeId, slug, localeCode, isEdito
4689
4702
  if (!experienceEntry) {
4690
4703
  throw new Error(`No experience entry with slug: ${slug} exists`);
4691
4704
  }
4692
- removeCircularPatternReferences(experienceEntry);
4693
- removeSelfReferencingDataSource(experienceEntry);
4694
- sideloadPrebindingDefaultValues(experienceEntry);
4705
+ prepareExperienceEntry(experienceEntry);
4695
4706
  try {
4696
4707
  const { entries, assets } = await fetchReferencedEntities({
4697
4708
  client,
@@ -4748,9 +4759,7 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
4748
4759
  if (!experienceEntry) {
4749
4760
  throw new Error(`No experience entry with id: ${id} exists`);
4750
4761
  }
4751
- removeCircularPatternReferences(experienceEntry);
4752
- removeSelfReferencingDataSource(experienceEntry);
4753
- sideloadPrebindingDefaultValues(experienceEntry);
4762
+ prepareExperienceEntry(experienceEntry);
4754
4763
  try {
4755
4764
  const { entries, assets } = await fetchReferencedEntities({
4756
4765
  client,