cactus-react-native 1.5.0 → 1.10.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 (221) hide show
  1. package/Cactus.podspec +1 -1
  2. package/README.md +347 -241
  3. package/android/CMakeLists.txt +24 -5
  4. package/android/src/main/jniLibs/arm64-v8a/libcactus.a +0 -0
  5. package/android/src/main/jniLibs/arm64-v8a/libcurl.a +0 -0
  6. package/android/src/main/jniLibs/arm64-v8a/libmbedcrypto.a +0 -0
  7. package/android/src/main/jniLibs/arm64-v8a/libmbedtls.a +0 -0
  8. package/android/src/main/jniLibs/arm64-v8a/libmbedx509.a +0 -0
  9. package/cpp/HybridCactus.cpp +197 -117
  10. package/cpp/HybridCactus.hpp +18 -9
  11. package/cpp/cactus_ffi.h +66 -42
  12. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +0 -1
  13. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_cloud.h +48 -0
  14. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +66 -42
  15. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_utils.h +568 -135
  16. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +148 -17
  17. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +145 -36
  18. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +187 -6
  19. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +49 -149
  20. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Info.plist +0 -0
  21. package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
  22. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +0 -1
  23. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_cloud.h +48 -0
  24. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +66 -42
  25. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_utils.h +568 -135
  26. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +148 -17
  27. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +145 -36
  28. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +187 -6
  29. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +49 -149
  30. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
  31. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/_CodeSignature/CodeResources +1 -1
  32. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
  33. package/lib/module/classes/CactusLM.js +16 -49
  34. package/lib/module/classes/CactusLM.js.map +1 -1
  35. package/lib/module/classes/CactusSTT.js +41 -75
  36. package/lib/module/classes/CactusSTT.js.map +1 -1
  37. package/lib/module/classes/CactusVAD.js +95 -0
  38. package/lib/module/classes/CactusVAD.js.map +1 -0
  39. package/lib/module/hooks/useCactusLM.js +10 -11
  40. package/lib/module/hooks/useCactusLM.js.map +1 -1
  41. package/lib/module/hooks/useCactusSTT.js +23 -62
  42. package/lib/module/hooks/useCactusSTT.js.map +1 -1
  43. package/lib/module/hooks/useCactusVAD.js +171 -0
  44. package/lib/module/hooks/useCactusVAD.js.map +1 -0
  45. package/lib/module/index.js +2 -3
  46. package/lib/module/index.js.map +1 -1
  47. package/lib/module/modelRegistry.js +52 -0
  48. package/lib/module/modelRegistry.js.map +1 -0
  49. package/lib/module/native/Cactus.js +103 -23
  50. package/lib/module/native/Cactus.js.map +1 -1
  51. package/lib/module/native/CactusIndex.js.map +1 -1
  52. package/lib/module/native/index.js +0 -3
  53. package/lib/module/native/index.js.map +1 -1
  54. package/lib/module/types/CactusVAD.js +4 -0
  55. package/lib/module/{specs/CactusUtil.nitro.js.map → types/CactusVAD.js.map} +1 -1
  56. package/lib/typescript/src/classes/CactusLM.d.ts +5 -7
  57. package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
  58. package/lib/typescript/src/classes/CactusSTT.d.ts +9 -12
  59. package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -1
  60. package/lib/typescript/src/classes/CactusVAD.d.ts +20 -0
  61. package/lib/typescript/src/classes/CactusVAD.d.ts.map +1 -0
  62. package/lib/typescript/src/hooks/useCactusLM.d.ts +2 -2
  63. package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
  64. package/lib/typescript/src/hooks/useCactusSTT.d.ts +6 -8
  65. package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -1
  66. package/lib/typescript/src/hooks/useCactusVAD.d.ts +15 -0
  67. package/lib/typescript/src/hooks/useCactusVAD.d.ts.map +1 -0
  68. package/lib/typescript/src/index.d.ts +7 -5
  69. package/lib/typescript/src/index.d.ts.map +1 -1
  70. package/lib/typescript/src/modelRegistry.d.ts +5 -0
  71. package/lib/typescript/src/modelRegistry.d.ts.map +1 -0
  72. package/lib/typescript/src/native/Cactus.d.ts +13 -11
  73. package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
  74. package/lib/typescript/src/native/CactusIndex.d.ts +2 -2
  75. package/lib/typescript/src/native/CactusIndex.d.ts.map +1 -1
  76. package/lib/typescript/src/native/index.d.ts +0 -3
  77. package/lib/typescript/src/native/index.d.ts.map +1 -1
  78. package/lib/typescript/src/specs/Cactus.nitro.d.ts +7 -6
  79. package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
  80. package/lib/typescript/src/types/CactusIndex.d.ts +2 -2
  81. package/lib/typescript/src/types/CactusIndex.d.ts.map +1 -1
  82. package/lib/typescript/src/types/CactusLM.d.ts +19 -11
  83. package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
  84. package/lib/typescript/src/types/CactusSTT.d.ts +44 -12
  85. package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -1
  86. package/lib/typescript/src/types/CactusVAD.d.ts +34 -0
  87. package/lib/typescript/src/types/CactusVAD.d.ts.map +1 -0
  88. package/lib/typescript/src/types/common.d.ts +1 -6
  89. package/lib/typescript/src/types/common.d.ts.map +1 -1
  90. package/nitro.json +0 -11
  91. package/nitrogen/generated/android/cactus+autolinking.cmake +0 -5
  92. package/nitrogen/generated/android/cactusOnLoad.cpp +0 -30
  93. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +0 -50
  94. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +9 -147
  95. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +0 -13
  96. package/nitrogen/generated/ios/CactusAutolinking.mm +0 -26
  97. package/nitrogen/generated/ios/CactusAutolinking.swift +0 -30
  98. package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +5 -4
  99. package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +7 -6
  100. package/package.json +3 -3
  101. package/src/classes/CactusLM.ts +18 -65
  102. package/src/classes/CactusSTT.ts +52 -90
  103. package/src/classes/CactusVAD.ts +129 -0
  104. package/src/hooks/useCactusLM.ts +14 -17
  105. package/src/hooks/useCactusSTT.ts +47 -98
  106. package/src/hooks/useCactusVAD.ts +215 -0
  107. package/src/index.tsx +21 -12
  108. package/src/modelRegistry.ts +65 -0
  109. package/src/native/Cactus.ts +131 -38
  110. package/src/native/CactusIndex.ts +2 -2
  111. package/src/native/index.ts +0 -3
  112. package/src/specs/Cactus.nitro.ts +16 -7
  113. package/src/types/CactusIndex.ts +2 -2
  114. package/src/types/CactusLM.ts +19 -11
  115. package/src/types/CactusSTT.ts +47 -13
  116. package/src/types/CactusVAD.ts +39 -0
  117. package/src/types/common.ts +1 -6
  118. package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +0 -46
  119. package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +0 -27
  120. package/android/src/main/jniLibs/arm64-v8a/libcactus_util.a +0 -0
  121. package/cpp/HybridCactusUtil.cpp +0 -47
  122. package/cpp/HybridCactusUtil.hpp +0 -27
  123. package/cpp/cactus_util.h +0 -25
  124. package/ios/HybridCactusCrypto.swift +0 -37
  125. package/ios/HybridCactusDeviceInfo.swift +0 -32
  126. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_telemetry.h +0 -656
  127. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_telemetry.h +0 -656
  128. package/ios/cactus_util.xcframework/Info.plist +0 -39
  129. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +0 -25
  130. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/database.h +0 -27
  131. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +0 -10
  132. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +0 -25
  133. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
  134. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
  135. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +0 -25
  136. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h +0 -27
  137. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +0 -10
  138. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +0 -25
  139. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Info.plist +0 -0
  140. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/_CodeSignature/CodeResources +0 -135
  141. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
  142. package/lib/module/api/Database.js +0 -45
  143. package/lib/module/api/Database.js.map +0 -1
  144. package/lib/module/api/RemoteLM.js +0 -201
  145. package/lib/module/api/RemoteLM.js.map +0 -1
  146. package/lib/module/config/CactusConfig.js +0 -12
  147. package/lib/module/config/CactusConfig.js.map +0 -1
  148. package/lib/module/models.js +0 -336
  149. package/lib/module/models.js.map +0 -1
  150. package/lib/module/native/CactusCrypto.js +0 -10
  151. package/lib/module/native/CactusCrypto.js.map +0 -1
  152. package/lib/module/native/CactusDeviceInfo.js +0 -13
  153. package/lib/module/native/CactusDeviceInfo.js.map +0 -1
  154. package/lib/module/native/CactusUtil.js +0 -36
  155. package/lib/module/native/CactusUtil.js.map +0 -1
  156. package/lib/module/specs/CactusCrypto.nitro.js +0 -4
  157. package/lib/module/specs/CactusCrypto.nitro.js.map +0 -1
  158. package/lib/module/specs/CactusDeviceInfo.nitro.js +0 -4
  159. package/lib/module/specs/CactusDeviceInfo.nitro.js.map +0 -1
  160. package/lib/module/specs/CactusUtil.nitro.js +0 -4
  161. package/lib/module/telemetry/Telemetry.js +0 -154
  162. package/lib/module/telemetry/Telemetry.js.map +0 -1
  163. package/lib/typescript/src/api/Database.d.ts +0 -12
  164. package/lib/typescript/src/api/Database.d.ts.map +0 -1
  165. package/lib/typescript/src/api/RemoteLM.d.ts +0 -14
  166. package/lib/typescript/src/api/RemoteLM.d.ts.map +0 -1
  167. package/lib/typescript/src/config/CactusConfig.d.ts +0 -7
  168. package/lib/typescript/src/config/CactusConfig.d.ts.map +0 -1
  169. package/lib/typescript/src/models.d.ts +0 -6
  170. package/lib/typescript/src/models.d.ts.map +0 -1
  171. package/lib/typescript/src/native/CactusCrypto.d.ts +0 -5
  172. package/lib/typescript/src/native/CactusCrypto.d.ts.map +0 -1
  173. package/lib/typescript/src/native/CactusDeviceInfo.d.ts +0 -7
  174. package/lib/typescript/src/native/CactusDeviceInfo.d.ts.map +0 -1
  175. package/lib/typescript/src/native/CactusUtil.d.ts +0 -6
  176. package/lib/typescript/src/native/CactusUtil.d.ts.map +0 -1
  177. package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts +0 -8
  178. package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts.map +0 -1
  179. package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts +0 -16
  180. package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts.map +0 -1
  181. package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +0 -10
  182. package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +0 -1
  183. package/lib/typescript/src/telemetry/Telemetry.d.ts +0 -34
  184. package/lib/typescript/src/telemetry/Telemetry.d.ts.map +0 -1
  185. package/nitrogen/generated/android/c++/JDeviceInfo.hpp +0 -74
  186. package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +0 -65
  187. package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +0 -65
  188. package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +0 -85
  189. package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +0 -66
  190. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +0 -50
  191. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +0 -58
  192. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +0 -62
  193. package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +0 -11
  194. package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +0 -77
  195. package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +0 -11
  196. package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +0 -88
  197. package/nitrogen/generated/ios/swift/DeviceInfo.swift +0 -98
  198. package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +0 -47
  199. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +0 -54
  200. package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +0 -57
  201. package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +0 -139
  202. package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +0 -58
  203. package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +0 -164
  204. package/nitrogen/generated/shared/c++/DeviceInfo.hpp +0 -92
  205. package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +0 -21
  206. package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +0 -63
  207. package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +0 -22
  208. package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +0 -67
  209. package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +0 -23
  210. package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +0 -66
  211. package/src/api/Database.ts +0 -55
  212. package/src/api/RemoteLM.ts +0 -273
  213. package/src/config/CactusConfig.ts +0 -11
  214. package/src/models.ts +0 -344
  215. package/src/native/CactusCrypto.ts +0 -11
  216. package/src/native/CactusDeviceInfo.ts +0 -18
  217. package/src/native/CactusUtil.ts +0 -43
  218. package/src/specs/CactusCrypto.nitro.ts +0 -6
  219. package/src/specs/CactusDeviceInfo.nitro.ts +0 -15
  220. package/src/specs/CactusUtil.nitro.ts +0 -8
  221. package/src/telemetry/Telemetry.ts +0 -236
