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.
Files changed (3) hide show
  1. package/lib/r2.ts +48 -0
  2. package/package.json +1 -1
  3. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hostdb",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Source and download pre-built database binaries for multiple platforms, distributed via GitHub Releases",
5
5
  "private": false,
6
6
  "type": "module",
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": "e5b96ea40e6b92e441244c52add55192db0c9ffe74a3a296ebf1a87ac35c3ac0",
77
- "size": 96849038
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": "ce596086048fffb63b224612264cd219d4f229bbe2f40aa78154f56866e25391",
82
- "size": 99325861
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": "6fdd569e40ce8ddddbbed7e45273e078c34d87a823c3581a043f560d2fe2f4fc",
245
- "size": 78302849
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": "2a343d94b6f6e56f46d113be7c360e68b307c9145ed1d5b4078e1c1f2497a4c2",
250
- "size": 79510963
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": "d0b4e0d32c27d8141ace67368711ecff28ae4d3c5a6eb366e051db4cd3cf878b",
277
- "size": 77158056
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": "0b169586f063fe294bf541eb5dd3863cb0148c049c0d66654c657c1c2dcd44a9",
282
- "size": 78331686
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": "784efdf5e6d66e57b610e0d8642e1849cac678a26fe84c5ec78d3f4345205767",
309
- "size": 76998863
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": "09d499629ba20f8a9d243d38fb2157ec61cb923748168f5cdac54fdf0c124f75",
314
- "size": 78162243
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": "eeac10db13ce778c07dcab215ea4b71c8a14595ce7a62d3ef4bd3eeb4a9a00ab",
837
- "size": 1497752
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": "0a11a44c16ac5df97fd2e7b3811bef5449d2bec19c7dbb51cc86f84c63611b48",
842
- "size": 1582372
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": "a060ff64be58e1e9ee622222411df028293454ea58f07a6e2adbf1a089413482",
869
- "size": 1278481
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": "4cc319cabbf00fbd0d5e662f67abfe060d470776cfa80b8b84c4f67869bcddea",
874
- "size": 1360554
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": "4cfd2aec2120d4d36b2a8cb8b1dd1d292ca0930f940fb7e108bcf415dfdd0183",
1039
- "size": 1391047
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": "bae40b31af7c2a83a58b61a39c23fa6c4d03d307199ed4668a828e6d8de01412",
1044
- "size": 1490869
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": "17e868ed49b8b663cd1c216748133cf582419336994bcad8714ed9144be5fbef",
1071
- "size": 1285136
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": "71b7cfb3c8033bbaac1b42d1a9dac6d4facfd4ba180c73c4147ea097859a1566",
1076
- "size": 1365448
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",