@@ -3,22 +3,6 @@ const memoize = require("lodash/memoize");
33const REGISTRY_URL =
44 "https://connectors.airbyte.com/files/generated_reports/connector_registry_report.json" ;
55
6- // Only require Node.js modules in build-time context
7- let fs , path , REGISTRY_CACHE_PATH ;
8- if ( typeof __dirname !== 'undefined' ) {
9- try {
10- fs = require ( "fs" ) ;
11- path = require ( "path" ) ;
12- REGISTRY_CACHE_PATH = path . join (
13- __dirname ,
14- "data" ,
15- "connector_registry_full.json" ,
16- ) ;
17- } catch ( e ) {
18- // Silently fail in browser context
19- }
20- }
21-
226const fetchLatestVersionOfPyPackage = memoize ( async ( packageName ) => {
237 const json = await fetch ( `https://pypi.org/pypi/${ packageName } /json` ) . then (
248 ( resp ) => resp . json ( ) ,
@@ -27,24 +11,7 @@ const fetchLatestVersionOfPyPackage = memoize(async (packageName) => {
2711} ) ;
2812
2913const fetchCatalog = async ( ) => {
30- // First, try to load from cache (Node.js only)
31- if ( fs && REGISTRY_CACHE_PATH && fs . existsSync ( REGISTRY_CACHE_PATH ) ) {
32- try {
33- console . log ( "Loading connector registry from cache..." ) ;
34- const cachedData = fs . readFileSync ( REGISTRY_CACHE_PATH , "utf8" ) ;
35- const json = JSON . parse ( cachedData ) ;
36- console . log ( `loaded ${ json . length } connectors from cache` ) ;
37- return json ;
38- } catch ( error ) {
39- console . warn (
40- "Failed to load cached registry, attempting to fetch:" ,
41- error . message ,
42- ) ;
43- }
44- }
45-
46- // Fallback to fetching if cache is not available
47- console . log ( "Fetching connector registry from remote..." ) ;
14+ console . log ( "Fetching connector registry..." ) ;
4815 const json = await fetch ( REGISTRY_URL ) . then ( ( resp ) => resp . json ( ) ) ;
4916 console . log ( `fetched ${ json . length } connectors from registry` ) ;
5017
@@ -76,12 +43,28 @@ const parseCDKVersion = (
7643 }
7744} ;
7845
46+ function getSupportLevelDisplay ( rawSupportLevel ) {
47+ switch ( rawSupportLevel ) {
48+ case "certified" :
49+ return "Airbyte" ;
50+ case "community" :
51+ return "Marketplace" ;
52+ case "enterprise" :
53+ return "Enterprise" ;
54+ case "archived" :
55+ return "Archived" ;
56+ default :
57+ return null ;
58+ }
59+ }
60+
7961module . exports = {
8062 REGISTRY_URL ,
8163 catalog : fetchCatalog ( ) ,
8264 isPypiConnector : ( connector ) => {
8365 return Boolean ( connector . remoteRegistries_oss ?. pypi ?. enabled ) ;
8466 } ,
85- parseCDKVersion,
8667 getLatestPythonCDKVersion,
68+ parseCDKVersion,
69+ getSupportLevelDisplay,
8770} ;
0 commit comments