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

@natec/mef-dev-platform-connector

v16.4.2

Published

Mef.dev platform connector library

Downloads

29

Readme

Mef-Dev-Platform-Connector

The library is designed to write Angular plugins (as Trusted application on the architecture below) and simplify the interaction within the MEF.DEV serverless platform mef.dev.

Architecture platform

Get the right version

| Angular / CLI | @natec/mef-dev-platform-connector | |-|-| | 13 / 13 | 1.0.0 | | 14 / 14 | 14.0.0 | | 15 / 15 | 15.0.0 | | 16 / 16 | 16.0.0 |

General types and classes

static class PlatformHelper

The main class in which the methods of working with the MEF.DEV platform

class MefDevAuthInterceptor

Ensures security headers are added to requests. It is used as an ordinary interceptor. An example is here

class PlatformSseHelper

A service class that takes over part of the logic for working with SSE. Can be used for cases where only work with SSE is required.

General methods

The library's features are located by the static class PlatformHelper. Its main methods are given in the table below:

|Name|Return type|Description| |-|-|-| | PluginDataSync | UiProfileViewModel | Return plugin data synchronous if data will previously downloaded (PlatformHelper.loadPlatformOptions() or PlatformHelper.setOptions(...)) | | getPluginData() | Observable <UiProfileViewModel> | Return plugin data asynchronous. After successfully loading, data stored(session mode). Initiates loading of plugin data if no previusly loaded. | | setOptions(options: GetInfoSpecificOptions) | Observable <UiProfileViewModel> | This method used for setup data for running plugin on local machine(debug mode). Initiates loading of plugin data. Example and best practice on this demo | | loadPlatformOptions() | Observable<UiProfileViewModel> | Load and return plugin data asynchronous if plugin in production mode(work under platform). After successfully loading, store plugin data. For development mode use PlatformHelper.setOptions(...) | | getAssetUrl () | string | Return the asset path. In debug mode(on local machine) is 'assets'. But after uploading plugin in platform this path change | | updatePluginsRoutes(routes: Routes) | Routes | Update plugin components routes. After upload on platform path is changed. Its method help platform resolve plugin routes. Required to usage, code example | | getSseStream() | Observable<any> | Emit object from plugin SSE stream. | | sendSseStream(data: any) | Observable<any> | Send any object to plugin SSE stream. |

Specific methods(Use for creating own secure interceptor or other stuff)

|Name|Return type|Description| |-|-|-| | setAuthHeaders(request: HttpRequest | any, bearerToken: string | undefined = undefined) | HttpRequest<any> | Used for manual adding security headers for request. | | refreshPlatformAccessToken() | Observable<string> | Used for manual initiates refresh platform token. Token expire in few minutes. 455 request status signaled about token expiration. |

Depricated methods list:

|Name|Return type|Description| |-|-|-| | getPluginLocalData() | PluginLocalData | undefined | Return plugin data (old interface). Works only in production mode | | _getPlatformIHttpService() | IHttpService | undefined | Return platform instance of IHttpService (old interface). Works only in production mode |

Scripts

There are two main scripts available: mef-dev-publish and generate-version-file. To run them, use the following command: npm explore @natec/mef-dev-platform-connector -- npm run {script} [argsName=argValue]

generate-version-file

This script creates a version.js file containing a unique identifier for any plugin version. It is required for publishing on the mef.dev platform.

Example: npm explore @natec/mef-dev-platform-connector -- npm run generate-version-file

mef-dev-publish

This script builds, generates the version.js file, and publishes the plugin to the mef.dev platform from the CLI, without any manipulations on the site interface.

Example: `npm explore @natec/mef-dev-platform-connector -- npm run mef-dev-publish debug=true

Argument List

| Argument | Description | |-|-| | pluginBuildCommand | npm script what start build plugin process, default: build:plugin | | apiUrl | platform API web address, default: https://sandbox.mef.dev | | bauth | Basic credentials for publish, format NAME:PASS | | alias | Alias of plugin (optional) | | updateTenantVersion | Update tenant plugin version after upload, default: true| | updateConfiguration | Update plugin configuration after upload, default: false | | debug | Log expanded information, default: false |

Environment file

You can declare any arguments in environment.ts. Note that CLI arguments take priority.

// /src/environments/environment.ts
import { PLUGIN_VERSION } from './version';

export const environment = {
  production: false,
  version: PLUGIN_VERSION.version,
  alias: 'test',
  bauth: 'NAME:PASS',
  apiUrl: 'https://api.mef.dev'
};

metadata.json file

At the root of the project (near the angular.json file), you need to create a metadata.json file. This file will be automatically applied for publication and stores the data required for publication

// /metadata.json
{
  "name": "basic-request-demo",
  "serviceType": "APIUI",
  "description": "basic-request-demo",
  "dependencies": [],
  "config":{
    "routesUI":[
      {
          "lang":"en",
          "routerLink":"plugin-information",
          "label":"plugin-information"
      }
    ]
  },
  "externalUrl": null,
  "configuration": "{ \"someProp\": \"some value\" }"
}