react-native-nitro-sse 1.4.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -34
- package/android/src/main/java/com/margelo/nitro/nitrosse/NitroSse.kt +265 -84
- package/android/src/test/java/com/margelo/nitro/nitrosse/NitroSseLogicTest.kt +60 -13
- package/ios/NitroSse.swift +288 -81
- package/ios/Tests/NitroSseTests.swift +36 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/SseInterface.d.ts +31 -4
- package/lib/typescript/src/SseInterface.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.hpp +138 -0
- package/nitrogen/generated/android/c++/JHybridNitroSseSpec.cpp +5 -2
- package/nitrogen/generated/android/c++/JSseConfig.hpp +28 -3
- package/nitrogen/generated/android/c++/JSseEvent.hpp +11 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosse/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosse/SseConfig.kt +18 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosse/SseEvent.kt +9 -3
- package/nitrogen/generated/android/nitrosseOnLoad.cpp +2 -0
- package/nitrogen/generated/ios/NitroSse-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/NitroSse-Swift-Cxx-Bridge.hpp +130 -0
- package/nitrogen/generated/ios/NitroSse-Swift-Cxx-Umbrella.hpp +1 -0
- package/nitrogen/generated/ios/c++/HybridNitroSseSpecSwift.hpp +2 -1
- package/nitrogen/generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.swift +67 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___.swift +66 -0
- package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/SseConfig.swift +84 -1
- package/nitrogen/generated/ios/swift/SseEvent.swift +37 -1
- package/nitrogen/generated/shared/c++/SseConfig.hpp +17 -3
- package/nitrogen/generated/shared/c++/SseEvent.hpp +10 -2
- package/package.json +1 -1
- package/src/SseInterface.ts +31 -4
- package/src/{index.tsx → index.ts} +4 -3
|
@@ -25,19 +25,42 @@ export interface SseConfig {
|
|
|
25
25
|
body?: string;
|
|
26
26
|
/**
|
|
27
27
|
* Whether to continue processing events when the app is in the background.
|
|
28
|
-
* Note:
|
|
28
|
+
* Note: On iOS, this uses background tasks which are limited in time by the OS.
|
|
29
29
|
* @default false
|
|
30
30
|
*/
|
|
31
31
|
backgroundExecution?: boolean;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* How long (in ms) to wait and group multiple events before sending them to the JS side.
|
|
34
|
+
* High-frequency streams should use this to reduce JS bridge overhead and improve UI performance.
|
|
35
|
+
* Set to 0 to deliver events immediately one-by-one.
|
|
36
|
+
* @default 0
|
|
35
37
|
*/
|
|
36
38
|
batchingIntervalMs?: number;
|
|
37
39
|
/**
|
|
38
|
-
* Maximum number of events to
|
|
40
|
+
* Maximum number of events to keep in the native buffer before forcing a flush to JS,
|
|
41
|
+
* regardless of the `batchingIntervalMs`. Prevents memory pressure.
|
|
42
|
+
* @default 1000
|
|
39
43
|
*/
|
|
40
44
|
maxBufferSize?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum time (in ms) to wait for the initial server connection and handshake to complete.
|
|
47
|
+
* Effectively the "Connect Timeout".
|
|
48
|
+
* @default 15000
|
|
49
|
+
*/
|
|
50
|
+
connectionTimeoutMs?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Maximum idle time (in ms) allowed between receiving data packets or heartbeats.
|
|
53
|
+
* If the server remains silent longer than this, the connection is considered stalled and will reconnect.
|
|
54
|
+
* Increase this for streams that transmit data infrequently.
|
|
55
|
+
* @default 300000
|
|
56
|
+
*/
|
|
57
|
+
readTimeoutMs?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Async interceptor called before every connection attempt (including auto-reconnects).
|
|
60
|
+
* Use this to refresh tokens or calculate dynamic headers.
|
|
61
|
+
* Note: This is protected by a native timeout to prevent the app from hanging.
|
|
62
|
+
*/
|
|
63
|
+
onBeforeRequest?: () => Promise<Record<string, string>>;
|
|
41
64
|
}
|
|
42
65
|
/**
|
|
43
66
|
* Represents a single SSE event.
|
|
@@ -53,6 +76,10 @@ export interface SseEvent {
|
|
|
53
76
|
event?: string;
|
|
54
77
|
/** System message or error description. */
|
|
55
78
|
message?: string;
|
|
79
|
+
/** HTTP status code if applicable. */
|
|
80
|
+
statusCode?: number;
|
|
81
|
+
/** Server-requested retry delay in milliseconds. */
|
|
82
|
+
retry?: number;
|
|
56
83
|
}
|
|
57
84
|
/**
|
|
58
85
|
* Statistics about the SSE connection.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SseInterface.d.ts","sourceRoot":"","sources":["../../../src/SseInterface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B
|
|
1
|
+
{"version":3,"file":"SseInterface.d.ts","sourceRoot":"","sources":["../../../src/SseInterface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,6BAA6B;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,mCAAmC;IACnC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IAC9D,cAAc,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,wBAAgB,cAAc,IAAI,QAAQ,CAgBzC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <unordered_map>
|
|
15
|
+
#include <NitroModules/Promise.hpp>
|
|
16
|
+
#include <functional>
|
|
17
|
+
#include <NitroModules/JNICallable.hpp>
|
|
18
|
+
#include <NitroModules/JPromise.hpp>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::nitrosse {
|
|
21
|
+
|
|
22
|
+
using namespace facebook;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Represents the Java/Kotlin callback `() -> Promise<Promise<Map<String, String>>>`.
|
|
26
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
27
|
+
*/
|
|
28
|
+
struct JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____: public jni::JavaClass<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____> {
|
|
29
|
+
public:
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrosse/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____;";
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
/**
|
|
34
|
+
* Invokes the function this `JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____` instance holds through JNI.
|
|
35
|
+
*/
|
|
36
|
+
std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>> invoke() const {
|
|
37
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("invoke");
|
|
38
|
+
auto __result = method(self());
|
|
39
|
+
return [&]() {
|
|
40
|
+
auto __promise = Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>::create();
|
|
41
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
42
|
+
auto __result = jni::static_ref_cast<JPromise::javaobject>(__boxedResult);
|
|
43
|
+
__promise->resolve([&]() {
|
|
44
|
+
auto __promise = Promise<std::unordered_map<std::string, std::string>>::create();
|
|
45
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
46
|
+
auto __result = jni::static_ref_cast<jni::JMap<jni::JString, jni::JString>>(__boxedResult);
|
|
47
|
+
__promise->resolve([&]() {
|
|
48
|
+
std::unordered_map<std::string, std::string> __map;
|
|
49
|
+
__map.reserve(__result->size());
|
|
50
|
+
for (const auto& __entry : *__result) {
|
|
51
|
+
__map.emplace(__entry.first->toStdString(), __entry.second->toStdString());
|
|
52
|
+
}
|
|
53
|
+
return __map;
|
|
54
|
+
}());
|
|
55
|
+
});
|
|
56
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
57
|
+
jni::JniException __jniError(__throwable);
|
|
58
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
59
|
+
});
|
|
60
|
+
return __promise;
|
|
61
|
+
}());
|
|
62
|
+
});
|
|
63
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
64
|
+
jni::JniException __jniError(__throwable);
|
|
65
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
66
|
+
});
|
|
67
|
+
return __promise;
|
|
68
|
+
}();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* An implementation of Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ that is backed by a C++ implementation (using `std::function<...>`)
|
|
74
|
+
*/
|
|
75
|
+
class JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx final: public jni::HybridClass<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx, JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____> {
|
|
76
|
+
public:
|
|
77
|
+
static jni::local_ref<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____::javaobject> fromCpp(const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>& func) {
|
|
78
|
+
return JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx::newObjectCxxArgs(func);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public:
|
|
82
|
+
/**
|
|
83
|
+
* Invokes the C++ `std::function<...>` this `JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx` instance holds.
|
|
84
|
+
*/
|
|
85
|
+
jni::local_ref<JPromise::javaobject> invoke_cxx() {
|
|
86
|
+
std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>> __result = _func();
|
|
87
|
+
return [&]() {
|
|
88
|
+
jni::local_ref<JPromise::javaobject> __localPromise = JPromise::create();
|
|
89
|
+
jni::global_ref<JPromise::javaobject> __promise = jni::make_global(__localPromise);
|
|
90
|
+
__result->addOnResolvedListener([=](const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& __result) {
|
|
91
|
+
__promise->cthis()->resolve([&]() {
|
|
92
|
+
jni::local_ref<JPromise::javaobject> __localPromise = JPromise::create();
|
|
93
|
+
jni::global_ref<JPromise::javaobject> __promise = jni::make_global(__localPromise);
|
|
94
|
+
__result->addOnResolvedListener([=](const std::unordered_map<std::string, std::string>& __result) {
|
|
95
|
+
__promise->cthis()->resolve([&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
|
|
96
|
+
auto __map = jni::JHashMap<jni::JString, jni::JString>::create(__result.size());
|
|
97
|
+
for (const auto& __entry : __result) {
|
|
98
|
+
__map->put(jni::make_jstring(__entry.first), jni::make_jstring(__entry.second));
|
|
99
|
+
}
|
|
100
|
+
return __map;
|
|
101
|
+
}());
|
|
102
|
+
});
|
|
103
|
+
__result->addOnRejectedListener([=](const std::exception_ptr& __error) {
|
|
104
|
+
auto __jniError = jni::getJavaExceptionForCppException(__error);
|
|
105
|
+
__promise->cthis()->reject(__jniError);
|
|
106
|
+
});
|
|
107
|
+
return __localPromise;
|
|
108
|
+
}());
|
|
109
|
+
});
|
|
110
|
+
__result->addOnRejectedListener([=](const std::exception_ptr& __error) {
|
|
111
|
+
auto __jniError = jni::getJavaExceptionForCppException(__error);
|
|
112
|
+
__promise->cthis()->reject(__jniError);
|
|
113
|
+
});
|
|
114
|
+
return __localPromise;
|
|
115
|
+
}();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public:
|
|
119
|
+
[[nodiscard]]
|
|
120
|
+
inline const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>& getFunction() const {
|
|
121
|
+
return _func;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public:
|
|
125
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrosse/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx;";
|
|
126
|
+
static void registerNatives() {
|
|
127
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx::invoke_cxx)});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private:
|
|
131
|
+
explicit JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx(const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>& func): _func(func) { }
|
|
132
|
+
|
|
133
|
+
private:
|
|
134
|
+
friend HybridBase;
|
|
135
|
+
std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()> _func;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
} // namespace margelo::nitro::nitrosse
|
|
@@ -27,11 +27,14 @@ namespace margelo::nitro::nitrosse { enum class SseEventType; }
|
|
|
27
27
|
#include "HttpMethod.hpp"
|
|
28
28
|
#include "JHttpMethod.hpp"
|
|
29
29
|
#include <unordered_map>
|
|
30
|
+
#include <NitroModules/Promise.hpp>
|
|
31
|
+
#include <functional>
|
|
32
|
+
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.hpp"
|
|
33
|
+
#include <NitroModules/JNICallable.hpp>
|
|
34
|
+
#include <NitroModules/JPromise.hpp>
|
|
30
35
|
#include "SseEvent.hpp"
|
|
31
36
|
#include <vector>
|
|
32
|
-
#include <functional>
|
|
33
37
|
#include "JFunc_void_std__vector_SseEvent_.hpp"
|
|
34
|
-
#include <NitroModules/JNICallable.hpp>
|
|
35
38
|
#include "JSseEvent.hpp"
|
|
36
39
|
#include "SseEventType.hpp"
|
|
37
40
|
#include "JSseEventType.hpp"
|
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
#include "SseConfig.hpp"
|
|
12
12
|
|
|
13
13
|
#include "HttpMethod.hpp"
|
|
14
|
+
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.hpp"
|
|
14
15
|
#include "JHttpMethod.hpp"
|
|
16
|
+
#include <NitroModules/JNICallable.hpp>
|
|
17
|
+
#include <NitroModules/JPromise.hpp>
|
|
18
|
+
#include <NitroModules/Promise.hpp>
|
|
19
|
+
#include <functional>
|
|
15
20
|
#include <optional>
|
|
16
21
|
#include <string>
|
|
17
22
|
#include <unordered_map>
|
|
@@ -49,6 +54,12 @@ namespace margelo::nitro::nitrosse {
|
|
|
49
54
|
jni::local_ref<jni::JDouble> batchingIntervalMs = this->getFieldValue(fieldBatchingIntervalMs);
|
|
50
55
|
static const auto fieldMaxBufferSize = clazz->getField<jni::JDouble>("maxBufferSize");
|
|
51
56
|
jni::local_ref<jni::JDouble> maxBufferSize = this->getFieldValue(fieldMaxBufferSize);
|
|
57
|
+
static const auto fieldConnectionTimeoutMs = clazz->getField<jni::JDouble>("connectionTimeoutMs");
|
|
58
|
+
jni::local_ref<jni::JDouble> connectionTimeoutMs = this->getFieldValue(fieldConnectionTimeoutMs);
|
|
59
|
+
static const auto fieldReadTimeoutMs = clazz->getField<jni::JDouble>("readTimeoutMs");
|
|
60
|
+
jni::local_ref<jni::JDouble> readTimeoutMs = this->getFieldValue(fieldReadTimeoutMs);
|
|
61
|
+
static const auto fieldOnBeforeRequest = clazz->getField<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____::javaobject>("onBeforeRequest");
|
|
62
|
+
jni::local_ref<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____::javaobject> onBeforeRequest = this->getFieldValue(fieldOnBeforeRequest);
|
|
52
63
|
return SseConfig(
|
|
53
64
|
url->toStdString(),
|
|
54
65
|
method != nullptr ? std::make_optional(method->toCpp()) : std::nullopt,
|
|
@@ -63,7 +74,18 @@ namespace margelo::nitro::nitrosse {
|
|
|
63
74
|
body != nullptr ? std::make_optional(body->toStdString()) : std::nullopt,
|
|
64
75
|
backgroundExecution != nullptr ? std::make_optional(static_cast<bool>(backgroundExecution->value())) : std::nullopt,
|
|
65
76
|
batchingIntervalMs != nullptr ? std::make_optional(batchingIntervalMs->value()) : std::nullopt,
|
|
66
|
-
maxBufferSize != nullptr ? std::make_optional(maxBufferSize->value()) : std::nullopt
|
|
77
|
+
maxBufferSize != nullptr ? std::make_optional(maxBufferSize->value()) : std::nullopt,
|
|
78
|
+
connectionTimeoutMs != nullptr ? std::make_optional(connectionTimeoutMs->value()) : std::nullopt,
|
|
79
|
+
readTimeoutMs != nullptr ? std::make_optional(readTimeoutMs->value()) : std::nullopt,
|
|
80
|
+
onBeforeRequest != nullptr ? std::make_optional([&]() -> std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()> {
|
|
81
|
+
if (onBeforeRequest->isInstanceOf(JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx::javaClassStatic())) [[likely]] {
|
|
82
|
+
auto downcast = jni::static_ref_cast<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx::javaobject>(onBeforeRequest);
|
|
83
|
+
return downcast->cthis()->getFunction();
|
|
84
|
+
} else {
|
|
85
|
+
auto onBeforeRequestRef = jni::make_global(onBeforeRequest);
|
|
86
|
+
return JNICallable<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____, std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>(std::move(onBeforeRequestRef));
|
|
87
|
+
}
|
|
88
|
+
}()) : std::nullopt
|
|
67
89
|
);
|
|
68
90
|
}
|
|
69
91
|
|
|
@@ -73,7 +95,7 @@ namespace margelo::nitro::nitrosse {
|
|
|
73
95
|
*/
|
|
74
96
|
[[maybe_unused]]
|
|
75
97
|
static jni::local_ref<JSseConfig::javaobject> fromCpp(const SseConfig& value) {
|
|
76
|
-
using JSignature = JSseConfig(jni::alias_ref<jni::JString>, jni::alias_ref<JHttpMethod>, jni::alias_ref<jni::JMap<jni::JString, jni::JString>>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>);
|
|
98
|
+
using JSignature = JSseConfig(jni::alias_ref<jni::JString>, jni::alias_ref<JHttpMethod>, jni::alias_ref<jni::JMap<jni::JString, jni::JString>>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____::javaobject>);
|
|
77
99
|
static const auto clazz = javaClassStatic();
|
|
78
100
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
79
101
|
return create(
|
|
@@ -90,7 +112,10 @@ namespace margelo::nitro::nitrosse {
|
|
|
90
112
|
value.body.has_value() ? jni::make_jstring(value.body.value()) : nullptr,
|
|
91
113
|
value.backgroundExecution.has_value() ? jni::JBoolean::valueOf(value.backgroundExecution.value()) : nullptr,
|
|
92
114
|
value.batchingIntervalMs.has_value() ? jni::JDouble::valueOf(value.batchingIntervalMs.value()) : nullptr,
|
|
93
|
-
value.maxBufferSize.has_value() ? jni::JDouble::valueOf(value.maxBufferSize.value()) : nullptr
|
|
115
|
+
value.maxBufferSize.has_value() ? jni::JDouble::valueOf(value.maxBufferSize.value()) : nullptr,
|
|
116
|
+
value.connectionTimeoutMs.has_value() ? jni::JDouble::valueOf(value.connectionTimeoutMs.value()) : nullptr,
|
|
117
|
+
value.readTimeoutMs.has_value() ? jni::JDouble::valueOf(value.readTimeoutMs.value()) : nullptr,
|
|
118
|
+
value.onBeforeRequest.has_value() ? JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx::fromCpp(value.onBeforeRequest.value()) : nullptr
|
|
94
119
|
);
|
|
95
120
|
}
|
|
96
121
|
};
|
|
@@ -44,12 +44,18 @@ namespace margelo::nitro::nitrosse {
|
|
|
44
44
|
jni::local_ref<jni::JString> event = this->getFieldValue(fieldEvent);
|
|
45
45
|
static const auto fieldMessage = clazz->getField<jni::JString>("message");
|
|
46
46
|
jni::local_ref<jni::JString> message = this->getFieldValue(fieldMessage);
|
|
47
|
+
static const auto fieldStatusCode = clazz->getField<jni::JDouble>("statusCode");
|
|
48
|
+
jni::local_ref<jni::JDouble> statusCode = this->getFieldValue(fieldStatusCode);
|
|
49
|
+
static const auto fieldRetry = clazz->getField<jni::JDouble>("retry");
|
|
50
|
+
jni::local_ref<jni::JDouble> retry = this->getFieldValue(fieldRetry);
|
|
47
51
|
return SseEvent(
|
|
48
52
|
type->toCpp(),
|
|
49
53
|
data != nullptr ? std::make_optional(data->toStdString()) : std::nullopt,
|
|
50
54
|
id != nullptr ? std::make_optional(id->toStdString()) : std::nullopt,
|
|
51
55
|
event != nullptr ? std::make_optional(event->toStdString()) : std::nullopt,
|
|
52
|
-
message != nullptr ? std::make_optional(message->toStdString()) : std::nullopt
|
|
56
|
+
message != nullptr ? std::make_optional(message->toStdString()) : std::nullopt,
|
|
57
|
+
statusCode != nullptr ? std::make_optional(statusCode->value()) : std::nullopt,
|
|
58
|
+
retry != nullptr ? std::make_optional(retry->value()) : std::nullopt
|
|
53
59
|
);
|
|
54
60
|
}
|
|
55
61
|
|
|
@@ -59,7 +65,7 @@ namespace margelo::nitro::nitrosse {
|
|
|
59
65
|
*/
|
|
60
66
|
[[maybe_unused]]
|
|
61
67
|
static jni::local_ref<JSseEvent::javaobject> fromCpp(const SseEvent& value) {
|
|
62
|
-
using JSignature = JSseEvent(jni::alias_ref<JSseEventType>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
68
|
+
using JSignature = JSseEvent(jni::alias_ref<JSseEventType>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>);
|
|
63
69
|
static const auto clazz = javaClassStatic();
|
|
64
70
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
65
71
|
return create(
|
|
@@ -68,7 +74,9 @@ namespace margelo::nitro::nitrosse {
|
|
|
68
74
|
value.data.has_value() ? jni::make_jstring(value.data.value()) : nullptr,
|
|
69
75
|
value.id.has_value() ? jni::make_jstring(value.id.value()) : nullptr,
|
|
70
76
|
value.event.has_value() ? jni::make_jstring(value.event.value()) : nullptr,
|
|
71
|
-
value.message.has_value() ? jni::make_jstring(value.message.value()) : nullptr
|
|
77
|
+
value.message.has_value() ? jni::make_jstring(value.message.value()) : nullptr,
|
|
78
|
+
value.statusCode.has_value() ? jni::JDouble::valueOf(value.statusCode.value()) : nullptr,
|
|
79
|
+
value.retry.has_value() ? jni::JDouble::valueOf(value.retry.value()) : nullptr
|
|
72
80
|
);
|
|
73
81
|
}
|
|
74
82
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.kt
|
|
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
|
+
package com.margelo.nitro.nitrosse
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.core.Promise
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `() => std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____: () -> Promise<Promise<Map<String, String>>> {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(): Promise<Promise<Map<String, String>>>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `() => std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx: Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(): Promise<Promise<Map<String, String>>>
|
|
60
|
+
= invoke_cxx()
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(): Promise<Promise<Map<String, String>>>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `() => std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `() -> Promise<Promise<Map<String, String>>>`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______java(private val function: () -> Promise<Promise<Map<String, String>>>): Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(): Promise<Promise<Map<String, String>>> {
|
|
78
|
+
return this.function()
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -9,7 +9,7 @@ package com.margelo.nitro.nitrosse
|
|
|
9
9
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
-
|
|
12
|
+
import com.margelo.nitro.core.Promise
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Represents the JavaScript object/struct "SseConfig".
|
|
@@ -37,9 +37,22 @@ data class SseConfig(
|
|
|
37
37
|
val batchingIntervalMs: Double?,
|
|
38
38
|
@DoNotStrip
|
|
39
39
|
@Keep
|
|
40
|
-
val maxBufferSize: Double
|
|
40
|
+
val maxBufferSize: Double?,
|
|
41
|
+
@DoNotStrip
|
|
42
|
+
@Keep
|
|
43
|
+
val connectionTimeoutMs: Double?,
|
|
44
|
+
@DoNotStrip
|
|
45
|
+
@Keep
|
|
46
|
+
val readTimeoutMs: Double?,
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
val onBeforeRequest: Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____?
|
|
41
50
|
) {
|
|
42
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Create a new instance of SseConfig from Kotlin
|
|
53
|
+
*/
|
|
54
|
+
constructor(url: String, method: HttpMethod?, headers: Map<String, String>?, body: String?, backgroundExecution: Boolean?, batchingIntervalMs: Double?, maxBufferSize: Double?, connectionTimeoutMs: Double?, readTimeoutMs: Double?, onBeforeRequest: (() -> Promise<Promise<Map<String, String>>>)?):
|
|
55
|
+
this(url, method, headers, body, backgroundExecution, batchingIntervalMs, maxBufferSize, connectionTimeoutMs, readTimeoutMs, onBeforeRequest?.let { Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______java(it) })
|
|
43
56
|
|
|
44
57
|
companion object {
|
|
45
58
|
/**
|
|
@@ -49,8 +62,8 @@ data class SseConfig(
|
|
|
49
62
|
@Keep
|
|
50
63
|
@Suppress("unused")
|
|
51
64
|
@JvmStatic
|
|
52
|
-
private fun fromCpp(url: String, method: HttpMethod?, headers: Map<String, String>?, body: String?, backgroundExecution: Boolean?, batchingIntervalMs: Double?, maxBufferSize: Double?): SseConfig {
|
|
53
|
-
return SseConfig(url, method, headers, body, backgroundExecution, batchingIntervalMs, maxBufferSize)
|
|
65
|
+
private fun fromCpp(url: String, method: HttpMethod?, headers: Map<String, String>?, body: String?, backgroundExecution: Boolean?, batchingIntervalMs: Double?, maxBufferSize: Double?, connectionTimeoutMs: Double?, readTimeoutMs: Double?, onBeforeRequest: Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____?): SseConfig {
|
|
66
|
+
return SseConfig(url, method, headers, body, backgroundExecution, batchingIntervalMs, maxBufferSize, connectionTimeoutMs, readTimeoutMs, onBeforeRequest)
|
|
54
67
|
}
|
|
55
68
|
}
|
|
56
69
|
}
|
|
@@ -31,7 +31,13 @@ data class SseEvent(
|
|
|
31
31
|
val event: String?,
|
|
32
32
|
@DoNotStrip
|
|
33
33
|
@Keep
|
|
34
|
-
val message: String
|
|
34
|
+
val message: String?,
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
@Keep
|
|
37
|
+
val statusCode: Double?,
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
val retry: Double?
|
|
35
41
|
) {
|
|
36
42
|
/* primary constructor */
|
|
37
43
|
|
|
@@ -43,8 +49,8 @@ data class SseEvent(
|
|
|
43
49
|
@Keep
|
|
44
50
|
@Suppress("unused")
|
|
45
51
|
@JvmStatic
|
|
46
|
-
private fun fromCpp(type: SseEventType, data: String?, id: String?, event: String?, message: String?): SseEvent {
|
|
47
|
-
return SseEvent(type, data, id, event, message)
|
|
52
|
+
private fun fromCpp(type: SseEventType, data: String?, id: String?, event: String?, message: String?, statusCode: Double?, retry: Double?): SseEvent {
|
|
53
|
+
return SseEvent(type, data, id, event, message, statusCode, retry)
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
18
|
#include "JHybridNitroSseSpec.hpp"
|
|
19
|
+
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.hpp"
|
|
19
20
|
#include "JFunc_void_std__vector_SseEvent_.hpp"
|
|
20
21
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
21
22
|
|
|
@@ -42,6 +43,7 @@ void registerAllNatives() {
|
|
|
42
43
|
|
|
43
44
|
// Register native JNI methods
|
|
44
45
|
margelo::nitro::nitrosse::JHybridNitroSseSpec::CxxPart::registerNatives();
|
|
46
|
+
margelo::nitro::nitrosse::JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______cxx::registerNatives();
|
|
45
47
|
margelo::nitro::nitrosse::JFunc_void_std__vector_SseEvent__cxx::registerNatives();
|
|
46
48
|
|
|
47
49
|
// Register Nitro Hybrid Objects
|
|
@@ -14,6 +14,39 @@
|
|
|
14
14
|
|
|
15
15
|
namespace margelo::nitro::nitrosse::bridge::swift {
|
|
16
16
|
|
|
17
|
+
// pragma MARK: std::function<void(const std::unordered_map<std::string, std::string>& /* result */)>
|
|
18
|
+
Func_void_std__unordered_map_std__string__std__string_ create_Func_void_std__unordered_map_std__string__std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = NitroSse::Func_void_std__unordered_map_std__string__std__string_::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const std::unordered_map<std::string, std::string>& result) mutable -> void {
|
|
21
|
+
swiftClosure.call(result);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
26
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = NitroSse::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
29
|
+
swiftClosure.call(error);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>
|
|
34
|
+
Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
35
|
+
auto swiftClosure = NitroSse::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____::fromUnsafe(swiftClosureWrapper);
|
|
36
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>> {
|
|
37
|
+
auto __result = swiftClosure.call();
|
|
38
|
+
return __result;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// pragma MARK: std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& /* result */)>
|
|
43
|
+
Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ create_Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
44
|
+
auto swiftClosure = NitroSse::Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___::fromUnsafe(swiftClosureWrapper);
|
|
45
|
+
return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& result) mutable -> void {
|
|
46
|
+
swiftClosure.call(result);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
17
50
|
// pragma MARK: std::function<void(const std::vector<SseEvent>& /* events */)>
|
|
18
51
|
Func_void_std__vector_SseEvent_ create_Func_void_std__vector_SseEvent_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
52
|
auto swiftClosure = NitroSse::Func_void_std__vector_SseEvent_::fromUnsafe(swiftClosureWrapper);
|