@hot-updater/plugin-core 0.25.13 → 0.26.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.
|
@@ -91,7 +91,6 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
91
91
|
const channel = key.split("/")[0];
|
|
92
92
|
if (!keysByChannel[channel]) keysByChannel[channel] = [];
|
|
93
93
|
}
|
|
94
|
-
const updatedTargetFiles = /* @__PURE__ */ new Set();
|
|
95
94
|
for (const channel of Object.keys(keysByChannel)) {
|
|
96
95
|
const updateKeys = keysByChannel[channel];
|
|
97
96
|
const targetKey = `${channel}/${platform}/target-app-versions.json`;
|
|
@@ -99,12 +98,8 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
99
98
|
const oldTargetVersions = await loadObject(targetKey) ?? [];
|
|
100
99
|
const newTargetVersions = oldTargetVersions.filter((v) => currentVersions.includes(v));
|
|
101
100
|
for (const v of currentVersions) if (!newTargetVersions.includes(v)) newTargetVersions.push(v);
|
|
102
|
-
if (JSON.stringify(oldTargetVersions) !== JSON.stringify(newTargetVersions))
|
|
103
|
-
await uploadObject(targetKey, newTargetVersions);
|
|
104
|
-
updatedTargetFiles.add(`/${targetKey}`);
|
|
105
|
-
}
|
|
101
|
+
if (JSON.stringify(oldTargetVersions) !== JSON.stringify(newTargetVersions)) await uploadObject(targetKey, newTargetVersions);
|
|
106
102
|
}
|
|
107
|
-
return updatedTargetFiles;
|
|
108
103
|
}
|
|
109
104
|
/**
|
|
110
105
|
* Lists update.json keys for a given platform.
|
|
@@ -117,6 +112,25 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
117
112
|
const pattern = channel ? platform ? /* @__PURE__ */ new RegExp(`^${channel}/${platform}/[^/]+/update\\.json$`) : /* @__PURE__ */ new RegExp(`^${channel}/[^/]+/[^/]+/update\\.json$`) : platform ? /* @__PURE__ */ new RegExp(`^[^/]+/${platform}/[^/]+/update\\.json$`) : /^[^/]+\/[^/]+\/[^/]+\/update\.json$/;
|
|
118
113
|
return listObjects(prefix).then((keys) => keys.filter((key) => pattern.test(key)));
|
|
119
114
|
}
|
|
115
|
+
const addAppVersionInvalidationPaths = (pathsToInvalidate, { platform, channel, targetAppVersion }) => {
|
|
116
|
+
if (!isExactVersion(targetAppVersion)) {
|
|
117
|
+
pathsToInvalidate.add(`${apiBasePath}/app-version/${platform}/*`);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const normalizedVersions = getSemverNormalizedVersions(targetAppVersion);
|
|
121
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${platform}/${version}/${channel}/*`);
|
|
122
|
+
};
|
|
123
|
+
const addLookupInvalidationPaths = (pathsToInvalidate, { platform, channel, targetAppVersion, fingerprintHash }) => {
|
|
124
|
+
if (fingerprintHash) {
|
|
125
|
+
pathsToInvalidate.add(`${apiBasePath}/fingerprint/${platform}/${fingerprintHash}/${channel}/*`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (targetAppVersion) addAppVersionInvalidationPaths(pathsToInvalidate, {
|
|
129
|
+
platform,
|
|
130
|
+
channel,
|
|
131
|
+
targetAppVersion
|
|
132
|
+
});
|
|
133
|
+
};
|
|
120
134
|
return require_createDatabasePlugin.createDatabasePlugin({
|
|
121
135
|
name,
|
|
122
136
|
factory: () => ({
|
|
@@ -175,13 +189,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
175
189
|
pendingBundlesMap.set(data.id, bundleWithKey);
|
|
176
190
|
changedBundlesByKey[key] = changedBundlesByKey[key] || [];
|
|
177
191
|
changedBundlesByKey[key].push(removeBundleInternalKeys(bundleWithKey));
|
|
178
|
-
pathsToInvalidate
|
|
179
|
-
if (data.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${data.platform}/${data.fingerprintHash}/${data.channel}/*`);
|
|
180
|
-
else if (data.targetAppVersion) if (!isExactVersion(data.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/*`);
|
|
181
|
-
else {
|
|
182
|
-
const normalizedVersions = getSemverNormalizedVersions(data.targetAppVersion);
|
|
183
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${version}/${data.channel}/*`);
|
|
184
|
-
}
|
|
192
|
+
addLookupInvalidationPaths(pathsToInvalidate, data);
|
|
185
193
|
continue;
|
|
186
194
|
}
|
|
187
195
|
if (operation === "delete") {
|
|
@@ -193,13 +201,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
193
201
|
const key = bundle$1._updateJsonKey;
|
|
194
202
|
removalsByKey[key] = removalsByKey[key] || [];
|
|
195
203
|
removalsByKey[key].push(bundle$1.id);
|
|
196
|
-
pathsToInvalidate
|
|
197
|
-
if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
|
|
198
|
-
else if (bundle$1.targetAppVersion) if (!isExactVersion(bundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/*`);
|
|
199
|
-
else {
|
|
200
|
-
const normalizedVersions = getSemverNormalizedVersions(bundle$1.targetAppVersion);
|
|
201
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${version}/${bundle$1.channel}/*`);
|
|
202
|
-
}
|
|
204
|
+
addLookupInvalidationPaths(pathsToInvalidate, bundle$1);
|
|
203
205
|
continue;
|
|
204
206
|
}
|
|
205
207
|
let bundle = pendingBundlesMap.get(data.id);
|
|
@@ -225,39 +227,17 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
225
227
|
bundlesMap.set(data.id, updatedBundle$1);
|
|
226
228
|
pendingBundlesMap.set(data.id, updatedBundle$1);
|
|
227
229
|
changedBundlesByKey[newKey].push(removeBundleInternalKeys(updatedBundle$1));
|
|
228
|
-
pathsToInvalidate.add(`/${oldKey}`);
|
|
229
|
-
pathsToInvalidate.add(`/${newKey}`);
|
|
230
230
|
const oldChannel = bundle.channel;
|
|
231
|
-
const
|
|
232
|
-
if (oldChannel !==
|
|
233
|
-
pathsToInvalidate
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
if (bundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
240
|
-
else {
|
|
241
|
-
const normalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
242
|
-
for (const version of normalizedVersions) {
|
|
243
|
-
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${oldChannel}/*`);
|
|
244
|
-
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${newChannel$1}/*`);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
if (updatedBundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${updatedBundle$1.fingerprintHash}/${updatedBundle$1.channel}/*`);
|
|
249
|
-
else if (updatedBundle$1.targetAppVersion) {
|
|
250
|
-
if (!isExactVersion(updatedBundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/*`);
|
|
251
|
-
else {
|
|
252
|
-
const normalizedVersions = getSemverNormalizedVersions(updatedBundle$1.targetAppVersion);
|
|
253
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/${version}/${updatedBundle$1.channel}/*`);
|
|
254
|
-
}
|
|
255
|
-
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
256
|
-
else {
|
|
257
|
-
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
258
|
-
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
259
|
-
}
|
|
231
|
+
const nextChannel = updatedBundle$1.channel;
|
|
232
|
+
if (oldChannel !== nextChannel) {
|
|
233
|
+
addLookupInvalidationPaths(pathsToInvalidate, bundle);
|
|
234
|
+
if (bundle.targetAppVersion && !bundle.fingerprintHash) addLookupInvalidationPaths(pathsToInvalidate, {
|
|
235
|
+
...bundle,
|
|
236
|
+
channel: nextChannel
|
|
237
|
+
});
|
|
260
238
|
}
|
|
239
|
+
addLookupInvalidationPaths(pathsToInvalidate, updatedBundle$1);
|
|
240
|
+
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) addLookupInvalidationPaths(pathsToInvalidate, bundle);
|
|
261
241
|
continue;
|
|
262
242
|
}
|
|
263
243
|
const currentKey = bundle._updateJsonKey;
|
|
@@ -269,20 +249,8 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
269
249
|
pendingBundlesMap.set(data.id, updatedBundle);
|
|
270
250
|
changedBundlesByKey[currentKey] = changedBundlesByKey[currentKey] || [];
|
|
271
251
|
changedBundlesByKey[currentKey].push(removeBundleInternalKeys(updatedBundle));
|
|
272
|
-
pathsToInvalidate
|
|
273
|
-
if (
|
|
274
|
-
else if (updatedBundle.targetAppVersion) {
|
|
275
|
-
if (!isExactVersion(updatedBundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/*`);
|
|
276
|
-
else {
|
|
277
|
-
const normalizedVersions = getSemverNormalizedVersions(updatedBundle.targetAppVersion);
|
|
278
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/${version}/${updatedBundle.channel}/*`);
|
|
279
|
-
}
|
|
280
|
-
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
281
|
-
else {
|
|
282
|
-
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
283
|
-
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
252
|
+
addLookupInvalidationPaths(pathsToInvalidate, updatedBundle);
|
|
253
|
+
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) addLookupInvalidationPaths(pathsToInvalidate, bundle);
|
|
286
254
|
}
|
|
287
255
|
}
|
|
288
256
|
for (const oldKey of Object.keys(removalsByKey)) await (async () => {
|
|
@@ -302,12 +270,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
302
270
|
currentBundles.sort((a, b) => b.id.localeCompare(a.id));
|
|
303
271
|
await uploadObject(key, currentBundles);
|
|
304
272
|
})();
|
|
305
|
-
|
|
306
|
-
if (isTargetAppVersionChanged || isChannelChanged) for (const platform of PLATFORMS) {
|
|
307
|
-
const updatedPaths = await updateTargetVersionsForPlatform(platform);
|
|
308
|
-
for (const path of updatedPaths) updatedTargetFilePaths.add(path);
|
|
309
|
-
}
|
|
310
|
-
for (const path of updatedTargetFilePaths) pathsToInvalidate.add(path);
|
|
273
|
+
if (isTargetAppVersionChanged || isChannelChanged) for (const platform of PLATFORMS) await updateTargetVersionsForPlatform(platform);
|
|
311
274
|
const encondedPaths = /* @__PURE__ */ new Set();
|
|
312
275
|
for (const path of pathsToInvalidate) encondedPaths.add(encodeURI(path));
|
|
313
276
|
await invalidatePaths(Array.from(encondedPaths));
|
|
@@ -88,7 +88,6 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
88
88
|
const channel = key.split("/")[0];
|
|
89
89
|
if (!keysByChannel[channel]) keysByChannel[channel] = [];
|
|
90
90
|
}
|
|
91
|
-
const updatedTargetFiles = /* @__PURE__ */ new Set();
|
|
92
91
|
for (const channel of Object.keys(keysByChannel)) {
|
|
93
92
|
const updateKeys = keysByChannel[channel];
|
|
94
93
|
const targetKey = `${channel}/${platform}/target-app-versions.json`;
|
|
@@ -96,12 +95,8 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
96
95
|
const oldTargetVersions = await loadObject(targetKey) ?? [];
|
|
97
96
|
const newTargetVersions = oldTargetVersions.filter((v) => currentVersions.includes(v));
|
|
98
97
|
for (const v of currentVersions) if (!newTargetVersions.includes(v)) newTargetVersions.push(v);
|
|
99
|
-
if (JSON.stringify(oldTargetVersions) !== JSON.stringify(newTargetVersions))
|
|
100
|
-
await uploadObject(targetKey, newTargetVersions);
|
|
101
|
-
updatedTargetFiles.add(`/${targetKey}`);
|
|
102
|
-
}
|
|
98
|
+
if (JSON.stringify(oldTargetVersions) !== JSON.stringify(newTargetVersions)) await uploadObject(targetKey, newTargetVersions);
|
|
103
99
|
}
|
|
104
|
-
return updatedTargetFiles;
|
|
105
100
|
}
|
|
106
101
|
/**
|
|
107
102
|
* Lists update.json keys for a given platform.
|
|
@@ -114,6 +109,25 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
114
109
|
const pattern = channel ? platform ? /* @__PURE__ */ new RegExp(`^${channel}/${platform}/[^/]+/update\\.json$`) : /* @__PURE__ */ new RegExp(`^${channel}/[^/]+/[^/]+/update\\.json$`) : platform ? /* @__PURE__ */ new RegExp(`^[^/]+/${platform}/[^/]+/update\\.json$`) : /^[^/]+\/[^/]+\/[^/]+\/update\.json$/;
|
|
115
110
|
return listObjects(prefix).then((keys) => keys.filter((key) => pattern.test(key)));
|
|
116
111
|
}
|
|
112
|
+
const addAppVersionInvalidationPaths = (pathsToInvalidate, { platform, channel, targetAppVersion }) => {
|
|
113
|
+
if (!isExactVersion(targetAppVersion)) {
|
|
114
|
+
pathsToInvalidate.add(`${apiBasePath}/app-version/${platform}/*`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const normalizedVersions = getSemverNormalizedVersions(targetAppVersion);
|
|
118
|
+
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${platform}/${version}/${channel}/*`);
|
|
119
|
+
};
|
|
120
|
+
const addLookupInvalidationPaths = (pathsToInvalidate, { platform, channel, targetAppVersion, fingerprintHash }) => {
|
|
121
|
+
if (fingerprintHash) {
|
|
122
|
+
pathsToInvalidate.add(`${apiBasePath}/fingerprint/${platform}/${fingerprintHash}/${channel}/*`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (targetAppVersion) addAppVersionInvalidationPaths(pathsToInvalidate, {
|
|
126
|
+
platform,
|
|
127
|
+
channel,
|
|
128
|
+
targetAppVersion
|
|
129
|
+
});
|
|
130
|
+
};
|
|
117
131
|
return createDatabasePlugin({
|
|
118
132
|
name,
|
|
119
133
|
factory: () => ({
|
|
@@ -172,13 +186,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
172
186
|
pendingBundlesMap.set(data.id, bundleWithKey);
|
|
173
187
|
changedBundlesByKey[key] = changedBundlesByKey[key] || [];
|
|
174
188
|
changedBundlesByKey[key].push(removeBundleInternalKeys(bundleWithKey));
|
|
175
|
-
pathsToInvalidate
|
|
176
|
-
if (data.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${data.platform}/${data.fingerprintHash}/${data.channel}/*`);
|
|
177
|
-
else if (data.targetAppVersion) if (!isExactVersion(data.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/*`);
|
|
178
|
-
else {
|
|
179
|
-
const normalizedVersions = getSemverNormalizedVersions(data.targetAppVersion);
|
|
180
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${version}/${data.channel}/*`);
|
|
181
|
-
}
|
|
189
|
+
addLookupInvalidationPaths(pathsToInvalidate, data);
|
|
182
190
|
continue;
|
|
183
191
|
}
|
|
184
192
|
if (operation === "delete") {
|
|
@@ -190,13 +198,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
190
198
|
const key = bundle$1._updateJsonKey;
|
|
191
199
|
removalsByKey[key] = removalsByKey[key] || [];
|
|
192
200
|
removalsByKey[key].push(bundle$1.id);
|
|
193
|
-
pathsToInvalidate
|
|
194
|
-
if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
|
|
195
|
-
else if (bundle$1.targetAppVersion) if (!isExactVersion(bundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/*`);
|
|
196
|
-
else {
|
|
197
|
-
const normalizedVersions = getSemverNormalizedVersions(bundle$1.targetAppVersion);
|
|
198
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${version}/${bundle$1.channel}/*`);
|
|
199
|
-
}
|
|
201
|
+
addLookupInvalidationPaths(pathsToInvalidate, bundle$1);
|
|
200
202
|
continue;
|
|
201
203
|
}
|
|
202
204
|
let bundle = pendingBundlesMap.get(data.id);
|
|
@@ -222,39 +224,17 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
222
224
|
bundlesMap.set(data.id, updatedBundle$1);
|
|
223
225
|
pendingBundlesMap.set(data.id, updatedBundle$1);
|
|
224
226
|
changedBundlesByKey[newKey].push(removeBundleInternalKeys(updatedBundle$1));
|
|
225
|
-
pathsToInvalidate.add(`/${oldKey}`);
|
|
226
|
-
pathsToInvalidate.add(`/${newKey}`);
|
|
227
227
|
const oldChannel = bundle.channel;
|
|
228
|
-
const
|
|
229
|
-
if (oldChannel !==
|
|
230
|
-
pathsToInvalidate
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
if (bundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
237
|
-
else {
|
|
238
|
-
const normalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
239
|
-
for (const version of normalizedVersions) {
|
|
240
|
-
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${oldChannel}/*`);
|
|
241
|
-
pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${newChannel$1}/*`);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (updatedBundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${updatedBundle$1.fingerprintHash}/${updatedBundle$1.channel}/*`);
|
|
246
|
-
else if (updatedBundle$1.targetAppVersion) {
|
|
247
|
-
if (!isExactVersion(updatedBundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/*`);
|
|
248
|
-
else {
|
|
249
|
-
const normalizedVersions = getSemverNormalizedVersions(updatedBundle$1.targetAppVersion);
|
|
250
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/${version}/${updatedBundle$1.channel}/*`);
|
|
251
|
-
}
|
|
252
|
-
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
253
|
-
else {
|
|
254
|
-
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
255
|
-
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
256
|
-
}
|
|
228
|
+
const nextChannel = updatedBundle$1.channel;
|
|
229
|
+
if (oldChannel !== nextChannel) {
|
|
230
|
+
addLookupInvalidationPaths(pathsToInvalidate, bundle);
|
|
231
|
+
if (bundle.targetAppVersion && !bundle.fingerprintHash) addLookupInvalidationPaths(pathsToInvalidate, {
|
|
232
|
+
...bundle,
|
|
233
|
+
channel: nextChannel
|
|
234
|
+
});
|
|
257
235
|
}
|
|
236
|
+
addLookupInvalidationPaths(pathsToInvalidate, updatedBundle$1);
|
|
237
|
+
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) addLookupInvalidationPaths(pathsToInvalidate, bundle);
|
|
258
238
|
continue;
|
|
259
239
|
}
|
|
260
240
|
const currentKey = bundle._updateJsonKey;
|
|
@@ -266,20 +246,8 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
266
246
|
pendingBundlesMap.set(data.id, updatedBundle);
|
|
267
247
|
changedBundlesByKey[currentKey] = changedBundlesByKey[currentKey] || [];
|
|
268
248
|
changedBundlesByKey[currentKey].push(removeBundleInternalKeys(updatedBundle));
|
|
269
|
-
pathsToInvalidate
|
|
270
|
-
if (
|
|
271
|
-
else if (updatedBundle.targetAppVersion) {
|
|
272
|
-
if (!isExactVersion(updatedBundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/*`);
|
|
273
|
-
else {
|
|
274
|
-
const normalizedVersions = getSemverNormalizedVersions(updatedBundle.targetAppVersion);
|
|
275
|
-
for (const version of normalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/${version}/${updatedBundle.channel}/*`);
|
|
276
|
-
}
|
|
277
|
-
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
|
|
278
|
-
else {
|
|
279
|
-
const oldNormalizedVersions = getSemverNormalizedVersions(bundle.targetAppVersion);
|
|
280
|
-
for (const version of oldNormalizedVersions) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${version}/${bundle.channel}/*`);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
249
|
+
addLookupInvalidationPaths(pathsToInvalidate, updatedBundle);
|
|
250
|
+
if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) addLookupInvalidationPaths(pathsToInvalidate, bundle);
|
|
283
251
|
}
|
|
284
252
|
}
|
|
285
253
|
for (const oldKey of Object.keys(removalsByKey)) await (async () => {
|
|
@@ -299,12 +267,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
|
|
|
299
267
|
currentBundles.sort((a, b) => b.id.localeCompare(a.id));
|
|
300
268
|
await uploadObject(key, currentBundles);
|
|
301
269
|
})();
|
|
302
|
-
|
|
303
|
-
if (isTargetAppVersionChanged || isChannelChanged) for (const platform of PLATFORMS) {
|
|
304
|
-
const updatedPaths = await updateTargetVersionsForPlatform(platform);
|
|
305
|
-
for (const path of updatedPaths) updatedTargetFilePaths.add(path);
|
|
306
|
-
}
|
|
307
|
-
for (const path of updatedTargetFilePaths) pathsToInvalidate.add(path);
|
|
270
|
+
if (isTargetAppVersionChanged || isChannelChanged) for (const platform of PLATFORMS) await updateTargetVersionsForPlatform(platform);
|
|
308
271
|
const encondedPaths = /* @__PURE__ */ new Set();
|
|
309
272
|
for (const path of pathsToInvalidate) encondedPaths.add(encodeURI(path));
|
|
310
273
|
await invalidatePaths(Array.from(encondedPaths));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"es-toolkit": "^1.32.0",
|
|
43
43
|
"mime": "^4.0.4",
|
|
44
44
|
"semver": "^7.7.2",
|
|
45
|
-
"@hot-updater/core": "0.
|
|
45
|
+
"@hot-updater/core": "0.26.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/semver": "^7.5.8",
|
|
49
49
|
"typescript": "5.8.2",
|
|
50
|
-
"@hot-updater/test-utils": "0.
|
|
50
|
+
"@hot-updater/test-utils": "0.26.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsdown",
|