Skip to content

Commit

Permalink
Adding TS Connector v0.8 Tag changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sordina committed Sep 22, 2023
1 parent 654f791 commit 8cabe5e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 20 deletions.
50 changes: 31 additions & 19 deletions registry/typescript-deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ It assumes that dependencies are specified in accordance with [Deno](https://den

## Typescript Functions Format

Your functions should be organised into a directory with one file acting as the entrypoint.

An example could be as follows - `functions/main.ts`:
Your functions should be organised into a directory with `index.ts` file acting as the entrypoint.

```
// ./functions/index.ts
import { Hash, encode } from "https://deno.land/x/[email protected]/mod.ts";
/**
Expand All @@ -37,6 +37,7 @@ export function make_password_hash(pw: string): string {

* JSDoc comments and tags are exposed in the schema
* Async, and normal functions are both supported
* Only exported functions are exposed
* Functions tagged with `@pure` annotations are exposed as functions
* Those without `@pure` annotations are exposed as procedures

Expand All @@ -49,12 +50,10 @@ You will need:
* Secret service token
* A configuration file

The configuration file format needs at a minimum
a `typescript_source` referenced which matches the main
typescript file as mounted with the `--volume` flag.
Your functions directory should be added as a volume to `/functions`

```
{"typescript_source": "/functions/main.ts"}
--volume ./my-functions:/functions
```

Create the connector:
Expand All @@ -63,7 +62,7 @@ Create the connector:
hasura3 connector create my-cool-connector:v1 \
--github-repo-url https://github.com/hasura/ndc-typescript-deno/tree/main \
--config-file config.json \
--volume ./functions:/functions \
--volume ./my-functions:/functions \
--env SERVICE_TOKEN_SECRET=MY-SERVICE-TOKEN
```

Expand All @@ -85,20 +84,33 @@ for an example of what a project structure that uses a connector could look like

## Usage

Include the connector URL in your Hasura V3 project metadata:

Include the connector URL in your Hasura V3 project metadata (hml format).
Hasura cloud projects must also set a matching bearer token:

```yaml
kind: DataSource
name: sendgrid
dataConnectorUrl:
url: 'https://connector-9XXX7-hyc5v23h6a-ue.a.run.app'
auth:
type: Bearer
token: "SUPER_SECRET_TOKEN_XXX123"
```
[
{
"kind": "dataSource",
"name": "md5hasher",
"dataConnectorUrl": "https://connector-9XXX7-hyc5v23h6a-ue.a.run.app",
"schema": {}
}
...
]
While you can specify the token inline as above, it is recommended to use the Hasura secrets functionality for this purpose:
```yaml
kind: DataSource
name: sendgrid
dataConnectorUrl:
url: 'https://connector-9XXX7-hyc5v23h6a-ue.a.run.app'
auth:
type: Bearer
token:
valueFromSecret: CONNECTOR_TOKEN
```
## Troubleshooting
Please [submit a Github issue](https://github.com/hasura/ndc-typescript-deno/issues/new)
Expand Down
7 changes: 6 additions & 1 deletion registry/typescript-deno/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title":"Typescript (Deno) Connector",
"logo":"logo.png",
"tags":[],
"latest_version":"v0.3"
"latest_version":"v0.8"
},
"author":{
"support_email":"[email protected]",
Expand All @@ -17,6 +17,11 @@
"is_open_source":true,
"repository":"https://github.com/hasura/ndc-typescript-deno/",
"version":[
{
"tag": "v0.8",
"hash":"0913b41f4cef74fa18e7fa16ec456d32c6fc3a74",
"is_verified":true
},
{
"tag": "v0.3",
"hash":"23022c931bc5132932d9b187a80a737d7aac0e79",
Expand Down

0 comments on commit 8cabe5e

Please sign in to comment.