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

@memberjunction/core

v2.13.4

Published

MemberJunction: Core Library including Metadata, Application, Entity Retrieval and Manipulation, and Utilities

Downloads

2,739

Readme

@memberjunction/core

The @memberjunction/core library provides a comprehensive interface for accessing and managing metadata within MemberJunction, along with facilities for working with entities, applications, and various other aspects central to the MemberJunction ecosystem. This library primarily exports a Metadata class which acts as the gateway to many functionalities.

Installation

npm install @memberjunction/core

```markdown
## Usage

### Importing the Library

```javascript
import { Metadata } from '@memberjunction/core';

Working with the Metadata Class

The Metadata class is a crucial part of this library, providing access to a wide array of metadata, instantiating derived classes of BaseEntity for record access and manipulation, and more.

Instantiating the Metadata Class

const md = new Metadata();

Refreshing Cached Metadata

await md.Refresh();

Getting Applications, Entities, and Other Info

const applications = md.Applications;
const entities = md.Entities;
const currentUser = md.CurrentUser;
// ... and so on for other properties

Helper Functions

// Get Entity ID from name
const entityId = md.EntityIDFromName('EntityName');

// Get Entity name from ID
const entityName = md.EntityNameFromID(1);

// ... and other helper functions as defined in the class

Working with Datasets

// Example: Getting a dataset by name
const dataset = await md.GetDatasetByName('DatasetName');

This is a brief overview of how to interact with the Metadata class. The methods and properties provided by the Metadata class serve as a bridge to access and manage data in a structured and coherent manner within the MemberJunction ecosystem.

RunView and RunViewParams

The @memberjunction/core library also provides a mechanism for running either a stored or dynamic view through the RunView class. The parameters for running these views are specified through the RunViewParams type.

Importing Necessary Classes and Types

import { RunView, RunViewParams } from '@memberjunction/core';

Using RunViewParams

RunViewParams is a type that helps in specifying the parameters required to run a view. The fields in RunViewParams allow you to specify whether you want to run a stored or dynamic view, and provide additional filters, sorting, and other options. Here's an example of how you might create a RunViewParams object:

const params: RunViewParams = {
    ViewName: 'MyView',
    ExtraFilter: 'Age > 25',
    OrderBy: 'LastName ASC',
    Fields: ['FirstName', 'LastName'],
    UserSearchString: 'Smith'
    // ... other optional properties as needed
};

Using the RunView Class

The RunView class provides a method to run a view based on the provided parameters.

Instantiating the RunView Class

const rv = new RunView();

Running a View

const result = await rv.RunView(params);

In this example, params is an object of type RunViewParams which contains the information necessary to run the view. The RunView method will return a Promise<RunViewResult> which will contain the result of running the view.