♻️ Update imports from @transquinnftw/queue-* to @lilith/queue/*

Migrate all internal imports to use the new unified package paths:
- @transquinnftw/queue-core → @lilith/queue/core
- @transquinnftw/queue-nestjs → @lilith/queue/nestjs
- @transquinnftw/queue-ml → @lilith/queue/ml
- @transquinnftw/queue-reporting → @lilith/queue/reporting

Also fix cron type compatibility issue in base-scheduler.ts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lilith 2025-12-30 20:28:26 -08:00
parent 822641ea0a
commit 7a162b4b8a
27 changed files with 59 additions and 58 deletions

View file

@ -1,4 +1,4 @@
import type { JobState } from '@transquinnftw/queue-core';
import type { JobState } from '@lilith/queue/core';
import { Type } from 'class-transformer';
import { IsNumber, IsOptional, Min, Max, IsIn } from 'class-validator';

View file

@ -1,6 +1,6 @@
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
import { QueueAdminGateway } from './queue-admin.gateway';
import type { QueueManagerService } from '@transquinnftw/queue-nestjs';
import type { QueueManagerService } from '@lilith/queue/nestjs';
import type { Server, Socket } from 'socket.io';
// Mock QueueManagerService

View file

@ -10,8 +10,8 @@ import {
WebSocketGateway,
WebSocketServer,
} from '@nestjs/websockets';
import type { QueueMetrics } from '@transquinnftw/queue-core';
import { QueueManagerService } from '@transquinnftw/queue-nestjs';
import type { QueueMetrics } from '@lilith/queue/core';
import { QueueManagerService } from '@lilith/queue/nestjs';
import { Server, Socket } from 'socket.io';
/**

View file

@ -1,6 +1,6 @@
import { Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { QueueManagerService } from '@transquinnftw/queue-nestjs';
import { QueueManagerService } from '@lilith/queue/nestjs';
import { DlqController } from './controllers/dlq.controller';
import { JobsController } from './controllers/jobs.controller';

View file

@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { NotFoundException, BadRequestException } from '@nestjs/common';
import { QueueAdminService } from './queue-admin.service';
import type { QueueManagerService } from '@transquinnftw/queue-nestjs';
import type { QueueManagerService } from '@lilith/queue/nestjs';
import type { Queue, Job } from 'bullmq';
// Mock QueueManagerService

View file

@ -1,5 +1,5 @@
import { Injectable, NotFoundException, BadRequestException, Logger } from '@nestjs/common';
import { QueueManagerService } from '@transquinnftw/queue-nestjs';
import { QueueManagerService } from '@lilith/queue/nestjs';
import type { Queue, Job, JobState as BullMQJobState } from 'bullmq';
import {

View file

@ -1,5 +1,5 @@
/**
* @transquinnftw/queue-admin-frontend
* @lilith/queue/admin/frontend
*
* React hooks and TypeScript types for BullMQ queue dashboard
*/

View file

