Skip to content

Latest commit

 

History

History
572 lines (348 loc) · 19.1 KB

CHANGELOG.md

File metadata and controls

572 lines (348 loc) · 19.1 KB

Changelog

This lib is fully documented and so you'll find detailed migration guides.

9.0.3 (2020-03-13)

No code change, just rebuilt with very last Angular 9.0.6 to prevent any ngcc issues.

9.0.2 (2020-02-07)

Bug fix

If you were already using version >= v9.0.0-beta.4 or v9.0.0-rc.x of this lib, as a one time exception, please update with a classic npm install @ngx-pwa/local-storage@9, to avoid migration happening twice.

For future v9+ updates and if you're coming from v8.0.0 or version v9.0.0-beta.1-3, please stick to ng update @ngx-pwa/local-storage.

Following these instructions is very important, otherwise it would result in wrong config and loss of previously stored data.

9.0.0 (2020-02-07)

To update: ng update @ngx-pwa/local-storage

A full migration guide to version 9 is available.

Angular 9

v9 requires Angular 9.

Breaking change: internal storage change

Doing ng update should have managed backward compatibility. But it's not easy to be sure schematics work in all cases, so be sure to check the migration was done correctly by following the migration guide to v9, otherwise you would lost previously stored data.

Feature

Breaking changes: removal of deprecated features

The following APIs were already deprecated in v8 and are now removed in v9. Please follow the migration guide to v8 for more details about how to update to new APIs.

  • Removed providers for prefix management
    • If you're concerned, be very careful with this migration, otherwise you could lost previously stored data
    • { provide: LOCAL_STORAGE_PREFIX, useValue: 'myapp' } and localStorageProviders() (use StorageModule.forRoot({ LSPrefix: 'myapp_', IDBDBName: 'myapp_ngStorage' }) module import instead)
    • LocalStorageProvidersConfig interface (useless)
  • Removed APIs in validation
    • JSONSchemaNumeric interface (use JSONSchema instead)
    • LSGetItemOptions interface (useless)
  • Removed methods in LocalStorage service
    • .size (use .length or StorageMap.size instead)
    • .has() (use StorageMap.has() instead)
    • .keys() (use iterative StorageMap.keys() instead)
    • .setItemSubscribe() (use .setItem().subscribe() instead)
    • .removeItemSubscribe() (use .removeItem().subscribe() instead)
    • .clearSubscribe() (use .clear().subscribe() instead)

8.2.4 (2020-01-13)

No code change, just a release built with last Angular 8. Probably the last before Angular 9.

Also, documentation about sponsorship.

8.2.3 (2019-09-27)

Bug fix

  • .size in now working in Firefox private mode

Tests

The repo has moved from CircleCI to GitHub Actions. So it's free and a lot easier to test on several configurations, and now the lib is tested for each pull request on:

  • Chrome (Ubuntu & Windows)
  • Firefox (Ubuntu & Windows)
  • Safari (macOS)
  • IE (Windows)
  • in private mode of Chrome, Firefox and IE

Previously, the lib was only automatically tested in Chrome and Firefox on Ubuntu, in normal mode (other configs were tested manually).

8.2.2 (2019-09-01)

Bug fix

  • Fix a regression introduced in 8.2.0, causing the lib to fail instead of falling back to other storages in Firefox private mode

8.2.1 (2019-08-20)

Features

  • Support for ng add @ngx-pwa/local-storage (for versions >= 8)
  • Support for ng update @ngx-pwa/local-storage (it doesn't mean you don't have work to do when updating, be sure to follow the migrations guides)

Error management

Before v8.2.0, this lib was listening to indexedDb request success event. Now it's listening to transaction complete event.

Except for the special .keys() method, all other methods in this lib are doing just one request by transaction. So request success or transaction complete are supposed to be equivalent. But there are rare cases like #162 where the transaction could fail even if the request succeeded (meaning the data won't be written on disk).

