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 🙏

© 2026 – Pkg Stats / Ryan Hefner

m3-app-library

v0.3.6

Published

## Install NodeJS

Readme

Prerequisites

Install NodeJS

Use the instructions on this site: https://nodejs.org/

Install Angular CLI

Run the following from the command line:

npm install -g @angular/cli

Getting started

Create Angular project

Run the following from the command line:

ng new my-m3-app

Use routing if you want to. Using SASS with file extension .scss is suggested

Enter the project

Run the following from the command line:

cd my-m3-app

Install m3-app-library

Run the following from the command line:

npm install m3-app-library

Ignore peer dependecy warnings

Import M3 App Library in module

Open file src/app/app.module.ts

Add this line to the imports at the top of the file:

import { M3AppLibraryModule } from 'm3-app-library';

Add M3AppLibraryModule.forRoot() to the imports section, like this:

imports: [
	// ... other modules ...
    M3AppLibraryModule.forRoot(), // <-- add this line
],

The forRoot() method can accept an object overriding the default settings, but this is optional.

Configure proxy

In order to call MI API's in a remote M3 installation from your local development environment, you can use the build-in proxy feature in Angular.

Create a new empty file in the Angular project root:

proxy.conf.json

Enter the following JSON into the file:

{
	"/m3api-rest": {
		"target": "https://your-m3-installation.domain.com:12345",
		"secure": false
	}
}

Substitute the placeholder URL including port with the one of the M3 installation your want to develop against.

Open the file angular.json in your project root. Search for "serve" (including the quotes). This should take you to the right section. Modify the JSON in the following section by adding an entry for "proxyConfig" in the "options" section. Make sure to add a comma at the end of the line above.

"serve": {
  "builder": "@angular-devkit/build-angular:dev-server",
  "options": {
    "browserTarget": "my-m3-app:build",
    "proxyConfig": "proxy.conf.json"
  },
  ...
}

"Serve" the app using the Angular CLI built-in web server

Run the following from the command line:

ng serve

Then open your browser with the following URL:

http://localhost:4200

Inject the MI API Service into your app component

Open the following file:

src/app/app.component.ts

Add the following line to the import section at the top of the file:

import { MIApiService, MIApiResult } from 'm3-app-library';

Add the following line to the AppComponent class, just under the "title" line:

constructor( private mi:MIApiService ){}

Add code to run an MI API when the component is ready

Add a class field called "userInfo" by adding this line just above the constructor line you just added:

userInfo;

Add OnInit to the existing import statement at the top of the file:

import { Component, OnInit } from '@angular/core'; // <-- just add ", OnInit", the rest is there

Add the OnInit interface to the AppComponent definition, like this:

export class AppComponent implements OnInit { // <-- just add "implements OnInit"

Implement the ngOnInit method by adding this code below the constructor:

ngOnInit(){

}

Then add the following example MI call to the ngOnInit method, like this:

ngOnInit(){

	this.mi.executeMI(
		'MNS150MI',
		'GetUserInfo',
		{}
	)
	.then( result => {

		this.userInfo = result.item;

	});
}

Modify the component template to show the result of the MI API call

Open the component template file:

src/app/app.component.html

REMOVE all the contents of this file, and replace it with the following line:

<pre>{{userInfo | json}}</pre>

That line inserts the entire userInfo object into an HTML tag that will "preformat" it rather than printing it on a single line. The " | json" part will convert the object to JSON. This is all good for testing, but not something you usually want to do in a real app.

Add a line to print a single field, like this:

Your name is: {{userInfo.USFN}}.