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

@source-health/bridge

v0.0.4

Published

Official SDK for Source Health iframe plugins.

Downloads

38

Readme

Source Bridge SDK

| :bangbang: | This SDK is still in beta, and may change significantly before its public release. | | :--------: | :--------------------------------------------------------------------------------- |

The Source Bridge library is a required dependency for customer-built 'frame' plugins that run within the main Source Health web UI.

This SDK is written in TypeScript and compiled to ES6.

Getting Started

Getting started with Source Bridge is easy. First, install the package via NPM:

yarn add @source-health/bridge # or npm install @source-health/bridge

Then, import the SourceBridge API:

import { SourceBridge } from '@source-health/bridge'

Subscribe to context updates from the parent window. Note: after rendering for the first time, your application must call SourceBridge.ready() in order to clear the loading state and display the plugin.

await SourceBridge.onContextUpdate(async (context) => {
  // Handle the context, set and render your application
  await doSomeStuff(context.member)

  // Call ready() to clear the loading state for the plugin
  SourceBridge.ready()
})

And, finally, kick off the handshake with the parent window (which will lead to the context callback being run):

await SourceBridge.init()

The SourceBridge client will keep a refreshed application token available. At any point after the initial context update is received (including inside the onContextUpdate callback), you can obtain a valid token by calling:

const { token, expiresAt } = await SourceBridge.currentToken()

These tokens expire within a few minutes. When you need a token (e.g. to inject an Authorization header into a request you are making to your backend), you should call currentToken().

Plugin Developer Documentation

Early access developer documentation for plugin development is available for invited developers and will be be published publicly when the feature is generally available. In the meantime, an example plugin is available at source-health/source-demo-frame-plugin.

Testing

We have some minimal jest unit tests, these can be run with:

yarn test

Because this library is fundamentally about communicating between a parent window and a child window, we also have a browser-based (Playwright) end-to-end test capability using some static html and scripts adapted from the demo plugin. The tests and config for this are under ./e2e, including a separate webpack build with webpack-dev-server for bundling the test code and serving the html.

To run the E2E tests:

yarn e2e