Skip to content
Open
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
7 changes: 7 additions & 0 deletions packages/live-status-gateway-api/api/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ channels:
- $ref: '#/components/messages/adLibs'
- $ref: '#/components/messages/packages'
- $ref: '#/components/messages/buckets'
- $ref: '#/components/messages/notifications'
components:
messages:
ping:
Expand Down Expand Up @@ -137,3 +138,9 @@ components:
description: Buckets in Studio
payload:
$ref: './schemas/buckets.yaml#/$defs/buckets'
notifications:
name: notifications
messageId: notificationsUpdate
description: Active notifications in Sofie
payload:
$ref: './schemas/notifications.yaml#/$defs/notifications'
192 changes: 192 additions & 0 deletions packages/live-status-gateway-api/api/schemas/notifications.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
title: Notifications
description: Active notifications in Sofie

$defs:
notifications:
type: object
title: NotificationsEvent
properties:
event:
type: string
const: notifications
activeNotifications:
description: Active notifications in Sofie
type: array
items:
$ref: '#/$defs/NotificationObj'
required: [event, activeNotifications]
additionalProperties: false
examples:
- event: notifications
activeNotifications:
- $ref: '#/$defs/NotificationObj/examples/0'

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: '#/$defs/severity'
message:
type: string
description: The message of the notification
relatedTo:
$ref: '#/$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:
- _id: 'notif123'
severity: error
message: 'disk.space.low'
relatedTo:
$ref: '#/$defs/NotificationTarget/examples/0'
created: 1694784932
modified: 1694784950

severity:
type: string
title: NotificationSeverity
description: Severity level of the notification.
enum:
- warning
- error
- info
examples:
- info

NotificationTarget:
title: NotificationTarget
description: Description of what the notification is related to
oneOf:
- $ref: '#/$defs/NotificationTargetRundown'
- $ref: '#/$defs/NotificationTargetRundownPlaylist'
- $ref: '#/$defs/NotificationTargetPartInstance'
- $ref: '#/$defs/NotificationTargetPieceInstance'
- $ref: '#/$defs/NotificationTargetUnknown'
examples:
- $ref: '#/$defs/NotificationTargetRundown/examples/0'
- $ref: '#/$defs/NotificationTargetRundownPlaylist/examples/0'
- $ref: '#/$defs/NotificationTargetPartInstance/examples/0'
- $ref: '#/$defs/NotificationTargetPieceInstance/examples/0'
- $ref: '#/$defs/NotificationTargetUnknown/examples/0'

NotificationTargetType:
type: string
title: NotificationTargetType
description: Possible NotificationTarget types
enum:
- rundown
- playlist
- partInstance
- pieceInstance
- unknown

NotificationTargetRundown:
type: object
title: NotificationTargetRundown
required: [type, studioId, rundownId]
properties:
type:
$ref: '#/$defs/NotificationTargetType'
enum: [rundown]
studioId:
type: string
rundownId:
type: string
additionalProperties: false
examples:
- type: rundown
studioId: studio01
rundownId: rd123

NotificationTargetRundownPlaylist:
type: object
title: NotificationTargetRundownPlaylist
required: [type, studioId, playlistId]
properties:
type:
$ref: '#/$defs/NotificationTargetType'
enum: [playlist]
studioId:
type: string
playlistId:
type: string
additionalProperties: false
examples:
- type: playlist
studioId: studio01
playlistId: pl456

NotificationTargetPartInstance:
type: object
title: NotificationTargetPartInstance
required: [type, studioId, rundownId, partInstanceId]
properties:
type:
$ref: '#/$defs/NotificationTargetType'
enum: [partInstance]
studioId:
type: string
rundownId:
type: string
partInstanceId:
type: string
additionalProperties: false
examples:
- type: partInstance
studioId: studio01
rundownId: rd123
partInstanceId: pi789

NotificationTargetPieceInstance:
type: object
title: NotificationTargetPieceInstance
required: [type, studioId, rundownId, partInstanceId, pieceInstanceId]
properties:
type:
$ref: '#/$defs/NotificationTargetType'
enum: [pieceInstance]
studioId:
type: string
rundownId:
type: string
partInstanceId:
type: string
pieceInstanceId:
type: string
additionalProperties: false
examples:
- type: pieceInstance
studioId: studio01
rundownId: rd123
partInstanceId: pi789
pieceInstanceId: pc1011

NotificationTargetUnknown:
type: object
title: NotificationTargetUnknown
required: [type]
properties:
type:
$ref: '#/$defs/NotificationTargetType'
enum: [unknown]
additionalProperties: false
examples:
- type: unknown
1 change: 1 addition & 0 deletions packages/live-status-gateway-api/api/schemas/root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ $defs:
- activePieces
- segments
- adLibs
- notifications
- buckets
- packages
status:
Expand Down
Loading
Loading