@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,52 +0,0 @@
1
- //
2
- // Copyright © 2023 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- export type ErrorCode = keyof typeof ERROR_CODES
6
-
7
- /**
8
- * Error code and default error message for all Ditto error messages.
9
- *
10
- * Keys of this object define _error codes_ with each value containing the
11
- * accompanying error description that is set as the default error message for
12
- * errors instantiated with this code.
13
- *
14
- * Error codes may start with an error domain and a slash to group categories of
15
- * errors together.
16
- */
17
- export const ERROR_CODES = {
18
- /** Internal error for unexpected system states */
19
- internal: 'An unexpected internal error occured. Please get in touch with Ditto customer service to report this incident.',
20
-
21
- /** Internal error with an unknown error cause **/
22
- 'internal/unknown-error': 'An unexpected internal error occured. Please get in touch with Ditto customer service to report this incident.',
23
-
24
- //
25
- // Query errors
26
- //
27
-
28
- /** Error for invalid DQL query arguments. */
29
- 'query/arguments-invalid': 'The query arguments were invalid.',
30
-
31
- /** Errors that occur during execution of a query */
32
- 'query/execution': 'The query could not be executed.',
33
-
34
- /** Error for an invalid DQL query. */
35
- 'query/invalid': 'The query was invalid.',
36
-
37
- /** Error for a query that uses DQL features not supported in this version or not supported by the currently used API. */
38
- 'query/unsupported': 'The query contains unsupported features.',
39
-
40
- //
41
- // Store errors
42
- //
43
-
44
- /** Error in the storage backend. */
45
- 'store/backend': 'An error occurred with the storage backend.',
46
-
47
- /** Error for an invalid CRDT. */
48
- 'store/crdt': 'An error occurred processing a CRDT.',
49
-
50
- /** Error for a document not found. */
51
- 'store/document-not-found': 'The document with the provided ID could not be found.',
52
- } as const
@@ -1,203 +0,0 @@
1
- //
2
- // Copyright © 2023 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import { ErrorCode, ERROR_CODES } from './error-codes'
6
- import { DittoFFIError } from './ffi-error'
7
-
8
- /**
9
- * Additional data, which provides context to the error and may help with
10
- * debugging.
11
- *
12
- * **Warning:** The contents of this object may change in future versions of
13
- * the SDK.
14
- */
15
- export type ErrorContext = Record<string, any>
16
-
17
- /** @see {@link FFIErrorMapping} */
18
- const DEFAULT_STATUS_CODE_MAPPING: FFIErrorMapping = {
19
- JsFloatingStoreOperation: ['internal', 'Internal inconsistency, an outstanding store operation was not awaited.'],
20
-
21
- DqlQueryCompilation: ['query/invalid'],
22
- DqlInvalidQueryArgs: ['query/arguments-invalid'],
23
- DqlUnsupported: ['query/unsupported'],
24
- StoreQuery: ['query/execution'],
25
-
26
- StoreDocumentNotFound: ['store/document-not-found'],
27
- StoreDatabase: ['store/backend'],
28
- Crdt: ['store/crdt'],
29
-
30
- default: ['internal/unknown-error'],
31
- }
32
-
33
- /**
34
- * `DittoError` is a subclass of the default Javascript `Error`. You can
35
- * identify specific errors programatically using the
36
- * {@link DittoError.code | code} property.
37
- *
38
- * Please reference {@link ERROR_CODES} for a comprehensive list of
39
- * possible error codes in this SDK version.
40
- */
41
- export class DittoError extends Error {
42
- /**
43
- * Use the error code to identify a specific error programatically.
44
- *
45
- * @see {@link ERROR_CODES} for a comprehensive list of possible
46
- * error codes in this SDK version.
47
- */
48
- readonly code: ErrorCode = 'internal'
49
-
50
- /** Some environments provide a stack trace that is attached to any error. */
51
- readonly stack?: string
52
-
53
- /**
54
- * Additional data, which provides context to the error and may help with
55
- * debugging.
56
- *
57
- * **Warning:** The contents of this object may change in future versions of
58
- * the SDK.
59
- */
60
- readonly context: Readonly<ErrorContext>
61
-
62
- // --------------------------------------- Internal ------------------------
63
-
64
- /**
65
- * @internal
66
- * @param code string error code, see {@link ERROR_CODES}
67
- * @param message optional error message that replace's the message for the given error code
68
- * @param context optional object containing data that can help debug this error
69
- * @throws {@link DittoError} `internal`: when supplied with an invalid error code
70
- */
71
- constructor(code: ErrorCode, message?: string | null, context: ErrorContext = {}) {
72
- if (ERROR_CODES[code] == null) {
73
- throw new DittoError('internal', `Invalid error code: ${code}`)
74
- }
75
- super(`<${code}> ${message || ERROR_CODES[code]}`)
76
-
77
- this.code = code
78
- this.context = Object.freeze({ ...context })
79
- }
80
-
81
- /**
82
- * Create a {@link DittoError} from a {@link DittoFFIError}.
83
- *
84
- * The error message will be set to the optional `messageOverride` parameter
85
- * if supplied, otherwise it will be taken from the `message` property of the
86
- * given {@link DittoFFIError}. In any case, the details of the underlying FFI
87
- * error are made available in the error context of the returned {@link DittoError}.
88
- *
89
- * @internal
90
- * @param code string error code from {@link ERROR_CODES}
91
- * @param messageOverride optional string that will be used as the error
92
- * message even if a thread-local error message has been retrieved from the
93
- * FFI
94
- * @param context optional object containing data that can help debug this error
95
- * @returns {@link DittoError}
96
- */
97
- static fromFFIError(ffiError: DittoFFIError, code: ErrorCode, messageOverride?: string, context?: ErrorContext): DittoError {
98
- const message = messageOverride || ffiError.message
99
- const errorContext = {
100
- coreError: ffiError.code,
101
- coreErrorMessage: ffiError.message,
102
- ...context,
103
- }
104
- return new DittoError(code, message, errorContext)
105
- }
106
- }
107
-
108
- /**
109
- * Wraps the given function to catch any {@link DittoFFIError} and rethrow it as
110
- * a {@link DittoError}, mapping status codes of the {@link DittoFFIError} to
111
- * error codes of the {@link DittoError} using the given `statusCodeMapping`.
112
- *
113
- * Use either this function or {@link mapFFIErrorsAsync} to wrap all calls into
114
- * the FFI that can fail.
115
- *
116
- * If the given status code mapping contains error messages, they will replace
117
- * any error message that is returned by the FFI.
118
- *
119
- * @internal
120
- * @param closure function that can throw a {@link DittoFFIError}
121
- * @param statusCodeMapping optional mapping of status codes of the
122
- * {@link DittoFFIError} to error codes of the {@link DittoError}
123
- * @param context optional object containing data that can help debug this error
124
- * @throws {@link DittoError} when the wrapped function throws a {@link DittoFFIError}
125
- */
126
- export function mapFFIErrors<T>(closure: () => T, statusCodeMapping?: FFIErrorMapping, context?: ErrorContext): T {
127
- try {
128
- return closure()
129
- } catch (error) {
130
- if (error instanceof DittoFFIError) {
131
- throw translateFFIError(error, statusCodeMapping, context)
132
- }
133
- throw error
134
- }
135
- }
136
-
137
- /**
138
- * Wraps the given async function to catch any {@link DittoFFIError} and rethrow
139
- * it as a {@link DittoError}, mapping status codes of the {@link DittoFFIError}
140
- * to error codes of the {@link DittoError} using the given `statusCodeMapping`.
141
- *
142
- * Use either this function or {@link mapFFIErrors} to wrap any calls into the
143
- * FFI that can fail.
144
- *
145
- * If the given status code mapping contains error messages, they will replace
146
- * any error message that is returned by the FFI.
147
- *
148
- * @internal
149
- * @param closure async function that can throw a {@link DittoFFIError}
150
- * @param statusCodeMapping optional mapping of status codes of the
151
- * {@link DittoFFIError} to error codes of the {@link DittoError}.
152
- * @param context optional object containing data that can help debug this error
153
- * @throws {@link DittoError} when the wrapped function throws a {@link DittoFFIError}
154
- */
155
- export async function mapFFIErrorsAsync<T>(closure: () => Promise<T>, statusCodeMapping?: FFIErrorMapping, context?: ErrorContext): Promise<T> {
156
- try {
157
- return await closure()
158
- } catch (error) {
159
- if (error instanceof DittoFFIError) {
160
- throw translateFFIError(error, statusCodeMapping, context)
161
- }
162
- throw error
163
- }
164
- }
165
-
166
- /**
167
- * Defines which status code of an FFI response should be mapped to which error
168
- * code of a {@link DittoError}.
169
- *
170
- * The second element of the tuple is an optional string that will be used as
171
- * the error message of the {@link DittoError} instead of the FFI error message
172
- * if defined.
173
- *
174
- * If a key `default` is present, it will be used as the error code if no
175
- * mapping for a given status code is found.
176
- *
177
- * @example
178
- * ```typescript
179
- * const statusCodeMapping: FFIErrorMapping = {
180
- * '1': ['activation/failed', 'It just didn\'t work out'],
181
- * 'default': ['sdk/environment-incompatible']
182
- * }
183
- * ```
184
- *
185
- * @internal
186
- */
187
- type FFIErrorMapping = {
188
-
189
- [statusCode: string]: [ErrorCode, string?]
190
- }
191
-
192
- const translateFFIError = (ffiError: DittoFFIError, customStatusCodeMapping?: FFIErrorMapping, context?: ErrorContext): DittoError => {
193
-
194
- const statusCode = ffiError.code.toString()
195
-
196
- let code: ErrorCode, message: string | undefined
197
- if (customStatusCodeMapping != null && customStatusCodeMapping[statusCode] != null) {
198
- ;[code, message] = customStatusCodeMapping[statusCode]
199
- } else {
200
- ;[code, message] = DEFAULT_STATUS_CODE_MAPPING[statusCode] ?? DEFAULT_STATUS_CODE_MAPPING.default
201
- }
202
- return DittoError.fromFFIError(ffiError, code, message, context)
203
- }
@@ -1,53 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import { DocumentID } from './document-id'
6
-
7
- /**
8
- * Describes the direction when sorting a query.
9
- */
10
- export type SortDirection = 'ascending' | 'descending'
11
-
12
- /**
13
- * Defines the various strategies available when inserting a document into a
14
- * collection.
15
- *
16
- * - `merge`: the existing document will be merged with the document being
17
- * inserted, if there is a pre-existing document.
18
- *
19
- * - `insertIfAbsent`: insert the document only if there is not already a
20
- * document with the same ID in the store. If there is already a document in
21
- * the store with the same ID then this will be a no-op.
22
- *
23
- * - `insertDefaultIfAbsent`: insert the document, with its contents treated as
24
- * default data, only if there is not already a document with the same ID in
25
- * the store. If there is already a document in the store with the same ID
26
- * then this will be a no-op. Use this strategy if you want to insert default
27
- * data for a given document ID, which you want to treat as common initial
28
- * data amongst all peers and that you expect to be mutated or overwritten in
29
- * due course.
30
- */
31
- export type WriteStrategy = 'merge' | 'insertIfAbsent' | 'insertDefaultIfAbsent'
32
-
33
- /**
34
- * Represents a dictionary of values to be incorporated into a query keyed
35
- * by the placeholder used within that query. See method
36
- * {@link Collection.find | find()} of {@link Collection} for more info.
37
- */
38
- export type QueryArguments = {
39
- [key: string]: any
40
- }
41
-
42
- /**
43
- * Values to be incorporated into a query, keyed by the placeholder used within
44
- * that query.
45
- */
46
- export type DQLQueryArguments = {
47
- [key: string]: DQLQueryArgumentValue | undefined
48
- }
49
-
50
- /**
51
- * Individual value in a {@link DQLQueryArguments} object.
52
- */
53
- export type DQLQueryArgumentValue = string | number | boolean | Uint8Array | null | DocumentID | DQLQueryArgumentValue[] | { [key: string]: DQLQueryArgumentValue }
@@ -1,117 +0,0 @@
1
- //
2
- // Copyright © 2023 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import * as dittoCore from './@ditto.core'
6
-
7
- import type { Pointer, FFIError } from './ffi'
8
-
9
- /** Matches a `<...>` prefix in an FFI result error message, e.g. `<dql> ...`. **/
10
- const PREFIX_REGEX = new RegExp(/^<.*?>\s*/)
11
-
12
- /**
13
- * Error codes for FFI result.
14
- *
15
- * @internal
16
- */
17
- // prettier-ignore
18
- export type FFIResultErrorCode =
19
- 'StoreDocumentNotFound' |
20
- 'StoreDatabase' |
21
- 'StoreQuery' |
22
- 'Crdt' |
23
- 'JsFloatingStoreOperation' |
24
- 'DqlQueryCompilation' |
25
- 'DqlInvalidQueryArgs' |
26
- 'DqlUnsupported'
27
-
28
- /**
29
- * Represents an exception that occurred during a call into the Ditto FFI.
30
- *
31
- * Use the {@link throwOnErrorStatus | throwOnErrorStatus()} helper to
32
- * automatically throw this error when an FFI call returns with a non-zero
33
- * return value.
34
- *
35
- * @internal
36
- */
37
- export class DittoFFIError extends Error {
38
- /**
39
- * The code identifying this error.
40
- *
41
- * May be a numerical status code returned by an FFI call or an
42
- * {@link FFIResultErrorCode} for errors returned on FFI result objects.
43
- *
44
- * @see {@link throwOnErrorStatus | throwOnErrorStatus()}
45
- */
46
- readonly code: number | FFIResultErrorCode
47
-
48
- /**
49
- * Only call this constructor after having called `FFI.ensureInitialized()`
50
- * and `FFI.trace()`.
51
- *
52
- * @param code numerical status code returned by an FFI call or an
53
- * {@link FFIResultErrorCode} for errors returned on FFI result objects
54
- * @param messageOverride overrides the thread-local error message set in
55
- * Ditto core
56
- * @param messageFallback fallback message to use if the thread-local error
57
- * message is empty
58
- */
59
- constructor(code: number | FFIResultErrorCode, messageOverride?: string, messageFallback?: string) {
60
-
61
- const threadLocalErrorMessage = ffiErrorMessage()
62
- super(messageOverride || threadLocalErrorMessage || messageFallback)
63
- this.code = code
64
- }
65
- }
66
-
67
- /**
68
- * Throws a {@link DittoFFIError} if the given `ffiError` is not `null`.
69
- *
70
- * Removes the thread-local error message from Ditto core. If an error description
71
- * is available on the given `ffiError`, it is used as the error message of the
72
- * thrown {@link DittoFFIError}. A prefix in the error message is removed, e.g.
73
- * `<dql> ...`.
74
- *
75
- * If no error description is available, the given `ffiFunctionName` is used to
76
- * produce a fallback error message.
77
- *
78
- * @internal
79
- */
80
- export function throwOnErrorResult(ffiError: Pointer<FFIError> | null, ffiFunctionName: string): void {
81
- if (ffiError !== null) {
82
- let errorCode: FFIResultErrorCode
83
- let errorMsg: string | null
84
- try {
85
- errorCode = dittoCore.dittoffi_error_code(ffiError)
86
- errorMsg = dittoCore.boxCStringIntoString(dittoCore.dittoffi_error_description(ffiError))
87
- dittoCore.dittoffi_error_free(ffiError)
88
- } catch (err: any) {
89
- throw new DittoFFIError(-1, `Failed to retrieve Ditto core error message: ${err.message}`)
90
- }
91
-
92
- if (errorMsg == null) {
93
- errorMsg = `${ffiFunctionName}() failed with error code: ${errorCode}`
94
- } else {
95
- errorMsg = errorMsg.replace(PREFIX_REGEX, '')
96
- }
97
-
98
- throw new DittoFFIError(errorCode, errorMsg)
99
- }
100
- }
101
-
102
- /**
103
- * Retrieves last thread-local error message and removes it.
104
- *
105
- * Subsequent call to this function (if no new error message has been set) will
106
- * always return `null`.
107
- *
108
- * This function is not calling `FFI.ensureInitialized()` to avoid a circular
109
- * dependency. This is okay as long as this function is only called from a
110
- * context where `FFI.ensureInitialized()` has already been called.
111
- *
112
- * @internal
113
- */
114
- function ffiErrorMessage(): string | null {
115
- const errorMessageCString = dittoCore.ditto_error_message()
116
- return dittoCore.boxCStringIntoString(errorMessageCString)
117
- }