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
5 changes: 3 additions & 2 deletions meteor/server/publications/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { RundownId, RundownPlaylistId, StudioId } from '@sofie-automation/coreli
import { check } from 'meteor/check'
import { SYSTEM_ID } from '@sofie-automation/meteor-lib/dist/collections/CoreSystem'
import { triggerWriteAccessBecauseNoCheckNecessary } from '../security/securityVerify'
import { CorelibPubSub } from '@sofie-automation/corelib/dist/pubsub'

meteorPublish(MeteorPubSub.coreSystem, async function (_token: string | undefined) {
triggerWriteAccessBecauseNoCheckNecessary()
Expand All @@ -26,7 +27,7 @@ meteorPublish(MeteorPubSub.coreSystem, async function (_token: string | undefine
})
})

meteorPublish(MeteorPubSub.notificationsForRundown, async function (studioId: StudioId, rundownId: RundownId) {
meteorPublish(CorelibPubSub.notificationsForRundown, async function (studioId: StudioId, rundownId: RundownId) {
// HACK: This should do real auth
triggerWriteAccessBecauseNoCheckNecessary()

Expand All @@ -41,7 +42,7 @@ meteorPublish(MeteorPubSub.notificationsForRundown, async function (studioId: St
})

meteorPublish(
MeteorPubSub.notificationsForRundownPlaylist,
CorelibPubSub.notificationsForRundownPlaylist,
async function (studioId: StudioId, playlistId: RundownPlaylistId) {
// HACK: This should do real auth
triggerWriteAccessBecauseNoCheckNecessary()
Expand Down
15 changes: 15 additions & 0 deletions packages/corelib/src/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { BlueprintId, BucketId, RundownPlaylistActivationId, SegmentId, ShowStyl
import { PackageInfoDB } from './dataModel/PackageInfos.js'
import { UIPieceContentStatus } from './dataModel/PieceContentStatus.js'
import { Bucket } from './dataModel/Bucket.js'
import { DBNotificationObj } from './dataModel/Notifications.js'

/**
* Ids of possible DDP subscriptions for any the UI and gateways accessing the Rundown & RundownPlaylist model.
Expand Down Expand Up @@ -130,6 +131,14 @@ export enum CorelibPubSub {
* Fetch all Expected Package statuses in the specified Studios
*/
expectedPackageWorkStatuses = 'expectedPackageWorkStatuses',
/**
* Fetch notifications for playlist
*/
notificationsForRundownPlaylist = 'notificationsForRundownPlaylist',
/**
* Fetch notifications for rundown
*/
notificationsForRundown = 'notificationsForRundown',
/**
* Fetch all Package container statuses in the specified Studios
*/
Expand Down Expand Up @@ -328,6 +337,11 @@ export interface CorelibPubSubTypes {
studioIds: StudioId[],
token?: string
) => CollectionName.PackageContainerStatuses
[CorelibPubSub.notificationsForRundown]: (studioId: StudioId, rundownId: RundownId) => CollectionName.Notifications
[CorelibPubSub.notificationsForRundownPlaylist]: (
studioId: StudioId,
playlistId: RundownPlaylistId
) => CollectionName.Notifications
[CorelibPubSub.packageInfos]: (deviceId: PeripheralDeviceId, token?: string) => CollectionName.PackageInfos

[CorelibPubSub.uiPieceContentStatuses]: (
Expand All @@ -345,6 +359,7 @@ export type CorelibPubSubCollections = {
[CollectionName.ExpectedPackages]: ExpectedPackageDBBase
[CollectionName.ExpectedPackageWorkStatuses]: ExpectedPackageWorkStatus
[CollectionName.ExternalMessageQueue]: ExternalMessageQueueObj
[CollectionName.Notifications]: DBNotificationObj
[CollectionName.NrcsIngestDataCache]: NrcsIngestDataCacheObj
[CollectionName.PartInstances]: DBPartInstance
[CollectionName.PackageContainerStatuses]: PackageContainerStatusDB
Expand Down
2 changes: 2 additions & 0 deletions packages/live-status-gateway-api/api/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ channels:
$ref: './topics/packages/packagesTopic.yaml'
buckets:
$ref: './topics/buckets/bucketsTopic.yaml'
notifications:
$ref: './topics/notifications/notificationsTopic.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
event: notifications
activeNotifications:
- $ref: '../../notificationObj/notificationObj-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$defs:
notificationsEvent:
type: object
title: NotificationsEvent
description: Active notifications in Sofie
properties:
event:
type: string
const: notifications
activeNotifications:
description: Active notifications in Sofie
type: array
items:
$ref: '../../notificationObj/notificationObj.yaml#/$defs/NotificationObj'
required: [event, activeNotifications]
additionalProperties: false
examples:
- $ref: './notificationsEvent-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
components:
messages:
notificationsMessage:
messageId: notificationsUpdate
title: Active notifications in Sofie
payload:
$ref: '../events/notificationsEvent/notificationsEvent.yaml#/$defs/notificationsEvent'
examples:
- payload:
$ref: '../events/notificationsEvent/notificationsEvent-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
_id: 'notif123'
severity: error
message: 'disk.space.low'
relatedTo:
$ref: '../target/pieceInstance/notificationTargetPieceInstance-example.yaml'
created: 1694784932
modified: 1694784950
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$defs:
NotificationObj:
type: object
title: NotificationObj
description: This describes a notification that should be shown to a user. These can come from various sources, and are added and removed dynamically during system usage
required:
- _id
- severity
- message
- relatedTo
- created
properties:
_id:
type: string
description: Unique identifier for the notification
severity:
$ref: '../notificationSeverity.yaml#/$defs/severity'
message:
type: string
description: The message of the notification
relatedTo:
$ref: '../target/notificationTarget.yaml#/$defs/NotificationTarget'
created:
type: integer
format: int64
description: Unix timestamp of creation
modified:
type: integer
format: int64
description: Unix timestamp of last modification
additionalProperties: false
examples:
- $ref: './notificationObj-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$defs:
severity:
type: string
title: NotificationSeverity
description: Severity level of the notification.
enum:
- warning
- error
- info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$defs:
NotificationTarget:
title: NotificationTarget
description: Describes what the notification is related to
oneOf:
- $ref: './rundown/notificationTargetRundown.yaml#/$defs/NotificationTargetRundown'
- $ref: './rundownPlaylist/notificationTargetRundownPlaylist.yaml#/$defs/NotificationTargetRundownPlaylist'
- $ref: './partInstance/notificationTargetPartInstance.yaml#/$defs/NotificationTargetPartInstance'
- $ref: './pieceInstance/notificationTargetPieceInstance.yaml#/$defs/NotificationTargetPieceInstance'
- $ref: './unknown/notificationTargetUnknown.yaml#/$defs/NotificationTargetUnknown'
examples:
- $ref: './rundown/notificationTargetRundown-example.yaml'
- $ref: './rundownPlaylist/notificationTargetRundownPlaylist-example.yaml'
- $ref: './partInstance/notificationTargetPartInstance-example.yaml'
- $ref: './pieceInstance/notificationTargetPieceInstance-example.yaml'
- $ref: './unknown/notificationTargetUnknown-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$defs:
NotificationTargetType:
type: string
title: NotificationTargetType
description: Possible NotificationTarget types
enum:
- rundown
- playlist
- partInstance
- pieceInstance
- unknown
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type: partInstance
studioId: studio01
rundownId: rd123
partInstanceId: pi789
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$defs:
NotificationTargetPartInstance:
type: object
title: NotificationTargetPartInstance
required: [type, studioId, rundownId, partInstanceId]
properties:
type:
$ref: '../notificationTargetType.yaml#/$defs/NotificationTargetType'
const: partInstance
studioId:
type: string
rundownId:
type: string
partInstanceId:
type: string
additionalProperties: false
examples:
- $ref: './notificationTargetPartInstance-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: pieceInstance
studioId: studio01
rundownId: rd123
partInstanceId: pi789
pieceInstanceId: pc1011
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$defs:
NotificationTargetPieceInstance:
type: object
title: NotificationTargetPieceInstance
required: [type, studioId, rundownId, partInstanceId, pieceInstanceId]
properties:
type:
$ref: '../notificationTargetType.yaml#/$defs/NotificationTargetType'
const: pieceInstance
studioId:
type: string
rundownId:
type: string
partInstanceId:
type: string
pieceInstanceId:
type: string
additionalProperties: false
examples:
- $ref: './notificationTargetPieceInstance-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type: rundown
studioId: studio01
rundownId: rd123
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$defs:
NotificationTargetRundown:
type: object
title: NotificationTargetRundown
required: [type, studioId, rundownId]
properties:
type:
$ref: '../notificationTargetType.yaml#/$defs/NotificationTargetType'
const: rundown
studioId:
type: string
rundownId:
type: string
additionalProperties: false
examples:
- $ref: './notificationTargetRundown-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type: playlist
studioId: studio01
playlistId: pl456
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$defs:
NotificationTargetRundownPlaylist:
type: object
title: NotificationTargetRundownPlaylist
required: [type, studioId, playlistId]
properties:
type:
$ref: '../notificationTargetType.yaml#/$defs/NotificationTargetType'
const: playlist
studioId:
type: string
playlistId:
type: string
additionalProperties: false
examples:
- $ref: './notificationTargetRundownPlaylist-example.yaml'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type: unknown
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$defs:
NotificationTargetUnknown:
type: object
title: NotificationTargetUnknown
required: [type]
properties:
type:
$ref: '../notificationTargetType.yaml#/$defs/NotificationTargetType'
const: unknown
additionalProperties: false
examples:
- $ref: './notificationTargetUnknown-example.yaml'
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ $defs:
- activePieces
- segments
- adLibs
- notifications
- buckets
- packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: Notifications topic for websocket subscriptions.
subscribe:
operationId: receiveNotifications
description: Server sends notifications updates
message:
oneOf:
- $ref: '../../components/notifications/messages/notificationsMessage.yaml#/components/messages/notificationsMessage'
Loading
Loading