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

@api-client/amf-store

v0.3.6

Published

A library to work with the AMF parser and model in a web worker. Exposes a set of APIs to manipulate the API model.

Downloads

76

Readme

AMF service for web apps

This is a work in progress.

Published on NPM

Tests and publishing

The AMF service for web provides an access to the graph model generated from an API specification and parsed by the AMF parser. This service allows to read and manipulate API meta data. Can be used to render API documentation or to create / edit existing APIs.

The entire work is performed in a web worker. This is essential especially when parsing APIs to eliminate a possibility of freezing the main thread.

Status

  • [x] Importing an API from graph model (previously parsed by AMF parser)
  • [x] Creating a new web API
  • [ ] Creating a new Async API
  • [ ] Reading API model (about 70% done)
  • [ ] Manipulating API model (CUD) (about 5% done)
  • [ ] Generating API spec file
  • [ ] Importing API from source
  • [ ] Dom event based access to the meta store

Usage

Be aware: this is a work in progress. Everything at this point is a subject to change without prior notification or breaking changes announcements.

Installation

npm install --save @api-client/amf-store

Using the store in a web browser

To use the store directly in a web browser use the AmfStoreService class. The constructor accepts two argument: the events target (EventTarget instance) and optional configuration for the web worker creation and the AMF bundle location.

By default the web worker location is expected to be in the workers/AmfWorker.js relative to the library location. You can set any the location by setting the workerLocation on the init object.

import { AmfStoreService } from '@api-client/amf-store';

const store = new AmfStoreService(window, {
  workerLocation: './node_modules/@api-client/amf-store/workers/AmfWorker.js',
});

Mind that the worker imports scripts from the main library so it also requires bundling when used.

Alternatively, you can set the createWebWorker property on the init object to manually create the worker instance.

import { AmfStoreService } from '@api-client/amf-store';

const store = new AmfStoreService(window, {
  createWebWorker: () => {
    return new Worker('./node_modules/@api-client/amf-store/workers/AmfWorker.js', {
      type: 'module',
    });
  },
});

Finally, the worker imports the AMF bundle located in the root of this library. By default it expects the library to be located at /amf-bundle.js, which is the root of your web server. You can set a custom location by setting the amfLocation property on the init object.

import { AmfStoreService } from '@api-client/amf-store';

const store = new AmfStoreService(window, {
  amfLocation: '/static/amf-bundle.js',
});

Development

git clone https://github.com/@api-client/amf-store
cd amf-store
npm install

Running the demo locally

npm start

Running the tests

npm test

License