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

vcon-library

v0.1.0

Published

JavaScript library for creating and managing vCons (Virtual Conversations)

Readme

vcon-library

A JavaScript library for creating and managing vCons (Virtual Conversations).

Installation

npm install vcon-library

Usage

Creating a new vCon

import { Vcon, Party, Dialog } from "vcon-library";

// Create a new vCon
const vcon = Vcon.buildNew();

// Add parties
const party1 = new Party({
  tel: "+1234567890",
  name: "John Doe",
});
const party2 = new Party({
  tel: "+0987654321",
  name: "Jane Smith",
});

vcon.addParty(party1);
vcon.addParty(party2);

// Add a dialog
const dialog = new Dialog({
  type: "text/plain",
  start: new Date(),
  parties: [0, 1], // References to party indices
  body: "Hello, this is a conversation!",
  mimetype: "text/plain",
});

vcon.addDialog(dialog);

// Convert to JSON
const json = vcon.toJson();

Loading from JSON

import { Vcon } from "vcon-library";

const jsonString = "..."; // Your vCon JSON string
const vcon = Vcon.buildFromJson(jsonString);

Working with Attachments

import { Vcon, Attachment } from "vcon-library";

const vcon = Vcon.buildNew();

// Add an attachment
const attachment = vcon.addAttachment(
  "application/pdf",
  "base64EncodedContent",
  "base64"
);

// Find an attachment by type
const pdfAttachment = vcon.findAttachmentByType("application/pdf");

Working with Analysis

import { Vcon } from "vcon-library";

const vcon = Vcon.buildNew();

// Add analysis
vcon.addAnalysis({
  type: "sentiment",
  dialog: 0, // Reference to dialog index
  vendor: "sentiment-analyzer",
  body: {
    score: 0.8,
    label: "positive",
  },
});

// Find analysis by type
const sentimentAnalysis = vcon.findAnalysisByType("sentiment");

Working with Tags

import { Vcon } from "vcon-library";

const vcon = Vcon.buildNew();

// Add a tag
vcon.addTag("category", "support");

// Get a tag
const category = vcon.getTag("category");

API Reference

Vcon

The main class for working with vCons.

Methods

  • static buildNew(): Creates a new vCon
  • static buildFromJson(jsonString: string): Creates a vCon from JSON
  • addParty(party: Party): Adds a party to the vCon
  • addDialog(dialog: Dialog): Adds a dialog to the vCon
  • addAttachment(type: string, body: any, encoding?: Encoding): Adds an attachment
  • addAnalysis(params: AnalysisParams): Adds analysis data
  • addTag(tagName: string, tagValue: string): Adds a tag
  • findPartyIndex(by: string, val: string): Finds a party index
  • findDialog(by: string, val: any): Finds a dialog
  • findAttachmentByType(type: string): Finds an attachment by type
  • findAnalysisByType(type: string): Finds analysis by type
  • getTag(tagName: string): Gets a tag value
  • toJson(): Converts the vCon to JSON
  • toDict(): Converts the vCon to a dictionary

Party

Class for representing parties in a vCon.

Properties

  • tel?: string: Telephone number
  • stir?: string: STIR identifier
  • mailto?: string: Email address
  • name?: string: Display name
  • validation?: string: Validation information
  • gmlpos?: string: GML position
  • civicaddress?: CivicAddress: Civic address
  • uuid?: string: UUID
  • role?: string: Role
  • contact_list?: string: Contact list
  • meta?: Record<string, any>: Additional metadata

Dialog

Class for representing dialogs in a vCon.

Properties

  • type: string: Dialog type
  • start: Date: Start time
  • parties: number[]: Party indices
  • originator?: number: Originator party index
  • mimetype?: string: MIME type
  • filename?: string: Filename
  • body?: string: Dialog content
  • encoding?: string: Content encoding
  • url?: string: External URL
  • signature?: string: Digital signature
  • duration?: number: Duration in seconds
  • meta?: Record<string, any>: Additional metadata

Methods

  • addExternalData(url: string, filename: string, mimetype: string): Adds external data
  • addInlineData(body: string, filename: string, mimetype: string): Adds inline data
  • isExternalData(): Checks if dialog has external data
  • isInlineData(): Checks if dialog has inline data
  • isText(): Checks if dialog is text
  • isAudio(): Checks if dialog is audio
  • isVideo(): Checks if dialog is video
  • isEmail(): Checks if dialog is email

Attachment

Class for representing attachments in a vCon.

Properties

  • type: string: Attachment type
  • body: any: Attachment content
  • encoding: Encoding: Content encoding

License

MIT