1.0.5 • Published 8 months ago

smart-task-scheduler v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Smart Task Scheduler

npm License

The Smart Task Scheduler is an innovative npm package designed to simplify and streamline task scheduling in Node.js projects. Leveraging the power of Natural Language Processing (NLP), it allows you to define tasks using human-friendly, natural language expressions, making task management accessible and intuitive.

Natural Language Scheduling

With Smart Task Scheduler, you can express task schedules in ways that feel natural, eliminating the need for complex configurations. Examples include:

  • "Every Monday at 9 AM": Automate weekly tasks like meetings or reports.
  • "Run after 5 minutes": Quickly execute a task with a simple delay.
  • "On the first day of every month": Perfect for recurring monthly operations, like invoicing or analytics.
  • "At 3 PM every weekend": Automate weekend routines like maintenance checks or updates.

Why Choose Smart Task Scheduler?

This package empowers developers with an intuitive yet powerful solution for managing tasks efficiently. Whether you're working on a personal project or a complex enterprise application, Smart Task Scheduler simplifies workflows with features such as:

  • Task Prioritization: Sort tasks by urgency (high, medium, low).
  • Cross-Timezone Scheduling: Handle global tasks seamlessly.
  • Error-Resilient Design: Avoid mistakes with clear validation and feedback.

Use Cases

The Smart Task Scheduler is a versatile tool suitable for a variety of real-world scenarios:

1. Reminder Applications

Easily build reminder apps by scheduling tasks based on natural language input. For example:

  • "Remind me to call the client every Friday at 3 PM."
  • "Notify me in 30 minutes about my break."

2. Job Automation

Automate repetitive backend processes such as:

  • Generating daily reports.
  • Sending email notifications.
  • Triggering system backups at specific times.

3. Task Management Systems

Efficiently handle task organization by:

  • Scheduling and prioritizing tasks with urgency levels (high, medium, low).
  • Managing recurring tasks, such as weekly check-ins or monthly goals.

4. Workflow Orchestration

Coordinate complex workflows by scheduling interdependent tasks in a specific sequence:

  • Example:
    • Start data processing at 2 AM.
    • Trigger email notifications at 3 AM once processing is complete.
    • Perform database backups at 4 AM.

By combining human-friendly task definitions with robust scheduling features, Smart Task Scheduler is a game-changer for developers who need reliable, scalable task management.


Installation

Install the package using npm:

npm install smart-task-scheduler

Usage

Here’s how you can get started with Smart Scheduler.

Basic Usage

const HumanScheduler = require('smart-task-scheduler');

// Create a new scheduler
const scheduler = new HumanScheduler();

// Schedule a high-priority task
scheduler.scheduleTask("Send email to team", () => {
    console.log("Email sent successfully!");
}, 'high');

// Schedule a low-priority task
scheduler.scheduleTask("Clean temp files", () => {
    console.log("Temporary files cleaned up!");
}, 'low');

// List all scheduled tasks
console.log("Scheduled Tasks:", scheduler.listTasks());

Advanced Features

Delay a Task

You can delay a task by a specific number of minutes:

scheduler.delayTask(0, 15); // Delay task with ID 0 by 15 minutes

Cancel a Task

To cancel a specific task:

scheduler.cancelTask(1); // Cancel task with ID 1

Mark a Task as Completed

You can manually mark a task as completed:

scheduler.markTaskAsCompleted(task);
console.log("Completed Tasks:", scheduler.listCompletedTasks());

View All Scheduled Tasks

List all currently scheduled tasks with their details:

console.log("All Scheduled Tasks:", scheduler.listTasks());

Example Output

Here’s an example of what the output might look like:

Task scheduled: "Send email to team" with priority: high
Task scheduled: "Clean temp files" with priority: low
Scheduled Tasks: [
    { id: 0, description: 'Send email to team', time: '...', status: 'Scheduled', priority: 'high' },
    { id: 1, description: 'Clean temp files', time: '...', status: 'Scheduled', priority: 'low' }
]
Task "Send email to team" completed.
Completed Tasks: [
    { description: 'Send email to team', time: '...', priority: 'high' }
]

Contributing

We welcome contributions! If you'd like to improve this package, feel free to fork the repository and submit a pull request.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Links


Badges

npm License


1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago