Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding TS Connector v0.8 Tag changes #45

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 32 additions & 20 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,21 +50,19 @@ 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:

```
hasura3 connector create my-cool-connector:v1 \
--github-repo-url https://github.com/hasura/ndc-typescript-deno/tree/main \
--github-repo-url https://github.com/hasura/ndc-typescript-deno/tree/v0.8 \
--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