@dittolive/ditto 4.5.4 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +2 -2
  2. package/node/ditto.cjs.js +1111 -563
  3. package/node/ditto.darwin-arm64.node +0 -0
  4. package/node/ditto.darwin-x64.node +0 -0
  5. package/node/ditto.linux-arm.node +0 -0
  6. package/node/ditto.linux-arm64.node +0 -0
  7. package/node/ditto.linux-x64.node +0 -0
  8. package/node/ditto.win32-x64.node +0 -0
  9. package/node/transports.darwin-arm64.node +0 -0
  10. package/node/transports.darwin-x64.node +0 -0
  11. package/package.json +45 -1
  12. package/react-native/android/build.gradle +1 -1
  13. package/react-native/android/cpp-adapter.cpp +68 -59
  14. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.java +35 -0
  15. package/react-native/cpp/include/Arc.hpp +1 -1
  16. package/react-native/cpp/include/Attachment.h +5 -1
  17. package/react-native/cpp/include/DQL.h +9 -9
  18. package/react-native/cpp/include/FFIUtils.h +14 -0
  19. package/react-native/cpp/include/IO.h +13 -0
  20. package/react-native/cpp/include/Lifecycle.h +0 -1
  21. package/react-native/cpp/include/Misc.h +3 -0
  22. package/react-native/cpp/include/Utils.h +0 -2
  23. package/react-native/cpp/src/Attachment.cpp +200 -13
  24. package/react-native/cpp/src/Authentication.cpp +3 -3
  25. package/react-native/cpp/src/DQL.cpp +23 -23
  26. package/react-native/cpp/src/Document.cpp +10 -10
  27. package/react-native/cpp/src/FFIUtils.cpp +64 -0
  28. package/react-native/cpp/src/IO.cpp +35 -0
  29. package/react-native/cpp/src/Identity.cpp +3 -3
  30. package/react-native/cpp/src/Lifecycle.cpp +2 -19
  31. package/react-native/cpp/src/LiveQuery.cpp +3 -5
  32. package/react-native/cpp/src/Logger.cpp +171 -172
  33. package/react-native/cpp/src/Misc.cpp +52 -4
  34. package/react-native/cpp/src/Presence.cpp +1 -1
  35. package/react-native/cpp/src/SmallPeerInfo.cpp +1 -1
  36. package/react-native/cpp/src/Transports.cpp +10 -5
  37. package/react-native/cpp/src/Utils.cpp +110 -114
  38. package/react-native/cpp/src/main.cpp +28 -15
  39. package/react-native/dittoffi/dittoffi.h +328 -280
  40. package/react-native/ios/DittoRNSDK.mm +123 -71
  41. package/react-native/src/ditto.rn.ts +30 -6
  42. package/react-native/src/index.ts +7 -4
  43. package/react-native/src/sources/@cbor-redux.ts +1 -1
  44. package/react-native/src/sources/attachment-fetch-event.ts +2 -2
  45. package/react-native/src/sources/attachment-fetcher-manager.ts +5 -4
  46. package/react-native/src/sources/attachment-fetcher.ts +152 -21
  47. package/react-native/src/sources/attachment-token.ts +94 -13
  48. package/react-native/src/sources/attachment.ts +66 -19
  49. package/react-native/src/sources/augment.ts +13 -6
  50. package/react-native/src/sources/base-pending-cursor-operation.ts +22 -6
  51. package/react-native/src/sources/base-pending-id-specific-operation.ts +3 -0
  52. package/react-native/src/sources/bridge.ts +2 -2
  53. package/react-native/src/sources/cbor.ts +0 -15
  54. package/react-native/src/sources/collection-interface.ts +12 -6
  55. package/react-native/src/sources/collection.ts +9 -2
  56. package/react-native/src/sources/ditto.ts +26 -18
  57. package/react-native/src/sources/document-id.ts +11 -7
  58. package/react-native/src/sources/document-path.ts +4 -2
  59. package/react-native/src/sources/document.ts +49 -5
  60. package/react-native/src/sources/error-codes.ts +28 -0
  61. package/react-native/src/sources/error.ts +20 -1
  62. package/react-native/src/sources/essentials.ts +25 -3
  63. package/react-native/src/sources/ffi-error.ts +2 -1
  64. package/react-native/src/sources/ffi.ts +180 -102
  65. package/react-native/src/sources/internal.ts +37 -3
  66. package/react-native/src/sources/live-query-manager.ts +10 -1
  67. package/react-native/src/sources/live-query.ts +1 -1
  68. package/react-native/src/sources/observer-manager.ts +7 -0
  69. package/react-native/src/sources/pending-id-specific-operation.ts +2 -2
  70. package/react-native/src/sources/presence-manager.ts +12 -2
  71. package/react-native/src/sources/presence.ts +5 -0
  72. package/react-native/src/sources/query-result-item.ts +15 -0
  73. package/react-native/src/sources/small-peer-info.ts +2 -2
  74. package/react-native/src/sources/static-tcp-client.ts +2 -0
  75. package/react-native/src/sources/store-observer.ts +4 -2
  76. package/react-native/src/sources/store.ts +253 -3
  77. package/react-native/src/sources/sync.ts +6 -3
  78. package/react-native/src/sources/transport-config.ts +2 -2
  79. package/react-native/src/sources/update-results-map.ts +8 -0
  80. package/react-native/src/sources/write-transaction-collection.ts +1 -1
  81. package/react-native/src/sources/write-transaction.ts +1 -1
  82. package/types/ditto.d.ts +2866 -2568
  83. package/web/ditto.es6.js +1 -1
  84. package/web/ditto.umd.js +1 -1
  85. package/web/ditto.wasm +0 -0
  86. package/react-native/.yarn/install-state.gz +0 -0
  87. package/react-native/.yarnrc.yml +0 -1
