Skip to content

Releases: orbitjs/orbit

v0.17.0-beta.3

08 May 19:15
Compare
Choose a tag to compare
v0.17.0-beta.3 Pre-release
Pre-release

This is the third beta release for v0.17. It includes several enhancements and some major modernizations to the build process and build dependencies.

This release finally removes @orbit/store, which has been deprecated for a while. Please update your apps to use @orbit/memory instead.

The @orbit/jsonapi source now supports a new url option, which allows for completely custom URLs to be used for any request (both queries and transforms).

Furthermore, request option handling has been standardized for both queries and transforms. Any option passed at the root level will be merged with options specific to sources (with the specific options taking precedence).

The above changes mean that the following requests will both be treated by a jsonapi source named remote:

source.query(q => q.findRecords('planets'), {
  label: 'Find planets and their moons',
  sources: {
    remote: { 
      include: 'moons',
      url: 'https://example.com/custom/planets'
    }
  }
});

source.query(q => q.findRecords('planets'), {
  label: 'Find planets and their moons',
  include: 'moons',
  url: 'https://example.com/custom/planets'
});

The former will only provide the include and url options to the remote source, while other sources won't be aware of them. For most cases, this level of specificity is not needed since sources typically ignore options they don't recognize.

Changelog

🚀 Enhancement

  • @orbit/jsonapi
    • #746 [jsonapi] Support url request option (@dgeb)
  • @orbit/data, @orbit/indexeddb, @orbit/jsonapi, @orbit/local-storage, @orbit/memory, @orbit/record-cache
    • #742 Standardize request option handling (@dgeb)
  • @orbit/record-cache

🏠 Internal

  • @orbit/coordinator, @orbit/core, @orbit/data, @orbit/identity-map, @orbit/immutable, @orbit/indexeddb-bucket, @orbit/indexeddb, @orbit/integration-tests, @orbit/jsonapi, @orbit/local-storage-bucket, @orbit/local-storage, @orbit/memory, @orbit/record-cache, @orbit/serializers, @orbit/store, @orbit/utils

Committers: 2

v0.16.5

12 Mar 19:58
Compare
Choose a tag to compare

v0.16.5 (2020-03-12)

This release backports PR #735 to v0.16 to improve the mergeRecords function to better handle links, meta, and relationships members when merging records. This fixes a bug (#709) in which data members in a relationship were replaced when the updated relationship contained only links or meta (but not a replacement data).

🚀 Enhancement

  • @orbit/data, @orbit/memory, @orbit/record-cache
    • #739 Backport PR 735 to v0.16 (Improve mergeRecords to better handle links, meta, and relationships) (@dgeb)

Committers: 1

v0.17.0-beta.2

07 Mar 17:17
Compare
Choose a tag to compare
v0.17.0-beta.2 Pre-release
Pre-release

This is the second beta release for v0.17. It includes a number of significant new features and improvements from 6 contributors.

Changelog

🚀 Enhancement

  • @orbit/record-cache
    • #718 introduces new live query interfaces which allow you to subscribe to changes made to any record cache (sync or async) based upon a query expression. Once subscribed to a query, you will be notified whenever the results of your query have changed. (@tchak)
  • @orbit/data
    • #736 Remove deprecated expression property on query (@tchak)
  • @orbit/data, @orbit/memory, @orbit/record-cache
    • #735 Improve mergeRecords to better handle links, meta, and relationships (@dgeb)
  • @orbit/jsonapi
    • #727 Handle 304 responses in jsonapi-request-processor (@pangratz)
    • #731 Export all the types from jsonapi source (@tchak)
  • @orbit/coordinator, @orbit/core, @orbit/data
    • #732 Improve control of source and strategy activation and deactivation (@dgeb)
  • @orbit/core, @orbit/data, @orbit/indexeddb-bucket, @orbit/local-storage-bucket
  • @orbit/data, @orbit/indexeddb, @orbit/integration-tests, @orbit/jsonapi, @orbit/local-storage, @orbit/memory, @orbit/record-cache
    • #692 Deprecate model on relationshipDef (@tchak)

🐛 Bug Fix

  • @orbit/data
    • #710 Allow mergeOperations to set null for hasOne relationship (@jembezmamy)
  • @orbit/jsonapi
    • #712 [BUGFIX] Always allow serialization of null attributes (@makepanic)

📝 Documentation

  • #729 first pass at generating docs with typedoc (@brumm)

🏠 Internal

  • @orbit/record-cache
  • @orbit/coordinator, @orbit/core, @orbit/data, @orbit/identity-map, @orbit/immutable, @orbit/indexeddb-bucket, @orbit/indexeddb, @orbit/integration-tests, @orbit/jsonapi, @orbit/local-storage-bucket, @orbit/local-storage, @orbit/memory, @orbit/record-cache, @orbit/serializers, @orbit/store, @orbit/utils