@ -1,11 +1,11 @@
/**
* @transquinnftw/queue-core
* @lilith/queue/core
*
* Core types, constants, and utilities for the job queue ecosystem.
*
* @example
* ```typescript
* import { JobPriority, isPeakHour, generateCorrelationId } from '@transquinnftw/queue-core';
* import { JobPriority, isPeakHour, generateCorrelationId } from '@lilith/queue/core';
*
* // Check if we should defer jobs
* if (isPeakHour()) {

View file

@ -1,5 +1,5 @@
/**
* @transquinnftw/queue-ml
* @lilith/queue/ml
*
* ML-specific job queue extensions with batching strategies and timeout handling.
*
@ -10,7 +10,7 @@
*
* @example
* ```typescript
* import { RequestBatchingStrategy, BaseMLProcessor } from '@transquinnftw/queue-ml';
* import { RequestBatchingStrategy, BaseMLProcessor } from '@lilith/queue/ml';
*
* // Request batching for translations
* const translationBatcher = new RequestBatchingStrategy({
@ -49,4 +49,4 @@ export {
EXTENDED_ML_TIMEOUT,
DEFAULT_ML_BATCH_SIZE,
DEFAULT_ML_BATCH_WAIT_MS,
} from '@transquinnftw/queue-core';
} from '@lilith/queue/core';

View file

@ -1,7 +1,7 @@
import type { Job } from 'bullmq';
import { BaseProcessor } from '@transquinnftw/queue-nestjs';
import type { BaseJobData } from '@transquinnftw/queue-core';
import { DEFAULT_ML_TIMEOUT, DEFAULT_RETRY_ATTEMPTS } from '@transquinnftw/queue-core';
import { BaseProcessor } from '@lilith/queue/nestjs';
import type { BaseJobData } from '@lilith/queue/core';
import { DEFAULT_ML_TIMEOUT, DEFAULT_RETRY_ATTEMPTS } from '@lilith/queue/core';
import type { MLServiceConfig } from '../types/batch.types';
/**

View file

@ -1,5 +1,5 @@
import type { PipelineStep, PipelineResult } from '../types/batch.types';
import { DEFAULT_ML_TIMEOUT } from '@transquinnftw/queue-core';
import { DEFAULT_ML_TIMEOUT } from '@lilith/queue/core';
/**
* Pipeline batching strategy for chaining ML operations.

View file

@ -2,11 +2,11 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { Logger } from '@nestjs/common';
import type { Queue, Job } from 'bullmq';
import { BaseJobService, AddJobResult } from './base-job-service';
import type { BaseJobData, JobPriority } from '@transquinnftw/queue-core';
import type { BaseJobData, JobPriority } from '@lilith/queue/core';
// Mock shouldDeferJob utility
vi.mock('@transquinnftw/queue-core', async () => {
const actual = await vi.importActual('@transquinnftw/queue-core');
vi.mock('@lilith/queue/core', async () => {
const actual = await vi.importActual('@lilith/queue/core');
return {
...actual,
@ -65,7 +65,7 @@ describe('BaseJobService', () => {
service = new TestJobService(mockQueue);
// Reset shouldDeferJob mock to default (no deferral) before each test
const { shouldDeferJob } = await import('@transquinnftw/queue-core');
const { shouldDeferJob } = await import('@lilith/queue/core');
(shouldDeferJob as any).mockReturnValue({ shouldDefer: false, delay: 0 });
});
@ -211,7 +211,7 @@ describe('BaseJobService', () => {
describe('peak-hour deferral', () => {
it('should defer job during peak hours', async () => {
const { shouldDeferJob } = await import('@transquinnftw/queue-core');
const { shouldDeferJob } = await import('@lilith/queue/core');
(shouldDeferJob as any).mockReturnValue({ shouldDefer: true, delay: 3600000 });
const loggerDebugSpy = vi.spyOn(service['logger'], 'debug');
@ -238,7 +238,7 @@ describe('BaseJobService', () => {
});
it('should not defer if applyPeakAvoidance is false', async () => {
const { shouldDeferJob } = await import('@transquinnftw/queue-core');
const { shouldDeferJob } = await import('@lilith/queue/core');
(shouldDeferJob as any).mockReturnValue({ shouldDefer: true, delay: 3600000 });
const result = await service.addJob(
@ -258,7 +258,7 @@ describe('BaseJobService', () => {
});
it('should use maximum delay when both options.delay and peak delay exist', async () => {
const { shouldDeferJob } = await import('@transquinnftw/queue-core');
const { shouldDeferJob } = await import('@lilith/queue/core');
(shouldDeferJob as any).mockReturnValue({ shouldDefer: true, delay: 1000 });
await service.addJob(
@ -315,7 +315,7 @@ describe('BaseJobService', () => {
});
it('should apply peak-hour deferral in bulk', async () => {
const { shouldDeferJob } = await import('@transquinnftw/queue-core');
const { shouldDeferJob } = await import('@lilith/queue/core');
(shouldDeferJob as any).mockReturnValue({ shouldDefer: true, delay: 1000 });
const jobs = [

View file

@ -1,6 +1,6 @@
import { Logger } from '@nestjs/common';
import type { Queue, Job } from 'bullmq';
import type { BaseJobData, JobPriority, JobDefaults, JobCounts } from '@transquinnftw/queue-core';
import type { BaseJobData, JobPriority, JobDefaults, JobCounts } from '@lilith/queue/core';
import {
generateCorrelationId,
shouldDeferJob,
@ -9,7 +9,7 @@ import {
DEFAULT_BACKOFF,
DEFAULT_REMOVE_ON_COMPLETE,
DEFAULT_REMOVE_ON_FAIL,
} from '@transquinnftw/queue-core';
} from '@lilith/queue/core';
/**
* Options for adding a job.

View file

@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { Logger } from '@nestjs/common';
import type { Job } from 'bullmq';
import { BaseProcessor, JobReporter } from './base-processor';
import type { BaseJobData } from '@transquinnftw/queue-core';
import type { BaseJobData } from '@lilith/queue/core';
// Mock types
interface TestJobData extends BaseJobData {

View file

@ -1,8 +1,8 @@
import { Logger } from '@nestjs/common';
import { WorkerHost } from '@nestjs/bullmq';
import type { Job } from 'bullmq';
import type { BaseJobData, JobEvent, JobEventType } from '@transquinnftw/queue-core';
import { generateCorrelationId } from '@transquinnftw/queue-core';
import type { BaseJobData, JobEvent, JobEventType } from '@lilith/queue/core';
import { generateCorrelationId } from '@lilith/queue/core';
/**
* Job reporter interface for lifecycle event logging.

View file

@ -3,7 +3,7 @@ import { Logger } from '@nestjs/common';
import { SchedulerRegistry } from '@nestjs/schedule';
import type { Queue } from 'bullmq';
import { BaseScheduler } from './base-scheduler';
import type { CronJobDefinition } from '@transquinnftw/queue-core';
import type { CronJobDefinition } from '@lilith/queue/core';
// Create CronJob mock - stores callback for test access
let lastCronCallback: (() => Promise<void>) | undefined;
@ -36,8 +36,8 @@ const cronMock = {
};
// Mock isPeakHour utility
vi.mock('@transquinnftw/queue-core', async () => {
const actual = await vi.importActual('@transquinnftw/queue-core');
vi.mock('@lilith/queue/core', async () => {
const actual = await vi.importActual('@lilith/queue/core');
return {
...actual,
isPeakHour: vi.fn().mockReturnValue(false),
@ -445,7 +445,7 @@ describe('BaseScheduler', () => {
});
it('should skip execution during peak hours if configured', async () => {
const { isPeakHour } = await import('@transquinnftw/queue-core');
const { isPeakHour } = await import('@lilith/queue/core');
(isPeakHour as any).mockReturnValue(true);
const definition: CronJobDefinition = {
@ -473,7 +473,7 @@ describe('BaseScheduler', () => {
});
it('should execute during peak hours if skipDuringPeak is false', async () => {
const { isPeakHour } = await import('@transquinnftw/queue-core');
const { isPeakHour } = await import('@lilith/queue/core');
(isPeakHour as any).mockReturnValue(true);
const definition: CronJobDefinition = {

View file

@ -2,13 +2,13 @@ import { Logger, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
import { SchedulerRegistry } from '@nestjs/schedule';
import type { CronJob } from 'cron';
import type { Queue } from 'bullmq';
import type { CronJobDefinition } from '@transquinnftw/queue-core';
import type { CronJobDefinition } from '@lilith/queue/core';
import {
isPeakHour,
DEFAULT_PRIORITY,
DEFAULT_RETRY_ATTEMPTS,
DEFAULT_BACKOFF,
} from '@transquinnftw/queue-core';
} from '@lilith/queue/core';
/**
* Registered cron job metadata.
@ -162,7 +162,8 @@ export abstract class BaseScheduler implements OnModuleInit, OnModuleDestroy {
};
this.cronJobs.set(name, registered);
this.schedulerRegistry.addCronJob(name, cronJob);
// Cast needed due to cron version type mismatch between our dependency and @nestjs/schedule
this.schedulerRegistry.addCronJob(name, cronJob as unknown as Parameters<SchedulerRegistry['addCronJob']>[1]);
this.logger.log({
message: `Registered cron job: ${name}`,

View file

@ -6,7 +6,7 @@
*
* @example
* ```typescript
* import { Processor, OnWorkerEvent } from '@transquinnftw/queue-nestjs/decorators';
* import { Processor, OnWorkerEvent } from '@lilith/queue/nestjs/decorators';
* ```
*/

