@delali/narsil-react-native 0.0.0-stage → 0.3.1-next.146

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 (186) hide show
  1. package/LICENSE +201 -0
  2. package/NarsilReactNative.podspec +57 -0
  3. package/README.md +46 -2
  4. package/android/CMakeLists.txt +48 -0
  5. package/android/build.gradle +151 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/AndroidEnvironment.cpp +44 -0
  9. package/android/src/main/cpp/AndroidEnvironment.hpp +11 -0
  10. package/android/src/main/cpp/cpp-adapter.cpp +11 -0
  11. package/android/src/main/java/com/margelo/nitro/narsil/NarsilAndroidEnvironment.kt +29 -0
  12. package/android/src/main/java/com/margelo/nitro/narsil/NarsilReactNativePackage.kt +22 -0
  13. package/app.plugin.js +25 -0
  14. package/cpp/AttachedField.cpp +234 -0
  15. package/cpp/AttachedField.hpp +61 -0
  16. package/cpp/Compression.cpp +113 -0
  17. package/cpp/Compression.hpp +16 -0
  18. package/cpp/GraphHeldAlone.cpp +29 -0
  19. package/cpp/GraphHeldAlone.hpp +25 -0
  20. package/cpp/HostMemory.cpp +123 -0
  21. package/cpp/HostMemory.hpp +53 -0
  22. package/cpp/HybridNarsilCoreImpl.cpp +390 -0
  23. package/cpp/HybridNarsilCoreImpl.hpp +68 -0
  24. package/cpp/HybridNarsilFilesImpl.cpp +245 -0
  25. package/cpp/HybridNarsilFilesImpl.hpp +34 -0
  26. package/cpp/HybridNarsilHostImpl.cpp +126 -0
  27. package/cpp/HybridNarsilHostImpl.hpp +42 -0
  28. package/cpp/NativeAtomics.cpp +110 -0
  29. package/cpp/NativeAtomics.hpp +11 -0
  30. package/cpp/ProcessInfo.cpp +83 -0
  31. package/cpp/ProcessInfo.hpp +11 -0
  32. package/cpp/ThreadPriority.cpp +77 -0
  33. package/cpp/ThreadPriority.hpp +8 -0
  34. package/cpp/WorkletRuntimeDispatcher.cpp +61 -0
  35. package/cpp/WorkletRuntimeDispatcher.hpp +9 -0
  36. package/cpp/core/include/narsil_core.h +208 -0
  37. package/cpp/core/src/connect.c +213 -0
  38. package/cpp/core/src/distance.c +103 -0
  39. package/cpp/core/src/files.c +99 -0
  40. package/cpp/core/src/heap.c +84 -0
  41. package/cpp/core/src/internal.h +284 -0
  42. package/cpp/core/src/kernels_code.c +209 -0
  43. package/cpp/core/src/kernels_float.c +197 -0
  44. package/cpp/core/src/kernels_pair.c +133 -0
  45. package/cpp/core/src/last_links.c +145 -0
  46. package/cpp/core/src/links.c +195 -0
  47. package/cpp/core/src/locks.c +168 -0
  48. package/cpp/core/src/nearest_links.c +147 -0
  49. package/cpp/core/src/place.c +215 -0
  50. package/cpp/core/src/quantize.c +226 -0
  51. package/cpp/core/src/records.c +97 -0
  52. package/cpp/core/src/remove.c +205 -0
  53. package/cpp/core/src/vectors.c +139 -0
  54. package/cpp/core/src/walk.c +231 -0
  55. package/cpp/core/src/workspace.c +167 -0
  56. package/ios/PrivacyInfo.xcprivacy +23 -0
  57. package/lib/client.d.ts +19 -0
  58. package/lib/client.js +41 -0
  59. package/lib/constants.d.ts +9 -0
  60. package/lib/constants.js +9 -0
  61. package/lib/engine/byte-files.d.ts +5 -0
  62. package/lib/engine/byte-files.js +97 -0
  63. package/lib/engine/core.d.ts +3 -0
  64. package/lib/engine/core.js +113 -0
  65. package/lib/engine/files.d.ts +3 -0
  66. package/lib/engine/files.js +188 -0
  67. package/lib/engine/host.d.ts +13 -0
  68. package/lib/engine/host.js +102 -0
  69. package/lib/engine/install.d.ts +4 -0
  70. package/lib/engine/install.js +29 -0
  71. package/lib/engine/native-error.d.ts +1 -0
  72. package/lib/engine/native-error.js +12 -0
  73. package/lib/engine/stand-ins/atomics.d.ts +5 -0
  74. package/lib/engine/stand-ins/atomics.js +236 -0
  75. package/lib/engine/stand-ins/crypto.d.ts +2 -0
  76. package/lib/engine/stand-ins/crypto.js +65 -0
  77. package/lib/engine/stand-ins/process.d.ts +2 -0
  78. package/lib/engine/stand-ins/process.js +22 -0
  79. package/lib/engine/stand-ins/streams.d.ts +1 -0
  80. package/lib/engine/stand-ins/streams.js +31 -0
  81. package/lib/engine/stand-ins/structured-clone.d.ts +1 -0
  82. package/lib/engine/stand-ins/structured-clone.js +121 -0
  83. package/lib/engine/streamed.d.ts +6 -0
  84. package/lib/engine/streamed.js +29 -0
  85. package/lib/engine/transfer.d.ts +3 -0
  86. package/lib/engine/transfer.js +77 -0
  87. package/lib/errors.d.ts +25 -0
  88. package/lib/errors.js +59 -0
  89. package/lib/index.d.ts +3 -0
  90. package/lib/index.js +2 -0
  91. package/lib/methods.d.ts +5 -0
  92. package/lib/methods.js +47 -0
  93. package/lib/native-objects.d.ts +2 -0
  94. package/lib/native-objects.js +24 -0
  95. package/lib/specs/core.nitro.d.ts +79 -0
  96. package/lib/specs/core.nitro.js +1 -0
  97. package/lib/specs/files.nitro.d.ts +36 -0
  98. package/lib/specs/files.nitro.js +1 -0
  99. package/lib/specs/host.nitro.d.ts +24 -0
  100. package/lib/specs/host.nitro.js +1 -0
  101. package/lib/transferred.d.ts +15 -0
  102. package/lib/transferred.js +6 -0
  103. package/lib/types.d.ts +136 -0
  104. package/lib/types.js +1 -0
  105. package/lib/worklets/app-turns.d.ts +1 -0
  106. package/lib/worklets/app-turns.js +44 -0
  107. package/lib/worklets/client.d.ts +30 -0
  108. package/lib/worklets/client.js +144 -0
  109. package/lib/worklets/index.d.ts +4 -0
  110. package/lib/worklets/index.js +2 -0
  111. package/lib/worklets/instances.d.ts +15 -0
  112. package/lib/worklets/instances.js +194 -0
  113. package/lib/worklets/json-part.d.ts +1 -0
  114. package/lib/worklets/json-part.js +42 -0
  115. package/lib/worklets/runtime.d.ts +25 -0
  116. package/lib/worklets/runtime.js +80 -0
  117. package/lib/worklets/transfer-queue.d.ts +7 -0
  118. package/lib/worklets/transfer-queue.js +79 -0
  119. package/lib/worklets/types.d.ts +26 -0
  120. package/lib/worklets/types.js +1 -0
  121. package/nitro.json +32 -0
  122. package/nitrogen/generated/.gitattributes +1 -0
  123. package/nitrogen/generated/android/NarsilReactNative+autolinking.cmake +85 -0
  124. package/nitrogen/generated/android/NarsilReactNative+autolinking.gradle +27 -0
  125. package/nitrogen/generated/android/NarsilReactNativeOnLoad.cpp +69 -0
  126. package/nitrogen/generated/android/NarsilReactNativeOnLoad.hpp +34 -0
  127. package/nitrogen/generated/android/kotlin/com/margelo/nitro/narsil/NarsilReactNativeOnLoad.kt +35 -0
  128. package/nitrogen/generated/ios/NarsilReactNative+autolinking.rb +62 -0
  129. package/nitrogen/generated/ios/NarsilReactNative-Swift-Cxx-Bridge.cpp +17 -0
  130. package/nitrogen/generated/ios/NarsilReactNative-Swift-Cxx-Bridge.hpp +27 -0
  131. package/nitrogen/generated/ios/NarsilReactNative-Swift-Cxx-Umbrella.hpp +38 -0
  132. package/nitrogen/generated/ios/NarsilReactNativeAutolinking.mm +55 -0
  133. package/nitrogen/generated/ios/NarsilReactNativeAutolinking.swift +16 -0
  134. package/nitrogen/generated/shared/c++/DirectoryEntry.hpp +91 -0
  135. package/nitrogen/generated/shared/c++/FileStatus.hpp +103 -0
  136. package/nitrogen/generated/shared/c++/GraphMemory.hpp +120 -0
  137. package/nitrogen/generated/shared/c++/HybridNarsilAttachedGraphSpec.cpp +21 -0
  138. package/nitrogen/generated/shared/c++/HybridNarsilAttachedGraphSpec.hpp +62 -0
  139. package/nitrogen/generated/shared/c++/HybridNarsilAttachedStoreSpec.cpp +21 -0
  140. package/nitrogen/generated/shared/c++/HybridNarsilAttachedStoreSpec.hpp +62 -0
  141. package/nitrogen/generated/shared/c++/HybridNarsilCoreSpec.cpp +35 -0
  142. package/nitrogen/generated/shared/c++/HybridNarsilCoreSpec.hpp +100 -0
  143. package/nitrogen/generated/shared/c++/HybridNarsilFilesSpec.cpp +37 -0
  144. package/nitrogen/generated/shared/c++/HybridNarsilFilesSpec.hpp +86 -0
  145. package/nitrogen/generated/shared/c++/HybridNarsilHostSpec.cpp +34 -0
  146. package/nitrogen/generated/shared/c++/HybridNarsilHostSpec.hpp +78 -0
  147. package/nitrogen/generated/shared/c++/MemoryView.hpp +91 -0
  148. package/nitrogen/generated/shared/c++/NativeConnectOutcome.hpp +87 -0
  149. package/nitrogen/generated/shared/c++/NativeScores.hpp +87 -0
  150. package/nitrogen/generated/shared/c++/NativeSearchHits.hpp +91 -0
  151. package/nitrogen/generated/shared/c++/ProcessMemory.hpp +87 -0
  152. package/nitrogen/generated/shared/c++/StoreMemory.hpp +142 -0
  153. package/package.json +87 -3
  154. package/react-native.config.js +8 -0
  155. package/src/client.ts +44 -0
  156. package/src/constants.ts +9 -0
  157. package/src/engine/byte-files.ts +99 -0
  158. package/src/engine/core.ts +162 -0
  159. package/src/engine/files.ts +186 -0
  160. package/src/engine/host.ts +111 -0
  161. package/src/engine/install.ts +31 -0
  162. package/src/engine/native-error.ts +10 -0
  163. package/src/engine/stand-ins/atomics.ts +288 -0
  164. package/src/engine/stand-ins/crypto.ts +81 -0
  165. package/src/engine/stand-ins/process.ts +30 -0
  166. package/src/engine/stand-ins/streams.ts +45 -0
  167. package/src/engine/stand-ins/structured-clone.ts +118 -0
  168. package/src/engine/streamed.ts +40 -0
  169. package/src/engine/transfer.ts +72 -0
  170. package/src/errors.ts +73 -0
  171. package/src/index.ts +3 -0
  172. package/src/methods.ts +52 -0
  173. package/src/native-objects.ts +30 -0
  174. package/src/specs/core.nitro.ts +140 -0
  175. package/src/specs/files.nitro.ts +42 -0
  176. package/src/specs/host.nitro.ts +30 -0
  177. package/src/transferred.ts +18 -0
  178. package/src/types.ts +164 -0
  179. package/src/worklets/app-turns.ts +48 -0
  180. package/src/worklets/client.ts +165 -0
  181. package/src/worklets/index.ts +4 -0
  182. package/src/worklets/instances.ts +231 -0
  183. package/src/worklets/json-part.ts +38 -0
  184. package/src/worklets/runtime.ts +190 -0
  185. package/src/worklets/transfer-queue.ts +98 -0
  186. package/src/worklets/types.ts +37 -0
