@pidgeyjs/core
v0.2.0
Published
Database-agnostic job queue logic
Readme
@pidgeyjs/core
Core logic for Pidgey, a type-safe job queue for TypeScript.
Installation
pnpm add @pidgeyjs/coreOverview
This package contains the core interfaces, types, and client logic for Pidgey. It is designed to be adapter-agnostic and provides the foundation for all Pidgey implementations.
Note: Most users should use integration packages like
@pidgeyjs/nextinstead of using@pidgeyjs/coredirectly. Integration packages provide convenient helpers and smart defaults for specific frameworks.
Direct Usage
If you need to use Pidgey outside of Next.js or want full control over initialization:
import { PidgeyClient } from '@pidgeyjs/core';
import { PostgresQueueAdapter } from '@pidgeyjs/postgres';
const client = new PidgeyClient(
new PostgresQueueAdapter({
connectionString: process.env.DATABASE_URL,
})
);
await client.connect();
const emailJob = client.defineJob({
name: 'send-email',
handler: async (data: { to: string }) => {
console.log('Sending email to', data.to);
},
});
await emailJob.enqueue({ to: '[email protected]' });Available Adapters
@pidgeyjs/postgres- PostgreSQL adapter@pidgeyjs/sqlite- SQLite adapter@pidgeyjs/redis- Redis adapter (powered by BullMQ)
For Framework Integration Developers
This package exports the core types and interfaces needed to build framework-specific integrations:
PidgeyClient- Main client classQueueAdapter- Base adapter interfaceJobDefinition,JobHandler,Job- Core type definitionsdefineWorkerConfig- Helper for worker configuration
License
MIT
