From 4e1c561c3f6c45ad4f3052e4c0db518e345df466 Mon Sep 17 00:00:00 2001 From: Gary Tokman Date: Mon, 2 Sep 2024 18:18:37 -0400 Subject: [PATCH 1/2] chore: release 0.4.0 --- packages/npm/send/CHANGELOG.md | 61 +++++++++++++++++++++++++++++++++- packages/npm/send/package.json | 2 +- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/packages/npm/send/CHANGELOG.md b/packages/npm/send/CHANGELOG.md index 37d0062..55692e0 100644 --- a/packages/npm/send/CHANGELOG.md +++ b/packages/npm/send/CHANGELOG.md @@ -1,3 +1,62 @@ + + +# [0.4.0](https://github.com/candlefinance/oss/compare/v0.3.22...v0.4.0) (2024-09-02) + + +### Bug Fixes + +* add more complex types ([ccdd0a9](https://github.com/candlefinance/oss/commit/ccdd0a96947746289e90eafb2e6548071d273182)) +* **all:** cleanup android code ([03a0c3d](https://github.com/candlefinance/oss/commit/03a0c3d8894fe67bcecee92365069385d1fb0f02)) +* **all:** cleanup pr comments ([6cf8ba5](https://github.com/candlefinance/oss/commit/6cf8ba5d461d2c9540826692771f1afc1301e11e)) +* bump send version ([4f6b82c](https://github.com/candlefinance/oss/commit/4f6b82c15d8a85852bb0108e8b7d8c1e50555317)) +* compiler error on android ([c22010a](https://github.com/candlefinance/oss/commit/c22010aa4bebbdf29d295a69da1b7f15044e0770)) +* get android to compile ([de4bbce](https://github.com/candlefinance/oss/commit/de4bbce3596c97246d61e22a91d85902c4e4e14b)) +* lint ([bb942a8](https://github.com/candlefinance/oss/commit/bb942a8562e13753679bb16e8a07237ef8c144b4)) +* lock ([9d90e8e](https://github.com/candlefinance/oss/commit/9d90e8ebbd764c13fe91f7aff621591bf631d4c1)) +* make android compile ([021670f](https://github.com/candlefinance/oss/commit/021670febdf72b205e026a6fb9db5b9c438a985e)) +* make things compile ([88f64b9](https://github.com/candlefinance/oss/commit/88f64b91ce14fe8c14d5438523aaff44ddbd323f)) +* more changes ([dc809b8](https://github.com/candlefinance/oss/commit/dc809b8d1df351f53b6d6a4e323222ec5a2dbf7a)) +* more polish ([b1252ed](https://github.com/candlefinance/oss/commit/b1252edaaead926958d7dc231fe6c2102a5fa8ef)) +* **packages:** add important note to readme ([33201b1](https://github.com/candlefinance/oss/commit/33201b1adee0a047f3a07d04a7235194333c9ef3)) +* pass through errors ([4c4bf10](https://github.com/candlefinance/oss/commit/4c4bf102ac17fe8c595f70716c2a6fcbeb903cc9)) +* pr feedback ([6e67a1c](https://github.com/candlefinance/oss/commit/6e67a1c819df86c7e95d7ad01ae7e929bb762de0)) +* **prefs:** add ios impl ([dbc3322](https://github.com/candlefinance/oss/commit/dbc332223d2253260bf9f858fbec764fe0bdfcaa)) +* **prefs:** add readme and make example app consistent ([27c3e52](https://github.com/candlefinance/oss/commit/27c3e5279a69e8bfb6a056332448a1bd8966b721)) +* **prefs:** add try/catches and error handling ([04ecb0b](https://github.com/candlefinance/oss/commit/04ecb0ba37b48c65cb561fc9fe7f8c8e52ca45a2)) +* **prefs:** clean up method names and signatures ([8c368e1](https://github.com/candlefinance/oss/commit/8c368e1e4e82c81aec79ea5bb32d0760d87d3880)) +* **prefs:** expose non-effect interface ([d0788f3](https://github.com/candlefinance/oss/commit/d0788f3b331c181c4f4b68569ebfa2f40fda6340)) +* **prefs:** fix readme ([2fa3464](https://github.com/candlefinance/oss/commit/2fa34642604983e37d5e617b39a626d7dde7d44f)) +* **prefs:** fix readme ([2f0c773](https://github.com/candlefinance/oss/commit/2f0c7737b947aeb44f3642f8576d02ac068d377d)) +* **prefs:** fix readme example code ([a500370](https://github.com/candlefinance/oss/commit/a5003708a94fc9cb2aa7b493944897dfd0e30797)) +* **prefs:** fix throws ([e463c52](https://github.com/candlefinance/oss/commit/e463c5238b798a6b5fbdaa2f988544905c02bec0)) +* **prefs:** improve readme formatting ([c1e213a](https://github.com/candlefinance/oss/commit/c1e213a7e3583366b0901c7b1cfb584067d2b161)) +* **prefs:** use better file name ([1b4e21c](https://github.com/candlefinance/oss/commit/1b4e21ceb83fda9db72d6bc7351eb5417847653e)) +* readme ([f9ebb92](https://github.com/candlefinance/oss/commit/f9ebb92b0af98af48e93bc9d6905f6dbfc2dcb09)) +* revert ([c7486f1](https://github.com/candlefinance/oss/commit/c7486f183432f821e505e25ed7217c88c93e48d1)) +* revert android changes ([0ed31d2](https://github.com/candlefinance/oss/commit/0ed31d2ef4ac6bb2882258aab65a23cc1e30ef3b)) +* revert yarn ([2dcb5b4](https://github.com/candlefinance/oss/commit/2dcb5b47a7cc4d0883c74a674fdf5556e46125c1)) +* udpates ([0249043](https://github.com/candlefinance/oss/commit/02490430d88929b029484e9dd8f5b3bc3a2e7cb3)) +* update ([af6a8f2](https://github.com/candlefinance/oss/commit/af6a8f2e523833957714c2895ecc8b5fb6aa4e51)) +* update ([1f7340a](https://github.com/candlefinance/oss/commit/1f7340aa4cff569213d519ab1efefe5470279653)) +* update readme ([0b7adbc](https://github.com/candlefinance/oss/commit/0b7adbc5963d38d18b8346fe21a3bab14a600a34)) +* updates ([c96843b](https://github.com/candlefinance/oss/commit/c96843b2f0d44608c88ba2263ecf5a61fcced0ae)) +* updates ([bb1b28d](https://github.com/candlefinance/oss/commit/bb1b28d6bd7086e22b37165c1a617bfc3fe8c3e2)) +* updates ([1e5f468](https://github.com/candlefinance/oss/commit/1e5f4683b94729e6a383dbbaa79a48f65a526473)) +* updates ([d413696](https://github.com/candlefinance/oss/commit/d413696ad05f9ced9e039d6a031fe1843adfd488)) +* updates ([21a9781](https://github.com/candlefinance/oss/commit/21a9781c135b5c249d575a56f07ac3f194fb0339)) +* updates ([4f3956a](https://github.com/candlefinance/oss/commit/4f3956a379ca99bcee6dbfb07fcfa4640f049e33)) +* updates and refactor ([4bb81ff](https://github.com/candlefinance/oss/commit/4bb81fff7ead5884a7435a0ce16410e937dfd1a7)) +* updates to (wip) ([a4714d6](https://github.com/candlefinance/oss/commit/a4714d6f3e248bc6bf913fd58dd7ae2dbb2ae0f3)) +* wip ([8019844](https://github.com/candlefinance/oss/commit/8019844918d9cb6450860bed389feade36c63295)) +* wrap the headers and query ([4b7019e](https://github.com/candlefinance/oss/commit/4b7019e02be441df32458c6d286de3fba2fb522f)) + + +### Features + +* add android impl for new prefs library ([61832bb](https://github.com/candlefinance/oss/commit/61832bb76edff84c52966405a82906b50f3841ab)) +* make ios compile ([e561816](https://github.com/candlefinance/oss/commit/e56181654c842ea6bc1f4508a3f22583fb291cca)) +* make ios compile ([be7228f](https://github.com/candlefinance/oss/commit/be7228f9efe287aca95c0818a65d87d95de2ffd9)) + ## 0.3.14 (2024-06-05) ## 0.3.13 (2024-06-04) @@ -105,4 +164,4 @@ ### Features - **all:** implement android library and tweak ios and react ([c630427](https://github.com/candlefinance/oss/commit/c6304279e0e9576b4a98982e0a96dc0335d44cc7)) -- **ios:** implement ios library ([15ea2dc](https://github.com/candlefinance/oss/commit/15ea2dc77070ca8345fe905e63c6f85b2922b471)) +- **ios:** implement ios library ([15ea2dc](https://github.com/candlefinance/oss/commit/15ea2dc77070ca8345fe905e63c6f85b2922b471)) \ No newline at end of file diff --git a/packages/npm/send/package.json b/packages/npm/send/package.json index 5bb91e7..cf701cf 100644 --- a/packages/npm/send/package.json +++ b/packages/npm/send/package.json @@ -1,6 +1,6 @@ { "name": "@candlefinance/send", - "version": "0.3.15", + "version": "0.4.0", "description": "A fast, low-level networking library", "source": "./src/index.tsx", "main": "./lib/commonjs/index.js", From 70d2fad6ff44dee807e437643db36050231a2fbd Mon Sep 17 00:00:00 2001 From: Gary Tokman Date: Fri, 18 Oct 2024 13:55:33 -0400 Subject: [PATCH 2/2] fix: bump send --- packages/npm/send/example/ios/Podfile | 2 +- packages/npm/send/example/ios/Podfile.lock | 24 ++-- .../example/ios/SendExample/AppDelegate.mm | 4 + packages/npm/send/example/package.json | 2 +- packages/npm/send/nitro.json | 4 +- .../generated/android/c++/JHybridSendSpec.cpp | 21 ++-- .../generated/android/c++/JHybridSendSpec.hpp | 10 +- .../generated/android/c++/JSendError.hpp | 1 - .../generated/android/c++/JSendErrorCode.hpp | 3 +- .../generated/android/c++/JSendMethod.hpp | 3 +- .../generated/android/c++/JSendParameters.hpp | 19 ++-- .../generated/android/c++/JSendRequest.hpp | 27 +++-- .../generated/android/c++/JSendResponse.hpp | 1 - .../generated/android/c++/JSendResult.hpp | 1 - .../android/candlefinance_sendOnLoad.cpp | 32 ++++++ .../android/candlefinance_sendOnLoad.hpp | 25 +++++ .../android/candlefinance_sendOnLoad.kt | 1 + .../candlefinance_send/HybridSendSpec.kt | 12 +- .../nitro/candlefinance_send/SendError.kt | 1 - .../nitro/candlefinance_send/SendErrorCode.kt | 1 - .../nitro/candlefinance_send/SendMethod.kt | 1 - .../candlefinance_send/SendParameters.kt | 1 - .../nitro/candlefinance_send/SendRequest.kt | 1 - .../nitro/candlefinance_send/SendResponse.kt | 1 - .../nitro/candlefinance_send/SendResult.kt | 1 - .../generated/android/send+autolinking.cmake | 4 +- .../generated/android/send+autolinking.gradle | 1 - .../generated/ios/c++/HybridSendSpecSwift.cpp | 1 - .../generated/ios/c++/HybridSendSpecSwift.hpp | 7 +- .../ios/candlefinance_send+autolinking.rb | 11 +- .../candlefinance_send-Swift-Cxx-Bridge.cpp | 26 ++++- .../candlefinance_send-Swift-Cxx-Bridge.hpp | 35 +++++- .../candlefinance_send-Swift-Cxx-Umbrella.hpp | 8 +- .../generated/ios/swift/HybridSendSpec.swift | 15 +-- .../ios/swift/HybridSendSpecCxx.swift | 65 ++++++++--- .../generated/ios/swift/SendError.swift | 1 - .../generated/ios/swift/SendErrorCode.swift | 1 - .../generated/ios/swift/SendMethod.swift | 1 - .../generated/ios/swift/SendParameters.swift | 29 +++-- .../generated/ios/swift/SendRequest.swift | 31 +++--- .../generated/ios/swift/SendResponse.swift | 13 +-- .../generated/ios/swift/SendResult.swift | 25 ++--- .../generated/shared/c++/HybridSendSpec.cpp | 1 - .../generated/shared/c++/HybridSendSpec.hpp | 4 +- .../generated/shared/c++/SendError.hpp | 1 - .../generated/shared/c++/SendErrorCode.hpp | 1 - .../generated/shared/c++/SendMethod.hpp | 5 +- .../generated/shared/c++/SendParameters.hpp | 1 - .../generated/shared/c++/SendRequest.hpp | 1 - .../generated/shared/c++/SendResponse.hpp | 1 - .../generated/shared/c++/SendResult.hpp | 1 - packages/npm/send/package.json | 2 +- packages/npm/send/yarn.lock | 105 ++++++++++++------ 53 files changed, 379 insertions(+), 217 deletions(-) create mode 100644 packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.cpp create mode 100644 packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.hpp create mode 100644 packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.kt diff --git a/packages/npm/send/example/ios/Podfile b/packages/npm/send/example/ios/Podfile index 6d742bd..bd1c526 100644 --- a/packages/npm/send/example/ios/Podfile +++ b/packages/npm/send/example/ios/Podfile @@ -1,4 +1,4 @@ -ENV['RCT_NEW_ARCH_ENABLED'] = '1' +ENV['RCT_NEW_ARCH_ENABLED'] = '0' # Resolve react_native_pods.rb with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', diff --git a/packages/npm/send/example/ios/Podfile.lock b/packages/npm/send/example/ios/Podfile.lock index 26fb4da..c9cda46 100644 --- a/packages/npm/send/example/ios/Podfile.lock +++ b/packages/npm/send/example/ios/Podfile.lock @@ -1,6 +1,6 @@ PODS: - boost (1.84.0) - - candlefinance-send (0.3.14): + - candlefinance-send (0.4.0): - DoubleConversion - glog - hermes-engine @@ -29,7 +29,7 @@ PODS: - hermes-engine (0.75.2): - hermes-engine/Pre-built (= 0.75.2) - hermes-engine/Pre-built (0.75.2) - - NitroModules (0.6.0): + - NitroModules (0.12.0): - DoubleConversion - glog - hermes-engine @@ -1748,13 +1748,13 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost: 4cb898d0bf20404aab1850c656dcea009429d6c1 - candlefinance-send: ff2122d1795b0c437050490ae4f8f8af0aa09803 + candlefinance-send: 1fe917564c59d2b31d5994fe204d39951a76829e DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5 FBLazyVector: 38bb611218305c3bc61803e287b8a81c6f63b619 fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120 glog: 69ef571f3de08433d766d614c73a9838a06bf7eb hermes-engine: 3b6e0717ca847e2fc90a201e59db36caf04dee88 - NitroModules: b404fe4ebf47e0b057c526959b5e200256000f09 + NitroModules: e77029bf91543f05ace96cc5241c4ef16660b299 RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740 RCTDeprecation: 34cbf122b623037ea9facad2e92e53434c5c7422 RCTRequired: 24c446d7bcd0f517d516b6265d8df04dc3eb1219 @@ -1765,16 +1765,16 @@ SPEC CHECKSUMS: React-CoreModules: f92a2cb11d22f6066823ca547c61e900325dfe44 React-cxxreact: f5595a4cbfe5a4e9d401dffa2c1c78bbbbbe75e4 React-debug: 4a91c177b5b2efcc546fb50bc2f676f3f589efab - React-defaultsnativemodule: 6b666572abf5fe7fe87836a42776abd6ad5ed173 - React-domnativemodule: 785d767c4edbb9f011b8c976271077759ca5c4aa + React-defaultsnativemodule: bb94c3db425b01c760f41a253de8536b3f5497f0 + React-domnativemodule: 6c581fd39812cafb024171e091c00905b2c3a3e2 React-Fabric: a33cc1fdc62a3085774783bb30970531589d2028 React-FabricComponents: 98de5f94cbd35d407f4fc78855298b562d8289cb React-FabricImage: 0ce8fd83844d9edef5825116d38f0e208b9ad786 React-featureflags: 37a78859ad71db758e2efdcbdb7384afefa8701e - React-featureflagsnativemodule: f94aacb52c463e200ee185bff90ae3b392e60263 + React-featureflagsnativemodule: 52b46e161a151b4653cf1762285e8e899d534e3f React-graphics: c16f1bab97a5d473831a79360d84300e93a614e5 React-hermes: 7801f8c0e12f326524b461dc368d3e74f3d2a385 - React-idlecallbacksnativemodule: d81bb7b5d26cea9852a8edc6ad1979cd7ed0841f + React-idlecallbacksnativemodule: 58de2ac968ee80947d19dc8fe20def607e5c2de8 React-ImageManager: 98a1e5b0b05528dde47ebcd953d916ac66d46c09 React-jserrorhandler: 08f1c3465a71a6549c27ad82809ce145ad52d4f1 React-jsi: 161428ab2c706d5fcd9878d260ff1513fdb356ab @@ -1783,16 +1783,16 @@ SPEC CHECKSUMS: React-jsitracing: 52b849a77d02e2dc262a3031454c23be8dabb4d9 React-logger: 8db32983d75dc2ad54f278f344ccb9b256e694fc React-Mapbuffer: 1c08607305558666fd16678b85ef135e455d5c96 - React-microtasksnativemodule: f13f03163b6a5ec66665dfe80a0df4468bb766a6 + React-microtasksnativemodule: 87b8de96f937faefece8afd2cb3a518321b2ef99 React-nativeconfig: 57781b79e11d5af7573e6f77cbf1143b71802a6d React-NativeModulesApple: 7ff2e2cfb2e5fa5bdedcecf28ce37e696c6ef1e1 React-perflogger: 8a360ccf603de6ddbe9ff8f54383146d26e6c936 React-performancetimeline: 3cfec915adcb3653a5a633b41e711903844c35d8 React-RCTActionSheet: 1c0e26a88eec41215089cf4436e38188cfe9f01a React-RCTAnimation: d87207841b1e2ae1389e684262ea8c73c887cb04 - React-RCTAppDelegate: 328e56399c4f1c3d20cfe547ea24ebded2b3a87f + React-RCTAppDelegate: 4ec7824c0cc9cc4b146ca8ee0fd81b10c316a440 React-RCTBlob: 79b42cb7db55f34079297687a480dbcf37f023f6 - React-RCTFabric: 27636a6a5fa5622159297fce26881945d3658cf6 + React-RCTFabric: 1dd1661db93716f8cb116e451bd9c211a8d15716 React-RCTImage: 0c10a75de59f7384a2a55545d5f36fe783e6ecda React-RCTLinking: bf08f4f655bf777af292b8d97449072c8bb196ca React-RCTNetwork: 1b690846b40fc5685af58e088720657db6814637 @@ -1813,6 +1813,6 @@ SPEC CHECKSUMS: SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Yoga: 2a45d7e59592db061217551fd3bbe2dd993817ae -PODFILE CHECKSUM: 587829e2504f7c0b375fddc67c0ec17f3b28a967 +PODFILE CHECKSUM: ab1658764ce8ab6ffe56492dd721cffdbaf705bb COCOAPODS: 1.15.2 diff --git a/packages/npm/send/example/ios/SendExample/AppDelegate.mm b/packages/npm/send/example/ios/SendExample/AppDelegate.mm index 9830fe5..c68d7b8 100644 --- a/packages/npm/send/example/ios/SendExample/AppDelegate.mm +++ b/packages/npm/send/example/ios/SendExample/AppDelegate.mm @@ -28,4 +28,8 @@ - (NSURL *)bundleURL #endif } +- (BOOL)bridgelessEnabled { + return NO; +} + @end diff --git a/packages/npm/send/example/package.json b/packages/npm/send/example/package.json index a223fb8..5de8920 100644 --- a/packages/npm/send/example/package.json +++ b/packages/npm/send/example/package.json @@ -12,7 +12,7 @@ "dependencies": { "react": "18.3.1", "react-native": "0.75.2", - "react-native-nitro-modules": "^0.6.0" + "react-native-nitro-modules": "^0.12.0" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/packages/npm/send/nitro.json b/packages/npm/send/nitro.json index e1a4640..a1b19cd 100644 --- a/packages/npm/send/nitro.json +++ b/packages/npm/send/nitro.json @@ -6,5 +6,7 @@ "android": { "androidNamespace": ["candlefinance_send"], "androidCxxLibName": "send" - } + }, + "autolinking": {}, + "ignorePaths": ["node_modules"] } diff --git a/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.cpp b/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.cpp index 19826b7..46a90cc 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.cpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.cpp @@ -1,6 +1,5 @@ /// /// JHybridSendSpec.cpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -66,19 +65,19 @@ namespace margelo::nitro::send { // Methods std::future JHybridSendSpec::send(const SendRequest& request) { - static const auto method = _javaPart->getClass()->getMethod(jni::alias_ref /* request */)>("send"); - auto result = method(_javaPart, JSendRequest::fromCpp(request)); + static const auto method = _javaPart->getClass()->getMethod(jni::alias_ref /* request */)>("send"); + auto __result = method(_javaPart, JSendRequest::fromCpp(request)); return [&]() { - auto promise = std::make_shared>(); - result->cthis()->addOnResolvedListener([=](const jni::global_ref& boxedResult) { - auto result = jni::static_ref_cast(boxedResult); - promise->set_value(result->toCpp()); + auto __promise = std::make_shared>(); + __result->cthis()->addOnResolvedListener([=](const jni::alias_ref& __boxedResult) { + auto __result = jni::static_ref_cast(__boxedResult); + __promise->set_value(__result->toCpp()); }); - result->cthis()->addOnRejectedListener([=](const jni::global_ref& message) { - std::runtime_error error(message->toStdString()); - promise->set_exception(std::make_exception_ptr(error)); + __result->cthis()->addOnRejectedListener([=](const jni::alias_ref& __message) { + std::runtime_error __error(__message->toStdString()); + __promise->set_exception(std::make_exception_ptr(__error)); }); - return promise->get_future(); + return __promise->get_future(); }(); } diff --git a/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.hpp b/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.hpp index f936b8a..478b874 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JHybridSendSpec.hpp @@ -1,6 +1,5 @@ /// /// HybridSendSpec.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -12,18 +11,21 @@ #include #include "HybridSendSpec.hpp" + + + namespace margelo::nitro::send { using namespace facebook; - class JHybridSendSpec final: public jni::HybridClass, - public HybridSendSpec { + class JHybridSendSpec: public jni::HybridClass, + public virtual HybridSendSpec { public: static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/candlefinance_send/HybridSendSpec;"; static jni::local_ref initHybrid(jni::alias_ref jThis); static void registerNatives(); - private: + protected: // C++ constructor (called from Java via `initHybrid()`) explicit JHybridSendSpec(jni::alias_ref jThis) : HybridObject(HybridSendSpec::TAG), diff --git a/packages/npm/send/nitrogen/generated/android/c++/JSendError.hpp b/packages/npm/send/nitrogen/generated/android/c++/JSendError.hpp index 33ab559..68c77d0 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JSendError.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JSendError.hpp @@ -1,6 +1,5 @@ /// /// JSendError.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/c++/JSendErrorCode.hpp b/packages/npm/send/nitrogen/generated/android/c++/JSendErrorCode.hpp index 19e9041..17eb09d 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JSendErrorCode.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JSendErrorCode.hpp @@ -1,6 +1,5 @@ /// /// JSendErrorCode.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -78,7 +77,7 @@ namespace margelo::nitro::send { return clazz->getStaticFieldValue(fieldUNEXPECTED); default: std::string stringValue = std::to_string(static_cast(value)); - throw std::runtime_error("Invalid enum value (" + stringValue + "!"); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); } } }; diff --git a/packages/npm/send/nitrogen/generated/android/c++/JSendMethod.hpp b/packages/npm/send/nitrogen/generated/android/c++/JSendMethod.hpp index 532202b..6e20fd8 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JSendMethod.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JSendMethod.hpp @@ -1,6 +1,5 @@ /// /// JSendMethod.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -72,7 +71,7 @@ namespace margelo::nitro::send { return clazz->getStaticFieldValue(fieldTRACE); default: std::string stringValue = std::to_string(static_cast(value)); - throw std::runtime_error("Invalid enum value (" + stringValue + "!"); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); } } }; diff --git a/packages/npm/send/nitrogen/generated/android/c++/JSendParameters.hpp b/packages/npm/send/nitrogen/generated/android/c++/JSendParameters.hpp index 1d5d156..02256f1 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JSendParameters.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JSendParameters.hpp @@ -1,6 +1,5 @@ /// /// JSendParameters.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -36,12 +35,12 @@ namespace margelo::nitro::send { jni::local_ref> parameters = this->getFieldValue(fieldParameters); return SendParameters( [&]() { - std::unordered_map map; - map.reserve(parameters->size()); - for (const auto& entry : *parameters) { - map.emplace(entry.first->toStdString(), entry.second->toStdString()); + std::unordered_map __map; + __map.reserve(parameters->size()); + for (const auto& __entry : *parameters) { + __map.emplace(__entry.first->toStdString(), __entry.second->toStdString()); } - return map; + return __map; }() ); } @@ -54,11 +53,11 @@ namespace margelo::nitro::send { static jni::local_ref fromCpp(const SendParameters& value) { return newInstance( [&]() { - auto map = jni::JHashMap::create(value.parameters.size()); - for (const auto& entry : value.parameters) { - map->put(jni::make_jstring(entry.first), jni::make_jstring(entry.second)); + auto __map = jni::JHashMap::create(value.parameters.size()); + for (const auto& __entry : value.parameters) { + __map->put(jni::make_jstring(__entry.first), jni::make_jstring(__entry.second)); } - return map; + return __map; }() ); } diff --git a/packages/npm/send/nitrogen/generated/android/c++/JSendRequest.hpp b/packages/npm/send/nitrogen/generated/android/c++/JSendRequest.hpp index 799ba14..eae4b47 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JSendRequest.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JSendRequest.hpp @@ -1,6 +1,5 @@ /// /// JSendRequest.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -60,14 +59,14 @@ namespace margelo::nitro::send { method->toCpp(), body != nullptr ? std::make_optional(body->toStdString()) : std::nullopt, [&]() { - size_t size = utf8ContentTypes->size(); - std::vector vector; - vector.reserve(size); - for (size_t i = 0; i < size; i++) { - auto element = utf8ContentTypes->getElement(i); - vector.push_back(element->toStdString()); + size_t __size = utf8ContentTypes->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = utf8ContentTypes->getElement(__i); + __vector.push_back(__element->toStdString()); } - return vector; + return __vector; }() ); } @@ -86,13 +85,13 @@ namespace margelo::nitro::send { JSendMethod::fromCpp(value.method), value.body.has_value() ? jni::make_jstring(value.body.value()) : nullptr, [&]() { - size_t size = value.utf8ContentTypes.size(); - jni::local_ref> array = jni::JArrayClass::newArray(size); - for (size_t i = 0; i < size; i++) { - const auto& element = value.utf8ContentTypes[i]; - array->setElement(i, *jni::make_jstring(element)); + size_t __size = value.utf8ContentTypes.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = value.utf8ContentTypes[__i]; + __array->setElement(__i, *jni::make_jstring(__element)); } - return array; + return __array; }() ); } diff --git a/packages/npm/send/nitrogen/generated/android/c++/JSendResponse.hpp b/packages/npm/send/nitrogen/generated/android/c++/JSendResponse.hpp index 01ad7c7..233778d 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JSendResponse.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JSendResponse.hpp @@ -1,6 +1,5 @@ /// /// JSendResponse.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/c++/JSendResult.hpp b/packages/npm/send/nitrogen/generated/android/c++/JSendResult.hpp index ef92c98..467c86c 100644 --- a/packages/npm/send/nitrogen/generated/android/c++/JSendResult.hpp +++ b/packages/npm/send/nitrogen/generated/android/c++/JSendResult.hpp @@ -1,6 +1,5 @@ /// /// JSendResult.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.cpp b/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.cpp new file mode 100644 index 0000000..f6b0a32 --- /dev/null +++ b/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.cpp @@ -0,0 +1,32 @@ +/// +/// candlefinance_sendOnLoad.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2024 Marc Rousavy @ Margelo +/// + +#include "candlefinance_sendOnLoad.hpp" + +#include +#include +#include + +#include "JHybridSendSpec.hpp" + +namespace margelo::nitro::send { + +int initialize(JavaVM* vm) { + using namespace margelo::nitro; + using namespace margelo::nitro::send; + using namespace facebook; + + return facebook::jni::initialize(vm, [] { + // Register native JNI methods + margelo::nitro::send::JHybridSendSpec::registerNatives(); + + // Register Nitro Hybrid Objects + + }); +} + +} // namespace margelo::nitro::send diff --git a/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.hpp b/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.hpp new file mode 100644 index 0000000..69baf06 --- /dev/null +++ b/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.hpp @@ -0,0 +1,25 @@ +/// +/// candlefinance_sendOnLoad.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2024 Marc Rousavy @ Margelo +/// + +#include +#include + +namespace margelo::nitro::send { + + /** + * Initializes the native (C++) part of send, and autolinks all Hybrid Objects. + * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`). + * Example: + * ```cpp (cpp-adapter.cpp) + * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) { + * return margelo::nitro::send::initialize(vm); + * } + * ``` + */ + int initialize(JavaVM* vm); + +} // namespace margelo::nitro::send diff --git a/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.kt b/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.kt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/packages/npm/send/nitrogen/generated/android/candlefinance_sendOnLoad.kt @@ -0,0 +1 @@ + diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/HybridSendSpec.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/HybridSendSpec.kt index fe20245..3c98dab 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/HybridSendSpec.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/HybridSendSpec.kt @@ -1,6 +1,5 @@ /// /// HybridSendSpec.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -22,10 +21,8 @@ import com.margelo.nitro.core.* @Keep @Suppress("RedundantSuppression", "KotlinJniMissingFunction", "PropertyName", "RedundantUnitReturnType", "unused") abstract class HybridSendSpec: HybridObject() { - protected val TAG = "HybridSendSpec" - @DoNotStrip - val mHybridData: HybridData = initHybrid() + private var mHybridData: HybridData = initHybrid() init { // Pass this `HybridData` through to it's base class, @@ -33,6 +30,13 @@ abstract class HybridSendSpec: HybridObject() { super.updateNative(mHybridData) } + /** + * Call from a child class to initialize HybridData with a child. + */ + override fun updateNative(hybridData: HybridData) { + mHybridData = hybridData + } + // Properties diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendError.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendError.kt index f821ed3..791aa33 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendError.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendError.kt @@ -1,6 +1,5 @@ /// /// SendError.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendErrorCode.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendErrorCode.kt index 1672e55..ae5572b 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendErrorCode.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendErrorCode.kt @@ -1,6 +1,5 @@ /// /// SendErrorCode.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendMethod.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendMethod.kt index f4f939f..a307a87 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendMethod.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendMethod.kt @@ -1,6 +1,5 @@ /// /// SendMethod.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendParameters.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendParameters.kt index 59c531d..0632868 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendParameters.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendParameters.kt @@ -1,6 +1,5 @@ /// /// SendParameters.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendRequest.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendRequest.kt index 8eaefc7..51ad2d4 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendRequest.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendRequest.kt @@ -1,6 +1,5 @@ /// /// SendRequest.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResponse.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResponse.kt index 21b7b34..0e78b51 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResponse.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResponse.kt @@ -1,6 +1,5 @@ /// /// SendResponse.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResult.kt b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResult.kt index e4f0d3b..fe937a9 100644 --- a/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResult.kt +++ b/packages/npm/send/nitrogen/generated/android/kotlin/com/margelo/nitro/candlefinance_send/SendResult.kt @@ -1,6 +1,5 @@ /// /// SendResult.kt -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/android/send+autolinking.cmake b/packages/npm/send/nitrogen/generated/android/send+autolinking.cmake index e09c59d..4b218ff 100644 --- a/packages/npm/send/nitrogen/generated/android/send+autolinking.cmake +++ b/packages/npm/send/nitrogen/generated/android/send+autolinking.cmake @@ -1,6 +1,5 @@ # # send+autolinking.cmake -# Mon Sep 02 2024 # This file was generated by nitrogen. DO NOT MODIFY THIS FILE. # https://github.com/mrousavy/nitro # Copyright © 2024 Marc Rousavy @ Margelo @@ -18,12 +17,15 @@ include_directories( "../nitrogen/generated/shared/c++" "../nitrogen/generated/android/c++" + "../nitrogen/generated/android/" ) # Add all .cpp sources that were generated by Nitrogen target_sources( # CMake project name (Android C++ library name) send PRIVATE + # Autolinking Setup + ../nitrogen/generated/android/sendOnLoad.cpp # Shared Nitrogen C++ sources ../nitrogen/generated/shared/c++/HybridSendSpec.cpp # Android-specific Nitrogen C++ sources diff --git a/packages/npm/send/nitrogen/generated/android/send+autolinking.gradle b/packages/npm/send/nitrogen/generated/android/send+autolinking.gradle index 073ef61..ea11571 100644 --- a/packages/npm/send/nitrogen/generated/android/send+autolinking.gradle +++ b/packages/npm/send/nitrogen/generated/android/send+autolinking.gradle @@ -1,6 +1,5 @@ /// /// send+autolinking.gradle -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.cpp b/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.cpp index c9f73a0..7271462 100644 --- a/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.cpp +++ b/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.cpp @@ -1,6 +1,5 @@ /// /// HybridSendSpecSwift.cpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.hpp b/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.hpp index 3ab8f50..60b48eb 100644 --- a/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.hpp +++ b/packages/npm/send/nitrogen/generated/ios/c++/HybridSendSpecSwift.hpp @@ -1,6 +1,5 @@ /// /// HybridSendSpecSwift.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -62,7 +61,7 @@ namespace margelo::nitro::send { * the future, HybridSendSpecCxx can directly inherit from the C++ class HybridSendSpec * to simplify the whole structure and memory management. */ - class HybridSendSpecSwift final: public HybridSendSpec { + class HybridSendSpecSwift: public virtual HybridSendSpec { public: // Constructor from a Swift instance explicit HybridSendSpecSwift(const candlefinance_send::HybridSendSpecCxx& swiftPart): @@ -86,8 +85,8 @@ namespace margelo::nitro::send { public: // Methods inline std::future send(const SendRequest& request) override { - auto value = _swiftPart.send(request); - return value.getFuture(); + auto __result = _swiftPart.send(request); + return __result.getFuture(); } private: diff --git a/packages/npm/send/nitrogen/generated/ios/candlefinance_send+autolinking.rb b/packages/npm/send/nitrogen/generated/ios/candlefinance_send+autolinking.rb index b7fafcc..74de457 100644 --- a/packages/npm/send/nitrogen/generated/ios/candlefinance_send+autolinking.rb +++ b/packages/npm/send/nitrogen/generated/ios/candlefinance_send+autolinking.rb @@ -1,6 +1,5 @@ # # candlefinance_send+autolinking.rb -# Mon Sep 02 2024 # This file was generated by nitrogen. DO NOT MODIFY THIS FILE. # https://github.com/mrousavy/nitro # Copyright © 2024 Marc Rousavy @ Margelo @@ -25,15 +24,15 @@ def add_nitrogen_files(spec) spec.dependency "NitroModules" - current_source_files = spec.attributes_hash['source_files'] || [] + current_source_files = Array(spec.attributes_hash['source_files']) spec.source_files = current_source_files + [ # Generated cross-platform specs "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}", # Generated bridges for the cross-platform specs - "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,swift}", + "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}", ] - current_public_header_files = spec.attributes_hash['public_header_files'] || [] + current_public_header_files = Array(spec.attributes_hash['public_header_files']) spec.public_header_files = current_public_header_files + [ # Generated specs "nitrogen/generated/shared/**/*.{h,hpp}", @@ -41,7 +40,7 @@ def add_nitrogen_files(spec) "nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.hpp" ] - current_private_header_files = spec.attributes_hash['private_header_files'] || [] + current_private_header_files = Array(spec.attributes_hash['private_header_files']) spec.private_header_files = current_private_header_files + [ # iOS specific specs "nitrogen/generated/ios/c++/**/*.{h,hpp}", @@ -53,5 +52,7 @@ def add_nitrogen_files(spec) "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", # Enables C++ <-> Swift interop (by default it's only C) "SWIFT_OBJC_INTEROP_MODE" => "objcxx", + # Enables stricter modular headers + "DEFINES_MODULE" => "YES", }) end diff --git a/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.cpp b/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.cpp index 9de5e65..8ead870 100644 --- a/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.cpp +++ b/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.cpp @@ -1,9 +1,33 @@ /// /// candlefinance_send-Swift-Cxx-Bridge.cpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo /// #include "candlefinance_send-Swift-Cxx-Bridge.hpp" + +// Include C++ implementation defined types +#include "HybridSendSpecSwift.hpp" +#include "candlefinance_send-Swift-Cxx-Umbrella.hpp" +#include + +namespace margelo::nitro::send::bridge::swift { + + // pragma MARK: std::shared_ptr + std::shared_ptr create_std__shared_ptr_margelo__nitro__send__HybridSendSpec_(size_t swiftReferenceId) { + candlefinance_send::HybridSendSpecCxx swiftPart = candlefinance_send::HybridSendSpecCxxReferenceHolder::getById(swiftReferenceId); + return HybridContext::getOrCreate(swiftPart); + } + size_t get_std__shared_ptr_margelo__nitro__send__HybridSendSpec_(std__shared_ptr_margelo__nitro__send__HybridSendSpec_ cppType) { + std::shared_ptr swiftWrapper = std::dynamic_pointer_cast(cppType); + #ifdef NITRO_DEBUG + if (swiftWrapper == nullptr) [[unlikely]] { + throw std::runtime_error("Class \"HybridSendSpec\" is not implemented in Swift!"); + } + #endif + candlefinance_send::HybridSendSpecCxx swiftPart = swiftWrapper->getSwiftPart(); + return candlefinance_send::HybridSendSpecCxxReferenceHolder::put(swiftPart); + } + +} // namespace margelo::nitro::send::bridge::swift diff --git a/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.hpp b/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.hpp index d757c33..b3cfa35 100644 --- a/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.hpp +++ b/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Bridge.hpp @@ -1,6 +1,5 @@ /// /// candlefinance_send-Swift-Cxx-Bridge.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -8,20 +7,40 @@ #pragma once +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + // Forward declarations of C++ defined types +// Forward declaration of `HybridSendSpec` to properly resolve imports. +namespace margelo::nitro::send { class HybridSendSpec; } +// Forward declaration of `SendErrorCode` to properly resolve imports. +namespace margelo::nitro::send { enum class SendErrorCode; } // Forward declaration of `SendError` to properly resolve imports. namespace margelo::nitro::send { struct SendError; } +// Forward declaration of `SendParameters` to properly resolve imports. +namespace margelo::nitro::send { struct SendParameters; } // Forward declaration of `SendResponse` to properly resolve imports. namespace margelo::nitro::send { struct SendResponse; } // Forward declaration of `SendResult` to properly resolve imports. namespace margelo::nitro::send { struct SendResult; } +// Forward declarations of Swift defined types +// Forward declaration of `HybridSendSpecCxx` to properly resolve imports. +namespace candlefinance_send { class HybridSendSpecCxx; } + // Include C++ defined types +#include "HybridSendSpec.hpp" #include "SendError.hpp" +#include "SendErrorCode.hpp" +#include "SendParameters.hpp" #include "SendResponse.hpp" #include "SendResult.hpp" #include #include +#include #include #include #include @@ -33,6 +52,7 @@ namespace margelo::nitro::send { struct SendResult; } */ namespace margelo::nitro::send::bridge::swift { + // pragma MARK: std::unordered_map /** * Specialized version of `std::unordered_map`. */ @@ -51,6 +71,7 @@ namespace margelo::nitro::send::bridge::swift { return keys; } + // pragma MARK: std::optional /** * Specialized version of `std::optional`. */ @@ -59,6 +80,7 @@ namespace margelo::nitro::send::bridge::swift { return std::optional(value); } + // pragma MARK: std::optional /** * Specialized version of `std::optional`. */ @@ -67,6 +89,7 @@ namespace margelo::nitro::send::bridge::swift { return std::optional(value); } + // pragma MARK: std::optional /** * Specialized version of `std::optional`. */ @@ -75,6 +98,7 @@ namespace margelo::nitro::send::bridge::swift { return std::optional(value); } + // pragma MARK: PromiseHolder /** * Specialized version of `PromiseHolder`. */ @@ -83,6 +107,7 @@ namespace margelo::nitro::send::bridge::swift { return PromiseHolder(); } + // pragma MARK: std::vector /** * Specialized version of `std::vector`. */ @@ -92,5 +117,13 @@ namespace margelo::nitro::send::bridge::swift { vector.reserve(size); return vector; } + + // pragma MARK: std::shared_ptr + /** + * Specialized version of `std::shared_ptr`. + */ + using std__shared_ptr_margelo__nitro__send__HybridSendSpec_ = std::shared_ptr; + std::shared_ptr create_std__shared_ptr_margelo__nitro__send__HybridSendSpec_(size_t swiftReferenceId); + size_t get_std__shared_ptr_margelo__nitro__send__HybridSendSpec_(std__shared_ptr_margelo__nitro__send__HybridSendSpec_ cppType); } // namespace margelo::nitro::send::bridge::swift diff --git a/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Umbrella.hpp b/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Umbrella.hpp index cb25153..a3bc158 100644 --- a/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Umbrella.hpp +++ b/packages/npm/send/nitrogen/generated/ios/candlefinance_send-Swift-Cxx-Umbrella.hpp @@ -1,6 +1,5 @@ /// /// candlefinance_send-Swift-Cxx-Umbrella.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -9,6 +8,8 @@ #pragma once // Forward declarations of C++ defined types +// Forward declaration of `HybridSendSpec` to properly resolve imports. +namespace margelo::nitro::send { class HybridSendSpec; } // Forward declaration of `SendErrorCode` to properly resolve imports. namespace margelo::nitro::send { enum class SendErrorCode; } // Forward declaration of `SendError` to properly resolve imports. @@ -25,6 +26,7 @@ namespace margelo::nitro::send { struct SendResponse; } namespace margelo::nitro::send { struct SendResult; } // Include C++ defined types +#include "HybridSendSpec.hpp" #include "SendError.hpp" #include "SendErrorCode.hpp" #include "SendMethod.hpp" @@ -33,6 +35,7 @@ namespace margelo::nitro::send { struct SendResult; } #include "SendResponse.hpp" #include "SendResult.hpp" #include +#include #include #include #include @@ -48,7 +51,8 @@ namespace margelo::nitro::send { struct SendResult; } #include // Forward declarations of Swift defined types - +// Forward declaration of `HybridSendSpecCxx` to properly resolve imports. +namespace candlefinance_send { class HybridSendSpecCxx; } // Include Swift defined types #if __has_include("candlefinance_send-Swift.h") diff --git a/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpec.swift b/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpec.swift index 422614f..ad6038b 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpec.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpec.swift @@ -1,6 +1,5 @@ /// /// HybridSendSpec.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -28,22 +27,10 @@ import NitroModules * } * ``` */ -public protocol HybridSendSpec: HybridObjectSpec { +public protocol HybridSendSpec: AnyObject, HybridObjectSpec { // Properties // Methods func send(request: SendRequest) throws -> Promise } - -public extension HybridSendSpec { - /** - * Create a new instance of HybridSendSpecCxx for the given HybridSendSpec. - * - * Instances of HybridSendSpecCxx can be accessed from C++, and contain - * additional required bridging code for C++ <> Swift interop. - */ - func createCxxBridge() -> HybridSendSpecCxx { - return HybridSendSpecCxx(self) - } -} diff --git a/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpecCxx.swift b/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpecCxx.swift index ac55bf2..d332ba6 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpecCxx.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/HybridSendSpecCxx.swift @@ -1,6 +1,5 @@ /// /// HybridSendSpecCxx.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -9,6 +8,28 @@ import Foundation import NitroModules +/** + * Holds instances of HybridSendSpecCxx and stores them under Integer IDs. + * Those Integer IDs can be used in C++ to box the Swift type to prevent cyclic includes. + */ +public final class HybridSendSpecCxxReferenceHolder { + private static var instances: [Int : HybridSendSpecCxx] = [:] + private static var counter: Int = 0 + + public static func put(_ instance: HybridSendSpecCxx) -> Int { + let id = counter + counter += 1 + instances[id] = instance + return id + } + + public static func getById(_ instanceId: Int) -> HybridSendSpecCxx { + let instance = instances[instanceId]! + instances.removeValue(forKey: instanceId) + return instance + } +} + /** * A class implementation that bridges HybridSendSpec over to C++. * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined. @@ -18,7 +39,7 @@ import NitroModules * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper * - Throwing methods need to be wrapped with a Result type, as exceptions cannot be propagated to C++ */ -public final class HybridSendSpecCxx { +public class HybridSendSpecCxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::send::bridge::swift`) * from `candlefinance_send-Swift-Cxx-Bridge.hpp`. @@ -29,25 +50,36 @@ public final class HybridSendSpecCxx { /** * Holds an instance of the `HybridSendSpec` Swift protocol. */ - private(set) var implementation: HybridSendSpec + private var __implementation: any HybridSendSpec /** * Create a new `HybridSendSpecCxx` that wraps the given `HybridSendSpec`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: HybridSendSpec) { - self.implementation = implementation + public init(_ implementation: some HybridSendSpec) { + self.__implementation = implementation + /* no base class */ + } + + /** + * Get the actual `HybridSendSpec` instance this class wraps. + */ + @inline(__always) + public func getHybridSendSpec() -> any HybridSendSpec { + return __implementation } /** * Contains a (weak) reference to the C++ HybridObject to cache it. */ public var hybridContext: margelo.nitro.HybridContext { + @inline(__always) get { - return self.implementation.hybridContext + return self.__implementation.hybridContext } + @inline(__always) set { - self.implementation.hybridContext = newValue + self.__implementation.hybridContext = newValue } } @@ -55,8 +87,9 @@ public final class HybridSendSpecCxx { * Get the memory size of the Swift class (plus size of any other allocations) * so the JS VM can properly track it and garbage-collect the JS object if needed. */ + @inline(__always) public var memorySize: Int { - return self.implementation.memorySize + return self.__implementation.memorySize } // Properties @@ -66,17 +99,17 @@ public final class HybridSendSpecCxx { @inline(__always) public func send(request: SendRequest) -> bridge.PromiseHolder_SendResult_ { do { - let result = try self.implementation.send(request: request) + let __result = try self.__implementation.send(request: request) return { () -> bridge.PromiseHolder_SendResult_ in - let promiseHolder = bridge.create_PromiseHolder_SendResult_() - result - .then({ promiseHolder.resolve($0) }) - .catch({ promiseHolder.reject(std.string(String(describing: $0))) }) - return promiseHolder + let __promiseHolder = bridge.create_PromiseHolder_SendResult_() + __result + .then({ __result in __promiseHolder.resolve(__result) }) + .catch({ __error in __promiseHolder.reject(std.string(String(describing: __error))) }) + return __promiseHolder }() } catch { - let message = "\(error.localizedDescription)" - fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(message))") + let __message = "\(error.localizedDescription)" + fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))") } } } diff --git a/packages/npm/send/nitrogen/generated/ios/swift/SendError.swift b/packages/npm/send/nitrogen/generated/ios/swift/SendError.swift index 45c9ff6..3758c69 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/SendError.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/SendError.swift @@ -1,6 +1,5 @@ /// /// SendError.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/ios/swift/SendErrorCode.swift b/packages/npm/send/nitrogen/generated/ios/swift/SendErrorCode.swift index ad85c5b..e47a06f 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/SendErrorCode.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/SendErrorCode.swift @@ -1,6 +1,5 @@ /// /// SendErrorCode.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/ios/swift/SendMethod.swift b/packages/npm/send/nitrogen/generated/ios/swift/SendMethod.swift index dde5fbd..40ea16d 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/SendMethod.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/SendMethod.swift @@ -1,6 +1,5 @@ /// /// SendMethod.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/ios/swift/SendParameters.swift b/packages/npm/send/nitrogen/generated/ios/swift/SendParameters.swift index ee21080..d083606 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/SendParameters.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/SendParameters.swift @@ -1,6 +1,5 @@ /// /// SendParameters.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -21,11 +20,11 @@ public extension SendParameters { */ init(parameters: Dictionary) { self.init({ () -> bridge.std__unordered_map_std__string__std__string_ in - var map = bridge.create_std__unordered_map_std__string__std__string_(parameters.count) - for (k, v) in parameters { - map[std.string(k)] = std.string(v) + var __map = bridge.create_std__unordered_map_std__string__std__string_(parameters.count) + for (__k, __v) in parameters { + __map[std.string(__k)] = std.string(__v) } - return map + return __map }()) } @@ -33,23 +32,23 @@ public extension SendParameters { @inline(__always) get { return { () -> Dictionary in - var dictionary = Dictionary(minimumCapacity: self.__parameters.size()) - let keys = bridge.get_std__unordered_map_std__string__std__string__keys(self.__parameters) - for key in keys { - let value = self.__parameters[key]! - dictionary[String(key)] = String(value) + var __dictionary = Dictionary(minimumCapacity: self.__parameters.size()) + let __keys = bridge.get_std__unordered_map_std__string__std__string__keys(self.__parameters) + for __key in __keys { + let __value = self.__parameters[__key]! + __dictionary[String(__key)] = String(__value) } - return dictionary + return __dictionary }() } @inline(__always) set { self.__parameters = { () -> bridge.std__unordered_map_std__string__std__string_ in - var map = bridge.create_std__unordered_map_std__string__std__string_(newValue.count) - for (k, v) in newValue { - map[std.string(k)] = std.string(v) + var __map = bridge.create_std__unordered_map_std__string__std__string_(newValue.count) + for (__k, __v) in newValue { + __map[std.string(__k)] = std.string(__v) } - return map + return __map }() } } diff --git a/packages/npm/send/nitrogen/generated/ios/swift/SendRequest.swift b/packages/npm/send/nitrogen/generated/ios/swift/SendRequest.swift index 41ae2d8..ce6cf50 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/SendRequest.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/SendRequest.swift @@ -1,6 +1,5 @@ /// /// SendRequest.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -21,17 +20,17 @@ public extension SendRequest { */ init(baseURL: String, path: String, query: SendParameters, header: SendParameters, method: SendMethod, body: String?, utf8ContentTypes: [String]) { self.init(std.string(baseURL), std.string(path), query, header, method, { () -> bridge.std__optional_std__string_ in - if let actualValue = body { - return bridge.create_std__optional_std__string_(std.string(actualValue)) + if let __unwrappedValue = body { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) } else { return .init() } }(), { () -> bridge.std__vector_std__string_ in - var vector = bridge.create_std__vector_std__string_(utf8ContentTypes.count) - for item in utf8ContentTypes { - vector.push_back(std.string(item)) + var __vector = bridge.create_std__vector_std__string_(utf8ContentTypes.count) + for __item in utf8ContentTypes { + __vector.push_back(std.string(__item)) } - return vector + return __vector }()) } @@ -94,8 +93,8 @@ public extension SendRequest { @inline(__always) get { return { () -> String? in - if let actualValue = self.__body.value { - return String(actualValue) + if let __unwrapped = self.__body.value { + return String(__unwrapped) } else { return nil } @@ -104,8 +103,8 @@ public extension SendRequest { @inline(__always) set { self.__body = { () -> bridge.std__optional_std__string_ in - if let actualValue = newValue { - return bridge.create_std__optional_std__string_(std.string(actualValue)) + if let __unwrappedValue = newValue { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) } else { return .init() } @@ -116,16 +115,16 @@ public extension SendRequest { var utf8ContentTypes: [String] { @inline(__always) get { - return self.__utf8ContentTypes.map({ val in String(val) }) + return self.__utf8ContentTypes.map({ __item in String(__item) }) } @inline(__always) set { self.__utf8ContentTypes = { () -> bridge.std__vector_std__string_ in - var vector = bridge.create_std__vector_std__string_(newValue.count) - for item in newValue { - vector.push_back(std.string(item)) + var __vector = bridge.create_std__vector_std__string_(newValue.count) + for __item in newValue { + __vector.push_back(std.string(__item)) } - return vector + return __vector }() } } diff --git a/packages/npm/send/nitrogen/generated/ios/swift/SendResponse.swift b/packages/npm/send/nitrogen/generated/ios/swift/SendResponse.swift index a94a13c..53f4ed0 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/SendResponse.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/SendResponse.swift @@ -1,6 +1,5 @@ /// /// SendResponse.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -21,8 +20,8 @@ public extension SendResponse { */ init(statusCode: Double, header: SendParameters, body: String?) { self.init(statusCode, header, { () -> bridge.std__optional_std__string_ in - if let actualValue = body { - return bridge.create_std__optional_std__string_(std.string(actualValue)) + if let __unwrappedValue = body { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) } else { return .init() } @@ -55,8 +54,8 @@ public extension SendResponse { @inline(__always) get { return { () -> String? in - if let actualValue = self.__body.value { - return String(actualValue) + if let __unwrapped = self.__body.value { + return String(__unwrapped) } else { return nil } @@ -65,8 +64,8 @@ public extension SendResponse { @inline(__always) set { self.__body = { () -> bridge.std__optional_std__string_ in - if let actualValue = newValue { - return bridge.create_std__optional_std__string_(std.string(actualValue)) + if let __unwrappedValue = newValue { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) } else { return .init() } diff --git a/packages/npm/send/nitrogen/generated/ios/swift/SendResult.swift b/packages/npm/send/nitrogen/generated/ios/swift/SendResult.swift index a82a171..08a72fa 100644 --- a/packages/npm/send/nitrogen/generated/ios/swift/SendResult.swift +++ b/packages/npm/send/nitrogen/generated/ios/swift/SendResult.swift @@ -1,6 +1,5 @@ /// /// SendResult.swift -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -21,14 +20,14 @@ public extension SendResult { */ init(response: SendResponse?, error: SendError?) { self.init({ () -> bridge.std__optional_SendResponse_ in - if let actualValue = response { - return bridge.create_std__optional_SendResponse_(actualValue) + if let __unwrappedValue = response { + return bridge.create_std__optional_SendResponse_(__unwrappedValue) } else { return .init() } }(), { () -> bridge.std__optional_SendError_ in - if let actualValue = error { - return bridge.create_std__optional_SendError_(actualValue) + if let __unwrappedValue = error { + return bridge.create_std__optional_SendError_(__unwrappedValue) } else { return .init() } @@ -39,8 +38,8 @@ public extension SendResult { @inline(__always) get { return { () -> SendResponse? in - if let actualValue = self.__response.value { - return actualValue + if let __unwrapped = self.__response.value { + return __unwrapped } else { return nil } @@ -49,8 +48,8 @@ public extension SendResult { @inline(__always) set { self.__response = { () -> bridge.std__optional_SendResponse_ in - if let actualValue = newValue { - return bridge.create_std__optional_SendResponse_(actualValue) + if let __unwrappedValue = newValue { + return bridge.create_std__optional_SendResponse_(__unwrappedValue) } else { return .init() } @@ -62,8 +61,8 @@ public extension SendResult { @inline(__always) get { return { () -> SendError? in - if let actualValue = self.__error.value { - return actualValue + if let __unwrapped = self.__error.value { + return __unwrapped } else { return nil } @@ -72,8 +71,8 @@ public extension SendResult { @inline(__always) set { self.__error = { () -> bridge.std__optional_SendError_ in - if let actualValue = newValue { - return bridge.create_std__optional_SendError_(actualValue) + if let __unwrappedValue = newValue { + return bridge.create_std__optional_SendError_(__unwrappedValue) } else { return .init() } diff --git a/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.cpp b/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.cpp index 76cc0ab..d8c9284 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.cpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.cpp @@ -1,6 +1,5 @@ /// /// HybridSendSpec.cpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.hpp b/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.hpp index bbe54a0..72da395 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/HybridSendSpec.hpp @@ -1,6 +1,5 @@ /// /// HybridSendSpec.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -30,9 +29,12 @@ namespace margelo::nitro::send { /** * An abstract base class for `Send` * Inherit this class to create instances of `HybridSendSpec` in C++. + * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. * @example * ```cpp * class HybridSend: public HybridSendSpec { + * public: + * HybridSend(...): HybridObject(TAG) { ... } * // ... * }; * ``` diff --git a/packages/npm/send/nitrogen/generated/shared/c++/SendError.hpp b/packages/npm/send/nitrogen/generated/shared/c++/SendError.hpp index 96a37a8..a9c6f32 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/SendError.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/SendError.hpp @@ -1,6 +1,5 @@ /// /// SendError.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/shared/c++/SendErrorCode.hpp b/packages/npm/send/nitrogen/generated/shared/c++/SendErrorCode.hpp index e4e9aaf..902f267 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/SendErrorCode.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/SendErrorCode.hpp @@ -1,6 +1,5 @@ /// /// SendErrorCode.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/shared/c++/SendMethod.hpp b/packages/npm/send/nitrogen/generated/shared/c++/SendMethod.hpp index 4ef218a..ed8e136 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/SendMethod.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/SendMethod.hpp @@ -1,6 +1,5 @@ /// /// SendMethod.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -63,7 +62,7 @@ namespace margelo::nitro { case hashString("CONNECT"): return SendMethod::CONNECT; case hashString("TRACE"): return SendMethod::TRACE; default: [[unlikely]] - throw std::runtime_error("Cannot convert \"" + unionValue + "\" to enum SendMethod - invalid value!"); + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum SendMethod - invalid value!"); } } static inline jsi::Value toJSI(jsi::Runtime& runtime, SendMethod arg) { @@ -78,7 +77,7 @@ namespace margelo::nitro { case SendMethod::CONNECT: return JSIConverter::toJSI(runtime, "CONNECT"); case SendMethod::TRACE: return JSIConverter::toJSI(runtime, "TRACE"); default: [[unlikely]] - throw std::runtime_error("Cannot convert SendMethod to JS - invalid value: " + throw std::invalid_argument("Cannot convert SendMethod to JS - invalid value: " + std::to_string(static_cast(arg)) + "!"); } } diff --git a/packages/npm/send/nitrogen/generated/shared/c++/SendParameters.hpp b/packages/npm/send/nitrogen/generated/shared/c++/SendParameters.hpp index c1e25db..4868120 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/SendParameters.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/SendParameters.hpp @@ -1,6 +1,5 @@ /// /// SendParameters.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/shared/c++/SendRequest.hpp b/packages/npm/send/nitrogen/generated/shared/c++/SendRequest.hpp index a1c22e7..5f267e6 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/SendRequest.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/SendRequest.hpp @@ -1,6 +1,5 @@ /// /// SendRequest.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/shared/c++/SendResponse.hpp b/packages/npm/send/nitrogen/generated/shared/c++/SendResponse.hpp index 9bf69c2..d410aa2 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/SendResponse.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/SendResponse.hpp @@ -1,6 +1,5 @@ /// /// SendResponse.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/nitrogen/generated/shared/c++/SendResult.hpp b/packages/npm/send/nitrogen/generated/shared/c++/SendResult.hpp index c9a5f1a..81ba345 100644 --- a/packages/npm/send/nitrogen/generated/shared/c++/SendResult.hpp +++ b/packages/npm/send/nitrogen/generated/shared/c++/SendResult.hpp @@ -1,6 +1,5 @@ /// /// SendResult.hpp -/// Mon Sep 02 2024 /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo diff --git a/packages/npm/send/package.json b/packages/npm/send/package.json index cf701cf..3d5195c 100644 --- a/packages/npm/send/package.json +++ b/packages/npm/send/package.json @@ -75,7 +75,7 @@ "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.1", "jest": "^29.7.0", - "nitro-codegen": "^0.6.0", + "nitro-codegen": "^0.12.0", "prettier": "^3.0.3", "react": "18.3.1", "react-native": "0.75.2", diff --git a/packages/npm/send/yarn.lock b/packages/npm/send/yarn.lock index 86faa20..707cf69 100644 --- a/packages/npm/send/yarn.lock +++ b/packages/npm/send/yarn.lock @@ -1642,7 +1642,7 @@ __metadata: react: "npm:18.3.1" react-native: "npm:0.75.2" react-native-builder-bob: "npm:^0.30.0" - react-native-nitro-modules: "npm:^0.6.0" + react-native-nitro-modules: "npm:^0.12.0" languageName: unknown linkType: soft @@ -1662,7 +1662,7 @@ __metadata: eslint-config-prettier: "npm:^9.0.0" eslint-plugin-prettier: "npm:^5.0.1" jest: "npm:^29.7.0" - nitro-codegen: "npm:^0.6.0" + nitro-codegen: "npm:^0.12.0" prettier: "npm:^3.0.3" react: "npm:18.3.1" react-native: "npm:0.75.2" @@ -3115,15 +3115,14 @@ __metadata: languageName: node linkType: hard -"@ts-morph/common@npm:~0.24.0": - version: 0.24.0 - resolution: "@ts-morph/common@npm:0.24.0" +"@ts-morph/common@npm:~0.25.0": + version: 0.25.0 + resolution: "@ts-morph/common@npm:0.25.0" dependencies: - fast-glob: "npm:^3.3.2" minimatch: "npm:^9.0.4" - mkdirp: "npm:^3.0.1" path-browserify: "npm:^1.0.1" - checksum: 10/5b732789868e92689c86a902c8f4528d998ac2e183a02cfeff6cf7731075d254cf3dd1e7bb73f2943ec1fcde6f2fb1caa19ee47a17a4289be08c224d68a902d4 + tinyglobby: "npm:^0.2.9" + checksum: 10/9b192dfebb7179e96267ea1720f6afe77964f9f89ecaca41d372da206cdfd838a77c1080026c73115a5d3a88752b1504ec7380907e26b6424e8fb7f7625c7461 languageName: node linkType: hard @@ -4592,10 +4591,10 @@ __metadata: languageName: node linkType: hard -"code-block-writer@npm:^13.0.1": - version: 13.0.2 - resolution: "code-block-writer@npm:13.0.2" - checksum: 10/070ea25d30393efd2e41a137e19a88114e728570a783d798c0b75a693bbeba97b2896a19a301167d45ed2062b46212b321aa9e4db7ef475e66498380aba2fae5 +"code-block-writer@npm:^13.0.3": + version: 13.0.3 + resolution: "code-block-writer@npm:13.0.3" + checksum: 10/771546224f38610eecee0598e83c9e0f86dcd600ea316dbf27c2cfebaab4fed51b042325aa460b8e0f131fac5c1de208f6610a1ddbffe4b22e76f9b5256707cb languageName: node linkType: hard @@ -6360,6 +6359,18 @@ __metadata: languageName: node linkType: hard +"fdir@npm:^6.4.0": + version: 6.4.2 + resolution: "fdir@npm:6.4.2" + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + checksum: 10/5ff80d1d2034e75cc68be175401c9f64c4938a6b2c1e9a0c27f2d211ffbe491fd86d29e4576825d9da8aff9bd465f0283427c2dddc11653457906c46d3bbc448 + languageName: node + linkType: hard + "fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": version: 3.2.0 resolution: "fetch-blob@npm:3.2.0" @@ -9734,15 +9745,6 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:^3.0.1": - version: 3.0.1 - resolution: "mkdirp@npm:3.0.1" - bin: - mkdirp: dist/cjs/src/bin.js - checksum: 10/16fd79c28645759505914561e249b9a1f5fe3362279ad95487a4501e4467abeb714fd35b95307326b8fd03f3c7719065ef11a6f97b7285d7888306d1bd2232ba - languageName: node - linkType: hard - "modify-values@npm:^1.0.0": version: 1.0.1 resolution: "modify-values@npm:1.0.1" @@ -9822,18 +9824,18 @@ __metadata: languageName: node linkType: hard -"nitro-codegen@npm:^0.6.0": - version: 0.6.0 - resolution: "nitro-codegen@npm:0.6.0" +"nitro-codegen@npm:^0.12.0": + version: 0.12.0 + resolution: "nitro-codegen@npm:0.12.0" dependencies: chalk: "npm:^5.3.0" - react-native-nitro-modules: "npm:^0.6.0" - ts-morph: "npm:^23.0.0" + react-native-nitro-modules: "npm:^0.11.0" + ts-morph: "npm:^24.0.0" yargs: "npm:^17.7.2" zod: "npm:^3.23.8" bin: nitro-codegen: lib/index.js - checksum: 10/0992f1b494cc961e72342e6e3e4205b81126368eb17bc54b067439b5895dfb0785d8ac333c29a537bb7e83a504ee5ea0edc51043556e7ea4209b91e3412b584c + checksum: 10/6a15d1bda77c2f45f5140d976cd43f5d252fd6c77eb8a8cc365d8ad2f954db757a87f30fe76b513ddab66f14f93c023f69fe617609535abe5cbb39502e5b28ca languageName: node linkType: hard @@ -10544,6 +10546,13 @@ __metadata: languageName: node linkType: hard +"picomatch@npm:^4.0.2": + version: 4.0.2 + resolution: "picomatch@npm:4.0.2" + checksum: 10/ce617b8da36797d09c0baacb96ca8a44460452c89362d7cb8f70ca46b4158ba8bc3606912de7c818eb4a939f7f9015cef3c766ec8a0c6bfc725fdc078e39c717 + languageName: node + linkType: hard + "pify@npm:^2.3.0": version: 2.3.0 resolution: "pify@npm:2.3.0" @@ -10927,6 +10936,26 @@ __metadata: languageName: node linkType: hard +"react-native-nitro-modules@npm:^0.11.0": + version: 0.11.0 + resolution: "react-native-nitro-modules@npm:0.11.0" + peerDependencies: + react: "*" + react-native: "*" + checksum: 10/87b477a4f715c5209c87bdea5e1f48eacfe384e3c7e204361c4ef402d182256c683a809d37119ead157b40fd79794a274c82725e89b99ecc55f33b8356e9eab7 + languageName: node + linkType: hard + +"react-native-nitro-modules@npm:^0.12.0": + version: 0.12.0 + resolution: "react-native-nitro-modules@npm:0.12.0" + peerDependencies: + react: "*" + react-native: "*" + checksum: 10/a05f3f0aea38a37aea722fa704b81cd1a102cf24cc1a0bf5d16be73a1f18efa56ab58ba155ba32acff79d0ed46274b0b46ad545db3b1f325c0f25bba6d5e9b60 + languageName: node + linkType: hard + "react-native-nitro-modules@npm:^0.6.0": version: 0.6.0 resolution: "react-native-nitro-modules@npm:0.6.0" @@ -12403,6 +12432,16 @@ __metadata: languageName: node linkType: hard +"tinyglobby@npm:^0.2.9": + version: 0.2.9 + resolution: "tinyglobby@npm:0.2.9" + dependencies: + fdir: "npm:^6.4.0" + picomatch: "npm:^4.0.2" + checksum: 10/4570dacefa7f7371f49e52c8e4b7c4638d2cab9ee2903e1142c3eff4cfe71d1b8ab6cc55f65590a3232c27f8c0bcec794e4c2f02a4370fc79f3f4f026b5d84e7 + languageName: node + linkType: hard + "titleize@npm:^3.0.0": version: 3.0.0 resolution: "titleize@npm:3.0.0" @@ -12470,13 +12509,13 @@ __metadata: languageName: node linkType: hard -"ts-morph@npm:^23.0.0": - version: 23.0.0 - resolution: "ts-morph@npm:23.0.0" +"ts-morph@npm:^24.0.0": + version: 24.0.0 + resolution: "ts-morph@npm:24.0.0" dependencies: - "@ts-morph/common": "npm:~0.24.0" - code-block-writer: "npm:^13.0.1" - checksum: 10/2ac0e615021b9d4115df60be02fce0b9b80cb0db173b7836ac70f60f987d9f055ec6a4b2233cf6ed9bdd7f1d8854e8266f5af2d4d40ca738cd7374246e163da3 + "@ts-morph/common": "npm:~0.25.0" + code-block-writer: "npm:^13.0.3" + checksum: 10/560f64eac91429f852277af7588d116b83f91ace2e6ba89c71893b364a42c1e9a658fb40ad2c8d1b48af14d744ba1d4ee7a7efeae033d14ad7a6b5f50b83ccca languageName: node linkType: hard