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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ouroboros/mouth

v2.2.0

Published

Package to handle the Mouth service.

Readme

@ouroboros/mouth

npm version Custom License

Shared javascript code for interacting with the mouth service created by Ouroboros Coding Inc.

See Releases for changes from release to release.

Installation

Install with npm

foo@bar:~$ npm install @ouroboros/mouth

RESTlike Documentation

If you're here to connect to a backend using mouth2_oc and you're already familiar with how to connect to body_oc, services in JS/TS projects, then you're probably just looking for the request docs. See the full documentation on the individual RESTlike requests in mouth and what they return.

React + Material UI

If you're connecting to mouth via a React / MUI framework, you might want to checkout @ouroboros/mouth-mui which provides several Components for creating Locales and Templates.

Using mouth

Mouth uses @ouroboros/body and relies on @ouroboros/brain for sign in / session access, so some small setup is required for mouth to work as expected.

import body from '@ouroboros/body';
import { errors } from '@ouroboros/brain';

// Set the domain for all requests
body.domain('https://rest.mydomain.com');

// Do we have a session?
const session = localStorage.getItem('session');
if(session) {
  body.session(session);
}

// Sign in
body.create('brain', 'signin', {
  email: '[email protected]',
  passwd: '********'
}).then(res => {

  // If we failed
  if(res.error) {
    if(res.error.code === errors.SIGNIN_FAILED) {
      // notify failed signin
    } else if(res.error.code === errors.BAD_PORTAL) {
      // notify no access to portal
    } else {
      // notify.... uh oh
    }
    return;
  }

  // Did we get something back?
  if(res.data) {

    // Store session so we can use it on a reload
    localStorage.setItem('session', res.data.session);

    // Let body know we have a session
    body.session(res.data.session);

    // Get user
    body.read('brain', 'user').then(res => {
      if(res.error) {
        handleError(res.error);
      } else {
        storeUser(res.data);
      }
    });
  }
});

Now that we have connected to the REST services, and signed in to get a user, we can make requests to the Mouth service

import mouth, { errors } from '@ouroboros/mouth';

const locale = {
	_id: 'en-UK',
	name: 'English / United Kingdom'
};
mouth.create('locale', locale).then(res => {
	if(res.error) {
    if(res.error.code === errors.body.DATA_FIELDS) {
      // error.msg is a list of errors related to the data sent
    } else if(res.error.code === errors.body.DB_DUPLICATE) {
      // en-UK already exists
    } else {
      // handle other error, check docs
    }
    return
  }

  if(res.data) {
		// Locale en-UK added
	}
});

Errors

Mouth provides several error codes unique to the mouth2_oc service.

TEMPLATE_CONTENT_ERROR, ATTACHMENT_STRUCTURE, ATTACHMENT_DECODE, SMTP_ERROR

They can be accessed through errors from @ouroboros/mouth.

import { errors } from '@ouroboros/mouth';
console.log(errors.TEMPLATE_CONTENT_ERROR) // prints 1300

Additionally, if you need to access lower level body_oc errors, you can do so via the body variable.

import { errors } from '@ouroboros/mouth';
console.log(errors.body.DATA_FIELDS) // prints 1001