hostdb 0.27.0 → 0.28.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/lib/r2.ts +48 -0
- package/package.json +1 -1
- package/releases.json +32 -32
package/lib/r2.ts
CHANGED
|
@@ -158,3 +158,51 @@ export async function publishReleasesJson(options: {
|
|
|
158
158
|
}): Promise<void> {
|
|
159
159
|
await publishJsonToR2({ ...options, filename: 'releases.json' })
|
|
160
160
|
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Purge Cloudflare CDN cache for specific URLs.
|
|
164
|
+
*
|
|
165
|
+
* Required env vars: CLOUDFLARE_API_TOKEN, CLOUDFLARE_ZONE_ID
|
|
166
|
+
* If not set, logs a warning and returns (no-op).
|
|
167
|
+
*/
|
|
168
|
+
export async function purgeCloudflareCache(
|
|
169
|
+
urls: string[],
|
|
170
|
+
): Promise<{ purged: boolean; count: number }> {
|
|
171
|
+
const apiToken = process.env.CLOUDFLARE_API_TOKEN
|
|
172
|
+
const zoneId = process.env.CLOUDFLARE_ZONE_ID
|
|
173
|
+
|
|
174
|
+
if (!apiToken || !zoneId) {
|
|
175
|
+
return { purged: false, count: 0 }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Cloudflare allows max 30 URLs per purge request
|
|
179
|
+
const BATCH_SIZE = 30
|
|
180
|
+
let totalPurged = 0
|
|
181
|
+
|
|
182
|
+
for (let i = 0; i < urls.length; i += BATCH_SIZE) {
|
|
183
|
+
const batch = urls.slice(i, i + BATCH_SIZE)
|
|
184
|
+
|
|
185
|
+
const response = await fetch(
|
|
186
|
+
`https://api.cloudflare.com/client/v4/zones/${zoneId}/purge_cache`,
|
|
187
|
+
{
|
|
188
|
+
method: 'POST',
|
|
189
|
+
headers: {
|
|
190
|
+
Authorization: `Bearer ${apiToken}`,
|
|
191
|
+
'Content-Type': 'application/json',
|
|
192
|
+
},
|
|
193
|
+
body: JSON.stringify({ files: batch }),
|
|
194
|
+
},
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
if (!response.ok) {
|
|
198
|
+
const body = await response.text()
|
|
199
|
+
throw new Error(
|
|
200
|
+
`Cloudflare cache purge failed: ${response.status} ${body}`,
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
totalPurged += batch.length
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return { purged: true, count: totalPurged }
|
|
208
|
+
}
|
package/package.json
CHANGED
package/releases.json
CHANGED
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"platforms": {
|
|
74
74
|
"darwin-arm64": {
|
|
75
75
|
"url": "https://registry.layerbase.host/couchdb-3.5.1/couchdb-3.5.1-darwin-arm64.tar.gz",
|
|
76
|
-
"sha256": "
|
|
77
|
-
"size":
|
|
76
|
+
"sha256": "444b41ecca208faa2ea6b25b57b270d2493cac55f5783c2e577aeeff9497f854",
|
|
77
|
+
"size": 96726799
|
|
78
78
|
},
|
|
79
79
|
"darwin-x64": {
|
|
80
80
|
"url": "https://registry.layerbase.host/couchdb-3.5.1/couchdb-3.5.1-darwin-x64.tar.gz",
|
|
81
|
-
"sha256": "
|
|
82
|
-
"size":
|
|
81
|
+
"sha256": "6f52214ab10b75c47577ba513bddffd4add8f5e3d509d135d0fcd4505492fc12",
|
|
82
|
+
"size": 99199477
|
|
83
83
|
},
|
|
84
84
|
"linux-arm64": {
|
|
85
85
|
"url": "https://registry.layerbase.host/couchdb-3.5.1/couchdb-3.5.1-linux-arm64.tar.gz",
|
|
@@ -241,13 +241,13 @@
|
|
|
241
241
|
"platforms": {
|
|
242
242
|
"darwin-arm64": {
|
|
243
243
|
"url": "https://registry.layerbase.host/mariadb-11.8.5/mariadb-11.8.5-darwin-arm64.tar.gz",
|
|
244
|
-
"sha256": "
|
|
245
|
-
"size":
|
|
244
|
+
"sha256": "c454854be9bc25c7d3f3a662c57819a2b0d78e9802f3764e2776032fa5477c78",
|
|
245
|
+
"size": 80955321
|
|
246
246
|
},
|
|
247
247
|
"darwin-x64": {
|
|
248
248
|
"url": "https://registry.layerbase.host/mariadb-11.8.5/mariadb-11.8.5-darwin-x64.tar.gz",
|
|
249
|
-
"sha256": "
|
|
250
|
-
"size":
|
|
249
|
+
"sha256": "268ec04d4d75963389cb15e08ad7ce669d15aeacb696276195c6266efcaced13",
|
|
250
|
+
"size": 83304379
|
|
251
251
|
},
|
|
252
252
|
"linux-arm64": {
|
|
253
253
|
"url": "https://registry.layerbase.host/mariadb-11.8.5/mariadb-11.8.5-linux-arm64.tar.gz",
|
|
@@ -273,13 +273,13 @@
|
|
|
273
273
|
"platforms": {
|
|
274
274
|
"darwin-arm64": {
|
|
275
275
|
"url": "https://registry.layerbase.host/mariadb-11.4.5/mariadb-11.4.5-darwin-arm64.tar.gz",
|
|
276
|
-
"sha256": "
|
|
277
|
-
"size":
|
|
276
|
+
"sha256": "eaf68030cd808d5db5b449d870a98cba68c41d459325f0ad0d855c3908633eaa",
|
|
277
|
+
"size": 79824774
|
|
278
278
|
},
|
|
279
279
|
"darwin-x64": {
|
|
280
280
|
"url": "https://registry.layerbase.host/mariadb-11.4.5/mariadb-11.4.5-darwin-x64.tar.gz",
|
|
281
|
-
"sha256": "
|
|
282
|
-
"size":
|
|
281
|
+
"sha256": "8b099ad3314c95a4e18255c5fb0cccf586b9a669a734d42ee20b8d4df19fb82f",
|
|
282
|
+
"size": 82119958
|
|
283
283
|
},
|
|
284
284
|
"linux-arm64": {
|
|
285
285
|
"url": "https://registry.layerbase.host/mariadb-11.4.5/mariadb-11.4.5-linux-arm64.tar.gz",
|
|
@@ -305,13 +305,13 @@
|
|
|
305
305
|
"platforms": {
|
|
306
306
|
"darwin-arm64": {
|
|
307
307
|
"url": "https://registry.layerbase.host/mariadb-10.11.15/mariadb-10.11.15-darwin-arm64.tar.gz",
|
|
308
|
-
"sha256": "
|
|
309
|
-
"size":
|
|
308
|
+
"sha256": "51894275a19270c9cf429788630e0725293c39ee4f5450ed696ddef8c0b8d0ac",
|
|
309
|
+
"size": 79653537
|
|
310
310
|
},
|
|
311
311
|
"darwin-x64": {
|
|
312
312
|
"url": "https://registry.layerbase.host/mariadb-10.11.15/mariadb-10.11.15-darwin-x64.tar.gz",
|
|
313
|
-
"sha256": "
|
|
314
|
-
"size":
|
|
313
|
+
"sha256": "1d773381079b6f33e29f61ee830da021894c8302a50ea81f98980a9dad79ee23",
|
|
314
|
+
"size": 81943271
|
|
315
315
|
},
|
|
316
316
|
"linux-arm64": {
|
|
317
317
|
"url": "https://registry.layerbase.host/mariadb-10.11.15/mariadb-10.11.15-linux-arm64.tar.gz",
|
|
@@ -833,13 +833,13 @@
|
|
|
833
833
|
"platforms": {
|
|
834
834
|
"darwin-arm64": {
|
|
835
835
|
"url": "https://registry.layerbase.host/redis-8.4.0/redis-8.4.0-darwin-arm64.tar.gz",
|
|
836
|
-
"sha256": "
|
|
837
|
-
"size":
|
|
836
|
+
"sha256": "0e2a48c3d5ae8c973b5f6c65d7fb68d1a80da9378df635e6cdc00fc2a55a5a8a",
|
|
837
|
+
"size": 4162572
|
|
838
838
|
},
|
|
839
839
|
"darwin-x64": {
|
|
840
840
|
"url": "https://registry.layerbase.host/redis-8.4.0/redis-8.4.0-darwin-x64.tar.gz",
|
|
841
|
-
"sha256": "
|
|
842
|
-
"size":
|
|
841
|
+
"sha256": "a674bba83c259ce94a9ff6eff74258b5f5b982ae44a1637f8ed5ab880cb1b566",
|
|
842
|
+
"size": 4035868
|
|
843
843
|
},
|
|
844
844
|
"linux-arm64": {
|
|
845
845
|
"url": "https://registry.layerbase.host/redis-8.4.0/redis-8.4.0-linux-arm64.tar.gz",
|
|
@@ -865,13 +865,13 @@
|
|
|
865
865
|
"platforms": {
|
|
866
866
|
"darwin-arm64": {
|
|
867
867
|
"url": "https://registry.layerbase.host/redis-7.4.7/redis-7.4.7-darwin-arm64.tar.gz",
|
|
868
|
-
"sha256": "
|
|
869
|
-
"size":
|
|
868
|
+
"sha256": "242cb46cf12f52205e7978df520ffc70e0569f1352a01ac42bbd93d23eb256ef",
|
|
869
|
+
"size": 3947352
|
|
870
870
|
},
|
|
871
871
|
"darwin-x64": {
|
|
872
872
|
"url": "https://registry.layerbase.host/redis-7.4.7/redis-7.4.7-darwin-x64.tar.gz",
|
|
873
|
-
"sha256": "
|
|
874
|
-
"size":
|
|
873
|
+
"sha256": "2bb2049471467234e2191c01032a9f5039323fd0825ece792d6248aca306245f",
|
|
874
|
+
"size": 3810104
|
|
875
875
|
},
|
|
876
876
|
"linux-arm64": {
|
|
877
877
|
"url": "https://registry.layerbase.host/redis-7.4.7/redis-7.4.7-linux-arm64.tar.gz",
|
|
@@ -1035,13 +1035,13 @@
|
|
|
1035
1035
|
"platforms": {
|
|
1036
1036
|
"darwin-arm64": {
|
|
1037
1037
|
"url": "https://registry.layerbase.host/valkey-9.0.1/valkey-9.0.1-darwin-arm64.tar.gz",
|
|
1038
|
-
"sha256": "
|
|
1039
|
-
"size":
|
|
1038
|
+
"sha256": "3d49a6c92cf4656ce128d6c60b0c017cc62317ce5cc0afa8d025009066093d09",
|
|
1039
|
+
"size": 4059940
|
|
1040
1040
|
},
|
|
1041
1041
|
"darwin-x64": {
|
|
1042
1042
|
"url": "https://registry.layerbase.host/valkey-9.0.1/valkey-9.0.1-darwin-x64.tar.gz",
|
|
1043
|
-
"sha256": "
|
|
1044
|
-
"size":
|
|
1043
|
+
"sha256": "633f8bfc3fce675f9751c5cbc396d35169ce5790353e005cbe4056ec988cefa1",
|
|
1044
|
+
"size": 3941591
|
|
1045
1045
|
},
|
|
1046
1046
|
"linux-arm64": {
|
|
1047
1047
|
"url": "https://registry.layerbase.host/valkey-9.0.1/valkey-9.0.1-linux-arm64.tar.gz",
|
|
@@ -1067,13 +1067,13 @@
|
|
|
1067
1067
|
"platforms": {
|
|
1068
1068
|
"darwin-arm64": {
|
|
1069
1069
|
"url": "https://registry.layerbase.host/valkey-8.0.6/valkey-8.0.6-darwin-arm64.tar.gz",
|
|
1070
|
-
"sha256": "
|
|
1071
|
-
"size":
|
|
1070
|
+
"sha256": "8501a77d9f289122599f43fd932be5367863ca0d693cc792b3fe4f239425811a",
|
|
1071
|
+
"size": 3954916
|
|
1072
1072
|
},
|
|
1073
1073
|
"darwin-x64": {
|
|
1074
1074
|
"url": "https://registry.layerbase.host/valkey-8.0.6/valkey-8.0.6-darwin-x64.tar.gz",
|
|
1075
|
-
"sha256": "
|
|
1076
|
-
"size":
|
|
1075
|
+
"sha256": "917982453b64e80fb2968ee0ea3e61c71d86f89bbaa8d513acbde7908a8bd0ce",
|
|
1076
|
+
"size": 3815087
|
|
1077
1077
|
},
|
|
1078
1078
|
"linux-arm64": {
|
|
1079
1079
|
"url": "https://registry.layerbase.host/valkey-8.0.6/valkey-8.0.6-linux-arm64.tar.gz",
|