Skip to content

Commit

Permalink
docs: /docs/reference/typegraph/client (#777)
Browse files Browse the repository at this point in the history
Pre-documentation for the code-first queries feature.

#### Migration notes

...

- [ ] The change comes with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
  • Loading branch information
Yohe-Am authored Oct 18, 2024
1 parent 1a2b58d commit 8e24b01
Show file tree
Hide file tree
Showing 25 changed files with 1,253 additions and 471 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ on:
- synchronize
- ready_for_review


# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GHJK_VERSION: "v0.2.1"
GHJK_ENV: "ci"
Expand Down
53 changes: 47 additions & 6 deletions docs/metatype.dev/docs/reference/metagen/index.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
/typegrap/typegraphh---
sidebar_position: 50
---

Expand All @@ -13,7 +13,12 @@ The following feature is not yet stable.

:::

Metagen is a code-generator suite that contains implementations that help with development on the Metatype platform. Today, this means a set of generators to help with [custom functions](/docs/guides/external-functions) by generating types, serializers and bindings. It's availaible bundled within the [meta CLI](/docs/reference/meta-cli) and the [typegraph SDKs](/docs/reference/typegraph#sdks).
Metagen is a code-generator suite that contains implementations that help with development on the Metatype platform. Today, this means a set of generators to:

- Generate code-first, typesafe clients for your typegraph
- Help with [custom functions](/docs/guides/external-functions) by generating types, serializers and bindings.

It's availaible bundled within the [meta CLI](/docs/reference/meta-cli) and the [typegraph SDKs](/docs/reference/typegraph#sdks).

## Access through CLI

Expand Down Expand Up @@ -43,10 +48,10 @@ metagen:
stubbed_runtimes: ["wasm_wire", "deno"]
# more than one targets avail if you need them
iter:
- generator: fdk_typescript
path: ./ts/
- generator: client_ts
path: ./next_app/
# name of typegraph to read from typegate
typegraph: svc_products
typegraph: svc_bff
```
This allows us to invoke the targets from the CLI.
Expand Down Expand Up @@ -77,6 +82,41 @@ To resolve this concern, the SDKs support a serialization mode that skips resolu

:::

### `client_ts`

This generator supports:

- Types and query builders based on your typegraph
- [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) based `GraphQlTransport` implementation
- Requires Node.js version `v17.5.0` and [up](https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#fetch).
- Requires using `--experimental-fetch` flag if on Node.js version below v18.0.0
- Provides async queries
- Prepared requests and aliases

Refer to the [client reference](/docs/reference/typegraph/client/) for usage guidelines and examples.

### `client_py`

This generator supports:

- Types and query builders based on your typegraph
- `urlib` based `GraphQlTransport` implementation.
- Provides sync and async queries
- Prepared requests and aliases

Refer to the [client reference](/docs/reference/typegraph/client/) for usage guidelines and examples.

### `client_rs`

This generator supports:

- Types and query builders based on your typegraph
- [`reqwest`](https://lib.rs/crates/reqwest) based `GraphQlTransport` implementation
- Provides sync and async queries
- Prepared requests and aliases

Refer to the [client reference](/docs/reference/typegraph/client/) for usage guidelines and examples.

### `fdk_typescript`

This generator supports:
Expand All @@ -85,7 +125,8 @@ This generator supports:
- Stub function types for custom functions implementors that adhere to typegraph functions.
- By default, all function types from the `DenoRuntime` get stub types.
- Use `stubbed_runtimes` to select which runtimes get stubs.
- Types for interacting with the typegate from within custom functions.
- [`client_ts`](#client_ts) based typegraph client
- Special `HostcallTransport` implementation

The following example showcases the generator.

Expand Down
Loading

0 comments on commit 8e24b01

Please sign in to comment.