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

@pinecards/client

v0.4.0

Published

Pine's client library provides an easy way to interact with the Pine API in a type-safe manner. For a complete overview of the documentation, please visit [**docs.pinecards.app**](https://docs.pinecards.app/) instead.

Readme

Pine's client library provides an easy way to interact with the Pine API in a type-safe manner. For a complete overview of the documentation, please visit docs.pinecards.app instead.

Installation

This library is only intended for use on the frontend. Use the @pinecards/server library to communicate with Pine on the backend.

Pine's client library provides an easy way to interact with the Pine API from within a frontend extension.

To get started, you'll need to install the library in your project with your preferred package manager:

npm install @pinecards/client

The PineSDKClient uses IPC messages under the hood to securely communicate with Pine. To create the connection, it's thus necessary to call connectSDKClient as soon as possible in the global scope of your application:

import { connectSDKClient } from "@pinecards/client";

const client = connectSDKClient({ debug: false });

The cards, decks, and fields namespaces follow a similar signature to server library, while namespaces like routes , storage, and context are available exclusively through the client library.

Cards

The cards namespace provides methods for interacting with card data.

Data can be queried using read and list, as expanded on in queries.

const card = await client.cards.read({ where: { id: "..." } });
const { data: cards } = await client.cards.list({ where: { limit: 100 } });

Data can be mutated using create, update, and delete, as expanded on in mutations.

const createdCard = await client.cards.create({
  data: { title: [], body: [] }
});

const updatedCard = await client.cards.update({
  where: { id: "..." },
  data: { title: [], body: [] }
});

await client.cards.delete({ where: { id: "..." } });

Data can be subscribed to by using the on handler:

await client.cards.on("cardsChange", event => {
  const cards = event.data;
});

The above methods will throw an error if you do not have the required card permissions.

The cards namespace also supports the following sub-namespaces:

  • associations: create, update, and delete card associations (comments, etc...).
  • connections: create, update, and delete card connections (links, backlinks, etc...).
  • embeddings: read and list local AI card embeddings.

Decks

The decks namespace provides methods for interacting with deck data.

Data can be queried using read and list, as expanded on in queries.

const deck = await client.decks.read({ where: { id: "..." } });
const { data: decks } = await client.decks.list({ where: { limit: 100 } });

Data can be mutated using create, update, and delete, as expanded on in mutations.

const createdDeck = await client.decks.create({
  data: { title: [], description: [] }
});

const updatedDeck = await client.decks.update({
  where: { id: "..." },
  data: { title: [], description: [] }
});

await client.decks.delete({ where: { id: "..." } });

Data can be subscribed to by using the on handler:

await client.decks.on("decksChange", event => {
  const decks = event.data;
});

The above methods will throw an error if you do not have the required deck permissions.

The decks namespace also supports the following sub-namespaces:

  • associations: create, update, and delete deck associations (comments, etc...).
  • connections: create, update, and delete deck connections (links, backlinks, etc...).
  • embeddings: read and list local AI deck embeddings.

Fields

The fields namespace provides methods for interacting with a workspace's configured preferences. This will return an object/dictionary data structure with the appropriate field type matching the corresponding value type:

| Field type | Value type | | ---------- | ---------- | | text | string | | number | number | | switch | boolean | | date | string |

Fields that haven't been assigned a value will return a null value.

You can retrieve the value of a configured number field as follows:

const fields = await client.fields.list({ where: {} });
const value = fields.data.find(field => field.id === "ID_FROM_UI")

Routes

The routes namespace allows you to listen to route changes, as well as navigate users to specific routes.

// push to a route
await client.routes.push({
  path: "/dates/:dateId",
  params: { dateId: new Date().toISOString() }
});

// replace existing route
await client.routes.replace({
  path: "/dates/:dateId",
  params: { dateId: new Date().toISOString() }
});

// fetch current route
const route = await client.routes.get();

// listen to route changes
await client.routes.on("routeChange", event => {
  switch (event.data.path) {
    case "/dates/:dateId":
      // do something
      break;
  }
});

Storage

The storage namespace provides methods for storing data in IndexedDB.

The data that is stored in IndexedDB is not encrypted. It's thus not recommended that any sensitive data be stored here. Instead, it should be used to persist in the application state between sessions or store other forms of non-sensitive data.

To minimize security risks, both the key and value arguments must be strings. It's recommended to serialize your inputs to strings (e.g. using JSON.stringify()) if you wish to store more complex objects:

// set the following key-value pair in storage
await client.storage.set({
  key: "key",
  value: JSON.stringify({ foo: "bar" })
});

// retrieve the value associated with the key from storage
const result = await client.storage.get({ key: "key" });
if (result) JSON.parse(result);

// remove the key from storage
await client.storage.remove({ key: "key" });

// clear the storage completely
await client.storage.clear();

Context

The context namespace provides utilities for accessing information such as theme data or manipulating the optional badge that appears next to the integration icon in the sidebar.

const theme = await client.context.getTheme();

await client.context.on("themeChange", event => {
  const theme = event.data;
});

await client.context.setBadge({ count: 5 });