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

@cclabsnz/sf-core

v0.3.0

Published

Shared platform layer for CloudCounsel Salesforce sf plugins — API clients, org context, event log pull, report shell, and versioned IR schemas.

Readme

@cclabsnz/sf-core

Shared platform layer for the CloudCounsel Salesforce sf plugins.

The read-only API surface, platform-behaviour knowledge, report shell and versioned IR contracts behind @cclabsnz/sf-audit (security auditing) and @cclabsnz/sf-orgintel (org intelligence).

What's in it

| Area | What it provides | | --- | --- | | API clients | SoqlClient, ToolingClient, RestClient, MetadataClient — read-only wrappers over a @salesforce/core Connection | | Platform behaviour | FlowRepository, ApexRepository, isSalesforceId, describeSalesforceError, mapWithConcurrency | | IR contracts | Typed interfaces plus JSON Schemas for coupling-graph, landscape-manifest and process-graph | | Report shell | Branding resolution and embedded webfonts for self-contained HTML reports | | Test invariants | Static guards that fail a build on org writes or network egress |

Why the platform layer exists

Salesforce has behaviours that are easy to get wrong and expensive to discover, and each one here was learned by running against a real org:

  • FlowDefinitionView is a standard object — querying it through Tooling answers "sObject type 'FlowDefinitionView' is not supported."
  • Flow.Metadata is Tooling, and is strictly one row per query — an Id IN (...) batch is rejected outright, so bulk reads need bounded concurrency.
  • ApexClass has a SymbolTable column; ApexTrigger does not — selecting it fails the entire query.
  • Managed-package flows return a durable name (ns__Flow-1) where an Id is expected; feeding that to a WHERE clause yields invalid ID field.
  • expr0 is Salesforce's own aggregate alias and cannot be requested — an explicit COUNT(Id) expr0 is rejected with "alias is reserved: expr0".

Encoding these once means a consumer cannot rediscover them by shipping the bug first. The contract tests are the point: their mocks refuse exactly as an org refuses, so a query sent to the wrong API or asking for a non-existent column fails the build rather than degrading silently in production.

Install

pnpm add @cclabsnz/sf-core

Usage

import { FlowRepository, ApexRepository, mapWithConcurrency } from '@cclabsnz/sf-core';

const flows = new FlowRepository(soqlClient, toolingClient);
const definitions = await flows.listDefinitions();
const { versions, managedSkipped } = FlowRepository.selectVersions(definitions);

// Flow.Metadata is one row per query — concurrency is the only lever.
await mapWithConcurrency(versions, 8, async (v) => {
  const metadata = await flows.fetchMetadata(v.id);
  // ...
});

JSON Schemas are reachable as a subpath export:

import { loadSchema, schemaPath } from '@cclabsnz/sf-core';
const couplingGraphSchema = loadSchema('coupling-graph');

Guarantees

Both are enforced as tests, not asserted in prose — run them yourself with pnpm test:

  • Read-only. No jsforce mutation API, HTTP write verb, or bulk/composite write path may appear in source. Every org request is a SOQL query, a REST GET, or a Metadata read.
  • Local-first. No third-party HTTP client, telemetry endpoint, LLM call, websocket, or remote asset in a generated report. The only network destination is the org the operator authenticated against.

Versioning

The IR contracts (coupling-graph, landscape-manifest, process-graph) carry an explicit version field and are the stable product surface. A breaking change to their shape is a version bump on the contract, not a silent edit.

Licence

Apache-2.0 — see LICENSE. Bundled fonts are SIL OFL 1.1; see src/assets/fonts/NOTICE.md.