@dittolive/ditto 4.7.4 → 4.8.0-rc.2

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 (126) hide show
  1. package/DittoReactNative.podspec +33 -2
  2. package/README.md +2 -2
  3. package/node/ditto.cjs.js +341 -376
  4. package/node/ditto.darwin-arm64.node +0 -0
  5. package/node/ditto.darwin-x64.node +0 -0
  6. package/node/ditto.linux-arm.node +0 -0
  7. package/node/ditto.linux-arm64.node +0 -0
  8. package/node/ditto.linux-x64.node +0 -0
  9. package/node/ditto.win32-x64.node +0 -0
  10. package/package.json +2 -2
  11. package/react-native/android/build.gradle +24 -64
  12. package/react-native/android/cpp-adapter.cpp +37 -104
  13. package/react-native/android/src/main/AndroidManifestNew.xml +2 -0
  14. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.java +5 -70
  15. package/react-native/cpp/include/ConnectionRequest.h +1 -1
  16. package/react-native/cpp/include/IO.h +2 -0
  17. package/react-native/cpp/include/Logger.h +2 -1
  18. package/react-native/cpp/include/Misc.h +1 -0
  19. package/react-native/cpp/include/main.h +4 -2
  20. package/react-native/cpp/src/Attachment.cpp +1 -3
  21. package/react-native/cpp/src/ConnectionRequest.cpp +1 -1
  22. package/react-native/cpp/src/IO.cpp +79 -0
  23. package/react-native/cpp/src/Logger.cpp +63 -0
  24. package/react-native/cpp/src/Misc.cpp +21 -0
  25. package/react-native/cpp/src/main.cpp +10 -4
  26. package/react-native/ditto.es6.js +2 -0
  27. package/react-native/dittoffi/dittoffi.h +137 -40
  28. package/react-native/ios/DittoRNSDK.mm +19 -124
  29. package/react-native.config.js +2 -1
  30. package/types/ditto.d.ts +2412 -2032
  31. package/web/ditto.es6.js +1 -1
  32. package/web/ditto.umd.js +1 -1
  33. package/web/ditto.wasm +0 -0
  34. package/node/transports.darwin-arm64.node +0 -0
  35. package/node/transports.darwin-x64.node +0 -0
  36. package/react-native/android/.gradle/8.9/checksums/checksums.lock +0 -0
  37. package/react-native/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  38. package/react-native/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  39. package/react-native/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  40. package/react-native/android/.gradle/8.9/gc.properties +0 -0
  41. package/react-native/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  42. package/react-native/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  43. package/react-native/android/.gradle/vcs-1/gc.properties +0 -0
  44. package/react-native/lib/commonjs/ditto.rn.js +0 -93
  45. package/react-native/lib/commonjs/ditto.rn.js.map +0 -1
  46. package/react-native/lib/commonjs/index.js +0 -61
  47. package/react-native/lib/commonjs/index.js.map +0 -1
  48. package/react-native/lib/module/ditto.rn.js +0 -89
  49. package/react-native/lib/module/ditto.rn.js.map +0 -1
  50. package/react-native/lib/module/index.js +0 -27
  51. package/react-native/lib/module/index.js.map +0 -1
  52. package/react-native/lib/typescript/ditto.rn.d.ts +0 -15
  53. package/react-native/lib/typescript/ditto.rn.d.ts.map +0 -1
  54. package/react-native/lib/typescript/index.d.ts +0 -1
  55. package/react-native/lib/typescript/index.d.ts.map +0 -1
  56. package/react-native/src/ditto.rn.ts +0 -123
  57. package/react-native/src/environment/environment.fallback.ts +0 -4
  58. package/react-native/src/index.ts +0 -29
  59. package/react-native/src/sources/@cbor-redux.ts +0 -2
  60. package/react-native/src/sources/@ditto.core.ts +0 -1
  61. package/react-native/src/sources/@environment.ts +0 -1
  62. package/react-native/src/sources/attachment-fetch-event.ts +0 -54
  63. package/react-native/src/sources/attachment-fetcher-manager.ts +0 -145
  64. package/react-native/src/sources/attachment-fetcher.ts +0 -265
  65. package/react-native/src/sources/attachment-token.ts +0 -129
  66. package/react-native/src/sources/attachment.ts +0 -121
  67. package/react-native/src/sources/augment.ts +0 -108
  68. package/react-native/src/sources/authenticator.ts +0 -314
  69. package/react-native/src/sources/base-pending-cursor-operation.ts +0 -255
  70. package/react-native/src/sources/base-pending-id-specific-operation.ts +0 -112
  71. package/react-native/src/sources/bridge.ts +0 -557
  72. package/react-native/src/sources/build-time-constants.ts +0 -8
  73. package/react-native/src/sources/cbor.ts +0 -20
  74. package/react-native/src/sources/collection-interface.ts +0 -73
  75. package/react-native/src/sources/collection.ts +0 -219
  76. package/react-native/src/sources/collections-event.ts +0 -99
  77. package/react-native/src/sources/connection-request.ts +0 -142
  78. package/react-native/src/sources/counter.ts +0 -82
  79. package/react-native/src/sources/ditto.ts +0 -991
  80. package/react-native/src/sources/document-id.ts +0 -163
  81. package/react-native/src/sources/document-path.ts +0 -308
  82. package/react-native/src/sources/document.ts +0 -237
  83. package/react-native/src/sources/epilogue.ts +0 -32
  84. package/react-native/src/sources/error-codes.ts +0 -114
  85. package/react-native/src/sources/error.ts +0 -256
  86. package/react-native/src/sources/essentials.ts +0 -81
  87. package/react-native/src/sources/ffi-error.ts +0 -134
  88. package/react-native/src/sources/ffi.ts +0 -2190
  89. package/react-native/src/sources/identity.ts +0 -163
  90. package/react-native/src/sources/init.ts +0 -71
  91. package/react-native/src/sources/internal.ts +0 -143
  92. package/react-native/src/sources/keep-alive.ts +0 -73
  93. package/react-native/src/sources/key-path.ts +0 -198
  94. package/react-native/src/sources/live-query-event.ts +0 -208
  95. package/react-native/src/sources/live-query-manager.ts +0 -110
  96. package/react-native/src/sources/live-query.ts +0 -167
  97. package/react-native/src/sources/logger.ts +0 -196
  98. package/react-native/src/sources/main.ts +0 -61
  99. package/react-native/src/sources/observer-manager.ts +0 -185
  100. package/react-native/src/sources/observer.ts +0 -79
  101. package/react-native/src/sources/pending-collections-operation.ts +0 -241
  102. package/react-native/src/sources/pending-cursor-operation.ts +0 -218
  103. package/react-native/src/sources/pending-id-specific-operation.ts +0 -218
  104. package/react-native/src/sources/presence-manager.ts +0 -170
  105. package/react-native/src/sources/presence.ts +0 -427
  106. package/react-native/src/sources/query-result-item.ts +0 -131
  107. package/react-native/src/sources/query-result.ts +0 -55
  108. package/react-native/src/sources/register.ts +0 -95
  109. package/react-native/src/sources/small-peer-info.ts +0 -166
  110. package/react-native/src/sources/static-tcp-client.ts +0 -8
  111. package/react-native/src/sources/store-observer.ts +0 -170
  112. package/react-native/src/sources/store.ts +0 -630
  113. package/react-native/src/sources/subscription-manager.ts +0 -99
  114. package/react-native/src/sources/subscription.ts +0 -89
  115. package/react-native/src/sources/sync-subscription.ts +0 -90
  116. package/react-native/src/sources/sync.ts +0 -561
  117. package/react-native/src/sources/test-helpers.ts +0 -24
  118. package/react-native/src/sources/transport-conditions-manager.ts +0 -104
  119. package/react-native/src/sources/transport-config.ts +0 -430
  120. package/react-native/src/sources/update-result.ts +0 -66
  121. package/react-native/src/sources/update-results-map.ts +0 -65
  122. package/react-native/src/sources/websocket-client.ts +0 -7
  123. package/react-native/src/sources/write-transaction-collection.ts +0 -122
  124. package/react-native/src/sources/write-transaction-pending-cursor-operation.ts +0 -101
  125. package/react-native/src/sources/write-transaction-pending-id-specific-operation.ts +0 -74
  126. package/react-native/src/sources/write-transaction.ts +0 -121
