diff --git a/packages/backend/src/core/QueueService.ts b/packages/backend/src/core/QueueService.ts index c1664312c4b2..667257086611 100644 --- a/packages/backend/src/core/QueueService.ts +++ b/packages/backend/src/core/QueueService.ts @@ -7,7 +7,7 @@ import { randomUUID } from 'node:crypto'; import { Inject, Injectable } from '@nestjs/common'; import type { IActivity } from '@/core/activitypub/type.js'; import type { MiDriveFile } from '@/models/DriveFile.js'; -import type { MiWebhook, WebhookEventType } from '@/models/Webhook.js'; +import type { MiWebhook, WebhookEventTypes } from '@/models/Webhook.js'; import type { MiSystemWebhook, SystemWebhookEventType } from '@/models/SystemWebhook.js'; import type { Config } from '@/config.js'; import { DI } from '@/di-symbols.js'; @@ -463,7 +463,7 @@ export class QueueService { @bindThis public userWebhookDeliver( webhook: MiWebhook, - type: WebhookEventType, + type: WebhookEventTypes, content: unknown, opts?: { attempts?: number }, ) { diff --git a/packages/backend/src/models/Webhook.ts b/packages/backend/src/models/Webhook.ts index 26cba2e59a5b..6b054e45f37e 100644 --- a/packages/backend/src/models/Webhook.ts +++ b/packages/backend/src/models/Webhook.ts @@ -8,7 +8,6 @@ import { id } from './util/id.js'; import { MiUser } from './User.js'; export const webhookEventTypes = ['mention', 'unfollow', 'follow', 'followed', 'note', 'reply', 'renote', 'reaction'] as const; -export type WebhookEventType = (typeof webhookEventTypes)[number] | `note@${string}`; // TODO: remove this line later export type WebhookEventTypes = typeof webhookEventTypes[number] | `note@${string}`; @Entity('webhook') @@ -39,7 +38,7 @@ export class MiWebhook { @Column('varchar', { length: 128, array: true, default: '{}', }) - public on: WebhookEventType[]; + public on: WebhookEventTypes[]; @Column('varchar', { length: 1024, diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts index f0b445c6238c..4f19cce3b9a7 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { IdService } from '@/core/IdService.js'; import type { WebhooksRepository } from '@/models/_.js'; -import { webhookEventTypes, WebhookEventType } from '@/models/Webhook.js'; +import { webhookEventTypes, WebhookEventTypes } from '@/models/Webhook.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; import { RoleService } from '@/core/RoleService.js'; @@ -112,7 +112,7 @@ export default class extends Endpoint { // eslint- name: ps.name, url: ps.url, secret: ps.secret, - on: ps.on as WebhookEventType[], + on: ps.on as WebhookEventTypes[], }); this.globalEventService.publishInternalEvent('webhookCreated', webhook); diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts index 93b34e9d42cc..816c9ce9f3d5 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { WebhooksRepository } from '@/models/_.js'; -import { webhookEventTypes, WebhookEventType } from '@/models/Webhook.js'; +import { webhookEventTypes, WebhookEventTypes } from '@/models/Webhook.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; import { RoleService } from '@/core/RoleService.js'; @@ -83,7 +83,7 @@ export default class extends Endpoint { // eslint- name: ps.name, url: ps.url, secret: ps.secret === null ? '' : ps.secret, - on: ps.on as WebhookEventType[], + on: ps.on as WebhookEventTypes[], active: ps.active, });