{"_id":"@adonisjs_log/app_logger","name":"@adonisjs_log/app_logger","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@adonisjs_log/app_logger","version":"1.0.0","description":"Task scheduler for AdonisJS","homepage":"https://github.com/KABBOUCHI/adonisjs-scheduler#readme","license":"MIT","keywords":["adonisjs","scheduler","crons"],"type":"module","author":{"name":"Georges KABBOUCHI","email":"georges.kabbouchi@gmail.com"},"main":"build/providers/scheduler_provider.js","scripts":{"build":"npm run clean && npm run build-only && npm run copyfiles","copyfiles":"copyfiles \"stubs/**/*.stub\" build","build-only":"tsc && npm run index:commands","clean":"rimraf build","prepublishOnly":"npm run build","index:commands":"adonis-kit index build/commands","test":"node --enable-source-maps --import=ts-node-maintained/register/esm bin/test.ts","dev":"npm run build -- --watch"},"exports":{".":"./build/index.js","./services/main":"./build/services/main.js","./scheduler_provider":"./build/providers/scheduler_provider.js","./commands":"./build/commands/main.js"},"devDependencies":{"@adonisjs/core":"^6.2.0","@adonisjs/eslint-config":"^1.2.1","@adonisjs/prettier-config":"^1.2.1","@adonisjs/tsconfig":"^1.2.1","@japa/assert":"^4.0.0","@japa/runner":"^3.1.4","@swc/core":"^1.3.102","@types/async-lock":"^1.4.2","@types/luxon":"^3.4.2","@types/node":"^22.10.1","@types/node-cron":"^3.0.7","copyfiles":"^2.4.1","eslint":"^8.19.0","prettier":"^2.7.1","rimraf":"^3.0.2","ts-node-maintained":"^10.9.4","typescript":"^5.3.3"},"publishConfig":{"tag":"latest","access":"public"},"repository":{"type":"git","url":"git+https://github.com/KABBOUCHI/adonisjs-scheduler.git"},"bugs":{"url":"https://github.com/KABBOUCHI/adonisjs-scheduler/issues"},"eslintConfig":{"extends":"@adonisjs/eslint-config/package"},"prettier":"@adonisjs/prettier-config","dependencies":{"async-lock":"^1.4.1","chokidar":"^4.0.2","cron-parser":"^5.0.4","luxon":"^3.5.0","node-cron":"^3.0.2","string-width":"^7.2.0"},"peerDependencies":{"@adonisjs/core":"^6.2.0"},"_id":"@adonisjs_log/app_logger@1.0.0","gitHead":"7717cb5d3d5b919ef0fb730db4eddce63291ddc3","types":"./build/providers/scheduler_provider.d.ts","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-53EZhzT28tbHZUADZSl4HfI0CWF3D+J9ZUkVGbvcFkoUP/PjywfRCt7L/V04b7w8PDqRtCk5eR2+cAvqv6W3eQ==","shasum":"5396bf3eb35f64c9c21c5d7deb4b92f20d880b56","tarball":"https://registry.npmjs.org/@adonisjs_log/app_logger/-/app_logger-1.0.0.tgz","fileCount":35,"unpackedSize":53805,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEG0C6BOeHyOcw92h5SH1l4NqciPRQMlBbCOG3YJfchcAiEAmFhc6Tc61f3u4auO0d8udNj390KCHA0gCxkBIVJdyxk="}]},"_npmUser":{"name":"kamrul1985","email":"kamrul_sscis@hotmail.com"},"directories":{},"maintainers":[{"name":"kamrul1985","email":"kamrul_sscis@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/app_logger_1.0.0_1765460216997_0.9446640375531987"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-11T13:36:56.925Z","1.0.0":"2025-12-11T13:36:57.157Z","modified":"2025-12-11T13:36:57.485Z"},"maintainers":[{"name":"kamrul1985","email":"kamrul_sscis@hotmail.com"}],"description":"Task scheduler for AdonisJS","homepage":"https://github.com/KABBOUCHI/adonisjs-scheduler#readme","keywords":["adonisjs","scheduler","crons"],"repository":{"type":"git","url":"git+https://github.com/KABBOUCHI/adonisjs-scheduler.git"},"author":{"name":"Georges KABBOUCHI","email":"georges.kabbouchi@gmail.com"},"bugs":{"url":"https://github.com/KABBOUCHI/adonisjs-scheduler/issues"},"license":"MIT","readme":"<div align=\"center\">\n  <h1><b>AdonisJS Scheduler</b></h1>\n\n  <p>Task scheduler for AdonisJS v6</p>\n\n  \n</div>\n\n## Installation\n\nInstall the package from npm using the following command:\n\n```bash\nnode ace add adonisjs-scheduler\n```\n\n## Running The Scheduler\n\n```sh\nnode ace scheduler:run\n# or\nnode ace scheduler:work\n\n# automatically restart the scheduler when files are modified during development mode\nnode ace scheduler:run --watch\n\n\nnode ace scheduler:run --tag <tag_name> # Run all schedules with the specified tag\n```\n\n## Defining Schedules\n\n```ts\n// start/scheduler.ts\n\nimport scheduler from 'adonisjs-scheduler/services/main'\n\nimport PurgeUsers from '../commands/purge_users'\n\nscheduler.command('inspire').everyFiveSeconds()\nscheduler.command(PurgeUsers, ['30 days']).everyFiveSeconds().withoutOverlapping()\n\nscheduler.withoutOverlapping(\n  () => {\n    scheduler.command('inspire').everySecond()\n    scheduler.command(PurgeUsers, ['30 days']).everyFiveSeconds()\n  },\n  { expiresAt: 30_000 }\n)\n\nscheduler.withTag(\n  () => {\n    scheduler.command('inspire').everySecond()\n  },\n  'my-tag'\n)\n\nscheduler\n  .call(() => {\n    console.log('Pruge DB!')\n  })\n  .weekly()\n\n\nscheduler\n  .call(() => {\n    console.log('Pruge DB!')\n  })\n  .tag('my-tag')\n  .weekly()\n```\n\nor define schedule directly on command\n\n```ts\nimport { BaseCommand, args } from '@adonisjs/core/ace'\nimport { schedule } from 'adonisjs-scheduler'\n\n@schedule(\"* * * * *\", [\"30 days\"])\n@schedule((s) => s.everyFiveSeconds().immediate(), [\"7 days\"])\n@schedule((s) => s.everyMinute(), [\"42 days\"])\nexport default class PurgeUsers extends BaseCommand {\n  static commandName = 'purge:users'\n  static description = ''\n\n  static options: CommandOptions = {}\n\n  @args.string()\n  declare olderThan: string\n\n  async run() {\n    //\n  }\n}\n```\n\n\n## Schedule Frequency Options\n\n| Method                           | Description                                             |\n| -------------------------------- | ------------------------------------------------------- |\n| `.cron('* * * * *');`            | Run the task on a custom cron schedule                  |\n| `.everyMinute();`                | Run the task every minute                               |\n| `.everyTwoMinutes();`            | Run the task every two minutes                          |\n| `.everyThreeMinutes();`          | Run the task every three minutes                        |\n| `.everyFourMinutes();`           | Run the task every four minutes                         |\n| `.everyFiveMinutes();`           | Run the task every five minutes                         |\n| `.everyTenMinutes();`            | Run the task every ten minutes                          |\n| `.everyFifteenMinutes();`        | Run the task every fifteen minutes                      |\n| `.everyThirtyMinutes();`         | Run the task every thirty minutes                       |\n| `.hourly();`                     | Run the task every hour                                 |\n| `.hourlyAt(17);`                 | Run the task every hour at 17 minutes past the hour.    |\n| `.everyTwoHours();`              | Run the task every two hours                            |\n| `.everyThreeHours();`            | Run the task every three hours                          |\n| `.everyFourHours();`             | Run the task every four hours                           |\n| `.everyFiveHours();`             | Run the task every five hours                           |\n| `.everySixHours();`              | Run the task every six hours                            |\n| `.daily();`                      | Run the task every day at midnight                      |\n| `.dailyAt('13:00');`             | Run the task every day at 13:00.                        |\n| `.twiceDaily(1, 13);`            | Run the task daily at 1:00 & 13:00.                     |\n| `.twiceDailyAt(1, 13, 15);`      | Run the task daily at 1:15 & 13:15.                     |\n| `.weekly();`                     | Run the task every Sunday at 00:00                      |\n| `.weeklyOn(1, '8:00');`          | Run the task every week on Monday at 8:00.              |\n| `.monthly();`                    | Run the task on the first day of every month at 00:00   |\n| `.monthlyOn(4, '15:00');`        | Run the task every month on the 4th at 15:00.           |\n| `.twiceMonthly(1, 16, '13:00');` | Run the task monthly on the 1st and 16th at 13:00.      |\n| `.lastDayOfMonth('15:00');`      | Run the task on the last day of the month at 15:00.     |\n| `.quarterly();`                  | Run the task on the first day of every quarter at 00:00.|\n| `.quarterlyOn(4, '14:00');`      | Run the task every quarter on the 4th at 14:00.         |\n| `.yearly();`                     | Run the task on the first day of every year at 00:00.   |\n| `.yearlyOn(6, 1, '17:00');`      | Run the task every year on June 1st at 17:00.           |\n| `.timezone('America/New_York');` | Set the timezone for the task.                          |\n| `.immediate();`                  | Run the task on startup                                 |\n| `.withoutOverlapping();`         | Run the task without overlapping                        |\n\n\n## Alternative Ways to Run the Scheduler\n\nBesides using `node ace scheduler:run`, you can also manually initialize and control the scheduler worker in your code:\n\n```ts\nimport { Worker } from 'adonisjs-scheduler'\nimport app from '@adonisjs/core/services/app'\n\nconst worker = new Worker(app)\n\napp.terminating(async () => {\n  await worker.stop()\n})\n\nawait worker.start()\n```\n\n\nNote: make sure to modify `adonisrc.ts` and include the environment where the worker is running.\n\n```ts\nimport { defineConfig } from '@adonisjs/core/app'\n\nexport default defineConfig({\n providers: [\n   {\n      file: () => import('adonisjs-scheduler/scheduler_provider'),\n      environment: ['console', 'web'], // <---\n   },\n\n   // or enable for all environments\n   () => import('adonisjs-scheduler/scheduler_provider'),\n})\n```\n","readmeFilename":"README.md","_rev":"1-c1067c89a17ceb721260a73186eb68d6"}