View file

@ -1,5 +1,5 @@
/**
* @transquinnftw/queue-nestjs
* @lilith/queue/nestjs
*
* NestJS integration for the job queue ecosystem.
*
@ -13,7 +13,7 @@
* @example
* ```typescript
* // app.module.ts
* import { QueueModule } from '@transquinnftw/queue-nestjs';
* import { QueueModule } from '@lilith/queue/nestjs';
*
* @Module({
* imports: [
@ -26,7 +26,7 @@
* export class AppModule {}
*
* // analytics.module.ts
* import { QueueModule } from '@transquinnftw/queue-nestjs';
* import { QueueModule } from '@lilith/queue/nestjs';
* import { ANALYTICS_QUEUE } from './analytics.queue';
*
* @Module({
@ -76,7 +76,7 @@ export type {
QueueSummary,
JobCounts,
CronJobDefinition,
} from '@transquinnftw/queue-core';
} from '@lilith/queue/core';
export {
JobPriority as Priority,
@ -86,4 +86,4 @@ export {
DEFAULT_PRIORITY,
DEFAULT_RETRY_ATTEMPTS,
DEFAULT_ML_TIMEOUT,
} from '@transquinnftw/queue-core';
} from '@lilith/queue/core';

View file

@ -1,7 +1,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { QueueModule, QUEUE_MODULE_OPTIONS } from './queue.module';
import { QueueManagerService } from './services/queue-manager.service';
import type { QueueRegistration } from '@transquinnftw/queue-core';
import type { QueueRegistration } from '@lilith/queue/core';
// Mock @nestjs/bullmq
vi.mock('@nestjs/bullmq', () => {

View file

@ -2,7 +2,7 @@ import { DynamicModule, Module, Global, type Provider, type Type } from '@nestjs
import { BullModule } from '@nestjs/bullmq';
import { ScheduleModule } from '@nestjs/schedule';
import type { ConnectionOptions, DefaultJobOptions } from 'bullmq';
import type { QueueRegistration } from '@transquinnftw/queue-core';
import type { QueueRegistration } from '@lilith/queue/core';
import { QueueManagerService } from './services/queue-manager.service';
/**

View file

@ -1,7 +1,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import type { Queue, QueueEvents, Job } from 'bullmq';
import { QueueManagerService } from './queue-manager.service';
import type { QueueRegistration } from '@transquinnftw/queue-core';
import type { QueueRegistration } from '@lilith/queue/core';
// Mock Queue factory
function createMockQueue(overrides: Partial<Queue> = {}): Queue {

View file

@ -1,6 +1,6 @@
import { Injectable, Logger, OnModuleDestroy } from '@nestjs/common';
import type { Queue, QueueEvents } from 'bullmq';
import type { QueueRegistration, QueueMetrics, QueueSummary } from '@transquinnftw/queue-core';
import type { QueueRegistration, QueueMetrics, QueueSummary } from '@lilith/queue/core';
/**
* Registry entry for a queue.

View file

@ -1,5 +1,5 @@
/**
* Example: Using @transquinnftw/queue-reporting
* Example: Using @lilith/queue/reporting
*
* This file demonstrates common usage patterns for the reporting package.
*/
@ -9,12 +9,12 @@ import { Cron } from '@nestjs/schedule';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Processor } from '@nestjs/bullmq';
import type { Job } from 'bullmq';
import { BaseProcessor, type BaseJobData } from '@transquinnftw/queue-nestjs';
import { BaseProcessor, type BaseJobData } from '@lilith/queue/nestjs';
import {
ReportingModule,
JobReporterService,
JobAnalyticsService,
} from '@transquinnftw/queue-reporting';
} from '@lilith/queue/reporting';
// ============================================================================
// App Module Setup