package/web/ditto.wasm CHANGED
Binary file
Binary file
Binary file
File without changes
@@ -1,2 +0,0 @@
1
- #Thu Aug 01 08:49:33 MDT 2024
2
- gradle.version=8.9
File without changes
@@ -1,93 +0,0 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true,
5
- })
6
- exports.boxCBytesIntoBuffer = boxCBytesIntoBuffer
7
- exports.boxCStringIntoString = boxCStringIntoString
8
- exports.ditto_sdk_transports_init = ditto_sdk_transports_init
9
- exports.getDeadlockTimeout = getDeadlockTimeout
10
- exports.getMissingAndroidPermissions = getMissingAndroidPermissions
11
- exports.setDeadlockTimeout = setDeadlockTimeout
12
- var _reactNative = require('react-native')
13
- var _weakrefs = require('@ungap/weakrefs')
14
- require('fastestsmallesttextencoderdecoder')
15
- // import { fullBuildVersionString } from '../../sources/build-time-constants';
16
-
17
- const dittoCore = global
18
- const isLoaded = typeof dittoCore.ditto_sdk_transports_init === 'function'
19
- if (!isLoaded) {
20
- var _NativeModules$DittoR
21
- const result = (_NativeModules$DittoR = _reactNative.NativeModules.DittoRNSDK) === null || _NativeModules$DittoR === void 0 ? void 0 : _NativeModules$DittoR.install()
22
- if (!result) {
23
- throw new Error('JSI bindings were not installed for: DittoRNSDK Module')
24
- }
25
-
26
- setInterval(() => {
27
- dittoCore.ditto_tick()
28
- }, 50)
29
-
30
- // Stay as close as possible to the JS SDK with the API
31
- // We have to rename the shim that has a different name.
32
- if (typeof global.FinalizationRegistry === 'undefined' && typeof _weakrefs.FinalizationGroup !== 'undefined') {
33
- global.FinalizationRegistry = _weakrefs.FinalizationGroup
34
- }
35
- const platformName = _reactNative.Platform.select({
36
- ios: 'Ios',
37
- android: 'Android',
38
- default: 'Unknown',
39
- })
40
- dittoCore.ditto_init_sdk_version(platformName, 'JavaScript', '4.5.3')
41
- }
42
-
43
- // Export JSI methods.
44
- Object.keys(dittoCore)
45
- // we will provide our own decorated implementation.
46
- .filter((key) => key !== 'ditto_sdk_transports_init')
47
- .forEach((key) => {
48
- exports[key] = dittoCore[key]
49
- })
50
-
51
- // Decorated implementation with an extra step of setting the context for
52
- // Transports to work on Android.
53
- function ditto_sdk_transports_init(transportsErrorPointer) {
54
- if (_reactNative.Platform.OS === 'android') {
55
- const res = dittoCore.ditto_sdk_transports_set_android_context()
56
- if (!res) {
57
- throw new Error("Couldn't manage to set Android context with `ditto_sdk_transports_set_android_context()`")
58
- }
59
- }
60
- return dittoCore.ditto_sdk_transports_init(transportsErrorPointer)
61
- }
62
-
63
- /**
64
- * Get the list of missing Android permissions for syncing. The returned value
65
- * can be passed directly to `PermissionsAndroid.requestMultiple()`.
66
- *
67
- * Returns an empty array on other platforms.
68
- */
69
- function getMissingAndroidPermissions() {
70
- if (_reactNative.Platform.OS !== 'android') {
71
- return []
72
- }
73
- return dittoCore.ditto_sdk_transports_android_missing_permissions()
74
- }
75
-
76
- //
77
- // Needed as for JS SDK API's.
78
- //
79
-
80
- function boxCStringIntoString(something) {
81
- return something
82
- }
83
- function boxCBytesIntoBuffer(cborBytes) {
84
- const bytes = dittoCore.sliceBoxedToUInt8Array(cborBytes)
85
- return bytes ? new Uint8Array(bytes) : null
86
- }
87
- function getDeadlockTimeout() {
88
- return 0
89
- }
90
- function setDeadlockTimeout(something) {
91
- return something
92
- }
93
- //# sourceMappingURL=ditto.rn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","_weakrefs","dittoCore","global","isLoaded","ditto_sdk_transports_init","_NativeModules$DittoR","result","NativeModules","DittoRNSDK","install","Error","setInterval","ditto_tick","FinalizationRegistry","FinalizationGroup","platformName","Platform","select","ios","android","default","ditto_init_sdk_version","Object","keys","filter","key","forEach","exports","transportsErrorPointer","OS","res","ditto_sdk_transports_set_android_context","getMissingAndroidPermissions","ditto_sdk_transports_android_missing_permissions","boxCStringIntoString","something","boxCBytesIntoBuffer","cborBytes","bytes","sliceBoxedToUInt8Array","Uint8Array","getDeadlockTimeout","setDeadlockTimeout"],"sourceRoot":"../../src","sources":["ditto.rn.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,SAAA,GAAAD,OAAA;AACAA,OAAA;AANA;;AAEA;AACA;AACA;AAIA;AAEA;AACA;AACA;AAoBA,MAAME,SAAS,GAAGC,MAAkC;AAEpD,MAAMC,QAAQ,GAAG,OAAOF,SAAS,CAACG,yBAAyB,KAAK,UAAU;AAC1E,IAAI,CAACD,QAAQ,EAAE;EAAA,IAAAE,qBAAA;EACb,MAAMC,MAAM,IAAAD,qBAAA,GAAGE,0BAAa,CAACC,UAAU,cAAAH,qBAAA,uBAAxBA,qBAAA,CAA0BI,OAAO,CAAC,CAAC;EAElD,IAAI,CAACH,MAAM,EAAE;IACX,MAAM,IAAII,KAAK,CAAC,wDAAwD,CAAC;EAC3E;;EAEA;EACA;EACA;EACAC,WAAW,CAAC,MAAM;IAChBV,SAAS,CAACW,UAAU,CAA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;AAEO,SAASC,mBAAmBA,CAACC,SAAc,EAAE;EAClD,MAAMC,KAAK,GAAGrC,SAAS,CAACsC,sBAAsB,CAACF,SAAS,CAAC;EACzD,OAAOC,KAAK,GAAG,IAAIE,UAAU,CAACF,KAAK,CAAC,GAAG,IAAI;AAC7C;AAEO,SAASG,kBAAkBA,CAAA,EAAW;EAC3C,OAAO,CAAC;AACV;AAEO,SAASC,kBAAkBA,CAACP,SAAc,EAAE;EACjD,OAAOA,SAAS;AAClB"}
@@ -1,61 +0,0 @@
1
- // // RN API
2
-
3
- // export { getMissingAndroidPermissions } from './ditto.rn';
4
-
5
- // // JS API
6
-
7
- // // export * from '../../sources/keep-alive';
8
-
9
- // export * from '../../sources/essentials';
10
- // // export * from '../../sources/counter';
11
- // // export * from '../../sources/register';
12
- // // export * from '../../sources/attachment-token';
13
-
14
- // // export * from '../../sources/init';
15
- // export * from '../../sources/logger';
16
- // export * from '../../sources/document-id';
17
- // export * from '../../sources/observer';
18
-
19
- // // export * from '../../sources/base-pending-cursor-operation';
20
- // // export * from '../../sources/base-pending-id-specific-operation';
21
- // export * from '../../sources/authenticator';
22
- // export * from '../../sources/identity';
23
- // export * from '../../sources/ditto';
24
- // export * from '../../sources/store-observer';
25
- // // export * from '../../sources/collection';
26
- // // export * from '../../sources/collection-interface';
27
- // // export * from '../../sources/collections-event';
28
- // // export * from '../../sources/document-path';
29
- // // export * from '../../sources/document';
30
- // export * from '../../sources/sync';
31
- // export * from '../../sources/sync-subscription';
32
- // export * from '../../sources/error';
33
- // export * from '../../sources/error-codes';
34
- // export * from '../../sources/query-result-item';
35
- // export * from '../../sources/query-result';
36
- // // export * from '../../sources/live-query-event';
37
- // // export * from '../../sources/live-query';
38
- // // export * from '../../sources/attachment';
39
- // // export * from '../../sources/attachment-fetcher';
40
- // // export * from '../../sources/attachment-fetch-event';
41
- // // export * from '../../sources/pending-cursor-operation';
42
- // // export * from '../../sources/pending-id-specific-operation';
43
- // // export * from '../../sources/pending-collections-operation';
44
- // export * from '../../sources/small-peer-info';
45
- // export * from '../../sources/store';
46
- // export * from '../../sources/presence';
47
- // // export * from '../../sources/subscription';
48
- // // export * from '../../sources/test-helpers';
49
- // export * from '../../sources/transport-config';
50
- // // export * from '../../sources/update-result';
51
- // // export * from '../../sources/update-results-map';
52
- // // export * from '../../sources/write-transaction';
53
- // // export * from '../../sources/write-transaction-collection';
54
- // // export * from '../../sources/write-transaction-pending-cursor-operation';
55
- // // export * from '../../sources/write-transaction-pending-id-specific-operation';
56
- // export * from '../../sources/epilogue';
57
-
58
- // // TEMPORARY: exported to deal with non-canonical IDs.
59
- // // export * from '../../sources/cbor';
60
- "use strict";
61
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AAAA"}
@@ -1,89 +0,0 @@
1
- import { NativeModules, Platform } from 'react-native'
2
- // import { fullBuildVersionString } from '../../sources/build-time-constants';
3
-
4
- // @ts-ignore No types provided by the 3rd party
5
- import { FinalizationGroup } from '@ungap/weakrefs'
6
- import 'fastestsmallesttextencoderdecoder'
7
-
8
- // import type { Language, Platform as SDKPlatform } from '../../sources/ffi';
9
-
10
- // No need to define types for each of them as these will not be used anywhere,
11
- // but rather just pollute and require maintenance. It's good to highlight that
12
- // these will be exported, though.
13
- const dittoCore = global
14
- const isLoaded = typeof dittoCore.ditto_sdk_transports_init === 'function'
15
- if (!isLoaded) {
16
- var _NativeModules$DittoR
17
- const result = (_NativeModules$DittoR = NativeModules.DittoRNSDK) === null || _NativeModules$DittoR === void 0 ? void 0 : _NativeModules$DittoR.install()
18
- if (!result) {
19
- throw new Error('JSI bindings were not installed for: DittoRNSDK Module')
20
- }
21
-
22
- setInterval(() => {
23
- dittoCore.ditto_tick()
24
- }, 50)
25
-
26
- // Stay as close as possible to the JS SDK with the API
27
- // We have to rename the shim that has a different name.
28
- if (typeof global.FinalizationRegistry === 'undefined' && typeof FinalizationGroup !== 'undefined') {
29
- global.FinalizationRegistry = FinalizationGroup
30
- }
31
- const platformName = Platform.select({
32
- ios: 'Ios',
33
- android: 'Android',
34
- default: 'Unknown',
35
- })
36
- dittoCore.ditto_init_sdk_version(platformName, 'JavaScript', '4.5.3')
37
- }
38
-
39
- // Export JSI methods.
40
- Object.keys(dittoCore)
41
- // we will provide our own decorated implementation.
42
- .filter((key) => key !== 'ditto_sdk_transports_init')
43
- .forEach((key) => {
44
- exports[key] = dittoCore[key]
45
- })
46
-
47
- // Decorated implementation with an extra step of setting the context for
48
- // Transports to work on Android.
49
- export function ditto_sdk_transports_init(transportsErrorPointer) {
50
- if (Platform.OS === 'android') {
51
- const res = dittoCore.ditto_sdk_transports_set_android_context()
52
- if (!res) {
53
- throw new Error("Couldn't manage to set Android context with `ditto_sdk_transports_set_android_context()`")
54
- }
55
- }
56
- return dittoCore.ditto_sdk_transports_init(transportsErrorPointer)
57
- }
58
-
59
- /**
60
- * Get the list of missing Android permissions for syncing. The returned value
61
- * can be passed directly to `PermissionsAndroid.requestMultiple()`.
62
- *
63
- * Returns an empty array on other platforms.
64
- */
65
- export function getMissingAndroidPermissions() {
66
- if (Platform.OS !== 'android') {
67
- return []
68
- }
69
- return dittoCore.ditto_sdk_transports_android_missing_permissions()
70
- }
71
-
72
- //
73
- // Needed as for JS SDK API's.
74
- //
75
-
76
- export function boxCStringIntoString(something) {
77
- return something
78
- }
79
- export function boxCBytesIntoBuffer(cborBytes) {
80
- const bytes = dittoCore.sliceBoxedToUInt8Array(cborBytes)
81
- return bytes ? new Uint8Array(bytes) : null
82
- }
83
- export function getDeadlockTimeout() {
84
- return 0
85
- }
86
- export function setDeadlockTimeout(something) {
87
- return something
88
- }
89
- //# sourceMappingURL=ditto.rn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeModules","Platform","FinalizationGroup","dittoCore","global","isLoaded","ditto_sdk_transports_init","_NativeModules$DittoR","result","DittoRNSDK","install","Error","setInterval","ditto_tick","FinalizationRegistry","platformName","select","ios","android","default","ditto_init_sdk_version","Object","keys","filter","key","forEach","exports","transportsErrorPointer","OS","res","ditto_sdk_transports_set_android_context","getMissingAndroidPermissions","ditto_sdk_transports_android_missing_permissions","boxCStringIntoString","something","boxCBytesIntoBuffer","cborBytes","bytes","sliceBoxedToUInt8Array","Uint8Array","getDeadlockTimeout","setDeadlockTimeout"],"sourceRoot":"../../src","sources":["ditto.rn.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAyB,cAAc;AACvE;;AAEA;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,OAAO,mCAAmC;;AAE1C;;AAEA;AACA;AACA;AAoBA,MAAMC,SAAS,GAAGC,MAAkC;AAEpD,MAAMC,QAAQ,GAAG,OAAOF,SAAS,CAACG,yBAAyB,KAAK,UAAU;AAC1E,IAAI,CAACD,QAAQ,EAAE;EAAA,IAAAE,qBAAA;EACb,MAAMC,MAAM,IAAAD,qBAAA,GAAGP,aAAa,CAACS,UAAU,cAAAF,qBAAA,uBAAxBA,qBAAA,CAA0BG,OAAO,CAAC,CAAC;EAElD,IAAI,CAACF,MAAM,EAAE;IACX,MAAM,IAAIG,KAAK,CAAC,wDAAwD,CAAC;EAC3E;;EAEA;EACA;EACA;EACAC,WAAW,CAAC,MAAM;IAChBT,SAAS,CAACU,UAAU,CAAC,CAAC;EACxB,CAAC,EAAE,EAAE,CAAC;;EAEN;EACA;EACA,IACE,OAAOT,MAAM,CAACU,oBAAoB,KAAK,WAAW,IAClD,OAAOZ,iBAAiB,KAAK,WAAW,E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EACzD,OAAOC,KAAK,GAAG,IAAIE,UAAU,CAACF,KAAK,CAAC,GAAG,IAAI;AAC7C;AAEA,OAAO,SAASG,kBAAkBA,CAAA,EAAW;EAC3C,OAAO,CAAC;AACV;AAEA,OAAO,SAASC,kBAAkBA,CAACP,SAAc,EAAE;EACjD,OAAOA,SAAS;AAClB"}
@@ -1,27 +0,0 @@
1
- // RN API
2
-
3
- export { getMissingAndroidPermissions } from './ditto.rn';
4
-
5
- // JS API
6
-
7
- export * from '../../sources/essentials';
8
- export * from '../../sources/logger';
9
- export * from '../../sources/document-id';
10
- export * from '../../sources/observer';
11
- export * from '../../sources/authenticator';
12
- export * from '../../sources/identity';
13
- export * from '../../sources/ditto';
14
- export * from '../../sources/store-observer';
15
- export * from '../../sources/sync';
16
- export * from '../../sources/sync-subscription';
17
- export * from '../../sources/error';
18
- export * from '../../sources/error-codes';
19
- export * from '../../sources/query-result-item';
20
- export * from '../../sources/query-result';
21
- export * from '../../sources/small-peer-info';
22
- export * from '../../sources/store';
23
- export * from '../../sources/presence';
24
- export * from '../../sources/transport-config';
25
- export * from '../../sources/epilogue';
26
-
27
- # sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA"}
@@ -1,15 +0,0 @@
1
- import { type Permission } from 'react-native';
2
- import 'fastestsmallesttextencoderdecoder';
3
- export declare function ditto_sdk_transports_init(transportsErrorPointer: any): boolean;
4
- /**
5
- * Get the list of missing Android permissions for syncing. The returned value
6
- * can be passed directly to `PermissionsAndroid.requestMultiple()`.
7
- *
8
- * Returns an empty array on other platforms.
9
- */
10
- export declare function getMissingAndroidPermissions(): Permission[];
11
- export declare function boxCStringIntoString(something: any): any;
12
- export declare function boxCBytesIntoBuffer(cborBytes: any): Uint8Array | null;
13
- export declare function getDeadlockTimeout(): number;
14
- export declare function setDeadlockTimeout(something: any): any;
15
- //# sourceMappingURL=ditto.rn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ditto.rn.d.ts","sourceRoot":"","sources":["../../src/ditto.rn.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAOxE,OAAO,mCAAmC,CAAC;AAuE3C,wBAAgB,yBAAyB,CACvC,sBAAsB,EAAE,GAAG,GAC1B,OAAO,CAUT;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,UAAU,EAAE,CAK3D;AAMD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG,OAElD;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,GAAG,qBAGjD;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,OAEhD"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
@@ -1,123 +0,0 @@
1
- import { NativeModules, Platform, type Permission } from 'react-native';
2
-
3
- import { FinalizationGroup } from '@ungap/weakrefs';
4
- import 'fastestsmallesttextencoderdecoder';
5
-
6
- import { type Language, type Platform as SDKPlatform } from './sources/ffi';
7
-
8
- interface JSSDKAPI {
9
- /* C++ methods */
10
- ditto_sdk_transports_init(transportsErrorPointer: any): boolean;
11
- ditto_init_sdk_version(
12
- platform: SDKPlatform,
13
- language: Language,
14
- semVer: string
15
- ): number;
16
- sliceBoxedToUInt8Array(cborBytes: any): Uint8Array | null;
17
- sliceRefToUInt8Array(cborBytes: any): Uint8Array | null;
18
- }
19
- interface PlatformSpecificAPI {
20
- getRandomValues<T extends ArrayBufferView>(array: T): T;
21
- ditto_tick(): void;
22
- createDirectory(path: string): string;
23
- readFile(path: string): string;
24
- copyFile(source: string, destination: string, dittoPath: string): string;
25
- checkDirectoryExists(path: string): string;
26
- defaultDeviceName(): string;
27
-
28
- // Android only
29
- ditto_sdk_transports_set_android_context(): boolean;
30
- ditto_sdk_transports_android_missing_permissions(): string[];
31
- }
32
-
33
- type DittoCoreType = JSSDKAPI & PlatformSpecificAPI;
34
- const dittoCore = global as unknown as DittoCoreType;
35
-
36
- const isLoaded = typeof dittoCore.ditto_sdk_transports_init === 'function';
37
- if (!isLoaded) {
38
- const result = NativeModules.DittoRNSDK?.install();
39
-
40
- if (!result) {
41
- throw new Error('JSI bindings were not installed for: DittoRNSDK Module');
42
- }
43
-
44
- setInterval(() => {
45
- dittoCore.ditto_tick();
46
- }, 50);
47
-
48
- if (
49
- typeof global.FinalizationRegistry === 'undefined' &&
50
- typeof FinalizationGroup !== 'undefined'
51
- ) {
52
- global.FinalizationRegistry = FinalizationGroup;
53
- }
54
-
55
- const platformName: SDKPlatform = Platform.select({
56
- ios: 'Ios',
57
- android: 'Android',
58
- default: 'Unknown',
59
- });
60
-
61
- dittoCore.ditto_init_sdk_version(
62
- platformName,
63
- 'JavaScript',
64
- '4.7.0-rc.1'
65
- );
66
- }
67
-
68
- // Export JSI methods.
69
- Object.keys(dittoCore)
70
- // we will provide our own decorated implementation.
71
- .filter((key) => key !== 'ditto_sdk_transports_init')
72
- .forEach((key) => {
73
- exports[key] = dittoCore[key as keyof DittoCoreType];
74
- });
75
-
76
- export function ditto_sdk_transports_init(
77
- transportsErrorPointer: any
78
- ): boolean {
79
- if (Platform.OS === 'android') {
80
- const res = dittoCore.ditto_sdk_transports_set_android_context();
81
- if (!res) {
82
- throw new Error(
83
- "Couldn't manage to set Android context with `ditto_sdk_transports_set_android_context()`"
84
- );
85
- }
86
- }
87
- return dittoCore.ditto_sdk_transports_init(transportsErrorPointer);
88
- }
89
-
90
- /**
91
- * Get the list of missing Android permissions for syncing. The returned value
92
- * can be passed directly to `PermissionsAndroid.requestMultiple()`.
93
- *
94
- * Returns an empty array on other platforms.
95
- */
96
- export function getMissingAndroidPermissions(): Permission[] {
97
- if (Platform.OS !== 'android') {
98
- return [];
99
- }
100
- return dittoCore.ditto_sdk_transports_android_missing_permissions() as Permission[];
101
- }
102
-
103
- //
104
- // Needed as for JS SDK API's.
105
- //
106
-
107
- export function boxCBytesIntoBuffer(cborBytes: any): Uint8Array | null {
108
- const bytes = dittoCore.sliceBoxedToUInt8Array(cborBytes);
109
- return bytes ? new Uint8Array(bytes) : null;
110
- }
111
-
112
- export function refCBytesIntoBuffer(cborBytes: any): Uint8Array | null {
113
- const bytes = dittoCore.sliceRefToUInt8Array(cborBytes);
114
- return bytes ? new Uint8Array(bytes) : null;
115
- }
116
-
117
- export function getDeadlockTimeout(): number {
118
- return 0;
119
- }
120
-
121
- export function setDeadlockTimeout(something: any) {
122
- return something;
123
- }
@@ -1,4 +0,0 @@
1
- export const isReactNativeBuild = true
2
- export const isNodeBuild = false
3
- export const isWebBuild = false
4
-
@@ -1,29 +0,0 @@
1
- export { getMissingAndroidPermissions } from './ditto.rn';
2
-
3
- export * from './sources/essentials';
4
-
5
- export * from './sources/attachment-token';
6
- export * from './sources/attachment';
7
- export * from './sources/attachment-fetcher';
8
- export * from './sources/attachment-fetch-event';
9
- export * from './sources/init';
10
- export * from './sources/logger';
11
- export * from './sources/document-id';
12
- export * from './sources/observer';
13
-
14
- export * from './sources/authenticator';
15
- export * from './sources/identity';
16
- export * from './sources/ditto';
17
- export * from './sources/store-observer';
18
- export * from './sources/sync';
19
- export * from './sources/sync-subscription';
20
- export * from './sources/error';
21
- export * from './sources/error-codes';
22
- export * from './sources/query-result-item';
23
- export * from './sources/query-result';
24
- export * from './sources/small-peer-info';
25
- export * from './sources/store';
26
- export * from './sources/presence';
27
- export * from './sources/transport-config';
28
- export * from './sources/epilogue';
29
- export * from './sources/connection-request';
@@ -1,2 +0,0 @@
1
- import * as CBOR from 'cbor-redux';
2
- export {CBOR};
@@ -1 +0,0 @@
1
- export * from '@dittolive/ditto/react-native/src/ditto.rn';
@@ -1 +0,0 @@
1
- export * from '@dittolive/ditto/react-native/src/environment/environment.fallback';
@@ -1,54 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import type { Attachment } from './attachment'
6
- import type { Store } from './store'
7
-
8
- /**
9
- * The types of attachment fetch events that can be delivered to an attachment
10
- * fetcher's `callback`.
11
- */
12
- export type AttachmentFetchEventType = 'Completed' | 'Progress' | 'Deleted'
13
-
14
- /**
15
- * An attachment fetch event used when the attachment's download has completed.
16
- */
17
- export type AttachmentFetchEventCompleted = {
18
- type: 'Completed'
19
- attachment: Attachment
20
- }
21
-
22
- /**
23
- * An attachment fetch event used when the attachment's download progressed but
24
- * is not yet complete.
25
- */
26
- export type AttachmentFetchEventProgress = {
27
- type: 'Progress'
28
- totalBytes: number | BigInt
29
- downloadedBytes: number | BigInt
30
- }
31
-
32
- /**
33
- * An attachment fetch event used when the attachment is deleted.
34
- */
35
- export type AttachmentFetchEventDeleted = {
36
- type: 'Deleted'
37
- }
38
-
39
- /**
40
- * A representation of the events that can occur in relation to an attachment
41
- * fetch.
42
- *
43
- * There are three different attachment fetch events: `Completed`, `Progress`,
44
- * or `Deleted`.
45
- *
46
- * There will be at most one `Completed` or `Deleted` event per attachment
47
- * fetch. There can be many `Progress` events delivered for each attachment
48
- * fetch.
49
- *
50
- * Updates relating to an attachment fetch are delivered by registering an
51
- * {@link AttachmentFetcher} through a call to
52
- * {@link Store["fetchAttachment"] | ditto.store.fetchAttachment()}.
53
- */
54
- export type AttachmentFetchEvent = AttachmentFetchEventCompleted | AttachmentFetchEventProgress | AttachmentFetchEventDeleted