Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Change Log
Unreleased
__________

[9.20.0] - 2025-03-15
---------------------

Added
~~~~~

* Added new ``LIBRARY_CONTAINER_CREATED``, ``LIBRARY_CONTAINER_UPDATED`` and ``LIBRARY_CONTAINER_DELETED`` events in content_authoring.
* Adds ``LibraryContainerData`` to support these events

[9.19.0] - 2025-03-14
---------------------

Expand Down
2 changes: 1 addition & 1 deletion openedx_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
more information about the project.
"""

__version__ = "9.19.0"
__version__ = "9.20.0"
19 changes: 18 additions & 1 deletion openedx_events/content_authoring/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class LibraryCollectionData:
Data related to a library collection that has changed.

Attributes:
library_key (LibraryLocatorV2): a key that represents a Blockstore-based content library.
library_key (LibraryLocatorV2): a key that represents a content library.
collection_key (str): identifies the collection within the library's learning package
background (bool): indicate whether the sender doesn't want to wait for handler to finish execution,
i.e., the handler can run the task in background. By default it is False.
Expand All @@ -227,3 +227,20 @@ class LibraryCollectionData:
library_key = attr.ib(type=LibraryLocatorV2)
collection_key = attr.ib(type=str)
background = attr.ib(type=bool, default=False)


@attr.s(frozen=True)
class LibraryContainerData:
"""
Data related to a library container that has changed.

Attributes:
library_key (LibraryLocatorV2): a key that represents a content library.
container_key (str): identifies the container within the library's learning package (e.g. unit, section)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[non-blocking] Should this have its own type, like LibraryLocator or CourseKey, instead of being a plain str? This question also applies for the collection_key in LibraryCollectionData.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use only the LibraryContainerLocator for the Container events. CC @pomegranited

For the Collections, the events were created before we had a LibraryCollectionLocator, so we needed the LibraryLocator and the collection_key: str to reference it. This can be fixed later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariajgrimaldi Ya, as noted, making that change is blocked on openedx/opaque-keys#369, but we'd be happy to fix this in a follow-up.

Copy link
Member

@mariajgrimaldi mariajgrimaldi Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pomegranited @rpenido: agreed! Thank you for pointing me to openedx/opaque-keys#369

background (bool): indicate whether the sender doesn't want to wait for handler to finish execution,
i.e., the handler can run the task in background. By default it is False.
"""

library_key = attr.ib(type=LibraryLocatorV2)
container_key = attr.ib(type=str)
background = attr.ib(type=bool, default=False)
37 changes: 37 additions & 0 deletions openedx_events/content_authoring/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
DuplicatedXBlockData,
LibraryBlockData,
LibraryCollectionData,
LibraryContainerData,
XBlockData,
)
from openedx_events.tooling import OpenEdxPublicSignal
Expand Down Expand Up @@ -277,6 +278,42 @@
}
)

# .. event_type: org.openedx.content_authoring.content_library.container.created.v1
# .. event_name: LIBRARY_CONTAINER_CREATED
# .. event_description: Emitted when a content library container is created.
# .. event_data: LibraryContainerData
# .. event_trigger_repository: openedx/edx-platform
LIBRARY_CONTAINER_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content_library.container.created.v1",
data={
"library_container": LibraryContainerData
}
)

# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
# .. event_name: LIBRARY_CONTAINER_UPDATED
# .. event_description: Emitted when when a content library container is updated.
# .. event_data: LibraryContainerData
# .. event_trigger_repository: openedx/edx-platform
LIBRARY_CONTAINER_UPDATED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content_library.container.updated.v1",
data={
"library_container": LibraryContainerData
}
)

# .. event_type: org.openedx.content_authoring.content_library.container.deleted.v1
# .. event_name: LIBRARY_CONTAINER_DELETED
# .. event_description: Emitted when an when a content library container is deleted.
# .. event_data: LibraryContainerData
# .. event_trigger_repository: openedx/edx-platform
LIBRARY_CONTAINER_DELETED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content_library.container.deleted.v1",
data={
"library_container": LibraryContainerData
}
)

# .. event_type: org.openedx.content_authoring.course.import.completed.v1
# .. event_name: COURSE_IMPORT_COMPLETED
# .. event_key_field: catalog_info.course_key
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "library_container",
"type": {
"name": "LibraryContainerData",
"type": "record",
"fields": [
{
"name": "library_key",
"type": "string"
},
{
"name": "container_key",
"type": "string"
},
{
"name": "background",
"type": "boolean"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content_library.container.created.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "library_container",
"type": {
"name": "LibraryContainerData",
"type": "record",
"fields": [
{
"name": "library_key",
"type": "string"
},
{
"name": "container_key",
"type": "string"
},
{
"name": "background",
"type": "boolean"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content_library.container.deleted.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "library_container",
"type": {
"name": "LibraryContainerData",
"type": "record",
"fields": [
{
"name": "library_key",
"type": "string"
},
{
"name": "container_key",
"type": "string"
},
{
"name": "background",
"type": "boolean"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content_library.container.updated.v1"
}