@tailor-platform/sdk 1.69.0 → 1.70.1
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 +73 -0
- package/dist/{application-Cr-limKC.mjs → application-DmjIKQ-a.mjs} +319 -79
- package/dist/application-DmjIKQ-a.mjs.map +1 -0
- package/dist/application-a_ApFuPh.mjs +4 -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 +642 -91
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +87 -13
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +159 -6
- 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-BpHVwifd.mjs} +525 -311
- package/dist/runtime-BpHVwifd.mjs.map +1 -0
- package/dist/{schema-1msIhXwA.mjs → schema-C4fkpWV_.mjs} +9 -15
- package/dist/schema-C4fkpWV_.mjs.map +1 -0
- package/dist/{service_pb-DGSmn-aF.mjs → service_pb-BJ9GsAnW.mjs} +1 -1
- package/dist/{service_pb-DSNjrcbW.mjs → service_pb-BsBR6yW5.mjs} +22 -7
- package/dist/service_pb-BsBR6yW5.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/auth.md +4 -14
- package/docs/services/http-adapter.md +16 -1
- package/package.json +11 -11
- 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/service_pb-DSNjrcbW.mjs.map +0 -1
- package/dist/types-CmzfQP_m.mjs.map +0 -1
package/docs/cli/application.md
CHANGED
|
@@ -110,10 +110,45 @@ Before applying changes, `deploy` shows a preview of the planned resource change
|
|
|
110
110
|
After the detailed list, a summary line is printed:
|
|
111
111
|
|
|
112
112
|
```text
|
|
113
|
-
Plan: 5 to create, 3 to update, 1 to delete
|
|
113
|
+
Plan: 5 to create, 3 to update, 1 to delete
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
Use `--dry-run` to preview the plan without applying anything.
|
|
116
|
+
Use `--dry-run` to preview the plan without applying anything. In dry-run mode the plan is written to **stdout**, so it can be captured in CI without `2>&1`:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
tailor-sdk deploy --dry-run > plan.txt
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
In apply mode, the plan is printed to stderr so it does not interfere with piped output.
|
|
123
|
+
|
|
124
|
+
**JSON Output:**
|
|
125
|
+
|
|
126
|
+
Pass the global `--json` / `-j` flag to get machine-readable output.
|
|
127
|
+
|
|
128
|
+
**Dry-run** (`--dry-run --json`): writes a JSON object to stdout:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"summary": { "create": 2, "update": 1, "delete": 0, "replace": 0 },
|
|
133
|
+
"changes": [{ "action": "create", "name": "Order", "labels": ["type"], "namespace": "tailordb" }],
|
|
134
|
+
"warnings": [
|
|
135
|
+
{ "type": "unmanaged", "resourceType": "tailorDB", "name": "LegacyType" },
|
|
136
|
+
{ "type": "skippedSecret", "resourceType": "secret", "name": "DB_PASSWORD" }
|
|
137
|
+
],
|
|
138
|
+
"conflicts": [{ "resourceType": "tailorDB", "name": "User", "currentOwner": "other-app" }]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- `summary` — counts of each change type.
|
|
143
|
+
- `changes` — planned resource changes, each with `action`, `name`, and optional `labels` / `namespace`.
|
|
144
|
+
- `warnings` — resources not in config (`type: "unmanaged"`) or secrets with missing values (`type: "skippedSecret"`). Unmanaged resources require confirmation in apply mode (apply is cancelled if declined); skipped secrets are non-blocking.
|
|
145
|
+
- `conflicts` — resources owned by another application that conflict with the current config. Require confirmation in apply mode; apply is cancelled if declined.
|
|
146
|
+
|
|
147
|
+
**Apply** (`--json`): writes a JSON object to stdout:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{ "summary": { "create": 1, "update": 2, "delete": 0, "replace": 0 }, "status": "applied" }
|
|
151
|
+
```
|
|
117
152
|
|
|
118
153
|
## remove
|
|
119
154
|
|
package/docs/cli/setup.md
CHANGED
|
@@ -23,6 +23,7 @@ tailor-sdk setup [options] [command]
|
|
|
23
23
|
| `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (requires --tag; defaults to v\*) | No | - |
|
|
24
24
|
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
|
|
25
25
|
| `--no-plan` | - | Disable the plan job for a branch target (cannot be combined with --tag) | No | `false` |
|
|
26
|
+
| `--erd-preview` | - | Add PR ERD viewer artifacts with current/diff previews for TailorDB namespaces | No | `false` |
|
|
26
27
|
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
|
27
28
|
| `--force` | - | Discard hand edits / take over unmanaged files and regenerate | No | `false` |
|
|
28
29
|
|
package/docs/cli/tailordb.md
CHANGED
|
@@ -247,6 +247,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
247
247
|
| Command | Description |
|
|
248
248
|
| --------------------------------------------- | ----------------------------------------------------------------- |
|
|
249
249
|
| [`tailordb erd export`](#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
|
|
250
|
+
| [`tailordb erd diff`](#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
|
|
250
251
|
| [`tailordb erd serve`](#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
|
|
251
252
|
| [`tailordb erd deploy`](#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
|
|
252
253
|
|
|
@@ -270,6 +271,28 @@ tailor-sdk tailordb erd export [options]
|
|
|
270
271
|
|
|
271
272
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
272
273
|
|
|
274
|
+
#### tailordb erd diff
|
|
275
|
+
|
|
276
|
+
Render TailorDB ERD schema diff HTML from exported ERD viewers.
|
|
277
|
+
|
|
278
|
+
**Usage**
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
tailor-sdk tailordb erd diff [options]
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Options**
|
|
285
|
+
|
|
286
|
+
| Option | Alias | Description | Required | Default |
|
|
287
|
+
| ----------------------------- | ----- | ----------------------------------------------------------------------- | -------- | ------- |
|
|
288
|
+
| `--base-html <BASE_HTML>` | - | Base ERD viewer HTML file | No | - |
|
|
289
|
+
| `--head-html <HEAD_HTML>` | - | Head ERD viewer HTML file | No | - |
|
|
290
|
+
| `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (defaults to the provided ERD schema namespace) | No | - |
|
|
291
|
+
| `--output <OUTPUT>` | `-o` | Output ERD diff HTML file | Yes | - |
|
|
292
|
+
| `--output-json <OUTPUT_JSON>` | - | Optional output JSON file for the computed diff | No | - |
|
|
293
|
+
|
|
294
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
295
|
+
|
|
273
296
|
#### tailordb erd serve
|
|
274
297
|
|
|
275
298
|
Generate and serve TailorDB ERD locally with watch reload. (beta)
|
|
@@ -316,6 +339,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
316
339
|
|
|
317
340
|
- ERD commands build from the local TailorDB schema, including plugin-generated TailorDB types.
|
|
318
341
|
- `tailordb erd export` writes a self-contained `index.html` viewer to `<output>/<namespace>/dist`.
|
|
342
|
+
- `tailordb erd diff` compares exported self-contained viewer HTML files and writes a visual ERD viewer that can switch between the current schema and the highlighted diff.
|
|
319
343
|
- `tailordb erd serve` watches the config file and TailorDB type files, then reloads the browser viewer when the rebuilt `index.html` reports a new embedded schema revision.
|
|
320
344
|
- `tailordb erd deploy` still requires `erdSite` in `tailor.config.ts` because it uploads the generated viewer to a configured Static Website.
|
|
321
345
|
|
package/docs/cli/user.md
CHANGED
|
@@ -14,6 +14,10 @@ tailor-sdk login [options]
|
|
|
14
14
|
|
|
15
15
|
**Options**
|
|
16
16
|
|
|
17
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
18
|
+
| --------------------- | ----- | ------------------------------------------------------------------- | -------- | ------- | ------------------------- |
|
|
19
|
+
| `--profile <PROFILE>` | `-p` | Workspace profile whose platform settings should be used for login. | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
20
|
+
|
|
17
21
|
> One of the following option groups is required:
|
|
18
22
|
|
|
19
23
|
**User Login:**
|
|
@@ -37,9 +41,15 @@ Logout from Tailor Platform.
|
|
|
37
41
|
**Usage**
|
|
38
42
|
|
|
39
43
|
```
|
|
40
|
-
tailor-sdk logout
|
|
44
|
+
tailor-sdk logout [options]
|
|
41
45
|
```
|
|
42
46
|
|
|
47
|
+
**Options**
|
|
48
|
+
|
|
49
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
50
|
+
| --------------------- | ----- | -------------------------------------------------------------------- | -------- | ------- | ------------------------- |
|
|
51
|
+
| `--profile <PROFILE>` | `-p` | Workspace profile whose platform settings should be used for logout. | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
52
|
+
|
|
43
53
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
44
54
|
|
|
45
55
|
## user
|
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
|
});
|
package/docs/services/auth.md
CHANGED
|
@@ -369,17 +369,14 @@ Auth connections enable OAuth2 authentication with external providers (Google, M
|
|
|
369
369
|
|
|
370
370
|
For the official Tailor Platform documentation, see [AuthConnection Guide](https://docs.tailor.tech/guides/auth/authconnection).
|
|
371
371
|
|
|
372
|
-
> [!
|
|
373
|
-
>
|
|
374
|
-
> A deploy revokes and recreates the connection — discarding the token obtained via `authconnection authorize` — whenever it cannot confirm the secret is unchanged. That check relies on a hash stored locally in `.tailor-sdk/secrets-state.json`, which is gitignored and therefore not shared across machines. So a deploy from CI, a clean checkout, another developer's machine, or after deleting `.tailor-sdk/` recreates the connection and drops its token. Only repeated deploys from the same machine that still holds that state keep the token.
|
|
375
|
-
>
|
|
376
|
-
> Because of this, prefer to **create the connection and its token from the Console**. You can jump to the connections page with:
|
|
372
|
+
> [!NOTE]
|
|
373
|
+
> Deploy updates connections **in-place**, preserving the OAuth token. If the connection requires re-authorization after an update, the deploy will warn you:
|
|
377
374
|
>
|
|
378
375
|
> ```bash
|
|
376
|
+
> tailor-sdk authconnection authorize --name <connection-name>
|
|
377
|
+
> # Or via the Console:
|
|
379
378
|
> tailor-sdk authconnection open
|
|
380
379
|
> ```
|
|
381
|
-
>
|
|
382
|
-
> The `connections` field in `defineAuth()` and the `authconnection authorize` flow are documented below for reference.
|
|
383
380
|
|
|
384
381
|
### Setup Flow
|
|
385
382
|
|
|
@@ -432,13 +429,6 @@ The authorize command opens a browser for the OAuth2 flow. The authorization cod
|
|
|
432
429
|
| `authUrl` | `string` | No | Override for the authorization endpoint. |
|
|
433
430
|
| `tokenUrl` | `string` | No | Override for the token endpoint. |
|
|
434
431
|
|
|
435
|
-
### Change Detection
|
|
436
|
-
|
|
437
|
-
The SDK uses hash-based change detection for connection configs. Only connections whose configuration has changed since the last `apply` are updated (revoked and recreated). Deleting the `.tailor-sdk/` directory forces all connections to be re-sent.
|
|
438
|
-
|
|
439
|
-
> [!WARNING]
|
|
440
|
-
> The secret hash lives in `.tailor-sdk/secrets-state.json`, which is gitignored and not shared across machines or CI. When that state is missing — a clean checkout, CI, another machine, or after deleting `.tailor-sdk/` — a deploy cannot confirm the secret is unchanged, so it revokes and recreates the connection and discards the token stored by `authconnection authorize`. For shared and CI workflows, manage the connection and create its token from the Console (`tailor-sdk authconnection open`) instead.
|
|
441
|
-
|
|
442
432
|
### `auth.getConnectionToken()`
|
|
443
433
|
|
|
444
434
|
`auth.getConnectionToken()` retrieves connection tokens at runtime by calling `tailor.authconnection.getConnectionToken()` internally. When `connections` is defined in `defineAuth()`, the connection name is type-checked and autocompleted against the defined keys:
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.70.1",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"dependencies": {
|
|
142
142
|
"@0no-co/graphql.web": "1.3.2",
|
|
143
143
|
"@badgateway/oauth2-client": "3.3.1",
|
|
144
|
-
"@bufbuild/protobuf": "2.12.
|
|
144
|
+
"@bufbuild/protobuf": "2.12.1",
|
|
145
145
|
"@bufbuild/protovalidate": "1.2.0",
|
|
146
146
|
"@connectrpc/connect": "2.1.2",
|
|
147
147
|
"@connectrpc/connect-node": "2.1.2",
|
|
@@ -157,16 +157,16 @@
|
|
|
157
157
|
"@oxc-project/types": "0.137.0",
|
|
158
158
|
"@standard-schema/spec": "1.1.0",
|
|
159
159
|
"@tailor-platform/function-kysely-tailordb": "0.1.3",
|
|
160
|
-
"@toiroakr/lines-db": "0.
|
|
160
|
+
"@toiroakr/lines-db": "0.10.0",
|
|
161
161
|
"@toiroakr/read-multiline": "0.4.1",
|
|
162
|
-
"@urql/core": "6.0.
|
|
162
|
+
"@urql/core": "6.0.3",
|
|
163
163
|
"chalk": "5.6.2",
|
|
164
164
|
"chokidar": "5.0.0",
|
|
165
165
|
"confbox": "0.2.4",
|
|
166
166
|
"date-fns": "4.4.0",
|
|
167
|
-
"es-toolkit": "1.
|
|
167
|
+
"es-toolkit": "1.49.0",
|
|
168
168
|
"find-up-simple": "1.0.1",
|
|
169
|
-
"globals": "17.
|
|
169
|
+
"globals": "17.7.0",
|
|
170
170
|
"graphql": "17.0.1",
|
|
171
171
|
"inflection": "3.0.2",
|
|
172
172
|
"kysely": "0.29.2",
|
|
@@ -178,8 +178,8 @@
|
|
|
178
178
|
"pathe": "2.0.3",
|
|
179
179
|
"pgsql-ast-parser": "12.0.2",
|
|
180
180
|
"pkg-types": "2.3.1",
|
|
181
|
-
"politty": "0.
|
|
182
|
-
"rolldown": "1.1.
|
|
181
|
+
"politty": "0.10.1",
|
|
182
|
+
"rolldown": "1.1.3",
|
|
183
183
|
"semver": "7.8.5",
|
|
184
184
|
"sql-highlight": "6.1.0",
|
|
185
185
|
"std-env": "4.1.0",
|
|
@@ -199,14 +199,14 @@
|
|
|
199
199
|
"@types/semver": "7.7.1",
|
|
200
200
|
"@typescript/native-preview": "7.0.0-dev.20260621.1",
|
|
201
201
|
"@vitest/coverage-v8": "4.1.9",
|
|
202
|
-
"oxfmt": "0.
|
|
203
|
-
"oxlint": "1.
|
|
202
|
+
"oxfmt": "0.56.0",
|
|
203
|
+
"oxlint": "1.71.0",
|
|
204
204
|
"oxlint-tsgolint": "0.23.0",
|
|
205
205
|
"sonda": "0.13.1",
|
|
206
206
|
"tsdown": "0.22.3",
|
|
207
207
|
"typescript": "6.0.3",
|
|
208
208
|
"vitest": "4.1.9",
|
|
209
|
-
"zinfer": "0.2.
|
|
209
|
+
"zinfer": "0.2.3",
|
|
210
210
|
"@tailor-platform/tailor-proto": "^0.0.0"
|
|
211
211
|
},
|
|
212
212
|
"peerDependencies": {
|