@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,116 +0,0 @@
1
- //
2
- // Copyright © 2023 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import * as FFI from './ffi'
6
- import { CBOR } from './cbor'
7
- import { Bridge } from './bridge'
8
- import { Document } from './document'
9
-
10
- /**
11
- * Represents a single match of a DQL query, similar to a “row” in SQL terms.
12
- * It’s a reference type serving as a “cursor”, allowing for efficient access of
13
- * the underlying data in various formats.
14
- *
15
- * The {@link QueryResultItem.value | value } property is lazily
16
- * materialized and kept in memory until it goes out of scope. To reduce the
17
- * memory footprint, structure your code such that items can be processed as a
18
- * stream, i.e. one by one (or in batches) and
19
- * {@link QueryResultItem.dematerialize | dematerialize() } them
20
- * right after use.
21
- */
22
- export class QueryResultItem {
23
- /**
24
- * Returns the content as a materialized object.
25
- *
26
- * The item's value is
27
- * {@link QueryResultItem.materialize | materialized() } on first access
28
- * and subsequently on each access after performing
29
- * {@link QueryResultItem.dematerialize | dematerialize() }. Once
30
- * materialized, the value is kept in memory until explicitly
31
- * {@link QueryResultItem.dematerialize | dematerialize() }-ed or the item
32
- * goes out of scope.
33
- *
34
- * Note: This property is very similar to {@link Document.value}.
35
- */
36
- get value(): any {
37
- this.materialize()
38
- if (this.materializedValue === undefined) {
39
- throw new Error('Internal Error: Materialized value is undefined')
40
- }
41
- return this.materializedValue
42
- }
43
-
44
- /**
45
- * Returns `true` if value is currently held materialized in memory, otherwise
46
- * returns `false`.
47
- *
48
- * See {@link QueryResultItem.materialize | materialize()} and
49
- * {@link QueryResultItem.dematerialize | dematerialize()}.
50
- */
51
- get isMaterialized(): boolean {
52
- return this.materializedValue !== undefined
53
- }
54
-
55
- /**
56
- * Loads the CBOR representation of the item's content, decodes it as an
57
- * object so it can be accessed via {@link QueryResultItem.value | value }.
58
- * Keeps the object in memory until
59
- * {@link QueryResultItem.dematerialize | dematerialize() } is called. No-op
60
- * if {@link QueryResultItem.value | value } is already materialized.
61
- */
62
- materialize(): void {
63
- if (!this.isMaterialized) {
64
- const cborValue = this.cborData()
65
- let materializedValue: any
66
- try {
67
- materializedValue = CBOR.decode(cborValue)
68
- } catch (error: any) {
69
- throw new Error(`Internal inconsistency: CBOR decoding error while materializing result item: ${error.message}`)
70
- }
71
-
72
- if (materializedValue === undefined) {
73
- throw new Error('Internal inconsistency: Materialized value is undefined')
74
- }
75
-
76
- this.materializedValue = materializedValue
77
- }
78
- }
79
-
80
- /**
81
- * Releases the materialized value from memory. No-op if item is not
82
- * materialized.
83
- */
84
- dematerialize(): void {
85
- this.materializedValue = undefined
86
- }
87
-
88
- /**
89
- * Returns the content of the item as CBOR data.
90
- *
91
- * Important: The returned CBOR data is not cached, make sure to call this
92
- * method once and keep it for as long as needed.
93
- */
94
- cborData(): Uint8Array {
95
- const resultHandle = Bridge.dqlResult.handleFor(this)
96
- return FFI.dqlResultCBOR(resultHandle.deref())
97
- }
98
-
99
- /**
100
- * Returns the content of the item as a JSON string.
101
- *
102
- * Important: The returned JSON string is not cached, make sure to call this
103
- * method once and keep it for as long as needed.
104
- */
105
- jsonString(): string {
106
- const resultHandle = Bridge.dqlResult.handleFor(this)
107
- return FFI.dqlResultJSON(resultHandle.deref())
108
- }
109
-
110
- // ----------------------------------------------------------- Internal ------
111
-
112
- private materializedValue: any
113
-
114
- /** @internal */
115
- constructor() {}
116
- }
@@ -1,55 +0,0 @@
1
- //
2
- // Copyright © 2023 DittoLive Incorporated. All rights reserved.
3
- //
4
- import * as FFI from './ffi'
5
-
6
- import { Bridge } from './bridge'
7
- import { QueryResultItem } from './query-result-item'
8
- import { DocumentID } from './document-id'
9
-
10
- import type { Store } from './store'
11
-
12
- /**
13
- * Represents results returned when executing a DQL query containing a
14
- * {@link QueryResultItem} for each match.
15
- *
16
- * More info, such as metrics, will be provided in the near future.
17
- */
18
- export class QueryResult {
19
- /**
20
- * Individual items matching a DQL query.
21
- */
22
- readonly items: QueryResultItem[]
23
-
24
- /**
25
- * IDs of documents that were mutated _locally_ by a _mutating_ DQL query
26
- * passed to {@link Store.execute | `execute()`}. Empty array if no documents
27
- * have been mutated.
28
- *
29
- * **Note: Query results received from a {@link StoreObserver} never contain
30
- * mutated document IDs because a store observer is always registered using a
31
- * non-mutating `SELECT` query.
32
- *
33
- * **Important:** The returned document IDs are not cached, make sure to call
34
- * this method once and keep the return value for as long as needed.
35
- *
36
- * @returns an array of document IDs
37
- */
38
- mutatedDocumentIDs(): DocumentID[] {
39
- const responseHandle = Bridge.dqlResponse.handleFor(this)
40
- const affectedCBORIDs = FFI.dqlMutatedDocumentIDs(responseHandle.deref())
41
- return affectedCBORIDs.map((id) => new DocumentID(id, true))
42
- }
43
-
44
- // ----------------------------------------------------- Internal ------------
45
-
46
- /** @internal */
47
- constructor(responsePointer: FFI.Pointer<FFI.FFIDqlResponse>) {
48
- if (responsePointer == null) {
49
- throw new Error('Internal inconsistency, failed to initialize query result without a response pointer')
50
- }
51
-
52
- const results = FFI.dqlResponseResults(responsePointer)
53
- this.items = results.map((r) => Bridge.dqlResult.bridge(r))
54
- }
55
- }
@@ -1,92 +0,0 @@
1
- //
2
- // Copyright © 2022 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
-
6
- const privateToken = '@ditto.ff82dae89821c5ab822a8b539056bce4'
7
-
8
- /**
9
- * Represents a CRDT register that can be upserted as part of a document or
10
- * assigned to a property during an update of a document.
11
- */
12
- export class Register {
13
- /** Returns the value of the register. */
14
- get value(): any {
15
- return this['@ditto.value']
16
- }
17
-
18
- /**
19
- * Creates a new Register that can be used as part of a document's content.
20
- */
21
- constructor(value: any) {
22
- this['@ditto.value'] = value
23
- }
24
-
25
- /** @internal */
26
- static '@ditto.create'(mutableDocument, path, value) {
27
- const register = mutableDocument ? new (MutableRegister as any)(value, privateToken) : new Register(value)
28
- register['@ditto.mutableDocument'] = mutableDocument
29
- register['@ditto.path'] = path
30
- register['@ditto.value'] = value
31
- return register
32
- }
33
-
34
- /** @internal */
35
- protected '@ditto.mutableDocument': any
36
-
37
- /** @internal */
38
- protected '@ditto.path': any
39
-
40
- /** @internal */
41
- protected '@ditto.value': any
42
- }
43
-
44
- // -----------------------------------------------------------------------------
45
-
46
- /**
47
- * Represents a mutable CRDT register that can be set to a specific value when
48
- * updating a document.
49
- *
50
- * This class can't be instantiated directly, it's returned automatically for
51
- * any register property of a document within an update block via {@link MutableDocumentPath.register}.
52
- */
53
- export class MutableRegister extends Register {
54
- /** Returns the value of the register. */
55
- get value(): any {
56
- return super.value
57
- }
58
-
59
- /**
60
- * Convenience setter, equivalent to {@link set | set()}.
61
- */
62
- set value(value: any) {
63
- this.set(value)
64
- }
65
-
66
- /**
67
- * Sets the register to the provided value.
68
- *
69
- * Only valid within the `update` closure of
70
- * {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
71
- * {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
72
- * otherwise an exception is thrown.
73
- */
74
- set(value: any) {
75
- const mutableDocument = this['@ditto.mutableDocument']
76
- const path = this['@ditto.path']
77
-
78
- mutableDocument.at(path)['@ditto.set'](value)
79
-
80
-
81
- this['@ditto.value'] = value
82
- }
83
-
84
- /** @internal */
85
- constructor(value: any) {
86
- if (arguments[1] === privateToken) {
87
- super(value)
88
- } else {
89
- throw new Error(`MutableRegister constructor is for internal use only.`)
90
- }
91
- }
92
- }
@@ -1,176 +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 { Ditto } from './ditto'
9
-
10
- /**
11
- * Specifies which peers to replicate the small peer info to when enabled.
12
- *
13
- * Possible values are:
14
- *
15
- * - `LocalPeerOnly`: no replication (default)
16
- * - `BigPeerOnly`: replicate to the Big Peer
17
- */
18
- export type SmallPeerInfoSyncScope = 'LocalPeerOnly' | 'BigPeerOnly'
19
-
20
- /**
21
- * The entrypoint for small peer user info collection. Small peer info consists
22
- * of information gathered into a system collection on a regular interval and
23
- * optionally synced to the Big Peer for device dashboard and debugging
24
- * purposes.
25
- *
26
- * An instance of this class is available on each `Ditto` instance via its
27
- * {@link Ditto.smallPeerInfo | `smallPeerInfo`} property. Instantiating this
28
- * class directly is not supported.
29
- */
30
- export class SmallPeerInfo {
31
- /**
32
- * Indicates whether small peer info collection is currently enabled, defaults
33
- * to `false`.
34
- *
35
- * **Note**: whether the background ingestion process is enabled or not is a
36
- * separate decision to whether this information is allowed to sync to other
37
- * peers (including the big peer). This is controlled by
38
- * {@link getSyncScope | getSyncScope()} and
39
- * {@link setSyncScope | setSyncScope()}.
40
- */
41
- get isEnabled(): boolean {
42
- const dittoHandle = Bridge.ditto.handleFor(this.ditto)
43
- return this.ditto.deferClose(() => {
44
- return FFI.dittoSmallPeerInfoGetIsEnabled(dittoHandle.deref())
45
- })
46
- }
47
-
48
- /**
49
- * Set whether small peer info collection is enabled.
50
- *
51
- * @throws when set to a non-boolean value.
52
- */
53
- set isEnabled(newValue: boolean) {
54
- if (typeof newValue !== 'boolean') {
55
- throw new TypeError(`Expected boolean, got ${typeof newValue}`)
56
- }
57
-
58
- const dittoHandle = Bridge.ditto.handleFor(this.ditto)
59
- this.ditto.deferClose(() => {
60
- FFI.dittoSmallPeerInfoSetEnabled(dittoHandle.deref(), newValue)
61
- })
62
- }
63
-
64
- /**
65
- * The metadata associated with the small peer info.
66
- *
67
- * Small peer info metadata is a free-form, user-provided JSON object that
68
- * is inserted into the small peer info system document at each collection
69
- * interval.
70
- */
71
- get metadata(): Record<string, any> {
72
- return JSON.parse(this.metadataJSONString)
73
- }
74
-
75
- /**
76
- * Set the metadata associated with the small peer info.
77
- *
78
- * The metadata must be a JSON-serializable object that conforms to the
79
- * following constraints:
80
- *
81
- * - Must be a JSON object (not an array, string, number, etc.)
82
- * - The size when encoded as JSON must be less than 128 KB
83
- * - May only be nested up to 2 levels deep
84
- *
85
- * @example <caption>Valid metadata</caption>
86
- * ditto.smallPeerInfo.metadata = {
87
- * "foo": "bar",
88
- * "nested": {
89
- * "inner": "value"
90
- * }
91
- * }
92
- *
93
- * @example <caption>Invalid metadata</caption>
94
- * // This is invalid and results in an error.
95
- * ditto.smallPeerInfo.metadata = {
96
- * "foo": "bar",
97
- * "nested": {
98
- * "illegal": {
99
- * "inner": "value"
100
- * }
101
- * }
102
- * }
103
- *
104
- * @throws when set to a value that violates any of the constraints listed
105
- * above.
106
- */
107
- set metadata(metadata: Record<string, any>) {
108
- this.metadataJSONString = JSON.stringify(metadata)
109
- }
110
-
111
- /**
112
- * The metadata associated with the small peer info, as a JSON string.
113
- */
114
- get metadataJSONString(): string {
115
- const dittoHandle = Bridge.ditto.handleFor(this.ditto)
116
- return this.ditto.deferClose(() => {
117
- return FFI.dittoSmallPeerInfoGetMetadata(dittoHandle.deref())
118
- })
119
- }
120
-
121
- /**
122
- * Set the metadata associated with the small peer info, as a JSON string.
123
- *
124
- * @see {@link SmallPeerInfo.metadata | `metadata`} for more information on
125
- * valid values.
126
- * @throws when set to a value that violates any of the constraints listed in
127
- * {@link SmallPeerInfo.metadata | `metadata`}.
128
- */
129
- set metadataJSONString(metadata: string) {
130
- if (typeof metadata !== 'string') {
131
- throw new TypeError(`Expected string, got ${typeof metadata}`)
132
- }
133
- const dittoHandle = Bridge.ditto.handleFor(this.ditto)
134
- this.ditto.deferClose(() => {
135
- FFI.dittoSmallPeerInfoSetMetadata(dittoHandle.deref(), metadata)
136
- })
137
- }
138
-
139
- /**
140
- * Determines which "kind" of peers the small peer info will be
141
- * replicated to.
142
- *
143
- * Defaults to `LocalPeerOnly`, which means no replication. Set this to
144
- * `BigPeerOnly` to replicate collected info to the Big Peer.
145
- */
146
- async getSyncScope(): Promise<SmallPeerInfoSyncScope> {
147
- const dittoHandle = Bridge.ditto.handleFor(this.ditto)
148
- return this.ditto.deferCloseAsync(async () => {
149
- return FFI.dittoSmallPeerInfoGetSyncScope(dittoHandle.deref())
150
- })
151
- }
152
-
153
- /**
154
- * Set the sync scope.
155
- *
156
- * See {@link getSyncScope} for more information.
157
- *
158
- * @param syncScope the new sync scope.
159
- * @throws when set to a value other than `BigPeerOnly` or `LocalPeerOnly`.
160
- */
161
- async setSyncScope(syncScope: SmallPeerInfoSyncScope): Promise<void> {
162
- const dittoHandle = Bridge.ditto.handleFor(this.ditto)
163
- return this.ditto.deferCloseAsync(async () => {
164
- return FFI.dittoSmallPeerInfoSetSyncScope(dittoHandle.deref(), syncScope as any)
165
- })
166
- }
167
-
168
- // ----------------------------------------------------------- Internal ------
169
-
170
- private ditto: Ditto
171
-
172
- /** @internal */
173
- constructor(ditto: Ditto) {
174
- this.ditto = ditto
175
- }
176
- }
@@ -1,6 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- /** @internal */
6
- export class StaticTCPClient {}
@@ -1,176 +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, documentIDReplacer } from './cbor'
9
- import { DittoError, mapFFIErrors } from './error'
10
- import { Logger } from './logger'
11
- import { QueryResult } from './query-result'
12
-
13
- import type { Ditto } from './ditto'
14
- import type { DQLQueryArguments } from './essentials'
15
- import type { Store } from './store'
16
-
17
- /**
18
- * A store observation handler is called whenever an active store observer
19
- * receives new results.
20
- */
21
- export type StoreObservationHandler = (queryResult: QueryResult) => void
22
-
23
- /**
24
- * A store observation handler is called whenever an active store observer
25
- * receives new results.
26
- *
27
- * Call `signalNext()` to signal that the handler is ready to receive the next
28
- * callback from the store observer.
29
- */
30
- export type StoreObservationHandlerWithSignalNext = (queryResult: QueryResult, signalNext: () => void) => void
31
-
32
- /**
33
- * A store observer invokes a given handler whenever results for its query
34
- * change.
35
- *
36
- * The store observer will remain active until it is {@link cancel | cancelled},
37
- * or the Ditto instance managing the observer has been
38
- * {@link Ditto.close | closed}.
39
- *
40
- * Create a store observer by calling
41
- * {@link Store.registerObserver | `ditto.store.registerObserver()`}.
42
- */
43
- export class StoreObserver {
44
- /**
45
- * The Ditto instance this store observer is registered with.
46
- */
47
- readonly ditto: Ditto
48
-
49
- /**
50
- * The query string of the store observer (as passed when registering it).
51
- */
52
- readonly queryString: string
53
-
54
- /**
55
- * The query arguments of the store observer (as passed when registering it).
56
- */
57
- readonly queryArguments?: Readonly<DQLQueryArguments>
58
-
59
- /**
60
- * Convenience property, returns `true` once the store observer has been
61
- * cancelled.
62
- */
63
- get isCancelled(): boolean {
64
- return this._isCancelled
65
- }
66
-
67
- /**
68
- * Cancels the store observer and unregisters it. No-op if the
69
- * store observer has already been cancelled.
70
- */
71
- cancel() {
72
- if (this._isCancelled) return
73
- this._isCancelled = true
74
- this.ditto.store.unregisterObserver(this)
75
- }
76
-
77
- // --------------------------- Internal -------------------------------------
78
-
79
- /**
80
- * The ID of this observer's live query.
81
- *
82
- * @internal
83
- */
84
- readonly liveQueryID: number
85
-
86
- /** @internal */
87
- constructor(ditto: Ditto, query: string, queryArguments: DQLQueryArguments | null, observationHandler: StoreObservationHandlerWithSignalNext) {
88
- this.queryString = query
89
- this.queryArguments = queryArguments ? Object.freeze({ ...queryArguments }) : undefined
90
- this.ditto = ditto
91
-
92
- let queryArgumentsCBOR: Uint8Array | null = null
93
- if (queryArguments != null) {
94
- try {
95
- queryArgumentsCBOR = CBOR.encode(queryArguments, documentIDReplacer)
96
- } catch (error: any) {
97
- throw new DittoError('query/arguments-invalid')
98
- }
99
- }
100
- let storeObserverID: number | undefined
101
- const dittoHandle = Bridge.ditto.handleFor(ditto)
102
- this.ditto.deferClose(() => {
103
- const weakThis = new WeakRef(this)
104
-
105
- function wrappedObservationHandler(cCBParams: CCallbackParams): void {
106
- const strongThis = weakThis.deref()
107
- if (strongThis == null) {
108
- Logger.debug(`Ignoring change event received by store observer ${storeObserverID} after it was cancelled`)
109
- return
110
- }
111
-
112
- const response = Bridge.dqlResponse.bridge(cCBParams.query_result, () => new QueryResult(cCBParams.query_result))
113
-
114
- Logger.debug(`Invoking user event handler with new event for store observer ${storeObserverID}`)
115
- observationHandler(response, () => {
116
- strongThis.signalNext()
117
- })
118
- }
119
-
120
- const errorContext = {
121
- query,
122
- queryArguments,
123
- }
124
-
125
- mapFFIErrors(
126
- () => {
127
- storeObserverID = FFI.tryExperimentalRegisterChangeObserver(dittoHandle.deref(), query, queryArgumentsCBOR, wrappedObservationHandler)
128
- },
129
- undefined,
130
- errorContext,
131
- )
132
- })
133
-
134
- if (storeObserverID == null) {
135
- throw new DittoError('internal', 'Internal inconsistency, store observer ID is undefined after registering')
136
- }
137
-
138
- this.liveQueryID = storeObserverID
139
- }
140
-
141
- // --------------------------- Private --------------------------------------
142
-
143
- /**
144
- * `true` when the store observer has been cancelled.
145
- *
146
- * We mark the store observer as cancelled here as an optimization to avoid a
147
- * scan of all store observers in the store whenever the `isCancelled`
148
- * property is checked.
149
- */
150
- private _isCancelled = false
151
-
152
- /**
153
- * Signals to Ditto Core that the observer is ready for the next event.
154
- */
155
- private signalNext() {
156
- const ditto = this.ditto
157
- if (!ditto || ditto.isClosed) return
158
-
159
- const dittoHandle = Bridge.ditto.handleFor(ditto)
160
- const dittoPointer = dittoHandle.derefOrNull()
161
- if (!dittoPointer) return
162
-
163
- if (this.liveQueryID == null) {
164
- throw new Error('live query ID is null while signaling ready for next event')
165
- }
166
-
167
- return ditto.deferCloseAsync(async () => {
168
- Logger.debug(`Signaling availability for live query ${this.liveQueryID}`)
169
- await FFI.liveQuerySignalAvailableNext(dittoPointer, this.liveQueryID)
170
- })
171
- }
172
- }
173
-
174
- type CCallbackParams = {
175
- query_result: FFI.Pointer<FFI.FFIDqlResponse>
176
- }