@hot-updater/plugin-core 0.20.12 → 0.20.14
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 +47 -8
- package/dist/index.js +47 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -17782,6 +17782,24 @@ function isExactVersion(version) {
|
|
|
17782
17782
|
return semver.default.valid(version) !== null;
|
|
17783
17783
|
}
|
|
17784
17784
|
/**
|
|
17785
|
+
* Get all normalized semver versions for a version string.
|
|
17786
|
+
* This handles the case where clients may request with different normalized forms.
|
|
17787
|
+
*
|
|
17788
|
+
* Examples:
|
|
17789
|
+
* - "1.0.0" generates ["1.0.0", "1.0", "1"]
|
|
17790
|
+
* - "2.1.0" generates ["2.1.0", "2.1"]
|
|
17791
|
+
* - "1.2.3" generates ["1.2.3"]
|
|
17792
|
+
*/
|
|
17793
|
+
function getSemverNormalizedVersions(version) {
|
|
17794
|
+
const coerced = semver.default.coerce(version);
|
|
17795
|
+
if (!coerced) return [version];
|
|
17796
|
+
const versions = /* @__PURE__ */ new Set();
|
|
17797
|
+
versions.add(coerced.version);
|
|
17798
|
+
if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
|
|
17799
|
+
if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
|
|
17800
|
+
return Array.from(versions);
|
|
17801
|
+
}
|
|
17802
|
+
/**
|
|
17785
17803
|
*
|
|
17786
17804
|
* @param name - The name of the database plugin
|
|
17787
17805
|
* @param listObjects - Function to list objects in the storage
|
|
@@ -17908,7 +17926,10 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17908
17926
|
pathsToInvalidate.add(`/${key}`);
|
|
17909
17927
|
if (data.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${data.platform}/${data.fingerprintHash}/${data.channel}/*`);
|
|
17910
17928
|
else if (data.targetAppVersion) if (!isExactVersion(data.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/*`);
|
|
17911
|
-
else
|
|
17929
|
+
else {
|
|
17930
|
+
const normalizedVersions = getSemverNormalizedVersions(data.targetAppVersion);
|
|
17931
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${version}/${data.channel}/*`);
|
|
17932
|
+
}
|
|
17912
17933
|
continue;
|
|
17913
17934
|
}
|
|
17914
17935
|
if (operation === "delete") {
|
|
@@ -17923,7 +17944,10 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17923
17944
|
pathsToInvalidate.add(`/${key}`);
|
|
17924
17945
|
if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
|
|
17925
17946
|
else if (bundle$1.targetAppVersion) if (!isExactVersion(bundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/*`);
|
|
17926
|
-
else
|
|
17947
|
+
else {
|
|
17948
|
+
const normalizedVersions = getSemverNormalizedVersions(bundle$1.targetAppVersion);
|
|
17949
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${version}/${bundle$1.channel}/*`);
|
|
17950
|
+
}
|
|
17927
17951
|
continue;
|
|
17928
17952
|
}
|
|
17929
17953
|
let bundle = pendingBundlesMap.get(data.id);
|
|
@@ -17962,16 +17986,25 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17962
17986
|
}
|
|
17963
17987
|
if (bundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
17964
17988
|
else {
|
|
17965
|
-
|
|
17966
|
-
|
|
17989
|
+
const normalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
17990
|
+
for (const version of normalizedVersions) {
|
|
17991
|
+
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${oldChannel}/*`);
|
|
17992
|
+
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${newChannel$1}/*`);
|
|
17993
|
+
}
|
|
17967
17994
|
}
|
|
17968
17995
|
}
|
|
17969
17996
|
if (updatedBundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${updatedBundle$1.fingerprintHash}/${updatedBundle$1.channel}/*`);
|
|
17970
17997
|
else if (updatedBundle$1.targetAppVersion) {
|
|
17971
17998
|
if (!isExactVersion(updatedBundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/*`);
|
|
17972
|
-
else
|
|
17999
|
+
else {
|
|
18000
|
+
const normalizedVersions = getSemverNormalizedVersions(updatedBundle$1.targetAppVersion);
|
|
18001
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/${version}/${updatedBundle$1.channel}/*`);
|
|
18002
|
+
}
|
|
17973
18003
|
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
17974
|
-
else
|
|
18004
|
+
else {
|
|
18005
|
+
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
18006
|
+
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
18007
|
+
}
|
|
17975
18008
|
}
|
|
17976
18009
|
continue;
|
|
17977
18010
|
}
|
|
@@ -17988,9 +18021,15 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17988
18021
|
if (updatedBundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${updatedBundle.platform}/${updatedBundle.fingerprintHash}/${updatedBundle.channel}/*`);
|
|
17989
18022
|
else if (updatedBundle.targetAppVersion) {
|
|
17990
18023
|
if (!isExactVersion(updatedBundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/*`);
|
|
17991
|
-
else
|
|
18024
|
+
else {
|
|
18025
|
+
const normalizedVersions = getSemverNormalizedVersions(updatedBundle.targetAppVersion);
|
|
18026
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/${version}/${updatedBundle.channel}/*`);
|
|
18027
|
+
}
|
|
17992
18028
|
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
17993
|
-
else
|
|
18029
|
+
else {
|
|
18030
|
+
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
18031
|
+
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
18032
|
+
}
|
|
17994
18033
|
}
|
|
17995
18034
|
}
|
|
17996
18035
|
}
|
package/dist/index.js
CHANGED
|
@@ -17773,6 +17773,24 @@ function isExactVersion(version) {
|
|
|
17773
17773
|
return semver.valid(version) !== null;
|
|
17774
17774
|
}
|
|
17775
17775
|
/**
|
|
17776
|
+
* Get all normalized semver versions for a version string.
|
|
17777
|
+
* This handles the case where clients may request with different normalized forms.
|
|
17778
|
+
*
|
|
17779
|
+
* Examples:
|
|
17780
|
+
* - "1.0.0" generates ["1.0.0", "1.0", "1"]
|
|
17781
|
+
* - "2.1.0" generates ["2.1.0", "2.1"]
|
|
17782
|
+
* - "1.2.3" generates ["1.2.3"]
|
|
17783
|
+
*/
|
|
17784
|
+
function getSemverNormalizedVersions(version) {
|
|
17785
|
+
const coerced = semver.coerce(version);
|
|
17786
|
+
if (!coerced) return [version];
|
|
17787
|
+
const versions = /* @__PURE__ */ new Set();
|
|
17788
|
+
versions.add(coerced.version);
|
|
17789
|
+
if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
|
|
17790
|
+
if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
|
|
17791
|
+
return Array.from(versions);
|
|
17792
|
+
}
|
|
17793
|
+
/**
|
|
17776
17794
|
*
|
|
17777
17795
|
* @param name - The name of the database plugin
|
|
17778
17796
|
* @param listObjects - Function to list objects in the storage
|
|
@@ -17899,7 +17917,10 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17899
17917
|
pathsToInvalidate.add(`/${key}`);
|
|
17900
17918
|
if (data.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${data.platform}/${data.fingerprintHash}/${data.channel}/*`);
|
|
17901
17919
|
else if (data.targetAppVersion) if (!isExactVersion(data.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/*`);
|
|
17902
|
-
else
|
|
17920
|
+
else {
|
|
17921
|
+
const normalizedVersions = getSemverNormalizedVersions(data.targetAppVersion);
|
|
17922
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${version}/${data.channel}/*`);
|
|
17923
|
+
}
|
|
17903
17924
|
continue;
|
|
17904
17925
|
}
|
|
17905
17926
|
if (operation === "delete") {
|
|
@@ -17914,7 +17935,10 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17914
17935
|
pathsToInvalidate.add(`/${key}`);
|
|
17915
17936
|
if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
|
|
17916
17937
|
else if (bundle$1.targetAppVersion) if (!isExactVersion(bundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/*`);
|
|
17917
|
-
else
|
|
17938
|
+
else {
|
|
17939
|
+
const normalizedVersions = getSemverNormalizedVersions(bundle$1.targetAppVersion);
|
|
17940
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${version}/${bundle$1.channel}/*`);
|
|
17941
|
+
}
|
|
17918
17942
|
continue;
|
|
17919
17943
|
}
|
|
17920
17944
|
let bundle = pendingBundlesMap.get(data.id);
|
|
@@ -17953,16 +17977,25 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17953
17977
|
}
|
|
17954
17978
|
if (bundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
17955
17979
|
else {
|
|
17956
|
-
|
|
17957
|
-
|
|
17980
|
+
const normalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
17981
|
+
for (const version of normalizedVersions) {
|
|
17982
|
+
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${oldChannel}/*`);
|
|
17983
|
+
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${newChannel$1}/*`);
|
|
17984
|
+
}
|
|
17958
17985
|
}
|
|
17959
17986
|
}
|
|
17960
17987
|
if (updatedBundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${updatedBundle$1.fingerprintHash}/${updatedBundle$1.channel}/*`);
|
|
17961
17988
|
else if (updatedBundle$1.targetAppVersion) {
|
|
17962
17989
|
if (!isExactVersion(updatedBundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/*`);
|
|
17963
|
-
else
|
|
17990
|
+
else {
|
|
17991
|
+
const normalizedVersions = getSemverNormalizedVersions(updatedBundle$1.targetAppVersion);
|
|
17992
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/${version}/${updatedBundle$1.channel}/*`);
|
|
17993
|
+
}
|
|
17964
17994
|
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
17965
|
-
else
|
|
17995
|
+
else {
|
|
17996
|
+
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
17997
|
+
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
17998
|
+
}
|
|
17966
17999
|
}
|
|
17967
18000
|
continue;
|
|
17968
18001
|
}
|
|
@@ -17979,9 +18012,15 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
|
|
|
17979
18012
|
if (updatedBundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${updatedBundle.platform}/${updatedBundle.fingerprintHash}/${updatedBundle.channel}/*`);
|
|
17980
18013
|
else if (updatedBundle.targetAppVersion) {
|
|
17981
18014
|
if (!isExactVersion(updatedBundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/*`);
|
|
17982
|
-
else
|
|
18015
|
+
else {
|
|
18016
|
+
const normalizedVersions = getSemverNormalizedVersions(updatedBundle.targetAppVersion);
|
|
18017
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/${version}/${updatedBundle.channel}/*`);
|
|
18018
|
+
}
|
|
17983
18019
|
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
17984
|
-
else
|
|
18020
|
+
else {
|
|
18021
|
+
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
18022
|
+
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
18023
|
+
}
|
|
17985
18024
|
}
|
|
17986
18025
|
}
|
|
17987
18026
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"fast-glob": "3.3.3",
|
|
48
48
|
"oxc-transform": "0.82.1",
|
|
49
49
|
"semver": "^7.7.2",
|
|
50
|
-
"@hot-updater/core": "0.20.
|
|
50
|
+
"@hot-updater/core": "0.20.14"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "^20",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"picocolors": "1.1.1",
|
|
59
59
|
"typescript": "5.8.2",
|
|
60
60
|
"workspace-tools": "^0.36.4",
|
|
61
|
-
"@hot-updater/plugin-core": "0.20.
|
|
61
|
+
"@hot-updater/plugin-core": "0.20.14"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "tsdown",
|