@npaw/forge-react-native 9.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/LICENSE +10 -0
- package/NPAWForgeReactNative.podspec +44 -0
- package/README.md +51 -0
- package/android/build.gradle +77 -0
- package/android/src/main/AndroidManifest.xml +14 -0
- package/android/src/main/java/com/npaw/forge/reactnative/ForgeDtoMapper.java +295 -0
- package/android/src/main/java/com/npaw/forge/reactnative/ForgeInstanceRegistry.java +61 -0
- package/android/src/main/java/com/npaw/forge/reactnative/NPAWForgeModule.java +735 -0
- package/android/src/main/java/com/npaw/forge/reactnative/NPAWForgePackage.java +53 -0
- package/android/src/test/java/com/npaw/forge/reactnative/ForgeDtoMapperTest.java +133 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/Info.plist +82 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/Headers/ForgeKernelFFI.h +17 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/Headers/forge_kernelFFI.h +873 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/Headers/module.modulemap +7 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/libForgeKernelFFI.a +0 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/Headers/ForgeKernelFFI.h +17 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/Headers/forge_kernelFFI.h +873 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap +7 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/libForgeKernelFFI.a +0 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/Headers/ForgeKernelFFI.h +17 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/Headers/forge_kernelFFI.h +873 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/Headers/module.modulemap +7 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/libForgeKernelFFI.a +0 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/Headers/ForgeKernelFFI.h +17 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/Headers/forge_kernelFFI.h +873 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/Headers/module.modulemap +7 -0
- package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/libForgeKernelFFI.a +0 -0
- package/ios/ForgeApple/Sources/ForgeKernelUniFFI/forge_kernel.swift +3931 -0
- package/ios/ForgeApple/Sources/ForgeKernelUniFFI/forge_kernelFFI.h +873 -0
- package/ios/ForgeApple/Sources/ForgeKernelUniFFI/forge_kernelFFI.modulemap +7 -0
- package/ios/ForgeApple/Sources/NPAWForgeAVPlayerAdapter/AVPlayerAccessLogFacts.swift +152 -0
- package/ios/ForgeApple/Sources/NPAWForgeAVPlayerAdapter/AVPlayerAdapter.swift +877 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/AttributionCapture.swift +158 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/CapturePlanGate.swift +189 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/CrashCapture.swift +120 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/ForgeAutomaticCapture.swift +639 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsCapture.swift +1176 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsEngine.swift +674 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsMarkers.swift +105 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsSwiftUI.swift +284 -0
- package/ios/ForgeApple/Sources/NPAWForgeCapture/SwiftUICapture.swift +44 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/AdAdapter.swift +199 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/AdSemantics.swift +136 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeApple.swift +596 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeCapturePlan.swift +297 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeClock.swift +29 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeLogging.swift +109 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeOutcome.swift +89 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeRuntime.swift +291 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeStorage.swift +70 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ManualAdReporter.swift +180 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/NPAWForge.swift +453 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/NativeUniFFIRuntime.swift +594 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/NetworkRequestRecord.swift +191 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/ObjectiveCWrappers.swift +191 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/PlayerAdapter.swift +299 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/PlayerSemantics.swift +266 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/PrivacySanitizer.swift +59 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/VideoAdapter.swift +478 -0
- package/ios/ForgeApple/Sources/NPAWForgeCore/VideoOptions.swift +431 -0
- package/ios/ForgeApple/Sources/NPAWForgeNetworkCapture/ForgeNetworkCapture.swift +116 -0
- package/ios/ForgeApple/Sources/NPAWForgeNetworkCaptureObjC/NPAWForgeNetworkSwizzler.m +293 -0
- package/ios/ForgeApple/Sources/NPAWForgeNetworkCaptureObjC/include/NPAWForgeNetworkSwizzler.h +33 -0
- package/ios/ForgeModuleImpl.swift +1131 -0
- package/ios/NPAWForgeTurboModule.mm +399 -0
- package/package.json +33 -0
- package/src/ForgeAdReporter.ts +101 -0
- package/src/ForgeVideo.ts +169 -0
- package/src/NPAWForge.ts +177 -0
- package/src/capture.ts +192 -0
- package/src/events.ts +40 -0
- package/src/index.ts +37 -0
- package/src/specs/NativeNPAWForge.ts +168 -0
- package/src/types.ts +114 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) NPAW - All Rights Reserved
|
|
3
|
+
*
|
|
4
|
+
* This source code is protected under international copyright law. All rights
|
|
5
|
+
* reserved and protected by the copyright holders.
|
|
6
|
+
* This file is confidential and only available to authorized individuals with the
|
|
7
|
+
* permission of the copyright holders. If you encounter this file and do not have
|
|
8
|
+
* permission, please contact the copyright holders and delete this file.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @author: Victor Soto <victor.soto@nicepeopleatwork.com>
|
|
12
|
+
* @description: React package registering the core NPAWForge TurboModule for autolinking.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
package com.npaw.forge.reactnative;
|
|
16
|
+
|
|
17
|
+
import com.facebook.react.TurboReactPackage;
|
|
18
|
+
import com.facebook.react.bridge.NativeModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
20
|
+
import com.facebook.react.module.model.ReactModuleInfo;
|
|
21
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
22
|
+
import java.util.HashMap;
|
|
23
|
+
import java.util.Map;
|
|
24
|
+
import androidx.annotation.Nullable;
|
|
25
|
+
|
|
26
|
+
public class NPAWForgePackage extends TurboReactPackage {
|
|
27
|
+
|
|
28
|
+
@Nullable
|
|
29
|
+
@Override
|
|
30
|
+
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
31
|
+
if (NPAWForgeModule.NAME.equals(name)) {
|
|
32
|
+
return new NPAWForgeModule(reactContext);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
39
|
+
return () -> {
|
|
40
|
+
Map<String, ReactModuleInfo> modules = new HashMap<>();
|
|
41
|
+
modules.put(
|
|
42
|
+
NPAWForgeModule.NAME,
|
|
43
|
+
new ReactModuleInfo(
|
|
44
|
+
NPAWForgeModule.NAME,
|
|
45
|
+
NPAWForgeModule.class.getName(),
|
|
46
|
+
false,
|
|
47
|
+
false,
|
|
48
|
+
false,
|
|
49
|
+
true));
|
|
50
|
+
return modules;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) NPAW - All Rights Reserved
|
|
3
|
+
*
|
|
4
|
+
* This source code is protected under international copyright law. All rights
|
|
5
|
+
* reserved and protected by the copyright holders.
|
|
6
|
+
* This file is confidential and only available to authorized individuals with the
|
|
7
|
+
* permission of the copyright holders. If you encounter this file and do not have
|
|
8
|
+
* permission, please contact the copyright holders and delete this file.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @author: Victor Soto <victor.soto@nicepeopleatwork.com>
|
|
12
|
+
* @description: JVM unit tests for the RN bridge DTO conversions (JavaOnlyMap inputs; no Android runtime or bridge natives required).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
package com.npaw.forge.reactnative;
|
|
16
|
+
|
|
17
|
+
import static org.junit.Assert.assertEquals;
|
|
18
|
+
import static org.junit.Assert.assertNull;
|
|
19
|
+
import static org.junit.Assert.assertTrue;
|
|
20
|
+
|
|
21
|
+
import com.facebook.react.bridge.JavaOnlyMap;
|
|
22
|
+
import com.npaw.forge.android.NPAWForge;
|
|
23
|
+
import com.npaw.forge.android.network.NetworkRequestOutcome;
|
|
24
|
+
import com.npaw.forge.android.network.NetworkRequestRecord;
|
|
25
|
+
import com.npaw.forge.android.network.NetworkRequestSource;
|
|
26
|
+
import java.util.HashMap;
|
|
27
|
+
import java.util.Map;
|
|
28
|
+
import org.junit.Test;
|
|
29
|
+
|
|
30
|
+
public class ForgeDtoMapperTest {
|
|
31
|
+
|
|
32
|
+
@Test
|
|
33
|
+
public void toStringMapCoercesNumbersAndBooleans() {
|
|
34
|
+
JavaOnlyMap map = new JavaOnlyMap();
|
|
35
|
+
map.putString("title", "BBB");
|
|
36
|
+
map.putInt("count", 12);
|
|
37
|
+
map.putDouble("playhead", 4.5);
|
|
38
|
+
map.putBoolean("isLive", false);
|
|
39
|
+
map.putNull("skipped");
|
|
40
|
+
|
|
41
|
+
Map<String, String> result = ForgeDtoMapper.toStringMap(map);
|
|
42
|
+
|
|
43
|
+
assertEquals("BBB", result.get("title"));
|
|
44
|
+
assertEquals("12", result.get("count"));
|
|
45
|
+
assertEquals("4.5", result.get("playhead"));
|
|
46
|
+
assertEquals("false", result.get("isLive"));
|
|
47
|
+
assertTrue(!result.containsKey("skipped"));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Test
|
|
51
|
+
public void toDoubleMapKeepsOnlyNumbers() {
|
|
52
|
+
JavaOnlyMap map = new JavaOnlyMap();
|
|
53
|
+
map.putDouble("index", 2.0);
|
|
54
|
+
map.putString("name", "x");
|
|
55
|
+
|
|
56
|
+
Map<String, Double> result = ForgeDtoMapper.toDoubleMap(map);
|
|
57
|
+
|
|
58
|
+
assertEquals(Double.valueOf(2.0), result.get("index"));
|
|
59
|
+
assertEquals(1, result.size());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Test
|
|
63
|
+
public void emptyToNullSentinels() {
|
|
64
|
+
assertNull(ForgeDtoMapper.emptyToNull(""));
|
|
65
|
+
assertNull(ForgeDtoMapper.emptyToNull(null));
|
|
66
|
+
assertEquals("x", ForgeDtoMapper.emptyToNull("x"));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@Test
|
|
70
|
+
public void networkRecordMapsFieldsOutcomeAndNullables() {
|
|
71
|
+
JavaOnlyMap map = new JavaOnlyMap();
|
|
72
|
+
map.putString("targetUrl", "https://cdn.example/x.ts");
|
|
73
|
+
map.putString("method", "GET");
|
|
74
|
+
map.putInt("responseStatusCode", 404);
|
|
75
|
+
map.putInt("durationMs", 42);
|
|
76
|
+
map.putString("outcome", "http_error");
|
|
77
|
+
map.putString("protocol", "h2");
|
|
78
|
+
map.putInt("redirectCount", 1);
|
|
79
|
+
map.putInt("requestBytes", 100);
|
|
80
|
+
|
|
81
|
+
NetworkRequestRecord record = ForgeDtoMapper.toNetworkRequestRecord(map);
|
|
82
|
+
|
|
83
|
+
assertEquals("https://cdn.example/x.ts", record.getTargetUrl());
|
|
84
|
+
assertEquals("GET", record.getMethod());
|
|
85
|
+
assertEquals(404, record.getResponseStatusCode());
|
|
86
|
+
assertEquals(42L, record.getDurationMs());
|
|
87
|
+
assertEquals(NetworkRequestOutcome.HttpError, record.getOutcome());
|
|
88
|
+
assertEquals(NetworkRequestSource.Manual, record.getSource());
|
|
89
|
+
assertEquals("h2", record.getProtocol());
|
|
90
|
+
assertEquals(Integer.valueOf(1), record.getRedirectCount());
|
|
91
|
+
assertEquals(Long.valueOf(100L), record.getRequestBytes());
|
|
92
|
+
assertNull(record.getDnsDurationMs());
|
|
93
|
+
assertNull(record.getErrorMessage());
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@Test
|
|
97
|
+
public void networkRecordUnknownOutcomeFallsBack() {
|
|
98
|
+
JavaOnlyMap map = new JavaOnlyMap();
|
|
99
|
+
map.putString("targetUrl", "https://x");
|
|
100
|
+
map.putString("outcome", "not-a-thing");
|
|
101
|
+
|
|
102
|
+
assertEquals(NetworkRequestOutcome.Unknown, ForgeDtoMapper.toNetworkRequestRecord(map).getOutcome());
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@Test
|
|
106
|
+
public void applyConfigAcceptsCanonicalKeysAndIgnoresUnknowns() {
|
|
107
|
+
// Builder setters store values without touching the native runtime, so a
|
|
108
|
+
// real Builder is safe on the JVM; the assertion is exception-freedom for
|
|
109
|
+
// the full canonical key set plus forward-compatible unknown keys.
|
|
110
|
+
NPAWForge.Builder builder = new NPAWForge.Builder("npawdemodev");
|
|
111
|
+
JavaOnlyMap config = new JavaOnlyMap();
|
|
112
|
+
config.putString("appName", "Test");
|
|
113
|
+
config.putString("appReleaseVersion", "1.2.3");
|
|
114
|
+
config.putString("buildVariant", "debug");
|
|
115
|
+
config.putString("lmaEndpoint", "https://lma-stage.npaw.com");
|
|
116
|
+
config.putString("analyticsUserAgent", "ua");
|
|
117
|
+
config.putString("logLevel", "trace");
|
|
118
|
+
config.putBoolean("startSessionOnInitialize", true);
|
|
119
|
+
config.putBoolean("processEventsBeforeSessionStart", true);
|
|
120
|
+
config.putInt("preSessionEventQueueLimitEvents", 50);
|
|
121
|
+
config.putInt("preSessionEventQueueMaxAgeMs", 60000);
|
|
122
|
+
config.putBoolean("allowLocalHttpForTesting", true);
|
|
123
|
+
config.putString("deviceUuid", "abc");
|
|
124
|
+
config.putBoolean("autoDeviceIdentityEnabled", true);
|
|
125
|
+
config.putString("someFutureKey", "ignored");
|
|
126
|
+
|
|
127
|
+
ForgeDtoMapper.applyConfig(builder, config);
|
|
128
|
+
|
|
129
|
+
HashMap<String, Object> echo = new HashMap<>();
|
|
130
|
+
echo.put("ok", true);
|
|
131
|
+
assertTrue((Boolean) echo.get("ok"));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>libForgeKernelFFI.a</string>
|
|
10
|
+
<key>HeadersPath</key>
|
|
11
|
+
<string>Headers</string>
|
|
12
|
+
<key>LibraryIdentifier</key>
|
|
13
|
+
<string>tvos-arm64</string>
|
|
14
|
+
<key>LibraryPath</key>
|
|
15
|
+
<string>libForgeKernelFFI.a</string>
|
|
16
|
+
<key>SupportedArchitectures</key>
|
|
17
|
+
<array>
|
|
18
|
+
<string>arm64</string>
|
|
19
|
+
</array>
|
|
20
|
+
<key>SupportedPlatform</key>
|
|
21
|
+
<string>tvos</string>
|
|
22
|
+
</dict>
|
|
23
|
+
<dict>
|
|
24
|
+
<key>BinaryPath</key>
|
|
25
|
+
<string>libForgeKernelFFI.a</string>
|
|
26
|
+
<key>HeadersPath</key>
|
|
27
|
+
<string>Headers</string>
|
|
28
|
+
<key>LibraryIdentifier</key>
|
|
29
|
+
<string>ios-arm64</string>
|
|
30
|
+
<key>LibraryPath</key>
|
|
31
|
+
<string>libForgeKernelFFI.a</string>
|
|
32
|
+
<key>SupportedArchitectures</key>
|
|
33
|
+
<array>
|
|
34
|
+
<string>arm64</string>
|
|
35
|
+
</array>
|
|
36
|
+
<key>SupportedPlatform</key>
|
|
37
|
+
<string>ios</string>
|
|
38
|
+
</dict>
|
|
39
|
+
<dict>
|
|
40
|
+
<key>BinaryPath</key>
|
|
41
|
+
<string>libForgeKernelFFI.a</string>
|
|
42
|
+
<key>HeadersPath</key>
|
|
43
|
+
<string>Headers</string>
|
|
44
|
+
<key>LibraryIdentifier</key>
|
|
45
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
46
|
+
<key>LibraryPath</key>
|
|
47
|
+
<string>libForgeKernelFFI.a</string>
|
|
48
|
+
<key>SupportedArchitectures</key>
|
|
49
|
+
<array>
|
|
50
|
+
<string>arm64</string>
|
|
51
|
+
<string>x86_64</string>
|
|
52
|
+
</array>
|
|
53
|
+
<key>SupportedPlatform</key>
|
|
54
|
+
<string>ios</string>
|
|
55
|
+
<key>SupportedPlatformVariant</key>
|
|
56
|
+
<string>simulator</string>
|
|
57
|
+
</dict>
|
|
58
|
+
<dict>
|
|
59
|
+
<key>BinaryPath</key>
|
|
60
|
+
<string>libForgeKernelFFI.a</string>
|
|
61
|
+
<key>HeadersPath</key>
|
|
62
|
+
<string>Headers</string>
|
|
63
|
+
<key>LibraryIdentifier</key>
|
|
64
|
+
<string>tvos-arm64-simulator</string>
|
|
65
|
+
<key>LibraryPath</key>
|
|
66
|
+
<string>libForgeKernelFFI.a</string>
|
|
67
|
+
<key>SupportedArchitectures</key>
|
|
68
|
+
<array>
|
|
69
|
+
<string>arm64</string>
|
|
70
|
+
</array>
|
|
71
|
+
<key>SupportedPlatform</key>
|
|
72
|
+
<string>tvos</string>
|
|
73
|
+
<key>SupportedPlatformVariant</key>
|
|
74
|
+
<string>simulator</string>
|
|
75
|
+
</dict>
|
|
76
|
+
</array>
|
|
77
|
+
<key>CFBundlePackageType</key>
|
|
78
|
+
<string>XFWK</string>
|
|
79
|
+
<key>XCFrameworkFormatVersion</key>
|
|
80
|
+
<string>1.0</string>
|
|
81
|
+
</dict>
|
|
82
|
+
</plist>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) NPAW - All Rights Reserved
|
|
3
|
+
*
|
|
4
|
+
* This source code is protected under international copyright law. All rights
|
|
5
|
+
* reserved and protected by the copyright holders.
|
|
6
|
+
* This file is confidential and only available to authorized individuals with the
|
|
7
|
+
* permission of the copyright holders. If you encounter this file and do not have
|
|
8
|
+
* permission, please contact the copyright holders and delete this file.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @author: Victor Soto <victor.soto@nicepeopleatwork.com>
|
|
12
|
+
* @description: Umbrella header for the generated Forge Apple UniFFI C declarations.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
#pragma once
|
|
16
|
+
|
|
17
|
+
#include "forge_kernelFFI.h"
|