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
|
@@ -29,6 +29,8 @@ namespace NitroSse { class HybridNitroSseSpec_cxx; }
|
|
|
29
29
|
#include "SseEvent.hpp"
|
|
30
30
|
#include "SseEventType.hpp"
|
|
31
31
|
#include "SseStats.hpp"
|
|
32
|
+
#include <NitroModules/Promise.hpp>
|
|
33
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
32
34
|
#include <NitroModules/Result.hpp>
|
|
33
35
|
#include <exception>
|
|
34
36
|
#include <functional>
|
|
@@ -144,6 +146,134 @@ namespace margelo::nitro::nitrosse::bridge::swift {
|
|
|
144
146
|
return optional.value();
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
// pragma MARK: std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>
|
|
150
|
+
/**
|
|
151
|
+
* Specialized version of `std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>`.
|
|
152
|
+
*/
|
|
153
|
+
using std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ = std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>;
|
|
154
|
+
inline std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>> create_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___() noexcept {
|
|
155
|
+
return Promise<std::unordered_map<std::string, std::string>>::create();
|
|
156
|
+
}
|
|
157
|
+
inline PromiseHolder<std::unordered_map<std::string, std::string>> wrap_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___(std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>> promise) noexcept {
|
|
158
|
+
return PromiseHolder<std::unordered_map<std::string, std::string>>(std::move(promise));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// pragma MARK: std::function<void(const std::unordered_map<std::string, std::string>& /* result */)>
|
|
162
|
+
/**
|
|
163
|
+
* Specialized version of `std::function<void(const std::unordered_map<std::string, std::string>&)>`.
|
|
164
|
+
*/
|
|
165
|
+
using Func_void_std__unordered_map_std__string__std__string_ = std::function<void(const std::unordered_map<std::string, std::string>& /* result */)>;
|
|
166
|
+
/**
|
|
167
|
+
* Wrapper class for a `std::function<void(const std::unordered_map<std::string, std::string>& / * result * /)>`, this can be used from Swift.
|
|
168
|
+
*/
|
|
169
|
+
class Func_void_std__unordered_map_std__string__std__string__Wrapper final {
|
|
170
|
+
public:
|
|
171
|
+
explicit Func_void_std__unordered_map_std__string__std__string__Wrapper(std::function<void(const std::unordered_map<std::string, std::string>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::unordered_map<std::string, std::string>& /* result */)>>(std::move(func))) {}
|
|
172
|
+
inline void call(std::unordered_map<std::string, std::string> result) const noexcept {
|
|
173
|
+
_function->operator()(result);
|
|
174
|
+
}
|
|
175
|
+
private:
|
|
176
|
+
std::unique_ptr<std::function<void(const std::unordered_map<std::string, std::string>& /* result */)>> _function;
|
|
177
|
+
} SWIFT_NONCOPYABLE;
|
|
178
|
+
Func_void_std__unordered_map_std__string__std__string_ create_Func_void_std__unordered_map_std__string__std__string_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
179
|
+
inline Func_void_std__unordered_map_std__string__std__string__Wrapper wrap_Func_void_std__unordered_map_std__string__std__string_(Func_void_std__unordered_map_std__string__std__string_ value) noexcept {
|
|
180
|
+
return Func_void_std__unordered_map_std__string__std__string__Wrapper(std::move(value));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
184
|
+
/**
|
|
185
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
186
|
+
*/
|
|
187
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
188
|
+
/**
|
|
189
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
190
|
+
*/
|
|
191
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
192
|
+
public:
|
|
193
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
194
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
195
|
+
_function->operator()(error);
|
|
196
|
+
}
|
|
197
|
+
private:
|
|
198
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
199
|
+
} SWIFT_NONCOPYABLE;
|
|
200
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
201
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
202
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>
|
|
206
|
+
/**
|
|
207
|
+
* Specialized version of `std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>`.
|
|
208
|
+
*/
|
|
209
|
+
using Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ = std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>;
|
|
210
|
+
/**
|
|
211
|
+
* Wrapper class for a `std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>`, this can be used from Swift.
|
|
212
|
+
*/
|
|
213
|
+
class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______Wrapper final {
|
|
214
|
+
public:
|
|
215
|
+
explicit Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______Wrapper(std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>&& func): _function(std::make_unique<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>(std::move(func))) {}
|
|
216
|
+
inline std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>> call() const noexcept {
|
|
217
|
+
auto __result = _function->operator()();
|
|
218
|
+
return __result;
|
|
219
|
+
}
|
|
220
|
+
private:
|
|
221
|
+
std::unique_ptr<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>> _function;
|
|
222
|
+
} SWIFT_NONCOPYABLE;
|
|
223
|
+
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;
|
|
224
|
+
inline Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______Wrapper wrap_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____(Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ value) noexcept {
|
|
225
|
+
return Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string______Wrapper(std::move(value));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// pragma MARK: std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>
|
|
229
|
+
/**
|
|
230
|
+
* Specialized version of `std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>`.
|
|
231
|
+
*/
|
|
232
|
+
using 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>>>>>;
|
|
233
|
+
inline std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>> create_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____() noexcept {
|
|
234
|
+
return Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>::create();
|
|
235
|
+
}
|
|
236
|
+
inline PromiseHolder<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>> wrap_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>>>>> promise) noexcept {
|
|
237
|
+
return PromiseHolder<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>(std::move(promise));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// pragma MARK: std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& /* result */)>
|
|
241
|
+
/**
|
|
242
|
+
* Specialized version of `std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>&)>`.
|
|
243
|
+
*/
|
|
244
|
+
using Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ = std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& /* result */)>;
|
|
245
|
+
/**
|
|
246
|
+
* Wrapper class for a `std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& / * result * /)>`, this can be used from Swift.
|
|
247
|
+
*/
|
|
248
|
+
class Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string____Wrapper final {
|
|
249
|
+
public:
|
|
250
|
+
explicit Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string____Wrapper(std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& /* result */)>>(std::move(func))) {}
|
|
251
|
+
inline void call(std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>> result) const noexcept {
|
|
252
|
+
_function->operator()(result);
|
|
253
|
+
}
|
|
254
|
+
private:
|
|
255
|
+
std::unique_ptr<std::function<void(const std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>& /* result */)>> _function;
|
|
256
|
+
} SWIFT_NONCOPYABLE;
|
|
257
|
+
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;
|
|
258
|
+
inline Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string____Wrapper wrap_Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___(Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ value) noexcept {
|
|
259
|
+
return Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string____Wrapper(std::move(value));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// pragma MARK: std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>
|
|
263
|
+
/**
|
|
264
|
+
* Specialized version of `std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>`.
|
|
265
|
+
*/
|
|
266
|
+
using std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________ = std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>;
|
|
267
|
+
inline std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>> create_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________(const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>& value) noexcept {
|
|
268
|
+
return std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>(value);
|
|
269
|
+
}
|
|
270
|
+
inline bool has_value_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________(const std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>& optional) noexcept {
|
|
271
|
+
return optional.has_value();
|
|
272
|
+
}
|
|
273
|
+
inline std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()> get_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________(const std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>& optional) noexcept {
|
|
274
|
+
return optional.value();
|
|
275
|
+
}
|
|
276
|
+
|
|
147
277
|
// pragma MARK: std::vector<SseEvent>
|
|
148
278
|
/**
|
|
149
279
|
* Specialized version of `std::vector<SseEvent>`.
|
|
@@ -28,6 +28,7 @@ namespace margelo::nitro::nitrosse { struct SseStats; }
|
|
|
28
28
|
#include "SseEvent.hpp"
|
|
29
29
|
#include "SseEventType.hpp"
|
|
30
30
|
#include "SseStats.hpp"
|
|
31
|
+
#include <NitroModules/Promise.hpp>
|
|
31
32
|
#include <NitroModules/Result.hpp>
|
|
32
33
|
#include <exception>
|
|
33
34
|
#include <functional>
|
|
@@ -28,9 +28,10 @@ namespace margelo::nitro::nitrosse { struct SseStats; }
|
|
|
28
28
|
#include "HttpMethod.hpp"
|
|
29
29
|
#include <optional>
|
|
30
30
|
#include <unordered_map>
|
|
31
|
+
#include <NitroModules/Promise.hpp>
|
|
32
|
+
#include <functional>
|
|
31
33
|
#include "SseEvent.hpp"
|
|
32
34
|
#include <vector>
|
|
33
|
-
#include <functional>
|
|
34
35
|
#include "SseEventType.hpp"
|
|
35
36
|
#include "SseStats.hpp"
|
|
36
37
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `() -> Promise<Promise<Dictionary<String, String>>>` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitrosse.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: () -> Promise<Promise<Dictionary<String, String>>>
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping () -> Promise<Promise<Dictionary<String, String>>>) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call() -> bridge.std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ {
|
|
25
|
+
let __result: Promise<Promise<Dictionary<String, String>>> = self.closure()
|
|
26
|
+
return { () -> bridge.std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ in
|
|
27
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____()
|
|
28
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____(__promise)
|
|
29
|
+
__result
|
|
30
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ in
|
|
31
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___()
|
|
32
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___(__promise)
|
|
33
|
+
__result
|
|
34
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__unordered_map_std__string__std__string_ in
|
|
35
|
+
var __map = bridge.create_std__unordered_map_std__string__std__string_(__result.count)
|
|
36
|
+
for (__k, __v) in __result {
|
|
37
|
+
bridge.emplace_std__unordered_map_std__string__std__string_(&__map, std.string(__k), std.string(__v))
|
|
38
|
+
}
|
|
39
|
+
return __map
|
|
40
|
+
}()) })
|
|
41
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
42
|
+
return __promise
|
|
43
|
+
}()) })
|
|
44
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
45
|
+
return __promise
|
|
46
|
+
}()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
51
|
+
* This acquires one additional strong reference on the object!
|
|
52
|
+
*/
|
|
53
|
+
@inline(__always)
|
|
54
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
55
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Casts an unsafe pointer to a `Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____`.
|
|
60
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____>`.
|
|
61
|
+
* This removes one strong reference from the object!
|
|
62
|
+
*/
|
|
63
|
+
@inline(__always)
|
|
64
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ {
|
|
65
|
+
return Unmanaged<Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____>.fromOpaque(pointer).takeRetainedValue()
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitrosse.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: Promise<Dictionary<String, String>>) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitrosse.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: Promise<Dictionary<String, String>>) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: Promise<Dictionary<String, String>>) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: bridge.std__shared_ptr_Promise_std__unordered_map_std__string__std__string___) -> Void {
|
|
25
|
+
self.closure({ () -> Promise<Dictionary<String, String>> in
|
|
26
|
+
let __promise = Promise<Dictionary<String, String>>()
|
|
27
|
+
let __resolver = { (__result: Dictionary<String, String>) in
|
|
28
|
+
__promise.resolve(withResult: __result)
|
|
29
|
+
}
|
|
30
|
+
let __rejecter = { (__error: Error) in
|
|
31
|
+
__promise.reject(withError: __error)
|
|
32
|
+
}
|
|
33
|
+
let __resolverCpp = { () -> bridge.Func_void_std__unordered_map_std__string__std__string_ in
|
|
34
|
+
let __closureWrapper = Func_void_std__unordered_map_std__string__std__string_(__resolver)
|
|
35
|
+
return bridge.create_Func_void_std__unordered_map_std__string__std__string_(__closureWrapper.toUnsafe())
|
|
36
|
+
}()
|
|
37
|
+
let __rejecterCpp = { () -> bridge.Func_void_std__exception_ptr in
|
|
38
|
+
let __closureWrapper = Func_void_std__exception_ptr(__rejecter)
|
|
39
|
+
return bridge.create_Func_void_std__exception_ptr(__closureWrapper.toUnsafe())
|
|
40
|
+
}()
|
|
41
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___(value)
|
|
42
|
+
__promiseHolder.addOnResolvedListener(__resolverCpp)
|
|
43
|
+
__promiseHolder.addOnRejectedListener(__rejecterCpp)
|
|
44
|
+
return __promise
|
|
45
|
+
}())
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
50
|
+
* This acquires one additional strong reference on the object!
|
|
51
|
+
*/
|
|
52
|
+
@inline(__always)
|
|
53
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
54
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Casts an unsafe pointer to a `Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___`.
|
|
59
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___>`.
|
|
60
|
+
* This removes one strong reference from the object!
|
|
61
|
+
*/
|
|
62
|
+
@inline(__always)
|
|
63
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ {
|
|
64
|
+
return Unmanaged<Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___>.fromOpaque(pointer).takeRetainedValue()
|
|
65
|
+
}
|
|
66
|
+
}
|
package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__std__string_.swift
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__unordered_map_std__string__std__string_.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: Dictionary<String, String>) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__unordered_map_std__string__std__string_ {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitrosse.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: Dictionary<String, String>) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: Dictionary<String, String>) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: bridge.std__unordered_map_std__string__std__string_) -> Void {
|
|
25
|
+
self.closure({ () -> Dictionary<String, String> in
|
|
26
|
+
var __dictionary = Dictionary<String, String>(minimumCapacity: value.size())
|
|
27
|
+
let __keys = bridge.get_std__unordered_map_std__string__std__string__keys(value)
|
|
28
|
+
for __key in __keys {
|
|
29
|
+
let __value = bridge.get_std__unordered_map_std__string__std__string__value(value, __key)
|
|
30
|
+
__dictionary[String(__key)] = String(__value)
|
|
31
|
+
}
|
|
32
|
+
return __dictionary
|
|
33
|
+
}())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
38
|
+
* This acquires one additional strong reference on the object!
|
|
39
|
+
*/
|
|
40
|
+
@inline(__always)
|
|
41
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
42
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Casts an unsafe pointer to a `Func_void_std__unordered_map_std__string__std__string_`.
|
|
47
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__unordered_map_std__string__std__string_>`.
|
|
48
|
+
* This removes one strong reference from the object!
|
|
49
|
+
*/
|
|
50
|
+
@inline(__always)
|
|
51
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__unordered_map_std__string__std__string_ {
|
|
52
|
+
return Unmanaged<Func_void_std__unordered_map_std__string__std__string_>.fromOpaque(pointer).takeRetainedValue()
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -18,7 +18,7 @@ public extension SseConfig {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `SseConfig`.
|
|
20
20
|
*/
|
|
21
|
-
init(url: String, method: HttpMethod?, headers: Dictionary<String, String>?, body: String?, backgroundExecution: Bool?, batchingIntervalMs: Double?, maxBufferSize: Double?) {
|
|
21
|
+
init(url: String, method: HttpMethod?, headers: Dictionary<String, String>?, body: String?, backgroundExecution: Bool?, batchingIntervalMs: Double?, maxBufferSize: Double?, connectionTimeoutMs: Double?, readTimeoutMs: Double?, onBeforeRequest: (() -> Promise<Promise<Dictionary<String, String>>>)?) {
|
|
22
22
|
self.init(std.string(url), { () -> bridge.std__optional_HttpMethod_ in
|
|
23
23
|
if let __unwrappedValue = method {
|
|
24
24
|
return bridge.create_std__optional_HttpMethod_(__unwrappedValue)
|
|
@@ -61,6 +61,27 @@ public extension SseConfig {
|
|
|
61
61
|
} else {
|
|
62
62
|
return .init()
|
|
63
63
|
}
|
|
64
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
65
|
+
if let __unwrappedValue = connectionTimeoutMs {
|
|
66
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
67
|
+
} else {
|
|
68
|
+
return .init()
|
|
69
|
+
}
|
|
70
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
71
|
+
if let __unwrappedValue = readTimeoutMs {
|
|
72
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
73
|
+
} else {
|
|
74
|
+
return .init()
|
|
75
|
+
}
|
|
76
|
+
}(), { () -> bridge.std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________ in
|
|
77
|
+
if let __unwrappedValue = onBeforeRequest {
|
|
78
|
+
return bridge.create_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________({ () -> bridge.Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____ in
|
|
79
|
+
let __closureWrapper = Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____(__unwrappedValue)
|
|
80
|
+
return bridge.create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____(__closureWrapper.toUnsafe())
|
|
81
|
+
}())
|
|
82
|
+
} else {
|
|
83
|
+
return .init()
|
|
84
|
+
}
|
|
64
85
|
}())
|
|
65
86
|
}
|
|
66
87
|
|
|
@@ -141,4 +162,66 @@ public extension SseConfig {
|
|
|
141
162
|
}
|
|
142
163
|
}()
|
|
143
164
|
}
|
|
165
|
+
|
|
166
|
+
@inline(__always)
|
|
167
|
+
var connectionTimeoutMs: Double? {
|
|
168
|
+
return { () -> Double? in
|
|
169
|
+
if bridge.has_value_std__optional_double_(self.__connectionTimeoutMs) {
|
|
170
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__connectionTimeoutMs)
|
|
171
|
+
return __unwrapped
|
|
172
|
+
} else {
|
|
173
|
+
return nil
|
|
174
|
+
}
|
|
175
|
+
}()
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@inline(__always)
|
|
179
|
+
var readTimeoutMs: Double? {
|
|
180
|
+
return { () -> Double? in
|
|
181
|
+
if bridge.has_value_std__optional_double_(self.__readTimeoutMs) {
|
|
182
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__readTimeoutMs)
|
|
183
|
+
return __unwrapped
|
|
184
|
+
} else {
|
|
185
|
+
return nil
|
|
186
|
+
}
|
|
187
|
+
}()
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@inline(__always)
|
|
191
|
+
var onBeforeRequest: (() -> Promise<Promise<Dictionary<String, String>>>)? {
|
|
192
|
+
return { () -> (() -> Promise<Promise<Dictionary<String, String>>>)? in
|
|
193
|
+
if bridge.has_value_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________(self.__onBeforeRequest) {
|
|
194
|
+
let __unwrapped = bridge.get_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_________(self.__onBeforeRequest)
|
|
195
|
+
return { () -> () -> Promise<Promise<Dictionary<String, String>>> in
|
|
196
|
+
let __wrappedFunction = bridge.wrap_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____(__unwrapped)
|
|
197
|
+
return { () -> Promise<Promise<Dictionary<String, String>>> in
|
|
198
|
+
let __result = __wrappedFunction.call()
|
|
199
|
+
return { () -> Promise<Promise<Dictionary<String, String>>> in
|
|
200
|
+
let __promise = Promise<Promise<Dictionary<String, String>>>()
|
|
201
|
+
let __resolver = { (__result: Promise<Dictionary<String, String>>) in
|
|
202
|
+
__promise.resolve(withResult: __result)
|
|
203
|
+
}
|
|
204
|
+
let __rejecter = { (__error: Error) in
|
|
205
|
+
__promise.reject(withError: __error)
|
|
206
|
+
}
|
|
207
|
+
let __resolverCpp = { () -> bridge.Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___ in
|
|
208
|
+
let __closureWrapper = Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___(__resolver)
|
|
209
|
+
return bridge.create_Func_void_std__shared_ptr_Promise_std__unordered_map_std__string__std__string___(__closureWrapper.toUnsafe())
|
|
210
|
+
}()
|
|
211
|
+
let __rejecterCpp = { () -> bridge.Func_void_std__exception_ptr in
|
|
212
|
+
let __closureWrapper = Func_void_std__exception_ptr(__rejecter)
|
|
213
|
+
return bridge.create_Func_void_std__exception_ptr(__closureWrapper.toUnsafe())
|
|
214
|
+
}()
|
|
215
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_std__unordered_map_std__string__std__string_____(__result)
|
|
216
|
+
__promiseHolder.addOnResolvedListener(__resolverCpp)
|
|
217
|
+
__promiseHolder.addOnRejectedListener(__rejecterCpp)
|
|
218
|
+
return __promise
|
|
219
|
+
}()
|
|
220
|
+
}
|
|
221
|
+
}()
|
|
222
|
+
} else {
|
|
223
|
+
return nil
|
|
224
|
+
}
|
|
225
|
+
}()
|
|
226
|
+
}
|
|
144
227
|
}
|
|
@@ -18,7 +18,7 @@ public extension SseEvent {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `SseEvent`.
|
|
20
20
|
*/
|
|
21
|
-
init(type: SseEventType, data: String?, id: String?, event: String?, message: String?) {
|
|
21
|
+
init(type: SseEventType, data: String?, id: String?, event: String?, message: String?, statusCode: Double?, retry: Double?) {
|
|
22
22
|
self.init(type, { () -> bridge.std__optional_std__string_ in
|
|
23
23
|
if let __unwrappedValue = data {
|
|
24
24
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
@@ -43,6 +43,18 @@ public extension SseEvent {
|
|
|
43
43
|
} else {
|
|
44
44
|
return .init()
|
|
45
45
|
}
|
|
46
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
47
|
+
if let __unwrappedValue = statusCode {
|
|
48
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
49
|
+
} else {
|
|
50
|
+
return .init()
|
|
51
|
+
}
|
|
52
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
53
|
+
if let __unwrappedValue = retry {
|
|
54
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
55
|
+
} else {
|
|
56
|
+
return .init()
|
|
57
|
+
}
|
|
46
58
|
}())
|
|
47
59
|
}
|
|
48
60
|
|
|
@@ -98,4 +110,28 @@ public extension SseEvent {
|
|
|
98
110
|
}
|
|
99
111
|
}()
|
|
100
112
|
}
|
|
113
|
+
|
|
114
|
+
@inline(__always)
|
|
115
|
+
var statusCode: Double? {
|
|
116
|
+
return { () -> Double? in
|
|
117
|
+
if bridge.has_value_std__optional_double_(self.__statusCode) {
|
|
118
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__statusCode)
|
|
119
|
+
return __unwrapped
|
|
120
|
+
} else {
|
|
121
|
+
return nil
|
|
122
|
+
}
|
|
123
|
+
}()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@inline(__always)
|
|
127
|
+
var retry: Double? {
|
|
128
|
+
return { () -> Double? in
|
|
129
|
+
if bridge.has_value_std__optional_double_(self.__retry) {
|
|
130
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__retry)
|
|
131
|
+
return __unwrapped
|
|
132
|
+
} else {
|
|
133
|
+
return nil
|
|
134
|
+
}
|
|
135
|
+
}()
|
|
136
|
+
}
|
|
101
137
|
}
|
|
@@ -35,6 +35,8 @@ namespace margelo::nitro::nitrosse { enum class HttpMethod; }
|
|
|
35
35
|
#include "HttpMethod.hpp"
|
|
36
36
|
#include <optional>
|
|
37
37
|
#include <unordered_map>
|
|
38
|
+
#include <NitroModules/Promise.hpp>
|
|
39
|
+
#include <functional>
|
|
38
40
|
|
|
39
41
|
namespace margelo::nitro::nitrosse {
|
|
40
42
|
|
|
@@ -50,13 +52,16 @@ namespace margelo::nitro::nitrosse {
|
|
|
50
52
|
std::optional<bool> backgroundExecution SWIFT_PRIVATE;
|
|
51
53
|
std::optional<double> batchingIntervalMs SWIFT_PRIVATE;
|
|
52
54
|
std::optional<double> maxBufferSize SWIFT_PRIVATE;
|
|
55
|
+
std::optional<double> connectionTimeoutMs SWIFT_PRIVATE;
|
|
56
|
+
std::optional<double> readTimeoutMs SWIFT_PRIVATE;
|
|
57
|
+
std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>> onBeforeRequest SWIFT_PRIVATE;
|
|
53
58
|
|
|
54
59
|
public:
|
|
55
60
|
SseConfig() = default;
|
|
56
|
-
explicit SseConfig(std::string url, std::optional<HttpMethod> method, std::optional<std::unordered_map<std::string, std::string>> headers, std::optional<std::string> body, std::optional<bool> backgroundExecution, std::optional<double> batchingIntervalMs, std::optional<double> maxBufferSize): url(url), method(method), headers(headers), body(body), backgroundExecution(backgroundExecution), batchingIntervalMs(batchingIntervalMs), maxBufferSize(maxBufferSize) {}
|
|
61
|
+
explicit SseConfig(std::string url, std::optional<HttpMethod> method, std::optional<std::unordered_map<std::string, std::string>> headers, std::optional<std::string> body, std::optional<bool> backgroundExecution, std::optional<double> batchingIntervalMs, std::optional<double> maxBufferSize, std::optional<double> connectionTimeoutMs, std::optional<double> readTimeoutMs, std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>> onBeforeRequest): url(url), method(method), headers(headers), body(body), backgroundExecution(backgroundExecution), batchingIntervalMs(batchingIntervalMs), maxBufferSize(maxBufferSize), connectionTimeoutMs(connectionTimeoutMs), readTimeoutMs(readTimeoutMs), onBeforeRequest(onBeforeRequest) {}
|
|
57
62
|
|
|
58
63
|
public:
|
|
59
|
-
|
|
64
|
+
// SseConfig is not equatable because these properties are not equatable: onBeforeRequest
|
|
60
65
|
};
|
|
61
66
|
|
|
62
67
|
} // namespace margelo::nitro::nitrosse
|
|
@@ -75,7 +80,10 @@ namespace margelo::nitro {
|
|
|
75
80
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "body"))),
|
|
76
81
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundExecution"))),
|
|
77
82
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "batchingIntervalMs"))),
|
|
78
|
-
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxBufferSize")))
|
|
83
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxBufferSize"))),
|
|
84
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "connectionTimeoutMs"))),
|
|
85
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "readTimeoutMs"))),
|
|
86
|
+
JSIConverter<std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onBeforeRequest")))
|
|
79
87
|
);
|
|
80
88
|
}
|
|
81
89
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrosse::SseConfig& arg) {
|
|
@@ -87,6 +95,9 @@ namespace margelo::nitro {
|
|
|
87
95
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "backgroundExecution"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.backgroundExecution));
|
|
88
96
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "batchingIntervalMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.batchingIntervalMs));
|
|
89
97
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxBufferSize"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maxBufferSize));
|
|
98
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "connectionTimeoutMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.connectionTimeoutMs));
|
|
99
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "readTimeoutMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.readTimeoutMs));
|
|
100
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "onBeforeRequest"), JSIConverter<std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>>::toJSI(runtime, arg.onBeforeRequest));
|
|
90
101
|
return obj;
|
|
91
102
|
}
|
|
92
103
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -104,6 +115,9 @@ namespace margelo::nitro {
|
|
|
104
115
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundExecution")))) return false;
|
|
105
116
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "batchingIntervalMs")))) return false;
|
|
106
117
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxBufferSize")))) return false;
|
|
118
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "connectionTimeoutMs")))) return false;
|
|
119
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "readTimeoutMs")))) return false;
|
|
120
|
+
if (!JSIConverter<std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onBeforeRequest")))) return false;
|
|
107
121
|
return true;
|
|
108
122
|
}
|
|
109
123
|
};
|