@@ -1324,6 +1324,8 @@ typedef enum DittoErrorCode {
1324
1324
  DITTO_ERROR_CODE_DQL_UNSUPPORTED = 50331651,
1325
1325
  /** <No documentation available> */
1326
1326
  DITTO_ERROR_CODE_DQL_EXECUTION_FAILED = 50331652,
1327
+ /** <No documentation available> */
1328
+ DITTO_ERROR_CODE_PARAMETER_QUERY_FAILED = 50331653,
1327
1329
  } DittoErrorCode_t;
1328
1330
 
1329
1331
  /** <No documentation available> */
@@ -2238,44 +2240,6 @@ BoxedCharPtrResult_t
2238
2240
  /* fn */ ditto_documents_hash_mnemonic (
2239
2241
  slice_ref_CDocument_ptr_t documents);
2240
2242
 
2241
- /** <No documentation available> */
2242
- typedef struct CDqlResponse CDqlResponse_t;
2243
-
2244
- /** <No documentation available> */
2245
- slice_boxed_uint8_t
2246
- /* fn */ ditto_dql_response_affected_document_id_at (
2247
- CDqlResponse_t const * response,
2248
- size_t idx);
2249
-
2250
- /** <No documentation available> */
2251
- size_t
2252
- /* fn */ ditto_dql_response_affected_document_id_count (
2253
- CDqlResponse_t const * response);
2254
-
2255
- /** <No documentation available> */
2256
- void
2257
- /* fn */ ditto_dql_response_free (
2258
- CDqlResponse_t * response);
2259
-
2260
- /** <No documentation available> */
2261
- typedef struct CDqlResult CDqlResult_t;
2262
-
2263
- /** <No documentation available> */
2264
- CDqlResult_t *
2265
- /* fn */ ditto_dql_response_result_at (
2266
- CDqlResponse_t const * response,
2267
- size_t idx);
2268
-
2269
- /** <No documentation available> */
2270
- size_t
2271
- /* fn */ ditto_dql_response_result_count (
2272
- CDqlResponse_t const * response);
2273
-
2274
- /** <No documentation available> */
2275
- void
2276
- /* fn */ ditto_dql_result_free (
2277
- CDqlResult_t * result);
2278
-
2279
2243
  /** \brief
2280
2244
  * Retrieves last thread-local error message (used by some synchronous APIs)
2281
2245
  * and removes it. Subsequent call to this function (if nothing else has
@@ -2297,9 +2261,6 @@ char *
2297
2261
  char *
2298
2262
  /* fn */ ditto_error_message_peek (void);
2299
2263
 
2300
- /** <No documentation available> */
2301
- typedef struct UninitializedDitto UninitializedDitto_t;
2302
-
2303
2264
  /** <No documentation available> */
2304
2265
  typedef struct CIdentityConfig CIdentityConfig_t;
2305
2266
 
