cactus-react-native 1.4.0 → 1.7.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 (226) hide show
  1. package/Cactus.podspec +1 -1
  2. package/README.md +465 -174
  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 +157 -6
  10. package/cpp/HybridCactus.hpp +20 -3
  11. package/cpp/cactus_ffi.h +65 -30
  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_ffi.h +65 -30
  14. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_utils.h +357 -122
  15. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +184 -63
  16. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/gemma_tools.h +549 -0
  17. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +153 -27
  18. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +90 -178
  19. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +276 -151
  20. package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
  21. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +0 -1
  22. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +65 -30
  23. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_utils.h +357 -122
  24. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +184 -63
  25. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/gemma_tools.h +549 -0
  26. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +153 -27
  27. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +90 -178
  28. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +276 -151
  29. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
  30. package/lib/module/classes/CactusLM.js +43 -58
  31. package/lib/module/classes/CactusLM.js.map +1 -1
  32. package/lib/module/classes/CactusSTT.js +64 -38
  33. package/lib/module/classes/CactusSTT.js.map +1 -1
  34. package/lib/module/classes/CactusVAD.js +95 -0
  35. package/lib/module/classes/CactusVAD.js.map +1 -0
  36. package/lib/module/hooks/useCactusLM.js +23 -15
  37. package/lib/module/hooks/useCactusLM.js.map +1 -1
  38. package/lib/module/hooks/useCactusSTT.js +85 -28
  39. package/lib/module/hooks/useCactusSTT.js.map +1 -1
  40. package/lib/module/hooks/useCactusVAD.js +171 -0
  41. package/lib/module/hooks/useCactusVAD.js.map +1 -0
  42. package/lib/module/index.js +2 -3
  43. package/lib/module/index.js.map +1 -1
  44. package/lib/module/modelRegistry.js +52 -0
  45. package/lib/module/modelRegistry.js.map +1 -0
  46. package/lib/module/native/Cactus.js +107 -8
  47. package/lib/module/native/Cactus.js.map +1 -1
  48. package/lib/module/native/CactusIndex.js.map +1 -1
  49. package/lib/module/native/index.js +0 -3
  50. package/lib/module/native/index.js.map +1 -1
  51. package/lib/module/types/CactusLM.js +2 -0
  52. package/lib/module/types/CactusSTT.js +2 -0
  53. package/lib/module/types/CactusVAD.js +4 -0
  54. package/lib/module/types/{CactusModel.js.map → CactusVAD.js.map} +1 -1
  55. package/lib/module/types/common.js +2 -0
  56. package/lib/module/types/{CactusSTTModel.js.map → common.js.map} +1 -1
  57. package/lib/typescript/src/classes/CactusLM.d.ts +8 -6
  58. package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
  59. package/lib/typescript/src/classes/CactusSTT.d.ts +11 -6
  60. package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -1
  61. package/lib/typescript/src/classes/CactusVAD.d.ts +20 -0
  62. package/lib/typescript/src/classes/CactusVAD.d.ts.map +1 -0
  63. package/lib/typescript/src/hooks/useCactusLM.d.ts +3 -3
  64. package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
  65. package/lib/typescript/src/hooks/useCactusSTT.d.ts +11 -5
  66. package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -1
  67. package/lib/typescript/src/hooks/useCactusVAD.d.ts +15 -0
  68. package/lib/typescript/src/hooks/useCactusVAD.d.ts.map +1 -0
  69. package/lib/typescript/src/index.d.ts +7 -6
  70. package/lib/typescript/src/index.d.ts.map +1 -1
  71. package/lib/typescript/src/modelRegistry.d.ts +5 -0
  72. package/lib/typescript/src/modelRegistry.d.ts.map +1 -0
  73. package/lib/typescript/src/native/Cactus.d.ts +12 -6
  74. package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
  75. package/lib/typescript/src/native/CactusIndex.d.ts +2 -2
  76. package/lib/typescript/src/native/CactusIndex.d.ts.map +1 -1
  77. package/lib/typescript/src/native/index.d.ts +0 -3
  78. package/lib/typescript/src/native/index.d.ts.map +1 -1
  79. package/lib/typescript/src/specs/Cactus.nitro.d.ts +6 -1
  80. package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
  81. package/lib/typescript/src/types/CactusIndex.d.ts +2 -2
  82. package/lib/typescript/src/types/CactusIndex.d.ts.map +1 -1
  83. package/lib/typescript/src/types/CactusLM.d.ts +19 -9
  84. package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
  85. package/lib/typescript/src/types/CactusSTT.d.ts +45 -4
  86. package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -1
  87. package/lib/typescript/src/types/CactusVAD.d.ts +34 -0
  88. package/lib/typescript/src/types/CactusVAD.d.ts.map +1 -0
  89. package/lib/typescript/src/types/common.d.ts +23 -0
  90. package/lib/typescript/src/types/common.d.ts.map +1 -0
  91. package/nitro.json +0 -11
  92. package/nitrogen/generated/android/cactus+autolinking.cmake +0 -5
  93. package/nitrogen/generated/android/cactusOnLoad.cpp +0 -30
  94. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +0 -50
  95. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +9 -147
  96. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +0 -13
  97. package/nitrogen/generated/ios/CactusAutolinking.mm +0 -26
  98. package/nitrogen/generated/ios/CactusAutolinking.swift +0 -30
  99. package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +5 -0
  100. package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +6 -1
  101. package/package.json +3 -3
  102. package/src/classes/CactusLM.ts +59 -74
  103. package/src/classes/CactusSTT.ts +92 -49
  104. package/src/classes/CactusVAD.ts +129 -0
  105. package/src/hooks/useCactusLM.ts +26 -9
  106. package/src/hooks/useCactusSTT.ts +105 -44
  107. package/src/hooks/useCactusVAD.ts +215 -0
  108. package/src/index.tsx +20 -10
  109. package/src/modelRegistry.ts +65 -0
  110. package/src/native/Cactus.ts +130 -14
  111. package/src/native/CactusIndex.ts +2 -2
  112. package/src/native/index.ts +0 -3
  113. package/src/specs/Cactus.nitro.ts +11 -2
  114. package/src/types/CactusIndex.ts +2 -2
  115. package/src/types/CactusLM.ts +20 -9
  116. package/src/types/CactusSTT.ts +50 -4
  117. package/src/types/CactusVAD.ts +39 -0
  118. package/src/types/common.ts +23 -0
  119. package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +0 -46
  120. package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +0 -27
  121. package/android/src/main/jniLibs/arm64-v8a/libcactus_util.a +0 -0
  122. package/cpp/HybridCactusUtil.cpp +0 -47
  123. package/cpp/HybridCactusUtil.hpp +0 -27
  124. package/cpp/cactus_util.h +0 -25
  125. package/ios/HybridCactusCrypto.swift +0 -37
  126. package/ios/HybridCactusDeviceInfo.swift +0 -32
  127. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_telemetry.h +0 -656
  128. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_telemetry.h +0 -656
  129. package/ios/cactus_util.xcframework/Info.plist +0 -39
  130. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +0 -25
  131. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/database.h +0 -27
  132. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +0 -10
  133. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +0 -25
  134. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
  135. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
  136. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +0 -25
  137. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h +0 -27
  138. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +0 -10
  139. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +0 -25
  140. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Info.plist +0 -0
  141. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/_CodeSignature/CodeResources +0 -135
  142. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
  143. package/lib/module/api/Database.js +0 -137
  144. package/lib/module/api/Database.js.map +0 -1
  145. package/lib/module/api/RemoteLM.js +0 -201
  146. package/lib/module/api/RemoteLM.js.map +0 -1
  147. package/lib/module/config/CactusConfig.js +0 -12
  148. package/lib/module/config/CactusConfig.js.map +0 -1
  149. package/lib/module/native/CactusCrypto.js +0 -10
  150. package/lib/module/native/CactusCrypto.js.map +0 -1
  151. package/lib/module/native/CactusDeviceInfo.js +0 -13
  152. package/lib/module/native/CactusDeviceInfo.js.map +0 -1
  153. package/lib/module/native/CactusUtil.js +0 -36
  154. package/lib/module/native/CactusUtil.js.map +0 -1
  155. package/lib/module/specs/CactusCrypto.nitro.js +0 -4
  156. package/lib/module/specs/CactusCrypto.nitro.js.map +0 -1
  157. package/lib/module/specs/CactusDeviceInfo.nitro.js +0 -4
  158. package/lib/module/specs/CactusDeviceInfo.nitro.js.map +0 -1
  159. package/lib/module/specs/CactusUtil.nitro.js +0 -4
  160. package/lib/module/specs/CactusUtil.nitro.js.map +0 -1
  161. package/lib/module/telemetry/Telemetry.js +0 -154
  162. package/lib/module/telemetry/Telemetry.js.map +0 -1
  163. package/lib/module/types/CactusModel.js +0 -2
  164. package/lib/module/types/CactusSTTModel.js +0 -2
  165. package/lib/typescript/src/api/Database.d.ts +0 -18
  166. package/lib/typescript/src/api/Database.d.ts.map +0 -1
  167. package/lib/typescript/src/api/RemoteLM.d.ts +0 -14
  168. package/lib/typescript/src/api/RemoteLM.d.ts.map +0 -1
  169. package/lib/typescript/src/config/CactusConfig.d.ts +0 -7
  170. package/lib/typescript/src/config/CactusConfig.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/lib/typescript/src/types/CactusModel.d.ts +0 -13
  186. package/lib/typescript/src/types/CactusModel.d.ts.map +0 -1
  187. package/lib/typescript/src/types/CactusSTTModel.d.ts +0 -8
  188. package/lib/typescript/src/types/CactusSTTModel.d.ts.map +0 -1
  189. package/nitrogen/generated/android/c++/JDeviceInfo.hpp +0 -74
  190. package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +0 -65
  191. package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +0 -65
  192. package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +0 -85
  193. package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +0 -66
  194. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +0 -50
  195. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +0 -58
  196. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +0 -62
  197. package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +0 -11
  198. package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +0 -77
  199. package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +0 -11
  200. package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +0 -88
  201. package/nitrogen/generated/ios/swift/DeviceInfo.swift +0 -98
  202. package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +0 -47
  203. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +0 -54
  204. package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +0 -57
  205. package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +0 -139
  206. package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +0 -58
  207. package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +0 -164
  208. package/nitrogen/generated/shared/c++/DeviceInfo.hpp +0 -92
  209. package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +0 -21
  210. package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +0 -63
  211. package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +0 -22
  212. package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +0 -67
  213. package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +0 -23
  214. package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +0 -66
  215. package/src/api/Database.ts +0 -188
  216. package/src/api/RemoteLM.ts +0 -273
  217. package/src/config/CactusConfig.ts +0 -11
  218. package/src/native/CactusCrypto.ts +0 -11
  219. package/src/native/CactusDeviceInfo.ts +0 -18
  220. package/src/native/CactusUtil.ts +0 -43
  221. package/src/specs/CactusCrypto.nitro.ts +0 -6
  222. package/src/specs/CactusDeviceInfo.nitro.ts +0 -15
  223. package/src/specs/CactusUtil.nitro.ts +0 -8
  224. package/src/telemetry/Telemetry.ts +0 -236
  225. package/src/types/CactusModel.ts +0 -15
  226. package/src/types/CactusSTTModel.ts +0 -10
