@onekeyfe/react-native-range-downloader 3.0.81-alpha.1 → 3.0.81-alpha.11
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/ReactNativeRangeDownloader.podspec +1 -2
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveRules.kt +12 -5
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactOrphanSweep.kt +111 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactStore.kt +194 -214
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/ReactNativeRangeDownloader.kt +21 -21
- package/android/src/test/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveRulesTest.kt +39 -0
- package/android/src/test/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactDeadlineTest.kt +26 -0
- package/android/src/test/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactOrphanSweepTest.kt +107 -0
- package/ios/FirmwareArtifactStore.swift +667 -435
- package/ios/RangeDownloadLogic.swift +317 -0
- package/ios/ReactNativeRangeDownloader.swift +60 -484
- package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts +4 -7
- package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFirmwareArchiveMaterializeParams.hpp +7 -6
- package/nitrogen/generated/android/c++/JFirmwareArtifactDownloadParams.hpp +7 -7
- package/nitrogen/generated/android/c++/JFirmwareArtifactReceipt.hpp +7 -3
- package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.cpp +0 -19
- package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.hpp +0 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveMaterializeParams.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactDownloadParams.kt +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactReceipt.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/HybridReactNativeRangeDownloaderSpec.kt +0 -4
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Bridge.hpp +15 -0
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp +0 -3
- package/nitrogen/generated/ios/c++/HybridReactNativeRangeDownloaderSpecSwift.hpp +0 -11
- package/nitrogen/generated/ios/swift/FirmwareArchiveMaterializeParams.swift +32 -13
- package/nitrogen/generated/ios/swift/FirmwareArtifactDownloadParams.swift +39 -8
- package/nitrogen/generated/ios/swift/FirmwareArtifactReceipt.swift +13 -2
- package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec.swift +0 -1
- package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec_cxx.swift +0 -19
- package/nitrogen/generated/shared/c++/FirmwareArchiveMaterializeParams.hpp +6 -5
- package/nitrogen/generated/shared/c++/FirmwareArtifactDownloadParams.hpp +9 -9
- package/nitrogen/generated/shared/c++/FirmwareArtifactReceipt.hpp +6 -2
- package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.cpp +0 -1
- package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.hpp +0 -4
- package/package.json +1 -2
- package/src/ReactNativeRangeDownloader.nitro.ts +7 -11
- package/ios/FirmwareBackgroundSessionEventRouter.swift +0 -17
- package/nitrogen/generated/android/c++/JFirmwareArtifactLeaseReconcileParams.hpp +0 -76
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactLeaseReconcileParams.kt +0 -38
- package/nitrogen/generated/ios/swift/FirmwareArtifactLeaseReconcileParams.swift +0 -48
- package/nitrogen/generated/shared/c++/FirmwareArtifactLeaseReconcileParams.hpp +0 -76
|
@@ -36,8 +36,8 @@ export interface FirmwareArtifactDownloadParams {
|
|
|
36
36
|
url: string;
|
|
37
37
|
routeType: string;
|
|
38
38
|
resolvedIp?: string;
|
|
39
|
-
expectedSize
|
|
40
|
-
expectedSha256
|
|
39
|
+
expectedSize?: number;
|
|
40
|
+
expectedSha256?: string;
|
|
41
41
|
maxBytes: number;
|
|
42
42
|
overallDeadlineSeconds?: number;
|
|
43
43
|
}
|
|
@@ -45,6 +45,7 @@ export interface FirmwareArtifactReceipt {
|
|
|
45
45
|
artifactRef: string;
|
|
46
46
|
size: number;
|
|
47
47
|
sha256: string;
|
|
48
|
+
expectedSha256Verified: boolean;
|
|
48
49
|
}
|
|
49
50
|
export interface FirmwareArtifactCapabilities {
|
|
50
51
|
firmwareArtifactProtocolVersion: number;
|
|
@@ -73,7 +74,7 @@ export interface FirmwareArtifactReaderCloseParams {
|
|
|
73
74
|
export interface FirmwareArchiveMaterializeParams {
|
|
74
75
|
leaseRef: string;
|
|
75
76
|
archiveArtifactRef: string;
|
|
76
|
-
expectedEntries
|
|
77
|
+
expectedEntries?: FirmwareArchiveExpectedEntry[];
|
|
77
78
|
}
|
|
78
79
|
export interface FirmwareArchiveExpectedEntry {
|
|
79
80
|
artifactId: string;
|
|
@@ -102,9 +103,6 @@ export interface FirmwareArtifactLeaseReleaseParams {
|
|
|
102
103
|
leaseRef: string;
|
|
103
104
|
disposition: string;
|
|
104
105
|
}
|
|
105
|
-
export interface FirmwareArtifactLeaseReconcileParams {
|
|
106
|
-
activeLeaseRefs: string[];
|
|
107
|
-
}
|
|
108
106
|
export interface FirmwareArtifactSweepResult {
|
|
109
107
|
deletedFiles: number;
|
|
110
108
|
deletedBytes: number;
|
|
@@ -130,7 +128,6 @@ export interface ReactNativeRangeDownloader extends HybridObject<{
|
|
|
130
128
|
createFirmwareArtifactLease(params: FirmwareArtifactLeaseCreateParams): Promise<FirmwareArtifactLease>;
|
|
131
129
|
retainFirmwareArtifact(params: FirmwareArtifactLeaseRetainParams): Promise<void>;
|
|
132
130
|
releaseFirmwareArtifactLease(params: FirmwareArtifactLeaseReleaseParams): Promise<void>;
|
|
133
|
-
reconcileFirmwareArtifactLeases(params: FirmwareArtifactLeaseReconcileParams): Promise<void>;
|
|
134
131
|
sweepFirmwareArtifactOrphans(): Promise<FirmwareArtifactSweepResult>;
|
|
135
132
|
}
|
|
136
133
|
//# sourceMappingURL=ReactNativeRangeDownloader.nitro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeRangeDownloader.nitro.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeRangeDownloader.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM/D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAI5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAWD,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX,mBAAmB,GACnB,mBAAmB,GACnB,UAAU,CAAC;AAKf,MAAM,MAAM,iBAAiB,GACzB,oBAAoB,GACpB,kBAAkB,GAClB,aAAa,GACb,UAAU,GACV,kBAAkB,GAClB,kBAAkB,GAClB,qBAAqB,GACrB,kBAAkB,GAClB,WAAW,GACX,iB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C,CAAC;IACxB,qBAAqB,CACnB,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,0BAA0B,CACxB,MAAM,EAAE,gCAAgC,GACvC,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC7C,2BAA2B,CACzB,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAClC,sBAAsB,CACpB,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,4BAA4B,CAC1B,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,4BAA4B,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAAC;CACtE"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#include "FirmwareArchiveExpectedEntry.hpp"
|
|
14
14
|
#include "JFirmwareArchiveExpectedEntry.hpp"
|
|
15
|
+
#include <optional>
|
|
15
16
|
#include <string>
|
|
16
17
|
#include <vector>
|
|
17
18
|
|
|
@@ -43,7 +44,7 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
43
44
|
return FirmwareArchiveMaterializeParams(
|
|
44
45
|
leaseRef->toStdString(),
|
|
45
46
|
archiveArtifactRef->toStdString(),
|
|
46
|
-
[&]() {
|
|
47
|
+
expectedEntries != nullptr ? std::make_optional([&]() {
|
|
47
48
|
size_t __size = expectedEntries->size();
|
|
48
49
|
std::vector<FirmwareArchiveExpectedEntry> __vector;
|
|
49
50
|
__vector.reserve(__size);
|
|
@@ -52,7 +53,7 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
52
53
|
__vector.push_back(__element->toCpp());
|
|
53
54
|
}
|
|
54
55
|
return __vector;
|
|
55
|
-
}()
|
|
56
|
+
}()) : std::nullopt
|
|
56
57
|
);
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -69,16 +70,16 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
69
70
|
clazz,
|
|
70
71
|
jni::make_jstring(value.leaseRef),
|
|
71
72
|
jni::make_jstring(value.archiveArtifactRef),
|
|
72
|
-
[&]() {
|
|
73
|
-
size_t __size = value.expectedEntries.size();
|
|
73
|
+
value.expectedEntries.has_value() ? [&]() {
|
|
74
|
+
size_t __size = value.expectedEntries.value().size();
|
|
74
75
|
jni::local_ref<jni::JArrayClass<JFirmwareArchiveExpectedEntry>> __array = jni::JArrayClass<JFirmwareArchiveExpectedEntry>::newArray(__size);
|
|
75
76
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
76
|
-
const auto& __element = value.expectedEntries[__i];
|
|
77
|
+
const auto& __element = value.expectedEntries.value()[__i];
|
|
77
78
|
auto __elementJni = JFirmwareArchiveExpectedEntry::fromCpp(__element);
|
|
78
79
|
__array->setElement(__i, *__elementJni);
|
|
79
80
|
}
|
|
80
81
|
return __array;
|
|
81
|
-
}()
|
|
82
|
+
}() : nullptr
|
|
82
83
|
);
|
|
83
84
|
}
|
|
84
85
|
};
|
|
@@ -46,8 +46,8 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
46
46
|
jni::local_ref<jni::JString> routeType = this->getFieldValue(fieldRouteType);
|
|
47
47
|
static const auto fieldResolvedIp = clazz->getField<jni::JString>("resolvedIp");
|
|
48
48
|
jni::local_ref<jni::JString> resolvedIp = this->getFieldValue(fieldResolvedIp);
|
|
49
|
-
static const auto fieldExpectedSize = clazz->getField<
|
|
50
|
-
|
|
49
|
+
static const auto fieldExpectedSize = clazz->getField<jni::JDouble>("expectedSize");
|
|
50
|
+
jni::local_ref<jni::JDouble> expectedSize = this->getFieldValue(fieldExpectedSize);
|
|
51
51
|
static const auto fieldExpectedSha256 = clazz->getField<jni::JString>("expectedSha256");
|
|
52
52
|
jni::local_ref<jni::JString> expectedSha256 = this->getFieldValue(fieldExpectedSha256);
|
|
53
53
|
static const auto fieldMaxBytes = clazz->getField<double>("maxBytes");
|
|
@@ -62,8 +62,8 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
62
62
|
url->toStdString(),
|
|
63
63
|
routeType->toStdString(),
|
|
64
64
|
resolvedIp != nullptr ? std::make_optional(resolvedIp->toStdString()) : std::nullopt,
|
|
65
|
-
expectedSize,
|
|
66
|
-
expectedSha256->toStdString(),
|
|
65
|
+
expectedSize != nullptr ? std::make_optional(expectedSize->value()) : std::nullopt,
|
|
66
|
+
expectedSha256 != nullptr ? std::make_optional(expectedSha256->toStdString()) : std::nullopt,
|
|
67
67
|
maxBytes,
|
|
68
68
|
overallDeadlineSeconds != nullptr ? std::make_optional(overallDeadlineSeconds->value()) : std::nullopt
|
|
69
69
|
);
|
|
@@ -75,7 +75,7 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
75
75
|
*/
|
|
76
76
|
[[maybe_unused]]
|
|
77
77
|
static jni::local_ref<JFirmwareArtifactDownloadParams::javaobject> fromCpp(const FirmwareArtifactDownloadParams& value) {
|
|
78
|
-
using JSignature = JFirmwareArtifactDownloadParams(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>,
|
|
78
|
+
using JSignature = JFirmwareArtifactDownloadParams(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, 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::JString>, double, jni::alias_ref<jni::JDouble>);
|
|
79
79
|
static const auto clazz = javaClassStatic();
|
|
80
80
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
81
81
|
return create(
|
|
@@ -87,8 +87,8 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
87
87
|
jni::make_jstring(value.url),
|
|
88
88
|
jni::make_jstring(value.routeType),
|
|
89
89
|
value.resolvedIp.has_value() ? jni::make_jstring(value.resolvedIp.value()) : nullptr,
|
|
90
|
-
value.expectedSize,
|
|
91
|
-
jni::make_jstring(value.expectedSha256),
|
|
90
|
+
value.expectedSize.has_value() ? jni::JDouble::valueOf(value.expectedSize.value()) : nullptr,
|
|
91
|
+
value.expectedSha256.has_value() ? jni::make_jstring(value.expectedSha256.value()) : nullptr,
|
|
92
92
|
value.maxBytes,
|
|
93
93
|
value.overallDeadlineSeconds.has_value() ? jni::JDouble::valueOf(value.overallDeadlineSeconds.value()) : nullptr
|
|
94
94
|
);
|
|
@@ -37,10 +37,13 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
37
37
|
double size = this->getFieldValue(fieldSize);
|
|
38
38
|
static const auto fieldSha256 = clazz->getField<jni::JString>("sha256");
|
|
39
39
|
jni::local_ref<jni::JString> sha256 = this->getFieldValue(fieldSha256);
|
|
40
|
+
static const auto fieldExpectedSha256Verified = clazz->getField<jboolean>("expectedSha256Verified");
|
|
41
|
+
jboolean expectedSha256Verified = this->getFieldValue(fieldExpectedSha256Verified);
|
|
40
42
|
return FirmwareArtifactReceipt(
|
|
41
43
|
artifactRef->toStdString(),
|
|
42
44
|
size,
|
|
43
|
-
sha256->toStdString()
|
|
45
|
+
sha256->toStdString(),
|
|
46
|
+
static_cast<bool>(expectedSha256Verified)
|
|
44
47
|
);
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -50,14 +53,15 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
50
53
|
*/
|
|
51
54
|
[[maybe_unused]]
|
|
52
55
|
static jni::local_ref<JFirmwareArtifactReceipt::javaobject> fromCpp(const FirmwareArtifactReceipt& value) {
|
|
53
|
-
using JSignature = JFirmwareArtifactReceipt(jni::alias_ref<jni::JString>, double, jni::alias_ref<jni::JString
|
|
56
|
+
using JSignature = JFirmwareArtifactReceipt(jni::alias_ref<jni::JString>, double, jni::alias_ref<jni::JString>, jboolean);
|
|
54
57
|
static const auto clazz = javaClassStatic();
|
|
55
58
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
56
59
|
return create(
|
|
57
60
|
clazz,
|
|
58
61
|
jni::make_jstring(value.artifactRef),
|
|
59
62
|
value.size,
|
|
60
|
-
jni::make_jstring(value.sha256)
|
|
63
|
+
jni::make_jstring(value.sha256),
|
|
64
|
+
value.expectedSha256Verified
|
|
61
65
|
);
|
|
62
66
|
}
|
|
63
67
|
};
|
|
@@ -53,8 +53,6 @@ namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLe
|
|
|
53
53
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseRetainParams; }
|
|
54
54
|
// Forward declaration of `FirmwareArtifactLeaseReleaseParams` to properly resolve imports.
|
|
55
55
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReleaseParams; }
|
|
56
|
-
// Forward declaration of `FirmwareArtifactLeaseReconcileParams` to properly resolve imports.
|
|
57
|
-
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReconcileParams; }
|
|
58
56
|
|
|
59
57
|
#include "RangeDownloadResult.hpp"
|
|
60
58
|
#include <NitroModules/Promise.hpp>
|
|
@@ -113,8 +111,6 @@ namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLe
|
|
|
113
111
|
#include "JFirmwareArtifactLeaseRetainParams.hpp"
|
|
114
112
|
#include "FirmwareArtifactLeaseReleaseParams.hpp"
|
|
115
113
|
#include "JFirmwareArtifactLeaseReleaseParams.hpp"
|
|
116
|
-
#include "FirmwareArtifactLeaseReconcileParams.hpp"
|
|
117
|
-
#include "JFirmwareArtifactLeaseReconcileParams.hpp"
|
|
118
114
|
|
|
119
115
|
namespace margelo::nitro::reactnativerangedownloader {
|
|
120
116
|
|
|
@@ -368,21 +364,6 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
368
364
|
return __promise;
|
|
369
365
|
}();
|
|
370
366
|
}
|
|
371
|
-
std::shared_ptr<Promise<void>> JHybridReactNativeRangeDownloaderSpec::reconcileFirmwareArtifactLeases(const FirmwareArtifactLeaseReconcileParams& params) {
|
|
372
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JFirmwareArtifactLeaseReconcileParams> /* params */)>("reconcileFirmwareArtifactLeases");
|
|
373
|
-
auto __result = method(_javaPart, JFirmwareArtifactLeaseReconcileParams::fromCpp(params));
|
|
374
|
-
return [&]() {
|
|
375
|
-
auto __promise = Promise<void>::create();
|
|
376
|
-
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
377
|
-
__promise->resolve();
|
|
378
|
-
});
|
|
379
|
-
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
380
|
-
jni::JniException __jniError(__throwable);
|
|
381
|
-
__promise->reject(std::make_exception_ptr(__jniError));
|
|
382
|
-
});
|
|
383
|
-
return __promise;
|
|
384
|
-
}();
|
|
385
|
-
}
|
|
386
367
|
std::shared_ptr<Promise<FirmwareArtifactSweepResult>> JHybridReactNativeRangeDownloaderSpec::sweepFirmwareArtifactOrphans() {
|
|
387
368
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("sweepFirmwareArtifactOrphans");
|
|
388
369
|
auto __result = method(_javaPart);
|
|
@@ -71,7 +71,6 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
71
71
|
std::shared_ptr<Promise<FirmwareArtifactLease>> createFirmwareArtifactLease(const FirmwareArtifactLeaseCreateParams& params) override;
|
|
72
72
|
std::shared_ptr<Promise<void>> retainFirmwareArtifact(const FirmwareArtifactLeaseRetainParams& params) override;
|
|
73
73
|
std::shared_ptr<Promise<void>> releaseFirmwareArtifactLease(const FirmwareArtifactLeaseReleaseParams& params) override;
|
|
74
|
-
std::shared_ptr<Promise<void>> reconcileFirmwareArtifactLeases(const FirmwareArtifactLeaseReconcileParams& params) override;
|
|
75
74
|
std::shared_ptr<Promise<FirmwareArtifactSweepResult>> sweepFirmwareArtifactOrphans() override;
|
|
76
75
|
|
|
77
76
|
private:
|
|
@@ -25,7 +25,7 @@ data class FirmwareArchiveMaterializeParams(
|
|
|
25
25
|
val archiveArtifactRef: String,
|
|
26
26
|
@DoNotStrip
|
|
27
27
|
@Keep
|
|
28
|
-
val expectedEntries: Array<FirmwareArchiveExpectedEntry
|
|
28
|
+
val expectedEntries: Array<FirmwareArchiveExpectedEntry>?
|
|
29
29
|
) {
|
|
30
30
|
/* primary constructor */
|
|
31
31
|
|
|
@@ -37,7 +37,7 @@ data class FirmwareArchiveMaterializeParams(
|
|
|
37
37
|
@Keep
|
|
38
38
|
@Suppress("unused")
|
|
39
39
|
@JvmStatic
|
|
40
|
-
private fun fromCpp(leaseRef: String, archiveArtifactRef: String, expectedEntries: Array<FirmwareArchiveExpectedEntry
|
|
40
|
+
private fun fromCpp(leaseRef: String, archiveArtifactRef: String, expectedEntries: Array<FirmwareArchiveExpectedEntry>?): FirmwareArchiveMaterializeParams {
|
|
41
41
|
return FirmwareArchiveMaterializeParams(leaseRef, archiveArtifactRef, expectedEntries)
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -40,10 +40,10 @@ data class FirmwareArtifactDownloadParams(
|
|
|
40
40
|
val resolvedIp: String?,
|
|
41
41
|
@DoNotStrip
|
|
42
42
|
@Keep
|
|
43
|
-
val expectedSize: Double
|
|
43
|
+
val expectedSize: Double?,
|
|
44
44
|
@DoNotStrip
|
|
45
45
|
@Keep
|
|
46
|
-
val expectedSha256: String
|
|
46
|
+
val expectedSha256: String?,
|
|
47
47
|
@DoNotStrip
|
|
48
48
|
@Keep
|
|
49
49
|
val maxBytes: Double,
|
|
@@ -61,7 +61,7 @@ data class FirmwareArtifactDownloadParams(
|
|
|
61
61
|
@Keep
|
|
62
62
|
@Suppress("unused")
|
|
63
63
|
@JvmStatic
|
|
64
|
-
private fun fromCpp(taskId: String, transactionId: String, leaseRef: String, artifactId: String, url: String, routeType: String, resolvedIp: String?, expectedSize: Double
|
|
64
|
+
private fun fromCpp(taskId: String, transactionId: String, leaseRef: String, artifactId: String, url: String, routeType: String, resolvedIp: String?, expectedSize: Double?, expectedSha256: String?, maxBytes: Double, overallDeadlineSeconds: Double?): FirmwareArtifactDownloadParams {
|
|
65
65
|
return FirmwareArtifactDownloadParams(taskId, transactionId, leaseRef, artifactId, url, routeType, resolvedIp, expectedSize, expectedSha256, maxBytes, overallDeadlineSeconds)
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -25,7 +25,10 @@ data class FirmwareArtifactReceipt(
|
|
|
25
25
|
val size: Double,
|
|
26
26
|
@DoNotStrip
|
|
27
27
|
@Keep
|
|
28
|
-
val sha256: String
|
|
28
|
+
val sha256: String,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val expectedSha256Verified: Boolean
|
|
29
32
|
) {
|
|
30
33
|
/* primary constructor */
|
|
31
34
|
|
|
@@ -37,8 +40,8 @@ data class FirmwareArtifactReceipt(
|
|
|
37
40
|
@Keep
|
|
38
41
|
@Suppress("unused")
|
|
39
42
|
@JvmStatic
|
|
40
|
-
private fun fromCpp(artifactRef: String, size: Double, sha256: String): FirmwareArtifactReceipt {
|
|
41
|
-
return FirmwareArtifactReceipt(artifactRef, size, sha256)
|
|
43
|
+
private fun fromCpp(artifactRef: String, size: Double, sha256: String, expectedSha256Verified: Boolean): FirmwareArtifactReceipt {
|
|
44
|
+
return FirmwareArtifactReceipt(artifactRef, size, sha256, expectedSha256Verified)
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -120,10 +120,6 @@ abstract class HybridReactNativeRangeDownloaderSpec: HybridObject() {
|
|
|
120
120
|
@Keep
|
|
121
121
|
abstract fun releaseFirmwareArtifactLease(params: FirmwareArtifactLeaseReleaseParams): Promise<Unit>
|
|
122
122
|
|
|
123
|
-
@DoNotStrip
|
|
124
|
-
@Keep
|
|
125
|
-
abstract fun reconcileFirmwareArtifactLeases(params: FirmwareArtifactLeaseReconcileParams): Promise<Unit>
|
|
126
|
-
|
|
127
123
|
@DoNotStrip
|
|
128
124
|
@Keep
|
|
129
125
|
abstract fun sweepFirmwareArtifactOrphans(): Promise<FirmwareArtifactSweepResult>
|
|
@@ -402,6 +402,21 @@ namespace margelo::nitro::reactnativerangedownloader::bridge::swift {
|
|
|
402
402
|
return vector;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
+
// pragma MARK: std::optional<std::vector<FirmwareArchiveExpectedEntry>>
|
|
406
|
+
/**
|
|
407
|
+
* Specialized version of `std::optional<std::vector<FirmwareArchiveExpectedEntry>>`.
|
|
408
|
+
*/
|
|
409
|
+
using std__optional_std__vector_FirmwareArchiveExpectedEntry__ = std::optional<std::vector<FirmwareArchiveExpectedEntry>>;
|
|
410
|
+
inline std::optional<std::vector<FirmwareArchiveExpectedEntry>> create_std__optional_std__vector_FirmwareArchiveExpectedEntry__(const std::vector<FirmwareArchiveExpectedEntry>& value) noexcept {
|
|
411
|
+
return std::optional<std::vector<FirmwareArchiveExpectedEntry>>(value);
|
|
412
|
+
}
|
|
413
|
+
inline bool has_value_std__optional_std__vector_FirmwareArchiveExpectedEntry__(const std::optional<std::vector<FirmwareArchiveExpectedEntry>>& optional) noexcept {
|
|
414
|
+
return optional.has_value();
|
|
415
|
+
}
|
|
416
|
+
inline std::vector<FirmwareArchiveExpectedEntry> get_std__optional_std__vector_FirmwareArchiveExpectedEntry__(const std::optional<std::vector<FirmwareArchiveExpectedEntry>>& optional) noexcept {
|
|
417
|
+
return *optional;
|
|
418
|
+
}
|
|
419
|
+
|
|
405
420
|
// pragma MARK: std::shared_ptr<Promise<FirmwareArtifactLease>>
|
|
406
421
|
/**
|
|
407
422
|
* Specialized version of `std::shared_ptr<Promise<FirmwareArtifactLease>>`.
|
|
@@ -26,8 +26,6 @@ namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactCa
|
|
|
26
26
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactDownloadParams; }
|
|
27
27
|
// Forward declaration of `FirmwareArtifactLeaseCreateParams` to properly resolve imports.
|
|
28
28
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseCreateParams; }
|
|
29
|
-
// Forward declaration of `FirmwareArtifactLeaseReconcileParams` to properly resolve imports.
|
|
30
|
-
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReconcileParams; }
|
|
31
29
|
// Forward declaration of `FirmwareArtifactLeaseReleaseParams` to properly resolve imports.
|
|
32
30
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReleaseParams; }
|
|
33
31
|
// Forward declaration of `FirmwareArtifactLeaseRetainParams` to properly resolve imports.
|
|
@@ -70,7 +68,6 @@ namespace margelo::nitro::reactnativerangedownloader { enum class RangeFallbackK
|
|
|
70
68
|
#include "FirmwareArtifactDownloadParams.hpp"
|
|
71
69
|
#include "FirmwareArtifactLease.hpp"
|
|
72
70
|
#include "FirmwareArtifactLeaseCreateParams.hpp"
|
|
73
|
-
#include "FirmwareArtifactLeaseReconcileParams.hpp"
|
|
74
71
|
#include "FirmwareArtifactLeaseReleaseParams.hpp"
|
|
75
72
|
#include "FirmwareArtifactLeaseRetainParams.hpp"
|
|
76
73
|
#include "FirmwareArtifactReaderCloseParams.hpp"
|
|
@@ -58,8 +58,6 @@ namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLe
|
|
|
58
58
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseRetainParams; }
|
|
59
59
|
// Forward declaration of `FirmwareArtifactLeaseReleaseParams` to properly resolve imports.
|
|
60
60
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReleaseParams; }
|
|
61
|
-
// Forward declaration of `FirmwareArtifactLeaseReconcileParams` to properly resolve imports.
|
|
62
|
-
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReconcileParams; }
|
|
63
61
|
// Forward declaration of `FirmwareArtifactSweepResult` to properly resolve imports.
|
|
64
62
|
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactSweepResult; }
|
|
65
63
|
|
|
@@ -92,7 +90,6 @@ namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactSw
|
|
|
92
90
|
#include "FirmwareArtifactLeaseCreateParams.hpp"
|
|
93
91
|
#include "FirmwareArtifactLeaseRetainParams.hpp"
|
|
94
92
|
#include "FirmwareArtifactLeaseReleaseParams.hpp"
|
|
95
|
-
#include "FirmwareArtifactLeaseReconcileParams.hpp"
|
|
96
93
|
#include "FirmwareArtifactSweepResult.hpp"
|
|
97
94
|
|
|
98
95
|
#include "ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp"
|
|
@@ -273,14 +270,6 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
273
270
|
auto __value = std::move(__result.value());
|
|
274
271
|
return __value;
|
|
275
272
|
}
|
|
276
|
-
inline std::shared_ptr<Promise<void>> reconcileFirmwareArtifactLeases(const FirmwareArtifactLeaseReconcileParams& params) override {
|
|
277
|
-
auto __result = _swiftPart.reconcileFirmwareArtifactLeases(std::forward<decltype(params)>(params));
|
|
278
|
-
if (__result.hasError()) [[unlikely]] {
|
|
279
|
-
std::rethrow_exception(__result.error());
|
|
280
|
-
}
|
|
281
|
-
auto __value = std::move(__result.value());
|
|
282
|
-
return __value;
|
|
283
|
-
}
|
|
284
273
|
inline std::shared_ptr<Promise<FirmwareArtifactSweepResult>> sweepFirmwareArtifactOrphans() override {
|
|
285
274
|
auto __result = _swiftPart.sweepFirmwareArtifactOrphans();
|
|
286
275
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -19,13 +19,19 @@ public extension FirmwareArchiveMaterializeParams {
|
|
|
19
19
|
/**
|
|
20
20
|
* Create a new instance of `FirmwareArchiveMaterializeParams`.
|
|
21
21
|
*/
|
|
22
|
-
init(leaseRef: String, archiveArtifactRef: String, expectedEntries: [FirmwareArchiveExpectedEntry]) {
|
|
23
|
-
self.init(std.string(leaseRef), std.string(archiveArtifactRef), { () -> bridge.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
init(leaseRef: String, archiveArtifactRef: String, expectedEntries: [FirmwareArchiveExpectedEntry]?) {
|
|
23
|
+
self.init(std.string(leaseRef), std.string(archiveArtifactRef), { () -> bridge.std__optional_std__vector_FirmwareArchiveExpectedEntry__ in
|
|
24
|
+
if let __unwrappedValue = expectedEntries {
|
|
25
|
+
return bridge.create_std__optional_std__vector_FirmwareArchiveExpectedEntry__({ () -> bridge.std__vector_FirmwareArchiveExpectedEntry_ in
|
|
26
|
+
var __vector = bridge.create_std__vector_FirmwareArchiveExpectedEntry_(__unwrappedValue.count)
|
|
27
|
+
for __item in __unwrappedValue {
|
|
28
|
+
__vector.push_back(__item)
|
|
29
|
+
}
|
|
30
|
+
return __vector
|
|
31
|
+
}())
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
27
34
|
}
|
|
28
|
-
return __vector
|
|
29
35
|
}())
|
|
30
36
|
}
|
|
31
37
|
|
|
@@ -51,19 +57,32 @@ public extension FirmwareArchiveMaterializeParams {
|
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
var expectedEntries: [FirmwareArchiveExpectedEntry] {
|
|
60
|
+
var expectedEntries: [FirmwareArchiveExpectedEntry]? {
|
|
55
61
|
@inline(__always)
|
|
56
62
|
get {
|
|
57
|
-
return
|
|
63
|
+
return { () -> [FirmwareArchiveExpectedEntry]? in
|
|
64
|
+
if bridge.has_value_std__optional_std__vector_FirmwareArchiveExpectedEntry__(self.__expectedEntries) {
|
|
65
|
+
let __unwrapped = bridge.get_std__optional_std__vector_FirmwareArchiveExpectedEntry__(self.__expectedEntries)
|
|
66
|
+
return __unwrapped.map({ __item in __item })
|
|
67
|
+
} else {
|
|
68
|
+
return nil
|
|
69
|
+
}
|
|
70
|
+
}()
|
|
58
71
|
}
|
|
59
72
|
@inline(__always)
|
|
60
73
|
set {
|
|
61
|
-
self.__expectedEntries = { () -> bridge.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
self.__expectedEntries = { () -> bridge.std__optional_std__vector_FirmwareArchiveExpectedEntry__ in
|
|
75
|
+
if let __unwrappedValue = newValue {
|
|
76
|
+
return bridge.create_std__optional_std__vector_FirmwareArchiveExpectedEntry__({ () -> bridge.std__vector_FirmwareArchiveExpectedEntry_ in
|
|
77
|
+
var __vector = bridge.create_std__vector_FirmwareArchiveExpectedEntry_(__unwrappedValue.count)
|
|
78
|
+
for __item in __unwrappedValue {
|
|
79
|
+
__vector.push_back(__item)
|
|
80
|
+
}
|
|
81
|
+
return __vector
|
|
82
|
+
}())
|
|
83
|
+
} else {
|
|
84
|
+
return .init()
|
|
65
85
|
}
|
|
66
|
-
return __vector
|
|
67
86
|
}()
|
|
68
87
|
}
|
|
69
88
|
}
|
|
@@ -19,14 +19,26 @@ public extension FirmwareArtifactDownloadParams {
|
|
|
19
19
|
/**
|
|
20
20
|
* Create a new instance of `FirmwareArtifactDownloadParams`.
|
|
21
21
|
*/
|
|
22
|
-
init(taskId: String, transactionId: String, leaseRef: String, artifactId: String, url: String, routeType: String, resolvedIp: String?, expectedSize: Double
|
|
22
|
+
init(taskId: String, transactionId: String, leaseRef: String, artifactId: String, url: String, routeType: String, resolvedIp: String?, expectedSize: Double?, expectedSha256: String?, maxBytes: Double, overallDeadlineSeconds: Double?) {
|
|
23
23
|
self.init(std.string(taskId), std.string(transactionId), std.string(leaseRef), std.string(artifactId), std.string(url), std.string(routeType), { () -> bridge.std__optional_std__string_ in
|
|
24
24
|
if let __unwrappedValue = resolvedIp {
|
|
25
25
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
26
26
|
} else {
|
|
27
27
|
return .init()
|
|
28
28
|
}
|
|
29
|
-
}(),
|
|
29
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
30
|
+
if let __unwrappedValue = expectedSize {
|
|
31
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
36
|
+
if let __unwrappedValue = expectedSha256 {
|
|
37
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
38
|
+
} else {
|
|
39
|
+
return .init()
|
|
40
|
+
}
|
|
41
|
+
}(), maxBytes, { () -> bridge.std__optional_double_ in
|
|
30
42
|
if let __unwrappedValue = overallDeadlineSeconds {
|
|
31
43
|
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
32
44
|
} else {
|
|
@@ -125,25 +137,44 @@ public extension FirmwareArtifactDownloadParams {
|
|
|
125
137
|
}
|
|
126
138
|
}
|
|
127
139
|
|
|
128
|
-
var expectedSize: Double {
|
|
140
|
+
var expectedSize: Double? {
|
|
129
141
|
@inline(__always)
|
|
130
142
|
get {
|
|
131
|
-
return self.__expectedSize
|
|
143
|
+
return self.__expectedSize.value
|
|
132
144
|
}
|
|
133
145
|
@inline(__always)
|
|
134
146
|
set {
|
|
135
|
-
self.__expectedSize =
|
|
147
|
+
self.__expectedSize = { () -> bridge.std__optional_double_ in
|
|
148
|
+
if let __unwrappedValue = newValue {
|
|
149
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
150
|
+
} else {
|
|
151
|
+
return .init()
|
|
152
|
+
}
|
|
153
|
+
}()
|
|
136
154
|
}
|
|
137
155
|
}
|
|
138
156
|
|
|
139
|
-
var expectedSha256: String {
|
|
157
|
+
var expectedSha256: String? {
|
|
140
158
|
@inline(__always)
|
|
141
159
|
get {
|
|
142
|
-
return
|
|
160
|
+
return { () -> String? in
|
|
161
|
+
if bridge.has_value_std__optional_std__string_(self.__expectedSha256) {
|
|
162
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__expectedSha256)
|
|
163
|
+
return String(__unwrapped)
|
|
164
|
+
} else {
|
|
165
|
+
return nil
|
|
166
|
+
}
|
|
167
|
+
}()
|
|
143
168
|
}
|
|
144
169
|
@inline(__always)
|
|
145
170
|
set {
|
|
146
|
-
self.__expectedSha256 =
|
|
171
|
+
self.__expectedSha256 = { () -> bridge.std__optional_std__string_ in
|
|
172
|
+
if let __unwrappedValue = newValue {
|
|
173
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
174
|
+
} else {
|
|
175
|
+
return .init()
|
|
176
|
+
}
|
|
177
|
+
}()
|
|
147
178
|
}
|
|
148
179
|
}
|
|
149
180
|
|
|
@@ -19,8 +19,8 @@ public extension FirmwareArtifactReceipt {
|
|
|
19
19
|
/**
|
|
20
20
|
* Create a new instance of `FirmwareArtifactReceipt`.
|
|
21
21
|
*/
|
|
22
|
-
init(artifactRef: String, size: Double, sha256: String) {
|
|
23
|
-
self.init(std.string(artifactRef), size, std.string(sha256))
|
|
22
|
+
init(artifactRef: String, size: Double, sha256: String, expectedSha256Verified: Bool) {
|
|
23
|
+
self.init(std.string(artifactRef), size, std.string(sha256), expectedSha256Verified)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
var artifactRef: String {
|
|
@@ -55,4 +55,15 @@ public extension FirmwareArtifactReceipt {
|
|
|
55
55
|
self.__sha256 = std.string(newValue)
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
var expectedSha256Verified: Bool {
|
|
60
|
+
@inline(__always)
|
|
61
|
+
get {
|
|
62
|
+
return self.__expectedSha256Verified
|
|
63
|
+
}
|
|
64
|
+
@inline(__always)
|
|
65
|
+
set {
|
|
66
|
+
self.__expectedSha256Verified = newValue
|
|
67
|
+
}
|
|
68
|
+
}
|
|
58
69
|
}
|
|
@@ -31,7 +31,6 @@ public protocol HybridReactNativeRangeDownloaderSpec_protocol: HybridObject {
|
|
|
31
31
|
func createFirmwareArtifactLease(params: FirmwareArtifactLeaseCreateParams) throws -> Promise<FirmwareArtifactLease>
|
|
32
32
|
func retainFirmwareArtifact(params: FirmwareArtifactLeaseRetainParams) throws -> Promise<Void>
|
|
33
33
|
func releaseFirmwareArtifactLease(params: FirmwareArtifactLeaseReleaseParams) throws -> Promise<Void>
|
|
34
|
-
func reconcileFirmwareArtifactLeases(params: FirmwareArtifactLeaseReconcileParams) throws -> Promise<Void>
|
|
35
34
|
func sweepFirmwareArtifactOrphans() throws -> Promise<FirmwareArtifactSweepResult>
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -416,25 +416,6 @@ open class HybridReactNativeRangeDownloaderSpec_cxx {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
@inline(__always)
|
|
420
|
-
public final func reconcileFirmwareArtifactLeases(params: FirmwareArtifactLeaseReconcileParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
421
|
-
do {
|
|
422
|
-
let __result = try self.__implementation.reconcileFirmwareArtifactLeases(params: params)
|
|
423
|
-
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
424
|
-
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
425
|
-
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
426
|
-
__result
|
|
427
|
-
.then({ __result in __promiseHolder.resolve() })
|
|
428
|
-
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
429
|
-
return __promise
|
|
430
|
-
}()
|
|
431
|
-
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
432
|
-
} catch (let __error) {
|
|
433
|
-
let __exceptionPtr = __error.toCpp()
|
|
434
|
-
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
419
|
@inline(__always)
|
|
439
420
|
public final func sweepFirmwareArtifactOrphans() -> bridge.Result_std__shared_ptr_Promise_FirmwareArtifactSweepResult___ {
|
|
440
421
|
do {
|