Valence

Gulp-Mean-Seed is packaged with an Angular.js data layer known as Valence.

Here are some points about Valence:

  1. Provides configurable caching
  2. Promotes data reuse.
  3. Promotes clean abstractions betweenn data and business requirements.
  4. available through dependency injection.
  5. Cleanly aggregate data from multiple sources.
  6. Promotes thin controllers.

The below diagram illustrates the structure and flow of a Valence data layer.

  1. Typically there is one model per view.
  2. Models can have many resources, and even share them.
  3. Resources save their data to a centralized cache.
  4. Resources will first evaluate data in the cache, if the cache is empty or is expired, it will consult the remote provider.
  5. Everything is purely reference driven, preserving memory to ensure a natural congruence with Angular's digest cycle.
  6. Robust API at every layer.

Seed Data

This page aims to show you how awesome data can be when working with Valence.

If you want to see the mock seed data. Please run 'gulp mongo.seed' from './platform'. It will seed your DB with a few fake users.

Users:

    • {{user.name}}
    • {{user.age}}

Sample resource API - Examine - 'Valence' in the console.

  • Can attach a resource to a model.
  • Removes a resource from the model *and* unbinds the data.
  • Binds resource data to the model. If resource is unattached, it will attach it,
  • Unbinds resource data from the model. Does not detach resource.

Caching

In valence, all resource data is cached by default. You can circumvent the cache be setting the expiry to 0.

Open the network panel and click on the button below