From 85a6d301dc323947eeabad201d5536b206dd7e67 Mon Sep 17 00:00:00 2001 From: dqn Date: Wed, 13 May 2026 17:40:29 +0900 Subject: [PATCH] docs(sdk): clarify machineUserAttributes is required without userProfile The static website OAuth2 example and the auth.md inline comment both implied `machineUserAttributes` is optional. The SDK types make it required whenever you use `machineUsers` without a `userProfile`, so AI-authored configs that try `machineUsers: { runner: {} }` fail typecheck. Show the machine-user-only shape inline in the static website "OAuth2 Redirect URIs" example and fix the misleading auth.md "Optional" comment. --- packages/sdk/docs/services/auth.md | 2 +- packages/sdk/docs/services/staticwebsite.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/sdk/docs/services/auth.md b/packages/sdk/docs/services/auth.md index cb0c652bb..44a686685 100644 --- a/packages/sdk/docs/services/auth.md +++ b/packages/sdk/docs/services/auth.md @@ -33,7 +33,7 @@ const auth = defineAuth("my-auth", { usernameField: "email", attributes: { role: true }, }, - // Optional when you don't define userProfile: + // Required when you don't define userProfile (mutually exclusive with userProfile): // machineUserAttributes: { // role: t.string(), // }, diff --git a/packages/sdk/docs/services/staticwebsite.md b/packages/sdk/docs/services/staticwebsite.md index 3164ac562..603c6446c 100644 --- a/packages/sdk/docs/services/staticwebsite.md +++ b/packages/sdk/docs/services/staticwebsite.md @@ -80,12 +80,26 @@ export default defineConfig({ ### OAuth2 Redirect URIs +The same `website.url` placeholder can be reused in `defineAuth`'s OAuth2 redirect URIs. Pick exactly one of `userProfile` or `machineUserAttributes` on `defineAuth` (they are mutually exclusive). The snippet below uses the machine-user-only shape so it compiles standalone. + ```typescript +import { defineAuth, defineStaticWebSite, t } from "@tailor-platform/sdk"; + const website = defineStaticWebSite("my-frontend", { description: "Frontend application", }); const auth = defineAuth("my-auth", { + // `machineUserAttributes` is required whenever you use `machineUsers` + // without a `userProfile`. It types every `machineUsers[*].attributes`. + machineUserAttributes: { + role: t.string(), + }, + machineUsers: { + runner: { + attributes: { role: "RUNNER" }, + }, + }, oauth2Clients: { "my-client": { redirectURIs: [