Committers: 6

v0.16.4

10 Dec 18:50
Compare
Choose a tag to compare

This release fixes a couple bugs, both related to null values:

  • When merging changes, say from a fork back into a root source, null values for has-one relationships were not being applied.
  • In some scenarios, the JSONAPISerializer would error when serializing null values for attributes.

Many thanks to @jembezmamy and @makepanic for finding and fixing these bugs.

Changelog

🐛 Bug Fix

  • @orbit/data
    • #710 Allow mergeOperations to set null for hasOne relationship (@jembezmamy)
  • @orbit/jsonapi
    • #712 [BUGFIX] Always allow serialization of null attributes (@makepanic)

Committers: 2

v0.17.0-beta.1

22 Sep 16:12
Compare
Choose a tag to compare
v0.17.0-beta.1 Pre-release
Pre-release

This is the first beta release for v0.17. It includes several important enhancements and deprecations:

  • As described in #695, an unsubscribe function is now returned whenever subscribing to an event (with on or one). This function is more foolproof than calling off directly.

  • IndexedDB and LocalStorage sources are now more efficient about activation and deactivation.

  • Thanks to #688, queries now support multiple expressions! This makes queries analogous to transforms, which can support multiple operations. Query#expression has been deprecated in favor of Query#expressions.

Thanks to @tchak for doing all the heavy lifting with this release! 💪

Changelog

🚀 Enhancement

  • @orbit/core, @orbit/data, @orbit/record-cache
    • #695 Return off function from evented subscribers (@tchak)
  • @orbit/indexeddb, @orbit/local-storage
    • #689 Various small improvements to indexeddb and local-storage sources (@tchak)
  • @orbit/indexeddb
    • #694 Move indexeddb database opening code to source activate hook (@tchak)
  • @orbit/data, @orbit/indexeddb, @orbit/jsonapi, @orbit/local-storage, @orbit/memory, @orbit/record-cache

Committers: 1

v0.16.3

22 Sep 16:04
Compare
Choose a tag to compare

This release patches some issues with filtering results in @orbit/record-cache, and thus also in downstream sources such as @orbit/memory:

  • relatedRecord filter now works with null
  • All filters now ignore any undefined values (and will never match based upon an undefined value).

Thanks to @Michiel87 and @dgeb for finding and fixing these issues.

@tchak also did a bunch of housekeeping with this release - updating dependencies and switching lerna over to use yarn workspaces.

Changelog

🐛 Bug Fix

  • @orbit/memory, @orbit/record-cache
    • #702 Always ignore undefined values when filtering (@dgeb)
  • @orbit/record-cache
    • #701 fix: added null case to relatedRecord filter processing (@Michiel87)

🏠 Internal

  • @orbit/coordinator
  • @orbit/utils
  • @orbit/coordinator, @orbit/core, @orbit/data, @orbit/identity-map, @orbit/immutable, @orbit/indexeddb-bucket, @orbit/indexeddb, @orbit/integration-tests, @orbit/jsonapi, @orbit/local-storage-bucket, @orbit/local-storage, @orbit/memory, @orbit/record-cache, @orbit/serializers, @orbit/store, @orbit/utils
  • Other

Committers: 3

v0.16.2

05 Sep 21:53
Compare
Choose a tag to compare

v0.16.2 only updates @orbit/coordinator with a fix to the RequestStrategy handler. As described in #687, this fix ensures that custom handler functions on a RequestStrategy, such as action, blocking, and filter, receive all args emitted from the source event:

  • For beforeX events such as beforeQuery, the handler functions will receive the second hints argument.
  • For x events such as query, the handler functions will receive the second result argument.
  • For xFail events such as queryFail, the handler functions will receive the second error argument.

This is considered a bug fix because the behavior changed unintentionally when hints were introduced in v0.16.0.

Changelog

🐛 Bug Fix

  • @orbit/coordinator
    • #687 Ensure that RequestStrategy handler functions receive all args (@dgeb)

Committers: 1

v0.16.1

20 Aug 12:07
Compare
Choose a tag to compare

This patch release contains a few fixes, primarily focused on builds.

The ES5 builds available in each package's dist/*/es5 dir are now processed with the for...of and async / await transforms. These builds will need to be paired with the regenerator-runtime package to ensure that the regeneratorRuntime global is defined.

