Skip to content

Commit

Permalink
Support for the Connector Deployment Spec (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-chambers authored Feb 19, 2024
1 parent 2f87c11 commit bc316a7
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 292 deletions.
17 changes: 17 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 4.0.0
Breaking change: support for the [Connector Deployment Spec](https://github.com/hasura/ndc-hub/blob/main/rfcs/0000-deployment.md).

- The connector configuration server has been removed
- The way configuration is handled on `Connector` interface has changed
- `getRawConfigurationSchema`, `makeEmptyConfiguration`, `updateConfiguration` have been removed.
- `parseConfiguation` replaces `validateRawConfiguration`, and is given the directory path in which the connector's configuration files can be found
- The `RawConfiguration` type parameter has been removed
- The default port has changed from 8100 to 8080
- The command line arguments passed to the `serve` command have changed:
- The `--configuration` argument now takes the connector's configuration directory. Its associated environment variable is now `HASURA_CONFIGURATION_DIRECTORY`
- The `--otlp_endpoint` argument has been renamed to `--otlp-endpoint` and its environment variable is now `OTEL_EXPORTER_OTLP_ENDPOINT`
- The `PORT` environment variable has changed to `HASURA_CONNECTOR_PORT`
- The `SERVICE_TOKEN_SECRET` environment variable has changed to `HASURA_SERVICE_TOKEN_SECRET`
- The `LOG_LEVEL` environment variable has changed to `HASURA_LOG_LEVEL`
- The `PRETTY_PRINT_LOGS` environment variable has changed to `HASURA_PRETTY_PRINT_LOGS`

## 3.0.0
Breaking change: support for the [v0.1.0-rc.15 of NDC Spec](https://github.com/hasura/ndc-spec/compare/v0.1.0-rc.14...v0.1.0-rc.15).

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hasura/ndc-sdk-typescript",
"version": "3.0.0",
"version": "4.0.0",
"description": "",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -9,9 +9,9 @@
"regenerate-schema": "./typegen/regenerate-schema.sh",
"build": "tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"keywords": ["hasura", "ndc"],
"author": "Hasura",
"license": "Apache-2.0",
"dependencies": {
"@json-schema-tools/meta-schema": "^1.7.0",
"commander": "^11.0.0",
Expand All @@ -21,6 +21,6 @@
"devDependencies": {
"@types/node": "^20.6.0",
"json-schema-to-typescript": "^13.1.1",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
}
}
169 changes: 0 additions & 169 deletions src/configuration-server.ts

This file was deleted.

38 changes: 5 additions & 33 deletions src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,15 @@ import {
MutationResponse,
} from "./schema";

import { JSONSchemaObject } from "@json-schema-tools/meta-schema";
export interface Connector<Configuration, State> {

export interface Connector<RawConfiguration, Configuration, State> {
/**
* Return jsonschema for the raw configuration for this connector
*/
getRawConfigurationSchema(): JSONSchemaObject;

/**
* Return an empty raw configuration, to be manually filled in by the user to allow connection to the data source.
*
* The exact shape depends on your connector's configuration. Example:
*
* ```json
* {
* "connection_string": "",
* "tables": []
* }
* ```
*/
makeEmptyConfiguration(): RawConfiguration;
/**
* Take a raw configuration, update it where appropriate by connecting to the underlying data source, and otherwise return it as-is
* For example, if our configuration includes a list of tables, we may want to fetch an updated list from the data source.
* This is also used to "hidrate" an "empty" configuration where a user has provided connection details and little else.
* @param rawConfiguration a base raw configuration
*/
updateConfiguration(
rawConfiguration: RawConfiguration
): Promise<RawConfiguration>;
/**
* Validate the raw configuration provided by the user,
* returning a configuration error or a validated [`Connector::Configuration`].
* Validate the configuration files provided by the user, returning a validated 'Configuration',
* or throwing an 'Error'. Throwing an error prevents Connector startup.
* @param configuration
*/
validateRawConfiguration(
rawConfiguration: RawConfiguration
parseConfiguration(
configurationDir: string
): Promise<Configuration>;

/**
Expand Down
Loading

0 comments on commit bc316a7

Please sign in to comment.