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

@team_seki/extension-sdk

v0.0.9

Published

## How to implement an extension

Downloads

5

Readme

Models and utilities for extensions

How to implement an extension

Install the SDK

npm install @team_seki/extension-sdk

The extension is just a web project. When an extension is loaded, it should call ExtensionSDK.notifyLoaded to notify Seki that it is ready.

import { IExtensionContextData, ExtensionSDK } from '@team_seki/extension-sdk'

export default class App extends React.Component<IProps, PageState> {

  extensionId = 'awesome'

  override componentDidMount() {
    // notify seki that the extension is ready
    new ExtensionSDK(this.extensionId).notifyLoaded()
  }
  ...
}

Then Seki will send an instance of IExtensionContextData to the extension iframe using window.postMessage(). The extension must register an event listener to handle the event.

window.addEventListener('message', (e: MessageEvent<IExtensionContextData>) => {
  if (this.extensionId == e.data.extensionId) { // the message is addressed to this extension
    if (!e.data.productName || !e.data.authToken) {
      this.setState({ view: 'INVALID_PARAMS' });
      return;
    }

    this.setState({ view: 'READY', context: e.data})
  }
})

The IExtensionContextData object contains the workspace. You can used it to access the product name, the projects, cloud components, etc.

const extensionContextData = e.data

const productName = extensionContextData.productName

const theWorkspace = extensionContextData.workspace
const theProjects = theWorkspace.projects
const theCloudComponents = theWorkspace.cloud.components

Use the Seki SDK to access other functionality

import { SekiSDK } from '@team_seki/extension-sdk'

...

const seki = new SekiSDK(secrets.SEKI_API_URL, extensionContextData.authToken)

const repositoryInfo = seki.getProductRepository(extensionContextData.productName)
const cloudComponentSettings = seki.getCloudComponentSettings(extensionContextData.productName, 'staging', 'mongodb', 'default')

See also https://cencosud.atlassian.net/wiki/spaces/MPE/pages/35717167/Dev+Portal+Bridge+para+Extenciones#SDK-de-Extensiones

Examples

  • https://github.com/Cencosud-X/seki-redis-extension
  • https://github.com/Cencosud-X/seki-monitoring-extension

Building

Run nx build extension-sdk to build the library.

Running unit tests

Run nx test extension-sdk to execute the unit tests via Jest.