emberjs / data

A lightweight reactive data library for web applications. Designed over composable primitives.
https://api.emberjs.com/ember-data/release
Other
3.03k stars 1.33k forks source link
ember ember-data hacktoberfest javascript

The lightweight reactive data library for JavaScript applications

Build Status Discord Community Server


Wrangle your application's data management with scalable patterns for developer productivity.

Tagged Releases

📖 On This Page

Overview

*Ember*Data is a lightweight reactive data library for JavaScript applications that provides composable primitives for ordering query/mutation/peek flows, managing network and cache, and reducing data for presentation.

🪜 Architecture

*Ember*Data is both resource centric and document centric in it's approach to caching, requesting and presenting data. Your application's configuration and usage drives which is important and when.

The Store is a coordinator. When using a Store you configure what cache to use, how cache data should be presented to the UI, and where it should look for requested data when it is not available in the cache.

This coordination is handled opaquely to the nature of the requests issued and the format of the data being handled. This approach gives applications broad flexibility to configure *EmberData to best suit their needs. This makes Ember*Data a powerful solution for applications regardless of their size and complexity.

*Ember*Data is designed to scale, with a religious focus on performance and asset-size to keep its footprint small but speedy while still being able to handle large complex APIs in huge data-driven applications with no additional code and no added application complexity. It's goal is to prevent applications from writing code to manage data that is difficult to maintain or reason about.

*Ember*Data's power comes not from specific features, data formats, or adherence to specific API specs such as JSON:API trpc or GraphQL, but from solid conventions around requesting and mutating data developed over decades of experience scaling developer productivity.

Basic Installation

Install using your javascript package manager of choice. For instance with pnpm

pnpm add ember-data

ember-data is installed by default for new applications generated with ember-cli. You can check what version is installed by looking in the devDependencies hash of your project's package.json file.

If you have generated a new Ember application using ember-cli but do not wish to use ember-data, remove ember-data from your project's package.json file and run your package manager's install command to update your lockfile.

Advanced Installation

*Ember*Data is organized into primitives that compose together via public APIs.

The packages interop with each other through well defined public API boundaries. The core of the library is the store provided by @ember-data/store, while each of the other libraries plugs into the store when installed. Because these packages interop via fully public APIs, other libraries or applications may provide their own implementations. For instance, ember-m3 is a commonly used presentation and cache implementation suitable for complex resource objects and graphs.

Configuration

Deprecation Stripping

*Ember*Data allows users to opt-in and remove code that exists to support deprecated behaviors.

If your app has resolved all deprecations present in a given version, you may specify that version as your "compatibility" version to remove the code that supported the deprecated behavior from your app.

let app = new EmberApp(defaults, {
  emberData: {
    compatWith: '4.8',
  },
});

randomUUID polyfill

*Ember*Data uses UUID V4 by default to generate identifiers for new data created on the client. Identifier generation is configurable, but we also for convenience will polyfill the necessary feature if your browser support or deployment environment demands it. To activate this polyfill:

let app = new EmberApp(defaults, {
  emberData: {
    polyfillUUID: true
  },
});

removing inspector support in production

If you do not want to ship inspector support in your production application, you can specify that all support for it should be stripped from the build.

let app = new EmberApp(defaults, {
  emberData: {
    includeDataAdapterInProduction: false,
  },
});

Debugging

Many portions of the internals are helpfully instrumented with logging that can be activated at build time. This instrumentation is always removed from production builds or any builds that has not explicitly activated it. To activate it set the appropriate flag to true.

let app = new EmberApp(defaults, {
  emberData: {
    debug: {
      LOG_PAYLOADS: false, // data store received to update cache with
      LOG_OPERATIONS: false, // updates to cache remote state
      LOG_MUTATIONS: false, // updates to cache local state
      LOG_NOTIFICATIONS: false,
      LOG_REQUESTS: false, // log Requests issued via the request manager
      LOG_REQUEST_STATUS: false,
      LOG_IDENTIFIERS: false,
      LOG_GRAPH: false, // relationship storage
      LOG_INSTANCE_CACHE: false, // instance creation/deletion
    },
  },
});

Compatibility

The following table lists EmberData versions alongside information about ember compatibility.

the version of ember-source they were release with (lockstep), as well as the range of versions of ember-source that the project tested against at the point of release.

Status EmberData Lockstep Supported Tested Range
Latest NPM Stable Version 5.3.0 4.8 4.12 5.* 3.28 4.4 4.8 4.12 5.2 5.3 3.28.12
>= 4.*
>= 5.*
LTS NPM Stable Version 4.12.3 4.* 5.* 3.28 4.4 4.8 4.12 5.0 3.28.12
>= 4.*
>= 5.*
Prior LTS NPM Stable Version 4.12.3 4.* 5.* 3.28 4.4 4.8 4.12 5.0 3.28.12
>= 4.*
>= 5.*
unsupported
(prior LTS)
NPM Stable Version 4.8.6 4.* 3.28 4.4 4.8 3.28.12
>= 4.*
unsupported[^1] NPM Stable Version 4.6.0 3.28 4.* 3.28 4.4 4.5 4.6 3.28.12
>= 4.*
unsupported[^1]
(prior LTS)
NPM Stable Version 4.4.6 3.28 4.* 3.28 4.4 3.28.12
>= 4.*

[^1]: This version may receive special long-term patches to assist model-fragments users in creating a migration path onto 5.x and off of ModelFragments

The Big List of Versions

Package Audience LTS-4-12 LTS Stable Beta Canary
ember-data 🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/active-record 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/adapter 🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@warp-drive/build-config 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/codemods 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@warp-drive/diagnostic 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@warp-drive/ember 🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@warp-drive/experiments 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
eslint-plugin-ember-data 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/graph 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canarye Version
@warp-drive/holodeck 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/json-api 🌌🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/legacy-compat 🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/model 🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/request 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/request-utils 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/rest 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@warp-drive/schema 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@warp-drive/schema-record 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/serializer 🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/store 🌌 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version
@ember-data/tracking 🌌🐹 NPM LTS 4.12 Version NPM LTS Version NPM Stable Version NPM Beta Version NPM Canary Version

Contributing

See the Contributing guide for details.

Code of Conduct

Refer to the Code of Conduct for community guidelines and inclusivity.

License

This project is licensed under the MIT License.