@dittolive/ditto 4.0.2-experimental.shutdown-support.2.darwin-arm64 → 4.0.3-alpha.linux-ble-fixes-2

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.
Binary file
Binary file
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.0.2-experimental.shutdown-support.2.darwin-arm64",
3
+ "version": "4.0.3-alpha.linux-ble-fixes-2",
4
4
  "description": "Ditto is a cross-platform embeddable NoSQL database that can sync with or without an internet connection.",
5
5
  "homepage": "https://ditto.live",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
package/types/ditto.d.ts CHANGED
@@ -18,63 +18,8 @@ declare class KeepAlive {
18
18
  }
19
19
 
20
20
  /** @internal */
21
- type ObserverToken = string;
22
- /** @internal */
23
- type ObserverManagerConstructorOptions = {
24
- keepAlive?: KeepAlive;
25
- register?: (callback: (...args: any[]) => void) => void;
26
- unregister?: () => void;
27
- process?: (...args: any[]) => any[];
28
- };
29
- /** @internal */
30
- declare class ObserverManager {
31
- /** @internal */
32
- readonly id: string;
33
- /** @internal */
34
- readonly keepAlive: KeepAlive | null;
35
- /** @internal */
36
- constructor(id: string, options?: ObserverManagerConstructorOptions);
37
- /** @internal */
38
- addObserver(callback: any): ObserverToken;
39
- /** @internal */
40
- removeObserver(token: ObserverToken): void;
41
- hasObserver(token: ObserverToken): boolean;
42
- /** @internal */
43
- notify(...args: any[]): void;
44
- /** @internal */
45
- close(): void;
46
- /**
47
- * Can be injected and replaced via constructor options.
48
- *
49
- * @abstract
50
- */
51
- protected register(callback: (...args: any[]) => void): void;
52
- /**
53
- * Can be injected and replaced via constructor options.
54
- *
55
- * @abstract
56
- */
57
- protected unregister(): void;
58
- /**
59
- * Can be injected and replaced via constructor options.
60
- *
61
- * @abstract
62
- */
63
- protected process(...args: any[]): any[];
64
- private isClosed;
65
- private isRegistered;
66
- private callbacksByToken;
67
- private constructorOptions;
68
- private hasObservers;
69
- private registerIfNeeded;
70
- private unregisterIfNeeded;
71
- private finalize;
72
- }
73
-
74
- /** @internal */
75
- interface ObserverManaging {
76
- hasObserver(token: ObserverToken): any;
77
- removeObserver(token: ObserverToken): any;
21
+ interface ObserverRemoving {
22
+ removeObserver(token: any): any;
78
23
  }
79
24
  /** @internal */
80
25
  type ObserverOptions = {
@@ -88,13 +33,13 @@ type ObserverOptions = {
88
33
  */
89
34
  declare class Observer {
90
35
  /** @internal */
91
- readonly observerManager: ObserverManaging;
36
+ readonly observerManager: ObserverRemoving;
92
37
  /** @internal */
93
- readonly token?: ObserverToken;
38
+ readonly token?: any;
94
39
  /** @internal */
95
40
  readonly options?: ObserverOptions;
96
41
  /** @internal */
97
- constructor(observerManager: ObserverManaging, token: any, options?: ObserverOptions);
42
+ constructor(observerManager: ObserverRemoving, token: any, options?: ObserverOptions);
98
43
  /**
99
44
  * Returns `true` if the observer has been explicitly stopped via the `stop()`
100
45
  * method. Otherwise returns `false`.
@@ -924,6 +869,56 @@ declare class TransportConfig {
924
869
  static areListenHTTPsEqual(left: TransportConfigListenHTTP, right: TransportConfigListenHTTP): boolean;
925
870
  }
926
871
 
872
+ /** @internal */
873
+ type ObserverToken = string;
874
+ /** @internal */
875
+ type ObserverManagerConstructorOptions = {
876
+ keepAlive?: KeepAlive;
877
+ register?: (callback: (...args: any[]) => void) => void;
878
+ unregister?: () => void;
879
+ process?: (...args: any[]) => any[];
880
+ };
881
+ /** @internal */
882
+ declare class ObserverManager {
883
+ /** @internal */
884
+ readonly id: string;
885
+ /** @internal */
886
+ readonly keepAlive: KeepAlive | null;
887
+ /** @internal */
888
+ constructor(id: string, options?: ObserverManagerConstructorOptions);
889
+ /** @internal */
890
+ addObserver(callback: any): ObserverToken;
891
+ /** @internal */
892
+ removeObserver(token: ObserverToken): void;
893
+ /** @internal */
894
+ notify(...args: any[]): void;
895
+ /**
896
+ * Can be injected and replaced via constructor options.
897
+ *
898
+ * @abstract
899
+ */
900
+ protected register(callback: (...args: any[]) => void): void;
901
+ /**
902
+ * Can be injected and replaced via constructor options.
903
+ *
904
+ * @abstract
905
+ */
906
+ protected unregister(): void;
907
+ /**
908
+ * Can be injected and replaced via constructor options.
909
+ *
910
+ * @abstract
911
+ */
912
+ protected process(...args: any[]): any[];
913
+ private isRegistered;
914
+ private callbacksByToken;
915
+ private constructorOptions;
916
+ private hasObservers;
917
+ private registerIfNeeded;
918
+ private unregisterIfNeeded;
919
+ private finalize;
920
+ }
921
+
927
922
  /**
928
923
  * Provides info about the authentication status.
929
924
  */
@@ -1024,8 +1019,6 @@ declare class Authenticator {
1024
1019
  /** @internal */
1025
1020
  '@ditto.authClientValidityChanged'(isWebValid: boolean, isX509Valid: boolean): void;
1026
1021
  /** @internal */
1027
- close(): void;
1028
- /** @internal */
1029
1022
  protected keepAlive: KeepAlive;
1030
1023
  /** @internal */
1031
1024
  protected observerManager: ObserverManager;
@@ -1035,7 +1028,6 @@ declare class OnlineAuthenticator extends Authenticator {
1035
1028
  loginWithToken(token: string, provider: string): Promise<void>;
1036
1029
  loginWithUsernameAndPassword(username: string, password: string, provider: string): Promise<void>;
1037
1030
  logout(cleanupFn?: (Ditto: any) => void): Promise<void>;
1038
- close(): void;
1039
1031
  readonly authClientPointer: Pointer<FFIAuthClient>;
1040
1032
  readonly authenticationHandler: AuthenticationHandler;
1041
1033
  private ditto;
@@ -1308,8 +1300,6 @@ declare class Presence {
1308
1300
  observe(didChangeHandler: (presenceGraph: PresenceGraph) => void): Observer;
1309
1301
  /** @internal */
1310
1302
  constructor(ditto: Ditto);
1311
- /** @internal */
1312
- close(): void;
1313
1303
  private observerManager;
1314
1304
  }
1315
1305
 
@@ -1380,11 +1370,6 @@ declare class Ditto {
1380
1370
  * @see {@link setOfflineOnlyLicenseToken | setOfflineOnlyLicenseToken()}
1381
1371
  */
1382
1372
  readonly isActivated: boolean;
1383
- /**
1384
- * `true` once {@link close | Ditto.close()} has been called, otherwise
1385
- * `false`.
1386
- */
1387
- get isClosed(): boolean;
1388
1373
  /**
1389
1374
  * Returns `true` if sync is active, otherwise returns `false`. Use
1390
1375
  * {@link startSync | startSync()} to activate and {@link stopSync | stopSync()}
@@ -1543,51 +1528,13 @@ declare class Ditto {
1543
1528
  * or has (transitively) had disabled, syncing with v3 SDK peers.
1544
1529
  */
1545
1530
  disableSyncWithV3(): void;
1546
- /**
1547
- * Shut down Ditto and release all resources.
1548
- *
1549
- * Must be called before recreating a Ditto instance that uses the same
1550
- * persistence directory.
1551
- */
1552
- close(): Promise<void>;
1553
1531
  /** @internal */
1554
1532
  keepAlive: KeepAlive;
1555
- /**
1556
- * The number of operations pending before the Ditto instance can be closed.
1557
- *
1558
- * For testing purposes only.
1559
- * @internal */
1560
- get numPendingOperations(): number;
1561
- /**
1562
- * Makes sure that the closure is executed only if the Ditto instance hasn't
1563
- * been closed yet.
1564
- *
1565
- * @param closure the synchronous closure to execute.
1566
- * @returns the result of the closure.
1567
- * @throws if the Ditto instance was closed before calling this method.
1568
- * @internal */
1569
- deferClose<T>(closure: () => T): T;
1570
- /**
1571
- * Makes sure that the closure is executed to completion before the Ditto
1572
- * instance is closed.
1573
- *
1574
- * Any calls to {@link close | `Ditto.close()`} will wait until the closure
1575
- * has completed before closing the Ditto instance.
1576
- *
1577
- * @param closure the asynchronous closure to execute.
1578
- * @returns the result of the closure.
1579
- * @throws if the Ditto instance was closed before calling this method.
1580
- * @internal */
1581
- deferCloseAsync<T>(closure: () => Promise<T>): Promise<T>;
1582
1533
  private sync;
1583
- private _isClosed;
1584
- private deferCloseAllowed;
1585
1534
  private isWebValid;
1586
1535
  private isX509Valid;
1587
1536
  private presenceManager;
1588
1537
  private transportConditionsManager;
1589
- /** Set of pending operations that need to complete before the Ditto instance can be closed in a safe manner. */
1590
- private pendingOperations;
1591
1538
  private authClientValidityChanged;
1592
1539
  private validateIdentity;
1593
1540
  private setSyncActive;
@@ -2520,8 +2467,6 @@ declare class ExperimentalStore {
2520
2467
  * @returns a promise for an array of Ditto documents matching the query
2521
2468
  **/
2522
2469
  execute(query: string): Promise<Document[]>;
2523
- /** @internal */
2524
- close(): void;
2525
2470
  }
2526
2471
 
2527
2472
  /**
@@ -2725,8 +2670,6 @@ declare class Store {
2725
2670
  write(callback: (transaction: WriteTransaction) => Promise<void>): Promise<WriteTransactionResult[]>;
2726
2671
  /** @internal */
2727
2672
  constructor(ditto: Ditto);
2728
- /** @internal */
2729
- close(): void;
2730
2673
  /**
2731
2674
  * Private method, used only by the Portal https://github.com/getditto/ditto/pull/3652
2732
2675
  * @internal