@dittolive/ditto 4.13.0 → 4.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,10 +3,10 @@
3
3
  _Ditto is a cross-platform SDK that allows mobile, web, and IoT apps to sync
4
4
  with and even without connectivity._
5
5
 
6
- Version: **4.13.0**
6
+ Version: **4.13.1**
7
7
 
8
8
  For more information please visit [ditto.com](https://ditto.com), as well as the
9
- [API Reference](https://software.ditto.live/js/Ditto/4.13.0/api-reference/) for this particular version.
9
+ [API Reference](https://software.ditto.live/js/Ditto/4.13.1/api-reference/) for this particular version.
10
10
 
11
11
  ---
12
12
 
package/node/ditto.cjs.js CHANGED
@@ -2393,7 +2393,7 @@ class AttachmentToken {
2393
2393
 
2394
2394
  // NOTE: this is patched up with the actual build version by Jake task
2395
2395
  // build:package and has to be a valid semantic version as defined here: https://semver.org.
2396
- const fullBuildVersionString = '4.13.0';
2396
+ const fullBuildVersionString = '4.13.1';
2397
2397
 
2398
2398
  //
2399
2399
  // Copyright © 2021 DittoLive Incorporated. All rights reserved.
@@ -2596,9 +2596,9 @@ class Logger {
2596
2596
  * the `path` parameter. When uncompressed, the file contains one JSON value
2597
2597
  * per line with the oldest entry on the first line (JSON lines format).
2598
2598
  *
2599
- * Ditto limits the amount of logs it retains on disk to 15 MB and a maximum
2600
- * age of three days. Older logs are periodically discarded once one of these
2601
- * limits is reached.
2599
+ * By default, Ditto limits the amount of logs it retains on disk to 15 MB and
2600
+ * a maximum age of 15 days. Older logs are periodically discarded once one of
2601
+ * these limits is reached.
2602
2602
  *
2603
2603
  * This method currently only exports logs from the most recently created
2604
2604
  * Ditto instance, even when multiple instances are running in the same
@@ -5973,8 +5973,14 @@ class ObserverManager {
5973
5973
  const processedArgs = this.process(...args);
5974
5974
  for (const token in this.callbacksByToken) {
5975
5975
  const callback = this.callbacksByToken[token];
5976
- if (callback)
5977
- callback(...processedArgs);
5976
+ if (callback) {
5977
+ try {
5978
+ callback(...processedArgs);
5979
+ }
5980
+ catch (e) {
5981
+ Logger.error(`Uncaught error in ${this.id} observer callback: ${e}`);
5982
+ }
5983
+ }
5978
5984
  }
5979
5985
  }
5980
5986
  /** @internal */
@@ -9891,6 +9897,9 @@ class Presence {
9891
9897
  * devices come and go, or the active connections to them change.
9892
9898
  */
9893
9899
  observe(didChangeHandler) {
9900
+ if (typeof didChangeHandler !== 'function') {
9901
+ throw new TypeError(`Expected parameter didChangeHandler to have type function, but got '${typeof didChangeHandler}'`);
9902
+ }
9894
9903
  const observerToken = this.observerManager.addObserver(didChangeHandler);
9895
9904
  const observer = new Observer(this.observerManager, observerToken, {
9896
9905
  stopsWhenFinalized: true,
@@ -11737,6 +11746,9 @@ class Ditto {
11737
11746
  */
11738
11747
  observePeers(callback) {
11739
11748
  Logger.warning('`ditto.observePeers()` is deprecated, please use `ditto.presence.observe()` instead.');
11749
+ if (typeof callback !== 'function') {
11750
+ throw new TypeError(`Expected parameter callback to have type function, but got '${typeof callback}'`);
11751
+ }
11740
11752
  const token = this.presenceManager.addObserver(callback);
11741
11753
  return new Observer(this.presenceManager, token, {
11742
11754
  stopsWhenFinalized: true,
@@ -11752,6 +11764,9 @@ class Ditto {
11752
11764
  * the changed `condition` and its `source`.
11753
11765
  */
11754
11766
  observeTransportConditions(callback) {
11767
+ if (typeof callback !== 'function') {
11768
+ throw new TypeError(`Expected parameter callback to have type function, but got '${typeof callback}'`);
11769
+ }
11755
11770
  const token = this.transportConditionsManager.addObserver(callback);
11756
11771
  return new Observer(this.transportConditionsManager, token, {
11757
11772
  stopsWhenFinalized: true,
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dittolive/ditto",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "description": "Ditto is a cross-platform SDK that allows apps to sync with and even without internet connectivity.",
5
5
  "homepage": "https://ditto.com",
6
6
  "license": "SEE LICENSE IN LICENSE.md",