@hot-updater/plugin-core 0.33.2 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -2
- package/dist/index.mjs +1 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/package.json +4 -4
- package/dist/createDatabasePluginGetUpdateInfo.cjs +0 -36
- package/dist/createDatabasePluginGetUpdateInfo.d.cts +0 -27
- package/dist/createDatabasePluginGetUpdateInfo.d.mts +0 -27
- package/dist/createDatabasePluginGetUpdateInfo.mjs +0 -35
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,6 @@ const require_paginateBundles = require("./paginateBundles.cjs");
|
|
|
11
11
|
const require_requestUpdateBundleState = require("./requestUpdateBundleState.cjs");
|
|
12
12
|
const require_resolveUpdateInfoFromBundles = require("./resolveUpdateInfoFromBundles.cjs");
|
|
13
13
|
const require_createBlobDatabasePlugin = require("./createBlobDatabasePlugin.cjs");
|
|
14
|
-
const require_createDatabasePluginGetUpdateInfo = require("./createDatabasePluginGetUpdateInfo.cjs");
|
|
15
14
|
const require_createStorageKeyBuilder = require("./createStorageKeyBuilder.cjs");
|
|
16
15
|
const require_createStoragePlugin = require("./createStoragePlugin.cjs");
|
|
17
16
|
const require_generateMinBundleId = require("./generateMinBundleId.cjs");
|
|
@@ -26,7 +25,6 @@ exports.bundleMatchesQueryWhere = require_queryBundles.bundleMatchesQueryWhere;
|
|
|
26
25
|
exports.calculatePagination = require_calculatePagination.calculatePagination;
|
|
27
26
|
exports.createBlobDatabasePlugin = require_createBlobDatabasePlugin.createBlobDatabasePlugin;
|
|
28
27
|
exports.createDatabasePlugin = require_createDatabasePlugin.createDatabasePlugin;
|
|
29
|
-
exports.createDatabasePluginGetUpdateInfo = require_createDatabasePluginGetUpdateInfo.createDatabasePluginGetUpdateInfo;
|
|
30
28
|
exports.createNodeStoragePlugin = require_createStoragePlugin.createNodeStoragePlugin;
|
|
31
29
|
exports.createRequestUpdateBundleResolver = require_requestUpdateBundleState.createRequestUpdateBundleResolver;
|
|
32
30
|
exports.createRuntimeStoragePlugin = require_createStoragePlugin.createRuntimeStoragePlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,6 @@ import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLa
|
|
|
6
6
|
import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.cjs";
|
|
7
7
|
import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.cjs";
|
|
8
8
|
import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.cjs";
|
|
9
|
-
import { CreateDatabasePluginGetUpdateInfoOptions, createDatabasePluginGetUpdateInfo } from "./createDatabasePluginGetUpdateInfo.cjs";
|
|
10
9
|
import { createStorageKeyBuilder } from "./createStorageKeyBuilder.cjs";
|
|
11
10
|
import { createNodeStoragePlugin, createRuntimeStoragePlugin, createUniversalStoragePlugin } from "./createStoragePlugin.cjs";
|
|
12
11
|
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.cjs";
|
|
@@ -19,4 +18,4 @@ import { ResolveUpdateInfoFromBundlesOptions, resolveUpdateInfoFromBundles } fro
|
|
|
19
18
|
import { semverSatisfies } from "./semverSatisfies.cjs";
|
|
20
19
|
import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.cjs";
|
|
21
20
|
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.cjs";
|
|
22
|
-
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput,
|
|
21
|
+
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, ResolveUpdateInfoFromBundlesOptions, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,6 @@ import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLa
|
|
|
6
6
|
import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
|
|
7
7
|
import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
|
|
8
8
|
import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.mjs";
|
|
9
|
-
import { CreateDatabasePluginGetUpdateInfoOptions, createDatabasePluginGetUpdateInfo } from "./createDatabasePluginGetUpdateInfo.mjs";
|
|
10
9
|
import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
|
|
11
10
|
import { createNodeStoragePlugin, createRuntimeStoragePlugin, createUniversalStoragePlugin } from "./createStoragePlugin.mjs";
|
|
12
11
|
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
|
|
@@ -19,4 +18,4 @@ import { ResolveUpdateInfoFromBundlesOptions, resolveUpdateInfoFromBundles } fro
|
|
|
19
18
|
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
20
19
|
import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.mjs";
|
|
21
20
|
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
|
|
22
|
-
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput,
|
|
21
|
+
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, ResolveUpdateInfoFromBundlesOptions, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,6 @@ import { paginateBundles } from "./paginateBundles.mjs";
|
|
|
10
10
|
import { createRequestUpdateBundleResolver, getRequestUpdateBundleSeeds } from "./requestUpdateBundleState.mjs";
|
|
11
11
|
import { resolveUpdateInfoFromBundles } from "./resolveUpdateInfoFromBundles.mjs";
|
|
12
12
|
import { createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
|
|
13
|
-
import { createDatabasePluginGetUpdateInfo } from "./createDatabasePluginGetUpdateInfo.mjs";
|
|
14
13
|
import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
|
|
15
14
|
import { createNodeStoragePlugin, createRuntimeStoragePlugin, createUniversalStoragePlugin } from "./createStoragePlugin.mjs";
|
|
16
15
|
import { generateMinBundleId } from "./generateMinBundleId.mjs";
|
|
@@ -18,4 +17,4 @@ import { parseStorageUri } from "./parseStorageUri.mjs";
|
|
|
18
17
|
import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.mjs";
|
|
19
18
|
import { supportedIosPlatforms } from "./types/index.mjs";
|
|
20
19
|
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
|
|
21
|
-
export { assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin,
|
|
20
|
+
export { assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.cjs";
|
|
2
|
-
import { AppVersionGetBundlesArgs
|
|
2
|
+
import { AppVersionGetBundlesArgs, Bundle, Bundle as Bundle$1, FingerprintGetBundlesArgs, GetBundlesArgs, GetBundlesArgs as GetBundlesArgs$1, Platform, Platform as Platform$1, UpdateInfo, UpdateInfo as UpdateInfo$1 } from "@hot-updater/core";
|
|
3
3
|
|
|
4
4
|
//#region src/types/index.d.ts
|
|
5
5
|
interface BasePluginArgs {
|
|
@@ -504,4 +504,4 @@ interface NativeBuildOptions {
|
|
|
504
504
|
scheme?: string;
|
|
505
505
|
}
|
|
506
506
|
//#endregion
|
|
507
|
-
export { type AppVersionGetBundlesArgs
|
|
507
|
+
export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.mjs";
|
|
2
|
-
import { AppVersionGetBundlesArgs
|
|
2
|
+
import { AppVersionGetBundlesArgs, Bundle, Bundle as Bundle$1, FingerprintGetBundlesArgs, GetBundlesArgs, GetBundlesArgs as GetBundlesArgs$1, Platform, Platform as Platform$1, UpdateInfo, UpdateInfo as UpdateInfo$1 } from "@hot-updater/core";
|
|
3
3
|
|
|
4
4
|
//#region src/types/index.d.ts
|
|
5
5
|
interface BasePluginArgs {
|
|
@@ -504,4 +504,4 @@ interface NativeBuildOptions {
|
|
|
504
504
|
scheme?: string;
|
|
505
505
|
}
|
|
506
506
|
//#endregion
|
|
507
|
-
export { type AppVersionGetBundlesArgs
|
|
507
|
+
export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"es-toolkit": "^1.32.0",
|
|
46
46
|
"mime": "^4.0.4",
|
|
47
47
|
"semver": "^7.7.2",
|
|
48
|
-
"@hot-updater/core": "0.
|
|
49
|
-
"@hot-updater/js": "0.
|
|
48
|
+
"@hot-updater/core": "0.35.0",
|
|
49
|
+
"@hot-updater/js": "0.35.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^20",
|
|
53
53
|
"@types/semver": "^7.5.8",
|
|
54
54
|
"typescript": "6.0.2",
|
|
55
|
-
"@hot-updater/test-utils": "0.
|
|
55
|
+
"@hot-updater/test-utils": "0.35.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
-
const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
|
|
3
|
-
const require_resolveUpdateInfoFromBundles = require("./resolveUpdateInfoFromBundles.cjs");
|
|
4
|
-
let _hot_updater_core = require("@hot-updater/core");
|
|
5
|
-
//#region src/createDatabasePluginGetUpdateInfo.ts
|
|
6
|
-
const normalizeAppVersionArgs = (args) => ({
|
|
7
|
-
...args,
|
|
8
|
-
channel: args.channel ?? "production",
|
|
9
|
-
minBundleId: args.minBundleId ?? _hot_updater_core.NIL_UUID
|
|
10
|
-
});
|
|
11
|
-
const normalizeFingerprintArgs = (args) => ({
|
|
12
|
-
...args,
|
|
13
|
-
channel: args.channel ?? "production",
|
|
14
|
-
minBundleId: args.minBundleId ?? _hot_updater_core.NIL_UUID
|
|
15
|
-
});
|
|
16
|
-
const createDatabasePluginGetUpdateInfo = ({ getBundlesByFingerprint, getBundlesByTargetAppVersions, listTargetAppVersions }) => {
|
|
17
|
-
return async (args, context) => {
|
|
18
|
-
if (args._updateStrategy === "appVersion") {
|
|
19
|
-
const normalizedArgs = normalizeAppVersionArgs(args);
|
|
20
|
-
const compatibleAppVersions = require_filterCompatibleAppVersions.filterCompatibleAppVersions(await listTargetAppVersions(normalizedArgs, context), normalizedArgs.appVersion);
|
|
21
|
-
return require_resolveUpdateInfoFromBundles.resolveUpdateInfoFromBundles({
|
|
22
|
-
args: normalizedArgs,
|
|
23
|
-
bundles: compatibleAppVersions.length > 0 ? await getBundlesByTargetAppVersions(normalizedArgs, compatibleAppVersions, context) : [],
|
|
24
|
-
context
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const normalizedArgs = normalizeFingerprintArgs(args);
|
|
28
|
-
return require_resolveUpdateInfoFromBundles.resolveUpdateInfoFromBundles({
|
|
29
|
-
args: normalizedArgs,
|
|
30
|
-
bundles: await getBundlesByFingerprint(normalizedArgs, context),
|
|
31
|
-
context
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
exports.createDatabasePluginGetUpdateInfo = createDatabasePluginGetUpdateInfo;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Bundle as Bundle$1, HotUpdaterContext } from "./types/index.cjs";
|
|
2
|
-
import { AppVersionGetBundlesArgs, FingerprintGetBundlesArgs, GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
|
|
3
|
-
|
|
4
|
-
//#region src/createDatabasePluginGetUpdateInfo.d.ts
|
|
5
|
-
type AppVersionLookupArgs = {
|
|
6
|
-
channel: string;
|
|
7
|
-
minBundleId: string;
|
|
8
|
-
platform: AppVersionGetBundlesArgs["platform"];
|
|
9
|
-
};
|
|
10
|
-
type FingerprintLookupArgs = {
|
|
11
|
-
channel: string;
|
|
12
|
-
fingerprintHash: string;
|
|
13
|
-
minBundleId: string;
|
|
14
|
-
platform: FingerprintGetBundlesArgs["platform"];
|
|
15
|
-
};
|
|
16
|
-
interface CreateDatabasePluginGetUpdateInfoOptions<TContext = unknown> {
|
|
17
|
-
getBundlesByFingerprint: (args: FingerprintLookupArgs, context?: HotUpdaterContext<TContext>) => Promise<Bundle$1[]>;
|
|
18
|
-
getBundlesByTargetAppVersions: (args: AppVersionLookupArgs, targetAppVersions: string[], context?: HotUpdaterContext<TContext>) => Promise<Bundle$1[]>;
|
|
19
|
-
listTargetAppVersions: (args: AppVersionLookupArgs, context?: HotUpdaterContext<TContext>) => Promise<string[]>;
|
|
20
|
-
}
|
|
21
|
-
declare const createDatabasePluginGetUpdateInfo: <TContext = unknown>({
|
|
22
|
-
getBundlesByFingerprint,
|
|
23
|
-
getBundlesByTargetAppVersions,
|
|
24
|
-
listTargetAppVersions
|
|
25
|
-
}: CreateDatabasePluginGetUpdateInfoOptions<TContext>) => (args: GetBundlesArgs, context?: HotUpdaterContext<TContext>) => Promise<UpdateInfo | null>;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { CreateDatabasePluginGetUpdateInfoOptions, createDatabasePluginGetUpdateInfo };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Bundle as Bundle$1, HotUpdaterContext } from "./types/index.mjs";
|
|
2
|
-
import { AppVersionGetBundlesArgs, FingerprintGetBundlesArgs, GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
|
|
3
|
-
|
|
4
|
-
//#region src/createDatabasePluginGetUpdateInfo.d.ts
|
|
5
|
-
type AppVersionLookupArgs = {
|
|
6
|
-
channel: string;
|
|
7
|
-
minBundleId: string;
|
|
8
|
-
platform: AppVersionGetBundlesArgs["platform"];
|
|
9
|
-
};
|
|
10
|
-
type FingerprintLookupArgs = {
|
|
11
|
-
channel: string;
|
|
12
|
-
fingerprintHash: string;
|
|
13
|
-
minBundleId: string;
|
|
14
|
-
platform: FingerprintGetBundlesArgs["platform"];
|
|
15
|
-
};
|
|
16
|
-
interface CreateDatabasePluginGetUpdateInfoOptions<TContext = unknown> {
|
|
17
|
-
getBundlesByFingerprint: (args: FingerprintLookupArgs, context?: HotUpdaterContext<TContext>) => Promise<Bundle$1[]>;
|
|
18
|
-
getBundlesByTargetAppVersions: (args: AppVersionLookupArgs, targetAppVersions: string[], context?: HotUpdaterContext<TContext>) => Promise<Bundle$1[]>;
|
|
19
|
-
listTargetAppVersions: (args: AppVersionLookupArgs, context?: HotUpdaterContext<TContext>) => Promise<string[]>;
|
|
20
|
-
}
|
|
21
|
-
declare const createDatabasePluginGetUpdateInfo: <TContext = unknown>({
|
|
22
|
-
getBundlesByFingerprint,
|
|
23
|
-
getBundlesByTargetAppVersions,
|
|
24
|
-
listTargetAppVersions
|
|
25
|
-
}: CreateDatabasePluginGetUpdateInfoOptions<TContext>) => (args: GetBundlesArgs, context?: HotUpdaterContext<TContext>) => Promise<UpdateInfo | null>;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { CreateDatabasePluginGetUpdateInfoOptions, createDatabasePluginGetUpdateInfo };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
|
|
2
|
-
import { resolveUpdateInfoFromBundles } from "./resolveUpdateInfoFromBundles.mjs";
|
|
3
|
-
import { NIL_UUID } from "@hot-updater/core";
|
|
4
|
-
//#region src/createDatabasePluginGetUpdateInfo.ts
|
|
5
|
-
const normalizeAppVersionArgs = (args) => ({
|
|
6
|
-
...args,
|
|
7
|
-
channel: args.channel ?? "production",
|
|
8
|
-
minBundleId: args.minBundleId ?? NIL_UUID
|
|
9
|
-
});
|
|
10
|
-
const normalizeFingerprintArgs = (args) => ({
|
|
11
|
-
...args,
|
|
12
|
-
channel: args.channel ?? "production",
|
|
13
|
-
minBundleId: args.minBundleId ?? NIL_UUID
|
|
14
|
-
});
|
|
15
|
-
const createDatabasePluginGetUpdateInfo = ({ getBundlesByFingerprint, getBundlesByTargetAppVersions, listTargetAppVersions }) => {
|
|
16
|
-
return async (args, context) => {
|
|
17
|
-
if (args._updateStrategy === "appVersion") {
|
|
18
|
-
const normalizedArgs = normalizeAppVersionArgs(args);
|
|
19
|
-
const compatibleAppVersions = filterCompatibleAppVersions(await listTargetAppVersions(normalizedArgs, context), normalizedArgs.appVersion);
|
|
20
|
-
return resolveUpdateInfoFromBundles({
|
|
21
|
-
args: normalizedArgs,
|
|
22
|
-
bundles: compatibleAppVersions.length > 0 ? await getBundlesByTargetAppVersions(normalizedArgs, compatibleAppVersions, context) : [],
|
|
23
|
-
context
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
const normalizedArgs = normalizeFingerprintArgs(args);
|
|
27
|
-
return resolveUpdateInfoFromBundles({
|
|
28
|
-
args: normalizedArgs,
|
|
29
|
-
bundles: await getBundlesByFingerprint(normalizedArgs, context),
|
|
30
|
-
context
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
35
|
-
export { createDatabasePluginGetUpdateInfo };
|