Skip to content

Commit

Permalink
chore(release): 1.5.0 [skip ci]
Browse files Browse the repository at this point in the history
# [1.5.0](v1.4.0...v1.5.0) (2023-12-28)

### Features

* semantic-release ([79d9e4a](79d9e4a))
  • Loading branch information
semantic-release-bot committed Dec 28, 2023
1 parent 79d9e4a commit 7949ffa
Show file tree
Hide file tree
Showing 32 changed files with 1,041 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build/adonis-typings/container.d.ts
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.
2 changes: 2 additions & 0 deletions build/adonis-typings/index.d.ts
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 added build/adonis-typings/index.js
Empty file.
62 changes: 62 additions & 0 deletions build/adonis-typings/scheduler.d.ts
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.
19 changes: 19 additions & 0 deletions build/bin/japa_types.d.ts
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> {
}
}
3 changes: 3 additions & 0 deletions build/bin/japa_types.js
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");
1 change: 1 addition & 0 deletions build/bin/test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'reflect-metadata';
66 changes: 66 additions & 0 deletions build/bin/test.js
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)();
2 changes: 2 additions & 0 deletions build/commands/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: string[];
export default _default;
3 changes: 3 additions & 0 deletions build/commands/index.js
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'];
10 changes: 10 additions & 0 deletions build/commands/scheduler_work.d.ts
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>;
}
15 changes: 15 additions & 0 deletions build/commands/scheduler_work.js
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;
1 change: 1 addition & 0 deletions build/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The package has been configured successfully.
16 changes: 16 additions & 0 deletions build/providers/scheduler_provider.d.ts
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;
}
15 changes: 15 additions & 0 deletions build/providers/scheduler_provider.js
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;
46 changes: 46 additions & 0 deletions build/src/manages_frequencies.d.ts
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;
}
Loading

0 comments on commit 7949ffa

Please sign in to comment.