Skip to content
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
12 changes: 6 additions & 6 deletions docs/administration/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ containing all applications, including each Tailor Platform service.
Since changing workspace settings affects all the applications within the workspace,
only [Platform users](#what-is-the-platform-user) have permission to manage workspaces.

You can use the interactive mode of `tailor-sdk` to view all the options available for workspace management by running the following command.
You can use the interactive mode of `tailor` to view all the options available for workspace management by running the following command.

```bash
tailor-sdk workspace
tailor workspace
Commands:
workspace app Manage workspace applications
workspace create Create a new Tailor Platform workspace.
Expand All @@ -28,14 +28,14 @@ By default, a maximum of 10 workspaces can be created per organization.
The Platform user is the user who can log in to Tailor Platform using the following command:

```bash
tailor-sdk login
tailor login
```

When you sign up for an account, we create a Platform user with an admin role for you to manage your workspace. Please note that the [users you add to your application](/tutorials/setup-auth/login/create-user) are not Platform users and therefore cannot manage your workspace.\
To add a new Platform user, you can invite anyone with a Tailor Platform account to your workspace using the following command:

```bash
tailor-sdk workspace user invite --email $userEmailAddress --role $(admin|editor|viewer)
tailor workspace user invite --email $userEmailAddress --role $(admin|editor|viewer)
```

Depending on the role assigned, the Platform user will have different permissions to manage workspaces.
Expand Down Expand Up @@ -81,13 +81,13 @@ The `viewer` role can only view all application and workspace settings.
Platform users with an `admin` role can destroy a workspace using the following command:

```bash
tailor-sdk workspace delete -w {WORKSPACE_ID}
tailor workspace delete -w {WORKSPACE_ID}
```

If you need to restore a destroyed workspace, you can do so within 2 weeks of deletion using the following command:

```bash
tailor-sdk workspace restore -w {WORKSPACE_ID}
tailor workspace restore -w {WORKSPACE_ID}
```

After 2 weeks, all data associated with the workspace will be permanently removed and cannot be recovered.
8 changes: 4 additions & 4 deletions docs/getting-started/console/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ You can confirm that the input data aligns with the validation rules defined in

#### 1. Set Up Your Workspace

Configure your workspace to match your deployed application. You can view and manage workspaces using the `tailor-sdk` CLI.
Configure your workspace to match your deployed application. You can view and manage workspaces using the `tailor` CLI.

```bash
tailor-sdk workspace
tailor workspace
```

#### 2. Update the configuration file

For example, to modify the `User` type with a new field, update your TailorDB type definition:
For example, to modify the `User` table with a new field, update your TailorDB table definition:

```typescript
import { db } from "@tailor-platform/sdk";

export const user = db.type("User", "User of the system", {
export const user = db.table("User", "User of the system", {
name: db.string(),
email: db.string().unique(),
// Add new field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A [Workspace](/administration/workspace) is the top-level namespace in the Tailo
With the SDK, you can create a workspace using the CLI:

```bash
npx tailor-sdk workspace create --name my-workspace --region us-west
npx tailor workspace create --name my-workspace --region us-west
```

### Application
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/core-concepts/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A flexible database service that provides:

- **Type-safe schema definition** using the SDK
- **Auto-generated GraphQL API** for CRUD operations
- **Relationships** between data types
- **Relationships** between data tables
- **Hooks** for custom logic
- **Permission-based access control**

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/core-concepts/workspace-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Using the SDK CLI:

```bash
# Create a new workspace
npx tailor-sdk workspace create --name my-workspace --region us-west
npx tailor workspace create --name my-workspace --region us-west

# List your workspaces
npx tailor-sdk workspace list
npx tailor workspace list
```

Or create one through the [Console](https://console.tailor.tech).
Expand Down
18 changes: 9 additions & 9 deletions docs/getting-started/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ They are similar to making a GET request in REST APIs. With GraphQL, you can spe

### Query Example

Let's assume we have an API for an e-commerce platform that has a `Product` type with fields like `id`, `name`, and `price`.
Let's assume we have an API for an e-commerce platform that has a `Product` table with fields like `id`, `name`, and `price`.
Assume that the `name` field is of the `String` data type and the `price` field is of the `Integer` data type.
Here's an example of a GraphQL query to request a list of products and their details:

Expand Down Expand Up @@ -61,8 +61,8 @@ In this query, we are asking for a list of products and their `id`, `name`, and
}
```

You might notice that the name of the query: `products` is plural of the type name.
In Tailor Platform, `<type name>s` (in plural) will give you a list of the records in the `<type name>`.
You might notice that the name of the query: `products` is plural of the table name.
In Tailor Platform, `<table name>s` (in plural) will give you a list of the records in the `<table name>`.

`edges` contains an array of results.

Expand All @@ -76,7 +76,7 @@ In GraphQL, you can request data from related objects or entities in a single qu

### Nested Object Example

Continuing with our e-commerce platform example, let's assume that the `Product` type has a related `Manufacturer` type with fields like `id`, `name`, `country`, and `directShipping`. You can request data from both the `Product` and the related `Manufacturer` in a single query.
Continuing with our e-commerce platform example, let's assume that the `Product` table has a related `Manufacturer` table with fields like `id`, `name`, `country`, and `directShipping`. You can request data from both the `Product` and the related `Manufacturer` in a single query.

Here's an example of a GraphQL query requesting a list of products, their details, and the associated manufacturer information:

Expand Down Expand Up @@ -155,7 +155,7 @@ Here are examples of GraphQL mutations for each of these operations:
#### Create a new Product

```graphql {{ title: 'graphql'}}
# Create "Product C" and set the manufacturer "ABC Corp." with the id in the Manufacturer type
# Create "Product C" and set the manufacturer "ABC Corp." with the id in the Manufacturer table
mutation {
createProduct(
input: { name: "Product C", price: 40, manufacturerId: "6a5e6f81-15fd-493a-b5d5-86a80a8f81db" }
Expand Down Expand Up @@ -327,7 +327,7 @@ query {
}
```

In this query, we use the `aggregateProduct` query to perform an aggregation on the `price` field of the `Product` type. The `average` field is used to specify the aggregation operation, which in this case is calculating the average of all product prices.
In this query, we use the `aggregateProduct` query to perform an aggregation on the `price` field of the `Product` table. The `average` field is used to specify the aggregation operation, which in this case is calculating the average of all product prices.

Aggregation queries can also be combined with filtering to further customize the data you retrieve and perform calculations on specific subsets of your data.

Expand All @@ -346,16 +346,16 @@ query {
}
```

In this query, we use the `aggreagteOrder` query to perform an aggregation on the `Order` type. The `groupBy` syntax is used to group the orders by the `productId` field. For each group (each unique product), we calculate the sum of the `total` field, which represents the revenue for that specific product. We alias the result as `totalRevenue`.
In this query, we use the `aggreagteOrder` query to perform an aggregation on the `Order` table. The `groupBy` syntax is used to group the orders by the `productId` field. For each group (each unique product), we calculate the sum of the `total` field, which represents the revenue for that specific product. We alias the result as `totalRevenue`.

The response will include a list of grouped results, where each group is identified by a unique `key` (the `productId` in this case), and the corresponding aggregated values, such as the total revenue for that specific product.

Using `groupBy` with aggregation queries in GraphQL allows you to perform calculations on your data while grouping it by a specific field, which can be helpful for generating summary statistics, comparisons, or insights based on different categories or attributes.

To use the aggregation query, you'll need to enable advanced APIs. For example, to enable aggregation on the `Order` type
To use the aggregation query, you'll need to enable advanced APIs. For example, to enable aggregation on the `Order` table

```typescript
db.type("Order", {
db.table("Order", {
name: db.string(),
// ... other fields
}).features({
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Here is a quick look at the console.

## Tailor Platform SDK

The `tailor-sdk` is the command-line interface for building, deploying, and managing applications on the Tailor Platform. It provides a comprehensive set of tools for working with TailorDB, Functions, Workflows and Auth.
The `tailor` is the command-line interface for building, deploying, and managing applications on the Tailor Platform. It provides a comprehensive set of tools for working with TailorDB, Functions, Workflows and Auth.

### Installation

Expand Down
6 changes: 3 additions & 3 deletions docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ npm create @tailor-platform/sdk example-app --template hello-world
Before deploying your app, you need to create a workspace:

```bash
npx tailor-sdk login
npx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
npx tailor-sdk workspace list
npx tailor login
npx tailor workspace create --name <workspace-name> --region <workspace-region>
npx tailor workspace list

# OR
# Create a new workspace using Tailor Platform Console
Expand Down
12 changes: 6 additions & 6 deletions docs/guides/auth/app-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ After integrating your Identity Provider (IdP) with the Auth service, a user mus

1. **User Profile Management**: How Tailor Platform connects authentication with TailorDB user profiles
2. **OAuth2 Client Configuration**: How Tailor Platform's auth service acts as a standalone authentication service
3. **Login Process**: Using OAuth2 flows with `tailor-sdk`
3. **Login Process**: Using OAuth2 flows with `tailor`

## Authentication Architecture

Expand Down Expand Up @@ -63,7 +63,7 @@ Properties
| - usernameField | The field that contains the username. |
| - attributes | Map of attributes to include in the user profile. |

With this `attributes` configuration, the Auth service fetches the `roles` field from the `user` type and assigns its value to the roles attribute for permission checks.
With this `attributes` configuration, the Auth service fetches the `roles` field from the `user` table and assigns its value to the roles attribute for permission checks.

This configuration tells Tailor Platform:

Expand Down Expand Up @@ -173,17 +173,17 @@ Browser clients provide enhanced security for SPAs through multiple mechanisms:

## Part 3: Login Process

### Using `tailor-sdk` for Testing
### Using `tailor` for Testing

The `tailor-sdk` command provides a convenient way to test your OAuth2 configuration:
The `tailor` command provides a convenient way to test your OAuth2 configuration:

```bash
tailor-sdk login
tailor login
```

**What happens during this flow:**

1. **OAuth2 Authorization**: `tailor-sdk` initiates the OAuth2 authorization code flow
1. **OAuth2 Authorization**: `tailor` initiates the OAuth2 authorization code flow
2. **IdP Redirect**: Your browser opens to Tailor Platform's auth service, which redirects to your configured IdP
3. **User Authentication**: You authenticate with your IdP (Auth0, Okta, etc.)
4. **Profile Lookup**: Tailor Platform looks up your user profile in TailorDB using the email from your IdP
Expand Down
42 changes: 21 additions & 21 deletions docs/guides/auth/authconnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Store the client ID and secret in your `.env` file or CI secrets — never commi
Deploy to register the connection with the platform:

```bash
tailor-sdk deploy
tailor deploy
```

This creates (or updates) the connection record. A newly created connection exists but is not yet authorized — it has no tokens yet.
Expand All @@ -94,7 +94,7 @@ This creates (or updates) the connection record. A newly created connection exis
#### 2. Authorize the Connection

```bash
tailor-sdk authconnection authorize --name google-connection \
tailor authconnection authorize --name google-connection \
--scopes "openid,profile,email" \
--port 8080
```
Expand All @@ -114,24 +114,24 @@ This command:
4. Exchanges the authorization code for tokens using the client secret from your config
5. Stores tokens securely on the server

Alternatively, run `tailor-sdk authconnection open` to authorize the connection from the Console instead of the local CLI flow — useful on a machine without browser access:
Alternatively, run `tailor authconnection open` to authorize the connection from the Console instead of the local CLI flow — useful on a machine without browser access:

```bash
tailor-sdk authconnection open
tailor authconnection open
```

Verify the connection is authorized:

```bash
tailor-sdk authconnection list
tailor authconnection list
```

### Option B: Manage Entirely via the Console

No `tailor.config.ts` changes are needed — create, authorize, and manage the connection directly in the Tailor Platform Console:

```bash
tailor-sdk authconnection open
tailor authconnection open
```

This opens the workspace's connections settings page, where you can:
Expand All @@ -146,8 +146,8 @@ This is a good fit for connections you don't want tracked in git — for example

A connection name is owned by exactly one side at a time — the same connection cannot be managed by both the Console and your SDK config simultaneously:

- A connection created via the Console (Option B) carries no SDK ownership label. `tailor-sdk deploy` leaves it completely untouched as long as it isn't also declared in `connections`.
- If you later add a connection with the **same name** to `defineAuth()`'s `connections` and run `deploy`, the SDK finds it already exists without an ownership label and pauses to ask whether it should take it over ("Allow tailor-sdk to manage these resources?"). Confirming adopts it into config management — from that point on, every `deploy` overwrites its fields to match your config, and removing it from `connections` deletes the connection. (`--yes` confirms automatically, which is useful for CI but means this adoption happens without a prompt.)
- A connection created via the Console (Option B) carries no SDK ownership label. `tailor deploy` leaves it completely untouched as long as it isn't also declared in `connections`.
- If you later add a connection with the **same name** to `defineAuth()`'s `connections` and run `deploy`, the SDK finds it already exists without an ownership label and pauses to ask whether it should take it over ("Allow tailor to manage these resources?"). Confirming adopts it into config management — from that point on, every `deploy` overwrites its fields to match your config, and removing it from `connections` deletes the connection. (`--yes` confirms automatically, which is useful for CI but means this adoption happens without a prompt.)
- Until you confirm that handover, `deploy` refuses to proceed, so a Console-managed connection is never silently overwritten by config just because a connection with the same name appears in `tailor.config.ts`.

In short: use the Console (Option B) for connections you intend to manage by hand, and SDK config (Option A) for connections you want defined, reviewed, and deployed alongside the rest of your app. Don't mix the two for the same connection name.
Expand Down Expand Up @@ -176,10 +176,10 @@ connections: {

```bash
# 1. Deploy the connection
tailor-sdk deploy
tailor deploy

# 2. Authorize and get tokens
tailor-sdk authconnection authorize --name google-oauth \
tailor authconnection authorize --name google-oauth \
--scopes "https://www.googleapis.com/auth/admin.directory.user.readonly"
```

Expand Down Expand Up @@ -212,10 +212,10 @@ connections: {

```bash
# 1. Deploy the connection
tailor-sdk deploy
tailor deploy

# 2. Authorize and get tokens
tailor-sdk authconnection authorize --name ms365-oauth \
tailor authconnection authorize --name ms365-oauth \
--scopes "https://graph.microsoft.com/.default"
```

Expand Down Expand Up @@ -249,7 +249,7 @@ connections: {
```

```bash
tailor-sdk deploy
tailor deploy
```

**Common QuickBooks OAuth2 URLs:**
Expand Down Expand Up @@ -301,7 +301,7 @@ export default async () => {
// authconnection.getConnectionToken("unknown-connection"); // ❌ TypeScript error
```

Type narrowing is provided by the generated `tailor.d.ts` (the `ConnectionNameRegistry` interface). Run `tailor-sdk generate` (or `deploy`) after defining new connections to refresh it. Before the first generate, or when `connections` is not defined in `defineAuth()`, `getConnectionToken()` accepts any string.
Type narrowing is provided by the generated `tailor.d.ts` (the `ConnectionNameRegistry` interface). Run `tailor generate` (or `deploy`) after defining new connections to refresh it. Before the first generate, or when `connections` is not defined in `defineAuth()`, `getConnectionToken()` accepts any string.

### Advanced Usage with Error Handling

Expand Down Expand Up @@ -355,19 +355,19 @@ These commands work on any connection regardless of which option created it:

```bash
# Open the connections page in the Console
tailor-sdk authconnection open
tailor authconnection open

# Authorize (opens browser for OAuth2 flow)
tailor-sdk authconnection authorize --name <connection-name>
tailor authconnection authorize --name <connection-name>

# List all connections
tailor-sdk authconnection list
tailor authconnection list

# Revoke a connection's tokens (keeps the connection; re-authorize later)
tailor-sdk authconnection revoke --name <connection-name>
tailor authconnection revoke --name <connection-name>

# Delete a connection entirely
tailor-sdk authconnection delete --name <connection-name>
tailor authconnection delete --name <connection-name>
```

To delete a connection managed via SDK config (Option A), remove it from `connections` and redeploy instead of using `authconnection delete` directly — manage each connection through one method only, as described above.
Expand Down Expand Up @@ -408,7 +408,7 @@ connections: {
```

```bash
tailor-sdk deploy -w <production-workspace-id> --env-file .env.production
tailor deploy -w <production-workspace-id> --env-file .env.production
```

## Troubleshooting
Expand Down Expand Up @@ -436,7 +436,7 @@ tailor-sdk deploy -w <production-workspace-id> --env-file .env.production

**Re-authorization Required After Deploy**

- If `tailor-sdk deploy` warns that a connection needs re-authorization, run `tailor-sdk authconnection authorize --name <connection-name>` again
- If `tailor deploy` warns that a connection needs re-authorization, run `tailor authconnection authorize --name <connection-name>` again
- This happens when identity-changing fields (`providerUrl`, `issuerUrl`, `clientId`, `type`) are modified

**Function Runtime Errors**
Expand Down
Loading
Loading