So now it should catch more rare edgy cases, but for nearly everyone it should not change anything. But it's still a sensitive change as it concerns asynchrony (the order of operations are not exactly the same).

8.1.0 (2019-08-17)

Performance

  • Simpler and quicker way to store a value with indexedDb

6.2.5 & 8.0.2 (2019-06-19)

Bug fix

  • Same fix as previous release, but makes it work for all browsers (fixes #118)

6.2.4 & 8.0.1 (2019-06-05)

Bug fix

  • When storage is fully disabled in browser (via the "Block all cookies" option), just trying to check indexedDB or localStorage variables causes a security exception, and all Angular code will fail. So the lib is now catching the error, and fallbacks to in-memory storage in this case.

8.0.0 (2019-05-29)

A full migration guide to version 8 is available.

Angular 8

v8 requires Angular 8.

Feature: new StorageMap service

See the general documentation.

Feature: validation is much easier!

  • The schema used for validation can (and should) be passed directly as the second argument of getItem()
  • The returned type of getItem() is now inferred for basic types (string, number, boolean) and arrays of basic types (string[], number[], boolean[])
  • Just use the new JSONSchema interface, IntelliSense will adjust itself based on the type option

See the new validation guide.

Full review

This lib started as a little project and is now the first Angular library used for local storage. It was time to do a full review and refactoring, which results in:

  • Better error management (see README)
  • Better documentation
  • Better overall code (= easier to contribute)

Other features

  • indexedDB database and object store names default values are exported and can be changed (see the interoperability guide)
  • When trying to store null or undefined, removeItem() instead of just bypassing (meaning the old value was kept)

Breaking changes

  • type now required for array, object, const and enum validation schemas
  • JSONSchemaNull removed (useless, null doesn't require any validation)
  • JSONSchema no longer accepts extra properties
  • getUnsafeItem() is removed (was already deprecated in v7)

Future breaking changes

  • .has(), .keys() and .size are deprecated in LocalStorage. They will be removed in v9. They moved to the new StorageMap service.
  • JSONSchemaNumeric deprecated (will be removed in v9)
  • LSGetItemsOptions deprecated (not necessary anymore, will be removed in v9)
  • LOCAL_STORAGE_PREFIX, LocalStorageProvidersConfig and localStorageProviders() deprecated (will be removed in v9). Moved to StorageModule.forRoot()
  • setItemSubscribe(), removeItemSubscribe() and clearSubscribe() deprecated (will be removed in v9)

Reduced public API

Should not concern you as it was internal stuff.

  • IndexedDBDatabase and LocalStorageDatabase not exported anymore
  • MockLocalDatabase renamed and not exported anymore

7.4.1 (2019-01-27) / 5.3.6 and 6.2.3 and 7.4.2 (2019-02-25)

Documentation

  • No code change, only changes in documentation to prepare changes in v8 by recommending to:
    • explicit type in every JSON schema, especially type: 'array' and type: 'object' which were optional but will be required in v8
    • prefer the generic JSONSchema interface (v7 only)
    • avoid constants and enums validation (v7 only)
    • avoid null in JSON schemas
    • avoid adding unsupported extra properties in JSON schemas
    • use localStorageProviders() for configuration instead of LOCAL_STORAGE_PREFIX

7.4.0 (2019-01-12)

Feature

  • has() and keys() now work in Edge/IE too (fixes #69)

Do not use: it's deprecated in v8.

7.3.0 (2019-01-03)

Feature

  • getItem() and setItem() will now work with values stored from elsewhere (ie. via the native APIs or via another lib like localForage), given some limitations and adaptations (see the interoperability documentation) (fixes #65)

5.3.3 and 6.2.2 and 7.2.2 (2019-01-02)

Bug fix

  • Avoid throwing when storing undefined in localStorage fallback

5.3.2 and 6.2.1 and 7.2.1 (2018-12-12)

Bug fix

  • Correct validation for required vs optional properties (fixes #63)

7.2.0 (2018-11-27)

Feature

  • Added a partial Map-like API:
    • .keys() method
    • .has(key) method
    • .size property

In v7.2, has() and keys() were not supported in Internet Explorer and Edge. Update to v7.4.

Do not use: it's deprecated in v8.

See documentation.

Breaking change (from v7.1 only)

One of the features released in 7.1 caused an unforeseen critical regression. As it concerned only a minor feature introduced in 7.1, released only 4 days ago (so probably no one is using it yet), decision has been made to do an exceptional breaking change of this just released minor feature, before it was too late.

  • keys() is now returning Observable<string[]> (returning directly an array with all keys) instead of Observable<string> (it was iterating over the keys).

Documentation has been updated accordingly.

7.1.0 (2018-11-23) & 7.1.1 (2018-11-26)

These releases have been deprecated due to a critical regression.

7.0.0 (2018-10-19)

  • Support of Angular 7

Feature

  • New interfaces for better validation of your JSON schemas:
    • JSONSchemaConst
    • JSONSchemaEnum
    • JSONSchemaString
    • JSONSchemaNumeric (deprecated in v8)
    • JSONSchemaBoolean
    • JSONSchemaArray
    • JSONSchemaObject

See the full validation guide for more info.

Breaking change

A migration guide to version 7 is available. Be sure to read it before upgrading, as v7 introduces an important major change. Validation of data is now required when using getItem():

  • getItem<string>('test', { schema: { type: 'string' } }): no change

  • getItem<string>('test'): now returns the new TypeScript 3 unknown type instead of any, requiring from you to check the data manually

Migration is not urgent: while you manage this breaking change, you can just upgrade to v6.2.0, which is compatible with Angular 7.

6.2.0 (2018-10-19)

Feature

  • Allow Angular 7 in peerDependencies

6.1.1 and 5.3.1 (2018-09-29)

Bug fix

  • Fixed IndexedDB setter issue : Key already exists in the object store when there are concurrent setItem calls (note this situation should not happen, see #47 for details)

6.1.0 (2018-08-13)

Feature

  • Fallback to localStorage if IndexedDb connection fails (fixes #26 and #42)

6.0.0 (2018-07-26)

Features

  • New JSON Schema validation options supported (see #18 for the full list).

  • localStorageProviders({ prefix: 'myapp' }) to avoid collision in multiple apps on same subdomain

Breaking changes

A migration guide is available to ease the update. It's just a couple of refactorings. (If you want to contribute, it could be automated.)

New requirements

Supported version

  • Angular 6
  • TypeScript 2.7, 2.8 & 2.9

New classes names

  • AsyncLocalStorage removed, renamed to LocalStorage.
  • AsyncLocalDatabase removed, renamed to LocalDatabase.
  • ALSGetItemOptions removed, renamed to LSGetItemOptions.

No more LocalStorageModule

LocalStorageModule no longer needed and so removed. You must delete the import in your AppModule.

Validation

  • To be consistent with the strict validation, and to prepare future enhancement of JSON Schema typings, it is no longer possible to specify an array for type.
  • JSONSchemaType has been removed. It should very unlikely concern you, it was an internal type.

Others

  • Distribution files and directories have been changed to match official Angular Package Format v6. It affects your code only if you were manually loading UMD bundles, otherwise building tools like Angular CLI / webpack know where to find the files.

Internal changes for better performance

6.0.0-rc.2 (2018-07-23)

Breaking change

  • Distribution files and directories have been changed to match official Angular Package Format v6. It affects your code only if you were manually loading UMD bundles, otherwise building tools like Angular CLI / webpack know where to find the files.

6.0.0-rc.1 (2018-07-11)

Bug fix

  • localStorageProviders({ prefix: 'myapp' }) feature was adding the prefix twice.

Breaking change

  • If you were using previous v6 RC (v5 is not concerned) and relying on the prefix option above, your app will restart from empty data. If you want to keep your previous data, double the prefix, for example: localStorageProviders({ prefix: 'myapp_myapp' })

5.3.0 (2018-05-03)

Feature

  • localStorageProviders({ prefix: 'myapp' }) to avoid collision in multiple apps on same subdomain

5.1.1 (2018-04-07)

Bug fix

  • Correct too wide type inference for getItem()

5.1.0 and 4.1.0 (2018-04-07)

Refactoring

  • AsyncLocalStorageModule deprecated (but still working). Renamed to LocalStorageModule
  • AsyncLocalStorage deprecated (but still working). Renamed to LocalStorage
  • AsyncLocalDatabase deprecated (but still working). Renamed to LocalDatabase
  • ALSGetItemOptions deprecated (but still working). Renamed to LSGetItemOptions

See the migration guides.

5.0.0 (2018-04-03)

New package name

This lib has been renamed from angular-async-local-storage to @ngx-pwa/local-storage. See the migration guide.

Version alignement

This lib major version is now aligned to the major version of Angular. Meaning this v5 is for Angular 5. Same as v3.1.4.

4.0.0 (lts) (2018-04-03)

New package name

This lib has been renamed from angular-async-local-storage to @ngx-pwa/local-storage. See the migration guide.

Version alignement

This lib major version is now aligned to the major version of Angular. Meaning this v4 is for Angular 4. Same as v2.

We follow Angular LTS support, meaning we support Angular 4 until October 2018. So we backported some bug fixes:

  • Detect if storages are null or undefined (partially fixes (partially fixes #26)
  • Correctly complete observables (fixes #25 & #5)
  • Some IndexedDB connection errors were not caught

Previous versions were only released under angular-async-local-storage.


3.1.4 (2018-03-24)

Bug fix

  • Detect if storages are null (partially fixes #26)

3.1.3 (2018-03-23)

Bug fix

  • Detect if storages are undefined (partially fixes #26)

3.1.2 (2018-03-23)

Bug fix

  • Correctly complete observables (fixes #25 & #5)

3.1.1 (2018-01-04)

Bug fixes

  • Some IndexedDB connection errors were not caught
  • Browser info has been added for IndexedDB errors

3.1.0 (2017-11-29)

Features

  • JSON Schema validation
  • Extensibility : add your own storage

See README for instructions.

3.0.0 (2017-11-03)

Breaking changes

  • Angular 5 is now supported and required
  • RxJS >= 5.5.2 is now supported and required : lettable operators

2.0.1 (2017-10-03)

Bug fix

  • RxJS operators can now be used again on returned observables (fixes #10)

2.0.0 (2017-09-16)

Features

  • Implements Angular Package Format
    • Compatible with Universal builds from Angular CLI >= 1.3 (fixes #9)
    • Compatible with ES2015+ target builds (= smaller builds)
  • Better type checking with generics : this.storage.getItem<string>('color')

Breaking changes

  • Angular 4 is now required
  • TypeScript >= 2.3 is now required

Under the hood

  • Use Angular 4 platform tests to detect storages support instead of try/catch
  • Unit tests

1.4.0 (2017-04-01)

Features

  • Up to date with Angular 4.0

1.3.0 (2016-12-27)

Features

  • Rename package to angular-async-local-storage

Previous versions were only released under angular2-async-local-storage.


1.2.0 (2016-12-20)

Features

  • Up to date with Angular 2.4 and RxJS final

1.1.1 (2016-12-19)

Bug fixes

1.1.0 (2016-12-09)

Features

  • Up to date with Angular 2.3
  • Update peerDependencies :
    • reflect-metadata 0.1.8
    • rxjs 5.0.0-rc.4
    • zone.js 0.7.2

1.0.2 (2016-11-01)

Bug fixes

  • allow falsy values in mock database

1.0.1 (2016-11-01)

Bug fixes

  • null instead of undefined for unexisting item in mock database

1.0.0 (2016-10-31)

Features

  • Initial release : asynchronous local storage module for Angular
  • Up to date with Angular 2.1
  • Compatible with AoT pre-compiling
  • Compatible with Universal server-side rendering
  • IE9 support via native localStorage (public API still asynchronous but synchronous internally)