generated from verful/adonis-package-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# [1.5.0](v1.4.0...v1.5.0) (2023-12-28) ### Features * semantic-release ([79d9e4a](79d9e4a))
- Loading branch information
1 parent
79d9e4a
commit 7949ffa
Showing
32 changed files
with
1,041 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference path="scheduler.d.ts" /> | ||
declare module '@ioc:Adonis/Core/Application' { | ||
import { SchedulerContract } from '@ioc:Verful/Scheduler'; | ||
interface ContainerBindings { | ||
'Verful/Scheduler': SchedulerContract; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference path="container.d.ts" /> | ||
/// <reference path="scheduler.d.ts" /> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
declare module '@ioc:Verful/Scheduler' { | ||
export type ScheduleHandler = () => void; | ||
export type Time = `${string}:${string}`; | ||
export type Condition = () => boolean | Promise<Boolean>; | ||
export interface ManagesFrequenciesContract { | ||
expression: string; | ||
cron(expression: string): this; | ||
everyMinute(): this; | ||
everyTwoMinutes(): this; | ||
everyThreeMinutes(): this; | ||
everyFourMinutes(): this; | ||
everyFiveMinutes(): this; | ||
everyTenMinutes(): this; | ||
everyFifteenMinutes(): this; | ||
everyThirtyMinutes(): this; | ||
hourly(): this; | ||
hourlyAt(offset: number | number[]): this; | ||
everyTwoHours(): this; | ||
everyFourHours(): this; | ||
everySixHours(): this; | ||
daily(): this; | ||
dailyAt(time: Time): this; | ||
twiceDaily(): this; | ||
twiceDailyAt(first: number, second: number, offset: number): this; | ||
weekly(): this; | ||
weeklyOn(daysOfWeek: number | number[] | string, time: Time): this; | ||
monthly(): this; | ||
monthlyOn(dayOfMonth: number, time: Time): this; | ||
twiceMonthly(first: number, second: number, time: Time): this; | ||
lastDayOfMonth(time: Time): this; | ||
yearly(): this; | ||
yearlyOn(month: number, dayOfMonth?: string | number, time?: Time): this; | ||
days(days: number | number[] | string): this; | ||
weekdays(): this; | ||
weekends(): this; | ||
sundays(): this; | ||
mondays(): this; | ||
tuesdays(): this; | ||
wednesdays(): this; | ||
thursdays(): this; | ||
fridays(): this; | ||
saturdays(): this; | ||
} | ||
export interface ScheduleContract extends ManagesFrequenciesContract { | ||
command: ScheduleHandler; | ||
filters: Condition[]; | ||
rejects: Condition[]; | ||
skip(condition: Condition): this; | ||
when(condition: Condition): this; | ||
between(start: Time, end: Time): this; | ||
unlessBetween(start: Time, end: Time): this; | ||
environments(environments: Array<'production' | 'development' | 'staging' | 'test'>): this; | ||
} | ||
export interface SchedulerContract { | ||
call(handler: ScheduleHandler): ScheduleContract; | ||
command(command: string | string[]): ScheduleContract; | ||
exec(command: string): ScheduleContract; | ||
start(): void; | ||
} | ||
const Scheduler: SchedulerContract; | ||
export default Scheduler; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference path="../adonis-typings/container.d.ts" /> | ||
/// <reference types="@adonisjs/application/build/adonis-typings" /> | ||
/// <reference types=".pnpm/@adonisjs+application@5.3.0/node_modules/@adonisjs/application/build/adonis-typings/application" /> | ||
/// <reference types=".pnpm/@adonisjs+drive@2.3.0_@adonisjs+application@5.3.0_@adonisjs+http-server@5.12.0/node_modules/@adonisjs/drive/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+http-server@5.12.0_@adonisjs+application@5.3.0_@adonisjs+encryption@4.0.8/node_modules/@adonisjs/http-server/build/adonis-typings/container" /> | ||
/// <reference types="@adonisjs/core/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+events@7.2.1_@adonisjs+application@5.3.0/node_modules/@adonisjs/events/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+hash@7.2.2_@adonisjs+application@5.3.0/node_modules/@adonisjs/hash/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+encryption@4.0.8_@adonisjs+application@5.3.0/node_modules/@adonisjs/encryption/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+validator@12.5.0_@adonisjs+application@5.3.0_@adonisjs+bodyparser@8.1.9_@adonisjs+http-server@5.12.0/node_modules/@adonisjs/validator/build/adonis-typings/container" /> | ||
import { ApplicationContract } from '@ioc:Adonis/Core/Application'; | ||
import '@japa/runner'; | ||
declare module '@japa/runner' { | ||
interface TestContext { | ||
app: ApplicationContract; | ||
} | ||
interface Test<TestData> { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("@japa/runner"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import 'reflect-metadata'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("reflect-metadata"); | ||
const node_path_1 = require("node:path"); | ||
const standalone_1 = require("@adonisjs/core/build/standalone"); | ||
const assert_1 = require("@japa/assert"); | ||
const runner_1 = require("@japa/runner"); | ||
const spec_reporter_1 = require("@japa/spec-reporter"); | ||
const dev_utils_1 = require("@poppinss/dev-utils"); | ||
const fs = new dev_utils_1.Filesystem((0, node_path_1.resolve)(__dirname, '__app')); | ||
(0, runner_1.configure)({ | ||
...(0, runner_1.processCliArgs)(process.argv.slice(2)), | ||
files: ['tests/**/*.spec.ts'], | ||
plugins: [(0, assert_1.assert)()], | ||
reporters: [(0, spec_reporter_1.specReporter)()], | ||
importer: (filePath) => Promise.resolve(`${filePath}`).then(s => __importStar(require(s))), | ||
forceExit: true, | ||
setup: [ | ||
async () => { | ||
await fs.add('.env', ''); | ||
await fs.add('config/app.ts', ` | ||
export const profiler = { enabled: true } | ||
export const appKey = 'averylong32charsrandomsecretkey', | ||
export const http = { | ||
cookie: {}, | ||
trustProxy: () => true, | ||
} | ||
`); | ||
const app = new standalone_1.Application(fs.basePath, 'test', { | ||
providers: ['@adonisjs/core', '../../providers/scheduler_provider'], | ||
}); | ||
await app.setup(); | ||
await app.registerProviders(); | ||
await app.bootProviders(); | ||
return async () => { | ||
await app.shutdown(); | ||
await fs.cleanup(); | ||
}; | ||
}, | ||
], | ||
}); | ||
runner_1.TestContext.getter('app', () => require('@adonisjs/core/build/services/app.js').default); | ||
(0, runner_1.run)(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const _default: string[]; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = ['@verful/scheduler/build/commands/scheduler_work']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { BaseCommand } from '@adonisjs/core/build/standalone'; | ||
export default class ProcessSchedule extends BaseCommand { | ||
static commandName: string; | ||
static description: string; | ||
static settings: { | ||
loadApp: boolean; | ||
stayAlive: boolean; | ||
}; | ||
run(): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const standalone_1 = require("@adonisjs/core/build/standalone"); | ||
class ProcessSchedule extends standalone_1.BaseCommand { | ||
static commandName = 'scheduler:work'; | ||
static description = 'Process the scheduled tasks'; | ||
static settings = { | ||
loadApp: true, | ||
stayAlive: true, | ||
}; | ||
async run() { | ||
this.application.container.use('Verful/Scheduler').start(); | ||
} | ||
} | ||
exports.default = ProcessSchedule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The package has been configured successfully. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// <reference path="../adonis-typings/container.d.ts" /> | ||
/// <reference types="@adonisjs/application/build/adonis-typings" /> | ||
/// <reference types=".pnpm/@adonisjs+application@5.3.0/node_modules/@adonisjs/application/build/adonis-typings/application" /> | ||
/// <reference types=".pnpm/@adonisjs+drive@2.3.0_@adonisjs+application@5.3.0_@adonisjs+http-server@5.12.0/node_modules/@adonisjs/drive/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+http-server@5.12.0_@adonisjs+application@5.3.0_@adonisjs+encryption@4.0.8/node_modules/@adonisjs/http-server/build/adonis-typings/container" /> | ||
/// <reference types="@adonisjs/core/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+events@7.2.1_@adonisjs+application@5.3.0/node_modules/@adonisjs/events/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+hash@7.2.2_@adonisjs+application@5.3.0/node_modules/@adonisjs/hash/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+encryption@4.0.8_@adonisjs+application@5.3.0/node_modules/@adonisjs/encryption/build/adonis-typings/container" /> | ||
/// <reference types=".pnpm/@adonisjs+validator@12.5.0_@adonisjs+application@5.3.0_@adonisjs+bodyparser@8.1.9_@adonisjs+http-server@5.12.0/node_modules/@adonisjs/validator/build/adonis-typings/container" /> | ||
import type { ApplicationContract } from '@ioc:Adonis/Core/Application'; | ||
export default class ScheduleProvider { | ||
protected app: ApplicationContract; | ||
constructor(app: ApplicationContract); | ||
register(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class ScheduleProvider { | ||
app; | ||
constructor(app) { | ||
this.app = app; | ||
} | ||
register() { | ||
this.app.container.singleton('Verful/Scheduler', () => { | ||
const { default: Scheduler } = require('../src/scheduler'); | ||
return new Scheduler(this.app); | ||
}); | ||
} | ||
} | ||
exports.default = ScheduleProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/// <reference path="../adonis-typings/scheduler.d.ts" /> | ||
import { ManagesFrequenciesContract, Time } from '@ioc:Verful/Scheduler'; | ||
export default class ManagesFrequencies implements ManagesFrequenciesContract { | ||
expression: string; | ||
protected currentTimezone: string; | ||
timezone(timezone: string): this; | ||
protected spliceIntoPosition(position: number, value: string | number): this; | ||
everyMinute(): this; | ||
everyTwoMinutes(): this; | ||
everyThreeMinutes(): this; | ||
everyFourMinutes(): this; | ||
everyFiveMinutes(): this; | ||
everyTenMinutes(): this; | ||
everyFifteenMinutes(): this; | ||
everyThirtyMinutes(): this; | ||
hourly(): this; | ||
hourlyAt(offset: number | number[]): this; | ||
everyTwoHours(): this; | ||
everyThreeHours(): this; | ||
everyFourHours(): this; | ||
everySixHours(): this; | ||
daily(): this; | ||
dailyAt(time: Time): this; | ||
twiceDaily(): this; | ||
twiceDailyAt(first: number, second: number, offset?: number): this; | ||
weekly(): this; | ||
weeklyOn(daysOfWeek: number | number[] | string, time: Time): this; | ||
monthly(): this; | ||
monthlyOn(dayOfMonth: number, time?: Time): this; | ||
twiceMonthly(first?: number, second?: number, time?: Time): this; | ||
lastDayOfMonth(time?: Time): this; | ||
quarterly(): this; | ||
yearly(): this; | ||
yearlyOn(month: number, dayOfMonth?: string | number, time?: Time): this; | ||
days(days: number | number[] | string): this; | ||
weekdays(): this; | ||
weekends(): this; | ||
sundays(): this; | ||
mondays(): this; | ||
tuesdays(): this; | ||
wednesdays(): this; | ||
thursdays(): this; | ||
fridays(): this; | ||
saturdays(): this; | ||
cron(expression: string): this; | ||
} |
Oops, something went wrong.