Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

lovefield

google4.4kApache-2.02.1.12TypeScript support: included

Lovefield - A relational database for web apps

lovefield

readme

Lovefield

Build Status NPM version Bower version

Lovefield is a relational database written in pure JavaScript. It provides SQL-like syntax and works cross-browser (currently supporting Chrome 37+, Firefox 31+, IE 10+, and Safari 10+).

Please visit our public forum for general Q&A, feedback, and discussions.

Quick Start

Frequently Asked Questions

Specification

Developer Setup

Design Documents

Lovefield is Day 98 of 100 days of Google Dev. This is a quick 7-minute video filmed in August 2015.

Live 30min overview presentation at JS.LA (February 2015): Watch on YouTube or Vimeo.

changelog

Version: 2.1.12
Publish date: 20170203
Changes:

  • Fix error that was thrown when a query with columns of lf.Type.OBJECT or lf.Type.ARRAY_BUFFER was observed.
  • Fix toSql() for case where a single leftOuterJoin exists with no where clause.

Version: 2.1.11
Publish date: 20161212
Changes:

  • Support Safari 10+. Update code, document, and infrastructure for it.

Version: 2.1.10
Publish date: 20160922
Changes:

  • Fix case where rowIDs where corrupted when multiple databases co-exist.
  • Fix mobile Safari detection, such that WebSQL is used by default.
  • Remove race condition from the logic that throws lf.Exception 113.

Version: 2.1.9
Publish date: 20160708
Changes:

  • Include more information for lf.Exception 201 (duplicate key).
  • Remove Object.observe usage from spec sample code.
  • Relax groupBy projection list limitations.
  • Perform missing query validity checks for transaction attach().

Version: 2.1.8
Publish date: 20160502
Changes:

  • Fixed missing semicolon at the end of dist/ files.
  • Fixed lf.Exception to handle null/undefined arguments.

Version: 2.1.7
Publish date: 20160307
Changes:

  • Changed exception description URL to point to GitHub.

Version: 2.1.6
Publish date: 20160204
Changes:

  • Changed the algorithm of assigning auto-increment primary keys.
  • Allowed isNull() and isNotNull() predicate for lf.Type.OBJECT columns.
  • Fixed update queries incorrectly handling parameter binding.
  • Fixed incorrect TypeScript definitions.

Version: 2.1.5
Publish date: 20160107
Changes:

  • Fixed WebSQL back store initial row ID scanning bug.

Version: 2.1.4
Publish date: 20151222
Changes:

  • Fixed PushDownSelectionsPass case where nodes were not pushed down (which was affecting queries with multiple joins).
  • Fixed Tyepescript definitions for TableBuilder#addForeignKey.

Version: 2.1.3
Publish date: 20151216
Changes:

  • Fixed execution of queries that involve leftOuterJoin and have a where clause such that the result matches that of other SQL engines.
  • Fixed error thrown by MultiColumnOrPass optimization if tree was already optimized.
  • Fixed ChangeRecord objects returned to observers to not be renamed by the compiler.
  • Fixed Typescript definitions for Builder#connect.

Version: 2.1.2
Publish date: 20151120
Changes:

  • Fix inspector not showing some pages.
  • Fix TypeScript definition errors.
  • Fix a bug in lf.structs.MapSet#delete.
  • Fix WebSQL error when table name is a SQL reserved word.
  • Add transaction statistics.

Version: 2.1.1
Publish date: 20151030
Changes:

  • Add better debug inspector support that requires much less memory for the inspector extension.

Version: 2.1.0
Publish date: 20151026
Changes:

  • OR and IN predicates will use index trees instead of full table scan when possible.
  • Continuous integration using Travis CI and Sauce Labs is now in place and guarding all future submissions.
  • Lovefield declares golden: all features in the specification are implemented, unit-tested, and field-tested.

Version: 2.0.66
Publish date: 20151014
Changes:

  • Fix Firebase not listening to external changes for new instances.
  • Intercepting database initialization failures to provide better error message.

Version: 2.0.65
Publish date: 20151009
Changes:

  • Optimize the IN predicate to leverage indices.
  • Optimize certain class of OR predicate to leverage indices.
  • Fix cross-column index getRange() bug that caused some results to be missing.
  • Fix Firebase backstore incorrect serialization.

