@dittolive/ditto 4.5.0 → 4.5.1-experimental.aarch64-linux.1.aarch64

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.
Files changed (289) hide show
  1. package/README.md +2 -2
  2. package/node/ditto.cjs.js +2 -9620
  3. package/node/{ditto.linux-x64.node → ditto.linux-arm64.node} +0 -0
  4. package/package.json +38 -34
  5. package/types/ditto.d.ts +0 -2
  6. package/web/ditto.es6.js +1 -1
  7. package/web/ditto.umd.js +1 -1
  8. package/web/ditto.wasm +0 -0
  9. package/DittoReactNative.podspec +0 -27
  10. package/node/ditto.darwin-arm64.node +0 -0
  11. package/node/ditto.darwin-x64.node +0 -0
  12. package/node/ditto.linux-arm.node +0 -0
  13. package/node/ditto.win32-x64.node +0 -0
  14. package/node/transports.darwin-arm64.node +0 -0
  15. package/node/transports.darwin-x64.node +0 -0
  16. package/react-native/android/CMakeLists.txt +0 -37
  17. package/react-native/android/build.gradle +0 -203
  18. package/react-native/android/cpp-adapter.cpp +0 -254
  19. package/react-native/android/gradle.properties +0 -5
  20. package/react-native/android/src/main/AndroidManifest.xml +0 -4
  21. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.java +0 -85
  22. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKPackage.java +0 -28
  23. package/react-native/boost/boost/assert.hpp +0 -85
  24. package/react-native/boost/boost/config/abi/borland_prefix.hpp +0 -27
  25. package/react-native/boost/boost/config/abi/borland_suffix.hpp +0 -12
  26. package/react-native/boost/boost/config/abi/msvc_prefix.hpp +0 -22
  27. package/react-native/boost/boost/config/abi/msvc_suffix.hpp +0 -8
  28. package/react-native/boost/boost/config/abi_prefix.hpp +0 -25
  29. package/react-native/boost/boost/config/abi_suffix.hpp +0 -25
  30. package/react-native/boost/boost/config/assert_cxx03.hpp +0 -211
  31. package/react-native/boost/boost/config/assert_cxx11.hpp +0 -209
  32. package/react-native/boost/boost/config/assert_cxx14.hpp +0 -47
  33. package/react-native/boost/boost/config/assert_cxx17.hpp +0 -62
  34. package/react-native/boost/boost/config/assert_cxx20.hpp +0 -59
  35. package/react-native/boost/boost/config/assert_cxx98.hpp +0 -23
  36. package/react-native/boost/boost/config/auto_link.hpp +0 -525
  37. package/react-native/boost/boost/config/compiler/borland.hpp +0 -339
  38. package/react-native/boost/boost/config/compiler/clang.hpp +0 -366
  39. package/react-native/boost/boost/config/compiler/clang_version.hpp +0 -83
  40. package/react-native/boost/boost/config/compiler/codegear.hpp +0 -385
  41. package/react-native/boost/boost/config/compiler/comeau.hpp +0 -59
  42. package/react-native/boost/boost/config/compiler/common_edg.hpp +0 -183
  43. package/react-native/boost/boost/config/compiler/compaq_cxx.hpp +0 -19
  44. package/react-native/boost/boost/config/compiler/cray.hpp +0 -446
  45. package/react-native/boost/boost/config/compiler/diab.hpp +0 -26
  46. package/react-native/boost/boost/config/compiler/digitalmars.hpp +0 -143
  47. package/react-native/boost/boost/config/compiler/gcc.hpp +0 -383
  48. package/react-native/boost/boost/config/compiler/gcc_xml.hpp +0 -114
  49. package/react-native/boost/boost/config/compiler/greenhills.hpp +0 -28
  50. package/react-native/boost/boost/config/compiler/hp_acc.hpp +0 -149
  51. package/react-native/boost/boost/config/compiler/intel.hpp +0 -577
  52. package/react-native/boost/boost/config/compiler/kai.hpp +0 -33
  53. package/react-native/boost/boost/config/compiler/metrowerks.hpp +0 -198
  54. package/react-native/boost/boost/config/compiler/mpw.hpp +0 -140
  55. package/react-native/boost/boost/config/compiler/nvcc.hpp +0 -61
  56. package/react-native/boost/boost/config/compiler/pathscale.hpp +0 -138
  57. package/react-native/boost/boost/config/compiler/pgi.hpp +0 -23
  58. package/react-native/boost/boost/config/compiler/sgi_mipspro.hpp +0 -29
  59. package/react-native/boost/boost/config/compiler/sunpro_cc.hpp +0 -222
  60. package/react-native/boost/boost/config/compiler/vacpp.hpp +0 -186
  61. package/react-native/boost/boost/config/compiler/visualc.hpp +0 -391
  62. package/react-native/boost/boost/config/compiler/xlcpp.hpp +0 -299
  63. package/react-native/boost/boost/config/compiler/xlcpp_zos.hpp +0 -173
  64. package/react-native/boost/boost/config/detail/cxx_composite.hpp +0 -203
  65. package/react-native/boost/boost/config/detail/posix_features.hpp +0 -95
  66. package/react-native/boost/boost/config/detail/select_compiler_config.hpp +0 -157
  67. package/react-native/boost/boost/config/detail/select_platform_config.hpp +0 -147
  68. package/react-native/boost/boost/config/detail/select_stdlib_config.hpp +0 -121
  69. package/react-native/boost/boost/config/detail/suffix.hpp +0 -1294
  70. package/react-native/boost/boost/config/header_deprecated.hpp +0 -26
  71. package/react-native/boost/boost/config/helper_macros.hpp +0 -37
  72. package/react-native/boost/boost/config/no_tr1/cmath.hpp +0 -28
  73. package/react-native/boost/boost/config/no_tr1/complex.hpp +0 -28
  74. package/react-native/boost/boost/config/no_tr1/functional.hpp +0 -28
  75. package/react-native/boost/boost/config/no_tr1/memory.hpp +0 -28
  76. package/react-native/boost/boost/config/no_tr1/utility.hpp +0 -28
  77. package/react-native/boost/boost/config/platform/aix.hpp +0 -33
  78. package/react-native/boost/boost/config/platform/amigaos.hpp +0 -15
  79. package/react-native/boost/boost/config/platform/beos.hpp +0 -26
  80. package/react-native/boost/boost/config/platform/bsd.hpp +0 -83
  81. package/react-native/boost/boost/config/platform/cloudabi.hpp +0 -18
  82. package/react-native/boost/boost/config/platform/cray.hpp +0 -18
  83. package/react-native/boost/boost/config/platform/cygwin.hpp +0 -71
  84. package/react-native/boost/boost/config/platform/haiku.hpp +0 -31
  85. package/react-native/boost/boost/config/platform/hpux.hpp +0 -87
  86. package/react-native/boost/boost/config/platform/irix.hpp +0 -31
  87. package/react-native/boost/boost/config/platform/linux.hpp +0 -106
  88. package/react-native/boost/boost/config/platform/macos.hpp +0 -87
  89. package/react-native/boost/boost/config/platform/qnxnto.hpp +0 -31
  90. package/react-native/boost/boost/config/platform/solaris.hpp +0 -31
  91. package/react-native/boost/boost/config/platform/symbian.hpp +0 -97
  92. package/react-native/boost/boost/config/platform/vms.hpp +0 -25
  93. package/react-native/boost/boost/config/platform/vxworks.hpp +0 -422
  94. package/react-native/boost/boost/config/platform/wasm.hpp +0 -23
  95. package/react-native/boost/boost/config/platform/win32.hpp +0 -90
  96. package/react-native/boost/boost/config/platform/zos.hpp +0 -32
  97. package/react-native/boost/boost/config/pragma_message.hpp +0 -31
  98. package/react-native/boost/boost/config/requires_threads.hpp +0 -92
  99. package/react-native/boost/boost/config/stdlib/dinkumware.hpp +0 -324
  100. package/react-native/boost/boost/config/stdlib/libcomo.hpp +0 -93
  101. package/react-native/boost/boost/config/stdlib/libcpp.hpp +0 -180
  102. package/react-native/boost/boost/config/stdlib/libstdcpp3.hpp +0 -482
  103. package/react-native/boost/boost/config/stdlib/modena.hpp +0 -79
  104. package/react-native/boost/boost/config/stdlib/msl.hpp +0 -98
  105. package/react-native/boost/boost/config/stdlib/roguewave.hpp +0 -208
  106. package/react-native/boost/boost/config/stdlib/sgi.hpp +0 -168
  107. package/react-native/boost/boost/config/stdlib/stlport.hpp +0 -258
  108. package/react-native/boost/boost/config/stdlib/vacpp.hpp +0 -74
  109. package/react-native/boost/boost/config/stdlib/xlcpp_zos.hpp +0 -61
  110. package/react-native/boost/boost/config/user.hpp +0 -133
  111. package/react-native/boost/boost/config/warning_disable.hpp +0 -47
  112. package/react-native/boost/boost/config/workaround.hpp +0 -305
  113. package/react-native/boost/boost/config.hpp +0 -67
  114. package/react-native/boost/boost/cstdint.hpp +0 -556
  115. package/react-native/boost/boost/intrusive_ptr.hpp +0 -18
  116. package/react-native/boost/boost/smart_ptr/detail/atomic_count.hpp +0 -103
  117. package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp +0 -79
  118. package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp +0 -63
  119. package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +0 -88
  120. package/react-native/boost/boost/smart_ptr/detail/atomic_count_nt.hpp +0 -66
  121. package/react-native/boost/boost/smart_ptr/detail/atomic_count_pt.hpp +0 -104
  122. package/react-native/boost/boost/smart_ptr/detail/atomic_count_spin.hpp +0 -69
  123. package/react-native/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp +0 -67
  124. package/react-native/boost/boost/smart_ptr/detail/atomic_count_sync.hpp +0 -72
  125. package/react-native/boost/boost/smart_ptr/detail/atomic_count_win32.hpp +0 -70
  126. package/react-native/boost/boost/smart_ptr/detail/local_counted_base.hpp +0 -148
  127. package/react-native/boost/boost/smart_ptr/detail/local_sp_deleter.hpp +0 -91
  128. package/react-native/boost/boost/smart_ptr/detail/operator_bool.hpp +0 -64
  129. package/react-native/boost/boost/smart_ptr/detail/requires_cxx11.hpp +0 -23
  130. package/react-native/boost/boost/smart_ptr/detail/shared_count.hpp +0 -707
  131. package/react-native/boost/boost/smart_ptr/detail/sp_convertible.hpp +0 -92
  132. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base.hpp +0 -92
  133. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +0 -163
  134. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp +0 -152
  135. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +0 -185
  136. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp +0 -148
  137. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +0 -170
  138. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +0 -200
  139. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +0 -194
  140. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +0 -179
  141. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +0 -186
  142. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp +0 -119
  143. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp +0 -147
  144. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +0 -174
  145. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp +0 -141
  146. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +0 -147
  147. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp +0 -165
  148. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +0 -163
  149. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp +0 -140
  150. package/react-native/boost/boost/smart_ptr/detail/sp_counted_impl.hpp +0 -309
  151. package/react-native/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp +0 -40
  152. package/react-native/boost/boost/smart_ptr/detail/sp_forward.hpp +0 -52
  153. package/react-native/boost/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp +0 -27
  154. package/react-native/boost/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp +0 -69
  155. package/react-native/boost/boost/smart_ptr/detail/sp_interlocked.hpp +0 -173
  156. package/react-native/boost/boost/smart_ptr/detail/sp_noexcept.hpp +0 -48
  157. package/react-native/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp +0 -45
  158. package/react-native/boost/boost/smart_ptr/detail/sp_obsolete.hpp +0 -32
  159. package/react-native/boost/boost/smart_ptr/detail/sp_thread_pause.hpp +0 -51
  160. package/react-native/boost/boost/smart_ptr/detail/sp_thread_sleep.hpp +0 -104
  161. package/react-native/boost/boost/smart_ptr/detail/sp_thread_yield.hpp +0 -100
  162. package/react-native/boost/boost/smart_ptr/detail/sp_typeinfo_.hpp +0 -58
  163. package/react-native/boost/boost/smart_ptr/detail/sp_win32_sleep.hpp +0 -49
  164. package/react-native/boost/boost/smart_ptr/intrusive_ptr.hpp +0 -409
  165. package/react-native/boost/boost/smart_ptr/intrusive_ref_counter.hpp +0 -188
  166. package/react-native/cpp/include/Attachment.h +0 -16
  167. package/react-native/cpp/include/Authentication.h +0 -23
  168. package/react-native/cpp/include/Collection.h +0 -13
  169. package/react-native/cpp/include/DQL.h +0 -21
  170. package/react-native/cpp/include/Document.h +0 -17
  171. package/react-native/cpp/include/Identity.h +0 -17
  172. package/react-native/cpp/include/Lifecycle.h +0 -16
  173. package/react-native/cpp/include/LiveQuery.h +0 -17
  174. package/react-native/cpp/include/Logger.h +0 -22
  175. package/react-native/cpp/include/Misc.h +0 -26
  176. package/react-native/cpp/include/Presence.h +0 -14
  177. package/react-native/cpp/include/RetainableState.h +0 -24
  178. package/react-native/cpp/include/SmallPeerInfo.h +0 -17
  179. package/react-native/cpp/include/Transports.h +0 -25
  180. package/react-native/cpp/include/TypedArray.hpp +0 -167
  181. package/react-native/cpp/include/Utils.h +0 -61
  182. package/react-native/cpp/include/main.h +0 -10
  183. package/react-native/cpp/src/Attachment.cpp +0 -86
  184. package/react-native/cpp/src/Authentication.cpp +0 -224
  185. package/react-native/cpp/src/Collection.cpp +0 -54
  186. package/react-native/cpp/src/DQL.cpp +0 -254
  187. package/react-native/cpp/src/Document.cpp +0 -146
  188. package/react-native/cpp/src/Identity.cpp +0 -123
  189. package/react-native/cpp/src/Lifecycle.cpp +0 -75
  190. package/react-native/cpp/src/LiveQuery.cpp +0 -64
  191. package/react-native/cpp/src/Logger.cpp +0 -200
  192. package/react-native/cpp/src/Misc.cpp +0 -271
  193. package/react-native/cpp/src/Presence.cpp +0 -77
  194. package/react-native/cpp/src/RetainableState.cpp +0 -15
  195. package/react-native/cpp/src/SmallPeerInfo.cpp +0 -108
  196. package/react-native/cpp/src/Transports.cpp +0 -270
  197. package/react-native/cpp/src/TypedArray.cpp +0 -303
  198. package/react-native/cpp/src/Utils.cpp +0 -138
  199. package/react-native/cpp/src/main.cpp +0 -149
  200. package/react-native/dittoffi/dittoffi.h +0 -4698
  201. package/react-native/dittoffi/ifaddrs.cpp +0 -385
  202. package/react-native/dittoffi/ifaddrs.h +0 -206
  203. package/react-native/ios/DittoRNSDK.h +0 -7
  204. package/react-native/ios/DittoRNSDK.mm +0 -107
  205. package/react-native/ios/YeetJSIUtils.h +0 -60
  206. package/react-native/ios/YeetJSIUtils.mm +0 -196
  207. package/react-native/lib/commonjs/ditto.rn.js +0 -93
  208. package/react-native/lib/commonjs/ditto.rn.js.map +0 -1
  209. package/react-native/lib/commonjs/index.js +0 -14
  210. package/react-native/lib/commonjs/index.js.map +0 -1
  211. package/react-native/lib/module/ditto.rn.js +0 -83
  212. package/react-native/lib/module/ditto.rn.js.map +0 -1
  213. package/react-native/lib/module/index.js +0 -13
  214. package/react-native/lib/module/index.js.map +0 -1
  215. package/react-native/lib/typescript/ditto.rn.d.ts +0 -15
  216. package/react-native/lib/typescript/ditto.rn.d.ts.map +0 -1
  217. package/react-native/lib/typescript/index.d.ts +0 -1
  218. package/react-native/lib/typescript/index.d.ts.map +0 -1
  219. package/react-native/scripts/ruby/include_local_boost.rb +0 -78
  220. package/react-native/src/ditto.rn.ts +0 -91
  221. package/react-native/src/environment/environment.fallback.ts +0 -4
  222. package/react-native/src/index.ts +0 -26
  223. package/react-native/src/sources/@cbor-redux.ts +0 -2
  224. package/react-native/src/sources/@ditto.core.ts +0 -1
  225. package/react-native/src/sources/@environment.ts +0 -2
  226. package/react-native/src/sources/attachment-fetch-event.ts +0 -54
  227. package/react-native/src/sources/attachment-fetcher-manager.ts +0 -129
  228. package/react-native/src/sources/attachment-fetcher.ts +0 -124
  229. package/react-native/src/sources/attachment-token.ts +0 -48
  230. package/react-native/src/sources/attachment.ts +0 -59
  231. package/react-native/src/sources/augment.ts +0 -89
  232. package/react-native/src/sources/authenticator.ts +0 -314
  233. package/react-native/src/sources/base-pending-cursor-operation.ts +0 -237
  234. package/react-native/src/sources/base-pending-id-specific-operation.ts +0 -109
  235. package/react-native/src/sources/bridge.ts +0 -549
  236. package/react-native/src/sources/build-time-constants.ts +0 -4
  237. package/react-native/src/sources/cbor.ts +0 -35
  238. package/react-native/src/sources/collection-interface.ts +0 -67
  239. package/react-native/src/sources/collection.ts +0 -212
  240. package/react-native/src/sources/collections-event.ts +0 -99
  241. package/react-native/src/sources/counter.ts +0 -77
  242. package/react-native/src/sources/ditto.ts +0 -945
  243. package/react-native/src/sources/document-id.ts +0 -159
  244. package/react-native/src/sources/document-path.ts +0 -303
  245. package/react-native/src/sources/document.ts +0 -192
  246. package/react-native/src/sources/epilogue.ts +0 -24
  247. package/react-native/src/sources/error-codes.ts +0 -52
  248. package/react-native/src/sources/error.ts +0 -203
  249. package/react-native/src/sources/essentials.ts +0 -53
  250. package/react-native/src/sources/ffi-error.ts +0 -117
  251. package/react-native/src/sources/ffi.ts +0 -1972
  252. package/react-native/src/sources/identity.ts +0 -163
  253. package/react-native/src/sources/init.ts +0 -70
  254. package/react-native/src/sources/internal.ts +0 -113
  255. package/react-native/src/sources/keep-alive.ts +0 -69
  256. package/react-native/src/sources/key-path.ts +0 -195
  257. package/react-native/src/sources/live-query-event.ts +0 -208
  258. package/react-native/src/sources/live-query-manager.ts +0 -101
  259. package/react-native/src/sources/live-query.ts +0 -164
  260. package/react-native/src/sources/logger.ts +0 -196
  261. package/react-native/src/sources/observer-manager.ts +0 -175
  262. package/react-native/src/sources/observer.ts +0 -77
  263. package/react-native/src/sources/pending-collections-operation.ts +0 -232
  264. package/react-native/src/sources/pending-cursor-operation.ts +0 -218
  265. package/react-native/src/sources/pending-id-specific-operation.ts +0 -216
  266. package/react-native/src/sources/presence-manager.ts +0 -160
  267. package/react-native/src/sources/presence.ts +0 -238
  268. package/react-native/src/sources/query-result-item.ts +0 -116
  269. package/react-native/src/sources/query-result.ts +0 -55
  270. package/react-native/src/sources/register.ts +0 -92
  271. package/react-native/src/sources/small-peer-info.ts +0 -176
  272. package/react-native/src/sources/static-tcp-client.ts +0 -6
  273. package/react-native/src/sources/store-observer.ts +0 -176
  274. package/react-native/src/sources/store.ts +0 -365
  275. package/react-native/src/sources/subscription-manager.ts +0 -98
  276. package/react-native/src/sources/subscription.ts +0 -88
  277. package/react-native/src/sources/sync-subscription.ts +0 -90
  278. package/react-native/src/sources/sync.ts +0 -495
  279. package/react-native/src/sources/test-helpers.ts +0 -24
  280. package/react-native/src/sources/transport-conditions-manager.ts +0 -104
  281. package/react-native/src/sources/transport-config.ts +0 -428
  282. package/react-native/src/sources/update-result.ts +0 -66
  283. package/react-native/src/sources/update-results-map.ts +0 -57
  284. package/react-native/src/sources/websocket-client.ts +0 -6
  285. package/react-native/src/sources/write-transaction-collection.ts +0 -122
  286. package/react-native/src/sources/write-transaction-pending-cursor-operation.ts +0 -101
  287. package/react-native/src/sources/write-transaction-pending-id-specific-operation.ts +0 -72
  288. package/react-native/src/sources/write-transaction.ts +0 -119
  289. package/react-native.config.js +0 -9
