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 🙏

© 2025 – Pkg Stats / Ryan Hefner

blast-graph-angular2

v0.3.1

Published

![Alt text](./resources/images/b-circle-trans-100.png) **with** ![Alt text](./resources/images/angular.png)

Readme

Blast-Graph-Angular2

Alt text with Alt text

Overview

This is a websocket client for Angular2 projects for connection to a Blast Server. It is an extension of blast-angular2 and provides additional commands (functions) relevant to the blast-graph-module. It is worth reading about blast-graph-module before proceeding.

Building npm

NPM Commands

| Command|Description | |---|---| | npm run lint | runs lint | npm run compile | compiles tyepscript | npm run minify | minifies the output javascript | npm run bundle | includes any 3rd party libraries | npm run bundle-minify | minifies the bundle | npm run prepublish | runs all above commands | npm run dev | lint,compile and npm link | npm run build | runs everything

To publish to npm

npm publish

Note: Although the main objective for this project is a 'npm module' it also serves as the build for our native javascript library.

Getting Started

    npm install blast-graph-angular2

to build ..
npm run packagr
npm publish dist

// connect
const blastService: BlastService = new BlastService('ws://127.0.0.1:8081/blast');

// create an initialized variable for the local copy
let myBooks:any[] = [];

// attach local copy to server's data model, collection 'books'. 
// When server data changes then local copy will automatically be updated.

blastService.attach("books",myBooks);

Usage

The following commands (functions) are an extension to those already available in blast-angular2.

Commands

Command summary:

| Command|Description | |---|---| | add | Add an entity to the server's data graph | update | Update an entity in the server's data graph | remove | Remove an entity from the server's data graph | attach | Attach local variable to a collection in the server's data graph and automatically update when there are server side changes | detach | Associated local copy will no longer receive updates from the server | detachAll | All attachments are removed - no local copies will be mainatined | getAttachments | Returns a list of current attachments with the server | fetch | Get a snapshot of a collection or entity from the server's data graph | fetchRoot | Get a snapshot of all the data in the server's data graph | getSchema | Get the schema of the server's data graph

Add

Add new entity to the server's data graph.

Function

add(collection: string, entity: any): Promise<any>

Example

blastService.add("books",{bookId:1,name:'Hello World'}).then((response) => {
       console.log('that worked!');
   }).catch((error) => {
       console.log('oops! that failed');
   });

Update

Update an entity in the server's data graph.

Function

update(key: string, entity: any): Promise<any>

Example

blastService.update("books/id:1",{bookId:1,name:'New World'}).then((response) => {
       console.log('that worked!');
   }).catch((error) => {
       console.log('oops! that failed');
   });

Remove

Remove an entity in the server's data graph.

Function

remove(key: string): Promise<any>

Example

blastService.remove("books/id:1").then((response) => {
       console.log('book removed');
   }).catch((error) => {
       console.log('oops! that failed');
   });

Attach

Attach a client side variable to a server side collection. Whenever there is a change to the data on the server (including any of its children) then automatically updated my local client version.

For the key please read blast-graph-module for a better overview.

Function

    attach(key: string, data: any, parameters?: PathParameters, modificationWatcher?: ModificationWatcher): Promise<any> {

Example

let allBooks:any[] = [];
let oneBook:any = {};

blastService.attach('books',allBooks);

blastService.attach('books/id:1',oneBook);

Additional Parameters

PathParameters Apply filtering to the 'attach' or 'fetch' command.

| Paramter|Description | |---|---| | includeChildren | Default is true, but when false any children collections are not returned. | fields | An array of field names - the returned data will only include these fields, and for 'attach' the local copy will only be updated if any of these fields change.

Modifcation Watcher

A callback can be associated with the 'attach' - so, when there are changes to the local copy, the 'added','changed' or 'removed' methods of ModicationWatcher will be called.

Detach

Remove an 'attachment' - the local copy will no longer be maintained.

Function

detach(attachmentId: string)

Example

blastService.detach(attachmentId)

DetachAll

Remove all attachments - local copies will no longer be maintained.

Function

detachAll()

Example

detachAll()

getAttachments

Returns a list of current attachments.

Function

getAttachments()

Example

getAttachments()

Fetch

Fetch a collection or record from the server, this is a snapshot of the current data held by the server. The resultant value will not get updated if there is a change to the server data.

Function

fetch(key: string, parameters?: PathParameters) 

Example

let allBooks:any[] = blastService.fetch("books")
let oneBooks:any = blastService.fetch("books/id:1")

Fetch Root

Fetches the entire data graph from the server. Great in development! but strongly advise that this is not used in production - the resultant amount of data could be huge!

Function

fetchRoot();

Example

let myData:any = blastService.fetchRoot();

MyData would look like the following:

 {
    "books": []
    "authors": []
 }

getSchema

Fetches the schema of the server's data graph.

Function

getSchema()

Example

blastService.getSchema();