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

@pinpt/hubspot-helper

v1.0.12

Published

<div align="center"> <img width="500" src=".github/logo.svg" alt="Pinpoint Logo" /> </div>

Downloads

11

Readme

Setup

npm i @pinpt/hubspot-helper

Methods

buildDefinition

(from: ENTITIES, to: ENTITIES) => DEFINITIONS | undefined

Creates a definition based on the entity being mapped FROM and TO. Returns undefined if the mapping given does not exist in Hubspot.

invertDefinition

(definition: DEFINITIONS) => DEFINITIONS

Returns the inversion of a definition. For example, if given DEFINITIONS.CHILD_COMPANY_TO_PARENT_COMPANY, will return DEFINITIONS.PARENT_COMPANY_TO_CHILD_COMPANY.

createAssociation

(from: HSObjectId, to: HSObjectId, definition: DEFINITIONS) => HSAssociation

Creates an association object that can be sent to the Hubspot API to associate one object ID to another.

createTransactionalEmail

(to: string, emailId: string, properties?: HSTransactionalEmailCustomProperties) => HSTransactionalEmail | undefined

Takes an email address, email template ID, and optional properties array and returns an object that can be sent to the Hubspot API to send a transactional email.

objectIdToNumber

(objectId: HSObjectId) => number

Takes in an object ID as a string or integer, and ensures it is converted to a number for hubspot

createDeal

(properties: HSDealCustomProperties, associatedCompanies: HSObjectId[], associatedUsers?: HSObjectId[]) => HSDeal | undefined

Takes in an array of properties, associated companies, and associated users and returns an object that can be send to the Hubspot API to create a deal

updateManyObjects

(ids: HSObjectId[], values: HSCustomProperty[]) => HSUpdateMany[] | undefined

Takes in an array of object IDs to update to the values given. Each object will be updated with the same options array that is passed. Returns undefined if no object IDs or values are passed.

Return Types

HSAssociation

Can be sent to the hubspot API to create associations

{
	fromObjectId: number;
	toObjectId: number;
	category: CATEGORY;
	definitionId: DEFINITIONS;
}

HSDeal

Can be sent to the Hubspot API to create deals

{
	associations: {
		associatedCompanyIds?: number[];
		associatedVids?: number[];
	};
	properties: HSDealCustomProperties;
}

HSTransactionalEmail

Can be sent to the Hubspot API to send a transactional email

{
	emailId: string;
	message: HSTransactionalEmailMessage;
	customProperties?: HSTransactionalEmailCustomProperties;
}

HSTransactionalEmailMessage

{
	to: string;
}

HSCustomProperty

{
	name: string;
	value: string | number;
}

HSTransactionalEmailCustomProperties

HSCustomProperty[]

HSDealCustomProperties

HSCustomProperty[]

HSUpdateMany

Can be sent to the hubspot API to update many objects with the same fields

{
	objectId: number,
	properties: HSCustomProperty[],
}

Hubspot Types

HSObjectId

Object IDs can be input as a string or a number, and the library will handle parsing them to an integer for the Hubspot API if needed.

string | number

CATEGORY

enum CATEGORY {
	HUBSPOT_DEFINED = 'HUBSPOT_DEFINED'
}

ENTITIES

enum ENTITIES {
	// ENTITIES
	CONTACT,
	COMPANY,
	DEAL,
	ENGAGEMENT,
	PARENT_COMPANY,
	CHILD_COMPANY,
	TICKET,
	LINE_ITEM,

	// Special Entities
	ADVISOR,
	BOARD_MEMBER,
	CONTRACTOR,
	MANAGER,
	BUSINESS_OWNER,
	PARTNER,
	RESELLER
}

DEFINITIONS

enum DEFINITIONS {
	// Association Definitions
	CONTACT_TO_COMPANY = 1,
	COMPANY_TO_CONTACT = 2,

	DEAL_TO_CONTACT = 3,
	CONTACT_TO_DEAL = 4,

	DEAL_TO_COMPANY = 5,
	COMPANY_TO_DEAL = 6,

	COMPANY_TO_ENGAGEMENT = 7,
	ENGAGEMENT_TO_COMPANY = 8,

	CONTACT_TO_ENGAGEMENT = 9,
	ENGAGEMENT_TO_CONTACT = 10,

	DEAL_TO_ENGAGEMENT = 11,
	ENGAGEMENT_TO_DEAL = 12,

	PARENT_COMPANY_TO_CHILD_COMPANY = 13,
	CHILD_COMPANY_TO_PARENT_COMPANY = 14,

	CONTACT_TO_TICKET = 15,
	TICKET_TO_CONTACT = 16,

	TICKET_TO_ENGAGEMENT = 17,
	ENGAGEMENT_TO_TICKET = 18,

	DEAL_TO_LINE_ITEM = 19,
	LINE_ITEM_TO_DEAL = 20,

	COMPANY_TO_TICKET = 25,
	TICKET_TO_COMPANY = 26,

	DEAL_TO_TICKET = 27,
	TICKET_TO_DEAL = 28,

	// Special Associations
	ADVISOR_TO_COMPANY = 33,
	COMPANY_TO_ADVISOR = 34,

	BOARD_MEMBER_TO_COMPANY = 35,
	COMPANY_TO_BOARD_MEMBER = 36,

	CONTRACTOR_TO_COMPANY = 37,
	COMPANY_TO_CONTRACTOR = 38,

	MANAGER_TO_COMPANY = 39,
	COMPANY_TO_MANAGER = 40,

	BUSINESS_OWNER_TO_COMPANY = 41,
	COMPANY_TO_BUSINESS_OWNER = 42,

	PARTNER_TO_COMPANY = 43,
	COMPANY_TO_PARTNER = 44,

	RESELLER_TO_COMPANY = 45,
	COMPANY_TO_RESELLER = 46,
}