npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

amphora-schedule

v2.0.1

Published

A scheduling module for Amphora

Downloads

475

Readme

Amphora Schedule

A scheduling module for Amphora to schedule pages/layouts to so those can be published at a future date.

Installation & Usage

First install the module:

$ npm install -s amphora-schedule

Then pass the module into Amphora as an item for the plugins array property.

amphora({
  ...
  plugins: [
    ...
    require('amphora-schedule'),
    ...
  ],
  ...
})

At startup time the module will create the db schema and table needed to work properly (a new schedule schema with pages -- each with their own id and data), this is done using the amphora database adapter. After the database is ready, this module will act as any other amphora plugin that sets up a route -- domain/_schedule in this case -- and handles requests made to that route.

What makes this plugin "special" is its ability to frequently "poll" the database looking for scheduled pages (in the new table) in order to publish them. This logic is implemented in the schedule.js file inside the services folder. There will be an interval delay that determines the "polling" frequency.

The main reason this was made as an external module and not part of amphora's core, is to make it an optional feature that any amphora instance could use.

A GET request to the domain/_schedule endpoint will return an array of objects that look like the following:

  {
    "id": "domain/_schedule/id",
    "data": {
      "at": 1671541200000,
      "publish": "domain/_pages/clbr3qz9600000iddckqyk2oj"
  }

To schedule a page a POST request has to be made to the _schedule route with a payload object that looks like the following:

  {
    "at": 1671645600050,
    "publish": "domain/_pages/id"
  }

Where at is the desired time in the future when the page should be published, and publish is the URI of the page that would be published.

To unschedule a page a DELETE request has to be made to the same route with the id as part of the URL. It will like the following:

  domain/_schedule/id

The id is generated when the page is scheduled.

Environmental Variables

CLAY_SCHEDULING_ENABLED: Must be set to true in order to enable amphora-schedule to check, between intervals, for publishing instances. If this is not set or equal to false, it will still save the schedule pages but will not publish them.

License

MIT