@@ -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
@@ -1,164 +0,0 @@
1
- ///
2
- /// HybridCactusDeviceInfoSpec_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 HybridCactusDeviceInfoSpec 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 HybridCactusDeviceInfoSpec_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 `HybridCactusDeviceInfoSpec` Swift protocol.
31
- */
32
- private var __implementation: any HybridCactusDeviceInfoSpec
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_HybridCactusDeviceInfoSpec_
38
-
39
- /**
40
- * Create a new `HybridCactusDeviceInfoSpec_cxx` that wraps the given `HybridCactusDeviceInfoSpec`.
41
- * All properties and methods bridge to C++ types.
42
- */
43
- public init(_ implementation: any HybridCactusDeviceInfoSpec) {
44
- self.__implementation = implementation
45
- self.__cxxPart = .init()
46
- /* no base class */
47
- }
48
-
49
- /**
50
- * Get the actual `HybridCactusDeviceInfoSpec` instance this class wraps.
51
- */
52
- @inline(__always)
53
- public func getHybridCactusDeviceInfoSpec() -> any HybridCactusDeviceInfoSpec {
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 `HybridCactusDeviceInfoSpec_cxx`.
67
- * The pointer has to be a retained opaque `Unmanaged<HybridCactusDeviceInfoSpec_cxx>`.
68
- * This removes one strong reference from the object!
69
- */
70
- public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridCactusDeviceInfoSpec_cxx {
71
- return Unmanaged<HybridCactusDeviceInfoSpec_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<HybridCactusDeviceInfoSpec>`.
77
- */
78
- public func getCxxPart() -> bridge.std__shared_ptr_HybridCactusDeviceInfoSpec_ {
79
- let cachedCxxPart = self.__cxxPart.lock()
80
- if Bool(fromCxx: cachedCxxPart) {
81
- return cachedCxxPart
82
- } else {
83
- let newCxxPart = bridge.create_std__shared_ptr_HybridCactusDeviceInfoSpec_(self.toUnsafe())
84
- __cxxPart = bridge.weakify_std__shared_ptr_HybridCactusDeviceInfoSpec_(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 getAppIdentifier() -> bridge.Result_std__shared_ptr_Promise_std__optional_std__string____ {
123
- do {
124
- let __result = try self.__implementation.getAppIdentifier()
125
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__optional_std__string___ in
126
- let __promise = bridge.create_std__shared_ptr_Promise_std__optional_std__string___()
127
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__optional_std__string___(__promise)
128
- __result
129
- .then({ __result in __promiseHolder.resolve({ () -> bridge.std__optional_std__string_ in
130
- if let __unwrappedValue = __result {
131
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
132
- } else {
133
- return .init()
134
- }
135
- }()) })
136
- .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
137
- return __promise
138
- }()
139
- return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__string____(__resultCpp)
140
- } catch (let __error) {
141
- let __exceptionPtr = __error.toCpp()
142
- return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__string____(__exceptionPtr)
143
- }
144
- }
145
-
146
- @inline(__always)
147
- public final func getDeviceInfo() -> bridge.Result_std__shared_ptr_Promise_DeviceInfo___ {
148
- do {
149
- let __result = try self.__implementation.getDeviceInfo()
150
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_DeviceInfo__ in
151
- let __promise = bridge.create_std__shared_ptr_Promise_DeviceInfo__()
152
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_DeviceInfo__(__promise)
153
- __result
154
- .then({ __result in __promiseHolder.resolve(__result) })
155
- .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
156
- return __promise
157
- }()
158
- return bridge.create_Result_std__shared_ptr_Promise_DeviceInfo___(__resultCpp)
159
- } catch (let __error) {
160
- let __exceptionPtr = __error.toCpp()
161
- return bridge.create_Result_std__shared_ptr_Promise_DeviceInfo___(__exceptionPtr)
162
- }
163
- }
164
- }