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

@espressif/rainmaker-base-cdf

v2.0.1

Published

The esp-rainmaker base cdf

Readme

ESP RainMaker TypeScript Base — CDF

@espressif/rainmaker-base-cdf is CDF for RainMaker apps. It provides one app-facing contract across adaptor implementations: unified entities, adaptor registration, event-driven operations, and MobX-backed stores coordinated by synchronizers.


Table of Contents


Overview

CDF lets apps integrate multiple adaptors through a single, consistent model:

  • Unified entities (ESPCDFNode, ESPCDFGroup, ESPCDFUser, …) in src/entities — the app contract; apps work with CDF types, not raw adaptor-specific types.
  • Adaptor registry — register and switch implementations via src/registry.ts (AdaptorRegistry, capabilities, active adaptor).
  • Operation events — entities emit typed results through src/utils/OperationEventEmitter.ts; entities do not own long-lived store coupling.
  • Store synchronizerssrc/store/sync applies all observable state updates and cross-store work after operations (user, group, node, scene, schedule, automation).
  • MobX reactivity — stores expose observable entities (userStore, groupStore, nodeStore, sceneStore, scheduleStore, automationStore, subscriptionStore).
  • _raw and property-change sync — adaptors keep the underlying source entity in sync with CDF property changes where needed.

Together, this yields one API to learn, predictable state transitions, and type-safe TypeScript across implementations.


How CDF is structured

| Piece | Role | | -------- | ---- | | Adaptors | Implement ESPSDKAdaptorCore (and feature interfaces); transform source entities into CDF entities and supply operations delegates. | | CDF entities | Thin wrappers: call operations, emit success/failure on OperationEventEmitter; synchronizers apply property updates via stores — entities do not self-mutate app-visible state in the unified pattern. | | Stores | Hold observable maps/lists; expose @action update helpers for synchronizers; typically exclude _raw and operations from deep MobX tracking where appropriate. | | Synchronizers | Subscribe to entity events, map operation payloads to store updates, coordinate multi-store effects, manage attach/detach lifecycle. |


Architecture at a glance

Typical operation path through CDF:

  1. App calls a method on a CDF entity (e.g. group.getNodes(), automation.update(...)).
  2. Entity runs the adaptor operations (underlying implementation call).
  3. Entity emits an operation event (success or failure).
  4. The relevant store synchronizer handles the event and updates stores (@action / observable updates).
  5. MobX propagates changes to the UI.

Installation

npm

npm install @espressif/rainmaker-base-cdf

yarn

yarn add @espressif/rainmaker-base-cdf

pnpm

pnpm add @espressif/rainmaker-base-cdf

Quick Start

1. Register adaptor(s) and initialize CDF

import { AdaptorRegistry, initCDF } from "@espressif/rainmaker-base-cdf";
// import { ESPRMBaseSDKAdaptor } from "<your-adaptor-package>";

const sdkAdaptorRegistry = AdaptorRegistry.getInstance();
sdkAdaptorRegistry.clear();

// Register one or more adaptors that implement ESPSDKAdaptor
// const esprmAdaptor = new ESPRMBaseSDKAdaptor({ ...config });
// sdkAdaptorRegistry.register(esprmAdaptor);
// sdkAdaptorRegistry.setActiveAdaptor(esprmAdaptor._identifier);

const cdf = await initCDF({ sdkAdaptorRegistry });

2. Authenticate through the active adaptor

await cdf.userStore.auth.login({
  username: "[email protected]",
  password: "password",
});

const user = cdf.userStore.user;

3. Fetch groups and nodes using unified entities

For multi-adaptor flows, you can resolve the authorization entity per adaptor. After login, userStore.user is often the right handle:

if (!user) throw new Error("No active user");

await user.getGroups();
const groups = cdf.groupStore.groupsList;

const group = groups[0];
if (group) {
  await group.getNodes();
}

const nodes = cdf.nodeStore.nodesList;

4. Update entities with unified APIs

const automation = cdf.automationStore.getAutomationById("automation-id");
if (automation) {
  await automation.update({ name: "New Automation Name", enabled: true });
}

Core responsibilities

CDF separates concerns so app code stays adaptor-agnostic:

  • Adaptors translate between source types and CDF entities.
  • Entities delegate operations and emit typed events.
  • Synchronizers centralize entity/store updates and cross-store coordination.
  • Stores expose observable entities for reactive UIs.

Resources

License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.