@@ -1,11 +0,0 @@
1
- ///
2
- /// HybridCactusCryptoSpecSwift.cpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #include "HybridCactusCryptoSpecSwift.hpp"
9
-
10
- namespace margelo::nitro::cactus {
11
- } // namespace margelo::nitro::cactus
@@ -1,77 +0,0 @@
1
- ///
2
- /// HybridCactusCryptoSpecSwift.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #include "HybridCactusCryptoSpec.hpp"
11
-
12
- // Forward declaration of `HybridCactusCryptoSpec_cxx` to properly resolve imports.
13
- namespace Cactus { class HybridCactusCryptoSpec_cxx; }
14
-
15
-
16
-
17
- #include <string>
18
- #include <NitroModules/Promise.hpp>
19
-
20
- #include "Cactus-Swift-Cxx-Umbrella.hpp"
21
-
22
- namespace margelo::nitro::cactus {
23
-
24
- /**
25
- * The C++ part of HybridCactusCryptoSpec_cxx.swift.
26
- *
27
- * HybridCactusCryptoSpecSwift (C++) accesses HybridCactusCryptoSpec_cxx (Swift), and might
28
- * contain some additional bridging code for C++ <> Swift interop.
29
- *
30
- * Since this obviously introduces an overhead, I hope at some point in
31
- * the future, HybridCactusCryptoSpec_cxx can directly inherit from the C++ class HybridCactusCryptoSpec
32
- * to simplify the whole structure and memory management.
33
- */
34
- class HybridCactusCryptoSpecSwift: public virtual HybridCactusCryptoSpec {
35
- public:
36
- // Constructor from a Swift instance
37
- explicit HybridCactusCryptoSpecSwift(const Cactus::HybridCactusCryptoSpec_cxx& swiftPart):
38
- HybridObject(HybridCactusCryptoSpec::TAG),
39
- _swiftPart(swiftPart) { }
40
-
41
- public:
42
- // Get the Swift part
43
- inline Cactus::HybridCactusCryptoSpec_cxx& getSwiftPart() noexcept {
44
- return _swiftPart;
45
- }
46
-
47
- public:
48
- inline size_t getExternalMemorySize() noexcept override {
49
- return _swiftPart.getMemorySize();
50
- }
51
- void dispose() noexcept override {
52
- _swiftPart.dispose();
53
- }
54
- std::string toString() override {
55
- return _swiftPart.toString();
56
- }
57
-
58
- public:
59
- // Properties
60
-
61
-
62
- public:
63
- // Methods
64
- inline std::shared_ptr<Promise<std::string>> uuidv5(const std::string& namespaceUuid, const std::string& name) override {
65
- auto __result = _swiftPart.uuidv5(namespaceUuid, name);
66
- if (__result.hasError()) [[unlikely]] {
67
- std::rethrow_exception(__result.error());
68
- }
69
- auto __value = std::move(__result.value());
70
- return __value;
71
- }
72
-
73
- private:
74
- Cactus::HybridCactusCryptoSpec_cxx _swiftPart;
75
- };
76
-
77
- } // namespace margelo::nitro::cactus
@@ -1,11 +0,0 @@
1
- ///
2
- /// HybridCactusDeviceInfoSpecSwift.cpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #include "HybridCactusDeviceInfoSpecSwift.hpp"
9
-
10
- namespace margelo::nitro::cactus {
11
- } // namespace margelo::nitro::cactus
@@ -1,88 +0,0 @@
1
- ///
2
- /// HybridCactusDeviceInfoSpecSwift.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #include "HybridCactusDeviceInfoSpec.hpp"
11
-
12
- // Forward declaration of `HybridCactusDeviceInfoSpec_cxx` to properly resolve imports.
13
- namespace Cactus { class HybridCactusDeviceInfoSpec_cxx; }
14
-
15
- // Forward declaration of `DeviceInfo` to properly resolve imports.
16
- namespace margelo::nitro::cactus { struct DeviceInfo; }
17
-
18
- #include <string>
19
- #include <optional>
20
- #include <NitroModules/Promise.hpp>
21
- #include "DeviceInfo.hpp"
22
-
23
- #include "Cactus-Swift-Cxx-Umbrella.hpp"
24
-
25
- namespace margelo::nitro::cactus {
26
-
27
- /**
28
- * The C++ part of HybridCactusDeviceInfoSpec_cxx.swift.
29
- *
30
- * HybridCactusDeviceInfoSpecSwift (C++) accesses HybridCactusDeviceInfoSpec_cxx (Swift), and might
31
- * contain some additional bridging code for C++ <> Swift interop.
32
- *
33
- * Since this obviously introduces an overhead, I hope at some point in
34
- * the future, HybridCactusDeviceInfoSpec_cxx can directly inherit from the C++ class HybridCactusDeviceInfoSpec
35
- * to simplify the whole structure and memory management.
36
- */
37
- class HybridCactusDeviceInfoSpecSwift: public virtual HybridCactusDeviceInfoSpec {
38
- public:
39
- // Constructor from a Swift instance
40
- explicit HybridCactusDeviceInfoSpecSwift(const Cactus::HybridCactusDeviceInfoSpec_cxx& swiftPart):
41
- HybridObject(HybridCactusDeviceInfoSpec::TAG),
42
- _swiftPart(swiftPart) { }
43
-
44
- public:
45
- // Get the Swift part
46
- inline Cactus::HybridCactusDeviceInfoSpec_cxx& getSwiftPart() noexcept {
47
- return _swiftPart;
48
- }
49
-
50
- public:
51
- inline size_t getExternalMemorySize() noexcept override {
52
- return _swiftPart.getMemorySize();
53
- }
54
- void dispose() noexcept override {
55
- _swiftPart.dispose();
56
- }
57
- std::string toString() override {
58
- return _swiftPart.toString();
59
- }
60
-
61
- public:
62
- // Properties
63
-
64
-
65
- public:
66
- // Methods
67
- inline std::shared_ptr<Promise<std::optional<std::string>>> getAppIdentifier() override {
68
- auto __result = _swiftPart.getAppIdentifier();
69
- if (__result.hasError()) [[unlikely]] {
70
- std::rethrow_exception(__result.error());
71
- }
72
- auto __value = std::move(__result.value());
73
- return __value;
74
- }
75
- inline std::shared_ptr<Promise<DeviceInfo>> getDeviceInfo() override {
76
- auto __result = _swiftPart.getDeviceInfo();
77
- if (__result.hasError()) [[unlikely]] {
78
- std::rethrow_exception(__result.error());
79
- }
80
- auto __value = std::move(__result.value());
81
- return __value;
82
- }
83
-
84
- private:
85
- Cactus::HybridCactusDeviceInfoSpec_cxx _swiftPart;
86
- };
87
-
88
- } // namespace margelo::nitro::cactus
@@ -1,98 +0,0 @@
1
- ///
2
- /// DeviceInfo.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /**
11
- * Represents an instance of `DeviceInfo`, backed by a C++ struct.
12
- */
13
- public typealias DeviceInfo = margelo.nitro.cactus.DeviceInfo
14
-
15
- public extension DeviceInfo {
16
- private typealias bridge = margelo.nitro.cactus.bridge.swift
17
-
18
- /**
19
- * Create a new instance of `DeviceInfo`.
20
- */
21
- init(brand: String, model: String, device_id: String?, os: String, os_version: String) {
22
- self.init(std.string(brand), std.string(model), { () -> bridge.std__optional_std__string_ in
23
- if let __unwrappedValue = device_id {
24
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
- } else {
26
- return .init()
27
- }
28
- }(), std.string(os), std.string(os_version))
29
- }
30
-
31
- var brand: String {
32
- @inline(__always)
33
- get {
34
- return String(self.__brand)
35
- }
36
- @inline(__always)
37
- set {
38
- self.__brand = std.string(newValue)
39
- }
40
- }
41
-
42
- var model: String {
43
- @inline(__always)
44
- get {
45
- return String(self.__model)
46
- }
47
- @inline(__always)
48
- set {
49
- self.__model = std.string(newValue)
50
- }
51
- }
52
-
53
- var device_id: String? {
54
- @inline(__always)
55
- get {
56
- return { () -> String? in
57
- if bridge.has_value_std__optional_std__string_(self.__device_id) {
58
- let __unwrapped = bridge.get_std__optional_std__string_(self.__device_id)
59
- return String(__unwrapped)
60
- } else {
61
- return nil
62
- }
63
- }()
64
- }
65
- @inline(__always)
66
- set {
67
- self.__device_id = { () -> bridge.std__optional_std__string_ in
68
- if let __unwrappedValue = newValue {
69
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
70
- } else {
71
- return .init()
72
- }
73
- }()
74
- }
75
- }
76
-
77
- var os: String {
78
- @inline(__always)
79
- get {
80
- return String(self.__os)
81
- }
82
- @inline(__always)
83
- set {
84
- self.__os = std.string(newValue)
85
- }
86
- }
87
-
88
- var os_version: String {
89
- @inline(__always)
90
- get {
91
- return String(self.__os_version)
92
- }
93
- @inline(__always)
94
- set {
95
- self.__os_version = std.string(newValue)
96
- }
97
- }
98
- }
@@ -1,47 +0,0 @@
1
- ///
2
- /// Func_void_DeviceInfo.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
-
11
- /**
12
- * Wraps a Swift `(_ value: DeviceInfo) -> Void` as a class.
13
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
- */
15
- public final class Func_void_DeviceInfo {
16
- public typealias bridge = margelo.nitro.cactus.bridge.swift
17
-
18
- private let closure: (_ value: DeviceInfo) -> Void
19
-
20
- public init(_ closure: @escaping (_ value: DeviceInfo) -> Void) {
21
- self.closure = closure
22
- }
23
-
24
- @inline(__always)
25
- public func call(value: DeviceInfo) -> Void {
26
- self.closure(value)
27
- }
28
-
29
- /**
30
- * Casts this instance to a retained unsafe raw pointer.
31
- * This acquires one additional strong reference on the object!
32
- */
33
- @inline(__always)
34
- public func toUnsafe() -> UnsafeMutableRawPointer {
35
- return Unmanaged.passRetained(self).toOpaque()
36
- }
37
-
38
- /**
39
- * Casts an unsafe pointer to a `Func_void_DeviceInfo`.
40
- * The pointer has to be a retained opaque `Unmanaged<Func_void_DeviceInfo>`.
41
- * This removes one strong reference from the object!
42
- */
43
- @inline(__always)
44
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_DeviceInfo {
45
- return Unmanaged<Func_void_DeviceInfo>.fromOpaque(pointer).takeRetainedValue()
46
- }
47
- }
@@ -1,54 +0,0 @@
1
- ///
2
- /// Func_void_std__optional_std__string_.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
-
11
- /**
12
- * Wraps a Swift `(_ value: String?) -> Void` as a class.
13
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
- */
15
- public final class Func_void_std__optional_std__string_ {
16
- public typealias bridge = margelo.nitro.cactus.bridge.swift
17
-
18
- private let closure: (_ value: String?) -> Void
19
-
20
- public init(_ closure: @escaping (_ value: String?) -> Void) {
21
- self.closure = closure
22
- }
23
-
24
- @inline(__always)
25
- public func call(value: bridge.std__optional_std__string_) -> Void {
26
- self.closure({ () -> String? in
27
- if bridge.has_value_std__optional_std__string_(value) {
28
- let __unwrapped = bridge.get_std__optional_std__string_(value)
29
- return String(__unwrapped)
30
- } else {
31
- return nil
32
- }
33
- }())
34
- }
35
-
36
- /**
37
- * Casts this instance to a retained unsafe raw pointer.
38
- * This acquires one additional strong reference on the object!
39
- */
40
- @inline(__always)
41
- public func toUnsafe() -> UnsafeMutableRawPointer {
42
- return Unmanaged.passRetained(self).toOpaque()
43
- }
44
-
45
- /**
46
- * Casts an unsafe pointer to a `Func_void_std__optional_std__string_`.
47
- * The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_std__string_>`.
48
- * This removes one strong reference from the object!
49
- */
50
- @inline(__always)
51
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_std__string_ {
52
- return Unmanaged<Func_void_std__optional_std__string_>.fromOpaque(pointer).takeRetainedValue()
53
- }
54
- }
@@ -1,57 +0,0 @@
1
- ///
2
- /// HybridCactusCryptoSpec.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import Foundation
9
- import NitroModules
10
- import NitroModules
11
-
12
- /// See ``HybridCactusCryptoSpec``
13
- public protocol HybridCactusCryptoSpec_protocol: HybridObject {
14
- // Properties
15
-
16
-
17
- // Methods
18
- func uuidv5(namespaceUuid: String, name: String) throws -> Promise<String>
19
- }
20
-
21
- public extension HybridCactusCryptoSpec_protocol {
22
- /// Default implementation of ``HybridObject.toString``
23
- func toString() -> String {
24
- return "[HybridObject CactusCrypto]"
25
- }
26
- }
27
-
28
- /// See ``HybridCactusCryptoSpec``
29
- open class HybridCactusCryptoSpec_base {
30
- private weak var cxxWrapper: HybridCactusCryptoSpec_cxx? = nil
31
- public init() { }
32
- public func getCxxWrapper() -> HybridCactusCryptoSpec_cxx {
33
- #if DEBUG
34
- guard self is HybridCactusCryptoSpec else {
35
- fatalError("`self` is not a `HybridCactusCryptoSpec`! Did you accidentally inherit from `HybridCactusCryptoSpec_base` instead of `HybridCactusCryptoSpec`?")
36
- }
37
- #endif
38
- if let cxxWrapper = self.cxxWrapper {
39
- return cxxWrapper
40
- } else {
41
- let cxxWrapper = HybridCactusCryptoSpec_cxx(self as! HybridCactusCryptoSpec)
42
- self.cxxWrapper = cxxWrapper
43
- return cxxWrapper
44
- }
45
- }
46
- }
47
-
48
- /**
49
- * A Swift base-protocol representing the CactusCrypto HybridObject.
50
- * Implement this protocol to create Swift-based instances of CactusCrypto.
51
- * ```swift
52
- * class HybridCactusCrypto : HybridCactusCryptoSpec {
53
- * // ...
54
- * }
55
- * ```
56
- */
57
- public typealias HybridCactusCryptoSpec = HybridCactusCryptoSpec_protocol & HybridCactusCryptoSpec_base
@@ -1,139 +0,0 @@
1
- ///
2
- /// HybridCactusCryptoSpec_cxx.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import Foundation
9
- import NitroModules
10
- import NitroModules
11
-
12
- /**
13
- * A class implementation that bridges HybridCactusCryptoSpec over to C++.
14
- * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
15
- *
16
- * Also, some Swift types need to be bridged with special handling:
17
- * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
18
- * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
19
- * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
20
- */
21
- open class HybridCactusCryptoSpec_cxx {
22
- /**
23
- * The Swift <> C++ bridge's namespace (`margelo::nitro::cactus::bridge::swift`)
24
- * from `Cactus-Swift-Cxx-Bridge.hpp`.
25
- * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
26
- */
27
- public typealias bridge = margelo.nitro.cactus.bridge.swift
28
-
29
- /**
30
- * Holds an instance of the `HybridCactusCryptoSpec` Swift protocol.
31
- */
32
- private var __implementation: any HybridCactusCryptoSpec
33
-
34
- /**
35
- * Holds a weak pointer to the C++ class that wraps the Swift class.
36
- */
37
- private var __cxxPart: bridge.std__weak_ptr_HybridCactusCryptoSpec_
38
-
39
- /**
40
- * Create a new `HybridCactusCryptoSpec_cxx` that wraps the given `HybridCactusCryptoSpec`.
41
- * All properties and methods bridge to C++ types.
42
- */
43
- public init(_ implementation: any HybridCactusCryptoSpec) {
44
- self.__implementation = implementation
45
- self.__cxxPart = .init()
46
- /* no base class */
47
- }
48
-
49
- /**
50
- * Get the actual `HybridCactusCryptoSpec` instance this class wraps.
51
- */
52
- @inline(__always)
53
- public func getHybridCactusCryptoSpec() -> any HybridCactusCryptoSpec {
54
- return __implementation
55
- }
56
-
57
- /**
58
- * Casts this instance to a retained unsafe raw pointer.
59
- * This acquires one additional strong reference on the object!
60
- */
61
- public func toUnsafe() -> UnsafeMutableRawPointer {
62
- return Unmanaged.passRetained(self).toOpaque()
63
- }
64
-
65
- /**
66
- * Casts an unsafe pointer to a `HybridCactusCryptoSpec_cxx`.
67
- * The pointer has to be a retained opaque `Unmanaged<HybridCactusCryptoSpec_cxx>`.
68
- * This removes one strong reference from the object!
69
- */
70
- public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridCactusCryptoSpec_cxx {
71
- return Unmanaged<HybridCactusCryptoSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
72
- }
73
-
74
- /**
75
- * Gets (or creates) the C++ part of this Hybrid Object.
76
- * The C++ part is a `std::shared_ptr<HybridCactusCryptoSpec>`.
77
- */
78
- public func getCxxPart() -> bridge.std__shared_ptr_HybridCactusCryptoSpec_ {
79
- let cachedCxxPart = self.__cxxPart.lock()
80
- if Bool(fromCxx: cachedCxxPart) {
81
- return cachedCxxPart
82
- } else {
83
- let newCxxPart = bridge.create_std__shared_ptr_HybridCactusCryptoSpec_(self.toUnsafe())
84
- __cxxPart = bridge.weakify_std__shared_ptr_HybridCactusCryptoSpec_(newCxxPart)
85
- return newCxxPart
86
- }
87
- }
88
-
89
-
90
-
91
- /**
92
- * Get the memory size of the Swift class (plus size of any other allocations)
93
- * so the JS VM can properly track it and garbage-collect the JS object if needed.
94
- */
95
- @inline(__always)
96
- public var memorySize: Int {
97
- return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
98
- }
99
-
100
- /**
101
- * Call dispose() on the Swift class.
102
- * This _may_ be called manually from JS.
103
- */
104
- @inline(__always)
105
- public func dispose() {
106
- self.__implementation.dispose()
107
- }
108
-
109
- /**
110
- * Call toString() on the Swift class.
111
- */
112
- @inline(__always)
113
- public func toString() -> String {
114
- return self.__implementation.toString()
115
- }
116
-
117
- // Properties
118
-
119
-
120
- // Methods
121
- @inline(__always)
122
- public final func uuidv5(namespaceUuid: std.string, name: std.string) -> bridge.Result_std__shared_ptr_Promise_std__string___ {
123
- do {
124
- let __result = try self.__implementation.uuidv5(namespaceUuid: String(namespaceUuid), name: String(name))
125
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
126
- let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
127
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
128
- __result
129
- .then({ __result in __promiseHolder.resolve(std.string(__result)) })
130
- .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
131
- return __promise
132
- }()
133
- return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
134
- } catch (let __error) {
135
- let __exceptionPtr = __error.toCpp()
136
- return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
137
- }
138
- }
139
- }
@@ -1,58 +0,0 @@
1
- ///
2
- /// HybridCactusDeviceInfoSpec.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import Foundation
9
- import NitroModules
10
- import NitroModules
11
-
12
- /// See ``HybridCactusDeviceInfoSpec``
13
- public protocol HybridCactusDeviceInfoSpec_protocol: HybridObject {
14
- // Properties
15
-
16
-
17
- // Methods
18
- func getAppIdentifier() throws -> Promise<String?>
19
- func getDeviceInfo() throws -> Promise<DeviceInfo>
20
- }
21
-
22
- public extension HybridCactusDeviceInfoSpec_protocol {
23
- /// Default implementation of ``HybridObject.toString``
24
- func toString() -> String {
25
- return "[HybridObject CactusDeviceInfo]"
26
- }
27
- }
28
-
29
- /// See ``HybridCactusDeviceInfoSpec``
30
- open class HybridCactusDeviceInfoSpec_base {
31
- private weak var cxxWrapper: HybridCactusDeviceInfoSpec_cxx? = nil
32
- public init() { }
33
- public func getCxxWrapper() -> HybridCactusDeviceInfoSpec_cxx {
34
- #if DEBUG
35
- guard self is HybridCactusDeviceInfoSpec else {
36
- fatalError("`self` is not a `HybridCactusDeviceInfoSpec`! Did you accidentally inherit from `HybridCactusDeviceInfoSpec_base` instead of `HybridCactusDeviceInfoSpec`?")
37
- }
38
- #endif
39
- if let cxxWrapper = self.cxxWrapper {
40
- return cxxWrapper
41
- } else {
42
- let cxxWrapper = HybridCactusDeviceInfoSpec_cxx(self as! HybridCactusDeviceInfoSpec)
43
- self.cxxWrapper = cxxWrapper
44
- return cxxWrapper
45
- }
46
- }
47
- }
48
-
49
- /**
50
- * A Swift base-protocol representing the CactusDeviceInfo HybridObject.
51
- * Implement this protocol to create Swift-based instances of CactusDeviceInfo.
52
- * ```swift
53
- * class HybridCactusDeviceInfo : HybridCactusDeviceInfoSpec {
54
- * // ...
55
- * }
56
- * ```
57
- */
58
- public typealias HybridCactusDeviceInfoSpec = HybridCactusDeviceInfoSpec_protocol & HybridCactusDeviceInfoSpec_base