NotificationChannelModel
Defined in: packages/core/src/models/notification-channel.ts:39
Data operations for notification channels.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new NotificationChannelModel(
db,tables?,secret?):NotificationChannelModel
Defined in: packages/core/src/models/notification-channel.ts:49
Parameters
Section titled “Parameters”Database adapter.
tables?
Section titled “tables?”Table handles (defaults to the adapter’s tables).
secret?
Section titled “secret?”Server secret for channel-secret encryption.
Returns
Section titled “Returns”NotificationChannelModel
Methods
Section titled “Methods”create()
Section titled “create()”create(
input):Promise<NotificationChannelRow>
Defined in: packages/core/src/models/notification-channel.ts:70
Create a channel (secret encrypted at rest when provided).
Parameters
Section titled “Parameters”NotificationChannelCreateInput
Returns
Section titled “Returns”Promise<NotificationChannelRow>
decryptSecret()
Section titled “decryptSecret()”decryptSecret(
row):string
Defined in: packages/core/src/models/notification-channel.ts:127
Decrypt the secret for a stored row (in memory only, at send time).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string
get(
id):Promise<NotificationChannelRow|null>
Defined in: packages/core/src/models/notification-channel.ts:88
Fetch a channel by id, or null.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<NotificationChannelRow | null>
list()
Section titled “list()”list(
projectId):Promise<NotificationChannelRow[]>
Defined in: packages/core/src/models/notification-channel.ts:56
List channels for a project.
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
Returns
Section titled “Returns”Promise<NotificationChannelRow[]>
listSystem()
Section titled “listSystem()”listSystem():
Promise<NotificationChannelRow[]>
Defined in: packages/core/src/models/notification-channel.ts:63
List site-wide admin channels (project_id IS NULL).
Returns
Section titled “Returns”Promise<NotificationChannelRow[]>
recordOutcome()
Section titled “recordOutcome()”recordOutcome(
id,error?):Promise<void>
Defined in: packages/core/src/models/notification-channel.ts:138
Record the outcome of a delivery attempt: the sanitized error with its time, or nothing to clear a previous error. Skips the write when the row is already in that state.
Parameters
Section titled “Parameters”string
error?
Section titled “error?”string
Returns
Section titled “Returns”Promise<void>
remove()
Section titled “remove()”remove(
id):Promise<void>
Defined in: packages/core/src/models/notification-channel.ts:97
Remove a channel by id.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
toView()
Section titled “toView()”toView(
row):NotificationChannel|null
Defined in: packages/core/src/models/notification-channel.ts:105
Turn a stored row into the send-ready view providers take, with the secret decrypted in memory. Returns null when the secret cannot be decrypted with the configured keys.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”NotificationChannel | null
configOf()
Section titled “configOf()”
staticconfigOf(row):Record<string,unknown>
Defined in: packages/core/src/models/notification-channel.ts:186
Decode the JSON-serialized config of a channel.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Record<string, unknown>
eventsOf()
Section titled “eventsOf()”
staticeventsOf(row):string[]
Defined in: packages/core/src/models/notification-channel.ts:181
Decode the JSON-serialized event list of a channel.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string[]
isStateKind()
Section titled “isStateKind()”
staticisStateKind(notifiers,provider):boolean
Defined in: packages/core/src/models/notification-channel.ts:175
Whether the provider kind delivers state (git hosts), so it needs a project and a token.
Parameters
Section titled “Parameters”notifiers
Section titled “notifiers”readonly NotifierProvider[]
provider
Section titled “provider”string
Returns
Section titled “Returns”boolean
validateInput()
Section titled “validateInput()”
staticvalidateInput(notifiers,provider,config,scope?):ChannelValidation
Defined in: packages/core/src/models/notification-channel.ts:153
Validate channel input against the matching notifier’s schema. With scope, also
enforce what state providers (git hosts) need: a project and a token.
Parameters
Section titled “Parameters”notifiers
Section titled “notifiers”readonly NotifierProvider[]
provider
Section titled “provider”string
config
Section titled “config”unknown
scope?
Section titled “scope?”hasSecret
Section titled “hasSecret”boolean
projectId
Section titled “projectId”string | null