The default builds targeted by main and module are now ES-latest. These builds are as small and performant as possible, and of course can be further processed with Babel if necessary. This change is considered a bug fix because the previous targets were neither ES5 nor ES-latest, but rather a merger of the two (see #661 for more details).

Changelog

🚀 Enhancement

  • @orbit/jsonapi

🐛 Bug Fix

  • @orbit/core
    • #686 Add guards to check that TaskQueues have at least one processor (@cibernox)
  • @orbit/coordinator, @orbit/core, @orbit/data, @orbit/identity-map, @orbit/immutable, @orbit/indexeddb-bucket, @orbit/indexeddb, @orbit/integration-tests, @orbit/jsonapi, @orbit/local-storage-bucket, @orbit/local-storage, @orbit/memory, @orbit/record-cache, @orbit/serializers, @orbit/store, @orbit/utils
    • #684 Target ES-latest by default + Fix ES5 builds (@dgeb)

📝 Documentation

Committers: 3

v0.16.0

20 Aug 11:21
Compare
Choose a tag to compare

This is the first official release of v0.16. There have been no changes since the last beta release: v0.16.0-beta.11.

The Orbit guides now contain a complete summary of what's new in v0.16, which covers all the major changes since v0.15.

v0.16.0-beta.11

18 Jul 14:34
Compare
Choose a tag to compare
v0.16.0-beta.11 Pre-release
Pre-release

🚨 If you are an author of any sources, please focus on the breaking changes in this release! 🚨

While testing the hinting feature and its interactions with different source interfaces, @tchak uncovered some scenarios in which hints could fail to return expected results (see #612). This led to a quest to understand those problems and fix them across source interfaces. Unfortunately, in order to guarantee predictable and consistent behavior, we needed to move some responsibilities to source implementations that were previously handled in Orbit's private implementations of those interfaces.

Thus, if you're writing sources, please ensure that you do the following in any of your internal implementation methods that work with transforms (e.g. _update, _sync, etc.):

  • Check the transformLog for the requested transform to see if work actually needs to be done before doing it.

  • Invoke transformed for any transforms that are applied.

By moving these responsibilities to source implementations, we allow more flexibility in implementations. For instance, _update can ignore re-applying transforms that may have been sync'd via beforeUpdate listeners, while still returning results that are specified via the hints argument.

In order to update the @orbit/memory source to both support hints and respond to the above requirements, the following changes were needed:

  /////////////////////////////////////////////////////////////////////////////
  // Syncable interface implementation
  /////////////////////////////////////////////////////////////////////////////

  async _sync(transform: Transform): Promise<void> {
-    this._applyTransform(transform);
+    if (!this.transformLog.contains(transform.id)) {
+      this._applyTransform(transform); // <- internal implementation that applies the transform to the source's cache
+      await this.transformed([transform]);
+    }
  }

  /////////////////////////////////////////////////////////////////////////////
  // Updatable interface implementation
  /////////////////////////////////////////////////////////////////////////////

  async _update(transform: Transform, hints?: any): Promise<any> {
-    return this._applyTransform(transform);
+    let results: PatchResultData[];
+
+    if (!this.transformLog.contains(transform.id)) {
+      results = this._applyTransform(transform); // <- internal implementation that applies the transform to the source's cache
+      await this.transformed([transform]);
+    }
+
+    if (hints && hints.data) {
+      if (transform.operations.length > 1 && Array.isArray(hints.data)) {
+        return hints.data.map((idOrIds: RecordIdentity | RecordIdentity[]) =>
+          this._retrieveFromCache(idOrIds)
+        );
+      } else {
+        return this._retrieveFromCache(hints.data);
+      }
+    } else if (results) {
+      if (transform.operations.length === 1 && Array.isArray(results)) {
+        return results[0];
+      } else {
+        return results;
+      }
+    }
  }

  /////////////////////////////////////////////////////////////////////////////
  // Queryable interface implementation
  /////////////////////////////////////////////////////////////////////////////

  async _query(query: Query, hints?: any): Promise<any> {
-    return this._cache.query(query);
+    if (hints && hints.data) {
+      return this._retrieveFromCache(hints.data);
+    } else {
+      return this._cache.query(query);
+    }
  }

Please review your custom sources to make any necessary changes. If your methods don't support hints, the diffs should rather small, like in the _sync method above. If you want to support hints, you'll need to provide alternate code paths for when hints are provided and not, like in the _update and _query methods above.

We're planning to include a guide to writing your own sources with the v0.16 release to clarify all these responsibilities.

Changelog

💥 Breaking Change

  • @orbit/data, @orbit/indexeddb, @orbit/jsonapi, @orbit/local-storage, @orbit/memory
    • #678 [BREAKING] Shift some responsibilities for transform-related interfaces to source implementations (@dgeb)

🚀 Enhancement

  • @orbit/coordinator, @orbit/data, @orbit/indexeddb, @orbit/jsonapi, @orbit/local-storage, @orbit/memory
    • #680 [DEPRECATION] Deprecate _transformed in favor of transformed (@dgeb)

🏠 Internal

  • @orbit/jsonapi, @orbit/memory
  • @orbit/data
    • #677 Convert source interface implementations to use async/await (@dgeb)

Committers: 2