UNPKG

@hot-updater/react-native

Version:

React Native OTA solution for self-hosted

34 lines (32 loc) 1.22 kB
"use strict"; import { fetchUpdateInfo } from "./fetchUpdateInfo.js"; /** * Creates a default resolver that uses baseURL for network operations. * This encapsulates the existing baseURL logic into a resolver. * * @param baseURL - The base URL for the update server * @returns A HotUpdaterResolver that uses the baseURL */ export function createDefaultResolver(baseURL) { return { checkUpdate: async params => { // Build URL based on strategy (existing buildUpdateUrl logic) let url; if (params.updateStrategy === "fingerprint") { if (!params.fingerprintHash) { throw new Error("Fingerprint hash is required"); } url = `${baseURL}/fingerprint/${params.platform}/${params.fingerprintHash}/${params.channel}/${params.minBundleId}/${params.bundleId}`; } else { url = `${baseURL}/app-version/${params.platform}/${params.appVersion}/${params.channel}/${params.minBundleId}/${params.bundleId}`; } // Use existing fetchUpdateInfo return fetchUpdateInfo({ url, requestHeaders: params.requestHeaders, requestTimeout: params.requestTimeout }); } }; } //# sourceMappingURL=DefaultResolver.js.map