Files
task-stream/libs/api/tracker/presenters/src/lib/tracker-presenters.module.ts
Josep Piguillem d43fc620e9 feat: outgoing webhooks
Owners and admins can point a project at other systems: a signed JSON
POST (HMAC-SHA256 of the body) when tickets, comments, releases or sprints
change, filtered by event or family. Deliveries are retried a couple of
times, the last one is shown, and a ping can be sent from the settings.
Private addresses are refused unless WEBHOOKS_ALLOW_PRIVATE is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:36:19 +02:00

85 lines
2.9 KiB
TypeScript

import { DynamicModule, Module, Type } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { MulterModule } from '@nestjs/platform-express';
import './graphql/enums';
import { CommentResolver } from './graphql/comment.resolver';
import { NotificationResolver } from './graphql/notification.resolver';
import { IssueResolver } from './graphql/issue.resolver';
import { ProjectResolver } from './graphql/project.resolver';
import { ReleaseResolver } from './graphql/release.resolver';
import { SubscriptionResolver } from './graphql/subscription.resolver';
import { AttachmentsController } from './http/attachments.controller';
import { CommentsController } from './http/comments.controller';
import { IssuesController } from './http/issues.controller';
import { ExploreController } from './http/explore.controller';
import { ProjectsController } from './http/projects.controller';
import { Refs } from './http/refs';
import { ReleasesController } from './http/releases.controller';
import { NotificationsController } from './http/notifications.controller';
import { SavedFiltersController } from './http/saved-filters.controller';
import { SavedFilterResolver } from './graphql/saved-filter.resolver';
import { SprintResolver } from './graphql/sprint.resolver';
import { SprintsController } from './http/sprints.controller';
import { GitController } from './http/git.controller';
import { GitResolver } from './graphql/git.resolver';
import { WebhookResolver } from './graphql/webhook.resolver';
import { WebhooksController } from './http/webhooks.controller';
/**
* Driving adapters of the tracker context: GraphQL (queries, mutations,
* subscriptions) and REST with OpenAPI for other apps. Both call the same
* application services.
*/
@Module({
imports: [
// Uploads stay in memory until the command stores them; the size limit
// is enforced here, before a byte reaches the application.
MulterModule.registerAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
limits: {
fileSize:
(config.get<number>('ATTACHMENTS_MAX_MB') ?? 25) * 1024 * 1024,
files: 1,
},
}),
}),
],
controllers: [
ProjectsController,
IssuesController,
AttachmentsController,
CommentsController,
ReleasesController,
ExploreController,
NotificationsController,
SavedFiltersController,
SprintsController,
GitController,
WebhooksController,
],
providers: [
Refs,
ProjectResolver,
IssueResolver,
CommentResolver,
ReleaseResolver,
SubscriptionResolver,
NotificationResolver,
SavedFilterResolver,
SprintResolver,
GitResolver,
WebhookResolver,
],
})
export class TrackerPresentersModule {
static withApplication(
applicationModule: Type | DynamicModule,
): DynamicModule {
return {
module: TrackerPresentersModule,
imports: [applicationModule],
};
}
}