@@ -2322,7 +2283,7 @@ typedef enum HistoryTracking {
2322
2283
  */
2323
2284
  CDitto_t *
2324
2285
  /* fn */ ditto_experimental_make_with_passphrase (
2325
- UninitializedDitto_t * uninit_ditto,
2286
+ char const * working_dir,
2326
2287
  CIdentityConfig_t * identity_config,
2327
2288
  HistoryTracking_t history_tracking,
2328
2289
  char const * passphrase,
@@ -2855,8 +2816,159 @@ int8_t
2855
2816
  */
2856
2817
  CDitto_t *
2857
2818
  /* fn */ ditto_make (
2858
- UninitializedDitto_t * uninit_ditto,
2819
+ char const * working_dir,
2820
+ CIdentityConfig_t * identity_config,
2821
+ HistoryTracking_t history_tracking);
2822
+
2823
+ /** <No documentation available> */
2824
+ typedef struct Erased Erased_t;
2825
+
2826
+ /** \brief
2827
+ * An FFI-safe `Poll<()>`.
2828
+ */
2829
+ /** \remark Has the same ABI as `int8_t` **/
2830
+ #ifdef DOXYGEN
2831
+ typedef
2832
+ #endif
2833
+ enum PollFuture {
2834
+ /** <No documentation available> */
2835
+ POLL_FUTURE_COMPLETED = 0,
2836
+ /** <No documentation available> */
2837
+ POLL_FUTURE_PENDING = -1,
2838
+ }
2839
+ #ifndef DOXYGEN
2840
+ ; typedef int8_t
2841
+ #endif
2842
+ PollFuture_t;
2843
+
2844
+ /** \brief
2845
+ * The layout of `core::task::wake::Context` is opaque/subject to changes.
2846
+ */
2847
+ typedef struct Opaque_Context Opaque_Context_t;
2848
+
2849
+ /** <No documentation available> */
2850
+ typedef struct FfiFutureVTable {
2851
+ /** <No documentation available> */
2852
+ void (*release_vptr)(Erased_t *);
2853
+
2854
+ /** <No documentation available> */
2855
+ PollFuture_t (*dyn_poll)(Erased_t *, Opaque_Context_t *);
2856
+ } FfiFutureVTable_t;
2857
+
2858
+ /** <No documentation available> */
2859
+ typedef struct VirtualPtr__Erased_ptr_FfiFutureVTable {
2860
+ /** <No documentation available> */
2861
+ Erased_t * ptr;
2862
+
2863
+ /** <No documentation available> */
2864
+ FfiFutureVTable_t vtable;
2865
+ } VirtualPtr__Erased_ptr_FfiFutureVTable_t;
2866
+
2867
+ /** \brief
2868
+ * `Box<dyn 'static + Send + FnMut() -> Ret>`
2869
+ */
2870
+ typedef struct BoxDynFnMut0_void {
2871
+ /** <No documentation available> */
2872
+ void * env_ptr;
2873
+
2874
+ /** <No documentation available> */
2875
+ void (*call)(void *);
2876
+
2877
+ /** <No documentation available> */
2878
+ void (*free)(void *);
2879
+ } BoxDynFnMut0_void_t;
2880
+
2881
+ /** <No documentation available> */
2882
+ typedef struct DropGlueVTable {
2883
+ /** <No documentation available> */
2884
+ void (*release_vptr)(Erased_t *);
2885
+ } DropGlueVTable_t;
2886
+
2887
+ /** <No documentation available> */
2888
+ typedef struct VirtualPtr__Erased_ptr_DropGlueVTable {
2889
+ /** <No documentation available> */
2890
+ Erased_t * ptr;
2891
+
2892
+ /** <No documentation available> */
2893
+ DropGlueVTable_t vtable;
2894
+ } VirtualPtr__Erased_ptr_DropGlueVTable_t;
2895
+
2896
+ /** <No documentation available> */
2897
+ typedef struct FfiFutureExecutorVTable {
2898
+ /** <No documentation available> */
2899
+ void (*release_vptr)(Erased_t *);
2900
+
2901
+ /** <No documentation available> */
2902
+ Erased_t * (*retain_vptr)(Erased_t const *);
2903
+
2904
+ /** <No documentation available> */
2905
+ VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
2906
+
2907
+ /** <No documentation available> */
2908
+ VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn_blocking)(Erased_t const *, BoxDynFnMut0_void_t);
2909
+
2910
+ /** <No documentation available> */
2911
+ void (*dyn_block_on)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
2912
+
2913
+ /** <No documentation available> */
2914
+ VirtualPtr__Erased_ptr_DropGlueVTable_t (*dyn_enter)(Erased_t const *);
2915
+ } FfiFutureExecutorVTable_t;
2916
+
2917
+ /** <No documentation available> */
2918
+ typedef struct VirtualPtr__Erased_ptr_FfiFutureExecutorVTable {
2919
+ /** <No documentation available> */
2920
+ Erased_t * ptr;
2921
+
2922
+ /** <No documentation available> */
2923
+ FfiFutureExecutorVTable_t vtable;
2924
+ } VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t;
2925
+
2926
+ /** <No documentation available> */
2927
+ typedef struct StaticDropGlueVTable {
2928
+ /** <No documentation available> */
2929
+ void (*release_vptr)(Erased_t *);
2930
+
2931
+ /** <No documentation available> */
2932
+ Erased_t * (*retain_vptr)(Erased_t const *);
2933
+ } StaticDropGlueVTable_t;
2934
+
2935
+ /** <No documentation available> */
2936
+ typedef struct VirtualPtr__Erased_ptr_StaticDropGlueVTable {
2937
+ /** <No documentation available> */
2938
+ Erased_t * ptr;
2939
+
2940
+ /** <No documentation available> */
2941
+ StaticDropGlueVTable_t vtable;
2942
+ } VirtualPtr__Erased_ptr_StaticDropGlueVTable_t;
2943
+
2944
+ /** \brief
2945
+ * A `dyn` type-erased (and thus completely layout agnostic
2946
+ * (_e.g._, tokio-agnostic)) and yet FFI-compatible version of an `async`
2947
+ * runtime executor.
2948
+ *
2949
+ * Keep it in sync with `rust/dittolive-ditto-sys/lib.rs`!
2950
+ */
2951
+ typedef struct DynExecutor {
2952
+ /** \brief
2953
+ * The main object used to spawn futures and whatnot.
2954
+ */
2955
+ VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t handle;
2956
+
2957
+ /** \brief
2958
+ * The drop glue potentially driving the shutdown of the runtime.
2959
+ */
2960
+ VirtualPtr__Erased_ptr_StaticDropGlueVTable_t _runtime;
2961
+ } DynExecutor_t;
2962
+
2963
+ /** \brief
2964
+ * See docs for `ditto_make`. The only difference with that function is that you must also provide
2965
+ * an executor when calling this function.
2966
+ */
2967
+ CDitto_t *
2968
+ /* fn */ ditto_make_with_executor (
2969
+ char const * working_dir,
2859
2970
  CIdentityConfig_t * identity_config,
2971
+ DynExecutor_t executor,
2860
2972
  HistoryTracking_t history_tracking);
2861
2973
 
2862
2974
  /** <No documentation available> */
@@ -3209,16 +3321,6 @@ CancelTokenResult_t
3209
3321
  void (*on_progress_cb)(void *, uint64_t, uint64_t),
3210
3322
  void (*on_deleted_cb)(void *));