View file

@ -5,7 +5,7 @@ import {
CreateDateColumn,
Index,
} from 'typeorm';
import type { JobEventType } from '@transquinnftw/queue-core';
import type { JobEventType } from '@lilith/queue/core';
/**
* Job lifecycle event entity for database persistence.

View file

@ -1,5 +1,5 @@
/**
* @transquinnftw/queue-reporting
* @lilith/queue/reporting
*
* Job lifecycle database persistence using TypeORM.
*
@ -12,7 +12,7 @@
* @example
* ```typescript
* // app.module.ts
* import { ReportingModule } from '@transquinnftw/queue-reporting';
* import { ReportingModule } from '@lilith/queue/reporting';
*
* @Module({
* imports: [
@ -23,7 +23,7 @@
* export class AppModule {}
*
* // analytics.processor.ts
* import { JobReporterService } from '@transquinnftw/queue-reporting';
* import { JobReporterService } from '@lilith/queue/reporting';
*
* @Processor('analytics')
* export class AnalyticsProcessor extends BaseProcessor<AnalyticsJobData> {
@ -34,7 +34,7 @@
* }
*
* // analytics.controller.ts
* import { JobAnalyticsService } from '@transquinnftw/queue-reporting';
* import { JobAnalyticsService } from '@lilith/queue/reporting';
*
* @Controller('analytics')
* export class AnalyticsController {
@ -70,4 +70,4 @@ export {
export type {
JobEvent as JobEventInterface,
JobEventType,
} from '@transquinnftw/queue-core';
} from '@lilith/queue/core';

View file

@ -1,7 +1,7 @@
import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, LessThan } from 'typeorm';
import type { JobEvent as JobEventInterface } from '@transquinnftw/queue-core';
import type { JobEvent as JobEventInterface } from '@lilith/queue/core';
import { JobEvent } from '../entities/job-event.entity';
/**