Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@miniflare/scheduler

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@miniflare/scheduler - npm Package Compare versions

Comparing version 2.0.0-rc.3 to 2.0.0-rc.4

20

dist/src/index.d.ts

@@ -10,10 +10,3 @@ import { CorePluginSignatures } from '@miniflare/core';

export declare interface CronScheduler {
setInterval(cron: Cron, task: () => any): ITimerHandle;
clearTimeoutOrInterval(handle: ITimerHandle): void;
}
declare const kReload: unique symbol;
export declare class Scheduler<Plugins extends SchedulerPluginSignatures> {
export declare class CronScheduler<Plugins extends SchedulerPluginSignatures> {
private readonly mf;

@@ -23,3 +16,3 @@ private readonly cronScheduler;

private scheduledHandles?;
constructor(mf: MiniflareCore<Plugins>, cronScheduler?: Promise<CronScheduler>);
constructor(mf: MiniflareCore<Plugins>, cronScheduler?: Promise<CronSchedulerImpl>);
[kReload]: (event: ReloadEvent<Plugins>) => Promise<void>;

@@ -29,2 +22,9 @@ dispose(): Promise<void>;

export declare interface CronSchedulerImpl {
setInterval(cron: Cron, task: () => any): ITimerHandle;
clearTimeoutOrInterval(handle: ITimerHandle): void;
}
declare const kReload: unique symbol;
export declare class SchedulerError extends MiniflareError<SchedulerErrorCode> {

@@ -51,4 +51,4 @@ }

export declare function startScheduler<Plugins extends SchedulerPluginSignatures>(mf: MiniflareCore<Plugins>, cronScheduler?: Promise<CronScheduler>): Promise<Scheduler<Plugins>>;
export declare function startScheduler<Plugins extends SchedulerPluginSignatures>(mf: MiniflareCore<Plugins>, cronScheduler?: Promise<CronSchedulerImpl>): Promise<CronScheduler<Plugins>>;
export { }

@@ -0,3 +1,24 @@

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __decorateClass = (decorators, target, key, kind) => {

@@ -14,17 +35,15 @@ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;

// packages/scheduler/src/index.ts
import {
ReloadEvent,
logResponse
} from "@miniflare/core";
__export(exports, {
CronScheduler: () => CronScheduler,
SchedulerError: () => SchedulerError,
SchedulerPlugin: () => SchedulerPlugin,
startScheduler: () => startScheduler
});
var import_core = __toModule(require("@miniflare/core"));
// packages/scheduler/src/plugin.ts
import {
MiniflareError,
Option,
OptionType,
Plugin
} from "@miniflare/shared";
var SchedulerError = class extends MiniflareError {
var import_shared = __toModule(require("@miniflare/shared"));
var SchedulerError = class extends import_shared.MiniflareError {
};
var SchedulerPlugin = class extends Plugin {
var SchedulerPlugin = class extends import_shared.Plugin {
crons;

@@ -44,3 +63,5 @@ #validatedCrons = [];

}
const { parseCronExpression } = await import("cron-schedule");
const {
parseCronExpression
} = require("cron-schedule");
const validatedCrons = Array(this.crons.length);

@@ -61,4 +82,4 @@ for (let i = 0; i < this.crons.length; i++) {

__decorateClass([
Option({
type: OptionType.ARRAY,
(0, import_shared.Option)({
type: import_shared.OptionType.ARRAY,
alias: "t",

@@ -73,4 +94,4 @@ description: "CRON expression for triggering scheduled events",

var kReload = Symbol("kReload");
var Scheduler = class {
constructor(mf, cronScheduler = import("cron-schedule").then((module) => module.TimerBasedCronScheduler)) {
var CronScheduler = class {
constructor(mf, cronScheduler = Promise.resolve().then(() => require("cron-schedule").TimerBasedCronScheduler)) {
this.mf = mf;

@@ -96,3 +117,3 @@ this.cronScheduler = cronScheduler;

const waitUntil = this.mf.dispatchScheduled(void 0, spec);
await logResponse(this.mf.log, {
await (0, import_core.logResponse)(this.mf.log, {
start,

@@ -113,4 +134,4 @@ method: "SCHD",

async function startScheduler(mf, cronScheduler) {
const scheduler = new Scheduler(mf, cronScheduler);
const reloadEvent = new ReloadEvent("reload", {
const scheduler = new CronScheduler(mf, cronScheduler);
const reloadEvent = new import_core.ReloadEvent("reload", {
plugins: await mf.getPlugins(),

@@ -122,8 +143,9 @@ initial: false

}
export {
Scheduler,
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CronScheduler,
SchedulerError,
SchedulerPlugin,
startScheduler
};
});
//# sourceMappingURL=index.js.map
{
"name": "@miniflare/scheduler",
"version": "2.0.0-rc.3",
"version": "2.0.0-rc.4",
"description": "Scheduler module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers",

@@ -14,4 +14,3 @@ "keywords": [

"license": "MIT",
"type": "module",
"exports": "./dist/src/index.js",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",

@@ -40,9 +39,9 @@ "files": [

"dependencies": {
"@miniflare/core": "2.0.0-rc.3",
"@miniflare/shared": "2.0.0-rc.3",
"@miniflare/core": "2.0.0-rc.4",
"@miniflare/shared": "2.0.0-rc.4",
"cron-schedule": "^3.0.4"
},
"devDependencies": {
"@miniflare/shared-test": "2.0.0-rc.3"
"@miniflare/shared-test": "2.0.0-rc.4"
}
}

@@ -5,3 +5,3 @@ # `@miniflare/scheduler`

fun, full-featured, fully-local simulator for Cloudflare Workers. See
[⏰ Scheduled Events](https://miniflare.dev/scheduled.html) for more details.
[⏰ Scheduled Events](https://v2.miniflare.dev/core/scheduled) for more details.

@@ -8,0 +8,0 @@ ## Example

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc