@dittolive/ditto 3.0.0 → 3.0.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.
- package/README.md +2 -2
- package/node/ditto.cjs.js +275 -289
- 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 +2 -2
- package/types/ditto.d.ts +55 -38
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
|
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": "3.0.
|
|
3
|
+
"version": "3.0.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",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"serve": "^14.
|
|
48
|
+
"serve": "^14.1.2"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/types/ditto.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Describes the direction when sorting a query.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type SortDirection = 'ascending' | 'descending';
|
|
5
5
|
/**
|
|
6
6
|
* Defines the various strategies available when inserting a document into a
|
|
7
7
|
* collection.
|
|
@@ -21,37 +21,37 @@ declare type SortDirection = 'ascending' | 'descending';
|
|
|
21
21
|
* data amongst all peers and that you expect to be mutated or overwritten in
|
|
22
22
|
* due course.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
type WriteStrategy = 'merge' | 'insertIfAbsent' | 'insertDefaultIfAbsent';
|
|
25
25
|
/**
|
|
26
26
|
* Represents a dictionary of values to be incorporated into a query keyed
|
|
27
27
|
* by the placeholder used within that query. See method
|
|
28
28
|
* {@link Collection.find | find()} of {@link Collection} for more info.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
type QueryArguments = {
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/** @internal */
|
|
35
|
-
|
|
35
|
+
type Pointer<Type> = {
|
|
36
36
|
type: Type;
|
|
37
37
|
addr: string;
|
|
38
38
|
};
|
|
39
39
|
/** @internal */
|
|
40
|
-
|
|
40
|
+
type FFIAuthClient = 'CAuthClient_t';
|
|
41
41
|
/** @internal */
|
|
42
|
-
|
|
42
|
+
type OrderBy = {
|
|
43
43
|
query: string;
|
|
44
44
|
direction: 'Ascending' | 'Descending';
|
|
45
45
|
};
|
|
46
46
|
/** @internal */
|
|
47
|
-
|
|
47
|
+
type PathAccessorType = 'String' | 'Number' | 'Int' | 'UInt' | 'Float' | 'Double' | 'Bool' | 'Null' | 'Object' | 'Array' | 'Any' | 'Counter' | 'Register' | 'Attachment' | 'Rga' | 'RWMap';
|
|
48
48
|
/** Various options to pass the web assembly module to Ditto. */
|
|
49
|
-
|
|
49
|
+
type WebAssemblyModule = RequestInfo | URL | Response | BufferSource | WebAssembly.Module | string | null;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Available options for {@link init | init()}.
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
type InitOptions = {
|
|
55
55
|
/**
|
|
56
56
|
* You can explicitly pass the WebAssembly module or its location via the
|
|
57
57
|
* `webAssemblyModule` option. By default, Ditto tries to load the WebAssembly
|
|
@@ -165,6 +165,23 @@ interface TransportConfigGlobal {
|
|
|
165
165
|
* Ditto's permissions system.
|
|
166
166
|
*/
|
|
167
167
|
syncGroup: number;
|
|
168
|
+
/**
|
|
169
|
+
* The routing hint for this device.
|
|
170
|
+
*
|
|
171
|
+
* A routing hint is a performance tuning option which can improve the performance of
|
|
172
|
+
* applications that use large collections. Ditto will make a best effort to co-locate data for
|
|
173
|
+
* the same routing key. In most circumstances, this should substantially improve responsiveness
|
|
174
|
+
* of the Ditto Cloud.
|
|
175
|
+
*
|
|
176
|
+
* The value of the routing hint is application specific - you are free to chose any value.
|
|
177
|
+
* Devices which you expect to operate on much the same data should be configured to
|
|
178
|
+
* use the same value.
|
|
179
|
+
*
|
|
180
|
+
* A routing hint does not partition data. The value of the routing hint will not affect the data
|
|
181
|
+
* returned for a query. The routing hint only improves the efficiency of the Cloud's
|
|
182
|
+
* ability to satisfy the query.
|
|
183
|
+
*/
|
|
184
|
+
routingHint: number;
|
|
168
185
|
}
|
|
169
186
|
/**
|
|
170
187
|
* A configuration object specifying which network transports Ditto should
|
|
@@ -367,7 +384,7 @@ interface IdentityOnlineWithAuthentication {
|
|
|
367
384
|
* The various identity configurations that you can use when initializing a
|
|
368
385
|
* `Ditto` instance.
|
|
369
386
|
*/
|
|
370
|
-
|
|
387
|
+
type Identity = IdentityOfflinePlayground | IdentitySharedKey | IdentityManual | IdentityOnlinePlayground | IdentityOnlineWithAuthentication;
|
|
371
388
|
/** The list of identity types that require activation through an offlineLicenseToken */
|
|
372
389
|
declare const IdentityTypesRequiringOfflineLicenseToken: string[];
|
|
373
390
|
|
|
@@ -426,7 +443,7 @@ declare class Bridge<JSClass extends object, FFIType> {
|
|
|
426
443
|
}
|
|
427
444
|
|
|
428
445
|
/** Represents a unique identifier for a {@link Document}. */
|
|
429
|
-
|
|
446
|
+
type DocumentIDValue = any;
|
|
430
447
|
/** Represents a unique identifier for a {@link Document}. */
|
|
431
448
|
declare class DocumentID {
|
|
432
449
|
/**
|
|
@@ -509,7 +526,7 @@ declare function validateDocumentIDCBOR(idCBOR: Uint8Array): Uint8Array;
|
|
|
509
526
|
/**
|
|
510
527
|
* The types of an {@link UpdateResult}.
|
|
511
528
|
*/
|
|
512
|
-
|
|
529
|
+
type UpdateResultType = 'set' | 'incremented' | 'removed';
|
|
513
530
|
declare class UpdateResult {
|
|
514
531
|
/** The update result's type. */
|
|
515
532
|
readonly type: UpdateResultType;
|
|
@@ -822,7 +839,7 @@ declare class MutableDocumentPath {
|
|
|
822
839
|
* A document value is a JavaScript object containing values for keys that
|
|
823
840
|
* can be serialized via CBOR.
|
|
824
841
|
*/
|
|
825
|
-
|
|
842
|
+
type DocumentValue = Record<string, any>;
|
|
826
843
|
/** A document belonging to a {@link Collection} with an inner value. */
|
|
827
844
|
declare class Document {
|
|
828
845
|
/**
|
|
@@ -938,11 +955,11 @@ declare const attachmentBridge: Bridge<Attachment, "AttachmentHandle_t">;
|
|
|
938
955
|
* The types of attachment fetch events that can be delivered to an attachment
|
|
939
956
|
* fetcher's `callback`.
|
|
940
957
|
*/
|
|
941
|
-
|
|
958
|
+
type AttachmentFetchEventType = 'Completed' | 'Progress' | 'Deleted';
|
|
942
959
|
/**
|
|
943
960
|
* An attachment fetch event used when the attachment's download has completed.
|
|
944
961
|
*/
|
|
945
|
-
|
|
962
|
+
type AttachmentFetchEventCompleted = {
|
|
946
963
|
type: 'Completed';
|
|
947
964
|
attachment: Attachment;
|
|
948
965
|
};
|
|
@@ -950,7 +967,7 @@ declare type AttachmentFetchEventCompleted = {
|
|
|
950
967
|
* An attachment fetch event used when the attachment's download progressed but
|
|
951
968
|
* is not yet complete.
|
|
952
969
|
*/
|
|
953
|
-
|
|
970
|
+
type AttachmentFetchEventProgress = {
|
|
954
971
|
type: 'Progress';
|
|
955
972
|
totalBytes: number | BigInt;
|
|
956
973
|
downloadedBytes: number | BigInt;
|
|
@@ -958,7 +975,7 @@ declare type AttachmentFetchEventProgress = {
|
|
|
958
975
|
/**
|
|
959
976
|
* An attachment fetch event used when the attachment is deleted.
|
|
960
977
|
*/
|
|
961
|
-
|
|
978
|
+
type AttachmentFetchEventDeleted = {
|
|
962
979
|
type: 'Deleted';
|
|
963
980
|
};
|
|
964
981
|
/**
|
|
@@ -977,7 +994,7 @@ declare type AttachmentFetchEventDeleted = {
|
|
|
977
994
|
* {@link Collection.fetchAttachment | fetchAttachment()} on a
|
|
978
995
|
* {@link Collection} instance.
|
|
979
996
|
*/
|
|
980
|
-
|
|
997
|
+
type AttachmentFetchEvent = AttachmentFetchEventCompleted | AttachmentFetchEventProgress | AttachmentFetchEventDeleted;
|
|
981
998
|
|
|
982
999
|
/**
|
|
983
1000
|
* These objects are returned by calls to
|
|
@@ -1228,7 +1245,7 @@ declare class LiveQueryEventUpdate {
|
|
|
1228
1245
|
* Represents events delivered by a {@link LiveQuery}, which can be initial
|
|
1229
1246
|
* (fired immediately upon registration) or an update (all subsequent events).
|
|
1230
1247
|
*/
|
|
1231
|
-
|
|
1248
|
+
type LiveQueryEvent = LiveQueryEventInitial | LiveQueryEventUpdate;
|
|
1232
1249
|
/**
|
|
1233
1250
|
* Provides information about a live query event relating to a single document
|
|
1234
1251
|
* live query.
|
|
@@ -1257,7 +1274,7 @@ declare class SingleDocumentLiveQueryEvent {
|
|
|
1257
1274
|
* The closure that is called whenever the documents covered by a live query
|
|
1258
1275
|
* change.
|
|
1259
1276
|
*/
|
|
1260
|
-
|
|
1277
|
+
type QueryObservationHandler = (documents: Document[], event: LiveQueryEvent, signalNext?: () => void) => void | Promise<void>;
|
|
1261
1278
|
/**
|
|
1262
1279
|
* These objects are returned when using `find`-like functionality on
|
|
1263
1280
|
* {@link Collection}.
|
|
@@ -1454,7 +1471,7 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1454
1471
|
* The closure that is called whenever a single documunent covered by a
|
|
1455
1472
|
* live query changes.
|
|
1456
1473
|
*/
|
|
1457
|
-
|
|
1474
|
+
type SingleObservationHandler = (document: Document | null, event: SingleDocumentLiveQueryEvent, signalNext?: () => void) => void | Promise<void>;
|
|
1458
1475
|
/**
|
|
1459
1476
|
* These objects are returned when using {@link Collection.findByID | findByID()}
|
|
1460
1477
|
* functionality on {@link Collection | collections}.
|
|
@@ -1586,7 +1603,7 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1586
1603
|
private get query();
|
|
1587
1604
|
}
|
|
1588
1605
|
|
|
1589
|
-
|
|
1606
|
+
type UpsertOptions = {
|
|
1590
1607
|
writeStrategy?: WriteStrategy;
|
|
1591
1608
|
};
|
|
1592
1609
|
/**
|
|
@@ -1778,7 +1795,7 @@ declare class CollectionsEvent {
|
|
|
1778
1795
|
* The closure that is called whenever the collections covered by a live query
|
|
1779
1796
|
* change.
|
|
1780
1797
|
*/
|
|
1781
|
-
|
|
1798
|
+
type CollectionsObservationHandler = (event: CollectionsEvent, signalNext?: () => void) => void | Promise<void>;
|
|
1782
1799
|
/**
|
|
1783
1800
|
* These objects are returned when calling
|
|
1784
1801
|
* {@link Store.collections | collections()} on {@link Store}.
|
|
@@ -1947,7 +1964,7 @@ interface ObserverRemoving {
|
|
|
1947
1964
|
removeObserver(token: any): any;
|
|
1948
1965
|
}
|
|
1949
1966
|
/** @internal */
|
|
1950
|
-
|
|
1967
|
+
type ObserverOptions = {
|
|
1951
1968
|
stopsWhenFinalized?: boolean;
|
|
1952
1969
|
};
|
|
1953
1970
|
/**
|
|
@@ -1979,7 +1996,7 @@ declare class Observer {
|
|
|
1979
1996
|
}
|
|
1980
1997
|
|
|
1981
1998
|
/** Types of connections that can be established between two peers. */
|
|
1982
|
-
|
|
1999
|
+
type ConnectionType = 'P2PWiFi' | 'WebSocket' | 'AccessPoint' | 'Bluetooth';
|
|
1983
2000
|
/**
|
|
1984
2001
|
* An opaque address uniquely identifying another peer on the Ditto mesh
|
|
1985
2002
|
* network.
|
|
@@ -1989,7 +2006,7 @@ declare type ConnectionType = 'P2PWiFi' | 'WebSocket' | 'AccessPoint' | 'Bluetoo
|
|
|
1989
2006
|
* {@link addressToString | addressToString()} to compare individual addresses
|
|
1990
2007
|
* with each other.
|
|
1991
2008
|
*/
|
|
1992
|
-
|
|
2009
|
+
type Address = {
|
|
1993
2010
|
siteId: string;
|
|
1994
2011
|
pubkey: Uint8Array;
|
|
1995
2012
|
};
|
|
@@ -2000,7 +2017,7 @@ declare type Address = {
|
|
|
2000
2017
|
*/
|
|
2001
2018
|
declare function addressToString(address: Address): string;
|
|
2002
2019
|
/** Represents a connection between two peers on the Ditto mesh network. */
|
|
2003
|
-
|
|
2020
|
+
type Connection = {
|
|
2004
2021
|
/** Unique identifier for the connection. */
|
|
2005
2022
|
id: string;
|
|
2006
2023
|
/** Type of transport enabling this connection. */
|
|
@@ -2012,7 +2029,7 @@ declare type Connection = {
|
|
|
2012
2029
|
approximateDistanceInMeters?: number;
|
|
2013
2030
|
};
|
|
2014
2031
|
/** An instance of Ditto taking part in the Ditto mesh network. */
|
|
2015
|
-
|
|
2032
|
+
type Peer = {
|
|
2016
2033
|
/**
|
|
2017
2034
|
* Address to contact this peer via Ditto Bus, unique with a Ditto mesh
|
|
2018
2035
|
* network.
|
|
@@ -2042,7 +2059,7 @@ declare type Peer = {
|
|
|
2042
2059
|
* other. The `localPeer` is the entry point, all others are remote peers known
|
|
2043
2060
|
* by the local peer (either directly or via other remote peers).
|
|
2044
2061
|
*/
|
|
2045
|
-
|
|
2062
|
+
type PresenceGraph = {
|
|
2046
2063
|
/**
|
|
2047
2064
|
* Returns the local peer (usually the peer that is represented by the
|
|
2048
2065
|
* currently running Ditto instance). The `localPeer` is the entry point, all
|
|
@@ -2092,19 +2109,19 @@ declare class Presence {
|
|
|
2092
2109
|
}
|
|
2093
2110
|
|
|
2094
2111
|
/** Types of connections that can be established between two peers. */
|
|
2095
|
-
|
|
2112
|
+
type TransportCondition = 'Unknown' | 'OK' | 'GenericFailure' | 'AppInBackground' | 'MDNSFailure' | 'TCPListenFailure' | 'NoBLECentralPermission' | 'NoBLEPeripheralPermission' | 'CannotEstablishConnection' | 'BLEDisabled' | 'NoBLEHardware' | 'WiFiDisabled' | 'TemporarilyUnavailable';
|
|
2096
2113
|
/** The source for a transport condition. */
|
|
2097
|
-
|
|
2114
|
+
type ConditionSource = 'BLE' | 'TCP' | 'AWDL' | 'MDNS';
|
|
2098
2115
|
/**
|
|
2099
2116
|
* Types of connections that can be established between two peers.
|
|
2100
2117
|
* @deprecated replaced by {@link ConnectionType}.
|
|
2101
2118
|
*/
|
|
2102
|
-
|
|
2119
|
+
type PresenceConnectionType = 'WiFi' | 'WebSocket' | 'AWDL' | 'BLE';
|
|
2103
2120
|
/**
|
|
2104
2121
|
* A peer object with information about an observed peer.
|
|
2105
2122
|
* @deprecated replaced by {@link Peer}.
|
|
2106
2123
|
*/
|
|
2107
|
-
|
|
2124
|
+
type RemotePeer = {
|
|
2108
2125
|
networkID: string;
|
|
2109
2126
|
deviceName: string;
|
|
2110
2127
|
rssi?: number;
|
|
@@ -2319,9 +2336,9 @@ declare class Ditto {
|
|
|
2319
2336
|
declare const dittoBridge: Bridge<Ditto, "CDitto_t">;
|
|
2320
2337
|
|
|
2321
2338
|
/** @internal */
|
|
2322
|
-
|
|
2339
|
+
type ObserverToken = string;
|
|
2323
2340
|
/** @internal */
|
|
2324
|
-
|
|
2341
|
+
type ObserverManagerConstructorOptions = {
|
|
2325
2342
|
keepAlive?: KeepAlive;
|
|
2326
2343
|
register?: (callback: (...args: any[]) => void) => void;
|
|
2327
2344
|
unregister?: () => void;
|
|
@@ -2371,7 +2388,7 @@ declare class ObserverManager {
|
|
|
2371
2388
|
/**
|
|
2372
2389
|
* Provides info about the authentication status.
|
|
2373
2390
|
*/
|
|
2374
|
-
|
|
2391
|
+
type AuthenticationStatus = {
|
|
2375
2392
|
/**
|
|
2376
2393
|
* Returns `true` if authenticated, otherwise returns `false`.
|
|
2377
2394
|
*/
|
|
@@ -2504,12 +2521,12 @@ declare class Value {
|
|
|
2504
2521
|
}
|
|
2505
2522
|
|
|
2506
2523
|
/** The log levels supported by Ditto. */
|
|
2507
|
-
|
|
2524
|
+
type LogLevel = 'Error' | 'Warning' | 'Info' | 'Debug' | 'Verbose';
|
|
2508
2525
|
/**
|
|
2509
2526
|
* Closure that {@link Logger.setCustomLogCallback} can be set as a custom
|
|
2510
2527
|
* log callback on {@link Logger}.
|
|
2511
2528
|
*/
|
|
2512
|
-
|
|
2529
|
+
type CustomLogCallback = (logLevel: LogLevel, message: string) => void;
|
|
2513
2530
|
/**
|
|
2514
2531
|
* Class with static methods to customize the logging behavior from Ditto and
|
|
2515
2532
|
* log messages with the Ditto logging infrastructure.
|