Skip to content

Feature overview

The package has three PostgreSQL-backed feature modules plus BullMQ integration.

FeatureEnablePrimary APIHTTP controller
Uploaded filesuploadedFile: {...}UploadedFileServiceprivate opt-in
Action historyactionHistory: {...}ActionHistoryServiceprivate opt-in
Job schedulerjobScheduler: {}JobSchedulerServicenone
BullMQ queuequeue: {...} or QueueModuleQueue, SdWorkerHostnone

Shared setup

Uploaded files, action history, and job scheduler export TypeORM entities from @sdcorejs/nestjs/features. Register them with autoLoadEntities: true or list them explicitly, then generate application migrations.

ts
import { SdCoreModule } from '@sdcorejs/nestjs';

SdCoreModule.forRoot({
  uploadedFile: {
    driver: 'local',
    localRoot: './var/uploads',
    cleanupAfterDays: 7,
  },
  actionHistory: {
    authorizeRead: ({ context, tenantCode }) =>
      context.tenant === tenantCode &&
      context.permissions?.includes('history:read') === true,
  },
  jobScheduler: {},
  queue: {
    connection: { host: 'localhost', port: 6379, db: 1 },
    prefix: 'orders:dev:queue',
  },
});

Security model

  • Uploaded files use tenant/department/owner scope, generated keys, bounded input, pending-first persistence, durable deletion, and non-enumerating responses.
  • Action history binds reads to tenant + resource identity + explicit policy and recursively redacts secrets before persistence.
  • Job scheduler fences lease ownership but delegates external idempotency to a stable lease.idempotencyKey.
  • BullMQ provides durable work/retries but requires idempotent handlers.

The uploaded-file and action-history controllers are not auto-registered. Adding their classes to an application module's controllers array explicitly exposes those authenticated routes.

Released under the MIT License.