ember-data
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/ember-data package

5.3.9 • Public • Published

EmberData EmberData

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.

  • ⚡️ Committed to Best-In-Class Performance
  • 🌲 Focused on being as svelte as possible
  • 🚀 SSR Ready
  • 🔜 Typescript Support
  • 🐹 Built with ♥️ by Ember
  • ⚛️ Supports any API: GraphQL JSON:API REST tRPC ...bespoke or a mix

Tagged Releases

  • NPM Canary Version
  • NPM Beta Version
  • NPM Stable Version
  • NPM LTS Version
  • NPM LTS 4.12 Version

📖 On This Page

Overview

EmberData 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

EmberData 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 suite their needs. This makes EmberData a powerful solution for applications regardless of their size and complexity.

EmberData 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.

EmberData'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

EmberData is organized into primitives that compose together via public APIs.

  • @ember-data/request provides managed fetch via its RequestManager and can be used without any other parts of EmberData.
  • @ember-data/store is the "core" of EmberData and handles coordination between the RequestManager, the Cache, and Presentation Concerns.
  • @ember-data/tracking is currently required when using the core and provides tracking primitives for change notification of Tracked properties.
  • @ember-data/json-api is a resource cache for JSON:API structured data. It integrates with the store via the hook createCache
  • @ember-data/model is a presentation layer, it integrates with the store via the hooks instantiateRecord and teardownRecord.
  • @ember-data/debug provides (optional) debugging support for the ember-inspector.

Some EmberData APIs are older than others, and these still interop via well-defined public API boundaries but are no longer the ideal approach.

  • @ember-data/legacy-compat provides support for older paradigms that are being phased out
  • @ember-data/adapter provides various network API integrations for APIS built over specific REST or JSON:API conventions. It integrates with the Store via store.adapterFor, and with the request pipeline via the LegacyNetworkHandler available via @ember-data/legacy-compat which utilizes the Minimum Adapter Interface.
  • @ember-data/serializer pairs with @ember-data/adapter and the LegacyNetworkHandler to normalize and serialize data to and from an API format into the JSON:API format understood by @ember-data/json-api.

And finally:

  • ember-data is a "meta" package which bundles all of these together for convenience

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

EmberData 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

EmberData 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
    },
  },
});

License

This project is licensed under the MIT License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.28.1313,084lts-3-28
4.12.87,981lts-4-12
5.3.95,082latest
4.8.82,423lts-4-8
5.4.0-beta.122,386beta
2.18.51,527release-2-18
3.11.5852release-3-11
3.0.4519release-3-0
4.4.2441lts-4-4
5.4.0-alpha.113164canary
3.1.2137release-3-1
4.6.6124release-4-6
3.13.386release-3-13
3.3.246release-3-3
2.16.436release-2-16
2.17.122release-2-17
3.2.219release-3-2
2.15.418release-1-15
5.3.25lts
3.13.3-alpha.01experimental

Version History

