From 4255ecfaf6b342b3ba6c159f26fb09df978eb770 Mon Sep 17 00:00:00 2001 From: jackchuka Date: Mon, 8 Jun 2026 19:20:02 +0900 Subject: [PATCH] docs(develop-from-scratch): update tutorial for @tailor-platform/sdk Bring the SDK tutorial in line with the current @tailor-platform/sdk API. - Remove `workspaceId`/`WORKSPACE_ID` from `tailor.config.ts` in all steps; it is no longer a valid `defineConfig` field (fails to compile). Workspace is supplied at deploy time via TAILOR_PLATFORM_WORKSPACE_ID / --workspace-id, and the app `id` is auto-injected on first deploy. - Step 1: update Deploy instructions to TAILOR_PLATFORM_WORKSPACE_ID. - Step 4: webhook executor `body:` -> `requestBody:` (with `body:`, the SDK drops the payload and the callback param is untyped); fix deleted-trigger context field `record` -> `oldRecord`. --- docs/tutorials/develop-from-scratch/step-01.md | 10 ++++------ docs/tutorials/develop-from-scratch/step-02.md | 5 ----- docs/tutorials/develop-from-scratch/step-03.md | 5 ----- docs/tutorials/develop-from-scratch/step-04.md | 9 ++------- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/docs/tutorials/develop-from-scratch/step-01.md b/docs/tutorials/develop-from-scratch/step-01.md index e949a56..a71238b 100644 --- a/docs/tutorials/develop-from-scratch/step-01.md +++ b/docs/tutorials/develop-from-scratch/step-01.md @@ -50,12 +50,7 @@ This step establishes the foundational database schema for your project manageme ```typescript {{title: 'tailor.config.ts'}} import { defineConfig } from "@tailor-platform/sdk"; -if (!process.env.WORKSPACE_ID) { - throw new Error("WORKSPACE_ID environment variable is not set"); -} - export default defineConfig({ - workspaceId: process.env.WORKSPACE_ID, name: "project-management", db: { "main-db": { files: [`./src/db/*.ts`] } }, }); @@ -138,10 +133,13 @@ project-management/ ## Deploy +The workspace is provided at deploy time, not in `tailor.config.ts`. Pass it via the `TAILOR_PLATFORM_WORKSPACE_ID` environment variable (or the `--workspace-id` flag). On the first deploy, the SDK injects a stable `id` into `tailor.config.ts` to track the application across renames — keep it under version control. + ```bash npm install -export WORKSPACE_ID=your-workspace-id +export TAILOR_PLATFORM_WORKSPACE_ID=your-workspace-id npm run deploy +# or: npm run deploy -- --workspace-id your-workspace-id ``` ## Next Step diff --git a/docs/tutorials/develop-from-scratch/step-02.md b/docs/tutorials/develop-from-scratch/step-02.md index 0f57e4d..87b4e05 100644 --- a/docs/tutorials/develop-from-scratch/step-02.md +++ b/docs/tutorials/develop-from-scratch/step-02.md @@ -10,12 +10,7 @@ This step adds authentication capabilities to your project management applicatio import { defineAuth, defineConfig } from "@tailor-platform/sdk"; import { user } from "./src/db/user"; -if (!process.env.WORKSPACE_ID) { - throw new Error("WORKSPACE_ID environment variable is not set"); -} - export default defineConfig({ - workspaceId: process.env.WORKSPACE_ID, name: "project-management", db: { "main-db": { files: [`./src/db/*.ts`] } }, auth: defineAuth("main-auth", { diff --git a/docs/tutorials/develop-from-scratch/step-03.md b/docs/tutorials/develop-from-scratch/step-03.md index f553fa3..6f1e69f 100644 --- a/docs/tutorials/develop-from-scratch/step-03.md +++ b/docs/tutorials/develop-from-scratch/step-03.md @@ -14,12 +14,7 @@ Changes from Step 2: added `admin` machine user, `resolver` namespace, and `gene import { defineAuth, defineConfig, defineGenerators } from "@tailor-platform/sdk"; import { user } from "./src/db/user"; -if (!process.env.WORKSPACE_ID) { - throw new Error("WORKSPACE_ID environment variable is not set"); -} - export default defineConfig({ - workspaceId: process.env.WORKSPACE_ID, name: "project-management", db: { "main-db": { files: [`./src/db/*.ts`] } }, auth: defineAuth("main-auth", { diff --git a/docs/tutorials/develop-from-scratch/step-04.md b/docs/tutorials/develop-from-scratch/step-04.md index 608dfa8..79507a8 100644 --- a/docs/tutorials/develop-from-scratch/step-04.md +++ b/docs/tutorials/develop-from-scratch/step-04.md @@ -12,12 +12,7 @@ Only change from Step 3: added `executor` to `tailor.config.ts`. import { defineAuth, defineConfig, defineGenerators } from "@tailor-platform/sdk"; import { user } from "./src/db/user"; -if (!process.env.WORKSPACE_ID) { - throw new Error("WORKSPACE_ID environment variable is not set"); -} - export default defineConfig({ - workspaceId: process.env.WORKSPACE_ID, name: "project-management", db: { "main-db": { files: [`./src/db/*.ts`] } }, auth: defineAuth("main-auth", { @@ -50,7 +45,7 @@ export const generators = defineGenerators([ ]); ``` -`createExecutor` takes an object config with `name`, `trigger`, and `operation`. The trigger `recordCreatedTrigger` takes `{ type: task }`. Available trigger context: `newRecord` (created), `oldRecord`/`newRecord` (updated), `record` (deleted). +`createExecutor` takes an object config with `name`, `trigger`, and `operation`. The trigger `recordCreatedTrigger` takes `{ type: task }`. Available trigger context: `newRecord` (created), `oldRecord`/`newRecord` (updated), `oldRecord` (deleted). ```typescript {{title: 'src/executor/newTaskSlackNotification.ts'}} import { createExecutor, recordCreatedTrigger } from "@tailor-platform/sdk"; @@ -68,7 +63,7 @@ export default createExecutor({ headers: { "Content-Type": "application/json", }, - body: ({ newRecord }) => ({ + requestBody: ({ newRecord }) => ({ text: "New Task created :tada: " + newRecord.name, }), },