Skip to content
Open
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.
6 changes: 3 additions & 3 deletions docs/getting-started/console/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ 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
Expand All @@ -67,7 +67,7 @@ For example, to modify the `User` type with a new field, update your TailorDB ty
```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
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
2 changes: 1 addition & 1 deletion docs/getting-started/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Using `groupBy` with aggregation queries in GraphQL allows you to perform calcul
To use the aggregation query, you'll need to enable advanced APIs. For example, to enable aggregation on the `Order` type

```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
10 changes: 5 additions & 5 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 @@ -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
8 changes: 4 additions & 4 deletions docs/guides/auth/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Maps authenticated identities to a TailorDB type:
// tailordb/user.ts
import { db } from "@tailor-platform/sdk";

export const user = db.type("User", {
export const user = db.table("User", {
email: db.string().unique(), // usernameField must have unique constraint
role: db.enum(["admin", "user"]),
...db.fields.timestamps(),
Expand All @@ -78,7 +78,7 @@ machineUsers: {
Get a machine user token using the CLI:

```bash
tailor-sdk machineuser token <name>
tailor machineuser token <name>
```

### OAuth 2.0 Clients
Expand Down Expand Up @@ -364,7 +364,7 @@ const auth = defineAuth("my-auth", {
After adding the Machine user, run the following command to get the access token.

```bash
tailor-sdk machineuser token {MACHINE_USER_NAME}
tailor machineuser token {MACHINE_USER_NAME}
```

Once you get an access token, you can use it in the playground to run queries.
Expand All @@ -376,7 +376,7 @@ You can use the machine user's credentials in the client application to authenti
Run the following command to view the machine user credentials.

```bash
tailor-sdk machineuser list
tailor machineuser list
```

#### Request an Access Token
Expand Down
15 changes: 3 additions & 12 deletions docs/guides/function/accessing-tailordb.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ In order to access TailorDB from Function service, you need to instantiate the `
`tailordb` exists in the Function service environment by default, so you can use it without any additional installation.
Please specify the `namespace` of the TailorDB you want to connect to when creating the `Client` object.

Importing from `@tailor-platform/sdk` no longer activates the ambient `tailordb.*` global automatically. Add `import "@tailor-platform/sdk/runtime/globals"` as a side-effect import in your function file (or use the typed wrapper from `@tailor-platform/sdk/runtime` instead) — see [Runtime](/sdk/runtime) for details.

Here is the `Client` interface:

```ts
Expand Down Expand Up @@ -177,7 +179,7 @@ To execute the function, you need to set up the Product table in TailorDB.
```typescript {{ title: 'product.ts' }}
import { db, auth } from "@tailor-platform/sdk";

export const product = db.type("Product", {
export const product = db.table("Product", {
title: db.string().description("Title of the product"),
...db.fields.timestamps(),
});
Expand Down Expand Up @@ -750,10 +752,6 @@ const { metadata } = await tailordb.file.uploadStream(
);
```

::: warning Deprecated: openDownloadStream
`openDownloadStream()` is deprecated. Use `downloadStream()` instead, which returns a standard Web `ReadableStream` rather than a custom async iterator.
:::

### Delete Files

Delete a file attached to a record. This removes the file but does not delete the record itself.
Expand Down Expand Up @@ -846,13 +844,6 @@ tailordb.file.uploadStream(
options?: { contentType?: string; fileSize?: number }
): Promise<{ metadata: UploadMetadata }>

tailordb.file.openDownloadStream( // deprecated — use downloadStream()
namespace: string,
typeName: string,
fieldName: string,
recordId: string
): Promise<AsyncIterator<ChunkResult>>

tailordb.file.delete(
namespace: string,
typeName: string,
Expand Down
Loading
Loading