@multiplayer-app/session-recorder-react-native 0.0.1-alpha.1 → 0.0.1-alpha.10
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/RRWEB_INTEGRATION.md +336 -0
- package/VIEWSHOT_INTEGRATION_TEST.md +123 -0
- package/copy-react-native-dist.sh +38 -0
- package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.d.ts +6 -0
- package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js +1 -0
- package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js.map +1 -0
- package/dist/components/GestureCaptureWrapper/index.d.ts +1 -0
- package/dist/components/GestureCaptureWrapper/index.js +1 -0
- package/dist/components/GestureCaptureWrapper/index.js.map +1 -0
- package/dist/components/GestureCaptureWrapper.d.ts +6 -0
- package/dist/components/GestureCaptureWrapper.js +1 -0
- package/dist/components/GestureCaptureWrapper.js.map +1 -0
- package/dist/components/ScreenRecorderView/ScreenRecorderView.d.ts +5 -0
- package/dist/components/ScreenRecorderView/ScreenRecorderView.js +1 -0
- package/dist/components/ScreenRecorderView/ScreenRecorderView.js.map +1 -0
- package/dist/components/ScreenRecorderView/index.d.ts +1 -0
- package/dist/components/ScreenRecorderView/index.js +1 -0
- package/dist/components/ScreenRecorderView/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -0
- package/dist/config/constants.d.ts +18 -0
- package/dist/config/constants.js +1 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/defaults.d.ts +4 -0
- package/dist/config/defaults.js +1 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/masking.d.ts +2 -30
- package/dist/config/masking.js +1 -1
- package/dist/config/masking.js.map +1 -1
- package/dist/config/session-recorder.d.ts +2 -0
- package/dist/config/session-recorder.js +1 -0
- package/dist/config/session-recorder.js.map +1 -0
- package/dist/config/validators.d.ts +10 -0
- package/dist/config/validators.js +1 -0
- package/dist/config/validators.js.map +1 -0
- package/dist/context/SessionRecorderContext.d.ts +12 -0
- package/dist/context/SessionRecorderContext.js +1 -0
- package/dist/context/SessionRecorderContext.js.map +1 -0
- package/dist/expo.d.ts +5 -9
- package/dist/expo.js +1 -1
- package/dist/expo.js.map +1 -1
- package/dist/index.d.ts +6 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/otel/helpers.d.ts +45 -3
- package/dist/otel/helpers.js +1 -1
- package/dist/otel/helpers.js.map +1 -1
- package/dist/otel/index.d.ts +4 -25
- package/dist/otel/index.js +1 -1
- package/dist/otel/index.js.map +1 -1
- package/dist/otel/instrumentations/gestureInstrumentation.js +1 -1
- package/dist/otel/instrumentations/gestureInstrumentation.js.map +1 -1
- package/dist/otel/instrumentations/index.d.ts +3 -4
- package/dist/otel/instrumentations/index.js +1 -1
- package/dist/otel/instrumentations/index.js.map +1 -1
- package/dist/otel/instrumentations/reactNativeInstrumentation.js +1 -1
- package/dist/otel/instrumentations/reactNativeInstrumentation.js.map +1 -1
- package/dist/otel/instrumentations/reactNavigationInstrumentation.d.ts +1 -0
- package/dist/otel/instrumentations/reactNavigationInstrumentation.js +1 -1
- package/dist/otel/instrumentations/reactNavigationInstrumentation.js.map +1 -1
- package/dist/patch/index.d.ts +1 -0
- package/dist/patch/index.js +1 -0
- package/dist/patch/index.js.map +1 -0
- package/dist/patch/xhr.d.ts +2 -0
- package/dist/patch/xhr.js +1 -0
- package/dist/patch/xhr.js.map +1 -0
- package/dist/recorder/eventExporter.d.ts +21 -0
- package/dist/recorder/eventExporter.js +1 -0
- package/dist/recorder/eventExporter.js.map +1 -0
- package/dist/recorder/gestureHandlerRecorder.d.ts +19 -0
- package/dist/recorder/gestureHandlerRecorder.js +1 -0
- package/dist/recorder/gestureHandlerRecorder.js.map +1 -0
- package/dist/recorder/gestureRecorder.d.ts +68 -11
- package/dist/recorder/gestureRecorder.js +1 -1
- package/dist/recorder/gestureRecorder.js.map +1 -1
- package/dist/recorder/index.d.ts +60 -6
- package/dist/recorder/index.js +1 -1
- package/dist/recorder/index.js.map +1 -1
- package/dist/recorder/navigationTracker.js +1 -1
- package/dist/recorder/navigationTracker.js.map +1 -1
- package/dist/recorder/screenRecorder.d.ts +79 -10
- package/dist/recorder/screenRecorder.js +1 -1
- package/dist/recorder/screenRecorder.js.map +1 -1
- package/dist/services/api.service.d.ts +62 -10
- package/dist/services/api.service.js +1 -1
- package/dist/services/api.service.js.map +1 -1
- package/dist/services/storage.service.d.ts +23 -16
- package/dist/services/storage.service.js +1 -1
- package/dist/services/storage.service.js.map +1 -1
- package/dist/session-recorder.d.ts +166 -0
- package/dist/session-recorder.js +1 -0
- package/dist/session-recorder.js.map +1 -0
- package/dist/types/index.d.ts +15 -76
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/rrweb.d.ts +118 -0
- package/dist/types/rrweb.js +1 -0
- package/dist/types/rrweb.js.map +1 -0
- package/dist/types/session-recorder.d.ts +366 -0
- package/dist/types/session-recorder.js +1 -0
- package/dist/types/session-recorder.js.map +1 -0
- package/dist/types/session.d.ts +59 -0
- package/dist/types/session.js +1 -0
- package/dist/types/session.js.map +1 -0
- package/dist/utils/app-metadata.d.ts +16 -0
- package/dist/utils/app-metadata.js +1 -0
- package/dist/utils/app-metadata.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +112 -0
- package/dist/utils/logger.js +1 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/platform.d.ts +37 -0
- package/dist/utils/platform.js +1 -1
- package/dist/utils/platform.js.map +1 -1
- package/dist/utils/request-utils.d.ts +21 -0
- package/dist/utils/request-utils.js +1 -0
- package/dist/utils/request-utils.js.map +1 -0
- package/dist/utils/rrweb-events.d.ts +65 -0
- package/dist/utils/rrweb-events.js +1 -0
- package/dist/utils/rrweb-events.js.map +1 -0
- package/dist/utils/session.d.ts +5 -0
- package/dist/utils/session.js +1 -0
- package/dist/utils/session.js.map +1 -0
- package/dist/utils/time.d.ts +4 -0
- package/dist/utils/time.js +1 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/type-utils.d.ts +16 -0
- package/dist/utils/type-utils.js +1 -0
- package/dist/utils/type-utils.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/docs/AUTO_METADATA_DETECTION.md +108 -0
- package/package.json +10 -9
- package/scripts/generate-app-metadata.js +173 -0
- package/src/components/GestureCaptureWrapper/GestureCaptureWrapper.tsx +86 -0
- package/src/components/GestureCaptureWrapper/index.ts +1 -0
- package/src/components/ScreenRecorderView/ScreenRecorderView.tsx +72 -0
- package/src/components/ScreenRecorderView/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/src/config/constants.ts +60 -0
- package/src/config/defaults.ts +82 -0
- package/src/config/index.ts +6 -0
- package/src/config/masking.ts +10 -61
- package/src/config/session-recorder.ts +55 -0
- package/src/config/validators.ts +31 -0
- package/src/context/SessionRecorderContext.tsx +75 -0
- package/src/expo.ts +7 -37
- package/src/index.ts +14 -17
- package/src/otel/helpers.ts +265 -11
- package/src/otel/index.ts +37 -247
- package/src/otel/instrumentations/index.ts +82 -53
- package/src/patch/index.ts +1 -0
- package/src/patch/xhr.ts +142 -0
- package/src/recorder/eventExporter.ts +141 -0
- package/src/recorder/gestureRecorder.ts +194 -125
- package/src/recorder/index.ts +132 -24
- package/src/recorder/navigationTracker.ts +12 -10
- package/src/recorder/screenRecorder.ts +242 -155
- package/src/services/api.service.ts +170 -45
- package/src/services/storage.service.ts +102 -74
- package/src/session-recorder.ts +600 -0
- package/src/types/index.ts +19 -79
- package/src/types/session-recorder.ts +423 -0
- package/src/types/session.ts +65 -0
- package/src/utils/app-metadata.ts +31 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logger.ts +225 -0
- package/src/utils/platform.ts +321 -6
- package/src/utils/request-utils.ts +61 -0
- package/src/utils/rrweb-events.ts +309 -0
- package/src/utils/session.ts +18 -0
- package/src/utils/time.ts +17 -0
- package/src/utils/type-utils.ts +75 -0
- package/src/version.ts +1 -1
- package/dist/sessionRecorder.d.ts +0 -54
- package/dist/sessionRecorder.js +0 -1
- package/dist/sessionRecorder.js.map +0 -1
- package/examples/sample-expo-app/README.md +0 -142
- package/examples/sample-expo-app/app/(tabs)/_layout.tsx +0 -60
- package/examples/sample-expo-app/app/(tabs)/explore.tsx +0 -110
- package/examples/sample-expo-app/app/(tabs)/index.tsx +0 -125
- package/examples/sample-expo-app/app/(tabs)/posts.tsx +0 -96
- package/examples/sample-expo-app/app/(tabs)/users.tsx +0 -131
- package/examples/sample-expo-app/app/+not-found.tsx +0 -32
- package/examples/sample-expo-app/app/_layout.tsx +0 -53
- package/examples/sample-expo-app/app/post/[id].tsx +0 -199
- package/examples/sample-expo-app/app/user/[id].tsx +0 -270
- package/examples/sample-expo-app/app.json +0 -42
- package/examples/sample-expo-app/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/examples/sample-expo-app/assets/images/adaptive-icon.png +0 -0
- package/examples/sample-expo-app/assets/images/favicon.png +0 -0
- package/examples/sample-expo-app/assets/images/icon.png +0 -0
- package/examples/sample-expo-app/assets/images/partial-react-logo.png +0 -0
- package/examples/sample-expo-app/assets/images/react-logo.png +0 -0
- package/examples/sample-expo-app/assets/images/react-logo@2x.png +0 -0
- package/examples/sample-expo-app/assets/images/react-logo@3x.png +0 -0
- package/examples/sample-expo-app/assets/images/splash-icon.png +0 -0
- package/examples/sample-expo-app/components/Collapsible.tsx +0 -45
- package/examples/sample-expo-app/components/ErrorView.tsx +0 -52
- package/examples/sample-expo-app/components/ExternalLink.tsx +0 -24
- package/examples/sample-expo-app/components/HapticTab.tsx +0 -18
- package/examples/sample-expo-app/components/HelloWave.tsx +0 -40
- package/examples/sample-expo-app/components/LoadingSpinner.tsx +0 -34
- package/examples/sample-expo-app/components/ParallaxScrollView.tsx +0 -82
- package/examples/sample-expo-app/components/ThemedText.tsx +0 -60
- package/examples/sample-expo-app/components/ThemedView.tsx +0 -14
- package/examples/sample-expo-app/components/ui/IconSymbol.ios.tsx +0 -32
- package/examples/sample-expo-app/components/ui/IconSymbol.tsx +0 -41
- package/examples/sample-expo-app/components/ui/TabBarBackground.ios.tsx +0 -19
- package/examples/sample-expo-app/components/ui/TabBarBackground.tsx +0 -6
- package/examples/sample-expo-app/constants/Colors.ts +0 -26
- package/examples/sample-expo-app/eslint.config.js +0 -10
- package/examples/sample-expo-app/hooks/useApi.ts +0 -41
- package/examples/sample-expo-app/hooks/useColorScheme.ts +0 -1
- package/examples/sample-expo-app/hooks/useColorScheme.web.ts +0 -21
- package/examples/sample-expo-app/hooks/useThemeColor.ts +0 -21
- package/examples/sample-expo-app/metro.config.js +0 -26
- package/examples/sample-expo-app/package-lock.json +0 -26296
- package/examples/sample-expo-app/package.json +0 -59
- package/examples/sample-expo-app/scripts/reset-project.js +0 -112
- package/examples/sample-expo-app/services/api.ts +0 -98
- package/examples/sample-expo-app/tsconfig.json +0 -17
- package/examples/sample-expo-app/utils/navigation.ts +0 -19
- package/src/otel/instrumentations/gestureInstrumentation.ts +0 -141
- package/src/otel/instrumentations/reactNativeInstrumentation.ts +0 -164
- package/src/otel/instrumentations/reactNavigationInstrumentation.ts +0 -114
- package/src/sessionRecorder.ts +0 -367
package/dist/utils/platform.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.detectPlatform=detectPlatform;exports.getPlatformAttributes=getPlatformAttributes;exports.isExpoEnvironment=isExpoEnvironment;exports.isReactNativeEnvironment=isReactNativeEnvironment;function detectPlatform(){var _a,_b,_c,_d;try{var
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.configureAppMetadata=configureAppMetadata;exports.detectPlatform=detectPlatform;exports.getConfiguredAppMetadata=getConfiguredAppMetadata;exports.getNavigatorInfo=void 0;exports.getPlatformAttributes=getPlatformAttributes;exports.isExpoEnvironment=isExpoEnvironment;exports.isReactNativeEnvironment=isReactNativeEnvironment;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _expoConstants=_interopRequireDefault(require("expo-constants"));var _reactNative=require("react-native");var _version=require("../version");var _appMetadata=require("./app-metadata");function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}var globalAppMetadata={};var autoDetectedMetadata=null;function detectPlatform(){var _a,_b,_c,_d;try{var isExpo=!!((_a=_expoConstants["default"]["default"])===null||_a===void 0?void 0:_a.expoVersion)||!!_expoConstants["default"].expoVersion;if(isExpo){var expoVersion=((_b=_expoConstants["default"]["default"])===null||_b===void 0?void 0:_b.expoVersion)||_expoConstants["default"].expoVersion;var platform=((_c=_expoConstants["default"]["default"])===null||_c===void 0?void 0:_c.platform)||_expoConstants["default"].platform;return{isExpo:true,isReactNative:true,platform:(platform===null||platform===void 0?void 0:platform.ios)?'ios':(platform===null||platform===void 0?void 0:platform.android)?'android':'unknown',expoVersion:expoVersion,deviceType:'expo'};}return{isExpo:false,isReactNative:true,platform:_reactNative.Platform.OS,platformVersion:(_d=_reactNative.Platform.Version)===null||_d===void 0?void 0:_d.toString(),deviceType:_reactNative.Platform.OS};}catch(error){return{isExpo:false,isReactNative:false,platform:'unknown',deviceType:'unknown'};}}function getPlatformAttributes(){var platformInfo=detectPlatform();var attributes={'platform':platformInfo.isExpo?'expo':'react-native','device.type':platformInfo.deviceType};if(platformInfo.platformVersion){attributes['platform.version']=platformInfo.platformVersion;}if(platformInfo.expoVersion){attributes['expo.version']=platformInfo.expoVersion;}return attributes;}function isExpoEnvironment(){return detectPlatform().isExpo;}function isReactNativeEnvironment(){return detectPlatform().isReactNative;}function configureAppMetadata(metadata){globalAppMetadata=_objectSpread(_objectSpread({},globalAppMetadata),metadata);}function getConfiguredAppMetadata(){return _objectSpread({},globalAppMetadata);}function autoDetectAppMetadata(){if(autoDetectedMetadata){return autoDetectedMetadata;}try{var autoMetadata=(0,_appMetadata.getAutoDetectedAppMetadata)();var metadata={};if(autoMetadata.name)metadata.name=autoMetadata.name;if(autoMetadata.version)metadata.version=autoMetadata.version;if(autoMetadata.bundleId)metadata.bundleId=autoMetadata.bundleId;autoDetectedMetadata=metadata;return metadata;}catch(error){autoDetectedMetadata={};return{};}}function getAppMetadata(){var expoMetadata=getExpoMetadata();var configuredMetadata=getConfiguredAppMetadata();var autoMetadata=autoDetectAppMetadata();return{name:expoMetadata.name||configuredMetadata.name||autoMetadata.name,version:expoMetadata.version||configuredMetadata.version||autoMetadata.version,bundleId:expoMetadata.bundleId||configuredMetadata.bundleId||autoMetadata.bundleId};}function getExpoMetadata(){var _a,_b,_c;var expoConfig=((_a=_expoConstants["default"]["default"])===null||_a===void 0?void 0:_a.expoConfig)||_expoConstants["default"].expoConfig;if(!expoConfig)return{};return{name:expoConfig.name,version:expoConfig.version,bundleId:((_b=expoConfig.ios)===null||_b===void 0?void 0:_b.bundleIdentifier)||((_c=expoConfig.android)===null||_c===void 0?void 0:_c["package"])};}var getNavigatorInfo=exports.getNavigatorInfo=function getNavigatorInfo(){var platformInfo=detectPlatform();var screenData=_reactNative.Dimensions.get('window');var screenDataScreen=_reactNative.Dimensions.get('screen');var pixelRatio=_reactNative.PixelRatio.get();var getDeviceType=function getDeviceType(){var width=screenData.width,height=screenData.height;var minDimension=Math.min(width,height);var maxDimension=Math.max(width,height);if(maxDimension>=1024){return'Tablet';}else if(minDimension>=600){return'Large Phone';}else{return'Phone';}};var getOrientation=function getOrientation(){var width=screenData.width,height=screenData.height;return width>height?'Landscape':'Portrait';};var getOSInfo=function getOSInfo(){var _a;if(platformInfo.isExpo){var platform=((_a=_expoConstants["default"]["default"])===null||_a===void 0?void 0:_a.platform)||_expoConstants["default"].platform;if(platform===null||platform===void 0?void 0:platform.ios){return"iOS ".concat(_reactNative.Platform.Version);}else if(platform===null||platform===void 0?void 0:platform.android){return"Android ".concat(_reactNative.Platform.Version);}}if(_reactNative.Platform.OS==='ios'){return"iOS ".concat(_reactNative.Platform.Version);}else if(_reactNative.Platform.OS==='android'){return"Android ".concat(_reactNative.Platform.Version);}return"".concat(_reactNative.Platform.OS," ").concat(_reactNative.Platform.Version||'Unknown');};var getDeviceInfo=function getDeviceInfo(){var deviceType=getDeviceType();var osInfo=getOSInfo();return"".concat(deviceType," - ").concat(osInfo);};var getBrowserInfo=function getBrowserInfo(){if(platformInfo.isExpo){return"Expo ".concat(platformInfo.expoVersion||'Unknown'," - React Native");}return'React Native';};var getScreenSize=function getScreenSize(){return"".concat(Math.round(screenData.width),"x").concat(Math.round(screenData.height));};var getAppInfo=function getAppInfo(){var appName=getAppName();var appVersion=getAppVersion();return"".concat(appName," v").concat(appVersion);};var getAppName=function getAppName(){var metadata=getAppMetadata();if(metadata.name)return metadata.name;var configuredMetadata=getConfiguredAppMetadata();if(configuredMetadata.displayName)return configuredMetadata.displayName;return'React Native App';};var getAppVersion=function getAppVersion(){var metadata=getAppMetadata();if(metadata.version)return metadata.version;return'Unknown';};var getBundleId=function getBundleId(){var metadata=getAppMetadata();if(metadata.bundleId)return metadata.bundleId;return'com.reactnative.app';};var getBuildNumber=function getBuildNumber(){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k;var expoBuildNumber=((_c=(_b=(_a=_expoConstants["default"]["default"])===null||_a===void 0?void 0:_a.expoConfig)===null||_b===void 0?void 0:_b.ios)===null||_c===void 0?void 0:_c.buildNumber)||((_e=(_d=_expoConstants["default"].expoConfig)===null||_d===void 0?void 0:_d.ios)===null||_e===void 0?void 0:_e.buildNumber)||((_h=(_g=(_f=_expoConstants["default"]["default"])===null||_f===void 0?void 0:_f.expoConfig)===null||_g===void 0?void 0:_g.android)===null||_h===void 0?void 0:_h.versionCode)||((_k=(_j=_expoConstants["default"].expoConfig)===null||_j===void 0?void 0:_j.android)===null||_k===void 0?void 0:_k.versionCode);if(expoBuildNumber)return expoBuildNumber.toString();var configuredMetadata=getConfiguredAppMetadata();if(configuredMetadata.buildNumber)return configuredMetadata.buildNumber;return'1';};var getNetworkInfo=function getNetworkInfo(){return'Unknown';};var getHardwareInfo=function getHardwareInfo(){var pixelRatioInfo="Pixel Ratio: ".concat(pixelRatio);var screenDensity=_reactNative.PixelRatio.getFontScale();return"".concat(pixelRatioInfo,", Font Scale: ").concat(screenDensity);};return _objectSpread({platform:platformInfo.isExpo?'expo':'react-native',userAgent:getBrowserInfo(),language:'en',timestamp:new Date().toISOString(),deviceInfo:getDeviceInfo(),osInfo:getOSInfo(),browserInfo:getBrowserInfo(),screenSize:getScreenSize(),pixelRatio:pixelRatio,orientation:getOrientation(),screenWidth:Math.round(screenData.width),screenHeight:Math.round(screenData.height),screenScale:pixelRatio,hardwareConcurrency:1,cookiesEnabled:'N/A',packageVersion:_version.version,appInfo:getAppInfo(),appName:getAppName(),appVersion:getAppVersion(),bundleId:getBundleId(),buildNumber:getBuildNumber(),platformType:platformInfo.platform,platformVersion:platformInfo.platformVersion,expoVersion:platformInfo.expoVersion,deviceType:getDeviceType(),deviceModel:_reactNative.Platform.OS==='ios'?'iOS Device':'Android Device',deviceManufacturer:_reactNative.Platform.OS==='ios'?'Apple':'Android Manufacturer',deviceBrand:_reactNative.Platform.OS==='ios'?'Apple':'Android Brand',hardwareInfo:getHardwareInfo(),networkInfo:getNetworkInfo(),screenDensity:_reactNative.PixelRatio.getFontScale(),screenScaleFactor:pixelRatio,windowWidth:Math.round(screenData.width),windowHeight:Math.round(screenData.height),fullScreenWidth:Math.round(screenDataScreen.width),fullScreenHeight:Math.round(screenDataScreen.height),isExpo:platformInfo.isExpo,isReactNative:platformInfo.isReactNative,environment:platformInfo.isExpo?'expo':'react-native'},getPlatformAttributes());};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/utils/platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/utils/platform.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAE3D,sDAAsD;AACtD,IAAI,iBAAiB,GAA2D,EAAE,CAAA;AAElF,gEAAgE;AAChE,IAAI,oBAAoB,GAAkE,IAAI,CAAA;AAW9F,MAAM,UAAU,cAAc;;IAC5B,IAAI,CAAC;QACH,wCAAwC;QACxC,MAAM,MAAM,GAAG,CAAC,CAAC,CAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,WAAW,CAAA,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,CAAA;QAE1E,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,WAAW,GAAG,CAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,WAAW,KAAI,SAAS,CAAC,WAAW,CAAA;YAC3E,MAAM,QAAQ,GAAG,CAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,QAAQ,KAAI,SAAS,CAAC,QAAQ,CAAA;YAElE,OAAO;gBACL,MAAM,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native compatible)
|
|
6
|
+
* @param formData - FormData object
|
|
7
|
+
* @returns Query string
|
|
8
|
+
*/
|
|
9
|
+
export declare const formDataToQuery: (formData: any) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert object to query string
|
|
12
|
+
* @param obj - Object to convert
|
|
13
|
+
* @returns Query string
|
|
14
|
+
*/
|
|
15
|
+
export declare const objectToQuery: (obj: Record<string, any>) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Parse query string to object
|
|
18
|
+
* @param queryString - Query string to parse
|
|
19
|
+
* @returns Object with parsed parameters
|
|
20
|
+
*/
|
|
21
|
+
export declare const queryToObject: (queryString: string) => Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.queryToObject=exports.objectToQuery=exports.formDataToQuery=void 0;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}var formDataToQuery=exports.formDataToQuery=function formDataToQuery(formData){if(!formData)return'';var params=new URLSearchParams();if(typeof formData.entries==='function'){var _iterator=_createForOfIteratorHelper(formData.entries()),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _step$value=(0,_slicedToArray2["default"])(_step.value,2),key=_step$value[0],value=_step$value[1];params.append(key,value);}}catch(err){_iterator.e(err);}finally{_iterator.f();}}else if((0,_typeof2["default"])(formData)==='object'){for(var _i=0,_Object$entries=Object.entries(formData);_i<_Object$entries.length;_i++){var _Object$entries$_i=(0,_slicedToArray2["default"])(_Object$entries[_i],2),_key=_Object$entries$_i[0],_value=_Object$entries$_i[1];params.append(_key,String(_value));}}return params.toString();};var objectToQuery=exports.objectToQuery=function objectToQuery(obj){var params=new URLSearchParams();for(var _i2=0,_Object$entries2=Object.entries(obj);_i2<_Object$entries2.length;_i2++){var _Object$entries2$_i=(0,_slicedToArray2["default"])(_Object$entries2[_i2],2),key=_Object$entries2$_i[0],value=_Object$entries2$_i[1];if(value!==null&&value!==undefined){params.append(key,String(value));}}return params.toString();};var queryToObject=exports.queryToObject=function queryToObject(queryString){var params=new URLSearchParams(queryString);var obj={};var _iterator2=_createForOfIteratorHelper(params.entries()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _step2$value=(0,_slicedToArray2["default"])(_step2.value,2),key=_step2$value[0],value=_step2$value[1];obj[key]=value;}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}return obj;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-utils.js","sourceRoot":"","sources":["../../src/utils/request-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAC,M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AC,WAAmB,EAA0B,EAAE;IAC3E,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAA;IAC/C,MAAM,GAAG,GAA2B,EAAE,CAAA;IAEtC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5C,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IAClB,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { eventWithTime, serializedNodeWithId } from '@rrweb/types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a meta event to mark the start of recording
|
|
4
|
+
* @param sessionId - The session ID
|
|
5
|
+
* @param sessionType - The type of session (PLAIN or CONTINUOUS)
|
|
6
|
+
* @param additionalData - Additional data to include in the meta event
|
|
7
|
+
* @returns MetaEvent object
|
|
8
|
+
*/
|
|
9
|
+
export declare function createRecordingMetaEvent(): eventWithTime;
|
|
10
|
+
/**
|
|
11
|
+
* Create a full snapshot event with the given base64 image
|
|
12
|
+
* @param base64Image - Base64 encoded image data
|
|
13
|
+
* @param width - Screen width
|
|
14
|
+
* @param height - Screen height
|
|
15
|
+
* @param captureFormat - Image format (png, jpg, etc.)
|
|
16
|
+
* @param nodeIdCounter - Starting node ID counter (will be modified)
|
|
17
|
+
* @returns Full snapshot event
|
|
18
|
+
*/
|
|
19
|
+
export declare function createFullSnapshotEvent(base64Image: string, width: number, height: number, captureFormat: string | undefined, nodeIdCounter: {
|
|
20
|
+
current: number;
|
|
21
|
+
}): eventWithTime;
|
|
22
|
+
/**
|
|
23
|
+
* Create an incremental snapshot event with mutation data to update image src
|
|
24
|
+
* @param base64Image - New base64 encoded image data
|
|
25
|
+
* @param imageNodeId - ID of the image node to update
|
|
26
|
+
* @param captureFormat - Image format (png, jpg, etc.)
|
|
27
|
+
* @returns Incremental snapshot event with mutation data
|
|
28
|
+
*/
|
|
29
|
+
export declare function createIncrementalSnapshotWithImageUpdate(base64Image: string, captureFormat?: string): eventWithTime;
|
|
30
|
+
/**
|
|
31
|
+
* Create a simple image node for React Native screen capture
|
|
32
|
+
* @param base64Image - Base64 encoded image data
|
|
33
|
+
* @param width - Image width
|
|
34
|
+
* @param height - Image height
|
|
35
|
+
* @param captureFormat - Image format (png, jpg, etc.)
|
|
36
|
+
* @param nodeId - Node ID for the image
|
|
37
|
+
* @returns Serialized node with ID
|
|
38
|
+
*/
|
|
39
|
+
export declare function createImageNode(base64Image: string, width: number, height: number, captureFormat: string | undefined, nodeId: number): serializedNodeWithId;
|
|
40
|
+
/**
|
|
41
|
+
* Create a document node for React Native screen capture
|
|
42
|
+
* @param imageNode - The image node to include
|
|
43
|
+
* @param width - Screen width
|
|
44
|
+
* @param height - Screen height
|
|
45
|
+
* @param nodeIdCounter - Node ID counter (will be modified)
|
|
46
|
+
* @returns Document node
|
|
47
|
+
*/
|
|
48
|
+
export declare function createDocumentNode(imageNode: serializedNodeWithId, width: number, height: number, nodeIdCounter: {
|
|
49
|
+
current: number;
|
|
50
|
+
}): serializedNodeWithId;
|
|
51
|
+
/**
|
|
52
|
+
* Generate a simple hash for screen comparison
|
|
53
|
+
* This is a lightweight hash that focuses on the beginning and end of the base64 string
|
|
54
|
+
* to detect changes without doing a full comparison
|
|
55
|
+
* @param base64Image - Base64 encoded image
|
|
56
|
+
* @param sampleSize - Number of characters to sample from each part
|
|
57
|
+
* @returns Hash string for comparison
|
|
58
|
+
*/
|
|
59
|
+
export declare function generateScreenHash(base64Image: string, sampleSize?: number): string;
|
|
60
|
+
/**
|
|
61
|
+
* Simple hash function for string comparison
|
|
62
|
+
* @param str - String to hash
|
|
63
|
+
* @returns Hash value as string
|
|
64
|
+
*/
|
|
65
|
+
export declare function simpleHash(str: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createDocumentNode=createDocumentNode;exports.createFullSnapshotEvent=createFullSnapshotEvent;exports.createImageNode=createImageNode;exports.createIncrementalSnapshotWithImageUpdate=createIncrementalSnapshotWithImageUpdate;exports.createRecordingMetaEvent=createRecordingMetaEvent;exports.generateScreenHash=generateScreenHash;exports.simpleHash=simpleHash;var _reactNative=require("react-native");var _types=require("@rrweb/types");function createRecordingMetaEvent(){var screenDimensions=_reactNative.Dimensions.get('window');return{type:_types.EventType.Meta,data:{href:'https://go.multiplayer.app/session-recorder-react-native',width:screenDimensions.width,height:screenDimensions.height},timestamp:Date.now()};}function createFullSnapshotEvent(base64Image,width,height){var captureFormat=arguments.length>3&&arguments[3]!==undefined?arguments[3]:'jpg';var nodeIdCounter=arguments.length>4?arguments[4]:undefined;var imageNode={type:_types.NodeType.Element,id:0,tagName:'img',attributes:{src:"data:image/".concat(captureFormat,";base64,").concat(base64Image),width:width.toString(),height:height.toString(),style:"width: ".concat(width,"px; height: ").concat(height,"px;")},childNodes:[]};var rootNode={type:_types.NodeType.Element,id:nodeIdCounter.current++,tagName:'div',attributes:{style:"width: ".concat(width,"px; height: ").concat(height,"px; position: relative;")},childNodes:[imageNode]};var domNode={type:_types.NodeType.Document,childNodes:[{type:_types.NodeType.DocumentType,name:'html',publicId:'',systemId:'',id:nodeIdCounter.current++},{type:_types.NodeType.Element,tagName:'html',attributes:{},childNodes:[{type:_types.NodeType.Element,tagName:'head',attributes:{},childNodes:[{type:_types.NodeType.Element,tagName:'meta',attributes:{charset:'utf-8'},childNodes:[],id:nodeIdCounter.current++},{type:_types.NodeType.Element,tagName:'meta',attributes:{name:'viewport',content:'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'},childNodes:[],id:nodeIdCounter.current++}],id:nodeIdCounter.current++},{type:_types.NodeType.Element,tagName:'body',attributes:{},childNodes:[rootNode],id:nodeIdCounter.current++}],id:nodeIdCounter.current++}],id:nodeIdCounter.current++};return{type:_types.EventType.FullSnapshot,data:{node:domNode,initialOffset:{left:0,top:0}},timestamp:Date.now()};}function createIncrementalSnapshotWithImageUpdate(base64Image){var captureFormat=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'jpg';var mutationData={source:_types.IncrementalSource.Mutation,texts:[],attributes:[{id:0,attributes:{src:"data:image/".concat(captureFormat,";base64,").concat(base64Image)}}],removes:[],adds:[]};return{type:_types.EventType.IncrementalSnapshot,data:mutationData,timestamp:Date.now()};}function createImageNode(base64Image,width,height){var captureFormat=arguments.length>3&&arguments[3]!==undefined?arguments[3]:'jpg';var nodeId=arguments.length>4?arguments[4]:undefined;return{type:_types.NodeType.Element,id:nodeId,tagName:'img',attributes:{src:"data:image/".concat(captureFormat,";base64,").concat(base64Image),width:width.toString(),height:height.toString(),style:"width: ".concat(width,"px; height: ").concat(height,"px;")},childNodes:[]};}function createDocumentNode(imageNode,width,height,nodeIdCounter){var rootNode={type:_types.NodeType.Element,id:nodeIdCounter.current++,tagName:'div',attributes:{style:"width: ".concat(width,"px; height: ").concat(height,"px; position: relative;")},childNodes:[imageNode]};return{type:_types.NodeType.Document,childNodes:[{type:_types.NodeType.DocumentType,name:'html',publicId:'',systemId:'',id:nodeIdCounter.current++},{type:_types.NodeType.Element,tagName:'html',attributes:{},childNodes:[{type:_types.NodeType.Element,tagName:'head',attributes:{},childNodes:[{type:_types.NodeType.Element,tagName:'meta',attributes:{charset:'utf-8'},childNodes:[],id:nodeIdCounter.current++},{type:_types.NodeType.Element,tagName:'meta',attributes:{name:'viewport',content:'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'},childNodes:[],id:nodeIdCounter.current++}],id:nodeIdCounter.current++},{type:_types.NodeType.Element,tagName:'body',attributes:{},childNodes:[rootNode],id:nodeIdCounter.current++}],id:nodeIdCounter.current++}],id:nodeIdCounter.current++};}function generateScreenHash(base64Image){var sampleSize=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;var start=base64Image.substring(0,sampleSize);var middle=base64Image.substring(Math.floor(base64Image.length/2)-sampleSize/2,Math.floor(base64Image.length/2)+sampleSize/2);var end=base64Image.substring(base64Image.length-sampleSize);var combined=start+middle+end;return simpleHash(combined);}function simpleHash(str){var hash=0;for(var i=0;i<str.length;i++){var _char=str.charCodeAt(i);hash=(hash<<5)-hash+_char;hash=hash&hash;}return Math.abs(hash).toString(36);}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rrweb-events.js","sourceRoot":"","sources":["../../src/utils/rrweb-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,SAAS,EAAiB,QAAQ,EAAwB,iBAAiB,EAAgB,MAAM,cAAc,CAAA;AAExH;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB;IACtC,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAEjD,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,IAAI,EAAE;YACJ,IAAI,EAAE,0DAA0D;YAChE,KAAK,EAAE,gBAAgB,CAAC,KAAK;YAC7B,MAAM,EAAE,gBAAgB,CAAC,MAAM;SAChC;QACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAmB,EACnB,KAAa,EACb,MAAc,EACd,gBAAwB,KAAK,EAC7B,aAAkC;IAElC,gEAAgE;IAChE,MAAM,SAAS,GAAyB;QACtC,IAAI,EAAE,QAAQ,CAAC,OAAO;QACtB,EAAE,EAAE,CAAC;QACL,OAAO,EAAE,KAAK;QACd,UAAU,EAAE;YACV,GAAG,EAAE,cAAc,aAAa,WAAW,WAAW,EAAE;YACxD,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;YACvB,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;YACzB,KAAK,EAAE,UAAU,KAAK,eAAe,MAAM,KAAK;SACjD;QACD,UAAU,EAAE,EAAE;KACf,CAAA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ACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,IAAI,GAAG,CAAC,CAAA;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QAC9B,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;QAChC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,4BAA4B;IACjD,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isSessionActive=exports.isConsoleEvent=void 0;var _constants=require("../config/constants");var isSessionActive=exports.isSessionActive=function isSessionActive(session,continuousRecording){if(!session)return false;if(continuousRecording)return true;var startedAt=new Date(session.startedAt||session.createdAt);var now=new Date();var diff=now.getTime()-startedAt.getTime();return diff<_constants.DEBUG_SESSION_MAX_DURATION_SECONDS*1000;};var isConsoleEvent=exports.isConsoleEvent=function isConsoleEvent(event){var _a;return event.type==='Plugin'&&((_a=event.data)===null||_a===void 0?void 0:_a.plugin)==='rrweb/console@1';};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/utils/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAA;AAExE;;GAEG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAY,EAAE,mBAA4B,EAAW,EAAE;IACrF,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,IAAI,mBAAmB;QAAE,OAAO,IAAI,CAAA;IACpC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAA;IAClE,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;IACtB,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAA;IAChD,OAAO,IAAI,GAAG,kCAAkC,GAAG,IAAI,CAAA;AACzD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAU,EAAW,EAAE;;IACpD,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,MAAK,iBAAiB,CAAA;AAC5E,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getFormattedDate=void 0;var getFormattedDate=exports.getFormattedDate=function getFormattedDate(date,options){return new Date(date).toLocaleDateString('en-US',options||{month:'short',year:'numeric',day:'numeric',hour:'numeric',minute:'2-digit',second:'2-digit'});};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAmB,EAAE,OAAa,EAAU,EAAE;IAC7E,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,kBAAkB,CACtC,OAAO,EACP,OAAO,IAAI;QACT,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;KAClB,CACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const hasOwnProperty: (v: PropertyKey) => boolean;
|
|
2
|
+
export declare const isArray: (arg: any) => arg is any[];
|
|
3
|
+
export declare const isUint8Array: (x: unknown) => x is Uint8Array;
|
|
4
|
+
export declare const isFunction: (f: any) => f is (...args: any[]) => any;
|
|
5
|
+
export declare const isObject: (x: unknown) => x is Record<string, any>;
|
|
6
|
+
export declare const isEmptyObject: (x: unknown) => x is Record<string, any>;
|
|
7
|
+
export declare const isUndefined: (x: unknown) => x is undefined;
|
|
8
|
+
export declare const isString: (x: unknown) => x is string;
|
|
9
|
+
export declare const isEmptyString: (x: unknown) => boolean;
|
|
10
|
+
export declare const isNull: (x: unknown) => x is null;
|
|
11
|
+
export declare const isNullish: (x: unknown) => x is null | undefined;
|
|
12
|
+
export declare const isDate: (x: unknown) => x is Date;
|
|
13
|
+
export declare const isNumber: (x: unknown) => x is number;
|
|
14
|
+
export declare const isBoolean: (x: unknown) => x is boolean;
|
|
15
|
+
export declare const isFormData: (x: unknown) => x is FormData;
|
|
16
|
+
export declare const isFile: (x: unknown) => x is File;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isUndefined=exports.isUint8Array=exports.isString=exports.isObject=exports.isNumber=exports.isNullish=exports.isNull=exports.isFunction=exports.isFormData=exports.isFile=exports.isEmptyString=exports.isEmptyObject=exports.isDate=exports.isBoolean=exports.isArray=exports.hasOwnProperty=void 0;var nativeIsArray=Array.isArray;var ObjProto=Object.prototype;var hasOwnProperty=exports.hasOwnProperty=ObjProto.hasOwnProperty;var toString=ObjProto.toString;var isArray=exports.isArray=nativeIsArray||function(obj){return toString.call(obj)==='[object Array]';};var isUint8Array=exports.isUint8Array=function isUint8Array(x){return toString.call(x)==='[object Uint8Array]';};var isFunction=exports.isFunction=function isFunction(f){return typeof f==='function';};var isObject=exports.isObject=function isObject(x){return x===Object(x)&&!isArray(x);};var isEmptyObject=exports.isEmptyObject=function isEmptyObject(x){if(isObject(x)){for(var key in x){if(hasOwnProperty.call(x,key)){return false;}}return true;}return false;};var isUndefined=exports.isUndefined=function isUndefined(x){return x===void 0;};var isString=exports.isString=function isString(x){return toString.call(x)=='[object String]';};var isEmptyString=exports.isEmptyString=function isEmptyString(x){return isString(x)&&x.trim().length===0;};var isNull=exports.isNull=function isNull(x){return x===null;};var isNullish=exports.isNullish=function isNullish(x){return isUndefined(x)||isNull(x);};var isDate=exports.isDate=function isDate(x){return toString.call(x)=='[object Date]';};var isNumber=exports.isNumber=function isNumber(x){return toString.call(x)=='[object Number]';};var isBoolean=exports.isBoolean=function isBoolean(x){return toString.call(x)==='[object Boolean]';};var isFormData=exports.isFormData=function isFormData(x){return x instanceof FormData;};var isFile=exports.isFile=function isFile(x){return x instanceof File;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../../src/utils/type-utils.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAA;AACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAA;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAA;AACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAA;AAElC,MAAM,CAAC,MAAM,OAAO,GAClB,aAAa;IACb,UAAU,GAAQ;QAChB,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,gBAAgB,CAAA;IAChD,CAAC,CAAA;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAU;IAC9C,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,qBAAqB,CAAA;AACnD,CAAC,CAAA;AACD,8CAA8C;AAC9C,4DAA4D;AAC5D,0FAA0F;AAC1F,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAM;IACxC,OAAO,OAAO,CAAC,KAAK,UAAU,CAAA;AAChC,CAAC,CAAA;AACD,oBAAoB;AACpB,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAA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5C,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAU;IAC1C,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAA;AAC9C,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAU;IAC3C,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,kBAAkB,CAAA;AAChD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAU,EAAiB,EAAE;IACtD,OAAO,CAAC,YAAY,QAAQ,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAa,EAAE;IAC9C,OAAO,CAAC,YAAY,IAAI,CAAA;AAC1B,CAAC,CAAA"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.1-alpha.
|
|
1
|
+
export declare const version = "0.0.1-alpha.10";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="0.0.1-alpha.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="0.0.1-alpha.10";
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Automatic App Metadata Detection
|
|
2
|
+
|
|
3
|
+
The session recorder automatically detects app metadata from your project configuration files **without requiring any developer intervention**.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
The library automatically extracts app information from common configuration files in this priority order:
|
|
8
|
+
|
|
9
|
+
1. **`app.json`** - Expo/React Native app configuration
|
|
10
|
+
2. **`app.config.js`** - Dynamic Expo configuration
|
|
11
|
+
3. **`package.json`** - Node.js package configuration (fallback)
|
|
12
|
+
|
|
13
|
+
## Supported Configuration Files
|
|
14
|
+
|
|
15
|
+
### app.json
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"name": "My Awesome App",
|
|
20
|
+
"version": "1.2.3",
|
|
21
|
+
"displayName": "My App",
|
|
22
|
+
"ios": {
|
|
23
|
+
"bundleIdentifier": "com.mycompany.myapp",
|
|
24
|
+
"buildNumber": "123"
|
|
25
|
+
},
|
|
26
|
+
"android": {
|
|
27
|
+
"package": "com.mycompany.myapp",
|
|
28
|
+
"versionCode": 123
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### app.config.js
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
export default {
|
|
37
|
+
name: 'My Awesome App',
|
|
38
|
+
version: '1.2.3',
|
|
39
|
+
displayName: 'My App',
|
|
40
|
+
ios: {
|
|
41
|
+
bundleIdentifier: 'com.mycompany.myapp',
|
|
42
|
+
buildNumber: '123'
|
|
43
|
+
},
|
|
44
|
+
android: {
|
|
45
|
+
package: 'com.mycompany.myapp',
|
|
46
|
+
versionCode: 123
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### package.json (fallback)
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"name": "my-awesome-app",
|
|
56
|
+
"version": "1.2.3"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Detected Metadata
|
|
61
|
+
|
|
62
|
+
The following information is automatically extracted:
|
|
63
|
+
|
|
64
|
+
- **App Name** - From `name` or `displayName`
|
|
65
|
+
- **App Version** - From `version`
|
|
66
|
+
- **Bundle ID** - From `ios.bundleIdentifier` or `android.package`
|
|
67
|
+
- **Build Number** - From `ios.buildNumber` or `android.versionCode`
|
|
68
|
+
|
|
69
|
+
## Build Process
|
|
70
|
+
|
|
71
|
+
The metadata detection happens automatically during the build process:
|
|
72
|
+
|
|
73
|
+
1. The build script scans your project root for configuration files
|
|
74
|
+
2. Extracts relevant metadata from the first found configuration
|
|
75
|
+
3. Generates a TypeScript file with the detected metadata
|
|
76
|
+
4. The session recorder uses this metadata in all recordings
|
|
77
|
+
|
|
78
|
+
## No Developer Action Required
|
|
79
|
+
|
|
80
|
+
✅ **Zero configuration** - Works out of the box
|
|
81
|
+
✅ **Automatic detection** - Scans common config files
|
|
82
|
+
✅ **Build-time generation** - No runtime file reading
|
|
83
|
+
✅ **Fallback support** - Graceful degradation
|
|
84
|
+
|
|
85
|
+
## Manual Override (Optional)
|
|
86
|
+
|
|
87
|
+
If you need to override the auto-detected metadata, you can still use the manual configuration:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { configureAppMetadata } from '@multiplayer-app/session-recorder-react-native'
|
|
91
|
+
|
|
92
|
+
configureAppMetadata({
|
|
93
|
+
name: 'Custom App Name',
|
|
94
|
+
version: '2.0.0',
|
|
95
|
+
bundleId: 'com.custom.app'
|
|
96
|
+
})
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Priority Order
|
|
100
|
+
|
|
101
|
+
The metadata detection follows this priority:
|
|
102
|
+
|
|
103
|
+
1. **Expo Config** (if using Expo)
|
|
104
|
+
2. **Manual Configuration** (if `configureAppMetadata` was called)
|
|
105
|
+
3. **Auto-detected Metadata** (from config files)
|
|
106
|
+
4. **Fallback Values** (defaults)
|
|
107
|
+
|
|
108
|
+
This ensures maximum compatibility across different React Native setups while providing rich metadata for debugging sessions.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplayer-app/session-recorder-react-native",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.10",
|
|
4
4
|
"description": "Multiplayer Fullstack Session Recorder for React Native",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Multiplayer Software, Inc.",
|
|
@@ -45,9 +45,10 @@
|
|
|
45
45
|
"clean": "rimraf dist",
|
|
46
46
|
"lint": "eslint src/**/*.ts",
|
|
47
47
|
"lint:fix": "eslint src/**/*.ts --fix",
|
|
48
|
-
"prepublishOnly": "npm run
|
|
49
|
-
"prebuild": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts",
|
|
50
|
-
"build": "tsc && babel ./dist --out-dir dist --extensions '.js'"
|
|
48
|
+
"prepublishOnly": "npm run build",
|
|
49
|
+
"prebuild": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts && node scripts/generate-app-metadata.js",
|
|
50
|
+
"build": "tsc && babel ./dist --out-dir dist --extensions '.js' && ./copy-react-native-dist.sh",
|
|
51
|
+
"generate-metadata": "node scripts/generate-app-metadata.js"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@babel/cli": "^7.19.3",
|
|
@@ -78,19 +79,19 @@
|
|
|
78
79
|
"@opentelemetry/semantic-conventions": "1.36.0",
|
|
79
80
|
"@react-native-async-storage/async-storage": "^1.21.0",
|
|
80
81
|
"@react-native-community/netinfo": "^11.1.0",
|
|
82
|
+
"@rrweb/types": "^2.0.0-alpha.18",
|
|
81
83
|
"lib0": "0.2.82",
|
|
82
84
|
"react-native-gesture-handler": "^2.14.0",
|
|
83
85
|
"react-native-mmkv": "^2.11.0",
|
|
84
86
|
"react-native-reanimated": "^3.6.0",
|
|
85
|
-
"react-native-screenshot": "^1.0.0",
|
|
86
87
|
"react-native-view-shot": "^4.0.3",
|
|
87
88
|
"socket.io-client": "4.7.5"
|
|
88
89
|
},
|
|
89
90
|
"peerDependencies": {
|
|
90
|
-
"@opentelemetry/api": "1.9.0",
|
|
91
|
-
"expo": "
|
|
92
|
-
"react": "
|
|
93
|
-
"react-native": "
|
|
91
|
+
"@opentelemetry/api": "^1.9.0",
|
|
92
|
+
"expo": ">=49.0.0 <54.0.0",
|
|
93
|
+
"react": ">=18.0.0 <20.0.0",
|
|
94
|
+
"react-native": ">=0.72.0 <0.82.0"
|
|
94
95
|
},
|
|
95
96
|
"optionalDependencies": {
|
|
96
97
|
"expo-constants": "^15.0.0"
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build script to automatically extract app metadata from configuration files
|
|
5
|
+
* This runs without developer intervention and generates app-metadata.ts
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs')
|
|
9
|
+
const path = require('path')
|
|
10
|
+
|
|
11
|
+
function findProjectRoot() {
|
|
12
|
+
let currentDir = process.cwd()
|
|
13
|
+
|
|
14
|
+
// Look for package.json going up the directory tree
|
|
15
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
16
|
+
if (fs.existsSync(path.join(currentDir, 'package.json'))) {
|
|
17
|
+
return currentDir
|
|
18
|
+
}
|
|
19
|
+
currentDir = path.dirname(currentDir)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return process.cwd()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function extractAppMetadata(projectRoot) {
|
|
26
|
+
const metadata = {
|
|
27
|
+
name: undefined,
|
|
28
|
+
version: undefined,
|
|
29
|
+
bundleId: undefined,
|
|
30
|
+
buildNumber: undefined,
|
|
31
|
+
displayName: undefined,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
// Method 1: Try app.json
|
|
36
|
+
const appJsonPath = path.join(projectRoot, 'app.json')
|
|
37
|
+
if (fs.existsSync(appJsonPath)) {
|
|
38
|
+
const appConfig = JSON.parse(fs.readFileSync(appJsonPath, 'utf8'))
|
|
39
|
+
|
|
40
|
+
metadata.name = appConfig.name || appConfig.displayName
|
|
41
|
+
metadata.version = appConfig.version
|
|
42
|
+
metadata.displayName = appConfig.displayName
|
|
43
|
+
|
|
44
|
+
// Extract bundle ID from platform-specific configs
|
|
45
|
+
if (appConfig.ios?.bundleIdentifier) {
|
|
46
|
+
metadata.bundleId = appConfig.ios.bundleIdentifier
|
|
47
|
+
} else if (appConfig.android?.package) {
|
|
48
|
+
metadata.bundleId = appConfig.android.package
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (appConfig.ios?.buildNumber) {
|
|
52
|
+
metadata.buildNumber = appConfig.ios.buildNumber.toString()
|
|
53
|
+
} else if (appConfig.android?.versionCode) {
|
|
54
|
+
metadata.buildNumber = appConfig.android.versionCode.toString()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log('✅ Extracted metadata from app.json')
|
|
58
|
+
return metadata
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Method 2: Try app.config.js
|
|
62
|
+
const appConfigJsPath = path.join(projectRoot, 'app.config.js')
|
|
63
|
+
if (fs.existsSync(appConfigJsPath)) {
|
|
64
|
+
try {
|
|
65
|
+
// Clear require cache to get fresh config
|
|
66
|
+
delete require.cache[require.resolve(appConfigJsPath)]
|
|
67
|
+
const appConfig = require(appConfigJsPath)
|
|
68
|
+
|
|
69
|
+
metadata.name = appConfig.name || appConfig.displayName
|
|
70
|
+
metadata.version = appConfig.version
|
|
71
|
+
metadata.displayName = appConfig.displayName
|
|
72
|
+
|
|
73
|
+
// Extract bundle ID from platform-specific configs
|
|
74
|
+
if (appConfig.ios?.bundleIdentifier) {
|
|
75
|
+
metadata.bundleId = appConfig.ios.bundleIdentifier
|
|
76
|
+
} else if (appConfig.android?.package) {
|
|
77
|
+
metadata.bundleId = appConfig.android.package
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (appConfig.ios?.buildNumber) {
|
|
81
|
+
metadata.buildNumber = appConfig.ios.buildNumber.toString()
|
|
82
|
+
} else if (appConfig.android?.versionCode) {
|
|
83
|
+
metadata.buildNumber = appConfig.android.versionCode.toString()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
console.log('✅ Extracted metadata from app.config.js')
|
|
87
|
+
return metadata
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.warn('⚠️ Could not parse app.config.js:', error.message)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Method 3: Fallback to package.json
|
|
94
|
+
const packageJsonPath = path.join(projectRoot, 'package.json')
|
|
95
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
96
|
+
const packageConfig = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
97
|
+
|
|
98
|
+
metadata.name = packageConfig.name
|
|
99
|
+
metadata.version = packageConfig.version
|
|
100
|
+
|
|
101
|
+
console.log('✅ Extracted metadata from package.json')
|
|
102
|
+
return metadata
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.warn('⚠️ Error extracting app metadata:', error.message)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return metadata
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function generateAppMetadataFile(metadata, outputPath) {
|
|
113
|
+
const content = `/**
|
|
114
|
+
* Auto-generated app metadata
|
|
115
|
+
* This file is generated at build time to provide app metadata without developer intervention
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
// This file is automatically generated by the build process
|
|
119
|
+
// It extracts metadata from app.json, app.config.js, or package.json
|
|
120
|
+
|
|
121
|
+
export interface AppMetadata {
|
|
122
|
+
name?: string
|
|
123
|
+
version?: string
|
|
124
|
+
bundleId?: string
|
|
125
|
+
buildNumber?: string
|
|
126
|
+
displayName?: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Auto-detected values from project configuration files
|
|
130
|
+
export const APP_METADATA: AppMetadata = {
|
|
131
|
+
name: ${metadata.name ? `"${metadata.name}"` : 'undefined'},
|
|
132
|
+
version: ${metadata.version ? `"${metadata.version}"` : 'undefined'},
|
|
133
|
+
bundleId: ${metadata.bundleId ? `"${metadata.bundleId}"` : 'undefined'},
|
|
134
|
+
buildNumber: ${metadata.buildNumber ? `"${metadata.buildNumber}"` : 'undefined'},
|
|
135
|
+
displayName: ${metadata.displayName ? `"${metadata.displayName}"` : 'undefined'},
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Get auto-detected app metadata
|
|
140
|
+
*/
|
|
141
|
+
export function getAutoDetectedAppMetadata(): AppMetadata {
|
|
142
|
+
return { ...APP_METADATA }
|
|
143
|
+
}
|
|
144
|
+
`
|
|
145
|
+
|
|
146
|
+
fs.writeFileSync(outputPath, content, 'utf8')
|
|
147
|
+
console.log(`✅ Generated app-metadata.ts`)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function main() {
|
|
151
|
+
const projectRoot = findProjectRoot()
|
|
152
|
+
console.log(`🔍 Looking for app metadata in: ${projectRoot}`)
|
|
153
|
+
|
|
154
|
+
const metadata = extractAppMetadata(projectRoot)
|
|
155
|
+
|
|
156
|
+
// Show what was detected
|
|
157
|
+
console.log('📋 Detected metadata:')
|
|
158
|
+
Object.entries(metadata).forEach(([key, value]) => {
|
|
159
|
+
if (value) {
|
|
160
|
+
console.log(` ${key}: ${value}`)
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
// Generate the TypeScript file
|
|
165
|
+
const outputPath = path.join(__dirname, '../src/utils/app-metadata.ts')
|
|
166
|
+
generateAppMetadataFile(metadata, outputPath)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (require.main === module) {
|
|
170
|
+
main()
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
module.exports = { extractAppMetadata, generateAppMetadataFile }
|