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

@orcsrvcs/users-api

v0.0.8

Published

API for interfacing with users

Downloads

1

Readme

Inter-app API

There are several ways to communicate between apps, and events is one of them. This API package uses events. The API is designed to be published to an npm registry. Right now it will be published to npmjs.com but will be published to a private registry when the pipeline is ready.

Configuration for coordinating the exposure and reference of remotes between apps are defined in the remote configuration files.

Auto-generated Documentation

Development

The API is built as an npm package and imported into both shell and remote apps. To test changes to API locally before publishing:

  1. cd to app directory level in remote
  2. Run npm run build --workspaces
  3. cd to app directory level in app importing api
  4. Run sudo npm link <path to api directory>
    • If serving app, may need to re-serve
  5. Re-build api with each change but no need to re-link

Publishing

  1. Update 'version' via the major-minor-patch pattern
  2. cd to app directory level
  3. Run npm publish --workspaces --access=public
    • If publishing to npmjs.com, may need an account, be added to the @orcsrvcs organization, and be logged in via npm login

Files

package.json

Replace <app-name> with the name of the app.

index.ts

Shouldn't need to be modified
The entrypoint for when this package is imported. Everything exported in this file is immediately accessible by the developer.

common

Shouldn't need to be modified
Consists of the main class to handle events and all interfaces required to inferface with it. In the future, this may be exported to its own npm package and imported.

app-config.ts

Configuration file to properly expose and reference remotes.

remotes

All remote specific configurations are located within this directory. Each remote should have its own directory.

remotes.ts

One stop shop for referencing all remotes. This is convenient in showing developers which remotes and events are available. When adding new remotes, they need to be added here.

event-schemas.ts

One stop shop for referencing all event interfaces.

remote-config.ts

Configuration file to properly expose and reference remotes, and showing which events are associated with each remote.

events

A remote can contain zero or more events. Each event should have its own file.

event

Everything specific to an event is defined in these files.

  • event name
  • restrictions on how an app can use an event
  • event data structure
  • handling differences in API versions between apps

When updating the data structure, the version handling methods must be updated to properly convert the new structure to older structures. If the new event can't possibly be converted to an older structure, then consider throwing an error or something appropriate.

There is currently nothing to notify the developer the version handler needs to be updated if the structure has changed and API version has been updated, so it's up to the developer to remember to do that. Hopefully something will be implemented in the future.

Handling Duplicate Remotes / Custom Elements

By default, multiple remotes of the same type will all receive the same events from the shell. To ensure events go to only a specific remote, 'multiple = true' or 'eventSuffix != null' must be passed into getShellApi(), then the eventSuffix retrieved from the API and passed to the remote. The eventSuffix must then be passed into getRemoteApi().

  • Remotes can coordinate via URL
  • Custom elements can coordinate via HTML attributes