@@ -0,0 +1,91 @@
1
+ ///
2
+ /// MemoryView.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <NitroModules/ArrayBuffer.hpp>
34
+
35
+ namespace margelo::nitro::narsil {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (MemoryView).
39
+ */
40
+ struct MemoryView final {
41
+ public:
42
+ std::shared_ptr<ArrayBuffer> buffer SWIFT_PRIVATE;
43
+ double byteOffset SWIFT_PRIVATE;
44
+ double byteLength SWIFT_PRIVATE;
45
+
46
+ public:
47
+ MemoryView() = default;
48
+ explicit MemoryView(std::shared_ptr<ArrayBuffer> buffer, double byteOffset, double byteLength): buffer(buffer), byteOffset(byteOffset), byteLength(byteLength) {}
49
+
50
+ public:
51
+ friend bool operator==(const MemoryView& lhs, const MemoryView& rhs) = default;
52
+ };
53
+
54
+ } // namespace margelo::nitro::narsil
55
+
56
+ namespace margelo::nitro {
57
+
58
+ // C++ MemoryView <> JS MemoryView (object)
59
+ template <>
60
+ struct JSIConverter<margelo::nitro::narsil::MemoryView> final {
61
+ static inline margelo::nitro::narsil::MemoryView fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
62
+ jsi::Object obj = arg.asObject(runtime);
63
+ return margelo::nitro::narsil::MemoryView(
64
+ JSIConverter<std::shared_ptr<ArrayBuffer>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "buffer"))),
65
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "byteOffset"))),
66
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "byteLength")))
67
+ );
68
+ }
69
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::narsil::MemoryView& arg) {
70
+ jsi::Object obj(runtime);
71
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "buffer"), JSIConverter<std::shared_ptr<ArrayBuffer>>::toJSI(runtime, arg.buffer));
72
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "byteOffset"), JSIConverter<double>::toJSI(runtime, arg.byteOffset));
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "byteLength"), JSIConverter<double>::toJSI(runtime, arg.byteLength));
74
+ return obj;
75
+ }
76
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
77
+ if (!value.isObject()) {
78
+ return false;
79
+ }
80
+ jsi::Object obj = value.getObject(runtime);
81
+ if (!nitro::isPlainObject(runtime, obj)) {
82
+ return false;
83
+ }
84
+ if (!JSIConverter<std::shared_ptr<ArrayBuffer>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "buffer")))) return false;
85
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "byteOffset")))) return false;
86
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "byteLength")))) return false;
87
+ return true;
88
+ }
89
+ };
90
+
91
+ } // namespace margelo::nitro
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// NativeConnectOutcome.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <NitroModules/ArrayBuffer.hpp>
34
+
35
+ namespace margelo::nitro::narsil {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (NativeConnectOutcome).
39
+ */
40
+ struct NativeConnectOutcome final {
41
+ public:
42
+ double status SWIFT_PRIVATE;
43
+ std::shared_ptr<ArrayBuffer> wakes SWIFT_PRIVATE;
44
+
45
+ public:
46
+ NativeConnectOutcome() = default;
47
+ explicit NativeConnectOutcome(double status, std::shared_ptr<ArrayBuffer> wakes): status(status), wakes(wakes) {}
48
+
49
+ public:
50
+ friend bool operator==(const NativeConnectOutcome& lhs, const NativeConnectOutcome& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::narsil
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ NativeConnectOutcome <> JS NativeConnectOutcome (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::narsil::NativeConnectOutcome> final {
60
+ static inline margelo::nitro::narsil::NativeConnectOutcome fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::narsil::NativeConnectOutcome(
63
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status"))),
64
+ JSIConverter<std::shared_ptr<ArrayBuffer>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "wakes")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::narsil::NativeConnectOutcome& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "status"), JSIConverter<double>::toJSI(runtime, arg.status));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "wakes"), JSIConverter<std::shared_ptr<ArrayBuffer>>::toJSI(runtime, arg.wakes));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status")))) return false;
82
+ if (!JSIConverter<std::shared_ptr<ArrayBuffer>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "wakes")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// NativeScores.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <NitroModules/ArrayBuffer.hpp>
34
+
35
+ namespace margelo::nitro::narsil {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (NativeScores).
39
+ */
40
+ struct NativeScores final {
41
+ public:
42
+ double status SWIFT_PRIVATE;
43
+ std::shared_ptr<ArrayBuffer> distances SWIFT_PRIVATE;
44
+
45
+ public:
46
+ NativeScores() = default;
47
+ explicit NativeScores(double status, std::shared_ptr<ArrayBuffer> distances): status(status), distances(distances) {}
48
+
49
+ public:
50
+ friend bool operator==(const NativeScores& lhs, const NativeScores& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::narsil
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ NativeScores <> JS NativeScores (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::narsil::NativeScores> final {
60
+ static inline margelo::nitro::narsil::NativeScores fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::narsil::NativeScores(
63
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status"))),
64
+ JSIConverter<std::shared_ptr<ArrayBuffer>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distances")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::narsil::NativeScores& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "status"), JSIConverter<double>::toJSI(runtime, arg.status));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "distances"), JSIConverter<std::shared_ptr<ArrayBuffer>>::toJSI(runtime, arg.distances));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status")))) return false;
82
+ if (!JSIConverter<std::shared_ptr<ArrayBuffer>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distances")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,91 @@
1
+ ///
2
+ /// NativeSearchHits.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <NitroModules/ArrayBuffer.hpp>
34
+
35
+ namespace margelo::nitro::narsil {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (NativeSearchHits).
39
+ */
40
+ struct NativeSearchHits final {
41
+ public:
42
+ double count SWIFT_PRIVATE;
43
+ std::shared_ptr<ArrayBuffer> ordinals SWIFT_PRIVATE;
44
+ std::shared_ptr<ArrayBuffer> distances SWIFT_PRIVATE;
45
+
46
+ public:
47
+ NativeSearchHits() = default;
48
+ explicit NativeSearchHits(double count, std::shared_ptr<ArrayBuffer> ordinals, std::shared_ptr<ArrayBuffer> distances): count(count), ordinals(ordinals), distances(distances) {}
49
+
50
+ public:
51
+ friend bool operator==(const NativeSearchHits& lhs, const NativeSearchHits& rhs) = default;
52
+ };
53
+
54
+ } // namespace margelo::nitro::narsil
55
+
56
+ namespace margelo::nitro {
57
+
58
+ // C++ NativeSearchHits <> JS NativeSearchHits (object)
59
+ template <>
60
+ struct JSIConverter<margelo::nitro::narsil::NativeSearchHits> final {
61
+ static inline margelo::nitro::narsil::NativeSearchHits fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
62
+ jsi::Object obj = arg.asObject(runtime);
63
+ return margelo::nitro::narsil::NativeSearchHits(
64
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "count"))),
65
+ JSIConverter<std::shared_ptr<ArrayBuffer>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ordinals"))),
66
+ JSIConverter<std::shared_ptr<ArrayBuffer>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distances")))
67
+ );
68
+ }
69
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::narsil::NativeSearchHits& arg) {
70
+ jsi::Object obj(runtime);
71
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "count"), JSIConverter<double>::toJSI(runtime, arg.count));
72
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "ordinals"), JSIConverter<std::shared_ptr<ArrayBuffer>>::toJSI(runtime, arg.ordinals));
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "distances"), JSIConverter<std::shared_ptr<ArrayBuffer>>::toJSI(runtime, arg.distances));
74
+ return obj;
75
+ }
76
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
77
+ if (!value.isObject()) {
78
+ return false;
79
+ }
80
+ jsi::Object obj = value.getObject(runtime);
81
+ if (!nitro::isPlainObject(runtime, obj)) {
82
+ return false;
83
+ }
84
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "count")))) return false;
85
+ if (!JSIConverter<std::shared_ptr<ArrayBuffer>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ordinals")))) return false;
86
+ if (!JSIConverter<std::shared_ptr<ArrayBuffer>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distances")))) return false;
87
+ return true;
88
+ }
89
+ };
90
+
91
+ } // namespace margelo::nitro
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// ProcessMemory.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+
34
+
35
+ namespace margelo::nitro::narsil {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (ProcessMemory).
39
+ */
40
+ struct ProcessMemory final {
41
+ public:
42
+ double residentBytes SWIFT_PRIVATE;
43
+ double availableBytes SWIFT_PRIVATE;
44
+
45
+ public:
46
+ ProcessMemory() = default;
47
+ explicit ProcessMemory(double residentBytes, double availableBytes): residentBytes(residentBytes), availableBytes(availableBytes) {}
48
+
49
+ public:
50
+ friend bool operator==(const ProcessMemory& lhs, const ProcessMemory& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::narsil
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ ProcessMemory <> JS ProcessMemory (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::narsil::ProcessMemory> final {
60
+ static inline margelo::nitro::narsil::ProcessMemory fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::narsil::ProcessMemory(
63
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "residentBytes"))),
64
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "availableBytes")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::narsil::ProcessMemory& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "residentBytes"), JSIConverter<double>::toJSI(runtime, arg.residentBytes));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "availableBytes"), JSIConverter<double>::toJSI(runtime, arg.availableBytes));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "residentBytes")))) return false;
82
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "availableBytes")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,142 @@
1
+ ///
2
+ /// StoreMemory.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `MemoryView` to properly resolve imports.
32
+ namespace margelo::nitro::narsil { struct MemoryView; }
33
+
34
+ #include "MemoryView.hpp"
35
+ #include <string>
36
+ #include <vector>
37
+
38
+ namespace margelo::nitro::narsil {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (StoreMemory).
42
+ */
43
+ struct StoreMemory final {
44
+ public:
45
+ MemoryView storeHeader SWIFT_PRIVATE;
46
+ double dimension SWIFT_PRIVATE;
47
+ double bits SWIFT_PRIVATE;
48
+ double recordsPerBlock SWIFT_PRIVATE;
49
+ double vectorsPerBlock SWIFT_PRIVATE;
50
+ double vectorStrideBytes SWIFT_PRIVATE;
51
+ MemoryView codePresent SWIFT_PRIVATE;
52
+ MemoryView centroid SWIFT_PRIVATE;
53
+ MemoryView magnitudes SWIFT_PRIVATE;
54
+ MemoryView present SWIFT_PRIVATE;
55
+ MemoryView vectorFile SWIFT_PRIVATE;
56
+ MemoryView vectorOffset SWIFT_PRIVATE;
57
+ std::vector<std::string> vectorFiles SWIFT_PRIVATE;
58
+ std::vector<MemoryView> codeBlocks SWIFT_PRIVATE;
59
+ std::vector<MemoryView> vectorBlocks SWIFT_PRIVATE;
60
+
61
+ public:
62
+ StoreMemory() = default;
63
+ explicit StoreMemory(MemoryView storeHeader, double dimension, double bits, double recordsPerBlock, double vectorsPerBlock, double vectorStrideBytes, MemoryView codePresent, MemoryView centroid, MemoryView magnitudes, MemoryView present, MemoryView vectorFile, MemoryView vectorOffset, std::vector<std::string> vectorFiles, std::vector<MemoryView> codeBlocks, std::vector<MemoryView> vectorBlocks): storeHeader(storeHeader), dimension(dimension), bits(bits), recordsPerBlock(recordsPerBlock), vectorsPerBlock(vectorsPerBlock), vectorStrideBytes(vectorStrideBytes), codePresent(codePresent), centroid(centroid), magnitudes(magnitudes), present(present), vectorFile(vectorFile), vectorOffset(vectorOffset), vectorFiles(vectorFiles), codeBlocks(codeBlocks), vectorBlocks(vectorBlocks) {}
64
+
65
+ public:
66
+ friend bool operator==(const StoreMemory& lhs, const StoreMemory& rhs) = default;
67
+ };
68
+
69
+ } // namespace margelo::nitro::narsil
70
+
71
+ namespace margelo::nitro {
72
+
73
+ // C++ StoreMemory <> JS StoreMemory (object)
74
+ template <>
75
+ struct JSIConverter<margelo::nitro::narsil::StoreMemory> final {
76
+ static inline margelo::nitro::narsil::StoreMemory fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
77
+ jsi::Object obj = arg.asObject(runtime);
78
+ return margelo::nitro::narsil::StoreMemory(
79
+ JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "storeHeader"))),
80
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dimension"))),
81
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bits"))),
82
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recordsPerBlock"))),
83
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorsPerBlock"))),
84
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorStrideBytes"))),
85
+ JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codePresent"))),
86
+ JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "centroid"))),
87
+ JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "magnitudes"))),
88
+ JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "present"))),
89
+ JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorFile"))),
90
+ JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorOffset"))),
91
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorFiles"))),
92
+ JSIConverter<std::vector<margelo::nitro::narsil::MemoryView>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codeBlocks"))),
93
+ JSIConverter<std::vector<margelo::nitro::narsil::MemoryView>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorBlocks")))
94
+ );
95
+ }
96
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::narsil::StoreMemory& arg) {
97
+ jsi::Object obj(runtime);
98
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "storeHeader"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.storeHeader));
99
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "dimension"), JSIConverter<double>::toJSI(runtime, arg.dimension));
100
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "bits"), JSIConverter<double>::toJSI(runtime, arg.bits));
101
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "recordsPerBlock"), JSIConverter<double>::toJSI(runtime, arg.recordsPerBlock));
102
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "vectorsPerBlock"), JSIConverter<double>::toJSI(runtime, arg.vectorsPerBlock));
103
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "vectorStrideBytes"), JSIConverter<double>::toJSI(runtime, arg.vectorStrideBytes));
104
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "codePresent"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.codePresent));
105
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "centroid"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.centroid));
106
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "magnitudes"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.magnitudes));
107
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "present"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.present));
108
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "vectorFile"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.vectorFile));
109
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "vectorOffset"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.vectorOffset));
110
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "vectorFiles"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.vectorFiles));
111
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "codeBlocks"), JSIConverter<std::vector<margelo::nitro::narsil::MemoryView>>::toJSI(runtime, arg.codeBlocks));
112
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "vectorBlocks"), JSIConverter<std::vector<margelo::nitro::narsil::MemoryView>>::toJSI(runtime, arg.vectorBlocks));
113
+ return obj;
114
+ }
115
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
116
+ if (!value.isObject()) {
117
+ return false;
118
+ }
119
+ jsi::Object obj = value.getObject(runtime);
120
+ if (!nitro::isPlainObject(runtime, obj)) {
121
+ return false;
122
+ }
123
+ if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "storeHeader")))) return false;
124
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dimension")))) return false;
125
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bits")))) return false;
126
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recordsPerBlock")))) return false;
127
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorsPerBlock")))) return false;
128
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorStrideBytes")))) return false;
129
+ if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codePresent")))) return false;
130
+ if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "centroid")))) return false;
131
+ if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "magnitudes")))) return false;
132
+ if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "present")))) return false;
133
+ if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorFile")))) return false;
134
+ if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorOffset")))) return false;
135
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorFiles")))) return false;
136
+ if (!JSIConverter<std::vector<margelo::nitro::narsil::MemoryView>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codeBlocks")))) return false;
137
+ if (!JSIConverter<std::vector<margelo::nitro::narsil::MemoryView>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vectorBlocks")))) return false;
138
+ return true;
139
+ }
140
+ };
141
+
142
+ } // namespace margelo::nitro