cactus-react-native 1.2.0 → 1.4.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.
- package/README.md +573 -13
- package/android/CMakeLists.txt +4 -3
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusFileSystem.kt +21 -4
- package/android/src/main/jniLibs/arm64-v8a/libcactus.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.a +0 -0
- package/cpp/HybridCactus.cpp +112 -19
- package/cpp/HybridCactus.hpp +12 -3
- package/cpp/HybridCactusIndex.cpp +325 -0
- package/cpp/HybridCactusIndex.hpp +43 -0
- package/cpp/HybridCactusUtil.cpp +3 -3
- package/cpp/HybridCactusUtil.hpp +2 -1
- package/cpp/cactus_ffi.h +83 -2
- package/cpp/cactus_util.h +1 -1
- package/ios/HybridCactusFileSystem.swift +23 -2
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +2 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +83 -2
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_telemetry.h +656 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/{ffi_utils.h → cactus_utils.h} +104 -17
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +117 -7
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +91 -5
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +15 -6
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +2 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +83 -2
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_telemetry.h +656 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/{ffi_utils.h → cactus_utils.h} +104 -17
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +117 -7
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +91 -5
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +15 -6
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/_CodeSignature/CodeResources +1 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus_util.xcframework/Info.plist +4 -4
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +1 -1
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/database.h +27 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +1 -1
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h +27 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/_CodeSignature/CodeResources +3 -3
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
- package/lib/module/api/Database.js +57 -3
- package/lib/module/api/Database.js.map +1 -1
- package/lib/module/classes/CactusIndex.js +45 -0
- package/lib/module/classes/CactusIndex.js.map +1 -0
- package/lib/module/classes/CactusLM.js +35 -10
- package/lib/module/classes/CactusLM.js.map +1 -1
- package/lib/module/classes/CactusSTT.js +20 -12
- package/lib/module/classes/CactusSTT.js.map +1 -1
- package/lib/module/config/CactusConfig.js +2 -0
- package/lib/module/config/CactusConfig.js.map +1 -1
- package/lib/module/constants/packageVersion.js +1 -1
- package/lib/module/hooks/useCactusIndex.js +175 -0
- package/lib/module/hooks/useCactusIndex.js.map +1 -0
- package/lib/module/hooks/useCactusLM.js +54 -2
- package/lib/module/hooks/useCactusLM.js.map +1 -1
- package/lib/module/hooks/useCactusSTT.js +2 -2
- package/lib/module/hooks/useCactusSTT.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/Cactus.js +21 -5
- package/lib/module/native/Cactus.js.map +1 -1
- package/lib/module/native/CactusFileSystem.js +3 -0
- package/lib/module/native/CactusFileSystem.js.map +1 -1
- package/lib/module/native/CactusIndex.js +32 -0
- package/lib/module/native/CactusIndex.js.map +1 -0
- package/lib/module/native/CactusUtil.js +16 -3
- package/lib/module/native/CactusUtil.js.map +1 -1
- package/lib/module/native/index.js +1 -0
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/specs/CactusIndex.nitro.js +4 -0
- package/lib/module/specs/CactusIndex.nitro.js.map +1 -0
- package/lib/module/telemetry/Telemetry.js +3 -1
- package/lib/module/telemetry/Telemetry.js.map +1 -1
- package/lib/module/types/CactusIndex.js +2 -0
- package/lib/module/types/CactusIndex.js.map +1 -0
- package/lib/module/types/CactusSTTModel.js +2 -0
- package/lib/module/types/CactusSTTModel.js.map +1 -0
- package/lib/typescript/src/api/Database.d.ts +7 -1
- package/lib/typescript/src/api/Database.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusIndex.d.ts +15 -0
- package/lib/typescript/src/classes/CactusIndex.d.ts.map +1 -0
- package/lib/typescript/src/classes/CactusLM.d.ts +5 -3
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusSTT.d.ts +4 -4
- package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/config/CactusConfig.d.ts +1 -0
- package/lib/typescript/src/config/CactusConfig.d.ts.map +1 -1
- package/lib/typescript/src/constants/packageVersion.d.ts +1 -1
- package/lib/typescript/src/hooks/useCactusIndex.d.ts +14 -0
- package/lib/typescript/src/hooks/useCactusIndex.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts +4 -2
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusSTT.d.ts +3 -3
- package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/Cactus.d.ts +4 -2
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
- package/lib/typescript/src/native/CactusFileSystem.d.ts +1 -0
- package/lib/typescript/src/native/CactusFileSystem.d.ts.map +1 -1
- package/lib/typescript/src/native/CactusIndex.d.ts +12 -0
- package/lib/typescript/src/native/CactusIndex.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusUtil.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +1 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +4 -2
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts +1 -0
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/CactusIndex.nitro.d.ts +24 -0
- package/lib/typescript/src/specs/CactusIndex.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusIndex.d.ts +34 -0
- package/lib/typescript/src/types/CactusIndex.d.ts.map +1 -0
- package/lib/typescript/src/types/CactusLM.d.ts +17 -0
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusModel.d.ts +1 -0
- package/lib/typescript/src/types/CactusModel.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusSTT.d.ts +1 -1
- package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusSTTModel.d.ts +8 -0
- package/lib/typescript/src/types/CactusSTTModel.d.ts.map +1 -0
- package/nitro.json +3 -0
- package/nitrogen/generated/android/c++/JDeviceInfo.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +1 -1
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +1 -1
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.cpp +17 -1
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.hpp +2 -1
- package/nitrogen/generated/android/c++/JHybridCactusImageSpec.cpp +1 -1
- package/nitrogen/generated/android/c++/JHybridCactusImageSpec.hpp +1 -1
- package/nitrogen/generated/android/cactus+autolinking.cmake +2 -1
- package/nitrogen/generated/android/cactus+autolinking.gradle +1 -1
- package/nitrogen/generated/android/cactusOnLoad.cpp +11 -1
- package/nitrogen/generated/android/cactusOnLoad.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/Func_void_double.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusFileSystemSpec.kt +5 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusImageSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/cactusOnLoad.kt +1 -1
- package/nitrogen/generated/ios/Cactus+autolinking.rb +1 -1
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/CactusAutolinking.mm +11 -1
- package/nitrogen/generated/ios/CactusAutolinking.swift +1 -1
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.hpp +9 -1
- package/nitrogen/generated/ios/c++/HybridCactusImageSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridCactusImageSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/swift/DeviceInfo.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_double.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec_cxx.swift +20 -1
- package/nitrogen/generated/ios/swift/HybridCactusImageSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCactusImageSpec_cxx.swift +1 -1
- package/nitrogen/generated/shared/c++/CactusIndexGetResult.hpp +84 -0
- package/nitrogen/generated/shared/c++/CactusIndexQueryResult.hpp +79 -0
- package/nitrogen/generated/shared/c++/DeviceInfo.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.cpp +2 -1
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.hpp +2 -1
- package/nitrogen/generated/shared/c++/HybridCactusImageSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusImageSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusIndexSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridCactusIndexSpec.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +3 -1
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +6 -3
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +2 -2
- package/package.json +2 -2
- package/src/api/Database.ts +80 -2
- package/src/classes/CactusIndex.ts +58 -0
- package/src/classes/CactusLM.ts +41 -11
- package/src/classes/CactusSTT.ts +24 -16
- package/src/config/CactusConfig.ts +3 -0
- package/src/constants/packageVersion.ts +1 -1
- package/src/hooks/useCactusIndex.ts +195 -0
- package/src/hooks/useCactusLM.ts +63 -3
- package/src/hooks/useCactusSTT.ts +4 -4
- package/src/index.tsx +17 -0
- package/src/native/Cactus.ts +39 -4
- package/src/native/CactusFileSystem.ts +4 -0
- package/src/native/CactusIndex.ts +54 -0
- package/src/native/CactusUtil.ts +19 -3
- package/src/native/index.ts +1 -0
- package/src/specs/Cactus.nitro.ts +13 -2
- package/src/specs/CactusFileSystem.nitro.ts +2 -0
- package/src/specs/CactusIndex.nitro.ts +31 -0
- package/src/specs/CactusUtil.nitro.ts +1 -1
- package/src/telemetry/Telemetry.ts +1 -1
- package/src/types/CactusIndex.ts +40 -0
- package/src/types/CactusLM.ts +21 -0
- package/src/types/CactusModel.ts +1 -0
- package/src/types/CactusSTT.ts +1 -1
- package/src/types/CactusSTTModel.ts +10 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.so +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// cactusOnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#ifndef BUILDING_CACTUS_WITH_GENERATED_CMAKE_PROJECT
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
#include "JFunc_void_double.hpp"
|
|
22
22
|
#include "JHybridCactusImageSpec.hpp"
|
|
23
23
|
#include "HybridCactus.hpp"
|
|
24
|
+
#include "HybridCactusIndex.hpp"
|
|
24
25
|
#include "HybridCactusUtil.hpp"
|
|
25
26
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
26
27
|
|
|
@@ -49,6 +50,15 @@ int initialize(JavaVM* vm) {
|
|
|
49
50
|
return std::make_shared<HybridCactus>();
|
|
50
51
|
}
|
|
51
52
|
);
|
|
53
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
54
|
+
"CactusIndex",
|
|
55
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
56
|
+
static_assert(std::is_default_constructible_v<HybridCactusIndex>,
|
|
57
|
+
"The HybridObject \"HybridCactusIndex\" is not default-constructible! "
|
|
58
|
+
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
|
|
59
|
+
return std::make_shared<HybridCactusIndex>();
|
|
60
|
+
}
|
|
61
|
+
);
|
|
52
62
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
53
63
|
"CactusUtil",
|
|
54
64
|
[]() -> std::shared_ptr<HybridObject> {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_double.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.cactus
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusCryptoSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.cactus
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusDeviceInfoSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.cactus
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusFileSystemSpec.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusFileSystemSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.cactus
|
|
@@ -86,6 +86,10 @@ abstract class HybridCactusFileSystemSpec: HybridObject() {
|
|
|
86
86
|
@DoNotStrip
|
|
87
87
|
@Keep
|
|
88
88
|
abstract fun deleteModel(model: String): Promise<Unit>
|
|
89
|
+
|
|
90
|
+
@DoNotStrip
|
|
91
|
+
@Keep
|
|
92
|
+
abstract fun getIndexPath(name: String): Promise<String>
|
|
89
93
|
|
|
90
94
|
private external fun initHybrid(): HybridData
|
|
91
95
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusImageSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.cactus
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Cactus+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Cactus-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "Cactus-Swift-Cxx-Bridge.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// CactusAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#import <type_traits>
|
|
12
12
|
|
|
13
13
|
#include "HybridCactus.hpp"
|
|
14
|
+
#include "HybridCactusIndex.hpp"
|
|
14
15
|
#include "HybridCactusUtil.hpp"
|
|
15
16
|
#include "HybridCactusFileSystemSpecSwift.hpp"
|
|
16
17
|
#include "HybridCactusCryptoSpecSwift.hpp"
|
|
@@ -35,6 +36,15 @@
|
|
|
35
36
|
return std::make_shared<HybridCactus>();
|
|
36
37
|
}
|
|
37
38
|
);
|
|
39
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
40
|
+
"CactusIndex",
|
|
41
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
42
|
+
static_assert(std::is_default_constructible_v<HybridCactusIndex>,
|
|
43
|
+
"The HybridObject \"HybridCactusIndex\" is not default-constructible! "
|
|
44
|
+
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
|
|
45
|
+
return std::make_shared<HybridCactusIndex>();
|
|
46
|
+
}
|
|
47
|
+
);
|
|
38
48
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
39
49
|
"CactusUtil",
|
|
40
50
|
[]() -> std::shared_ptr<HybridObject> {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// CactusAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
public final class CactusAutolinking {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusCryptoSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridCactusCryptoSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusDeviceInfoSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridCactusDeviceInfoSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusFileSystemSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridCactusFileSystemSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusFileSystemSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -135,6 +135,14 @@ namespace margelo::nitro::cactus {
|
|
|
135
135
|
auto __value = std::move(__result.value());
|
|
136
136
|
return __value;
|
|
137
137
|
}
|
|
138
|
+
inline std::shared_ptr<Promise<std::string>> getIndexPath(const std::string& name) override {
|
|
139
|
+
auto __result = _swiftPart.getIndexPath(name);
|
|
140
|
+
if (__result.hasError()) [[unlikely]] {
|
|
141
|
+
std::rethrow_exception(__result.error());
|
|
142
|
+
}
|
|
143
|
+
auto __value = std::move(__result.value());
|
|
144
|
+
return __value;
|
|
145
|
+
}
|
|
138
146
|
|
|
139
147
|
private:
|
|
140
148
|
Cactus::HybridCactusFileSystemSpec_cxx _swiftPart;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusImageSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridCactusImageSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_std__exception_ptr.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_std__optional_std__string_.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusDeviceInfoSpec_cxx.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusFileSystemSpec.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
@@ -24,6 +24,7 @@ public protocol HybridCactusFileSystemSpec_protocol: HybridObject {
|
|
|
24
24
|
func getModelPath(model: String) throws -> Promise<String>
|
|
25
25
|
func downloadModel(model: String, from: String, callback: ((_ progress: Double) -> Void)?) throws -> Promise<Void>
|
|
26
26
|
func deleteModel(model: String) throws -> Promise<Void>
|
|
27
|
+
func getIndexPath(name: String) throws -> Promise<String>
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
public extension HybridCactusFileSystemSpec_protocol {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridCactusFileSystemSpec_cxx.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
@@ -300,4 +300,23 @@ open class HybridCactusFileSystemSpec_cxx {
|
|
|
300
300
|
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
+
|
|
304
|
+
@inline(__always)
|
|
305
|
+
public final func getIndexPath(name: std.string) -> bridge.Result_std__shared_ptr_Promise_std__string___ {
|
|
306
|
+
do {
|
|
307
|
+
let __result = try self.__implementation.getIndexPath(name: String(name))
|
|
308
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
|
|
309
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
|
|
310
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
|
|
311
|
+
__result
|
|
312
|
+
.then({ __result in __promiseHolder.resolve(std.string(__result)) })
|
|
313
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
314
|
+
return __promise
|
|
315
|
+
}()
|
|
316
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
|
|
317
|
+
} catch (let __error) {
|
|
318
|
+
let __exceptionPtr = __error.toCpp()
|
|
319
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
303
322
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CactusIndexGetResult.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
#include <vector>
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::cactus {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (CactusIndexGetResult).
|
|
35
|
+
*/
|
|
36
|
+
struct CactusIndexGetResult {
|
|
37
|
+
public:
|
|
38
|
+
std::vector<std::string> documents SWIFT_PRIVATE;
|
|
39
|
+
std::vector<std::string> metadatas SWIFT_PRIVATE;
|
|
40
|
+
std::vector<std::vector<double>> embeddings SWIFT_PRIVATE;
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
CactusIndexGetResult() = default;
|
|
44
|
+
explicit CactusIndexGetResult(std::vector<std::string> documents, std::vector<std::string> metadatas, std::vector<std::vector<double>> embeddings): documents(documents), metadatas(metadatas), embeddings(embeddings) {}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // namespace margelo::nitro::cactus
|
|
48
|
+
|
|
49
|
+
namespace margelo::nitro {
|
|
50
|
+
|
|
51
|
+
// C++ CactusIndexGetResult <> JS CactusIndexGetResult (object)
|
|
52
|
+
template <>
|
|
53
|
+
struct JSIConverter<margelo::nitro::cactus::CactusIndexGetResult> final {
|
|
54
|
+
static inline margelo::nitro::cactus::CactusIndexGetResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
56
|
+
return margelo::nitro::cactus::CactusIndexGetResult(
|
|
57
|
+
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "documents")),
|
|
58
|
+
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadatas")),
|
|
59
|
+
JSIConverter<std::vector<std::vector<double>>>::fromJSI(runtime, obj.getProperty(runtime, "embeddings"))
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::cactus::CactusIndexGetResult& arg) {
|
|
63
|
+
jsi::Object obj(runtime);
|
|
64
|
+
obj.setProperty(runtime, "documents", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.documents));
|
|
65
|
+
obj.setProperty(runtime, "metadatas", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.metadatas));
|
|
66
|
+
obj.setProperty(runtime, "embeddings", JSIConverter<std::vector<std::vector<double>>>::toJSI(runtime, arg.embeddings));
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
70
|
+
if (!value.isObject()) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
jsi::Object obj = value.getObject(runtime);
|
|
74
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "documents"))) return false;
|
|
78
|
+
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadatas"))) return false;
|
|
79
|
+
if (!JSIConverter<std::vector<std::vector<double>>>::canConvert(runtime, obj.getProperty(runtime, "embeddings"))) return false;
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|