diff --git a/registry/typescript-deno/README.md b/registry/typescript-deno/README.md index e192ca47..7e6ff96c 100644 --- a/registry/typescript-deno/README.md +++ b/registry/typescript-deno/README.md @@ -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/checksum@1.2.0/mod.ts"; /** @@ -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 @@ -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: @@ -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 ``` @@ -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) diff --git a/registry/typescript-deno/metadata.json b/registry/typescript-deno/metadata.json index b25bc9c8..648e3b9d 100644 --- a/registry/typescript-deno/metadata.json +++ b/registry/typescript-deno/metadata.json @@ -4,7 +4,7 @@ "title":"Typescript (Deno) Connector", "logo":"logo.png", "tags":[], - "latest_version":"v0.3" + "latest_version":"v0.8" }, "author":{ "support_email":"support@hasura.io", @@ -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",