@tailor-platform/sdk 1.69.0 → 1.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/application-BakHtldG.mjs +4 -0
- package/dist/{application-Cr-limKC.mjs → application-Df5_I83n.mjs} +318 -78
- package/dist/application-Df5_I83n.mjs.map +1 -0
- package/dist/cli/erd-viewer-assets/app.js +279 -36
- package/dist/cli/erd-viewer-assets/index.html +4 -0
- package/dist/cli/erd-viewer-assets/styles.css +252 -5
- package/dist/cli/index.mjs +641 -90
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +14 -8
- package/dist/cli/lib.mjs +2 -2
- package/dist/completion/zsh-worker.zsh +153 -2
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +8 -6
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-B7VbJm0_.d.mts → index-BAEaAqmz.d.mts} +90 -40
- package/dist/{index-CklcVeMG.d.mts → index-C-vsbx27.d.mts} +2 -2
- package/dist/{index-hXoO-AOC.d.mts → index-CKI0eZP6.d.mts} +2 -2
- package/dist/{index-DYhnxXYR.d.mts → index-CrqOgUF2.d.mts} +2 -2
- package/dist/{index-DlDRSzFZ.d.mts → index-DESLU9kI.d.mts} +2 -2
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +1 -1
- package/dist/{runtime-jowoN6qC.mjs → runtime-CSY0eD4_.mjs} +330 -190
- package/dist/runtime-CSY0eD4_.mjs.map +1 -0
- package/dist/{schema-1msIhXwA.mjs → schema-C4fkpWV_.mjs} +9 -15
- package/dist/schema-C4fkpWV_.mjs.map +1 -0
- package/dist/{types-2Be3wSMc.mjs → types-32lUMToj.mjs} +1 -1
- package/dist/{types-CmzfQP_m.mjs → types-D4QMmNWh.mjs} +1 -12
- package/dist/types-D4QMmNWh.mjs.map +1 -0
- package/dist/{types-Bzr0RQME.d.mts → types-Dynq4AJv.d.mts} +2 -2
- package/dist/{types-DZrtN6-H.d.mts → types-rj8YJcEe.d.mts} +5 -2
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-Br9bmLdX.d.mts → workflow.generated-DJULCuRr.d.mts} +177 -172
- package/docs/cli/application.md +37 -2
- package/docs/cli/setup.md +1 -0
- package/docs/cli/tailordb.md +24 -0
- package/docs/cli/user.md +11 -1
- package/docs/cli/workspace.md +13 -7
- package/docs/cli-reference.md +6 -0
- package/docs/github-actions.md +27 -0
- package/docs/multi-environment.md +22 -0
- package/docs/services/aigateway.md +4 -2
- package/docs/services/http-adapter.md +16 -1
- package/package.json +1 -1
- package/dist/application-Br48NXBD.mjs +0 -4
- package/dist/application-Cr-limKC.mjs.map +0 -1
- package/dist/runtime-jowoN6qC.mjs.map +0 -1
- package/dist/schema-1msIhXwA.mjs.map +0 -1
- package/dist/types-CmzfQP_m.mjs.map +0 -1
package/docs/cli/workspace.md
CHANGED
|
@@ -331,13 +331,16 @@ tailor-sdk profile create [options] <name>
|
|
|
331
331
|
|
|
332
332
|
**Options**
|
|
333
333
|
|
|
334
|
-
| Option | Alias | Description | Required | Default |
|
|
335
|
-
| ------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- |
|
|
336
|
-
| `--user <USER>` | `-u` | User email | Yes | - |
|
|
337
|
-
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | Yes | - |
|
|
338
|
-
| `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands while the profile is active. | No | `"write"` |
|
|
339
|
-
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). | No | - |
|
|
340
|
-
| `--machine-user-override <MACHINE_USER_OVERRIDE>` | - | Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user. | No | - |
|
|
334
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
335
|
+
| ------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- | ---------------------------------- |
|
|
336
|
+
| `--user <USER>` | `-u` | User email | Yes | - | - |
|
|
337
|
+
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | Yes | - | - |
|
|
338
|
+
| `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
|
|
339
|
+
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). | No | - | - |
|
|
340
|
+
| `--machine-user-override <MACHINE_USER_OVERRIDE>` | - | Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user. | No | - | - |
|
|
341
|
+
| `--platform-url <PLATFORM_URL>` | - | Platform API base URL for this profile. | No | - | `TAILOR_PLATFORM_URL` |
|
|
342
|
+
| `--oauth2-client-id <OAUTH2_CLIENT_ID>` | - | OAuth2 client ID for logging in to this profile's platform. | No | - | `TAILOR_PLATFORM_OAUTH2_CLIENT_ID` |
|
|
343
|
+
| `--console-url <CONSOLE_URL>` | - | Console base URL for this profile. | No | - | `TAILOR_PLATFORM_CONSOLE_URL` |
|
|
341
344
|
|
|
342
345
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
343
346
|
|
|
@@ -396,5 +399,8 @@ tailor-sdk profile update [options] <name>
|
|
|
396
399
|
| `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands; 'write' lifts the restriction. | No | - |
|
|
397
400
|
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). Pass an empty string to clear. | No | - |
|
|
398
401
|
| `--machine-user-override <MACHINE_USER_OVERRIDE>` | - | Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user; 'allow' lifts the restriction. | No | - |
|
|
402
|
+
| `--platform-url <PLATFORM_URL>` | - | Platform API base URL for this profile. Pass an empty string to clear. | No | - |
|
|
403
|
+
| `--oauth2-client-id <OAUTH2_CLIENT_ID>` | - | OAuth2 client ID for logging in to this profile's platform. Pass an empty string to clear. | No | - |
|
|
404
|
+
| `--console-url <CONSOLE_URL>` | - | Console base URL for this profile. Pass an empty string to clear. | No | - |
|
|
399
405
|
|
|
400
406
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
package/docs/cli-reference.md
CHANGED
|
@@ -74,6 +74,9 @@ You can use environment variables to configure workspace and authentication:
|
|
|
74
74
|
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` | Client ID for `login --machine-user` |
|
|
75
75
|
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | Client secret for `login --machine-user` |
|
|
76
76
|
| `TAILOR_PLATFORM_MACHINE_USER_NAME` | Default machine user name for `query`, `workflow start`, `function test-run`, `machineuser token` |
|
|
77
|
+
| `TAILOR_PLATFORM_URL` | Platform API base URL. Saved into profiles created with `profile create --platform-url` |
|
|
78
|
+
| `TAILOR_PLATFORM_OAUTH2_CLIENT_ID` | OAuth2 client ID for user login. Saved into profiles created with `profile create --oauth2-client-id` |
|
|
79
|
+
| `TAILOR_PLATFORM_CONSOLE_URL` | Console base URL. Saved into profiles created with `profile create --console-url` |
|
|
77
80
|
| `TAILOR_BUNDLE_CONCURRENCY` | Max concurrent bundle workers for `deploy` (resolvers/executors/workflows). Defaults to CPU count |
|
|
78
81
|
| `TAILOR_APPLY_CONCURRENCY` | Max concurrent unary platform RPCs during `apply`/`deploy` (streaming uploads are not gated). Defaults to 16 |
|
|
79
82
|
| `VISUAL` / `EDITOR` | Preferred editor for commands that open files (e.g., `vim`, `code`, `nano`) |
|
|
@@ -89,6 +92,8 @@ Token resolution follows this priority order:
|
|
|
89
92
|
3. Profile specified via `--profile` option or `TAILOR_PLATFORM_PROFILE`
|
|
90
93
|
4. Current user from platform config (`~/.config/tailor-platform/config.yaml`)
|
|
91
94
|
|
|
95
|
+
Config-backed login tokens are scoped to the Platform API URL. Profiles with `--platform-url` use the token saved for that URL, so switching profiles can also switch between Platform API environments.
|
|
96
|
+
|
|
92
97
|
### Workspace ID Priority
|
|
93
98
|
|
|
94
99
|
Workspace ID resolution follows this priority order:
|
|
@@ -131,6 +136,7 @@ Commands for managing TailorDB tables, data, and schema migrations.
|
|
|
131
136
|
| [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
|
|
132
137
|
| [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
|
|
133
138
|
| [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
|
|
139
|
+
| [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
|
|
134
140
|
| [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
|
|
135
141
|
| [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
|
|
136
142
|
|
package/docs/github-actions.md
CHANGED
|
@@ -63,6 +63,33 @@ What it does:
|
|
|
63
63
|
Fork pull requests cannot read repository secrets. For forks, the plan step is
|
|
64
64
|
automatically skipped; `generate-check` and other non-secret checks still run.
|
|
65
65
|
|
|
66
|
+
#### ERD preview artifacts
|
|
67
|
+
|
|
68
|
+
Pass `--erd-preview` on a branch target to add TailorDB ERD preview artifacts
|
|
69
|
+
to pull requests:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
tailor-sdk setup -n my-app-stg --erd-preview
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The generated workflow builds one self-contained ERD viewer HTML file for each
|
|
76
|
+
owned TailorDB namespace in `tailor.config.ts`. The viewer compares the pull
|
|
77
|
+
request merge result with the base branch, can switch between the current schema
|
|
78
|
+
and highlighted diff, uploads the HTML files as unarchived Actions artifacts,
|
|
79
|
+
and upserts a PR comment with artifact links.
|
|
80
|
+
|
|
81
|
+
ERD preview does not use Tailor Platform credentials. Fork pull requests still
|
|
82
|
+
build artifacts, but the comment step is skipped because fork tokens cannot
|
|
83
|
+
write PR comments.
|
|
84
|
+
|
|
85
|
+
`--erd-preview` is only available for branch targets with the plan job enabled;
|
|
86
|
+
it cannot be combined with `--tag` or `--no-plan`. The namespace list is
|
|
87
|
+
recorded in `.github/tailor-sdk.lock`; the pull request workflow compares the
|
|
88
|
+
head and base lock files so newly added or removed namespaces can still produce
|
|
89
|
+
all-added or all-removed viewer artifacts. Re-run `setup` after adding or
|
|
90
|
+
removing TailorDB namespaces. `setup check` reports drift when the recorded ERD
|
|
91
|
+
preview namespaces no longer match the current config.
|
|
92
|
+
|
|
66
93
|
### Tag target (recommended for production)
|
|
67
94
|
|
|
68
95
|
The tag target fires when a tag matching `--tag-pattern` (default `v*`) is
|
|
@@ -25,6 +25,28 @@ tailor-sdk deploy -p staging
|
|
|
25
25
|
|
|
26
26
|
Profiles are created with `write` permission by default. The production profile above opts into `--permission read`, which blocks write commands such as `deploy` while the profile is active — a guard against deploying to production by accident. To deploy to production deliberately, pass the workspace explicitly with `-w` without selecting the profile — the guard applies only while a profile is selected via `-p` or `TAILOR_PLATFORM_PROFILE` — or use a separate profile created with `write` permission.
|
|
27
27
|
|
|
28
|
+
If a profile targets a non-default Tailor Platform API, save that connection on the profile as well. User login tokens are stored per Platform URL, so you can log in once for each Platform and then switch with only the profile:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
export TAILOR_PLATFORM_URL=<platform-api-url>
|
|
32
|
+
export TAILOR_PLATFORM_OAUTH2_CLIENT_ID=<oauth2-client-id>
|
|
33
|
+
export TAILOR_PLATFORM_CONSOLE_URL=<console-url>
|
|
34
|
+
|
|
35
|
+
tailor-sdk login
|
|
36
|
+
tailor-sdk profile create development \
|
|
37
|
+
-u you@example.com \
|
|
38
|
+
-w <development-workspace-id> \
|
|
39
|
+
--platform-url "$TAILOR_PLATFORM_URL" \
|
|
40
|
+
--oauth2-client-id "$TAILOR_PLATFORM_OAUTH2_CLIENT_ID" \
|
|
41
|
+
--console-url "$TAILOR_PLATFORM_CONSOLE_URL"
|
|
42
|
+
|
|
43
|
+
unset TAILOR_PLATFORM_URL TAILOR_PLATFORM_OAUTH2_CLIENT_ID TAILOR_PLATFORM_CONSOLE_URL
|
|
44
|
+
tailor-sdk deploy -p development
|
|
45
|
+
tailor-sdk open -p development
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After the profile exists, run `tailor-sdk login -p development` to refresh the login for that Platform without re-exporting the connection variables.
|
|
49
|
+
|
|
28
50
|
## Varying config values per environment
|
|
29
51
|
|
|
30
52
|
`tailor.config.ts` is a TypeScript module evaluated locally each time an SDK command loads it, so any value can branch on `process.env`. If the config also defines an auth before-login hook, mind the `process.env` caveat in [Environment Variables](./configuration.md#environment-variables). Keep one env file per environment and load it with the global [`--env-file`](./cli-reference.md#environment-file-loading) option:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# AI Gateway
|
|
2
2
|
|
|
3
|
-
AI Gateway provides a unified endpoint for accessing
|
|
3
|
+
AI Gateway provides a unified endpoint for accessing a range of large language models through a single OpenAI-compatible API, with platform-managed credentials and workspace-scoped authentication.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
7
|
AI Gateway provides:
|
|
8
8
|
|
|
9
|
-
- A unified, OpenAI-compatible endpoint for multiple LLM
|
|
9
|
+
- A unified, OpenAI-compatible endpoint for multiple LLM models
|
|
10
10
|
- Mandatory authentication via your workspace's auth (request tokens are resolved against the configured auth namespace)
|
|
11
11
|
- Per-workspace isolation: each gateway is provisioned with its own platform-assigned URL
|
|
12
12
|
- Optional CORS allow-list for browser-based clients
|
|
@@ -31,6 +31,7 @@ const aiGateway = defineAIGateway("my-aigateway", {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
export default defineConfig({
|
|
34
|
+
name: "my-app",
|
|
34
35
|
aiGateways: [aiGateway],
|
|
35
36
|
});
|
|
36
37
|
```
|
|
@@ -80,6 +81,7 @@ const website = defineStaticWebSite("my-frontend", {
|
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
const aiGateway = defineAIGateway("my-aigateway", {
|
|
84
|
+
// Name of an auth namespace in your workspace; request tokens are resolved against it.
|
|
83
85
|
authNamespace: "default",
|
|
84
86
|
cors: [website.url],
|
|
85
87
|
});
|
|
@@ -7,7 +7,7 @@ HTTP adapters expose REST-style HTTP endpoints on your application by translatin
|
|
|
7
7
|
Each HTTP adapter is a single file that declares:
|
|
8
8
|
|
|
9
9
|
- A `pathPattern` (which methods it handles is derived from the `input` keys)
|
|
10
|
-
- An `input` object keyed by lowercase HTTP method (`get`, `post`, `put`, `patch`, `delete`) — each value is a function that converts an incoming HTTP request into a GraphQL request (`query`, `variables`, `operationName`)
|
|
10
|
+
- An `input` object keyed by lowercase HTTP method (`get`, `post`, `put`, `patch`, `delete`) — each value is a function that converts an incoming HTTP request into a GraphQL request (`query`, `variables`, `operationName`). `query` can be a GraphQL string or a generated `TypedDocumentNode`.
|
|
11
11
|
- An optional `output` function — **shared across all methods** — that converts the GraphQL response into an HTTP response (`statusCode`, `headers`, `body`)
|
|
12
12
|
|
|
13
13
|
Adapters are deployed together with your application. When a request arrives under the `/api/` prefix and matches an adapter, the handler for the request method runs server-side.
|
|
@@ -74,6 +74,21 @@ A request to `GET /api/users/abc-123` invokes the `get` handler, runs the result
|
|
|
74
74
|
|
|
75
75
|
If `output` is omitted, the raw GraphQL response is returned as JSON.
|
|
76
76
|
|
|
77
|
+
### Typed GraphQL Documents
|
|
78
|
+
|
|
79
|
+
`input` handlers can return generated `TypedDocumentNode` values instead of query strings. The SDK uses the document's variables type for `variables`, and passes the document's result type to `output` as `resp.data`.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { GetUserDocument } from "../generated/graphql";
|
|
83
|
+
|
|
84
|
+
get: (req) => ({
|
|
85
|
+
query: GetUserDocument,
|
|
86
|
+
variables: { id: req.path.split("/")[2] ?? "" },
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
When multiple methods return different typed documents, `resp.data` is the union of those result types because `output` is shared across the adapter. If a method returns a plain string query, its result type is `unknown`. When extracting an input handler and annotating it separately, pass the document type to `HttpAdapterInputFn` so required variables stay typed.
|
|
91
|
+
|
|
77
92
|
### Optional fields
|
|
78
93
|
|
|
79
94
|
Beyond `name`, `pathPattern`, `input`, and `output`, two optional fields control deploy-time behavior:
|
package/package.json
CHANGED