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

@accedo/accedo-one

v4.0.2

Published

The official Accedo One SDK for Node.js and browsers (previously known as AppGrid)

Readme

Accedo One SDK for Node.js and browsers npm

   _                    _           ___
  /_\   ___ ___ ___  __| | ___     /___\_ __   ___
 //_\\ / __/ __/ _ \/ _` |/ _ \   //  // '_ \ / _ \
/  _  \ (_| (_|  __/ (_| | (_) | / \_//| | | |  __/
\_/ \_/\___\___\___|\__,_|\___/  \___/ |_| |_|\___|

Summary

This is the official Accedo One SDK for Node.js and browsers, previously known as the AppGrid JS SDK. While Accedo One exposes a set of friendly REST APIs, this SDK is intended to provide a smoother experience when coding in JS. It also encourages the use of best practices (for example: reusing the same sessionId for a client, but different clients for different devices).

We follow semantic versioning. Check the change log for a listing of changes and new features per version.

Supported browsers

This project is written in ES2015 and the browsers build is transpiled to ES5. All modern browsers are supported (Firefox, Chrome, Opera, Safari, Edge, their mobile versions and declinations).

⚠️ If you need to support IE 11 (or other legacy browsers), make sure to load polyfills for the ES2015 features before loading this library. You can either use one such as what babel offers, or just the strict necessary: an ES6 Promise polyfill and another one for Object.assign. Refer to example-browser.html for an example on using such a polyfill.

We use CommonJS modules rather than ES6 modules, so no compilation step is needed on Node.

Supported Node.js versions

This should work from version 4, but we test on, and recommend to use the latest LTS version of Node (currently Node 6, soon Node 8).

Features

The default factory exposed by this SDK allows creating a client instance tied to a device id and an application key. It provides these features :

  • easy access to Accedo One APIs
  • automatic deviceId creation when none was provided
  • automatic session creation when none was provided (lazy - only when needed)
  • automatic session re-creation when the previous one has expired (lazy)
  • ensures only one session will be created at a time, even if concurrent Accedo One requests are made
  • specific to Detect:
  • ensures concurrent calls to get the log level will result in one network call at most
  • caches the log level for 3 minutes
  • on browsers, individual logs are only sent when necessary (i.e. when the log's level is equal or higher than the current level set on the app), and automatically grouped then sent as a batch (see the sendLog doc)

:information_source: For Node, an express-compatible middleware is also available as a separate package. You should really consider using it if possible, as it makes things even easier and provides extra features.

Documentation

Refer to the API docs for this SDK.

You may also want to refer to the Accedo One Rest API documentation that this SDK uses behind the scenes. Accedo One-specific terminology is defined there.

Installation

npm install --save @accedo/accedo-one (or, for yarn users: yarn add @accedo/accedo-one)

Then you can use the default export to get a factory:

const accedoOne = require('@accedo/accedo-one')

Or, using the ES6 module syntax:

import accedoOne from '@accedo/accedo-one'

Examples

Below are a few examples, refer to example-node.js for more of them that you can run yourself (clone this repo then execute node example-node.js).

Create an Accedo One client instance

:point_right: On Node, we recommend you use the Express middleware instead, as it makes it easier and enforces some more best practices.

An instance of an Accedo One client must be obtained. It's created with the factory exported as the default export in this library, with parameters for the specific client you need.

// This is an Accedo One client factory - name it "factory", "accedoOne", or anything else.
// If you use this library on a browser through a <script> tag, `accedoOne` is a global variable
// so you do not need to import or require anything.
import accedoOne from '@accedo/accedo-one';

const client = accedoOne({
  appKey: 'YOUR_ACCEDO_ONE_APPLICATION_KEY',
  deviceId: 'A_DEVICE_ID',
  // if there is already a session for this appKey/deviceId tuple, provide it
  sessionKey: 'AN_EXISTING_SESSION_KEY',
  // gid can be passed as well, it will be used for all API calls
  gid: 'SOME_GROUP_ID',
  // turn on the SDK debug logs by adding a log function such as this one
  // log(...args) { console.log(...args); },
});

You should create a new client for every device that needs to access the Accedo One APIs.

:warning: DO NOT reuse a single client, in your Node server, to relay requests from various consumers.

If you are triggering some Accedo One API calls in response to server requests, you should create a new client every time, by using the factory and reusing your application key and the consumer's deviceId (typically you would persist a consumer deviceId via the cookies, or as a request parameter in your server APIs - unless the device lets you use some unique ID like a MAC address).

:bulb: Note again, the middleware (see above) does that work for you, so it's best to use it whenever possible.

Create a new Accedo One session

The client.createSession lets you manually create a new session, that will be stored for reuse onto this client instance. As any API call that needs a session will trigger this method implicitly when needed, you will normally not need to ever do this yourself.

Get all Accedo One Metadata associated with your application key

client.getAllMetadata()
  .then(metadata => {
    console.log('Successfully requested all metadata from Accedo One', metadata);
  })
  .catch(error => {
    // TODO handle error
  });

SDK development

  • Clone/fork this repo
  • Run yarn (you should have yarn installed globally)
  • Code !
  • Before pushing, remember to:
    • update the UMD bundle (yarn run build)
    • add tests and check they all pass (yarn test)
    • add examples and check they all work (node example-node.js)
    • document any public API with JSDoc comments and generate the new doc (yarn run doc)

Testing code in the browser

If necessary, update the UMD bundle as noted above, then open the example-browser.html file in your browser.

On an OSX shell, you can use open example-browser.html. To serve it on a local web server, you can use php -S localhost:9000 or python -m SimpleHTTPServer 9000 if you have php or python binaries available on your path. Other options include Apache, Nginx, and Node-based servers such as http-server or static-server.

The sample includes the polyfills necessary for older browsers like IE11 (those that do not support ES6).

More information & Links

Unit Tests

Jest unit tests have been written to cover all of the exported APIs from this module. Tests will we called by running npm test or yarn test.

License

See the LICENSE file for license rights and limitations (Apache 2.0)