fix: clean up types

Signed-off-by: Paul Schultz <pschultz@pobox.com>
This commit is contained in:
Paul Schultz
2025-09-15 20:26:11 -05:00
parent 675b37596b
commit a95cebdcb9
9 changed files with 53 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-notifications-backend-module-slack': patch
'@backstage/plugin-notifications-backend': patch
'@backstage/types': patch
---
Internal refactoring for better type support
+1 -1
View File
@@ -46,7 +46,7 @@ export type Subscription = {
// We get the actual runtime polyfill from zen-observable
declare global {
interface SymbolConstructor {
readonly observable: symbol;
readonly observable: unique symbol;
}
}
@@ -42,7 +42,9 @@ export class SlackNotificationProcessor implements NotificationProcessor {
private readonly catalog: CatalogService;
private readonly auth: AuthService;
private readonly slack: WebClient;
private readonly sendNotifications;
private readonly sendNotifications: (
opts: ChatPostMessageArguments[],
) => Promise<void>;
private readonly messagesSent: Counter;
private readonly messagesFailed: Counter;
private readonly broadcastChannels?: string[];
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.createTable('notification', table => {
table.uuid('id').primary();
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('notification', table => {
table.text('link').nullable().alter();
@@ -21,6 +26,9 @@ exports.up = async function up(knex) {
});
};
/**
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
await knex.schema.alterTable('notification', table => {
table.text('link').notNullable().alter();
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.createTable('broadcast', table => {
table.uuid('id').primary();
@@ -37,7 +42,7 @@ exports.up = async function up(knex) {
table
.foreign('broadcast_id')
.references(['id'])
.references('id')
.inTable('broadcast')
.onDelete('CASCADE');
table.unique(['broadcast_id', 'user'], {
@@ -13,6 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.createTable('user_settings', table => {
table.string('user').notNullable();
@@ -14,6 +14,11 @@
* limitations under the License.
*/
// @ts-check
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('notification', table => {
table.string('icon', 255).nullable();
@@ -23,6 +28,9 @@ exports.up = async function up(knex) {
});
};
/**
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
await knex.schema.alterTable('notification', table => {
table.dropColumn('icon');
@@ -13,8 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-check
const crypto = require('crypto');
/**
* @param {import('knex').Knex} knex
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('user_settings', table => {
table.string('topic').nullable().after('origin');
@@ -41,6 +47,9 @@ exports.up = async function up(knex) {
});
};
/**
* @param {import('knex').Knex} knex
*/
exports.down = async function down(knex) {
await knex.schema.table('user_settings', table => {
table.dropUnique([], 'user_settings_unique_idx');