Skip to main content

Gotchas: hbf-knowledge-manager

Package-specific non-obvious patterns and pitfalls. Loaded on demand when working on this package.

  • SharePointDeltaService lives in WebhooksModule: To avoid a circular NestJS module dependency (SharePointModule -> SyncModule -> SourcesModule -> SharePointModule), SharePointDeltaService is declared as a provider in WebhooksModule, not SharePointModule. The file still lives at src/sources/sharepoint/sharepoint-delta.service.ts.
  • Graph webhook notifications don't contain file events: Unlike Azure Event Grid (which sends BlobCreated/BlobDeleted with metadata), SharePoint Graph webhooks only say "something changed". A delta query follow-up is always required. The SharePointWebhookHandler.parseEvent() returns null by design.

Content Type Filtering

  • allowedContentTypes holds file extensions, not MIME types: Both Azure Blob and SharePoint integrations use extension-based filtering (e.g., ["pdf", "docx"]). The isAllowedFileType function checks the file extension, not the content-type header. Old integrations may still have MIME values needing migration.
  • Azure Blob full-sync and webhook paths must apply the same filters: If they diverge, webhooks create groups that full-sync's orphan cleanup deletes (orphan cleanup only runs when errors.length === 0).