fxoi

0.1.1 • Public • Published

FxOi!

Package status Build status License

Live train announcements for Firefox Accounts.

You what?

Even though I'm a fully paid-up member of the dev team, a lot of the time I forget where we are in the Firefox Accounts deployment train cycle. Sometimes, this makes me look like a dick.

To work round this (fixing the root cause seems unrealistic), I've created a dashboard to be beamed onto every flat surface in my immediate vicinity. This project is the node module that powers said dashboard.

How do I install it?

Honestly, it's not meant for you.

But if you insist:

npm i fxoi --save

How do I use it?

How do I load the library?

Use require:

const fxoi = require('fxoi')

How do I register for announcements?

Call fxoi(callback, options), where callback is a function that will be invoked whenever the deployed versions have changed:

const cancel = fxoi(status => view.refresh(status))

Here, status will be an object that looks like this:

{
  train: 81,           // The current FxA train number.
  time: 1488582720000, // Estimated deployment time, in milliseconds since the epoch, UTC.
  diffs: [             // Details of which servers have changed since the last announcement.
    { name: 'auth', current: { train: 81, patch: 2 }, previous: { train: 81, patch: 1 } }
  ],
  patches: [           // Details of which servers have been tagged with a patch level.
    { name: 'auth', train: 81, patch: 2 }
  ],
  versions: [          // Full version information for each deployed server.
    { name: 'content', train: 81, patch: 0, tag: 'v1.81.0', repo: 'mozilla/fxa-content-server' },
    { name: 'auth', train: 81, patch: 2, tag: 'v1.81.2', repo: 'mozilla/fxa-auth-server-private' },
    { name: 'profile', train: 79, patch: 0, tag: 'v0.79.0', repo: 'mozilla/fxa-profile-server' },
    { name: 'oauth', train: 81, patch: 0, tag: 'v1.81.0', repo: 'mozilla/fxa-oauth-server' }
  ]
}

After registering once, your callback function will be called whenever updated version data is discovered on the production servers.

How do I cancel future announcements?

Just call the returned cancel function, like so:

cancel()

What options can I specify?

The options object looks like this:

{
  rate: 1800000,       // Frequency, in milliseconds, that the servers will be checked. Defaults to 1 hour.
  immediate: false,    // Indicates whether an immediate callback is desired. Defaults to `true`.
  userAgent: 'Foo/1.0' // The user agent string used to identify requests to the server.
  status: {            // Initial status information used to determine whether the data has changed.
    train: 81,
    time: 1488582720000,
    versions: [
      { train: 81, patch: 0 },
      { train: 81, patch: 2 },
      { train: 79, patch: 0 },
      { train: 81, patch: 0 }
    ]
  }
}

Is there a change log?

Yes.

How do I set up the dev environment?

To install the dependencies:

npm i

To run the unit tests:

npm t

To run a functional test against the production servers:

npm run tf

To lint the code:

npm run lint

What license is it released under?

MIT.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.12latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.12
0.1.00

Package Sidebar

Install

npm i fxoi

Weekly Downloads

2

Version

0.1.1

License

MIT

Last publish

Collaborators

  • philbooth