@dittolive/ditto 4.7.0-rc.1 → 4.7.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 +14 -16
- 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-arm64.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/react-native/android/.project +34 -0
- package/react-native/android/bin/.project +34 -0
- package/react-native/android/bin/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.class +0 -0
- package/react-native/android/bin/src/main/java/com/dittolive/rnsdk/DittoRNSDKPackage.class +0 -0
- package/react-native/android/build/intermediates/cxx/abi_configuration_4i3a4k2a.json +14 -0
- package/react-native/android/build/intermediates/cxx/abi_configuration_4i3a4k2a.log +1 -0
- package/react-native/android/build/intermediates/cxx/abi_configuration_4i3a4k2a_key.json +23 -0
- package/react-native/android/build/intermediates/cxx/create_cxx_tasks_371_timing.txt +5 -0
- package/react-native/android/build/intermediates/cxx/ndk_locator_record_4q2c3f1f.json +11 -0
- package/react-native/android/build/intermediates/cxx/ndk_locator_record_4q2c3f1f.log +72 -0
- package/react-native/android/build/intermediates/cxx/ndk_locator_record_4q2c3f1f_key.json +10 -0
- package/react-native/android/build.gradle +1 -1
- package/react-native/cpp/include/ConnectionRequest.h +1 -1
- package/react-native/cpp/src/ConnectionRequest.cpp +1 -1
- package/react-native/cpp/src/main.cpp +1 -1
- package/react-native/src/sources/connection-request.ts +7 -4
- package/react-native/src/sources/presence.ts +5 -5
- package/react-native/src/sources/store-observer.ts +3 -12
- package/react-native/src/sources/store.ts +1 -9
- package/react-native/src/sources/sync.ts +1 -2
- package/types/ditto.d.ts +12 -4
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
- package/node/ditto.cjs.js.map +0 -1
- package/node/ditto.cjs.pretty.js +0 -10563
- package/node/ditto.cjs.pretty.js.map +0 -1
- package/types/ditto.d.ts.map +0 -1
- package/web/ditto.es6.js.map +0 -1
- package/web/ditto.es6.pretty.js +0 -13516
- package/web/ditto.es6.pretty.js.map +0 -1
- package/web/ditto.umd.js.map +0 -1
- package/web/ditto.umd.pretty.js +0 -13586
- package/web/ditto.umd.pretty.js.map +0 -1
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.7.0
|
|
6
|
+
Version: **4.7.0**
|
|
7
7
|
|
|
8
8
|
For more information please visit [ditto.live](https://ditto.live), as well as the
|
|
9
|
-
[API Reference](https://software.ditto.live/js/Ditto/4.7.0
|
|
9
|
+
[API Reference](https://software.ditto.live/js/Ditto/4.7.0/api-reference/) for this particular version.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
package/node/ditto.cjs.js
CHANGED
|
@@ -2218,7 +2218,7 @@ class AttachmentToken {
|
|
|
2218
2218
|
|
|
2219
2219
|
// NOTE: this is patched up with the actual build version by Jake task
|
|
2220
2220
|
// build:package and has to be a valid semantic version as defined here: https://semver.org.
|
|
2221
|
-
const fullBuildVersionString = '4.7.0
|
|
2221
|
+
const fullBuildVersionString = '4.7.0';
|
|
2222
2222
|
|
|
2223
2223
|
//
|
|
2224
2224
|
// Copyright © 2021 DittoLive Incorporated. All rights reserved.
|
|
@@ -5282,10 +5282,12 @@ class ConnectionRequest {
|
|
|
5282
5282
|
/**
|
|
5283
5283
|
* Metadata associated with the remote peer.
|
|
5284
5284
|
*
|
|
5285
|
-
* This is an empty object if the remote peer has not set any metadata
|
|
5285
|
+
* This is an empty object if the remote peer has not set any metadata, or
|
|
5286
|
+
* when this request is for a WebSocket connection (which does not currently
|
|
5287
|
+
* support peer metadata).
|
|
5286
5288
|
*
|
|
5287
|
-
* Set peer metadata for the local peer using {@link Presence.peerMetadata}
|
|
5288
|
-
*
|
|
5289
|
+
* Set peer metadata for the local peer using {@link Presence.peerMetadata} or
|
|
5290
|
+
* {@link Presence.peerMetadataJSONString}.
|
|
5289
5291
|
*
|
|
5290
5292
|
* This is a convenience property that wraps
|
|
5291
5293
|
* {@link peerMetadataJSONString | `peerMetadataJSONString()`}.
|
|
@@ -5297,7 +5299,8 @@ class ConnectionRequest {
|
|
|
5297
5299
|
* JSON-encoded metadata associated with the remote peer.
|
|
5298
5300
|
*
|
|
5299
5301
|
* This is a JSON string representing an empty dictionary if the remote peer
|
|
5300
|
-
* has not set any metadata
|
|
5302
|
+
* has not set any metadata or when this request is for a WebSocket
|
|
5303
|
+
* connection.
|
|
5301
5304
|
*
|
|
5302
5305
|
* Set peer metadata for the local peer using {@link Presence.peerMetadata} or
|
|
5303
5306
|
* {@link Presence.peerMetadataJSONString}.
|
|
@@ -7080,13 +7083,9 @@ class StoreObserver {
|
|
|
7080
7083
|
strongThis.signalNext();
|
|
7081
7084
|
});
|
|
7082
7085
|
}
|
|
7083
|
-
const errorContext = {
|
|
7084
|
-
query,
|
|
7085
|
-
queryArguments,
|
|
7086
|
-
};
|
|
7087
7086
|
mapFFIErrors(() => {
|
|
7088
7087
|
storeObserverID = tryExperimentalRegisterChangeObserver(dittoHandle.deref(), query, queryArgumentsCBOR, wrappedObservationHandler);
|
|
7089
|
-
}
|
|
7088
|
+
});
|
|
7090
7089
|
});
|
|
7091
7090
|
if (storeObserverID == null) {
|
|
7092
7091
|
throw new DittoError('internal', 'Internal inconsistency, store observer ID is undefined after registering');
|
|
@@ -7811,9 +7810,8 @@ class Store {
|
|
|
7811
7810
|
throw new DittoError('query/arguments-invalid', `Unable to encode query arguments: ${error.message}`);
|
|
7812
7811
|
}
|
|
7813
7812
|
}
|
|
7814
|
-
const errorContext = { query, queryArguments };
|
|
7815
7813
|
// prettier-ignore
|
|
7816
|
-
const queryResultPointer = await mapFFIErrorsAsync(async () => await performAsyncToWorkaroundNonAsyncFFIAPI(() => tryExecStatement(dittoHandle.deref(), writeTransaction, query, queryArgumentsCBOR))
|
|
7814
|
+
const queryResultPointer = await mapFFIErrorsAsync(async () => await performAsyncToWorkaroundNonAsyncFFIAPI(() => tryExecStatement(dittoHandle.deref(), writeTransaction, query, queryArgumentsCBOR)));
|
|
7817
7815
|
return Bridge.queryResult.bridge(queryResultPointer, () => new QueryResult(queryResultPointer));
|
|
7818
7816
|
});
|
|
7819
7817
|
}
|
|
@@ -8062,11 +8060,10 @@ class Store {
|
|
|
8062
8060
|
throw new DittoError('query/arguments-invalid', `Invalid query arguments: ${error.message}`);
|
|
8063
8061
|
}
|
|
8064
8062
|
}
|
|
8065
|
-
const errorContext = { query, queryArguments };
|
|
8066
8063
|
const dittoHandle = Bridge.ditto.handleFor(this.ditto);
|
|
8067
8064
|
// prettier-ignore
|
|
8068
8065
|
return this.ditto.deferCloseAsync(async () => {
|
|
8069
|
-
const webhookIDCBOR = await mapFFIErrorsAsync(async () => await tryRegisterStoreObserverWebhook(dittoHandle.deref(), query, queryArgumentsCBOR, url)
|
|
8066
|
+
const webhookIDCBOR = await mapFFIErrorsAsync(async () => await tryRegisterStoreObserverWebhook(dittoHandle.deref(), query, queryArgumentsCBOR, url));
|
|
8070
8067
|
return new DocumentID(webhookIDCBOR, true);
|
|
8071
8068
|
});
|
|
8072
8069
|
}
|
|
@@ -8260,6 +8257,8 @@ class Presence {
|
|
|
8260
8257
|
* and when evaluating connection requests using
|
|
8261
8258
|
* {@link connectionRequestHandler | connectionRequestHandler()}.
|
|
8262
8259
|
*
|
|
8260
|
+
* This is not made available to peers only connected via WebSocket.
|
|
8261
|
+
*
|
|
8263
8262
|
* Uses UTF-8 encoding.
|
|
8264
8263
|
*
|
|
8265
8264
|
* @see {@link peerMetadata | peerMetadata()} for a convenience property that
|
|
@@ -8795,10 +8794,9 @@ class Sync {
|
|
|
8795
8794
|
throw new DittoError('query/arguments-invalid', `Unable to encode query arguments: ${error.message}`);
|
|
8796
8795
|
}
|
|
8797
8796
|
}
|
|
8798
|
-
const errorContext = { query, queryArguments };
|
|
8799
8797
|
const dittoHandle = Bridge.ditto.handleFor(this.ditto);
|
|
8800
8798
|
this.ditto.deferClose(() => {
|
|
8801
|
-
mapFFIErrors(() => tryAddSyncSubscription(dittoHandle.deref(), query, queryArgumentsCBOR)
|
|
8799
|
+
mapFFIErrors(() => tryAddSyncSubscription(dittoHandle.deref(), query, queryArgumentsCBOR));
|
|
8802
8800
|
});
|
|
8803
8801
|
const subscription = new SyncSubscription(this.ditto, query, queryArguments || null, queryArgumentsCBOR);
|
|
8804
8802
|
// @ts-expect-error modifying readonly property
|
|
Binary file
|
|
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.7.0
|
|
3
|
+
"version": "4.7.0",
|
|
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",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>dittolive_ditto</name>
|
|
4
|
+
<comment>Project dittolive_ditto created by Buildship.</comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
<buildCommand>
|
|
14
|
+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
15
|
+
<arguments>
|
|
16
|
+
</arguments>
|
|
17
|
+
</buildCommand>
|
|
18
|
+
</buildSpec>
|
|
19
|
+
<natures>
|
|
20
|
+
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
21
|
+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
22
|
+
</natures>
|
|
23
|
+
<filteredResources>
|
|
24
|
+
<filter>
|
|
25
|
+
<id>1710834642645</id>
|
|
26
|
+
<name></name>
|
|
27
|
+
<type>30</type>
|
|
28
|
+
<matcher>
|
|
29
|
+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
30
|
+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
31
|
+
</matcher>
|
|
32
|
+
</filter>
|
|
33
|
+
</filteredResources>
|
|
34
|
+
</projectDescription>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>dittolive_ditto</name>
|
|
4
|
+
<comment>Project dittolive_ditto created by Buildship.</comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
<buildCommand>
|
|
14
|
+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
15
|
+
<arguments>
|
|
16
|
+
</arguments>
|
|
17
|
+
</buildCommand>
|
|
18
|
+
</buildSpec>
|
|
19
|
+
<natures>
|
|
20
|
+
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
21
|
+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
22
|
+
</natures>
|
|
23
|
+
<filteredResources>
|
|
24
|
+
<filter>
|
|
25
|
+
<id>1710834642645</id>
|
|
26
|
+
<name></name>
|
|
27
|
+
<type>30</type>
|
|
28
|
+
<matcher>
|
|
29
|
+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
30
|
+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
31
|
+
</matcher>
|
|
32
|
+
</filter>
|
|
33
|
+
</filteredResources>
|
|
34
|
+
</projectDescription>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ndkHandlerSupportedAbis": [
|
|
3
|
+
"ARMEABI_V7A",
|
|
4
|
+
"ARM64_V8A",
|
|
5
|
+
"X86",
|
|
6
|
+
"X86_64"
|
|
7
|
+
],
|
|
8
|
+
"ndkHandlerDefaultAbis": [
|
|
9
|
+
"ARMEABI_V7A",
|
|
10
|
+
"ARM64_V8A",
|
|
11
|
+
"X86",
|
|
12
|
+
"X86_64"
|
|
13
|
+
],
|
|
14
|
+
"externalNativeBuildAbiFilters": [
|
|
15
|
+
"x86_64",
|
|
16
|
+
"x86",
|
|
17
|
+
"armeabi-v7a",
|
|
18
|
+
"arm64-v8a"
|
|
19
|
+
],
|
|
20
|
+
"ndkConfigAbiFilters": [],
|
|
21
|
+
"splitsFilterAbis": [],
|
|
22
|
+
"ideBuildOnlyTargetAbi": true
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"level_": 0,
|
|
4
|
+
"message_": "android.ndkVersion from module build.gradle is [23.1.7779620]",
|
|
5
|
+
"file_": "",
|
|
6
|
+
"tag_": "",
|
|
7
|
+
"diagnosticCode_": 0,
|
|
8
|
+
"memoizedIsInitialized": 1,
|
|
9
|
+
"unknownFields": {
|
|
10
|
+
"fields": {},
|
|
11
|
+
"fieldsDescending": {}
|
|
12
|
+
},
|
|
13
|
+
"memoizedSize": -1,
|
|
14
|
+
"memoizedHashCode": -1880541809
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"level_": 0,
|
|
18
|
+
"message_": "android.ndkPath from module build.gradle is not set",
|
|
19
|
+
"file_": "",
|
|
20
|
+
"tag_": "",
|
|
21
|
+
"diagnosticCode_": 0,
|
|
22
|
+
"memoizedIsInitialized": 1,
|
|
23
|
+
"unknownFields": {
|
|
24
|
+
"fields": {},
|
|
25
|
+
"fieldsDescending": {}
|
|
26
|
+
},
|
|
27
|
+
"memoizedSize": -1,
|
|
28
|
+
"memoizedHashCode": -71798567
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"level_": 0,
|
|
32
|
+
"message_": "ndk.dir in local.properties is not set",
|
|
33
|
+
"file_": "",
|
|
34
|
+
"tag_": "",
|
|
35
|
+
"diagnosticCode_": 0,
|
|
36
|
+
"memoizedIsInitialized": 1,
|
|
37
|
+
"unknownFields": {
|
|
38
|
+
"fields": {},
|
|
39
|
+
"fieldsDescending": {}
|
|
40
|
+
},
|
|
41
|
+
"memoizedSize": -1,
|
|
42
|
+
"memoizedHashCode": 632662626
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"level_": 0,
|
|
46
|
+
"message_": "Not considering ANDROID_NDK_HOME because support was removed after deprecation period.",
|
|
47
|
+
"file_": "",
|
|
48
|
+
"tag_": "",
|
|
49
|
+
"diagnosticCode_": 0,
|
|
50
|
+
"memoizedIsInitialized": 1,
|
|
51
|
+
"unknownFields": {
|
|
52
|
+
"fields": {},
|
|
53
|
+
"fieldsDescending": {}
|
|
54
|
+
},
|
|
55
|
+
"memoizedSize": -1,
|
|
56
|
+
"memoizedHashCode": -1799490600
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"level_": 0,
|
|
60
|
+
"message_": "sdkFolder is /Users/teodorc/Library/Android/sdk",
|
|
61
|
+
"file_": "",
|
|
62
|
+
"tag_": "",
|
|
63
|
+
"diagnosticCode_": 0,
|
|
64
|
+
"memoizedIsInitialized": 1,
|
|
65
|
+
"unknownFields": {
|
|
66
|
+
"fields": {},
|
|
67
|
+
"fieldsDescending": {}
|
|
68
|
+
},
|
|
69
|
+
"memoizedSize": -1,
|
|
70
|
+
"memoizedHashCode": 761152749
|
|
71
|
+
}
|
|
72
|
+
]
|
|
@@ -150,7 +150,7 @@ repositories {
|
|
|
150
150
|
|
|
151
151
|
// This can be moved to gradle.properties (minus the quotes) with no code changes
|
|
152
152
|
// here since `version` is a default project property.
|
|
153
|
-
version = "4.7.0
|
|
153
|
+
version = "4.7.0"
|
|
154
154
|
|
|
155
155
|
dependencies {
|
|
156
156
|
// For < 0.71, this will be from the local maven repo
|
|
@@ -9,7 +9,7 @@ namespace sharedjsi
|
|
|
9
9
|
{
|
|
10
10
|
Function dittoffi_connection_request_peer_key_string(Runtime &runtime);
|
|
11
11
|
Function dittoffi_connection_request_peer_metadata_json(Runtime &runtime);
|
|
12
|
-
Function
|
|
12
|
+
Function dittoffi_connection_request_identity_service_metadata_json(Runtime &runtime);
|
|
13
13
|
Function dittoffi_connection_request_authorize(Runtime &runtime);
|
|
14
14
|
Function dittoffi_connection_request_connection_type(Runtime &runtime);
|
|
15
15
|
Function dittoffi_connection_request_free(Runtime &runtime);
|
|
@@ -40,7 +40,7 @@ Function dittoffi_connection_request_peer_metadata_json(Runtime &runtime)
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
Function
|
|
43
|
+
Function dittoffi_connection_request_identity_service_metadata_json(Runtime &runtime)
|
|
44
44
|
{
|
|
45
45
|
return Function::createFromHostFunction(runtime,
|
|
46
46
|
PropNameID::forAscii(runtime,
|
|
@@ -148,7 +148,7 @@ namespace sharedjsi
|
|
|
148
148
|
// Connection Request
|
|
149
149
|
REGISTER_JS_FUNCTION(dittoffi_connection_request_peer_key_string);
|
|
150
150
|
REGISTER_JS_FUNCTION(dittoffi_connection_request_peer_metadata_json);
|
|
151
|
-
REGISTER_JS_FUNCTION(
|
|
151
|
+
REGISTER_JS_FUNCTION(dittoffi_connection_request_identity_service_metadata_json);
|
|
152
152
|
REGISTER_JS_FUNCTION(dittoffi_connection_request_authorize);
|
|
153
153
|
REGISTER_JS_FUNCTION(dittoffi_connection_request_free);
|
|
154
154
|
REGISTER_JS_FUNCTION(dittoffi_connection_request_connection_type);
|
|
@@ -52,10 +52,12 @@ export class ConnectionRequest {
|
|
|
52
52
|
/**
|
|
53
53
|
* Metadata associated with the remote peer.
|
|
54
54
|
*
|
|
55
|
-
* This is an empty object if the remote peer has not set any metadata
|
|
55
|
+
* This is an empty object if the remote peer has not set any metadata, or
|
|
56
|
+
* when this request is for a WebSocket connection (which does not currently
|
|
57
|
+
* support peer metadata).
|
|
56
58
|
*
|
|
57
|
-
* Set peer metadata for the local peer using {@link Presence.peerMetadata}
|
|
58
|
-
*
|
|
59
|
+
* Set peer metadata for the local peer using {@link Presence.peerMetadata} or
|
|
60
|
+
* {@link Presence.peerMetadataJSONString}.
|
|
59
61
|
*
|
|
60
62
|
* This is a convenience property that wraps
|
|
61
63
|
* {@link peerMetadataJSONString | `peerMetadataJSONString()`}.
|
|
@@ -68,7 +70,8 @@ export class ConnectionRequest {
|
|
|
68
70
|
* JSON-encoded metadata associated with the remote peer.
|
|
69
71
|
*
|
|
70
72
|
* This is a JSON string representing an empty dictionary if the remote peer
|
|
71
|
-
* has not set any metadata
|
|
73
|
+
* has not set any metadata or when this request is for a WebSocket
|
|
74
|
+
* connection.
|
|
72
75
|
*
|
|
73
76
|
* Set peer metadata for the local peer using {@link Presence.peerMetadata} or
|
|
74
77
|
* {@link Presence.peerMetadataJSONString}.
|
|
@@ -119,6 +119,9 @@ export type Peer = {
|
|
|
119
119
|
* Use `ditto.presence.setPeerMetadata()` or
|
|
120
120
|
* `ditto.presence.setPeerMetadataJSONData()` to set this value.
|
|
121
121
|
*
|
|
122
|
+
* This will be empty when a peer is only connected via a WebSocket
|
|
123
|
+
* connection.
|
|
124
|
+
*
|
|
122
125
|
* @see {@link Presence.peerMetadata | `ditto.presence.peerMetadata`} for
|
|
123
126
|
* details on usage of metadata.
|
|
124
127
|
*/
|
|
@@ -284,6 +287,8 @@ export class Presence {
|
|
|
284
287
|
* and when evaluating connection requests using
|
|
285
288
|
* {@link connectionRequestHandler | connectionRequestHandler()}.
|
|
286
289
|
*
|
|
290
|
+
* This is not made available to peers only connected via WebSocket.
|
|
291
|
+
*
|
|
287
292
|
* Uses UTF-8 encoding.
|
|
288
293
|
*
|
|
289
294
|
* @see {@link peerMetadata | peerMetadata()} for a convenience property that
|
|
@@ -375,11 +380,6 @@ export class Presence {
|
|
|
375
380
|
const observerToken = this.observerManager.addObserver(didChangeHandler)
|
|
376
381
|
const observer = new Observer(this.observerManager, observerToken, { stopsWhenFinalized: true })
|
|
377
382
|
|
|
378
|
-
// REFACTOR: make the initial callback call async, too (othewise we'd be
|
|
379
|
-
// mixing sync with async, which is a bit problematic in general but might
|
|
380
|
-
// be OK with single-threaded JS). This is a bit tricky, simply
|
|
381
|
-
// setTimeout(..., 0) here could lead us to a situation where the initial
|
|
382
|
-
// call would be sent AFTER the regular notification.
|
|
383
383
|
didChangeHandler(this.graph)
|
|
384
384
|
|
|
385
385
|
return observer
|
|
@@ -119,18 +119,9 @@ export class StoreObserver {
|
|
|
119
119
|
})
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
query,
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
mapFFIErrors(
|
|
128
|
-
() => {
|
|
129
|
-
storeObserverID = FFI.tryExperimentalRegisterChangeObserver(dittoHandle.deref(), query, queryArgumentsCBOR, wrappedObservationHandler)
|
|
130
|
-
},
|
|
131
|
-
undefined,
|
|
132
|
-
errorContext,
|
|
133
|
-
)
|
|
122
|
+
mapFFIErrors(() => {
|
|
123
|
+
storeObserverID = FFI.tryExperimentalRegisterChangeObserver(dittoHandle.deref(), query, queryArgumentsCBOR, wrappedObservationHandler)
|
|
124
|
+
})
|
|
134
125
|
})
|
|
135
126
|
|
|
136
127
|
if (storeObserverID == null) {
|
|
@@ -246,15 +246,11 @@ export class Store {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
const errorContext = { query, queryArguments }
|
|
250
|
-
|
|
251
249
|
// prettier-ignore
|
|
252
250
|
const queryResultPointer: FFI.Pointer<FFI.FFIQueryResult> = await mapFFIErrorsAsync(
|
|
253
251
|
async () => await performAsyncToWorkaroundNonAsyncFFIAPI(
|
|
254
252
|
() => FFI.tryExecStatement(dittoHandle.deref(), writeTransaction, query, queryArgumentsCBOR)
|
|
255
|
-
)
|
|
256
|
-
undefined,
|
|
257
|
-
errorContext
|
|
253
|
+
)
|
|
258
254
|
)
|
|
259
255
|
|
|
260
256
|
return Bridge.queryResult.bridge(queryResultPointer, () => new QueryResult(queryResultPointer))
|
|
@@ -508,15 +504,11 @@ export class Store {
|
|
|
508
504
|
}
|
|
509
505
|
}
|
|
510
506
|
|
|
511
|
-
const errorContext = { query, queryArguments }
|
|
512
|
-
|
|
513
507
|
const dittoHandle = Bridge.ditto.handleFor(this.ditto)
|
|
514
508
|
// prettier-ignore
|
|
515
509
|
return this.ditto.deferCloseAsync(async () => {
|
|
516
510
|
const webhookIDCBOR = await mapFFIErrorsAsync(
|
|
517
511
|
async () => await FFI.tryRegisterStoreObserverWebhook(dittoHandle.deref(), query, queryArgumentsCBOR, url),
|
|
518
|
-
undefined,
|
|
519
|
-
errorContext
|
|
520
512
|
)
|
|
521
513
|
return new DocumentID(webhookIDCBOR, true)
|
|
522
514
|
})
|
|
@@ -95,10 +95,9 @@ export class Sync {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
const errorContext = { query, queryArguments }
|
|
99
98
|
const dittoHandle = Bridge.ditto.handleFor(this.ditto)
|
|
100
99
|
this.ditto.deferClose(() => {
|
|
101
|
-
mapFFIErrors(() => FFI.tryAddSyncSubscription(dittoHandle.deref(), query, queryArgumentsCBOR)
|
|
100
|
+
mapFFIErrors(() => FFI.tryAddSyncSubscription(dittoHandle.deref(), query, queryArgumentsCBOR))
|
|
102
101
|
})
|
|
103
102
|
|
|
104
103
|
const subscription = new SyncSubscription(this.ditto, query, queryArguments || null, queryArgumentsCBOR)
|
package/types/ditto.d.ts
CHANGED
|
@@ -2853,10 +2853,12 @@ declare class ConnectionRequest {
|
|
|
2853
2853
|
/**
|
|
2854
2854
|
* Metadata associated with the remote peer.
|
|
2855
2855
|
*
|
|
2856
|
-
* This is an empty object if the remote peer has not set any metadata
|
|
2856
|
+
* This is an empty object if the remote peer has not set any metadata, or
|
|
2857
|
+
* when this request is for a WebSocket connection (which does not currently
|
|
2858
|
+
* support peer metadata).
|
|
2857
2859
|
*
|
|
2858
|
-
* Set peer metadata for the local peer using {@link Presence.peerMetadata}
|
|
2859
|
-
*
|
|
2860
|
+
* Set peer metadata for the local peer using {@link Presence.peerMetadata} or
|
|
2861
|
+
* {@link Presence.peerMetadataJSONString}.
|
|
2860
2862
|
*
|
|
2861
2863
|
* This is a convenience property that wraps
|
|
2862
2864
|
* {@link peerMetadataJSONString | `peerMetadataJSONString()`}.
|
|
@@ -2866,7 +2868,8 @@ declare class ConnectionRequest {
|
|
|
2866
2868
|
* JSON-encoded metadata associated with the remote peer.
|
|
2867
2869
|
*
|
|
2868
2870
|
* This is a JSON string representing an empty dictionary if the remote peer
|
|
2869
|
-
* has not set any metadata
|
|
2871
|
+
* has not set any metadata or when this request is for a WebSocket
|
|
2872
|
+
* connection.
|
|
2870
2873
|
*
|
|
2871
2874
|
* Set peer metadata for the local peer using {@link Presence.peerMetadata} or
|
|
2872
2875
|
* {@link Presence.peerMetadataJSONString}.
|
|
@@ -2986,6 +2989,9 @@ type Peer = {
|
|
|
2986
2989
|
* Use `ditto.presence.setPeerMetadata()` or
|
|
2987
2990
|
* `ditto.presence.setPeerMetadataJSONData()` to set this value.
|
|
2988
2991
|
*
|
|
2992
|
+
* This will be empty when a peer is only connected via a WebSocket
|
|
2993
|
+
* connection.
|
|
2994
|
+
*
|
|
2989
2995
|
* @see {@link Presence.peerMetadata | `ditto.presence.peerMetadata`} for
|
|
2990
2996
|
* details on usage of metadata.
|
|
2991
2997
|
*/
|
|
@@ -3091,6 +3097,8 @@ declare class Presence {
|
|
|
3091
3097
|
* and when evaluating connection requests using
|
|
3092
3098
|
* {@link connectionRequestHandler | connectionRequestHandler()}.
|
|
3093
3099
|
*
|
|
3100
|
+
* This is not made available to peers only connected via WebSocket.
|
|
3101
|
+
*
|
|
3094
3102
|
* Uses UTF-8 encoding.
|
|
3095
3103
|
*
|
|
3096
3104
|
* @see {@link peerMetadata | peerMetadata()} for a convenience property that
|