hostdb 0.30.0 → 0.31.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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # hostdb
2
2
 
3
- Pre-built database binaries for all major platforms, distributed via GitHub Releases.
3
+ Pre-built database binaries for all major platforms, distributed via Cloudflare R2 (mirrored from GitHub Releases). Also a **typed npm package** (`hostdb`) that bundles the registry offline so consumers can resolve versions and download URLs without a network round-trip to `registry.layerbase.host`.
4
4
 
5
- **Primary consumer:** [SpinDB](https://github.com/robertjbass/spindb) - a CLI tool for spinning up local database instances
5
+ **Primary consumer:** [SpinDB](https://github.com/robertjbass/spindb) a CLI tool for spinning up local database instances. SpinDB depends on `hostdb` as a pinned npm dependency; bumping `hostdb` is how SpinDB picks up new database versions.
6
6
 
7
7
  ## Philosophy
8
8
 
@@ -51,20 +51,52 @@ pnpm dbs
51
51
 
52
52
  ## Querying Available Binaries
53
53
 
54
- SpinDB (or any consumer) can fetch `releases.json` for available binaries:
54
+ ### As an npm package (recommended)
55
55
 
56
56
  ```bash
57
- curl https://raw.githubusercontent.com/robertjbass/hostdb/main/releases.json
57
+ pnpm add hostdb # or: npm install hostdb / yarn add hostdb
58
+ ```
59
+
60
+ ```ts
61
+ import {
62
+ resolveVersion,
63
+ getReleaseInfo,
64
+ listEngines,
65
+ } from 'hostdb'
66
+
67
+ // Short-form version → full pinned version (LTS-aware via the defaults block)
68
+ resolveVersion('postgresql', '17') // '17.10.0'
69
+ resolveVersion('mongodb', '8') // '8.0.23' (LTS pick, not the highest 8.x)
70
+ resolveVersion('mysql', '8') // '8.4.9' (LTS, not the 9.x latest)
71
+
72
+ // Find the R2 download URL + sha256 for a specific platform
73
+ getReleaseInfo('postgresql', '17.10.0', 'linux-x64')
74
+ // → { url: 'https://registry.layerbase.host/...', sha256: '...', size: 165123456 }
75
+
76
+ // All bundled engines
77
+ listEngines() // ['clickhouse', 'cockroachdb', ..., 'weaviate']
78
+ ```
79
+
80
+ The published tarball ships `databases.json`, `releases.json`, and `downloads.json` baked in. No runtime network calls. Pin to an exact version (e.g., `"hostdb": "0.31.0"` — no caret, no tilde) so the snapshot is deterministic for any given consumer release.
81
+
82
+ Full API surface is locked in `tests/api-shape.test.ts` (currently 19 exported names).
83
+
84
+ ### As raw JSON
85
+
86
+ ```bash
87
+ curl https://registry.layerbase.host/releases.json
58
88
  ```
59
89
 
60
90
  **Download URL pattern:**
61
91
  ```
62
- https://github.com/robertjbass/hostdb/releases/download/{tag}/{filename}
92
+ https://registry.layerbase.host/{tag}/{filename}
63
93
 
64
94
  # Example:
65
- https://github.com/robertjbass/hostdb/releases/download/mysql-8.4.3/mysql-8.4.3-darwin-arm64.tar.gz
95
+ https://registry.layerbase.host/mysql-8.4.3/mysql-8.4.3-darwin-arm64.tar.gz
66
96
  ```
67
97
 
98
+ GitHub Releases (`https://github.com/robertjbass/hostdb/releases/download/...`) are the upstream source; R2 is the canonical mirror.
99
+
68
100
  ## Configuration Files
69
101
 
70
102
  | File | Purpose |
package/databases.json CHANGED
@@ -12,14 +12,25 @@
12
12
  "hostedServiceAllowed": true,
13
13
  "protocol": null,
14
14
  "note": "Windows binaries unavailable. Require WSL.",
15
+ "defaults": {
16
+ "25": "25.12.3.21"
17
+ },
15
18
  "versions": {
16
19
  "25.12.3.21": true
17
20
  },
18
- "platforms": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64"],
21
+ "platforms": [
22
+ "linux-x64",
23
+ "linux-arm64",
24
+ "darwin-x64",
25
+ "darwin-arm64"
26
+ ],
19
27
  "cliTools": {
20
28
  "server": "clickhouse-server",
21
29
  "client": "clickhouse-client",
22
- "utilities": ["clickhouse-local", "clickhouse-benchmark"],
30
+ "utilities": [
31
+ "clickhouse-local",
32
+ "clickhouse-benchmark"
33
+ ],
23
34
  "enhanced": []
24
35
  },
25
36
  "connection": {
@@ -42,6 +53,9 @@
42
53
  "hostedServiceAllowed": false,
43
54
  "protocol": "postgresql",
44
55
  "note": "CockroachDB Software License restricts competing cloud services; fine for local dev",
56
+ "defaults": {
57
+ "25": "25.4.2"
58
+ },
45
59
  "versions": {
46
60
  "25.4.2": true
47
61
  },
@@ -56,7 +70,10 @@
56
70
  "server": "cockroach",
57
71
  "client": "cockroach",
58
72
  "utilities": [],
59
- "enhanced": ["pgcli", "usql"],
73
+ "enhanced": [
74
+ "pgcli",
75
+ "usql"
76
+ ],
60
77
  "note": "Single binary; use 'cockroach start-single-node' for server, 'cockroach sql' for client"
61
78
  },
62
79
  "connection": {
@@ -79,6 +96,9 @@
79
96
  "hostedServiceAllowed": true,
80
97
  "protocol": null,
81
98
  "note": "",
99
+ "defaults": {
100
+ "3": "3.5.1"
101
+ },
82
102
  "versions": {
83
103
  "3.5.1": true
84
104
  },
@@ -116,7 +136,11 @@
116
136
  "hostedServiceAllowed": true,
117
137
  "protocol": null,
118
138
  "note": "",
139
+ "defaults": {
140
+ "1": "1.4.4"
141
+ },
119
142
  "versions": {
143
+ "1.4.4": true,
120
144
  "1.4.3": true
121
145
  },
122
146
  "platforms": [
@@ -130,7 +154,9 @@
130
154
  "server": null,
131
155
  "client": "duckdb",
132
156
  "utilities": [],
133
- "enhanced": ["usql"]
157
+ "enhanced": [
158
+ "usql"
159
+ ]
134
160
  },
135
161
  "connection": {
136
162
  "runtime": "embedded",
@@ -152,6 +178,10 @@
152
178
  "hostedServiceAllowed": true,
153
179
  "protocol": "mongodb",
154
180
  "note": "FerretDB v2 requires PostgreSQL-DocumentDB; v1 uses plain PostgreSQL",
181
+ "defaults": {
182
+ "1": "1.24.2",
183
+ "2": "2.7.0"
184
+ },
155
185
  "versions": {
156
186
  "2.7.0": {
157
187
  "platforms": [
@@ -188,7 +218,10 @@
188
218
  "cliTools": {
189
219
  "server": "ferretdb",
190
220
  "client": "mongosh",
191
- "utilities": ["mongodump", "mongorestore"],
221
+ "utilities": [
222
+ "mongodump",
223
+ "mongorestore"
224
+ ],
192
225
  "enhanced": []
193
226
  },
194
227
  "connection": {
@@ -211,6 +244,9 @@
211
244
  "hostedServiceAllowed": true,
212
245
  "protocol": null,
213
246
  "note": "v3.0 is a Rust rewrite using Apache Arrow/DataFusion. Single binary with bundled Python runtime for plugin system. Most popular time-series database by adoption.",
247
+ "defaults": {
248
+ "3": "3.8.0"
249
+ },
214
250
  "versions": {
215
251
  "3.8.0": true
216
252
  },
@@ -248,15 +284,26 @@
248
284
  "hostedServiceAllowed": true,
249
285
  "protocol": "sqlite",
250
286
  "note": "Windows binaries unavailable. Require WSL.",
287
+ "defaults": {
288
+ "0": "0.24.32"
289
+ },
251
290
  "versions": {
252
291
  "0.24.32": true
253
292
  },
254
- "platforms": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64"],
293
+ "platforms": [
294
+ "linux-x64",
295
+ "linux-arm64",
296
+ "darwin-x64",
297
+ "darwin-arm64"
298
+ ],
255
299
  "cliTools": {
256
300
  "server": "sqld",
257
301
  "client": null,
258
302
  "utilities": [],
259
- "enhanced": ["litecli", "usql"],
303
+ "enhanced": [
304
+ "litecli",
305
+ "usql"
306
+ ],
260
307
  "note": "HTTP API; use Turso client SDKs or any libSQL/SQLite client"
261
308
  },
262
309
  "connection": {
@@ -279,9 +326,16 @@
279
326
  "hostedServiceAllowed": true,
280
327
  "protocol": null,
281
328
  "note": "",
329
+ "defaults": {
330
+ "10": "10.11.16",
331
+ "11": "11.8.6"
332
+ },
282
333
  "versions": {
334
+ "11.8.6": true,
283
335
  "11.8.5": true,
336
+ "11.4.10": true,
284
337
  "11.4.5": true,
338
+ "10.11.16": true,
285
339
  "10.11.15": true
286
340
  },
287
341
  "platforms": [
@@ -294,8 +348,15 @@
294
348
  "cliTools": {
295
349
  "server": "mariadbd",
296
350
  "client": "mariadb",
297
- "utilities": ["mariadb-dump", "mariadb-import", "mariadb-admin"],
298
- "enhanced": ["mycli", "usql"]
351
+ "utilities": [
352
+ "mariadb-dump",
353
+ "mariadb-import",
354
+ "mariadb-admin"
355
+ ],
356
+ "enhanced": [
357
+ "mycli",
358
+ "usql"
359
+ ]
299
360
  },
300
361
  "connection": {
301
362
  "runtime": "server",
@@ -317,7 +378,11 @@
317
378
  "hostedServiceAllowed": true,
318
379
  "protocol": null,
319
380
  "note": "",
381
+ "defaults": {
382
+ "1": "1.43.1"
383
+ },
320
384
  "versions": {
385
+ "1.43.1": true,
321
386
  "1.33.1": true
322
387
  },
323
388
  "platforms": [
@@ -354,9 +419,16 @@
354
419
  "hostedServiceAllowed": false,
355
420
  "protocol": null,
356
421
  "note": "SSPL restricts offering MongoDB as a competing managed database service (i.e., MongoDB Atlas competitors). Commercial use in applications, local dev, and internal use is fine. FerretDB available as fully open-source alternative.",
422
+ "defaults": {
423
+ "7": "7.0.34",
424
+ "8": "8.0.23"
425
+ },
357
426
  "versions": {
427
+ "8.2.9": true,
358
428
  "8.2.3": true,
429
+ "8.0.23": true,
359
430
  "8.0.17": true,
431
+ "7.0.34": true,
360
432
  "7.0.28": true
361
433
  },
362
434
  "platforms": [
@@ -397,14 +469,24 @@
397
469
  "hostedServiceAllowed": true,
398
470
  "protocol": null,
399
471
  "note": "",
472
+ "defaults": {
473
+ "8": "8.4.9",
474
+ "9": "9.6.0"
475
+ },
400
476
  "versions": {
401
477
  "9.6.0": {
402
478
  "note": "mysqlpump removed in MySQL 9.0; 9.x uses mysqldump only",
403
479
  "cliTools": {
404
480
  "server": "mysqld",
405
481
  "client": "mysql",
406
- "utilities": ["mysqldump", "mysqladmin"],
407
- "enhanced": ["mycli", "usql"]
482
+ "utilities": [
483
+ "mysqldump",
484
+ "mysqladmin"
485
+ ],
486
+ "enhanced": [
487
+ "mycli",
488
+ "usql"
489
+ ]
408
490
  }
409
491
  },
410
492
  "9.5.0": {
@@ -413,8 +495,14 @@
413
495
  "cliTools": {
414
496
  "server": "mysqld",
415
497
  "client": "mysql",
416
- "utilities": ["mysqldump", "mysqladmin"],
417
- "enhanced": ["mycli", "usql"]
498
+ "utilities": [
499
+ "mysqldump",
500
+ "mysqladmin"
501
+ ],
502
+ "enhanced": [
503
+ "mycli",
504
+ "usql"
505
+ ]
418
506
  }
419
507
  },
420
508
  "9.1.0": {
@@ -423,8 +511,29 @@
423
511
  "cliTools": {
424
512
  "server": "mysqld",
425
513
  "client": "mysql",
426
- "utilities": ["mysqldump", "mysqladmin"],
427
- "enhanced": ["mycli", "usql"]
514
+ "utilities": [
515
+ "mysqldump",
516
+ "mysqladmin"
517
+ ],
518
+ "enhanced": [
519
+ "mycli",
520
+ "usql"
521
+ ]
522
+ }
523
+ },
524
+ "8.4.9": {
525
+ "note": "mysqlpump removed in 8.4.9",
526
+ "cliTools": {
527
+ "server": "mysqld",
528
+ "client": "mysql",
529
+ "utilities": [
530
+ "mysqldump",
531
+ "mysqladmin"
532
+ ],
533
+ "enhanced": [
534
+ "mycli",
535
+ "usql"
536
+ ]
428
537
  }
429
538
  },
430
539
  "8.4.3": true,
@@ -443,8 +552,15 @@
443
552
  "cliTools": {
444
553
  "server": "mysqld",
445
554
  "client": "mysql",
446
- "utilities": ["mysqldump", "mysqlpump", "mysqladmin"],
447
- "enhanced": ["mycli", "usql"]
555
+ "utilities": [
556
+ "mysqldump",
557
+ "mysqlpump",
558
+ "mysqladmin"
559
+ ],
560
+ "enhanced": [
561
+ "mycli",
562
+ "usql"
563
+ ]
448
564
  },
449
565
  "connection": {
450
566
  "runtime": "server",
@@ -466,10 +582,20 @@
466
582
  "hostedServiceAllowed": true,
467
583
  "protocol": null,
468
584
  "note": "",
585
+ "defaults": {
586
+ "15": "15.18.0",
587
+ "16": "16.14.0",
588
+ "17": "17.10.0",
589
+ "18": "18.4.0"
590
+ },
469
591
  "versions": {
592
+ "18.4.0": true,
470
593
  "18.1.0": true,
594
+ "17.10.0": true,
471
595
  "17.7.0": true,
596
+ "16.14.0": true,
472
597
  "16.11.0": true,
598
+ "15.18.0": true,
473
599
  "15.15.0": true
474
600
  },
475
601
  "platforms": [
@@ -489,7 +615,10 @@
489
615
  "createdb",
490
616
  "dropdb"
491
617
  ],
492
- "enhanced": ["pgcli", "usql"]
618
+ "enhanced": [
619
+ "pgcli",
620
+ "usql"
621
+ ]
493
622
  },
494
623
  "connection": {
495
624
  "runtime": "server",
@@ -511,15 +640,30 @@
511
640
  "hostedServiceAllowed": true,
512
641
  "protocol": "postgresql",
513
642
  "note": "Backend for FerretDB v2 only; includes pg_cron, pgvector, PostGIS, rum extensions. Not available on Windows.",
643
+ "defaults": {
644
+ "17": "17-0.107.0"
645
+ },
514
646
  "versions": {
515
647
  "17-0.107.0": true
516
648
  },
517
- "platforms": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64"],
649
+ "platforms": [
650
+ "linux-x64",
651
+ "linux-arm64",
652
+ "darwin-x64",
653
+ "darwin-arm64"
654
+ ],
518
655
  "cliTools": {
519
656
  "server": "postgres",
520
657
  "client": "psql",
521
- "utilities": ["pg_dump", "pg_restore", "initdb", "pg_ctl"],
522
- "enhanced": ["pgcli"]
658
+ "utilities": [
659
+ "pg_dump",
660
+ "pg_restore",
661
+ "initdb",
662
+ "pg_ctl"
663
+ ],
664
+ "enhanced": [
665
+ "pgcli"
666
+ ]
523
667
  },
524
668
  "connection": {
525
669
  "runtime": "server",
@@ -541,6 +685,9 @@
541
685
  "hostedServiceAllowed": true,
542
686
  "protocol": null,
543
687
  "note": "",
688
+ "defaults": {
689
+ "1": "1.16.3"
690
+ },
544
691
  "versions": {
545
692
  "1.16.3": true
546
693
  },
@@ -585,6 +732,9 @@
585
732
  "note": "QuestDB uses PostgreSQL client tools (psql, pgcli) for its wire protocol; PostgreSQL remains installed as a standalone database when QuestDB is removed"
586
733
  }
587
734
  ],
735
+ "defaults": {
736
+ "9": "9.2.3"
737
+ },
588
738
  "versions": {
589
739
  "9.2.3": true
590
740
  },
@@ -599,7 +749,10 @@
599
749
  "server": "questdb",
600
750
  "client": "psql",
601
751
  "utilities": [],
602
- "enhanced": ["pgcli", "usql"],
752
+ "enhanced": [
753
+ "pgcli",
754
+ "usql"
755
+ ],
603
756
  "note": "PostgreSQL wire protocol; use psql or pgcli"
604
757
  },
605
758
  "connection": {
@@ -622,8 +775,13 @@
622
775
  "hostedServiceAllowed": false,
623
776
  "protocol": null,
624
777
  "note": "RSALv2 restricts building competing products to Redis itself. AGPL-3.0 (8.0+) requires source disclosure if you modify Redis and offer it as a network service. Commercial use in applications, local dev, and internal use is fine. Valkey available as BSD-licensed drop-in alternative.",
778
+ "defaults": {
779
+ "7": "7.4.9",
780
+ "8": "8.4.0"
781
+ },
625
782
  "versions": {
626
783
  "8.4.0": true,
784
+ "7.4.9": true,
627
785
  "7.4.7": true
628
786
  },
629
787
  "platforms": [
@@ -636,8 +794,14 @@
636
794
  "cliTools": {
637
795
  "server": "redis-server",
638
796
  "client": "redis-cli",
639
- "utilities": ["redis-benchmark", "redis-check-aof", "redis-check-rdb"],
640
- "enhanced": ["iredis"]
797
+ "utilities": [
798
+ "redis-benchmark",
799
+ "redis-check-aof",
800
+ "redis-check-rdb"
801
+ ],
802
+ "enhanced": [
803
+ "iredis"
804
+ ]
641
805
  },
642
806
  "connection": {
643
807
  "runtime": "server",
@@ -659,7 +823,11 @@
659
823
  "hostedServiceAllowed": true,
660
824
  "protocol": null,
661
825
  "note": "",
826
+ "defaults": {
827
+ "3": "3.53.1"
828
+ },
662
829
  "versions": {
830
+ "3.53.1": true,
663
831
  "3.51.2": true
664
832
  },
665
833
  "platforms": [
@@ -673,7 +841,10 @@
673
841
  "server": null,
674
842
  "client": "sqlite3",
675
843
  "utilities": [],
676
- "enhanced": ["litecli", "usql"]
844
+ "enhanced": [
845
+ "litecli",
846
+ "usql"
847
+ ]
677
848
  },
678
849
  "connection": {
679
850
  "runtime": "embedded",
@@ -695,6 +866,9 @@
695
866
  "hostedServiceAllowed": false,
696
867
  "protocol": null,
697
868
  "note": "Rust-based; single binary. License is BSL-1.1 (not Apache-2.0); prohibits competing DBaaS offerings. Converts to Apache-2.0 after 4 years per release. Fine for local dev and internal use.",
869
+ "defaults": {
870
+ "2": "2.3.2"
871
+ },
698
872
  "versions": {
699
873
  "2.3.2": true
700
874
  },
@@ -732,6 +906,9 @@
732
906
  "hostedServiceAllowed": true,
733
907
  "protocol": null,
734
908
  "note": "Written in Zig; single binary with built-in REPL client. Uses a custom binary protocol (not HTTP/SQL). macOS uses a universal (fat) binary for both x64 and arm64.",
909
+ "defaults": {
910
+ "0": "0.16.70"
911
+ },
735
912
  "versions": {
736
913
  "0.16.70": true
737
914
  },
@@ -769,6 +946,9 @@
769
946
  "hostedServiceAllowed": true,
770
947
  "protocol": null,
771
948
  "note": "Rewritten from Java to Rust in v3.0 (Dec 2024). Binaries distributed via Cloudsmith and GitHub Releases.",
949
+ "defaults": {
950
+ "3": "3.8.0"
951
+ },
772
952
  "versions": {
773
953
  "3.8.0": true
774
954
  },
@@ -806,8 +986,14 @@
806
986
  "hostedServiceAllowed": true,
807
987
  "protocol": "redis",
808
988
  "note": "",
989
+ "defaults": {
990
+ "8": "8.0.9",
991
+ "9": "9.0.4"
992
+ },
809
993
  "versions": {
994
+ "9.0.4": true,
810
995
  "9.0.1": true,
996
+ "8.0.9": true,
811
997
  "8.0.6": true
812
998
  },
813
999
  "platforms": [
@@ -820,8 +1006,12 @@
820
1006
  "cliTools": {
821
1007
  "server": "valkey-server",
822
1008
  "client": "valkey-cli",
823
- "utilities": ["valkey-benchmark"],
824
- "enhanced": ["iredis"]
1009
+ "utilities": [
1010
+ "valkey-benchmark"
1011
+ ],
1012
+ "enhanced": [
1013
+ "iredis"
1014
+ ]
825
1015
  },
826
1016
  "connection": {
827
1017
  "runtime": "server",
@@ -843,6 +1033,9 @@
843
1033
  "hostedServiceAllowed": true,
844
1034
  "protocol": null,
845
1035
  "note": "Go-based single binary (CGO_ENABLED=0). Linux from official releases; macOS/Windows cross-compiled from source.",
1036
+ "defaults": {
1037
+ "1": "1.35.7"
1038
+ },
846
1039
  "versions": {
847
1040
  "1.35.7": true
848
1041
  },
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared checksum utilities for fetching and parsing checksums.txt files
3
+ */
4
+ /**
5
+ * Parse checksums.txt content into a record of filename -> hash
6
+ */
7
+ export declare function parseChecksums(content: string): Record<string, string>;
8
+ /**
9
+ * Fetch checksums.txt from a GitHub release using the API (avoids CDN caching issues)
10
+ *
11
+ * @param repo - Repository in "owner/repo" format
12
+ * @param tag - Release tag name
13
+ * @returns Record of filename -> SHA256 hash, or empty object if not found
14
+ */
15
+ export declare function fetchChecksums(repo: string, tag: string): Promise<Record<string, string>>;
16
+ //# sourceMappingURL=checksums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checksums.d.ts","sourceRoot":"","sources":["../lib/checksums.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYtE;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAwDjC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Shared checksum utilities for fetching and parsing checksums.txt files
3
+ */
4
+ /**
5
+ * Parse checksums.txt content into a record of filename -> hash
6
+ */
7
+ export function parseChecksums(content) {
8
+ const checksums = {};
9
+ for (const line of content.split('\n')) {
10
+ // Format: "hash filename" or "hash *filename" (binary mode)
11
+ const match = line.match(/^([a-f0-9]{64})\s+\*?(.+)$/);
12
+ if (match) {
13
+ checksums[match[2]] = match[1];
14
+ }
15
+ }
16
+ return checksums;
17
+ }
18
+ /**
19
+ * Fetch checksums.txt from a GitHub release using the API (avoids CDN caching issues)
20
+ *
21
+ * @param repo - Repository in "owner/repo" format
22
+ * @param tag - Release tag name
23
+ * @returns Record of filename -> SHA256 hash, or empty object if not found
24
+ */
25
+ export async function fetchChecksums(repo, tag) {
26
+ // First try to get the asset URL from the API
27
+ const apiUrl = `https://api.github.com/repos/${repo}/releases/tags/${tag}`;
28
+ const apiResponse = await fetch(apiUrl, {
29
+ headers: {
30
+ Accept: 'application/vnd.github.v3+json',
31
+ 'User-Agent': 'hostdb-checksums',
32
+ ...(process.env.GITHUB_TOKEN
33
+ ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` }
34
+ : {}),
35
+ },
36
+ });
37
+ if (!apiResponse.ok) {
38
+ return {};
39
+ }
40
+ const release = (await apiResponse.json());
41
+ const checksumAsset = release.assets.find((a) => a.name === 'checksums.txt');
42
+ if (!checksumAsset) {
43
+ return {};
44
+ }
45
+ // Use API asset download (works for both private and public repos)
46
+ const assetApiUrl = `https://api.github.com/repos/${repo}/releases/assets/${checksumAsset.id}`;
47
+ const assetApiResponse = await fetch(assetApiUrl, {
48
+ headers: {
49
+ Accept: 'application/octet-stream',
50
+ 'User-Agent': 'hostdb-checksums',
51
+ ...(process.env.GITHUB_TOKEN
52
+ ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` }
53
+ : {}),
54
+ },
55
+ redirect: 'follow',
56
+ });
57
+ if (assetApiResponse.ok) {
58
+ const content = await assetApiResponse.text();
59
+ return parseChecksums(content);
60
+ }
61
+ // Fallback: try browser_download_url (only works for public repos)
62
+ if (!process.env.GITHUB_TOKEN) {
63
+ const browserResponse = await fetch(checksumAsset.browser_download_url, {
64
+ headers: { 'User-Agent': 'hostdb-checksums' },
65
+ redirect: 'follow',
66
+ });
67
+ if (browserResponse.ok) {
68
+ const content = await browserResponse.text();
69
+ return parseChecksums(content);
70
+ }
71
+ }
72
+ return {};
73
+ }
74
+ //# sourceMappingURL=checksums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checksums.js","sourceRoot":"","sources":["../lib/checksums.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,MAAM,SAAS,GAA2B,EAAE,CAAA;IAE5C,KAAK,MAAM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