@dittolive/ditto 4.1.0 → 4.2.0
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 +2 -2
- package/node/ditto.cjs.js +311 -94
- package/node/ditto.darwin-arm64.node +0 -0
- package/node/ditto.darwin-x64.node +0 -0
- package/node/ditto.linux-arm.node +0 -0
- package/node/ditto.linux-x64.node +0 -0
- package/node/ditto.win32-x64.node +0 -0
- package/node/transports.darwin-arm64.node +0 -0
- package/node/transports.darwin-x64.node +0 -0
- package/package.json +1 -1
- package/types/ditto.d.ts +152 -9
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
package/types/ditto.d.ts
CHANGED
|
@@ -1348,7 +1348,7 @@ declare class SubscriptionManager {
|
|
|
1348
1348
|
* registry.
|
|
1349
1349
|
*
|
|
1350
1350
|
* @internal */
|
|
1351
|
-
private
|
|
1351
|
+
private removeWithContextInfo;
|
|
1352
1352
|
}
|
|
1353
1353
|
|
|
1354
1354
|
/**
|
|
@@ -1919,6 +1919,36 @@ declare class Ditto {
|
|
|
1919
1919
|
* @see {@link Ditto.path}
|
|
1920
1920
|
*/
|
|
1921
1921
|
constructor(identity?: Identity, path?: string);
|
|
1922
|
+
/**
|
|
1923
|
+
* Don't terminate the process when callbacks are pending for a long time.
|
|
1924
|
+
*
|
|
1925
|
+
* Some methods in the Ditto library accept asynchronous functions as callback
|
|
1926
|
+
* parameters. If these asynchronous functions do not resolve within a certain
|
|
1927
|
+
* period of time after having been invoked by Ditto, deadlock detection gets
|
|
1928
|
+
* triggered, resulting in the termination of the process.
|
|
1929
|
+
*
|
|
1930
|
+
* When Ditto is executed in a Node.js environment with an interactive
|
|
1931
|
+
* debugger attached, this deadlock detection might get activated upon
|
|
1932
|
+
* encountering a breakpoint. Calling `Ditto.disableDeadlockDetection()`
|
|
1933
|
+
* disables this behavior, thus allowing the use of an interactive debugger
|
|
1934
|
+
* without triggering the deadlock detection.
|
|
1935
|
+
*
|
|
1936
|
+
* This feature is not available in the browser.
|
|
1937
|
+
*/
|
|
1938
|
+
static disableDeadlockDetection(): void;
|
|
1939
|
+
/**
|
|
1940
|
+
* Returns `true` if deadlock detection is enabled.
|
|
1941
|
+
*
|
|
1942
|
+
* See
|
|
1943
|
+
* {@link Ditto.disableDeadlockDetection | Ditto.disableDeadlockDetection()}
|
|
1944
|
+
* for more information.
|
|
1945
|
+
*
|
|
1946
|
+
* This method always returns `false` in the browser where deadlock detection
|
|
1947
|
+
* is not available.
|
|
1948
|
+
*
|
|
1949
|
+
* @returns `true` if deadlock detection is enabled
|
|
1950
|
+
*/
|
|
1951
|
+
static hasDeadlockDetection(): boolean;
|
|
1922
1952
|
/**
|
|
1923
1953
|
* Check if the current environment supports running Ditto.
|
|
1924
1954
|
*
|
|
@@ -1930,7 +1960,7 @@ declare class Ditto {
|
|
|
1930
1960
|
*
|
|
1931
1961
|
* Internet Explorer is not supported.
|
|
1932
1962
|
*
|
|
1933
|
-
* @returns true if the environment is supported
|
|
1963
|
+
* @returns `true` if the environment is supported
|
|
1934
1964
|
*/
|
|
1935
1965
|
static isEnvironmentSupported(): boolean;
|
|
1936
1966
|
/**
|
|
@@ -2109,6 +2139,15 @@ declare class Ditto {
|
|
|
2109
2139
|
}
|
|
2110
2140
|
/** @internal */
|
|
2111
2141
|
declare const checkAPIs: (_globalObject?: Window | typeof globalThis) => boolean;
|
|
2142
|
+
/**
|
|
2143
|
+
* Disable deadlock timeout when Node.js is running with `--inspect` parameter.
|
|
2144
|
+
*
|
|
2145
|
+
* This heuristic is not failsafe as debugging mode can also be enabled by
|
|
2146
|
+
* sending a `SIGUSR1` signal to the process.
|
|
2147
|
+
*
|
|
2148
|
+
* @internal
|
|
2149
|
+
*/
|
|
2150
|
+
declare const disableDeadlockTimeoutWhenDebugging: () => void;
|
|
2112
2151
|
|
|
2113
2152
|
/**
|
|
2114
2153
|
* Represents an attachment and can be used to insert the associated attachment
|
|
@@ -2599,6 +2638,94 @@ declare class PendingCollectionsOperation implements PromiseLike<Collection[]> {
|
|
|
2599
2638
|
private readonly pendingCursorOperation;
|
|
2600
2639
|
}
|
|
2601
2640
|
|
|
2641
|
+
/**
|
|
2642
|
+
* Manages `ExperimentalSubscription` instances and removes them when Ditto is
|
|
2643
|
+
* closed.
|
|
2644
|
+
*
|
|
2645
|
+
* @internal
|
|
2646
|
+
*/
|
|
2647
|
+
declare class ExperimentalSubscriptionManager {
|
|
2648
|
+
constructor(ditto: Ditto);
|
|
2649
|
+
/**
|
|
2650
|
+
* Begin tracking a subscription instance and start it.
|
|
2651
|
+
*
|
|
2652
|
+
* @internal
|
|
2653
|
+
*/
|
|
2654
|
+
addSubscription(subscription: ExperimentalSubscription): void;
|
|
2655
|
+
/**
|
|
2656
|
+
* Stop tracking a subscription instance and cancel it.
|
|
2657
|
+
*
|
|
2658
|
+
* @internal
|
|
2659
|
+
*/
|
|
2660
|
+
removeSubscription(subscription: ExperimentalSubscription): void;
|
|
2661
|
+
/**
|
|
2662
|
+
* Stop tracking all subscriptions and cancel them.
|
|
2663
|
+
*
|
|
2664
|
+
* @internal
|
|
2665
|
+
*/
|
|
2666
|
+
close(): void;
|
|
2667
|
+
private readonly ditto;
|
|
2668
|
+
private subscriptions;
|
|
2669
|
+
private finalizationRegistry;
|
|
2670
|
+
/**
|
|
2671
|
+
* Remove tracked subscription without unregistering from finalization
|
|
2672
|
+
* registry.
|
|
2673
|
+
*
|
|
2674
|
+
* @internal
|
|
2675
|
+
*/
|
|
2676
|
+
private removeWithContextInfo;
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Contains all information required to deregister a subscription
|
|
2681
|
+
* in Ditto Core, even when the subscription instance itself has
|
|
2682
|
+
* already been garbage collected.
|
|
2683
|
+
*
|
|
2684
|
+
* @internal
|
|
2685
|
+
*/
|
|
2686
|
+
type ExperimentalSubscriptionContextInfo = {
|
|
2687
|
+
/** Unique ID per `ExperimentalSubscription` instance. */
|
|
2688
|
+
id: string;
|
|
2689
|
+
query: string;
|
|
2690
|
+
queryArgsCBOR: Uint8Array | null;
|
|
2691
|
+
};
|
|
2692
|
+
/**
|
|
2693
|
+
* Create a subscription to receive updates from remote peers about documents
|
|
2694
|
+
* matching the subscription's query.
|
|
2695
|
+
*
|
|
2696
|
+
* The subscription will remain active until {@link cancel | cancel()} is called
|
|
2697
|
+
* or the subscription object goes out of scope and is garbage collected.
|
|
2698
|
+
*
|
|
2699
|
+
* @internal
|
|
2700
|
+
*/
|
|
2701
|
+
declare class ExperimentalSubscription {
|
|
2702
|
+
/**
|
|
2703
|
+
* Documents matching this query will be included in the subscription.
|
|
2704
|
+
*/
|
|
2705
|
+
readonly query: string;
|
|
2706
|
+
/**
|
|
2707
|
+
* `true` when {@link cancel | cancel()} has been called or the Ditto instance
|
|
2708
|
+
* managing this subscription has been closed.
|
|
2709
|
+
*/
|
|
2710
|
+
readonly isCancelled = false;
|
|
2711
|
+
/**
|
|
2712
|
+
* Cancels a subscription and releases all associated resources.
|
|
2713
|
+
*/
|
|
2714
|
+
cancel(): void;
|
|
2715
|
+
/** @internal */
|
|
2716
|
+
constructor(manager: ExperimentalSubscriptionManager, query: string, queryArgsCBOR: Uint8Array | null);
|
|
2717
|
+
/** @internal */
|
|
2718
|
+
contextInfo: ExperimentalSubscriptionContextInfo;
|
|
2719
|
+
/**
|
|
2720
|
+
* The corresponding named arguments for {@link query}, if any.
|
|
2721
|
+
*
|
|
2722
|
+
* @internal
|
|
2723
|
+
*/
|
|
2724
|
+
readonly queryArgsCBOR: Uint8Array | null;
|
|
2725
|
+
/** @internal */
|
|
2726
|
+
private manager;
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2602
2729
|
/**
|
|
2603
2730
|
* An addon for the Ditto store that contains experimental features. Accessible
|
|
2604
2731
|
* on `ditto.store.experimental`.
|
|
@@ -2613,22 +2740,37 @@ declare class ExperimentalStore {
|
|
|
2613
2740
|
readonly ditto: Ditto;
|
|
2614
2741
|
/** @internal */
|
|
2615
2742
|
constructor(ditto: Ditto);
|
|
2743
|
+
/** @internal */
|
|
2744
|
+
close(): void;
|
|
2616
2745
|
/**
|
|
2617
2746
|
* Executes the given query in the local store and returns the result.
|
|
2618
2747
|
*
|
|
2619
2748
|
* Limitations:
|
|
2620
2749
|
*
|
|
2621
|
-
* -
|
|
2622
|
-
*
|
|
2750
|
+
* - Supports `SELECT * FROM <collection name>` with optional `WHERE
|
|
2751
|
+
* <expression>`
|
|
2752
|
+
* - No query parameters as function arguments yet
|
|
2623
2753
|
* - No transactions
|
|
2624
2754
|
*
|
|
2625
2755
|
* @internal
|
|
2626
2756
|
* @param query a Ditto Query Language query string
|
|
2627
2757
|
* @returns a promise for an array of Ditto documents matching the query
|
|
2628
|
-
|
|
2758
|
+
*/
|
|
2629
2759
|
execute(query: string): Promise<Document[]>;
|
|
2630
|
-
/**
|
|
2631
|
-
|
|
2760
|
+
/**
|
|
2761
|
+
* Subscribes the device to updates specified by a DQL query to collections
|
|
2762
|
+
* that other devices know about.
|
|
2763
|
+
*
|
|
2764
|
+
* The returned {@link ExperimentalSubscription} object must be kept in scope
|
|
2765
|
+
* for as long as you want to keep receiving updates.
|
|
2766
|
+
*
|
|
2767
|
+
* @internal
|
|
2768
|
+
* @param query a Ditto Query Language query string of the form SELECT * FROM
|
|
2769
|
+
* collection WHERE expression
|
|
2770
|
+
* @returns {@link ExperimentalSubscription} object
|
|
2771
|
+
*/
|
|
2772
|
+
subscribe(query: string): ExperimentalSubscription;
|
|
2773
|
+
private subscriptionManager;
|
|
2632
2774
|
}
|
|
2633
2775
|
|
|
2634
2776
|
/**
|
|
@@ -3009,7 +3151,8 @@ declare abstract class BasePendingCursorOperation implements PromiseLike<Documen
|
|
|
3009
3151
|
*
|
|
3010
3152
|
* Use this in testing to ensure that all objects are properly garbage collected at the end of tests.
|
|
3011
3153
|
*
|
|
3012
|
-
* @returns an object with a key per bridge type,
|
|
3154
|
+
* @returns an object with a key per bridge type, set to the count of registered
|
|
3155
|
+
* objects.
|
|
3013
3156
|
*/
|
|
3014
3157
|
declare function getBridgeLoad(): {
|
|
3015
3158
|
[bridgeName: string]: number;
|
|
@@ -3023,5 +3166,5 @@ declare class CBOR {
|
|
|
3023
3166
|
static decode(data: Uint8Array): any;
|
|
3024
3167
|
}
|
|
3025
3168
|
|
|
3026
|
-
export { Address, Attachment, AttachmentFetchEvent, AttachmentFetchEventCompleted, AttachmentFetchEventDeleted, AttachmentFetchEventProgress, AttachmentFetchEventType, AttachmentFetcher, AttachmentToken, AuthenticationHandler, AuthenticationStatus, Authenticator, BasePendingCursorOperation, BasePendingIDSpecificOperation, CBOR, Collection, CollectionInterface, CollectionsEvent, CollectionsEventParams, CollectionsObservationHandler, ConditionSource, Connection, ConnectionType, Counter, CustomLogCallback, Ditto, Document, DocumentID, DocumentIDValue, DocumentPath, DocumentValue, ExperimentalStore, Identity, IdentityManual, IdentityOfflinePlayground, IdentityOnlinePlayground, IdentityOnlineWithAuthentication, IdentitySharedKey, IdentityTypesRequiringOfflineLicenseToken, InitOptions, KeepAlive, LiveQuery, LiveQueryEvent, LiveQueryEventInitial, LiveQueryEventUpdate, LiveQueryEventUpdateParams, LiveQueryMove, LogLevel, Logger, MutableCounter, MutableDocument, MutableDocumentPath, MutableRegister, NotAvailableAuthenticator, Observer, ObserverOptions, OnlineAuthenticator, Peer, PendingCollectionsOperation, PendingCursorOperation, PendingIDSpecificOperation, Presence, PresenceConnectionType, PresenceGraph, QueryArguments, QueryObservationHandler, Register, RemotePeer, SingleDocumentLiveQueryEvent, SingleObservationHandler, SortDirection, Store, Subscription, TransportCondition, TransportConfig, TransportConfigConnect, TransportConfigGlobal, TransportConfigLan, TransportConfigListen, TransportConfigListenHTTP, TransportConfigListenTCP, TransportConfigPeerToPeer, UpdateResult, UpdateResultType, UpdateResultsMap, UpsertOptions, Value, WebAssemblyModule, WriteStrategy, WriteTransaction, WriteTransactionCollection, WriteTransactionPendingCursorOperation, WriteTransactionPendingIDSpecificOperation, WriteTransactionResult, addressToString, checkAPIs, getBridgeLoad, init, validateDocumentIDCBOR, validateDocumentIDValue };
|
|
3169
|
+
export { Address, Attachment, AttachmentFetchEvent, AttachmentFetchEventCompleted, AttachmentFetchEventDeleted, AttachmentFetchEventProgress, AttachmentFetchEventType, AttachmentFetcher, AttachmentToken, AuthenticationHandler, AuthenticationStatus, Authenticator, BasePendingCursorOperation, BasePendingIDSpecificOperation, CBOR, Collection, CollectionInterface, CollectionsEvent, CollectionsEventParams, CollectionsObservationHandler, ConditionSource, Connection, ConnectionType, Counter, CustomLogCallback, Ditto, Document, DocumentID, DocumentIDValue, DocumentPath, DocumentValue, ExperimentalStore, ExperimentalSubscription, ExperimentalSubscriptionContextInfo, ExperimentalSubscriptionManager, Identity, IdentityManual, IdentityOfflinePlayground, IdentityOnlinePlayground, IdentityOnlineWithAuthentication, IdentitySharedKey, IdentityTypesRequiringOfflineLicenseToken, InitOptions, KeepAlive, LiveQuery, LiveQueryEvent, LiveQueryEventInitial, LiveQueryEventUpdate, LiveQueryEventUpdateParams, LiveQueryMove, LogLevel, Logger, MutableCounter, MutableDocument, MutableDocumentPath, MutableRegister, NotAvailableAuthenticator, Observer, ObserverOptions, OnlineAuthenticator, Peer, PendingCollectionsOperation, PendingCursorOperation, PendingIDSpecificOperation, Presence, PresenceConnectionType, PresenceGraph, QueryArguments, QueryObservationHandler, Register, RemotePeer, SingleDocumentLiveQueryEvent, SingleObservationHandler, SortDirection, Store, Subscription, TransportCondition, TransportConfig, TransportConfigConnect, TransportConfigGlobal, TransportConfigLan, TransportConfigListen, TransportConfigListenHTTP, TransportConfigListenTCP, TransportConfigPeerToPeer, UpdateResult, UpdateResultType, UpdateResultsMap, UpsertOptions, Value, WebAssemblyModule, WriteStrategy, WriteTransaction, WriteTransactionCollection, WriteTransactionPendingCursorOperation, WriteTransactionPendingIDSpecificOperation, WriteTransactionResult, addressToString, checkAPIs, disableDeadlockTimeoutWhenDebugging, getBridgeLoad, init, validateDocumentIDCBOR, validateDocumentIDValue };
|
|
3027
3170
|
//# sourceMappingURL=ditto.d.ts.map
|