react-native-nitro-sse 3.0.0-beta.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -23
- package/android/src/main/java/com/margelo/nitro/nitrosse/NitroSse.kt +110 -64
- package/android/src/main/java/com/margelo/nitro/nitrosse/SseConnectionHandler.kt +32 -23
- package/android/src/main/java/com/margelo/nitro/nitrosse/SseEventBuffer.kt +3 -0
- package/android/src/main/java/com/margelo/nitro/nitrosse/SseNetworkMonitor.kt +29 -2
- package/ios/NitroSse.swift +53 -17
- package/ios/SseConfig+CopyWith.swift +35 -19
- package/lib/module/MockSseEngine.js +0 -5
- package/lib/module/NitroSseClient.js +55 -7
- package/lib/module/createNitroSse.js +24 -0
- package/lib/module/index.js +1 -22
- package/lib/module/useNitroSse.js +22 -5
- package/lib/typescript/src/NitroSse.nitro.d.ts +2 -2
- package/lib/typescript/src/NitroSseClient.d.ts +7 -3
- package/lib/typescript/src/SseInterface.d.ts +14 -7
- package/lib/typescript/src/createNitroSse.d.ts +9 -0
- package/lib/typescript/src/index.d.ts +1 -8
- package/lib/typescript/src/useNitroSse.d.ts +2 -2
- package/nitrogen/generated/android/c++/JHybridNitroSseSpec.cpp +8 -8
- package/nitrogen/generated/android/c++/JHybridNitroSseSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JSseConfig.hpp +1 -18
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosse/HybridNitroSseSpec.kt +4 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosse/SseConfig.kt +4 -13
- package/nitrogen/generated/android/nitrosseOnLoad.cpp +2 -2
- package/nitrogen/generated/ios/NitroSse-Swift-Cxx-Bridge.cpp +8 -8
- package/nitrogen/generated/ios/NitroSse-Swift-Cxx-Bridge.hpp +104 -104
- package/nitrogen/generated/ios/c++/HybridNitroSseSpecSwift.hpp +4 -4
- package/nitrogen/generated/ios/swift/HybridNitroSseSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNitroSseSpec_cxx.swift +34 -1
- package/nitrogen/generated/ios/swift/SseConfig.swift +1 -48
- package/nitrogen/generated/shared/c++/HybridNitroSseSpec.hpp +3 -1
- package/nitrogen/generated/shared/c++/SseConfig.hpp +2 -8
- package/package.json +1 -1
|
@@ -37,8 +37,6 @@ namespace margelo::nitro::nitrosse { struct SseMockConfig; }
|
|
|
37
37
|
#include "HttpMethod.hpp"
|
|
38
38
|
#include <optional>
|
|
39
39
|
#include <unordered_map>
|
|
40
|
-
#include <NitroModules/Promise.hpp>
|
|
41
|
-
#include <functional>
|
|
42
40
|
#include "SseMockConfig.hpp"
|
|
43
41
|
|
|
44
42
|
namespace margelo::nitro::nitrosse {
|
|
@@ -64,15 +62,14 @@ namespace margelo::nitro::nitrosse {
|
|
|
64
62
|
std::optional<double> maxAuthRetries SWIFT_PRIVATE;
|
|
65
63
|
std::optional<bool> autoParseJSON SWIFT_PRIVATE;
|
|
66
64
|
std::optional<bool> monitorNetwork SWIFT_PRIVATE;
|
|
67
|
-
std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::unordered_map<std::string, std::string>>>>>()>> onBeforeRequest SWIFT_PRIVATE;
|
|
68
65
|
std::optional<SseMockConfig> mock SWIFT_PRIVATE;
|
|
69
66
|
|
|
70
67
|
public:
|
|
71
68
|
SseConfig() = default;
|
|
72
|
-
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<double> retryIntervalMs, std::optional<double> maxRetryIntervalMs, std::optional<double> jitterFactor, std::optional<double> maxReconnectAttempts, std::optional<double> maxAuthRetries, std::optional<bool> autoParseJSON, std::optional<bool> monitorNetwork, std::optional<
|
|
69
|
+
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<double> retryIntervalMs, std::optional<double> maxRetryIntervalMs, std::optional<double> jitterFactor, std::optional<double> maxReconnectAttempts, std::optional<double> maxAuthRetries, std::optional<bool> autoParseJSON, std::optional<bool> monitorNetwork, std::optional<SseMockConfig> mock): url(url), method(method), headers(headers), body(body), backgroundExecution(backgroundExecution), batchingIntervalMs(batchingIntervalMs), maxBufferSize(maxBufferSize), connectionTimeoutMs(connectionTimeoutMs), readTimeoutMs(readTimeoutMs), retryIntervalMs(retryIntervalMs), maxRetryIntervalMs(maxRetryIntervalMs), jitterFactor(jitterFactor), maxReconnectAttempts(maxReconnectAttempts), maxAuthRetries(maxAuthRetries), autoParseJSON(autoParseJSON), monitorNetwork(monitorNetwork), mock(mock) {}
|
|
73
70
|
|
|
74
71
|
public:
|
|
75
|
-
|
|
72
|
+
friend bool operator==(const SseConfig& lhs, const SseConfig& rhs) = default;
|
|
76
73
|
};
|
|
77
74
|
|
|
78
75
|
} // namespace margelo::nitro::nitrosse
|
|
@@ -101,7 +98,6 @@ namespace margelo::nitro {
|
|
|
101
98
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxAuthRetries"))),
|
|
102
99
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoParseJSON"))),
|
|
103
100
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "monitorNetwork"))),
|
|
104
|
-
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"))),
|
|
105
101
|
JSIConverter<std::optional<margelo::nitro::nitrosse::SseMockConfig>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mock")))
|
|
106
102
|
);
|
|
107
103
|
}
|
|
@@ -123,7 +119,6 @@ namespace margelo::nitro {
|
|
|
123
119
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxAuthRetries"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maxAuthRetries));
|
|
124
120
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "autoParseJSON"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.autoParseJSON));
|
|
125
121
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "monitorNetwork"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.monitorNetwork));
|
|
126
|
-
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));
|
|
127
122
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mock"), JSIConverter<std::optional<margelo::nitro::nitrosse::SseMockConfig>>::toJSI(runtime, arg.mock));
|
|
128
123
|
return obj;
|
|
129
124
|
}
|
|
@@ -151,7 +146,6 @@ namespace margelo::nitro {
|
|
|
151
146
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxAuthRetries")))) return false;
|
|
152
147
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoParseJSON")))) return false;
|
|
153
148
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "monitorNetwork")))) return false;
|
|
154
|
-
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;
|
|
155
149
|
if (!JSIConverter<std::optional<margelo::nitro::nitrosse::SseMockConfig>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mock")))) return false;
|
|
156
150
|
return true;
|
|
157
151
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-sse",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "High-performance Server-Sent Events (SSE) for React Native, powered by Nitro Modules.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|