3211
3323
 
3212
- /** <No documentation available> */
3213
- slice_boxed_uint8_t
3214
- /* fn */ ditto_result_cbor (
3215
- CDqlResult_t const * result);
3216
-
3217
- /** <No documentation available> */
3218
- char *
3219
- /* fn */ ditto_result_json (
3220
- CDqlResult_t const * result);
3221
-
3222
3324
  /** <No documentation available> */
3223
3325
  uint32_t
3224
3326
  /* fn */ ditto_run_garbage_collection (
@@ -3677,162 +3779,6 @@ char *
3677
3779
  /* fn */ ditto_transports_diagnostics (
3678
3780
  CDitto_t const * ditto);
3679
3781
 
3680
- /** \brief
3681
- * Make an UninitializedDitto object as an opaque pointer.
3682
- *
3683
- * This object serves as an intermediate object that allows database access.
3684
- * This allows the SDK to check if a pre-existing site ID has been persisted.
3685
- */
3686
- UninitializedDitto_t *
3687
- /* fn */ ditto_uninitialized_ditto_make (
3688
- char const * working_dir);
3689
-
3690
- /** <No documentation available> */
3691
- typedef struct Erased Erased_t;
3692
-
3693
- /** \brief
3694
- * An FFI-safe `Poll<()>`.
3695
- */
3696
- /** \remark Has the same ABI as `int8_t` **/
3697
- #ifdef DOXYGEN
3698
- typedef
3699
- #endif
3700
- enum PollFuture {
3701
- /** <No documentation available> */
3702
- POLL_FUTURE_COMPLETED = 0,
3703
- /** <No documentation available> */
3704
- POLL_FUTURE_PENDING = -1,
3705
- }
3706
- #ifndef DOXYGEN
3707
- ; typedef int8_t
3708
- #endif
3709
- PollFuture_t;
3710
-
3711
- /** \brief
3712
- * The layout of `core::task::wake::Context` is opaque/subject to changes.
3713
- */
3714
- typedef struct Opaque_Context Opaque_Context_t;
3715
-
3716
- /** <No documentation available> */
3717
- typedef struct FfiFutureVTable {
3718
- /** <No documentation available> */
3719
- void (*release_vptr)(Erased_t *);
3720
-
3721
- /** <No documentation available> */
3722
- PollFuture_t (*dyn_poll)(Erased_t *, Opaque_Context_t *);
3723
- } FfiFutureVTable_t;
3724
-
3725
- /** <No documentation available> */
3726
- typedef struct VirtualPtr__Erased_ptr_FfiFutureVTable {
3727
- /** <No documentation available> */
3728
- Erased_t * ptr;
3729
-
3730
- /** <No documentation available> */
3731
- FfiFutureVTable_t vtable;
3732
- } VirtualPtr__Erased_ptr_FfiFutureVTable_t;
3733
-
3734
- /** \brief
3735
- * `Box<dyn 'static + Send + FnMut() -> Ret>`
3736
- */
3737
- typedef struct BoxDynFnMut0_void {
3738
- /** <No documentation available> */
3739
- void * env_ptr;
3740
-
3741
- /** <No documentation available> */
3742
- void (*call)(void *);
3743
-
3744
- /** <No documentation available> */
3745
- void (*free)(void *);
3746
- } BoxDynFnMut0_void_t;
3747
-
3748
- /** <No documentation available> */
3749
- typedef struct DropGlueVTable {
3750
- /** <No documentation available> */
3751
- void (*release_vptr)(Erased_t *);
3752
- } DropGlueVTable_t;
3753
-
3754
- /** <No documentation available> */
3755
- typedef struct VirtualPtr__Erased_ptr_DropGlueVTable {
3756
- /** <No documentation available> */
3757
- Erased_t * ptr;
3758
-
3759
- /** <No documentation available> */
3760
- DropGlueVTable_t vtable;
3761
- } VirtualPtr__Erased_ptr_DropGlueVTable_t;
3762
-
3763
- /** <No documentation available> */
3764
- typedef struct FfiFutureExecutorVTable {
3765
- /** <No documentation available> */
3766
- void (*release_vptr)(Erased_t *);
3767
-
3768
- /** <No documentation available> */
3769
- Erased_t * (*retain_vptr)(Erased_t const *);
3770
-
3771
- /** <No documentation available> */
3772
- VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
3773
-
3774
- /** <No documentation available> */
3775
- VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn_blocking)(Erased_t const *, BoxDynFnMut0_void_t);
3776
-
3777
- /** <No documentation available> */
3778
- void (*dyn_block_on)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
3779
-
3780
- /** <No documentation available> */
3781
- VirtualPtr__Erased_ptr_DropGlueVTable_t (*dyn_enter)(Erased_t const *);
3782
- } FfiFutureExecutorVTable_t;
3783
-
3784
- /** <No documentation available> */
3785
- typedef struct VirtualPtr__Erased_ptr_FfiFutureExecutorVTable {
3786
- /** <No documentation available> */
3787
- Erased_t * ptr;
3788
-
3789
- /** <No documentation available> */
3790
- FfiFutureExecutorVTable_t vtable;
3791
- } VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t;
3792
-
3793
- /** <No documentation available> */
3794
- typedef struct StaticDropGlueVTable {
3795
- /** <No documentation available> */
3796
- void (*release_vptr)(Erased_t *);
3797
-
3798
- /** <No documentation available> */
3799
- Erased_t * (*retain_vptr)(Erased_t const *);
3800
- } StaticDropGlueVTable_t;
3801
-
3802
- /** <No documentation available> */
3803
- typedef struct VirtualPtr__Erased_ptr_StaticDropGlueVTable {
3804
- /** <No documentation available> */
3805
- Erased_t * ptr;
3806
-
3807
- /** <No documentation available> */
3808
- StaticDropGlueVTable_t vtable;
3809
- } VirtualPtr__Erased_ptr_StaticDropGlueVTable_t;
3810
-
3811
- /** \brief
3812
- * A `dyn` type-erased (and thus completely layout agnostic
3813
- * (_e.g._, tokio-agnostic)) and yet FFI-compatible version of an `async`
3814
- * runtime executor.
3815
- *
3816
- * Keep it in sync with `rust/dittolive-ditto-sys/lib.rs`!
3817
- */
3818
- typedef struct DynExecutor {
3819
- /** \brief
3820
- * The main object used to spawn futures and whatnot.
3821
- */
3822
- VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t handle;
3823
-
3824
- /** \brief
3825
- * The drop glue potentially driving the shutdown of the runtime.
3826
- */
3827
- VirtualPtr__Erased_ptr_StaticDropGlueVTable_t _runtime;
3828
- } DynExecutor_t;
3829
-
3830
- /** <No documentation available> */
3831
- UninitializedDitto_t *
3832
- /* fn */ ditto_uninitialized_ditto_make_with_executor (
3833
- char const * working_dir,
3834
- DynExecutor_t executor);
3835
-
3836
3782
  /** <No documentation available> */
