-
Notifications
You must be signed in to change notification settings - Fork 3
Added livepreview 2.0 and timeline support #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c670469
sca-scan.yml
aravindbuilt 0a27d5e
jira.yml
aravindbuilt 2986263
sast-scan.yml
aravindbuilt 8c368e2
codeql-analysis.yml
aravindbuilt 2b2bd12
Updated codeowners
aravindbuilt de43bcf
Added livepreview 2.0 support and timeline preview support
sunil-lakshman a3283bb
Added version bump
sunil-lakshman 63ab8cc
Fixed SNYK issues
sunil-lakshman 50a3ad1
Fixed snyk issues
sunil-lakshman 91ef053
Fixed snyk issues
sunil-lakshman 7566046
Updated license year and changelog file
sunil-lakshman dee64db
Fixed PR comments raised from copilot
sunil-lakshman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| # CHANGELOG | ||
|
|
||
| ## _v1.11.0_ | ||
|
|
||
| ### **Date: 17-MARCH-2025** | ||
|
|
||
| - Added Livepreview 2.0 and Timeline support | ||
|
|
||
| ## _v1.10.0_ | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| * @contentstack/security-admin | ||
| * @contentstack/security-admin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ | |
| __title__ = 'contentstack-delivery-python' | ||
| __author__ = 'contentstack' | ||
| __status__ = 'debug' | ||
| __version__ = 'v1.10.0' | ||
| __version__ = 'v1.11.0' | ||
| __endpoint__ = 'cdn.contentstack.io' | ||
| __email__ = '[email protected]' | ||
| __developer_email__ = '[email protected]' | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,36 @@ | ||
| class DeepMergeMixin: | ||
|
|
||
| def __init__(self, entry_response, lp_response): | ||
| if not isinstance(entry_response, list) or not isinstance(lp_response, list): | ||
| raise TypeError("Both entry_response and lp_response must be lists of dictionaries") | ||
|
|
||
| self.entry_response = entry_response | ||
| self.lp_response = lp_response | ||
| self.merged_response = self._merge_entries(entry_response, lp_response) | ||
|
|
||
| def _merge_entries(self, entry_list, lp_list): | ||
| """Merge each LP entry into the corresponding entry response based on UID""" | ||
| merged_entries = {entry["uid"]: entry.copy() for entry in entry_list} # Convert to dict for easy lookup | ||
|
|
||
| for lp_obj in self.lp_response: | ||
| for lp_obj in lp_list: | ||
| uid = lp_obj.get("uid") | ||
| matching_objs = [entry_obj for entry_obj in entry_response if entry_obj.get("uid") == uid] | ||
| if matching_objs: | ||
| for matching_obj in matching_objs: | ||
| self._deep_merge(lp_obj, matching_obj) | ||
| if uid in merged_entries: | ||
| self._deep_merge(lp_obj, merged_entries[uid]) | ||
| else: | ||
| merged_entries[uid] = lp_obj # If LP object does not exist in entry_response, add it | ||
|
|
||
| return list(merged_entries.values()) # Convert back to a list | ||
|
|
||
| def _deep_merge(self, source, destination): | ||
| if not isinstance(destination, dict) or not isinstance(source, dict): | ||
| return source # Return source if it's not a dict | ||
| for key, value in source.items(): | ||
| if isinstance(value, dict): | ||
| node = destination.setdefault(key, {}) | ||
| self._deep_merge(value, node) | ||
| else: | ||
| destination[key] = value | ||
| return destination | ||
|
|
||
| def to_dict(self): | ||
| return self.merged_response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.