Changes: Version: 2.0.64
Publish date: 20151005
Changes:

  • Implemented cascaded deletions/updates.
  • Implemented cross-column nullable indices.
  • Performance and memory improvements for READ_ONLY queries.
  • Modified distributed binaries such that they can be imported as modules.
  • Disable usage of native Map/Set for Safari or iOS Chrome.
  • Fixed a bug in BTree#getRange() for the case of LIMIT and SKIP by index.
  • Fixed a bug in BTree#getRange() for cross-column indices.
  • Fixed a bug preventing persisted indices to be serialized correctly if "bundled" mode is used.
  • Expliticly disallowing multiple calls to connect(), to avoid misusage.
  • Falling back to WEB_SQL or MEMORY data stores if no explicit data store type is requested in connectOptions and INDEXED_DB is not available.
  • Using the faster and experimental IDBObjectStore#getAll when available.
  • Stop accidentally distributing the codelabs/ folder through bower.

Version: 2.0.63
Publish date: 20150917
Changes:

  • Improved explain() output in the case of join predicates.
  • Implemented DB import/export functionality.
  • Fixed persisted indices implementation for WebSQL backing store.
  • Fixed debug/release binaries to work within a WebWorker.
  • Respecting column uniqueness for automatically created foreign key indices.
  • Forced Safari to use Set polyfill instead of native Set to work around buggy implementation.
  • Removed unnecessary function binding for better performance.
  • Create goog.Promise#catch alias for goog.Promise#thenCatch, such that returned promises match the interface of native Promise.
  • Enhanced nested loop join to be L1 cache aware.

Version: 2.0.62
Publish date: 20150807
Changes:

  • Implemented index nested loop join.
  • Optimize default cache.
  • Remove dependencies of Closure structures Multimap and TreeNode.
  • Provides source map for minified JS.
  • Provides ES6 only minified JS that strips out Map and Set polyfills.

Version: 2.0.61
Publish date: 20150730
Changes:

  • Converted all code paths to use native ES6 Map/Set when available.
  • Fixed a bug causing Firebase backend stopped working.
  • Fixed toSql() to correctly output queries with left outer join.
  • Fixed scoping bug in performance dashboard.
  • Fixed NULL handling problems in evaluators and predicates.
  • Improve B-Tree performance by using a more effective binary insert/remove algorithm.

Version: 2.0.60
Publish date: 20150727
Changes:

  • Modified not-nullable constraint to also mean not-undefinabale.
  • IndexRangeScanStep: Uses cheaper Index#get instead of Index#getRange whenever possible.
  • Ignore foreign key constraint violation if child column is set to null.
  • Make sure that cross-column TableBuilder#addUnique can't be used with nullable columns.
  • Various BTree optimizations (including get all records case).
  • Fixed case where trying to add an index with order lf.Order.DESC was being ignored (index was added with lf.Order.ASC).
  • Unified schema validation for SPAC and lf.query.Builder, and added missing checks.
  • Fixed TableBuilder toDbPayload() to handle ARRAY_BUFFER and nullable DATE_TIME correctly.
  • Fixed a bug in InMemoryUpdater#updateTableIndicesForRow which caused some indices to be inconsistent after a rollback.
  • Migrated various classes to use lf.structs.Map/Set, which is native Map/Set when available, or a pollyfil when not available.
  • Fixed behavior of aggregators MIN/MAX/AVG/SUM/COUNT/STDDEV for the case where nulls exist.

Version: 2.0.59
Publish date: 20150701
Changes:

  • Implemented RESTRICT foreign key constraints for all queries.
  • Fixed bug that caused a thrown lf.Exception to be unreadable when using lovefield.min.js.
  • Fixed bug that caused a nullable and unique index to allow multiple null keys.
  • Fixed default values of ARRAY_BUFFER and OBJECT columns to be null, per spec.

Version: 2.0.58
Publish date: 20150617
Changes:

  • Change lf.Exception to be error-code based.
  • Foreign key declaration syntax change, and add more checks for the validity.
  • Consolidate top-level enums into one single file.
  • Gulp improvements: unify all gulp command lines, update gulp to 3.9.0, and fix various bugs.
  • Fix a bug that SPAC wrongly placed arraybuffer/object columns as not nullable.

Version: 2.0.57
Publish date: 20150608
Changes:

  • Fixed lovefield.min.js. It was missing lf.raw.BackStore public API.

Version: 2.0.56
Publish date: 20150602
Changes:

  • Fixed lovefield.min.js. It was missing various public API endpoints.
  • Added lovefield.d.ts TypeScript definitions in dist/ folder.

Version: 2.0.55
Publish date: 20150526
Changes:

  • Fixed typos
  • Fixed namespace leak in distributed package

Version: 2.0.54
Publish date: 20150521
Changes:

  • lovefield.min.js size reduced from 295Kb to 114Kb.
  • Fixed WebSQL backstore to work properly on Safari.
  • Fixed gulp build bug to properly order dependencies (topological sorting).