3837
3783
  void
3838
3784
  /* fn */ ditto_unregister_local_auth_server (
@@ -4045,6 +3991,36 @@ int32_t
4045
3991
  CDitto_t const * _ditto,
4046
3992
  CWriteTransaction_t * transaction);
4047
3993
 
3994
+ /** \brief
3995
+ * To be used when base64 encoding or decoding.
3996
+ *
3997
+ * When encoding, specifies whether to produce padded or unpadded output. When decoding, specifies
3998
+ * whether or not to accept a padded input string.
3999
+ */
4000
+ typedef enum Base64PaddingMode {
4001
+ /** <No documentation available> */
4002
+ BASE64_PADDING_MODE_PADDED = 1,
4003
+ /** <No documentation available> */
4004
+ BASE64_PADDING_MODE_UNPADDED,
4005
+ } Base64PaddingMode_t;
4006
+
4007
+ /** \brief
4008
+ * Encodes a slice of bytes as a URL-safe base64 string. The caller can specify whether or not they
4009
+ * want the output to be padded.
4010
+ *
4011
+ * The returned string needs to be freed by the caller using `ditto_c_string_free`.
4012
+ */
4013
+ char *
4014
+ /* fn */ dittoffi_base64_encode (
4015
+ slice_ref_uint8_t bytes,
4016
+ Base64PaddingMode_t padding_mode);
4017
+
4018
+ /** <No documentation available> */
4019
+ BoolResult_t
4020
+ /* fn */ dittoffi_check_doc_cbor_against_provided_cbor (
4021
+ slice_ref_uint8_t document_cbor,
4022
+ slice_ref_uint8_t provided_cbor);
4023
+
4048
4024
  /** \brief
4049
4025
  * The ditto error type, opaque.
4050
4026
  */
