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

fluorine-orchestra

v3.3.2

Published

A data orchestration layer for Fluorine

Downloads

85

Readme

Fluorine Orchestra

About

Keeping a local copy of your database collections can be troublesome. Rewriting code to handle CRUD operations, normalize incoming data and resolve dependencies is not something to do every day.

Orchestra implements a data orchestration layer for Fluorine to easily solve your collection worries.

  • Handles data as collections with Immutable's OrderedMaps
  • Simple API to describe stores and dependencies
  • Automatically resolves dependencies
  • Easy observing of missing items inside collections

Quick Intro

This is just a short example that quickly presents most features of Orchestra. It is of course not representetive for how to use it in real React projects.

import { createDispatcher } from 'fluorine-lib'
import { createOrchestra, createStore } from 'fluorine-orchestra'

const dispatcher = createDispatcher()

// Create stores for your collections
const PostStore = createStore('posts')
const UserStore = createStore('users')
  .pre(user => { // Modify items before they're stored
    const firstName = user.get('firstName');
    const lastName = user.get('lastName');
    return user.set('name', firstName + ' ' + lastName);
  })
  .dependsOn( // Define dependencies between collections
    'posts',
    user => user.get('postIds', new List()), // Specify how to get the postId(s)
    (user, posts) => user.set('posts', posts) // Specify how to set posts on users
  )
  .post(user => { // Modify the dependency-resolved items before they reach your views
    const postSize = user.get('posts').size;
    return user.set('postSize', postSize);
  });

// Assemble the orchestra of stores
const orchestra = createOrchestra(PostStore, UserStore);

const {
  posts, // It spits out Fluorine stores (Observables) emitting your resolved state
  users
} = orchestra.reduce(dispatcher);

// Inserting items?
dispatcher.next(UserStore.insert({
  id: 'abc-1',
  firstName: 'John',
  lastName: 'Meyer'
}));

// Get Creative: Fetch missing ids that Orchestra can't find in its collections
const subscription = PostStore
  .observeMissing()
  .map(ids => fetchPosts(ids))
  .subscribe(dispatcher.next);

You can easily create stores for your different collections and define how to transform them when they're being fed from the server into your stores. Also define which dependencies they have and how to resolve them. The Orchestra will combine all stores and resolve the dependencies.

The result are normal Fluorine stores (Observables). You can pass these on, as you'd like.

If some items are missing, their ids will be reported on the respective stores. You can use this to fetch missing data on demand.

Method to create actions to insert, remove, filter or update items on the store are already present and can immediately be used.

Frequently Asked Questions

When is Fluorine Orchestra right for me?

It is a perfect fit for your project if:

  • you already use or want to use Fluorine as your state and side effect manager
  • your data collections are big and have complex dependencies
  • you quickly want to store collections and develop rapidly
  • you like using Immutable.js