VersionDownloads (Last 7 Days)Published
5.3.95,082
5.4.0-beta.122,386
5.4.0-alpha.113164
5.4.0-alpha.1126
5.4.0-alpha.1117
5.4.0-alpha.1107
5.4.0-alpha.1095
5.4.0-alpha.1081
5.4.0-alpha.1074
5.4.0-alpha.1061
5.4.0-alpha.1054
4.6.6124
5.4.0-alpha.1045
5.4.0-alpha.1031
5.4.0-alpha.1024
5.4.0-alpha.1014
5.4.0-alpha.1004
5.4.0-alpha.991
5.4.0-alpha.9829
5.4.0-alpha.974
5.4.0-alpha.944
5.4.0-alpha.934
5.4.0-alpha.924
5.3.85,023
5.4.0-beta.1128
5.4.0-alpha.914
5.3.76
5.4.0-beta.104
5.4.0-alpha.904
5.3.66
5.4.0-beta.94
5.4.0-alpha.894
5.3.568
5.4.0-beta.81
5.4.0-alpha.884
5.4.0-alpha.871
5.4.0-alpha.861
5.3.421
5.4.0-beta.71
5.4.0-alpha.851
5.4.0-alpha.841
5.4.0-alpha.831
5.4.0-alpha.821
5.4.0-alpha.811
5.4.0-alpha.801
5.4.0-alpha.791
5.4.0-beta.61
5.4.0-alpha.784
5.4.0-alpha.771
5.4.0-alpha.761
5.4.0-beta.51
5.4.0-alpha.751
5.4.0-alpha.741
5.4.0-alpha.731
5.4.0-alpha.721
5.4.0-alpha.712
5.4.0-alpha.701
5.4.0-alpha.641
5.4.0-alpha.631
4.6.5661
4.12.87,981
5.4.0-alpha.611
5.4.0-alpha.601
5.4.0-alpha.591
5.4.0-alpha.581
5.4.0-alpha.571
5.4.0-alpha.561
5.4.0-alpha.551
5.4.0-alpha.541
5.4.0-alpha.531
5.4.0-alpha.521
5.4.0-alpha.511
5.4.0-alpha.501
5.4.0-alpha.491
5.4.0-alpha.481
5.4.0-alpha.471
5.4.0-alpha.461
4.12.7634
5.4.0-alpha.451
4.12.61
5.4.0-alpha.441
5.4.0-alpha.431
5.4.0-alpha.411
5.4.0-alpha.354
5.4.0-alpha.344
5.4.0-alpha.334
5.4.0-alpha.324
5.4.0-alpha.314
5.4.0-alpha.301
5.4.0-alpha.291
5.3.31,940
5.4.0-beta.41
5.4.0-alpha.281
5.4.0-alpha.271
5.3.25
5.4.0-beta.31
5.4.0-alpha.261
5.3.1103
5.4.0-beta.21
5.4.0-alpha.231
5.4.0-alpha.221
5.4.0-alpha.211
5.4.0-alpha.201
5.4.0-alpha.191
5.4.0-alpha.181
5.4.0-alpha.171
4.12.5549
5.5.0-alpha.121
4.12.4492
4.4.32,899
5.5.0-alpha.116
5.5.0-alpha.101
5.5.0-alpha.91
5.5.0-alpha.81
5.5.0-alpha.71
5.5.0-alpha.62
5.5.0-alpha.51
5.4.0-beta.16
5.5.0-alpha.41
5.5.0-alpha.36
5.5.0-alpha.26
5.5.0-alpha.16
5.4.0-beta.01
5.5.0-alpha.01
5.3.01,296
5.3.0-beta.51
5.4.0-alpha.161
5.3.0-beta.41
5.4.0-alpha.151
5.4.0-alpha.141
5.4.0-alpha.131
5.4.0-alpha.126
5.4.0-alpha.116
5.3.0-beta.36
5.4.0-alpha.106
5.4.0-alpha.96
5.4.0-alpha.81
5.3.0-beta.21
5.4.0-alpha.71
5.3.0-beta.11
5.4.0-alpha.61
5.4.0-alpha.51
5.4.0-alpha.41
5.4.0-alpha.31
5.4.0-alpha.21
5.4.0-alpha.11
5.3.0-beta.01
5.4.0-alpha.01
5.2.028
5.1.227
5.3.0-alpha.151
5.3.0-alpha.141
5.3.0-alpha.131
5.3.0-alpha.121
5.3.0-alpha.111
4.4.2441
5.3.0-alpha.101
5.3.0-alpha.91
5.3.0-alpha.81
5.3.0-alpha.76
5.3.0-alpha.66
5.3.0-alpha.56
4.12.3532
5.3.0-alpha.46
5.3.0-alpha.31
5.1.1143
4.12.2232
5.3.0-alpha.21
5.3.0-alpha.11
5.3.0-alpha.01
5.2.0-beta.01
5.1.033
5.1.0-beta.11
5.0.120
4.12.14
5.2.0-alpha.51
5.2.0-alpha.41
5.2.0-alpha.31
5.2.0-alpha.21
5.2.0-alpha.11
5.1.0-beta.01
5.2.0-alpha.01
5.0.04
5.0.0-beta.21
5.1.0-alpha.151
5.1.0-alpha.141
5.1.0-alpha.131
5.1.0-alpha.121
5.0.0-beta.11
5.1.0-alpha.111
5.1.0-alpha.106
5.1.0-alpha.91
5.1.0-alpha.86
5.1.0-alpha.76
5.1.0-alpha.66
5.1.0-alpha.51
5.1.0-alpha.41
5.1.0-alpha.31
5.1.0-alpha.21
5.1.0-alpha.11
5.1.0-alpha.06
5.0.0-beta.01
4.12.0-beta.116
5.0.0-alpha.31
5.0.0-alpha.21
4.12.0-beta.101
5.0.0-alpha.11
5.0.0-alpha.02
4.12.024
4.12.0-beta.91
4.12.0-alpha.201
4.12.0-alpha.191
4.12.0-alpha.181
4.12.0-beta.81
4.12.0-alpha.171
4.12.0-beta.71
4.12.0-alpha.161
4.12.0-alpha.151
4.12.0-beta.61
4.12.0-beta.51
4.12.0-alpha.141
4.12.0-alpha.131
4.12.0-alpha.121
4.12.0-beta.41
4.12.0-alpha.111
4.12.0-alpha.101
4.12.0-alpha.91
4.12.0-alpha.81
4.12.0-alpha.71
4.12.0-alpha.61
4.12.0-alpha.56
4.12.0-alpha.46
4.11.31,391
4.8.82,423
4.12.0-beta.36
4.12.0-alpha.31
4.8.71
4.11.21
4.12.0-beta.21
4.12.0-alpha.21
4.12.0-beta.11
4.12.0-alpha.11
4.11.11
4.8.61
4.12.0-beta.01
4.10.0-beta.42
4.12.0-alpha.01
4.11.01
4.10.01
3.28.1313,084
4.10.0-alpha.271
4.10.0-alpha.261
4.10.0-alpha.256
4.10.0-alpha.246
4.10.0-alpha.231
4.10.0-alpha.221
4.10.0-alpha.211
4.10.0-alpha.201
4.10.0-alpha.191
4.10.0-alpha.181
4.10.0-alpha.171
4.10.0-alpha.161
4.10.0-alpha.151
4.10.0-alpha.141
4.10.0-alpha.131
4.10.0-alpha.121
4.10.0-alpha.111
4.10.0-alpha.101
4.10.0-alpha.91
4.10.0-alpha.81
4.10.0-alpha.71
4.10.0-alpha.61
4.10.0-alpha.51
4.10.0-beta.31
4.10.0-alpha.41
4.10.0-beta.21
4.10.0-alpha.31
4.10.0-alpha.21
4.10.0-beta.11
4.10.0-alpha.11
4.10.0-beta.01
4.10.0-alpha.01
4.9.164
4.8.477
4.9.01
4.8.38
4.9.0-beta.31
4.9.0-alpha.141
4.9.0-beta.21
4.9.0-alpha.131
4.8.27
4.8.11
4.9.0-beta.11
4.9.0-alpha.121
4.9.0-beta.01
4.9.0-alpha.101
4.8.01
4.9.0-alpha.61
4.9.0-alpha.51
4.7.3209
4.6.43,215
4.9.0-alpha.41
4.9.0-alpha.31
4.6.31
4.6.21
4.7.21
4.9.0-alpha.21
3.28.121,119
3.28.114
4.9.0-alpha.11
4.7.15
4.9.0-alpha.01
4.8.0-beta.01
4.7.01
4.8.0-alpha.61
4.8.0-alpha.51
4.8.0-alpha.41
4.8.0-alpha.31
4.8.0-alpha.21
4.8.0-alpha.11
4.6.1292
4.7.0-beta.11
4.8.0-alpha.01
4.7.0-beta.01
4.6.01
4.5.046
4.4.1408
4.5.0-alpha.61
4.5.0-alpha.51
4.5.0-alpha.41
4.5.0-alpha.31
4.5.0-alpha.21
4.5.0-alpha.11
4.5.0-alpha.01
4.5.0-beta.01
4.4.0-alpha.161
4.4.0-alpha.151
4.4.0-alpha.141
4.4.0-alpha.131
4.4.0-alpha.121
4.4.0-alpha.111
4.4.0153
3.28.101,156
4.4.0-alpha.101
4.4.0-alpha.91
4.4.0-alpha.81
4.4.0-alpha.71
4.4.0-alpha.61
4.4.0-alpha.51
4.4.0-beta.11
4.3.097
3.28.972
4.4.0-alpha.41
4.4.0-alpha.31
4.4.0-alpha.21
4.4.0-alpha.11
4.4.0-alpha.01
4.2.0547
4.3.0-beta.01
4.2.0-alpha.101
4.2.0-alpha.91
4.2.0-alpha.81
3.28.874
4.2.0-alpha.71
4.2.0-alpha.61
4.2.0-alpha.51
4.2.0-alpha.41
4.2.0-alpha.31
3.28.7390
4.2.0-beta.01
4.1.0754
4.2.0-alpha.21
4.2.0-alpha.11
4.0.2201
4.0.11
3.28.65
4.2.0-alpha.01
4.1.0-beta.01
4.0.030
4.1.0-alpha.161
4.1.0-alpha.151
4.1.0-alpha.141
3.28.512
3.28.4121
4.1.0-alpha.131
4.1.0-alpha.121
4.0.0-beta.41
4.0.0-beta.31
4.1.0-alpha.111
4.1.0-alpha.101
4.1.0-alpha.91
4.1.0-alpha.81
4.1.0-alpha.71
4.1.0-alpha.61
4.1.0-alpha.51
4.1.0-alpha.41
4.1.0-alpha.31
4.0.0-beta.21
3.28.3144
4.0.0-beta.11
3.28.21
4.1.0-alpha.21
3.28.110
4.1.0-alpha.11
4.1.0-alpha.01
4.0.0-beta.01
3.28.028
3.29.0-alpha.175
3.29.0-alpha.161
3.28.0-beta.31
3.29.0-alpha.151
3.29.0-alpha.131
3.28.0-beta.21
3.29.0-alpha.121
3.29.0-alpha.111
3.29.0-alpha.101
3.29.0-alpha.91
3.29.0-alpha.81
3.29.0-alpha.71
3.29.0-alpha.61
3.29.0-alpha.51
3.28.0-beta.11
3.27.11,785
3.29.0-alpha.41
3.29.0-alpha.31
3.29.0-alpha.21
3.29.0-alpha.11
3.29.0-alpha.01
3.28.0-beta.01
3.28.0-alpha.31
3.27.014
3.28.0-alpha.01
3.27.0-beta.01
3.26.0427
3.24.23,434
3.27.0-alpha.01
3.26.0-beta.01
3.25.062
3.24.125
3.26.0-alpha.01
3.25.0-beta.01
3.24.0727
3.25.0-alpha.01
3.24.0-beta.01
3.23.02,015
3.20.5803
3.22.1285
3.24.0-alpha.11
3.24.0-alpha.01
3.23.0-beta.01
3.22.029
3.22.0-beta.31
3.22.0-beta.21
3.21.292
3.20.4147
3.22.0-beta.11
3.21.11
3.20.316
3.23.0-alpha.01
3.22.0-beta.01
3.21.0463
3.20.29
3.22.0-alpha.11
3.21.0-beta.11
3.20.12
3.16.92,429
3.22.0-alpha.01
3.21.0-beta.01
3.20.058
3.16.847
3.16.71
3.21.0-alpha.01
3.20.0-beta.01
3.19.0140
3.16.62
3.16.51
3.20.0-alpha.01
3.19.0-beta.01
3.18.0119
3.17.1551
3.19.0-alpha.01
3.18.0-beta.01
3.17.089
3.16.446
3.16.31
3.12.6441
3.13.386
3.13.3-alpha.01
3.16.214
3.13.22
3.12.51
3.18.0-alpha.01
3.17.0-beta.01
3.16.060
3.16.0-beta.11
3.15.1468
3.17.0-alpha.02
3.16.0-beta.01
3.15.09
3.14.191
3.16.0-alpha.31
3.8.1520
3.16.0-alpha.21
3.16.0-alpha.01
3.15.0-beta.01
3.14.027
3.14.0-beta.21
3.15.0-alpha.11
3.12.43
3.13.147
3.15.0-alpha.01
3.14.0-beta.02
3.14.0-alpha.41
3.13.01
3.12.31
3.14.0-alpha.31
3.13.0-beta.21
3.12.250
3.12.11
3.11.5852
3.13.0-beta.11
3.14.0-alpha.21
3.14.0-alpha.11
3.14.0-alpha.01
3.13.0-beta.01
3.12.0148
3.11.410
3.13.0-canary.01
3.12.0-beta.01
3.11.31
3.11.211
3.11.11
3.11.07
3.11.0-beta.21
3.12.0-canary.21
3.12.0-canary.11
3.12.0-canary.01
3.11.0-beta.11
3.10.0558
3.9.3122
3.9.28
3.11.1-canary.01
3.10.0-beta.11
3.9.11
3.9.052
3.8.0151
3.9.0-beta.11
3.7.01,807
3.6.081
3.5.2102
3.5.110
3.6.0-beta.11
3.5.0273
3.4.41,428
3.4.31
3.5.0-beta.31
3.4.216
3.5.0-beta.21
3.4.11
3.3.246
3.2.219
3.1.2137
3.0.4519
2.18.51,527
3.5.0-beta.17
3.4.015
3.4.0-beta.41
3.4.0-beta.31
3.2.11
3.3.148
3.4.0-beta.21
2.18.498
3.4.0-beta.11
3.3.01
2.18.397
3.3.0-beta.11
3.2.013
3.2.0-beta.41
3.2.0-beta.32
3.2.0-beta.22
3.1.130
3.3.0-canary1
3.2.0-beta.11
3.1.026
3.1.0-beta.21
3.0.251
2.18.2232
2.17.122
2.15.418
2.16.436
2.18.111
3.0.17
3.1.0-beta.11
3.0.08
3.0.0-beta.19
2.18.0122
2.18.0-beta.11
2.17.040
2.17.0-beta.21
2.16.319
2.16.288
2.16.11
2.17.0-beta.11
2.16.01
2.15.314
2.16.0-beta.12
2.15.21
2.15.12
2.15.012
2.14.1148
2.15.0-beta.41
2.14.1060
2.14.956
2.14.81
2.15.0-beta.32
2.14.73
2.14.610
2.14.514
2.15.0-beta.21
2.14.411
2.14.37
2.14.21
2.14.12
2.15.0-beta.11
2.14.01
2.13.2168
2.14.0-beta.31
2.13.171
2.14.0-beta.22
2.14.0-beta.12
2.13.065
2.12.298
2.13.0-beta.42
2.13.0-beta.31
2.13.0-beta.21
2.12.129
2.13.0-beta.11
2.12.09
2.11.383
2.11.21
2.12.0-beta.41
2.12.0-beta.31
2.11.115
2.12.0-beta.21
2.12.0-beta.11
2.11.063
2.11.0-beta.11
2.10.0291
2.10.0-beta.31
2.10.0-beta.21
2.10.0-beta.11
2.9.0188
2.9.0-beta.41
2.9.0-beta.32
2.9.0-beta.21
2.8.124
2.9.0-beta.12
2.8.011
2.8.0-beta.31
2.8.0-beta.21
2.8.0-beta.12
2.7.041
2.6.226
2.5.52
2.5.41
2.7.0-beta.32
2.7.0-beta.21
2.6.11
2.7.0-beta.12
2.6.01
2.5.31
2.6.0-beta.42
2.6.0-beta.32
2.6.0-beta.21
2.5.29
2.5.11
2.6.0-beta.11
2.5.03
2.5.0-beta.41
2.5.0-beta.31
2.4.3274
2.4.21
2.4.11
2.5.0-beta.21
2.5.0-beta.19
2.4.09
2.4.0-beta.31
1.13.1687
2.4.0-beta.21
2.3.322
2.3.27
2.3.11
2.4.0-beta.11
2.3.027
2.3.0-beta.51
2.3.0-beta.41
2.3.0-beta.31
2.3.0-beta.21
2.2.116
2.3.0-beta.11
2.2.07
2.2.0-beta.41
1.13.15230
2.2.0-beta.31
2.2.0-beta.21
1.13.142
2.2.0-beta.11
2.1.0445
2.1.0-beta.51
2.1.0-beta.41
1.13.132
2.0.11
2.1.0-beta.31
1.13.125
2.1.0-beta.21
1.13.116
2.1.0-beta.11
1.13.106
2.0.014
2.0.0-beta.21
1.13.97
2.0.0-beta.11
1.13.882
1.13.736
1.13.66
1.13.542
1.13.41
1.13.39
1.13.21
1.13.16
1.13.06
1.0.0-beta.19.212
1.0.0-beta.19.16
1.0.0-beta.198
1.0.0-beta.1839
1.0.0-beta.1787
1.0.0-beta.16.1130
1.0.0-beta.1648
1.0.0-beta.1533
1.0.0-beta.14.110
1.0.0-beta.1448
1.0.0-beta.1237
1.0.0-beta.11166
1.0.0-beta.10183

Package Sidebar

Install

npm i ember-data

Weekly Downloads

69,617

Version

5.3.9

License

MIT

Unpacked Size

116 kB

Total Files

100

Last publish

Collaborators

  • hm_krystan
  • richgt
  • ember-data-admin
  • runspired
  • hjdivad
  • rwjblue
  • stefanpenner
  • bmac
  • fivetanley
  • dgeb
  • igort
  • kellyselden
  • heroiceric