@@ -4074,6 +4050,10 @@ typedef enum dittoffi_error_code {
4074
4050
  DITTOFFI_ERROR_CODE_STORE_DATABASE,
4075
4051
  /** <No documentation available> */
4076
4052
  DITTOFFI_ERROR_CODE_STORE_QUERY,
4053
+ /** \brief
4054
+ * A query to alter or retrieve a system parameter (ALTER SYSTEM or SHOW) failed.
4055
+ */
4056
+ DITTOFFI_ERROR_CODE_PARAMETER_QUERY,
4077
4057
  /** <No documentation available> */
4078
4058
  DITTOFFI_ERROR_CODE_CRDT,
4079
4059
  /** \brief
@@ -4095,6 +4075,10 @@ typedef enum dittoffi_error_code {
4095
4075
  * Unsupported features were used in a DQL statement or query.
4096
4076
  */
4097
4077
  DITTOFFI_ERROR_CODE_DQL_UNSUPPORTED,
4078
+ /** \brief
4079
+ * Invalid input provided for base64 decoding.
4080
+ */
4081
+ DITTOFFI_ERROR_CODE_BASE64_INVALID,
4098
4082
  } dittoffi_error_code_t;
4099
4083
 
4100
4084
  /** <No documentation available> */
@@ -4121,6 +4105,54 @@ void
4121
4105
  char *
4122
4106
  /* fn */ dittoffi_get_sdk_semver (void);
4123
4107
 
4108
+ /** <No documentation available> */
4109
+ typedef struct dittoffi_query_result dittoffi_query_result_t;
4110
+
4111
+ /** <No documentation available> */
4112
+ void
4113
+ /* fn */ dittoffi_query_result_free (
4114
+ dittoffi_query_result_t * result);
4115
+
4116
+ /** <No documentation available> */
4117
+ typedef struct dittoffi_query_result_item dittoffi_query_result_item_t;
4118
+
4119
+ /** <No documentation available> */
4120
+ dittoffi_query_result_item_t *
4121
+ /* fn */ dittoffi_query_result_item_at (
4122
+ dittoffi_query_result_t const * result,
4123
+ size_t idx);
4124
+
4125
+ /** <No documentation available> */
4126
+ slice_boxed_uint8_t
4127
+ /* fn */ dittoffi_query_result_item_cbor (
4128
+ dittoffi_query_result_item_t const * item);
4129
+
4130
+ /** <No documentation available> */
4131
+ size_t
4132
+ /* fn */ dittoffi_query_result_item_count (
4133
+ dittoffi_query_result_t const * result);
4134
+
4135
+ /** <No documentation available> */
4136
+ void
4137
+ /* fn */ dittoffi_query_result_item_free (
4138
+ dittoffi_query_result_item_t * item);
4139
+
4140
+ /** <No documentation available> */
4141
+ char *
4142
+ /* fn */ dittoffi_query_result_item_json (
4143
+ dittoffi_query_result_item_t const * item);
4144
+
4145
+ /** <No documentation available> */
4146
+ slice_boxed_uint8_t
4147
+ /* fn */ dittoffi_query_result_mutated_document_id_at (
4148
+ dittoffi_query_result_t const * result,
4149
+ size_t idx);
4150
+
4151
+ /** <No documentation available> */
4152
+ size_t
4153
+ /* fn */ dittoffi_query_result_mutated_document_id_count (
4154
+ dittoffi_query_result_t const * result);
4155
+
4124
4156
  /** <No documentation available> */
