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

@de-openfabtwin/bcf-client

v0.1.0

Published

JavaScript client library for BCF REST API 3.0

Downloads

56

Readme

bcf-client-js

A JavaScript client library for the BCF REST API 3.0 (BIM Collaboration Format).
Implements the full buildingSMART BCF API spec — authentication, projects, topics, comments, viewpoints, documents, and more.


Requirements

  • Node.js >= 18.0.0
  • ES Modules ("type": "module" in your package.json)
  • A running BCF server that supports authorization_code_grant

Installation

npm install @de-openfabtwin/bcf-client

Quick Start

import { FoundationClient } from '@openfabtwin-bim/bcf-client/auth';
import { BcfClient }        from '@openfabtwin-bim/bcf-client';

// 1. Create the auth client
const foundation = new FoundationClient(
  'https://your-bcf-server.example.com/',
  'your-client-id',
  'your-client-secret'
);

// 2. Create the BCF client and resolve the API version
const bcf = new BcfClient(foundation, '3.0');
await bcf.resolveVersion(); // triggers browser login on first use

// 3. Use the sub-clients
const projects = await bcf.project.getAllProjects();
console.log(projects);

resolveVersion() must be called once before using any sub-client.
It discovers the server's BCF base URL, triggers OAuth login if needed, and wires all clients.


Architecture

BcfClient
├── FoundationClient      ← OAuth 2.0 auth (authorization_code_grant)
│   └── OAuthReceiver     ← Temporary localhost:8081 server to catch OAuth redirect
├── BcfHttpClient         ← Thin HTTP layer (GET, POST, PUT, DELETE, binary)
└── Sub-clients (wired after resolveVersion())
    ├── project           → ProjectClient
    ├── topic             → TopicClient
    ├── comment           → CommentClient
    ├── viewpoint         → ViewpointClient
    ├── document          → DocumentClient
    ├── documentReference → DocumentReferenceClient
    ├── event             → EventClient
    ├── file              → FileClient
    ├── relatedTopic      → RelatedTopicClient
    └── snippet           → SnippetClient

Authentication

Authentication is handled by FoundationClient. It implements the BCF Foundation API auth flow:

  1. GET /foundation/1.1/auth — discovers OAuth endpoints
  2. Opens browser for login (authorization_code_grant)
  3. Catches the redirect code via a temporary local server on localhost:8081
  4. Exchanges code for access + refresh tokens
  5. Auto-refreshes tokens on expiry — transparent to callers
const foundation = new FoundationClient(baseUrl, clientId, clientSecret);
const token = await foundation.getAccessToken(); // login triggered automatically

Project Structure

src/
├── BcfClient.js              ← Main entry point
├── BcfHttpClient.js          ← HTTP layer (JSON + binary)
├── BcfException.js           ← Error class
├── queryBuilder.js           ← OData query string builder ($filter, $orderby, etc.)
├── auth/
│   ├── FoundationClient.js   ← OAuth 2.0 auth flow
│   └── OauthReceiver.js      ← Local redirect server (localhost:8081)
└── client/
    ├── ProjectClient.js
    ├── TopicClient.js
    ├── CommentClient.js
    ├── ViewpointClient.js
    ├── DocumentClient.js
    ├── DocumentReferenceClient.js
    ├── EventClient.js
    ├── FileClient.js
    ├── RelatedTopicClient.js
    └── SnippetClient.js

License

MIT

Acknowledgment

This work is funded by the German Federal Ministry for Economic Affairs and Climate Action (BMWK) through the central innovation programme for small and medium-sized enterprises (ZIM-program), with funding provided under grant number 16KN106902.