Skip to content

Commit

Permalink
fix references
Browse files Browse the repository at this point in the history
  • Loading branch information
meskill committed Dec 17, 2024
1 parent bdacbb8 commit b34e401
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docs/N+1.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ If you run the query, at first you will observe a lot of duplicate requests are

![Duplicate Upstream Calls](../static/images/docs/n+1-duplicate.png)

This happens because of the 100 posts, a lot them are authored by the same user and by default Tailcall will make a request for every user when requested. You can fix this by setting [dedupe](./directives/graphQL.md#dedupe) to `true` in [server](./directives/server.md).
This happens because of the 100 posts, a lot them are authored by the same user and by default Tailcall will make a request for every user when requested. You can fix this by setting [dedupe](./directives/graphQL.md#dedupe) to `true` in [server](./config/server.md).

```graphql {3}
schema
Expand Down
2 changes: 1 addition & 1 deletion docs/apollo-federation-subgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Please, note that you don't need to specify the `@key` directive manually when d

## Enable federation in the Tailcall config

Federation is controlled by the flag [`enableFederation`](./directives/server.md#enablefederation). Define it with `true` value to enable federation support.
Federation is controlled by the flag [`enableFederation`](./config/server.md#enablefederation). Define it with `true` value to enable federation support.

## Register your subgraph

Expand Down
2 changes: 1 addition & 1 deletion docs/apollo-studio.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This guide illustrates how to configure `tailcall` to send usage metrics to [Apo

![local-schema.png](../static/images/apollo-studio/local-schema.png)

You have now created a Monolith graph in Apollo Studio. The next step is to configure `tailcall` to use the `APOLLO_API_KEY` and `APOLLO_GRAPH_REF`. Follow detailed instructions [here](./directives/telemetry.md).
You have now created a Monolith graph in Apollo Studio. The next step is to configure `tailcall` to use the `APOLLO_API_KEY` and `APOLLO_GRAPH_REF`. Follow detailed instructions [here](./config/telemetry.md).

## Checking the metrics in Apollo Studio

Expand Down
8 changes: 4 additions & 4 deletions docs/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ to know more about how to use it, read the following articles:

Enabling support for authentication in Tailcall could be done in two steps:

1. With the help of [`@link` directive](./directives/link.md) connect multiple authentication files as you need for different provides. To connect it use either [`Htpasswd`](./directives/link.md#htpasswd) or [`Jwks`](./directives/link.md#jwks) link type
1. With the help of [`@link` directive](./config/links.md) connect multiple authentication files as you need for different provides. To connect it use either [`Htpasswd`](./config/links.md#htpasswd) or [`Jwks`](./config/links.md#jwks) link type
2. Mark that some type of field requires authentication to be fetched with the help of [`@protected` directive](./directives/protected.md)

Your config could look like this now:
Expand Down Expand Up @@ -250,7 +250,7 @@ In case you linked multiple authentication files all of them will be used to exe

### Authentication headers

To validate authentication for user request the specific headers are used (like `Authorization` header). In case auth is enabled for tailcall those headers will be also added to the [`allowedHeaders` list](./directives/upstream.md#allowedheaders) and therefore they will be forwarded to the upstream requests implicitly.
To validate authentication for user request the specific headers are used (like `Authorization` header). In case auth is enabled for tailcall those headers will be also added to the [`allowedHeaders` list](./config/upstream.md#allowedheaders) and therefore they will be forwarded to the upstream requests implicitly.

## Basic Authentication

Expand All @@ -270,7 +270,7 @@ Since this file stores secure information make sure to hash the password you use

### Basic Auth GraphQL Configuration

To use Basic Auth you should first include htpasswd file generated from [Prerequisites](#prerequisites) with the help of [`@link` directive](./directives/link.md#htpasswd).
To use Basic Auth you should first include htpasswd file generated from [Prerequisites](#prerequisites) with the help of [`@link` directive](./config/links.md#htpasswd).

We can use that file as an example for it that has data for `testuser:mypassword` credentials in encrypted format:

Expand Down Expand Up @@ -353,7 +353,7 @@ To create this file you can use available web-tools like [JWK creator](https://r

### JWT Auth GraphQL Configuration

To use JWT you should first include JWKS file generated from [Prerequisites](#prerequisites) with the help of [`@link` directive](./directives/link.md#jwks).
To use JWT you should first include JWKS file generated from [Prerequisites](#prerequisites) with the help of [`@link` directive](./config/links.md#jwks).

We can use that file as an example for it:

Expand Down
2 changes: 1 addition & 1 deletion docs/client-tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Connection pooling mitigates these issues by reusing existing connections for re

## Tuning HTTP Client

Tailcall uses connection pooling by default and sets up with default tuning suitable for most use cases. You might need to further tune the HTTP client to improve your application's performance. Tailcall DSL provides a directive named [`@upstream`](./directives/upstream.md) for this purpose.
Tailcall uses connection pooling by default and sets up with default tuning suitable for most use cases. You might need to further tune the HTTP client to improve your application's performance. Tailcall DSL provides a directive named [`@upstream`](./config/upstream.md) for this purpose.

:::note
Connection pooling optimizes HTTP/1. Since HTTP/2 and HTTP/3 support multiplexing, pooling enabled does not noticeably affect performance.
Expand Down
2 changes: 1 addition & 1 deletion docs/config/upstream.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ upstream:

## onRequest

Similar to the [@http](./http.md) property, this accepts a string value representing a middleware function defined in a JavaScript file. It intercepts all outgoing HTTP requests from the server. This interceptor, written in JavaScript, can be used to modify outgoing requests and also generate artificial responses to customize the behavior of the GraphQL server.
Similar to the [@http](../directives/http.md) property, this accepts a string value representing a middleware function defined in a JavaScript file. It intercepts all outgoing HTTP requests from the server. This interceptor, written in JavaScript, can be used to modify outgoing requests and also generate artificial responses to customize the behavior of the GraphQL server.

```yaml showLineNumbers
upstream:
Expand Down
4 changes: 0 additions & 4 deletions docs/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ Here is a list of all the custom directives supported by Tailcall:
| [`@graphQL`](./directives/graphQL.md) | Resolves a field or node by a GraphQL API. |
| [`@grpc`](./directives/grpc.md) | Resolves a field or node by a gRPC API. |
| [`@http`](./directives/http.md) | Resolves a field or node by a REST API. |
| [`@link`](./directives/link.md) | Imports external resources such as config files, certs, protobufs, etc in the schema. |
| [`@modify`](./directives/modify.md) | Enables changes to attributes of fields or nodes in the schema. |
| [`@omit`](./directives/omit.md) | Excludes fields or nodes from the generated schema, making them inaccessible through the GraphQL API. |
| [`@protected`](./directives/protected.md) | Adds authentication and authorization controls to fields or nodes in the schema. |
| [`@rest`](./directives/rest.md) | Allows exposing REST endpoints on top of GraphQL. |
| [`@server`](./directives/server.md) | Provides server configurations for behavior tuning and tailcall optimization in specific use-cases. |
| [`@telemetry`](./directives/telemetry.md) | Integrates with open-telemetry to provide observability of the running tailcall service. |
| [`@upstream`](./directives/upstream.md) | Controls aspects of the upstream server connection, including timeouts and keep-alive settings. |

### Resolvable Directives

Expand Down
2 changes: 1 addition & 1 deletion docs/directives/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ type Post {
The `onRequest` property accepts a string value representing the remote function to be called every time an HTTP request is initiated. Typically the remote function is defined in a linked JavaScript worker file.

:::note
For defining a request middleware globally for all requests, refer to the [upstream directive documentation](./upstream.md#onrequest).
For defining a request middleware globally for all requests, refer to the [upstream config documentation](../config/upstream.md#onrequest).
:::

```graphql showLineNumbers
Expand Down
2 changes: 1 addition & 1 deletion docs/directives/protected.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `@protected` directive designates a type or field as protected, meaning that

## Prerequisites

To use the `@protected` directive, you must configure at least one authentication provider using the [`@link`](./link.md) directive, such as `Htpasswd` or `Jwks`.
To use the `@protected` directive, you must configure at least one authentication provider using the [`links`](../config/links.md) configuration, such as `Htpasswd` or `Jwks`.

```graphql title="Authentication Provider Configuration" showLineNumbers
schema
Expand Down
6 changes: 3 additions & 3 deletions docs/grpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type Query {
}
```

Also, let's specify options for Tailcall's ingress and egress at the beginning of the config using [`@server`](./directives/server.md) and [`@upstream`](./directives/upstream.md) directives.
Also, let's specify options for Tailcall's ingress and egress at the beginning of the config using [`server`](./config/server.md) and [`upstream`](./config/upstream.md) options.

```graphql
schema @server(port: 8000) @upstream(httpCache: 42) {
Expand Down Expand Up @@ -235,7 +235,7 @@ Or

Another important feature of the `@grpc` directive is that it allows you to implement request batching for remote data almost effortlessly as soon as you have gRPC methods that resolve multiple responses for multiple inputs in a single request.

In our protobuf example file, we have a method called `GetMultipleNews` that we can use. To enable batching we need to enable [`@upstream.batch` option](./directives/upstream.md#batch) first and specify `batchKey` option for the `@grpc` directive.
In our protobuf example file, we have a method called `GetMultipleNews` that we can use. To enable batching we need to enable [`upstream.batch` option](./config/upstream.md#batch) first and specify `batchKey` option for the `@grpc` directive.

```graphql
schema
Expand Down Expand Up @@ -280,7 +280,7 @@ Those 2 requests will be executed inside a single request to the gRPC method `Ge

gRPC reflection is a potent feature enabling clients to dynamically discover services and their methods at runtime. Tailcall enhances this capability by obviating the need for developers to link each proto file individually. This feature proves particularly valuable in environments where proto files are continuously evolving or when services dynamically expose varying methods. Here are the steps to follow:

1. Add the gRPC endpoint as a [link](directives/link.md) with type set to `Grpc`. This enables the GraphQL server to understand that the specified source is a gRPC endpoint that supports reflection.
1. Add the gRPC endpoint as a [link](./config/links.md) with type set to `Grpc`. This enables the GraphQL server to understand that the specified source is a gRPC endpoint that supports reflection.

```graphql
schema
Expand Down
2 changes: 1 addition & 1 deletion docs/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Use self-signed certificates for HTTP/2 configurations in development environmen

## Configuration

Once the certificate and key are generated we can link them with our main configuration using the [@link](./directives/link.md) directive, to enable HTTPS.
Once the certificate and key are generated we can link them with our main configuration using the [links](./config/links.md) configuration, to enable HTTPS.

```graphql showLineNumbers
schema
Expand Down
2 changes: 1 addition & 1 deletion docs/rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ schema
}
```

To know more about the `@link` directive, please refer to the [Tailcall GraphQL Directives](./directives/link.md).
To know more about the `links` configuration, please refer [it's documentation](./config/links.md).

#### Response

Expand Down
8 changes: 4 additions & 4 deletions docs/scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ The runtime is not a full-fledged Node.js environment and has no access to the f

## Getting Started

To leverage this customization, JavaScript functions must be created in a JavaScript file and linked with the main configuration file using the [@link](./directives/link.md) directive. There are two primary ways to achieve this:
To leverage this customization, JavaScript functions must be created in a JavaScript file and linked with the main configuration file using the [links](./config/links.md) configuration. There are two primary ways to achieve this:

1. Define an `onRequest` property with the JS function name in the [http](./directives/http.md#onrequest) directive.
2. Define it in the [upstream](./directives/upstream.md#onrequest) directive, which acts as a global middleware for all requests.
2. Define it in the [upstream](./config/upstream.md#onrequest) configuration, which acts as a global middleware for all requests.

:::tip
If you specify a `onRequest` handler for both `http` and `upstream` the `http` one will always take precedence over the global `onRequest` handler.
Expand All @@ -29,7 +29,7 @@ function foo({request}) {
}
```

Once you have a worker file ready, link that file to the GraphQL configuration using the [`@link`](./directives/link.md) directive and define the [onRequest](./directives/upstream.md#onrequest) property.
Once you have a worker file ready, link that file to the GraphQL configuration using the [`links`](./config/links.md) configuration and define the [onRequest](./config/upstream.md#onrequest) property.

```graphql
schema
Expand Down Expand Up @@ -123,7 +123,7 @@ type Request = {
}
```
By default the headers field will be empty in most cases, unless headers are whitelisted via the [allowedHeaders](./directives/upstream.md#allowedheaders) setting in [`@upstream`](./directives/upstream.md).
By default the headers field will be empty in most cases, unless headers are whitelisted via the [allowedHeaders](./config/upstream.md#allowedheaders) setting.
The http filter doesn't have access to the request's body, hence you can't directly modify the body of an outgoing request. This is more of a design choice than a limitation we have made to ensure that developers don't misuse this API to write all kind of business logic in Tailcall.
Expand Down
6 changes: 3 additions & 3 deletions docs/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ We will update that config with telemetry integration in following sections.

By default, telemetry data is not generated by Tailcall since it requires some setup to know where to send this data and also that affects performance of server that could be undesirable in some cases.

Telemetry configuration is provided by [`@telemetry`](./directives/telemetry.md) directive to setup how and where the telemetry data is send.
Telemetry configuration is provided by [`telemetry`](./config/telemetry.md) configuration to setup how and where the telemetry data is send.

To enable it we can update our config with something like config below:

Expand Down Expand Up @@ -116,7 +116,7 @@ Prometheus integration works by adding a special route for the GraphQL server's

## Data generated

You can find a reference of type of info generated by Tailcall in the [`@telemetry` reference](./directives/telemetry.md) or consult examples in the next section, in order to gain some understanding.
You can find a reference of type of info generated by Tailcall in the [`telemetry` reference](./config/telemetry.md) or consult examples in the next section, in order to gain some understanding.

### Relation with other services

Expand All @@ -130,7 +130,7 @@ Where Tailcall is a part of whole distributed trace

### Customize generated data

In some cases you may want to customize the data that were added to telemetry payload to have more control over analyzing process. Tailcall supports that customization for specific use cases described below. For eg. the metric [`http.server.request.count`](./directives/telemetry.md#metrics) can be customized with the [`requestHeaders`](./directives/telemetry.md#requestheaders) property to allow splitting the overall count by specific headers.
In some cases you may want to customize the data that were added to telemetry payload to have more control over analyzing process. Tailcall supports that customization for specific use cases described below. For eg. the metric [`http.server.request.count`](./config/telemetry.md#metrics) can be customized with the [`requestHeaders`](./config/telemetry.md#requestheaders) property to allow splitting the overall count by specific headers.

:::important
The value of specified headers will be sent to telemetry backend as is, so use it with care to prevent of leaking any sensitive data to third-party services you don't have control over.
Expand Down
7 changes: 1 addition & 6 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "Config",
collapsed: false,
items: [
"config/link",
"config/server",
"config/telemetry",
"config/upstream"
].sort()
items: ["config/links", "config/server", "config/telemetry", "config/upstream"].sort(),
},
{
type: "category",
Expand Down

0 comments on commit b34e401

Please sign in to comment.