Skip to content

Commit

Permalink
feat: Add graphql to data-connector (#209)
Browse files Browse the repository at this point in the history
* update

* update

* fix: Add graphql to data-connector

* update

* update
  • Loading branch information
nadeesha authored Dec 3, 2024
1 parent a76eda1 commit 523d21c
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 32 deletions.
9 changes: 8 additions & 1 deletion data-connector/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,11 @@ POSTGRES_SCHEMA=public
#
# OPENAPI_SPEC_URL=https://api.inferable.ai/public/oas.json
# SERVER_URL=https://api.inferable.ai
# SERVER_AUTH_HEADER=Authorization: Bearer your_api_key_here
# SERVER_AUTH_HEADER=Bearer your_api_key_here\

#
# GraphQL config example.
#
# GRAPHQL_SCHEMA_URL=https://docs.github.com/public/fpt/schema.docs.graphql
# GRAPHQL_ENDPOINT=https://api.github.com/graphql
# GRAPHQL_AUTH_HEADER="bearer ghp_xxx"
19 changes: 14 additions & 5 deletions data-connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Inferable Data Connector is a bridge between your data systems and Inferable. Co

## Connectors

- [x] [Postgres](./src/postgres.ts)
- [x] [OpenAPI](./src/open-api.ts)
- [ ] [GraphQL](./src/graphql.ts)
- [ ] [MySQL](./src/mysql.ts)
- [ ] [SQLite](./src/sqlite.ts)
- [x] [Postgres](./src/postgres/postgres.ts)
- [x] [OpenAPI](./src/open-api/open-api.ts)
- [x] [GraphQL](./src/graphql/graphql.ts)
- [ ] [MySQL](./src/mysql/mysql.ts)
- [ ] [SQLite](./src/sqlite/sqlite.ts)

## Quick Start

Expand Down Expand Up @@ -114,6 +114,15 @@ Each connector is defined in the `config.connectors` array.

</details>

<details>
<summary>GraphQL Connector Configuration</summary>

- `config.connectors[].schemaUrl`: The URL to your GraphQL schema. Must be publicly accessible.
- `config.connectors[].endpoint`: The endpoint to use. (e.g. `https://api.inferable.ai`)
- `config.connectors[].defaultHeaders`: The default headers to use. (e.g. `{"Authorization": "Bearer <token>"}`)

</details>

### config.privacyMode

When enabled (`config.privacyMode=1`), raw data is never sent to the model. Instead:
Expand Down
8 changes: 8 additions & 0 deletions data-connector/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"defaultHeaders": {
"Authorization": "process.env.SERVER_AUTH_HEADER"
}
},
{
"type": "graphql",
"schemaUrl": "process.env.GRAPHQL_SCHEMA_URL",
"endpoint": "process.env.GRAPHQL_ENDPOINT",
"defaultHeaders": {
"Authorization": "process.env.GRAPHQL_AUTH_HEADER"
}
}
]
}
36 changes: 34 additions & 2 deletions data-connector/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions data-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
"dependencies": {
"dotenv": "^16.4.5",
"fastify": "^4.28.1",
"graphql": "^16.9.0",
"graphql-tag": "^2.12.6",
"inferable": "^0.30.48",
"pg": "^8.13.1",
"tsx": "^4.19.2"
},
"devDependencies": {
"@faker-js/faker": "^9.1.0",
"@types/node": "^20.11.19",
"typescript": "^5.3.3",
"@faker-js/faker": "^9.1.0"
"typescript": "^5.3.3"
}
}
}
Loading

0 comments on commit 523d21c

Please sign in to comment.