File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ handlebars.registerPartial(
2424 } ) ,
2525) ;
2626
27+ // We skip importing certain connectors' connection docs because they are too Prismatic-specific
28+ const IGNORED_CONNECTOR_CONNECTION_DOCS = [ "pipedrive" ] ;
29+
2730const writeConnectorDocsFile = (
2831 connector : Component ,
2932 connectorTemplate : HandlebarsTemplateDelegate < unknown > ,
@@ -58,6 +61,33 @@ async function generateConnectorDocs({
5861 JSON . stringify ( connectors , null , 2 ) ,
5962 ) ;
6063 for ( const connector of connectors ) {
64+ for ( const connection of connector . connections . nodes ) {
65+ const docsPath = path . join (
66+ __dirname ,
67+ ".." ,
68+ ".." ,
69+ ".." ,
70+ ".." ,
71+ "components" ,
72+ "components" ,
73+ connector . key ,
74+ "documentation" ,
75+ "connections" ,
76+ `${ connection . key } .mdx` ,
77+ ) ;
78+ if (
79+ fs . existsSync ( docsPath ) &&
80+ ! IGNORED_CONNECTOR_CONNECTION_DOCS . includes ( connector . key )
81+ ) {
82+ connection . connectionDocs = fs
83+ . readFileSync ( docsPath , { encoding : "utf-8" } )
84+ . replaceAll (
85+ / < O a u t h C a l l b a c k U r l \/ > / g,
86+ "`https://oauth2.%WHITE_LABEL_BASE_URL%/callback`" ,
87+ ) ;
88+ }
89+ }
90+
6191 fetchConnectorIcon ( connector ) ;
6292 writeConnectorDocsFile ( connector , connectorTemplate ) ;
6393 }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export interface Component {
44 description : string ;
55 category : string ;
66 iconUrl : string ;
7- connections : { nodes : Connection } ;
7+ connections : { nodes : Connection [ ] } ;
88 triggers : { nodes : Trigger [ ] } ;
99 dataSources : { nodes : DataSource [ ] } ;
1010 actions : { nodes : Action [ ] } ;
@@ -16,6 +16,7 @@ interface Connection {
1616 type : string ;
1717 default : string ;
1818 comments : string ;
19+ connectionDocs ?: string ;
1920}
2021
2122interface Trigger {
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ description: {{{description}}}
1717
1818{{{ comments }}}
1919
20+ {{ #if connectionDocs }}
21+
22+ {{{ connectionDocs }}}
23+
24+ {{ /if }}
25+
2026{{ #if oauth2Type }}
2127
2228This connection uses OAuth 2.0, a common authentication mechanism for integrations.
You can’t perform that action at this time.
0 commit comments