@@ -1,428 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- /**
6
- * Restore a `TransportConfig` from its serializable representation.
7
- *
8
- * @internal
9
- */
10
- export function transportConfigFromDeserializable(serialized: any): TransportConfig {
11
- const peerToPeerJSON = serialized['peer_to_peer']
12
- const bluetoothLEJSON = peerToPeerJSON['bluetooth_le']
13
- const bluetoothLEEnabled = bluetoothLEJSON['enabled']
14
- const awdlJSON = peerToPeerJSON['awdl']
15
- const awdlEnabled = awdlJSON['enabled']
16
- const lanJSON = peerToPeerJSON['lan']
17
- const lanEnabled = lanJSON['enabled']
18
- const lanMdnsEnabled = lanJSON['mdns_enabled']
19
- const lanMulticastEnabled = lanJSON['multicast_enabled']
20
-
21
- const connectJSON = serialized['connect']
22
- const connectTcpServers = connectJSON['tcp_servers']
23
- const connectWebsocketURLs = connectJSON['websocket_urls']
24
- const connectRetryInterval = connectJSON['retry_interval']
25
-
26
- const listenJSON = serialized['listen']
27
- const tcpJSON = listenJSON['tcp']
28
- const tcpEnabled = tcpJSON['enabled']
29
- const tcpInterfaceIP = tcpJSON['interface_ip']
30
- const tcpPort = tcpJSON['port']
31
- const httpJSON = listenJSON['http']
32
- const httpEnabled = httpJSON['enabled']
33
- const httpInterfaceIP = httpJSON['interface_ip']
34
- const httpPort = httpJSON['port']
35
- const httpStaticContentPath = httpJSON['static_content_path']
36
- const httpWebsocketSync = httpJSON['websocket_sync']
37
- const httpTLSKeyPath = httpJSON['tls_key_path']
38
- const httpTLSCertificatePath = httpJSON['tls_certificate_path']
39
-
40
- const globalJSON = serialized['global']
41
- const globalSyncGroup = globalJSON['sync_group']
42
- const globalRoutingHint = globalJSON['routing_hint']
43
-
44
- const config = new TransportConfig()
45
-
46
- config.peerToPeer.bluetoothLE.isEnabled = bluetoothLEEnabled
47
- config.peerToPeer.awdl.isEnabled = awdlEnabled
48
- config.peerToPeer.lan.isEnabled = lanEnabled
49
- config.peerToPeer.lan.isMdnsEnabled = lanMdnsEnabled
50
- config.peerToPeer.lan.isMulticastEnabled = lanMulticastEnabled
51
-
52
- config.connect.tcpServers = connectTcpServers
53
- config.connect.websocketURLs = connectWebsocketURLs
54
- config.connect.retryInterval = connectRetryInterval
55
-
56
- config.listen.tcp.isEnabled = tcpEnabled
57
- config.listen.tcp.interfaceIP = tcpInterfaceIP
58
- config.listen.tcp.port = tcpPort
59
- config.listen.http.isEnabled = httpEnabled
60
- config.listen.http.interfaceIP = httpInterfaceIP
61
- config.listen.http.port = httpPort
62
- config.listen.http.staticContentPath = httpStaticContentPath
63
- config.listen.http.websocketSync = httpWebsocketSync
64
- config.listen.http.tlsKeyPath = httpTLSKeyPath
65
- config.listen.http.tlsCertificatePath = httpTLSCertificatePath
66
-
67
- config.global.syncGroup = globalSyncGroup
68
- config.global.routingHint = globalRoutingHint
69
-
70
- return config
71
- }
72
-
73
- /**
74
- * Convert a `TransportConfig` to a serializable representation.
75
- *
76
- * This mainly involves converting the `TransportConfig`'s properties to have the expected key names
77
- * and casing.
78
- *
79
- * @internal
80
- */
81
- export function transportConfigToSerializable(config: TransportConfig): any {
82
- const peerToPeer = config.peerToPeer
83
- const connect = config.connect
84
- const listen = config.listen
85
- const global = config.global
86
-
87
- const serialized = {
88
- peer_to_peer: {
89
- bluetooth_le: {
90
- enabled: peerToPeer.bluetoothLE.isEnabled,
91
- },
92
- awdl: {
93
- enabled: peerToPeer.awdl.isEnabled,
94
- },
95
- lan: {
96
- enabled: peerToPeer.lan.isEnabled,
97
- mdns_enabled: peerToPeer.lan.isMdnsEnabled,
98
- multicast_enabled: peerToPeer.lan.isMulticastEnabled,
99
- },
100
- },
101
- connect: {
102
- tcp_servers: connect.tcpServers,
103
- websocket_urls: connect.websocketURLs,
104
- retry_interval: connect.retryInterval,
105
- },
106
- listen: {
107
- tcp: {
108
- enabled: listen.tcp.isEnabled,
109
- interface_ip: listen.tcp.interfaceIP,
110
- port: listen.tcp.port,
111
- },
112
- http: {
113
- enabled: listen.http.isEnabled,
114
- interface_ip: listen.http.interfaceIP,
115
- port: listen.http.port,
116
- websocket_sync: listen.http.websocketSync,
117
- },
118
- },
119
- global: {
120
- sync_group: global.syncGroup,
121
- routing_hint: global.routingHint,
122
- },
123
- }
124
-
125
- if (listen.http.staticContentPath) {
126
- serialized.listen.http['static_content_path'] = listen.http.staticContentPath
127
- }
128
- if (listen.http.tlsKeyPath) {
129
- serialized.listen.http['tls_key_path'] = listen.http.tlsKeyPath
130
- }
131
- if (listen.http.tlsCertificatePath) {
132
- serialized.listen.http['tls_certificate_path'] = listen.http.tlsCertificatePath
133
- }
134
-
135
- return serialized
136
- }
137
-
138
- /**
139
- * Part of {@link TransportConfig} type, configuration for listening for TCP
140
- * connections.
141
- */
142
- export interface TransportConfigListenTCP {
143
- isEnabled: boolean
144
- interfaceIP: string
145
- port: number
146
- }
147
-
148
- /**
149
- * Part of {@link TransportConfig} type, configuration for listening for HTTP,
150
- * including Websocket, connections.
151
- */
152
- export interface TransportConfigListenHTTP {
153
- isEnabled: boolean
154
- interfaceIP: string
155
- port: number
156
- staticContentPath?: string
157
- websocketSync: boolean
158
- tlsKeyPath?: string
159
- tlsCertificatePath?: string
160
- }
161
-
162
- /**
163
- * Part of {@link TransportConfig} type, configuration for all P2P transports.
164
- */
165
- export interface TransportConfigPeerToPeer {
166
- bluetoothLE: { isEnabled: boolean }
167
- awdl: { isEnabled: boolean }
168
- lan: TransportConfigLan
169
- }
170
-
171
- /**
172
- * Part of {@link TransportConfig} type, configuration for discovering and syncing with peers on LAN.
173
- */
174
- export interface TransportConfigLan {
175
- isEnabled: boolean
176
- isMdnsEnabled: boolean
177
- /**
178
- * @deprecated Multicast is deprecated. Please use mDNS instead.
179
- */
180
- isMulticastEnabled: boolean
181
- }
182
-
183
- /**
184
- * Part of {@link TransportConfig} type, configuration for connecting to TCP
185
- * and Websocket servers.
186
- */
187
- export interface TransportConfigConnect {
188
- tcpServers: string[]
189
- websocketURLs: string[]
190
- /**
191
- * The retry interval in milliseconds between failed connection attempts. For cross-compatibility, this must be less than 2^32 - 1.
192
- */
193
- retryInterval: number
194
- }
195
-
196
- /**
197
- * Part of {@link TransportConfig} type, configuration for listening for
198
- * incoming TCP and HTTP connections.
199
- */
200
- export interface TransportConfigListen {
201
- tcp: TransportConfigListenTCP
202
- http: TransportConfigListenHTTP
203
- }
204
-
205
- const NO_PREFERRED_ROUTE_HINT = 0
206
-
207
- /**
208
- * Part of {@link TransportConfig} type, settings not associated with any specific type of transport.
209
- */
210
- export interface TransportConfigGlobal {
211
- /**
212
- * The sync group for this device.
213
- *
214
- * When peer-to-peer transports are enabled, all devices with the same App ID will
215
- * normally form an interconnected mesh network. In some situations it may be
216
- * desirable to have distinct groups of devices within the same app, so that
217
- * connections will only be formed within each group. The `syncGroup` parameter
218
- * changes that group membership. A device can only ever be in one sync group, which
219
- * by default is group 0. Up to 2^32 distinct group numbers can be used in an app.
220
- *
221
- * This is an optimization, not a security control. If a connection is created
222
- * manually, such as by specifying a `connect` transport, then devices from
223
- * different sync groups will still sync as normal. If two groups of devices are
224
- * intended to have access to different data sets, this must be enforced using
225
- * Ditto's permissions system.
226
- */
227
- syncGroup: number
228
-
229
- /**
230
- * The routing hint for this device.
231
- *
232
- * A routing hint is a performance tuning option which can improve the performance of
233
- * applications that use large collections. Ditto will make a best effort to co-locate data for
234
- * the same routing key. In most circumstances, this should substantially improve responsiveness
235
- * of the Ditto Cloud.
236
- *
237
- * The value of the routing hint is application specific - you are free to chose any value.
238
- * Devices which you expect to operate on much the same data should be configured to
239
- * use the same value.
240
- *
241
- * A routing hint does not partition data. The value of the routing hint will not affect the data
242
- * returned for a query. The routing hint only improves the efficiency of the Cloud's
243
- * ability to satisfy the query.
244
- */
245
- routingHint: number
246
- }
247
-
248
- /**
249
- * A configuration object specifying which network transports Ditto should
250
- * use to sync data.
251
- *
252
- * A Ditto object comes with a default transport configuration where all
253
- * available peer-to-peer transports are enabled. You can customize this by
254
- * copying that or initializing a new `TransportConfig`, adjusting its
255
- * properties, and supplying it to `setTransportConfig()` on `Ditto`.
256
- *
257
- * When you initialize a new `TransportConfig` instance, all transports are
258
- * disabled. You must enable each one explicitly.
259
- *
260
- * Peer-to-peer transports will automatically discover peers in the vicinity
261
- * and create connections without any configuration. These are configured via
262
- * the `peerToPeer` property. To turn each one on, set its `isEnabled` property
263
- * to `true`.
264
- *
265
- * To connect to a peer at a known location, such as a Ditto Big Peer, add its
266
- * address inside the connect configuration. These are either "host:port"
267
- * strings for raw TCP sync, or a "wss://…" URL for websockets.
268
- *
269
- * The listen configurations are for specific less common data sync scenarios.
270
- * Please read the documentation on the Ditto website for examples. Incorrect
271
- * use of listen can result in insecure configurations.
272
- *
273
- * **IMPORTANT**: when running in the browser, only the `connect.websocketURLs`
274
- * part is considered, the rest of the configuration is ignored.
275
- */
276
- export class TransportConfig {
277
- /** Configuration for peer-to-peer connections. */
278
- readonly peerToPeer: TransportConfigPeerToPeer
279
-
280
- /** Configuration for connecting to servers. */
281
- readonly connect: TransportConfigConnect
282
-
283
- /** Configuration for listening for incomping connections. */
284
- readonly listen: TransportConfigListen
285
-
286
- /** Settings not associated with any specific type of transport. */
287
- readonly global: TransportConfigGlobal
288
-
289
- /**
290
- * Create a new transport config initialized with the default settings.
291
- */
292
- constructor() {
293
- this.peerToPeer = {
294
- bluetoothLE: { isEnabled: false },
295
- awdl: { isEnabled: false },
296
- lan: { isEnabled: false, isMdnsEnabled: true, isMulticastEnabled: true },
297
- }
298
-
299
- this.connect = {
300
- tcpServers: [],
301
- websocketURLs: [],
302
- retryInterval: 5000,
303
- }
304
-
305
- this.listen = {
306
- tcp: {
307
- isEnabled: false,
308
- interfaceIP: '0.0.0.0',
309
- port: 4040,
310
- },
311
-
312
- http: {
313
- isEnabled: false,
314
- interfaceIP: '0.0.0.0',
315
- port: 80,
316
- websocketSync: true,
317
- },
318
- }
319
-
320
- this.global = {
321
- syncGroup: 0,
322
- routingHint: NO_PREFERRED_ROUTE_HINT,
323
- }
324
- }
325
-
326
- /**
327
- * Enables all peer-to-peer transports. Throws if receiver is frozen.
328
- */
329
- setAllPeerToPeerEnabled(enabled: boolean) {
330
- this.peerToPeer.bluetoothLE.isEnabled = enabled
331
- this.peerToPeer.lan.isEnabled = enabled
332
- this.peerToPeer.awdl.isEnabled = enabled
333
- }
334
-
335
- /**
336
- * Returns `true` if the transport configuration is frozen, otherwise
337
- * returns `false`.
338
- */
339
- get isFrozen(): boolean {
340
- return this._isFrozen
341
- }
342
-
343
- /**
344
- * (Deep) freezes the receiver such that it can't be modified anymore.
345
- */
346
- freeze(): TransportConfig {
347
- if (this.isFrozen) return this
348
- this._isFrozen = true
349
-
350
- Object.freeze(this.peerToPeer.bluetoothLE)
351
- Object.freeze(this.peerToPeer.awdl)
352
- Object.freeze(this.peerToPeer.lan)
353
- Object.freeze(this.peerToPeer)
354
-
355
- Object.freeze(this.connect.tcpServers)
356
- Object.freeze(this.connect.websocketURLs)
357
- Object.freeze(this.connect)
358
-
359
- Object.freeze(this.listen.tcp)
360
- Object.freeze(this.listen.http)
361
- Object.freeze(this.listen)
362
-
363
- Object.freeze(this.global)
364
-
365
- return this
366
- }
367
-
368
- /**
369
- * Returns a (deep) copy of the receiver.
370
- */
371
- copy(): TransportConfig {
372
- const copy = new TransportConfig()
373
-
374
- copy.peerToPeer.bluetoothLE.isEnabled = this.peerToPeer.bluetoothLE.isEnabled
375
- copy.peerToPeer.awdl.isEnabled = this.peerToPeer.awdl.isEnabled
376
- copy.peerToPeer.lan.isEnabled = this.peerToPeer.lan.isEnabled
377
- copy.peerToPeer.lan.isMdnsEnabled = this.peerToPeer.lan.isMdnsEnabled
378
- copy.peerToPeer.lan.isMulticastEnabled = this.peerToPeer.lan.isMulticastEnabled
379
-
380
- copy.connect.tcpServers = this.connect.tcpServers.slice()
381
- copy.connect.websocketURLs = this.connect.websocketURLs.slice()
382
- copy.connect.retryInterval = this.connect.retryInterval
383
-
384
- copy.listen.tcp = { ...this.listen.tcp }
385
- copy.listen.http = { ...this.listen.http }
386
-
387
- copy.global.syncGroup = this.global.syncGroup
388
- copy.global.routingHint = this.global.routingHint
389
-
390
- return copy
391
- }
392
-
393
- /**
394
- * Returns `true` if passed in TCP configurations are equal, otherwise
395
- * returns `false`.
396
- */
397
- static areListenTCPsEqual(left: TransportConfigListenTCP, right: TransportConfigListenTCP): boolean {
398
- /* eslint-disable */
399
- return (
400
- left.isEnabled === right.isEnabled &&
401
- left.interfaceIP === right.interfaceIP &&
402
- left.port === right.port
403
- )
404
- /* eslint-enable */
405
- }
406
-
407
- /**
408
- * Returns `true` if passed in HTTP configurations are equal, otherwise
409
- * returns `false`.
410
- */
411
- static areListenHTTPsEqual(left: TransportConfigListenHTTP, right: TransportConfigListenHTTP): boolean {
412
- /* eslint-disable */
413
- // prettier-ignore
414
- return (
415
- left.isEnabled === right.isEnabled &&
416
- left.interfaceIP === right.interfaceIP &&
417
- left.port === right.port &&
418
-
419
- left.staticContentPath === right.staticContentPath &&
420
- left.websocketSync === right.websocketSync &&
421
- left.tlsKeyPath === right.tlsKeyPath &&
422
- left.tlsCertificatePath === right.tlsCertificatePath
423
- )
424
- /* eslint-enable */
425
- }
426
-
427
- private _isFrozen: boolean = false
428
- }
@@ -1,66 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import type { DocumentID } from './document-id'
6
-
7
- /**
8
- * The types of an {@link UpdateResult}.
9
- */
10
- export type UpdateResultType = 'set' | 'incremented' | 'removed'
11
-
12
- /*
13
- * Provides information about a successful update operation on a document.
14
- *
15
- * The update result can be one of the following types:
16
- * - `set`
17
- * - `removed`
18
- * - `incremented`
19
- */
20
- export class UpdateResult {
21
- /** The update result's type. */
22
- readonly type: UpdateResultType
23
-
24
- /** The ID of the document that was updated. */
25
- readonly docID: DocumentID
26
-
27
- /** The path to the key in the document that was updated. */
28
- readonly path: string
29
-
30
- /**
31
- * The associated value for `set` operations. The value will be the new value
32
- * at the key path.
33
- *
34
- * All other types of update results do not have this property set.
35
- */
36
- readonly value?: any
37
-
38
- /** The associated amount, only set if {@link type} is `incremented`. */
39
- readonly amount?: number
40
-
41
- // ----------------------------------------------------------- Internal ------
42
-
43
- /** @internal */
44
- static set(docID: DocumentID, path: string, value?: any): UpdateResult {
45
- return new UpdateResult('set', docID, path, value, undefined)
46
- }
47
-
48
- /** @internal */
49
- static incremented(docID: DocumentID, path: string, amount: number): UpdateResult {
50
- return new UpdateResult('incremented', docID, path, undefined, amount)
51
- }
52
-
53
- /** @internal */
54
- static removed(docID: DocumentID, path: string): UpdateResult {
55
- return new UpdateResult('removed', docID, path, undefined, undefined)
56
- }
57
-
58
- /** @internal */
59
- private constructor(type: UpdateResultType, docID: DocumentID, path: string, value?: any, amount?: number) {
60
- this.type = type
61
- this.docID = docID
62
- this.path = path
63
- if (value !== undefined) this.value = value
64
- if (amount !== undefined) this.amount = amount
65
- }
66
- }
@@ -1,57 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import { DocumentID } from './document-id'
6
- import { UpdateResult } from './update-result'
7
-
8
- import type { DocumentIDValue } from './document-id'
9
-
10
- /**
11
- * Maps a {@link DocumentID} to an array of
12
- * {@link UpdateResult | update results}. This is the data structure you get
13
- * when {@link PendingCursorOperation.update | updating} a set of documents
14
- * with detailed info about the performed updates.
15
- */
16
- export class UpdateResultsMap {
17
- /**
18
- * Returns an array of {@link UpdateResult | update results} associated with
19
- * the `documentID` or undefined if not found.
20
- */
21
- get(documentIDOrValue: DocumentID | DocumentIDValue): UpdateResult[] | undefined {
22
- const documentID: DocumentID = documentIDOrValue instanceof DocumentID ? documentIDOrValue : new DocumentID(documentIDOrValue)
23
- const documentIDString = documentID.toString()
24
- return this.updateResultsByDocumentIDString[documentIDString]
25
- }
26
-
27
- /**
28
- * Returns all contained keys, i.e. {@link DocumentID | document IDs}
29
- * contained in this map.
30
- */
31
- keys(): DocumentID[] {
32
- return this.documentIDs.slice()
33
- }
34
-
35
- // ----------------------------------------------------------- Internal ------
36
-
37
- /** @internal */
38
- constructor(documentIDs: DocumentID[], updateResultsByDocumentIDString: object) {
39
- const documentIDStrings = documentIDs
40
- .map((documentID) => documentID.toString())
41
- .sort()
42
- .join(', ')
43
- const updateResultsKeys = Object.keys(updateResultsByDocumentIDString).sort().join(', ')
44
-
45
- if (documentIDStrings !== updateResultsKeys) {
46
- throw new Error("Internal inconsistency, can't construct update results map, documentIDs must all be keys in update results (by document ID string)")
47
- }
48
-
49
- this.documentIDs = documentIDs.slice()
50
- this.updateResultsByDocumentIDString = { ...updateResultsByDocumentIDString }
51
- }
52
-
53
- // ------------------------------------------------------------ Private ------
54
-
55
- private documentIDs: DocumentID[]
56
- private updateResultsByDocumentIDString: object
57
- }
@@ -1,6 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- /** @internal */
6
- export class WebsocketClient {}
@@ -1,122 +0,0 @@
1
- //
2
- // Copyright © 2023 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import * as FFI from './ffi'
6
-
7
- import { Bridge } from './bridge'
8
- import { CBOR } from './cbor'
9
- import { desugarJSObject } from './augment'
10
- import { DocumentID } from './document-id'
11
- import { performAsyncToWorkaroundNonAsyncFFIAPI } from './internal'
12
- import { WriteTransactionPendingCursorOperation } from './write-transaction-pending-cursor-operation'
13
- import { WriteTransactionPendingIDSpecificOperation } from './write-transaction-pending-id-specific-operation'
14
-
15
- import type { Store } from './store'
16
- import type { QueryArguments } from './essentials'
17
- import type { DocumentValue } from './document'
18
- import type { CollectionInterface, UpsertOptions } from './collection-interface'
19
- import type { WriteTransaction } from './write-transaction'
20
-
21
- /**
22
- * Represents a collection of a Ditto store that is used in the context of a
23
- * write transaction.
24
- *
25
- * Supports most of a regular {@link Collection | collection}'s functionality
26
- * but cannot be subscribed or live queried and can not be used to create
27
- * attachments.
28
- *
29
- * Create a `WriteTransactionCollection` by starting a {@link WriteTransaction}
30
- * and using its `scoped` method.
31
- */
32
- export class WriteTransactionCollection implements CollectionInterface {
33
- /** The name of the collection. */
34
- readonly name: string
35
-
36
- /**
37
- * The store this collection belongs to.
38
- * @internal
39
- */
40
- readonly store: Store
41
-
42
- /**
43
- * The write transaction within which this collection instance is used.
44
- * @internal
45
- */
46
- readonly writeTransaction: WriteTransaction
47
-
48
- /**
49
- * Search for documents in this collection using the provided query string.
50
- *
51
- * The returned cursor operation can be used to chain operations on the
52
- * resulting document set.
53
- *
54
- * @param query The query to run against the collection.
55
- * @param queryArgs These arguments replace placeholders in the provided
56
- * query.
57
- */
58
- find(query: string, queryArgs?: QueryArguments | undefined): WriteTransactionPendingCursorOperation {
59
- return new WriteTransactionPendingCursorOperation(query, queryArgs ?? null, this)
60
- }
61
-
62
- /**
63
- * Convenience method, equivalent to calling {@link find | find()} and passing
64
- * the query `"true"`.
65
- */
66
- findAll(): WriteTransactionPendingCursorOperation {
67
- return this.find('true')
68
- }
69
-
70
- /**
71
- * Generates a {@link WriteTransactionPendingIDSpecificOperation} with the
72
- * provided document ID.
73
- *
74
- * The returned object can be used to find and return the document. It can also be used to update, remove or evict the document.
75
- *
76
- * @param id The ID of the document to find.
77
- */
78
- findByID(id: any): WriteTransactionPendingIDSpecificOperation {
79
- const documentID: DocumentID = id instanceof DocumentID ? id : new DocumentID(id)
80
- return new WriteTransactionPendingIDSpecificOperation(documentID, this)
81
- }
82
-
83
- async upsert(value: DocumentValue, options: UpsertOptions = {}): Promise<DocumentID> {
84
- const ditto = this.store.ditto
85
- const dittoHandle = Bridge.ditto.handleFor(ditto)
86
- return ditto.deferCloseAsync(async () => {
87
- const writeStrategy = options.writeStrategy ?? 'merge'
88
-
89
- const documentValueJSON = desugarJSObject(value, true)
90
- const documentValueCBOR = CBOR.encode(documentValueJSON)
91
-
92
- const idCBOR = await performAsyncToWorkaroundNonAsyncFFIAPI(async () => {
93
- return await FFI.collectionInsertValue(dittoHandle.deref(), this.name, documentValueCBOR, writeStrategy, this.writeTransaction.writeTransactionPointer)
94
- })
95
-
96
- const insertedDocumentId = new DocumentID(idCBOR, true)
97
- this.writeTransaction.addResult('inserted', insertedDocumentId, this.name)
98
-
99
- return new DocumentID(idCBOR, true)
100
- })
101
- }
102
-
103
- /**
104
- * See comment in {@link CollectionInterface.findByIDCBOR()}
105
- *
106
- * @internal */
107
- findByIDCBOR(idCBOR: Uint8Array): WriteTransactionPendingIDSpecificOperation {
108
- const documentID = new DocumentID(idCBOR, true, true)
109
- return new WriteTransactionPendingIDSpecificOperation(documentID, this)
110
- }
111
-
112
- /**
113
- * This constructor is marked internal because write transaction collections
114
- * should be created from a {@link WriteTransaction} instance.
115
- *
116
- * @internal */
117
- constructor(name: string, store: Store, writeTransaction: WriteTransaction) {
118
- this.name = name
119
- this.store = store
120
- this.writeTransaction = writeTransaction
121
- }
122
- }