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

@encodeagent/platform-helper-metadata

v1.2510.1131245

Published

Comprehensive TypeScript metadata library for the EncodeAgent platform with metadata utilities, query builders, migrations, and more

Readme

@encodeagent/platform-helper-util

Comprehensive TypeScript utility library for the EncodeAgent platform with AI services, authentication, file handling, web content processing, and more.

Installation

npm install @encodeagent/platform-helper-util

Requirements

  • Node.js >20.0.0 <23.0.0
  • TypeScript 5.2+

Usage

Core Utilities

import { 
  isNonEmptyString, 
  isGuid, 
  isEmail, 
  formatString, 
  getTimestamp,
  numberWithCommas,
  readableFileSize 
} from '@encodeagent/platform-helper-util';

isNonEmptyString('hello'); // true
isGuid('550e8400-e29b-41d4-a716-446655440000'); // true
isEmail('[email protected]'); // true
formatString('Hello {0}!', 'World'); // 'Hello World!'
numberWithCommas(1234567); // '1,234,567'
readableFileSize(1024); // '1.00 KB'

Authentication & Authorization

import { 
  checkRecordPrivilege, 
  hasRole, 
  isOwner, 
  checkPrivileges 
} from '@encodeagent/platform-helper-util';

const hasAccess = checkRecordPrivilege(record, context, 'read');
const userHasRole = hasRole(user, 'admin');
const isRecordOwner = isOwner(record, userId);

AI Services & LLM Integration

import { 
  getAIService, 
  getLLMRequest, 
  getAIContext,
  calculateCost 
} from '@encodeagent/platform-helper-util';

const aiService = getAIService('gpt-4');
const llmRequest = getLLMRequest(prompt, parameters);
const context = getAIContext(userId, organizationId);
const cost = calculateCost({ service: aiService, inputQuantity: 1000 });

File & Content Processing

import { 
  getFileType, 
  getContentType,
  processWebPage,
  markdownToHtml,
  htmlToMarkdown,
  cleanHtml 
} from '@encodeagent/platform-helper-util';

const fileType = getFileType('document.pdf');
const contentType = getContentType('.json');
const webContent = await processWebPage(url, settings);
const html = markdownToHtml('# Hello World');
const markdown = htmlToMarkdown('<h1>Hello World</h1>');

Color Utilities

import { 
  getColor, 
  hexToRgb, 
  isValidHex,
  BLUE,
  RED 
} from '@encodeagent/platform-helper-util';

const color = getColor('primary');
const rgb = hexToRgb('#FF0000'); // { r: 255, g: 0, b: 0 }
const isValid = isValidHex('#FF0000'); // true

Web & URL Utilities

import { 
  isValidUrl, 
  getBaseDomain, 
  fixUrl,
  getWebQueryValue 
} from '@encodeagent/platform-helper-util';

const isValid = isValidUrl('https://example.com');
const domain = getBaseDomain('https://sub.example.com/path');
const fixedUrl = fixUrl('example.com'); // 'https://example.com'

Record & Data Management

import { 
  getRecordDisplay, 
  convertRecordForCreate,
  getContextFromRecord,
  applyRecordSlug 
} from '@encodeagent/platform-helper-util';

const display = getRecordDisplay(record, entity);
const createRecord = convertRecordForCreate(record);
const context = getContextFromRecord(record);

Tree Operations

import { 
  getTreeItem, 
  insertTreeItem, 
  removeTreeItem,
  updateTreeItem 
} from '@encodeagent/platform-helper-util';

const item = getTreeItem(tree, itemId);
const newTree = insertTreeItem(tree, parentId, newItem);
const updatedTree = removeTreeItem(tree, itemId);

Caching

import { 
  getCache, 
  setCache, 
  removeCache 
} from '@encodeagent/platform-helper-util';

const cached = getCache('myKey');
setCache('myKey', data, 60); // Cache for 60 minutes
removeCache('myKey');

ID Generation

import { 
  newGuid, 
  newShortId, 
  slug 
} from '@encodeagent/platform-helper-util';

const guid = newGuid(); // '550e8400-e29b-41d4-a716-446655440000'
const shortId = newShortId(); // 'rJUWbIHOWM'
const urlSlug = slug('Hello World!'); // 'hello-world'

Type Definitions

The library exports comprehensive TypeScript types:

import type { 
  IContext, 
  IError, 
  IService, 
  ICost,
  TKeyOwner,
  TToken,
  TLLMMessage 
} from '@encodeagent/platform-helper-util';

Constants

Access platform constants and configurations:

import { 
  GUID_EMPTY,
  DEFAULT_PASSWORD_RULE,
  COUNTRIES,
  LANGUAGES,
  ERROR_HTTP_LIST 
} from '@encodeagent/platform-helper-util';

Development

Setup

npm install

Build

npm run build
npm run build:watch

Test

npm test
npm run test:watch

Lint

npm run lint
npm run lint:fix

Clean

npm run clean

Publishing

Automated Publishing (Recommended)

sh publish.sh

This script will:

  1. Clean previous builds
  2. Run tests
  3. Build the project
  4. Update version automatically
  5. Publish to npm

Manual Publishing

npm run prepublishOnly
npm publish

Scripts

  • build - Compile TypeScript to JavaScript
  • build:watch - Watch mode compilation
  • clean - Remove dist directory
  • test - Run Jest tests
  • test:watch - Run tests in watch mode
  • lint - Run ESLint
  • lint:fix - Fix ESLint issues
  • prepublishOnly - Clean and build before publishing

License

UNLICENSED - PrimeObjects Software Inc. All rights reserved.