4125
4157
  typedef struct dittoffi_result_void {
4126
4158
  /** \brief
@@ -4140,6 +4172,50 @@ dittoffi_result_void_t
4140
4172
  int32_t limit,
4141
4173
  uint32_t offset);
4142
4174
 
4175
+ /** \brief
4176
+ * Adds a DQL sync subscription.
4177
+ *
4178
+ * Only `SELECT` statements are supported here.
4179
+ *
4180
+ * Returns no meaningful value but for the resulting potential `.error`.
4181
+ */
4182
+ dittoffi_result_void_t
4183
+ /* fn */ dittoffi_try_add_sync_subscription (
4184
+ CDitto_t const * ditto,
4185
+ char const * query,
4186
+ slice_ref_uint8_t query_args_cbor);
4187
+
4188
+ /** <No documentation available> */
4189
+ typedef struct dittoffi_result_slice_boxed_uint8 {
4190
+ /** \brief
4191
+ * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4192
+ */
4193
+ dittoffi_error_t * error;
4194
+
4195
+ /** \brief
4196
+ * When no error occurred, the success value payload can be retrieved here.
4197
+ *
4198
+ * Otherwise, the value is to be ignored.
4199
+ */
4200
+ slice_boxed_uint8_t success;
4201
+ } dittoffi_result_slice_boxed_uint8_t;
4202
+
4203
+ /** \brief
4204
+ * Decodes a URL-safe base64-encoded string. The caller can specify whether or not they want to
4205
+ * allow padded input. By default, both padded and unpadded input is accepted.
4206
+ *
4207
+ * In the success case, the returned bytes need to be freed by the caller using
4208
+ * `ditto_c_bytes_free`.
4209
+ *
4210
+ * Throws `FfiError::Base64Invalid` if:
4211
+ * - the input string is not a valid base64-encoded string, or
4212
+ * - the desired padding mode is specified as `Unpadded` and the input string is padded.
4213
+ */
4214
+ dittoffi_result_slice_boxed_uint8_t
4215
+ /* fn */ dittoffi_try_base64_decode (
4216
+ char const * str,
4217
+ Base64PaddingMode_t padding_mode);
4218
+
4143
4219
  /** <No documentation available> */
4144
4220
  dittoffi_result_void_t
4145
4221
  /* fn */ dittoffi_try_collection (
@@ -4261,21 +4337,6 @@ dittoffi_result_CDocument_ptr_t
4261
4337
  slice_ref_uint8_t id,
4262
4338
  CReadTransaction_t * transaction);
4263
4339
 
4264
- /** <No documentation available> */
4265
- typedef struct dittoffi_result_slice_boxed_uint8 {
4266
- /** \brief
4267
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4268
- */
4269
- dittoffi_error_t * error;
4270
-
4271
- /** \brief
4272
- * When no error occurred, the success value payload can be retrieved here.
4273
- *
4274
- * Otherwise, the value is to be ignored.
4275
- */
4276
- slice_boxed_uint8_t success;
4277
- } dittoffi_result_slice_boxed_uint8_t;
4278
-
4279
4340
  /** <No documentation available> */
4280
4341
  dittoffi_result_slice_boxed_uint8_t
4281
4342
  /* fn */ dittoffi_try_collection_insert_value (
@@ -4337,21 +4398,8 @@ dittoffi_result_slice_boxed_uint8_t
4337
4398
  char const * pointer,
4338
4399
  PathAccessorType_t path_type);
4339
4400
 
4340
- /** \brief
4341
- * Adds a DQL subscription.
4342
- *
4343
- * Only `SELECT` queries are supported here.
4344
- *
4345
- * Returns no meaningful value but for the resulting potential `.error`.
4346
- */
4347
- dittoffi_result_void_t
4348
- /* fn */ dittoffi_try_experimental_add_dql_subscription (
4349
- CDitto_t const * ditto,
4350
- char const * query,
4351
- slice_ref_uint8_t query_args_cbor);
4352
-
4353
4401
  /** <No documentation available> */
4354
- typedef struct dittoffi_result_CDqlResponse_ptr {
4402
+ typedef struct dittoffi_result_dittoffi_query_result_ptr {
4355
4403
  /** \brief
4356
4404
  * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4357
4405
  */
@@ -4362,8 +4410,8 @@ typedef struct dittoffi_result_CDqlResponse_ptr {
4362
4410
  *
4363
4411
  * Otherwise, the value is to be ignored.
4364
4412
  */
4365
- CDqlResponse_t * success;
4366
- } dittoffi_result_CDqlResponse_ptr_t;
4413
+ dittoffi_query_result_t * success;
4414
+ } dittoffi_result_dittoffi_query_result_ptr_t;
4367
4415
 
4368
4416
  /** \brief
4369
4417
  * Execute specified DQL statement
@@ -4373,8 +4421,8 @@ typedef struct dittoffi_result_CDqlResponse_ptr {
4373
4421
  *
4374
4422
  * This is replacement for the old FFI, which was returning documents.
4375
4423
  */
4376
- dittoffi_result_CDqlResponse_ptr_t
4377
- /* fn */ dittoffi_try_experimental_exec_statement_str (
4424
+ dittoffi_result_dittoffi_query_result_ptr_t
4425
+ /* fn */ dittoffi_try_exec_statement (
4378
4426
  CDitto_t const * ditto,
4379
4427
  CWriteTransaction_t * txn,
4380
4428
  char const * statement,
@@ -4383,9 +4431,9 @@ dittoffi_result_CDqlResponse_ptr_t
4383
4431
  /** <No documentation available> */
4384
4432
  typedef struct ChangeHandlerWithQueryResult {
4385
4433
  /** \brief
4386
- * Must be freed with `ditto_dql_response_free`.
4434
+ * Must be freed with `dittoffi_query_result_free`.
4387
4435
  */
4388
- CDqlResponse_t * query_result;
4436
+ dittoffi_query_result_t * query_result;
4389
4437
  } ChangeHandlerWithQueryResult_t;
4390
4438
 
4391
4439
  /** <No documentation available> */
@@ -4415,26 +4463,6 @@ dittoffi_result_int64_t
4415
4463
  void (*release)(void *),
4416
4464
  void (*c_cb)(void *, ChangeHandlerWithQueryResult_t));
4417
4465
 
4418
- /** \brief
4419
- * Removes a DQL subscription.
4420
- *
4421
- * The arguments should be identical to the ones used during adding the subscription.
4422
- * Returns no meaningful value but for the resulting potential `.error`.
4423
- */
4424
- dittoffi_result_void_t
4425
- /* fn */ dittoffi_try_experimental_remove_dql_subscription (
4426
- CDitto_t const * ditto,
4427
- char const * query,
4428
- slice_ref_uint8_t query_args_cbor);
4429
-
4430
- /** <No documentation available> */
4431
- dittoffi_result_slice_boxed_uint8_t
4432
- /* fn */ dittoffi_try_experimental_webhook_register_dql_live_query_str (
4433
- CDitto_t const * ditto,
4434
- char const * query,
4435
- slice_ref_uint8_t query_args_cbor,
4436
- char const * url);
4437
-
4438
4466
  /** <No documentation available> */
4439
4467
  typedef struct dittoffi_result_Vec_char_ptr {
4440
4468
  /** \brief
@@ -4455,22 +4483,6 @@ dittoffi_result_Vec_char_ptr_t
4455
4483
  /* fn */ dittoffi_try_get_collection_names (
4456
4484
  CDitto_t const * ditto);
4457
4485
 
4458
- /** <No documentation available> */
4459
- dittoffi_result_int64_t
4460
- /* fn */ dittoffi_try_live_query_register_str (
4461
- CDitto_t const * ditto,
4462
- char const * coll_name,
4463
- char const * query,
4464
- slice_ref_uint8_t query_args_cbor,
4465
- slice_ref_COrderByParam_t order_by,
4466
- int32_t limit,
4467
- uint32_t offset,
4468
- LiveQueryAvailability_t lq_availability,
4469
- void * ctx,
4470
- void (*retain)(void *),
4471
- void (*release)(void *),
4472
- void (*c_cb)(void *, c_cb_params_t));
4473
-
4474
4486
  /** <No documentation available> */
4475
4487
  dittoffi_result_void_t
4476
4488
  /* fn */ dittoffi_try_live_query_start (
@@ -4548,6 +4560,30 @@ dittoffi_result_char_ptr_t
4548
4560
  slice_ref_char_const_ptr_t coll_names,
4549
4561
  slice_ref_char_const_ptr_t queries);
4550
4562
 
4563
+ /** <No documentation available> */
4564
+ dittoffi_result_int64_t
4565
+ /* fn */ dittoffi_try_register_store_observer (
4566
+ CDitto_t const * ditto,
4567
+ char const * coll_name,
4568
+ char const * query,
4569
+ slice_ref_uint8_t query_args_cbor,
4570
+ slice_ref_COrderByParam_t order_by,
4571
+ int32_t limit,
4572
+ uint32_t offset,
4573
+ LiveQueryAvailability_t lq_availability,
4574
+ void * ctx,
4575
+ void (*retain)(void *),
4576
+ void (*release)(void *),
4577
+ void (*c_cb)(void *, c_cb_params_t));
4578
+
4579
+ /** <No documentation available> */
4580
+ dittoffi_result_slice_boxed_uint8_t
4581
+ /* fn */ dittoffi_try_register_store_observer_webhook (
4582
+ CDitto_t const * ditto,
4583
+ char const * query,
4584
+ slice_ref_uint8_t query_args_cbor,
4585
+ char const * url);
4586
+
4551
4587
  /** <No documentation available> */
4552
4588
  dittoffi_result_void_t
4553
4589
  /* fn */ dittoffi_try_remove_subscription (
@@ -4559,6 +4595,18 @@ dittoffi_result_void_t
4559
4595
  int32_t limit,
4560
4596
  uint32_t offset);
4561
4597
 
4598
+ /** \brief
4599
+ * Removes a DQL sync subscription.
4600
+ *
4601
+ * The arguments should be identical to the ones used during adding the subscription.
4602
+ * Returns no meaningful value but for the resulting potential `.error`.
4603
+ */
4604
+ dittoffi_result_void_t
4605
+ /* fn */ dittoffi_try_remove_sync_subscription (
4606
+ CDitto_t const * ditto,
4607
+ char const * query,
4608
+ slice_ref_uint8_t query_args_cbor);
4609
+
4562
4610
  /** <No documentation available> */
4563
4611
  void
4564
4612
  /* fn */ free_c_string_vec (