@tailor-platform/sdk 2.0.0-next.5 → 2.0.0-next.6
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 +38 -0
- package/dist/{application-Bf8wxOi6.mjs → application-BJXRpQj5.mjs} +190 -1258
- package/dist/application-BJXRpQj5.mjs.map +1 -0
- package/dist/application-BV-AXawv.mjs +3 -0
- package/dist/cli/commands/deploy/deploy.d.mts +8 -3
- package/dist/cli/commands/generate/options.d.mts +0 -1
- package/dist/cli/commands/generate/service.d.mts +1 -1
- package/dist/cli/commands/staticwebsite/deploy.d.mts +19 -0
- package/dist/cli/commands/workspace/create.d.mts +3 -0
- package/dist/cli/commands/workspace/list.d.mts +1 -0
- package/dist/cli/commands/workspace/transform.d.mts +2 -0
- package/dist/cli/index.mjs +776 -1551
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +7 -3
- package/dist/cli/lib.mjs +49 -3
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/shared/config-loader.d.mts +1 -1
- package/dist/cli/shared/readonly-guard.d.mts +25 -0
- package/dist/cli/shared/tailordb-namespaces.d.mts +37 -0
- package/dist/cli/shared/workspace-name.d.mts +1 -0
- package/dist/completion/zsh-worker.zsh +15 -303
- package/dist/configure/index.mjs +7 -6
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/executor/executor.d.mts +2 -13
- package/dist/configure/services/executor/operation.d.mts +7 -2
- package/dist/configure/services/tailordb/schema.d.mts +1 -7
- package/dist/configure/services/tailordb/types.d.mts +1 -1
- package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
- package/dist/configure/types/type.d.mts +1 -9
- package/dist/{crashreport-D3RjuSYb.mjs → crashreport-0ioNRZ4K.mjs} +1 -1
- package/dist/{crashreport-Cg-pqRJV.mjs → crashreport-CxHne11E.mjs} +4 -3
- package/dist/{crashreport-Cg-pqRJV.mjs.map → crashreport-CxHne11E.mjs.map} +1 -1
- package/dist/errors-DfnF4ibq.mjs +100 -0
- package/dist/errors-DfnF4ibq.mjs.map +1 -0
- package/dist/{globals-BjhJJ2dN.mjs → globals-D-YbJKW-.mjs} +16 -10
- package/dist/globals-D-YbJKW-.mjs.map +1 -0
- package/dist/{logger-BEiZZ3qT.mjs → logger-BwS4ppwO.mjs} +3 -3
- package/dist/logger-BwS4ppwO.mjs.map +1 -0
- package/dist/parser/service/tailordb/type-source.d.mts +10 -0
- package/dist/{register-ts-hook-BhzVkej0.mjs → register-ts-hook-DL31O2W9.mjs} +2623 -1645
- package/dist/register-ts-hook-DL31O2W9.mjs.map +1 -0
- package/dist/{registry-BSbq6SPo.mjs → registry-CC3CbQiF.mjs} +3 -3
- package/dist/registry-CC3CbQiF.mjs.map +1 -0
- package/dist/runtime/field-parse.d.mts +10 -0
- package/dist/runtime/globals.d.mts +5 -2
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/workflow.d.mts +70 -10
- package/dist/runtime/workflow.mjs +1 -1
- package/dist/{schema-iCd1ugGp.mjs → schema--xYWRGfe.mjs} +42 -24
- package/dist/schema--xYWRGfe.mjs.map +1 -0
- package/dist/{secret-file-aoNXJmKa.mjs → secret-file-C3J4Gy8r.mjs} +2 -27
- package/dist/secret-file-C3J4Gy8r.mjs.map +1 -0
- package/dist/{secretmanager-Bd45j7an.mjs → secretmanager-IY4UvinW.mjs} +42 -9
- package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
- package/dist/{service-CzZEVrp9.mjs → service-CnHz9rwz.mjs} +34 -12
- package/dist/service-CnHz9rwz.mjs.map +1 -0
- package/dist/{service-DeZeYa06.mjs → service-DaeJlBoH.mjs} +3 -3
- package/dist/{service-DeZeYa06.mjs.map → service-DaeJlBoH.mjs.map} +1 -1
- package/dist/service-nU6ITOHL.mjs +3 -0
- package/dist/service_pb-BoLM0X4K.mjs +167 -0
- package/dist/service_pb-BoLM0X4K.mjs.map +1 -0
- package/dist/{service_pb-DZkfjB_6.mjs → service_pb-r1T7kpJc.mjs} +1 -1
- package/dist/types/executor.generated.d.mts +60 -42
- package/dist/user-agent-Bgsszb5I.mjs +28 -0
- package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +8 -8
- package/dist/vitest/index.mjs +591 -173
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock.d.mts +8 -8
- package/dist/vitest/mocks/aigateway.d.mts +14 -4
- package/dist/vitest/mocks/authconnection.d.mts +14 -4
- package/dist/vitest/mocks/file.d.mts +23 -6
- package/dist/vitest/mocks/iconv.d.mts +28 -4
- package/dist/vitest/mocks/idp.d.mts +25 -9
- package/dist/vitest/mocks/secretmanager.d.mts +13 -4
- package/dist/vitest/mocks/tailordb.d.mts +48 -7
- package/dist/vitest/mocks/workflow.d.mts +68 -22
- package/dist/vitest/setup.mjs +2 -2
- package/dist/workflow-9kHGKxF2.mjs +64 -0
- package/dist/workflow-9kHGKxF2.mjs.map +1 -0
- package/dist/{service_pb-Bk7dL-yT.mjs → workspace_resource_pb-Db3fv68L.mjs} +47 -165
- package/dist/workspace_resource_pb-Db3fv68L.mjs.map +1 -0
- package/docs/cli/application.md +61 -15
- package/docs/cli/tailordb.md +8 -140
- package/docs/cli/workspace.md +6 -4
- package/docs/cli-reference.md +11 -8
- package/docs/github-actions.md +8 -0
- package/docs/migration/v2.md +41 -0
- package/docs/runtime.md +5 -6
- package/docs/services/executor.md +5 -0
- package/docs/services/tailordb.md +44 -0
- package/docs/services/workflow.md +2 -2
- package/docs/testing.md +105 -89
- package/package.json +2 -5
- package/dist/application-Bf8wxOi6.mjs.map +0 -1
- package/dist/application-CUkjzfij.mjs +0 -3
- package/dist/cli/erd-viewer-assets/app.js +0 -1424
- package/dist/cli/erd-viewer-assets/index.html +0 -77
- package/dist/cli/erd-viewer-assets/serve.json +0 -13
- package/dist/cli/erd-viewer-assets/styles.css +0 -1036
- package/dist/configure/types/field-runtime.d.mts +0 -16
- package/dist/errors-118wUDRr.mjs +0 -42
- package/dist/errors-118wUDRr.mjs.map +0 -1
- package/dist/globals-BjhJJ2dN.mjs.map +0 -1
- package/dist/logger-BEiZZ3qT.mjs.map +0 -1
- package/dist/register-ts-hook-BhzVkej0.mjs.map +0 -1
- package/dist/registry-BSbq6SPo.mjs.map +0 -1
- package/dist/resource_pb-BRv7AMXK.mjs +0 -49
- package/dist/resource_pb-BRv7AMXK.mjs.map +0 -1
- package/dist/schema-iCd1ugGp.mjs.map +0 -1
- package/dist/secret-file-aoNXJmKa.mjs.map +0 -1
- package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
- package/dist/service-BT0GPd01.mjs +0 -3
- package/dist/service-CzZEVrp9.mjs.map +0 -1
- package/dist/service_pb-Bk7dL-yT.mjs.map +0 -1
- package/dist/workflow-GNuSnsTx.mjs +0 -22
- package/dist/workflow-GNuSnsTx.mjs.map +0 -1
package/docs/cli/application.md
CHANGED
|
@@ -38,10 +38,9 @@ tailor generate [options]
|
|
|
38
38
|
|
|
39
39
|
**Options**
|
|
40
40
|
|
|
41
|
-
| Option | Alias | Description
|
|
42
|
-
| ------------------- | ----- |
|
|
43
|
-
| `--config <CONFIG>` | `-c` | Path to SDK config file
|
|
44
|
-
| `--watch` | `-W` | Watch for type/resolver changes and regenerate | No | `false` |
|
|
41
|
+
| Option | Alias | Description | Required | Default |
|
|
42
|
+
| ------------------- | ----- | ----------------------- | -------- | -------------------- |
|
|
43
|
+
| `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` |
|
|
45
44
|
|
|
46
45
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
47
46
|
|
|
@@ -57,19 +56,66 @@ tailor deploy [options]
|
|
|
57
56
|
|
|
58
57
|
**Options**
|
|
59
58
|
|
|
60
|
-
| Option
|
|
61
|
-
|
|
|
62
|
-
| `--workspace-id <WORKSPACE_ID>`
|
|
63
|
-
| `--profile <PROFILE>`
|
|
64
|
-
| `--config <CONFIG>`
|
|
65
|
-
| `--yes`
|
|
66
|
-
| `--
|
|
67
|
-
| `--
|
|
68
|
-
| `--
|
|
69
|
-
| `--
|
|
70
|
-
| `--
|
|
59
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
60
|
+
| --------------------------------------- | ----- | ------------------------------------------------------------------------------------ | -------- | -------------------- | --------------------------------- |
|
|
61
|
+
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
|
|
62
|
+
| `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
63
|
+
| `--config <CONFIG>` | `-c` | Path to SDK config file. Use comma-separated paths to deploy multiple apps together. | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
|
|
64
|
+
| `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
|
|
65
|
+
| `--create-workspace` | - | Create a workspace when the account has none | No | - | - |
|
|
66
|
+
| `--workspace-name <WORKSPACE_NAME>` | - | Name for a workspace created during deploy | No | - | - |
|
|
67
|
+
| `--workspace-region <WORKSPACE_REGION>` | - | Region for a workspace created during deploy | No | - | - |
|
|
68
|
+
| `--organization-id <ORGANIZATION_ID>` | - | Organization ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
|
|
69
|
+
| `--folder-id <FOLDER_ID>` | - | Folder ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
|
|
70
|
+
| `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
|
|
71
|
+
| `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - | - |
|
|
72
|
+
| `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
|
|
73
|
+
| `--no-cache` | - | Disable bundle caching for this run | No | - | - |
|
|
74
|
+
| `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
|
|
71
75
|
|
|
72
76
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
77
|
+
**Workspace Selection:**
|
|
78
|
+
|
|
79
|
+
After validating the configuration file, `deploy` resolves a workspace before bundling the
|
|
80
|
+
application. Explicit configuration takes precedence in this order: `--workspace-id`,
|
|
81
|
+
`TAILOR_PLATFORM_WORKSPACE_ID`, and the selected profile. Otherwise, `deploy` reuses the workspace
|
|
82
|
+
previously selected for that configuration from project-local state. Each config file keeps an
|
|
83
|
+
independent selection, including when multiple configs share a directory. An explicit workspace also
|
|
84
|
+
updates this selection. Saved selections are verified against the workspaces currently visible to
|
|
85
|
+
the authenticated user before reuse, and `deploy` warns when it uses one.
|
|
86
|
+
|
|
87
|
+
When the project has no saved selection, `deploy` discovers the account's workspaces:
|
|
88
|
+
|
|
89
|
+
- One or more workspaces open a selection prompt in an interactive terminal, with an option to
|
|
90
|
+
create a new workspace. With one workspace in non-interactive or JSON mode, it is selected
|
|
91
|
+
automatically. With multiple workspaces, pass `--workspace-id` instead.
|
|
92
|
+
- No workspaces open a guided creation flow in an interactive terminal. The flow asks for a name,
|
|
93
|
+
fetches the available regions from the Platform, and confirms before creating anything. After
|
|
94
|
+
creation, the output shows how to reuse the workspace with `--workspace-id` or
|
|
95
|
+
`TAILOR_PLATFORM_WORKSPACE_ID` from CI or another machine.
|
|
96
|
+
|
|
97
|
+
In CI and other non-interactive environments, workspace creation must be explicit:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
tailor-sdk deploy \
|
|
101
|
+
--create-workspace \
|
|
102
|
+
--workspace-name example-workspace \
|
|
103
|
+
--workspace-region us-west
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`--create-workspace` only creates when the account has no workspace. If the existing workspace
|
|
107
|
+
matches the requested name, region, organization, and folder, `deploy` reuses it so the same command
|
|
108
|
+
is safe to rerun. If multiple workspaces exist, the flag never creates another one or guesses which
|
|
109
|
+
workspace to use. `--yes` skips deployment confirmation but does not authorize workspace creation.
|
|
110
|
+
|
|
111
|
+
If a saved workspace has been deleted or is no longer accessible, interactive terminals return to
|
|
112
|
+
workspace selection. Non-interactive environments stop with `WORKSPACE_CONTEXT_STALE` instead of
|
|
113
|
+
silently switching to another workspace. Automatically selected targets are printed with their
|
|
114
|
+
region, organization, and workspace ID.
|
|
115
|
+
|
|
116
|
+
`--dry-run` never creates a workspace or writes project context. When an account has no workspace,
|
|
117
|
+
create one explicitly before requesting a deployment plan.
|
|
118
|
+
|
|
73
119
|
**Config File Modification:**
|
|
74
120
|
|
|
75
121
|
On first run, `deploy` automatically injects a stable `id: "<uuid>"` field into your `defineConfig({...})` call in `tailor.config.ts`. This UUID is used to track your application across renames so the SDK can recognize ownership across renames. Commit the generated id to version control. See [Configuration](../configuration.md#application-settings) for details.
|
package/docs/cli/tailordb.md
CHANGED
|
@@ -16,11 +16,10 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
16
16
|
|
|
17
17
|
**Commands**
|
|
18
18
|
|
|
19
|
-
| Command | Description
|
|
20
|
-
| ------------------------------------------- |
|
|
21
|
-
| [`tailordb truncate`](#tailordb-truncate) | Truncate (delete all records from) TailorDB tables.
|
|
22
|
-
| [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations.
|
|
23
|
-
| [`tailordb erd`](#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
|
|
19
|
+
| Command | Description |
|
|
20
|
+
| ------------------------------------------- | --------------------------------------------------- |
|
|
21
|
+
| [`tailordb truncate`](#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
|
|
22
|
+
| [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations. |
|
|
24
23
|
|
|
25
24
|
### tailordb truncate
|
|
26
25
|
|
|
@@ -232,142 +231,11 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
232
231
|
|
|
233
232
|
### tailordb erd
|
|
234
233
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
**Usage**
|
|
238
|
-
|
|
239
|
-
```
|
|
240
|
-
tailor tailordb erd <command>
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
244
|
-
|
|
245
|
-
**Commands**
|
|
246
|
-
|
|
247
|
-
| Command | Description |
|
|
248
|
-
| --------------------------------------------- | ----------------------------------------------------------------- |
|
|
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. |
|
|
251
|
-
| [`tailordb erd serve`](#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
|
|
252
|
-
| [`tailordb erd deploy`](#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
|
|
253
|
-
|
|
254
|
-
#### tailordb erd export
|
|
255
|
-
|
|
256
|
-
Export TailorDB ERD static viewer from local TailorDB schema.
|
|
257
|
-
|
|
258
|
-
**Usage**
|
|
259
|
-
|
|
260
|
-
```
|
|
261
|
-
tailor tailordb erd export [options]
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
**Options**
|
|
265
|
-
|
|
266
|
-
| Option | Alias | Description | Required | Default | Env |
|
|
267
|
-
| ------------------------- | ----- | ---------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
|
|
268
|
-
| `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
|
|
269
|
-
| `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (optional if only one namespace is defined in config) | No | - | - |
|
|
270
|
-
| `--output <OUTPUT>` | `-o` | Output directory path for TailorDB ERD viewer files (writes to `<outputDir>/<namespace>/dist`) | No | `".tailor/erd"` | - |
|
|
271
|
-
|
|
272
|
-
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
273
|
-
|
|
274
|
-
#### tailordb erd diff
|
|
275
|
-
|
|
276
|
-
Render TailorDB ERD schema diff HTML from exported ERD viewers.
|
|
277
|
-
|
|
278
|
-
**Usage**
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
tailor 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
|
-
|
|
296
|
-
#### tailordb erd serve
|
|
297
|
-
|
|
298
|
-
Generate and serve TailorDB ERD locally with watch reload. (beta)
|
|
299
|
-
|
|
300
|
-
**Usage**
|
|
301
|
-
|
|
302
|
-
```
|
|
303
|
-
tailor tailordb erd serve [options]
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
**Options**
|
|
307
|
-
|
|
308
|
-
| Option | Alias | Description | Required | Default | Env |
|
|
309
|
-
| ------------------------- | ----- | ------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
|
|
310
|
-
| `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
|
|
311
|
-
| `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (uses first namespace in config if not specified) | No | - | - |
|
|
312
|
-
| `--port <PORT>` | - | Local server port (0 selects a free port) | No | `0` | - |
|
|
313
|
-
| `--open` | - | Open the ERD viewer in the default browser | No | `false` | - |
|
|
314
|
-
|
|
315
|
-
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
316
|
-
|
|
317
|
-
#### tailordb erd deploy
|
|
318
|
-
|
|
319
|
-
Deploy ERD static website for TailorDB namespace(s).
|
|
320
|
-
|
|
321
|
-
**Usage**
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
tailor tailordb erd deploy [options]
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
**Options**
|
|
328
|
-
|
|
329
|
-
| Option | Alias | Description | Required | Default | Env |
|
|
330
|
-
| ------------------------------- | ----- | ----------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
|
|
331
|
-
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
|
|
332
|
-
| `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
333
|
-
| `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
|
|
334
|
-
| `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (optional - deploys all namespaces with erdSite if omitted) | No | - | - |
|
|
335
|
-
|
|
336
|
-
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
337
|
-
|
|
338
|
-
**Notes:**
|
|
339
|
-
|
|
340
|
-
- ERD commands build from the local TailorDB schema, including plugin-generated TailorDB types.
|
|
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.
|
|
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.
|
|
344
|
-
- `tailordb erd deploy` still requires `erdSite` in `tailor.config.ts` because it uploads the generated viewer to a configured Static Website.
|
|
345
|
-
|
|
346
|
-
**Usage Examples:**
|
|
234
|
+
The `tailordb erd` commands (export, diff, serve, deploy) are provided by the `@tailor-platform/sdk-tailordb-erd-plugin` CLI plugin. Install it next to the SDK and keep running `tailor tailordb erd <command>` as before:
|
|
347
235
|
|
|
348
236
|
```bash
|
|
349
|
-
|
|
350
|
-
tailor tailordb erd
|
|
351
|
-
|
|
352
|
-
# Deploy ERD for a specific namespace
|
|
353
|
-
tailor tailordb erd deploy --namespace myNamespace
|
|
354
|
-
|
|
355
|
-
# Deploy ERD with JSON output
|
|
356
|
-
tailor tailordb erd deploy --json
|
|
237
|
+
npm install -D @tailor-platform/sdk-tailordb-erd-plugin@next
|
|
238
|
+
tailor tailordb erd export --namespace myNamespace
|
|
357
239
|
```
|
|
358
240
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
- This command is a beta feature and may introduce breaking changes in future releases
|
|
362
|
-
- Requires `erdSite` to be configured in `tailor.config.ts` for each namespace you want to deploy
|
|
363
|
-
- Example config:
|
|
364
|
-
```typescript
|
|
365
|
-
export default defineConfig({
|
|
366
|
-
db: {
|
|
367
|
-
myNamespace: {
|
|
368
|
-
// ... table definitions
|
|
369
|
-
erdSite: "my-erd-site-name",
|
|
370
|
-
},
|
|
371
|
-
},
|
|
372
|
-
});
|
|
373
|
-
```
|
|
241
|
+
See the plugin's README for the full command reference.
|
package/docs/cli/workspace.md
CHANGED
|
@@ -106,6 +106,7 @@ tailor workspace create [options]
|
|
|
106
106
|
| `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID to workspace associate with | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
|
|
107
107
|
| `--folder-id <FOLDER_ID>` | `-f` | Folder ID to workspace associate with | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
|
|
108
108
|
| `--profile-name <PROFILE_NAME>` | `-p` | Profile name to create | No | - | - |
|
|
109
|
+
| `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
109
110
|
| `--profile-user <PROFILE_USER>` | - | User email address or machine user client ID for the profile (defaults to current user) | No | - | - |
|
|
110
111
|
| `--permission <PERMISSION>` | - | Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
|
|
111
112
|
|
|
@@ -161,10 +162,11 @@ tailor workspace list [options]
|
|
|
161
162
|
|
|
162
163
|
**Options**
|
|
163
164
|
|
|
164
|
-
| Option
|
|
165
|
-
|
|
|
166
|
-
| `--order <ORDER>`
|
|
167
|
-
| `--limit <LIMIT>`
|
|
165
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
166
|
+
| --------------------- | ----- | ---------------------------------------------------------------- | -------- | -------- | ------------------------- |
|
|
167
|
+
| `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` | - |
|
|
168
|
+
| `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - | - |
|
|
169
|
+
| `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
168
170
|
|
|
169
171
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
170
172
|
|
package/docs/cli-reference.md
CHANGED
|
@@ -28,8 +28,11 @@ human-readable text or empty stdout.
|
|
|
28
28
|
Commands that only perform side effects and do not define a structured result may leave stdout empty
|
|
29
29
|
even when `--json` is passed.
|
|
30
30
|
|
|
31
|
-
Errors, warnings, progress, and diagnostic messages are written to stderr.
|
|
32
|
-
|
|
31
|
+
Errors, warnings, progress, and diagnostic messages are written to stderr. After argument parsing,
|
|
32
|
+
a command failure under `--json` emits a JSON error envelope to stderr. CLI errors include a stable
|
|
33
|
+
`error.code` and may include structured `error.next` and `error.context` fields for automated
|
|
34
|
+
recovery. Diagnostic lines may precede the error envelope, and stdout is not guaranteed to contain
|
|
35
|
+
an error object.
|
|
33
36
|
|
|
34
37
|
## Common Options
|
|
35
38
|
|
|
@@ -117,7 +120,9 @@ tailor hello world --loud
|
|
|
117
120
|
```
|
|
118
121
|
|
|
119
122
|
This also works under a built-in command group. The command path is joined with hyphens, so a plugin
|
|
120
|
-
nested under `tailordb` is named `tailor-tailordb-erd
|
|
123
|
+
nested under `tailordb` is named `tailor-tailordb-erd`. This is how the
|
|
124
|
+
`@tailor-platform/sdk-tailordb-erd-plugin`
|
|
125
|
+
package provides the `tailordb erd` commands:
|
|
121
126
|
|
|
122
127
|
```bash
|
|
123
128
|
# Runs `tailor-tailordb-erd` with: export
|
|
@@ -133,6 +138,9 @@ Resolution rules:
|
|
|
133
138
|
- **Lookup order:** the project's `node_modules/.bin` (nearest first, walking up from the current
|
|
134
139
|
directory), then your `PATH`. So a plugin installed as a project dev-dependency takes precedence over a
|
|
135
140
|
globally installed one.
|
|
141
|
+
- **Place global flags after the plugin command.** Only the arguments following the plugin name are
|
|
142
|
+
forwarded; a global flag placed before it (e.g. `tailor --json tailordb erd export`) is consumed by
|
|
143
|
+
the host CLI and does not reach the plugin. Write `tailor tailordb erd export --json` instead.
|
|
136
144
|
|
|
137
145
|
Because resolution is based on `node_modules/.bin` and `PATH`, any package manager that populates
|
|
138
146
|
`node_modules/.bin` works for project-local plugins — npm, pnpm (its content-addressable store is
|
|
@@ -195,11 +203,6 @@ Commands for managing TailorDB tables, data, and schema migrations.
|
|
|
195
203
|
| [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
|
|
196
204
|
| [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
|
|
197
205
|
| [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
|
|
198
|
-
| [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
|
|
199
|
-
| [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
|
|
200
|
-
| [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
|
|
201
|
-
| [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
|
|
202
|
-
| [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
|
|
203
206
|
|
|
204
207
|
### [Query Commands](./cli/query.md)
|
|
205
208
|
|
package/docs/github-actions.md
CHANGED
|
@@ -72,6 +72,14 @@ to pull requests:
|
|
|
72
72
|
tailor setup -n my-app-stg --erd-preview
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
The generated workflow runs `tailor tailordb erd`, which is provided by the
|
|
76
|
+
`@tailor-platform/sdk-tailordb-erd-plugin` CLI plugin — install it as a
|
|
77
|
+
dev-dependency in your project:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install -D @tailor-platform/sdk-tailordb-erd-plugin@next
|
|
81
|
+
```
|
|
82
|
+
|
|
75
83
|
The generated workflow builds one self-contained ERD viewer HTML file for each
|
|
76
84
|
owned TailorDB namespace in `tailor.config.ts`. The viewer compares the pull
|
|
77
85
|
request merge result with the base branch, can switch between the current schema
|
package/docs/migration/v2.md
CHANGED
|
@@ -1031,6 +1031,47 @@ Migration steps for each `.hooks()` call on a `db.type()`:
|
|
|
1031
1031
|
|
|
1032
1032
|
</details>
|
|
1033
1033
|
|
|
1034
|
+
## generate --watch flag removed
|
|
1035
|
+
|
|
1036
|
+
**Migration:** Manual
|
|
1037
|
+
|
|
1038
|
+
Review and remove `tailor generate --watch` / `-W` invocations and the `watch` option on `GenerateOptions`. The flag, its dependency watcher, and the self-restart-on-change logic are removed; `generate` now always performs a single generation pass.
|
|
1039
|
+
|
|
1040
|
+
The --watch/-W flag no longer exists; re-run generate after each change:
|
|
1041
|
+
|
|
1042
|
+
Before:
|
|
1043
|
+
|
|
1044
|
+
```sh
|
|
1045
|
+
tailor generate --watch
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
After:
|
|
1049
|
+
|
|
1050
|
+
```sh
|
|
1051
|
+
tailor generate
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
<details>
|
|
1055
|
+
<summary>Prompt for an AI agent (to perform this migration)</summary>
|
|
1056
|
+
|
|
1057
|
+
```text
|
|
1058
|
+
Tailor SDK v2 removes the `generate --watch` (`-W`) flag along with the
|
|
1059
|
+
dependency watcher and self-restart logic that powered it. `tailor generate`
|
|
1060
|
+
now always runs a single generation pass and exits.
|
|
1061
|
+
|
|
1062
|
+
For each flagged `tailor generate ... --watch` / `-W` invocation (package.json
|
|
1063
|
+
scripts, shell scripts, CI configs, or docs), drop the flag and re-run
|
|
1064
|
+
`tailor generate` after each change instead. If automatic regeneration on file
|
|
1065
|
+
change is still needed, wrap the command with a general-purpose file watcher
|
|
1066
|
+
(e.g. `chokidar-cli`, `nodemon`) at the project level.
|
|
1067
|
+
|
|
1068
|
+
For programmatic use of `generate()` from `@tailor-platform/sdk/cli`, remove the
|
|
1069
|
+
`watch` field from the `GenerateOptions` argument — the function now performs a
|
|
1070
|
+
single generation pass and resolves once it completes.
|
|
1071
|
+
```
|
|
1072
|
+
|
|
1073
|
+
</details>
|
|
1074
|
+
|
|
1034
1075
|
## Behavioral changes (no migration required)
|
|
1035
1076
|
|
|
1036
1077
|
These v2 changes alter runtime or CLI behavior; no source change is needed.
|
package/docs/runtime.md
CHANGED
|
@@ -31,7 +31,7 @@ const token = await authconnection.getConnectionToken("google");
|
|
|
31
31
|
const client = new idp.Client({ namespace: "my-namespace" });
|
|
32
32
|
const { users } = await client.users({ first: 10 });
|
|
33
33
|
|
|
34
|
-
const executionId = await workflow.
|
|
34
|
+
const executionId = await workflow.startWorkflow("approval", { reportId });
|
|
35
35
|
|
|
36
36
|
const invoker = context.getInvoker();
|
|
37
37
|
|
|
@@ -81,7 +81,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
|
|
|
81
81
|
- `secretmanager` — secret-vault access (`getSecret`, `getSecrets`)
|
|
82
82
|
- `authconnection` — OAuth-style connection tokens (`getConnectionToken`)
|
|
83
83
|
- `idp` — IdP user management (`new Client({ namespace })`)
|
|
84
|
-
- `workflow` — workflow & job control (`
|
|
84
|
+
- `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `startJobFunction`, `wait`, `resolve`; the pre-alignment names `triggerWorkflow`, `resumeWorkflow`, `triggerJobFunction` are kept as frozen aliases)
|
|
85
85
|
- `context` — execution context (`getInvoker`)
|
|
86
86
|
- `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`)
|
|
87
87
|
- `aigateway` — AI Gateway URL resolution (`get`)
|
|
@@ -97,17 +97,16 @@ import { expect, test } from "vitest";
|
|
|
97
97
|
|
|
98
98
|
test("encodes via iconv", () => {
|
|
99
99
|
using iconvM = mockIconv();
|
|
100
|
-
iconvM.
|
|
100
|
+
iconvM.convert.mockReturnValue(new Uint8Array([0x82, 0xa0]));
|
|
101
101
|
|
|
102
102
|
const out = iconv.convert("あ", "UTF-8", "Shift_JIS");
|
|
103
103
|
|
|
104
104
|
expect(out).toEqual(new Uint8Array([0x82, 0xa0]));
|
|
105
|
-
expect(iconvM.
|
|
105
|
+
expect(iconvM.convert).toHaveBeenCalledWith("あ", "UTF-8", "Shift_JIS");
|
|
106
106
|
}); // iconvM disposed here — the iconv mock is removed (previous state restored)
|
|
107
107
|
|
|
108
108
|
test("reads from a vault", async () => {
|
|
109
|
-
using sm = mockSecretmanager();
|
|
110
|
-
sm.setSecrets({ "my-vault": { API_KEY: "sk-123" } });
|
|
109
|
+
using sm = mockSecretmanager({ secrets: { "my-vault": { API_KEY: "sk-123" } } });
|
|
111
110
|
|
|
112
111
|
await expect(secretmanager.getSecret("my-vault", "API_KEY")).resolves.toBe("sk-123");
|
|
113
112
|
});
|
|
@@ -329,6 +329,11 @@ createExecutor({
|
|
|
329
329
|
});
|
|
330
330
|
```
|
|
331
331
|
|
|
332
|
+
`args` must match the workflow's main job input. It is required when that input is required
|
|
333
|
+
and can be omitted when the workflow has no input. Static arguments can be JSON-compatible
|
|
334
|
+
primitives, arrays, or plain objects; top-level `null` is not supported. An argument callback
|
|
335
|
+
must return the same input type.
|
|
336
|
+
|
|
332
337
|
### Authentication for Operations
|
|
333
338
|
|
|
334
339
|
GraphQL and Workflow operations can specify an `invoker` to execute with machine user credentials. Pass the machine user name as a plain string — it is type-narrowed to the names defined in your auth config:
|
|
@@ -555,6 +555,48 @@ db.table("User", {
|
|
|
555
555
|
});
|
|
556
556
|
```
|
|
557
557
|
|
|
558
|
+
#### GraphQL Operations
|
|
559
|
+
|
|
560
|
+
Control which GraphQL operations (`create`, `update`, `delete`, `read`) are exposed for a type. All operations are enabled by default.
|
|
561
|
+
|
|
562
|
+
```typescript
|
|
563
|
+
db.type("Order", {
|
|
564
|
+
status: db.string(),
|
|
565
|
+
}).features({
|
|
566
|
+
gqlOperations: {
|
|
567
|
+
delete: false, // Disable the delete mutation
|
|
568
|
+
},
|
|
569
|
+
});
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
Use the `"query"` alias to disable all mutations at once (read-only type: `create`/`update`/`delete` false, `read` true):
|
|
573
|
+
|
|
574
|
+
```typescript
|
|
575
|
+
db.type("AuditLog", {
|
|
576
|
+
action: db.string(),
|
|
577
|
+
}).features({
|
|
578
|
+
gqlOperations: "query",
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
**Namespace-level default**
|
|
583
|
+
|
|
584
|
+
Set a default for every type in a TailorDB namespace in `tailor.config.ts`. A type's own `.features({ gqlOperations })` always takes precedence over this default.
|
|
585
|
+
|
|
586
|
+
```typescript
|
|
587
|
+
// tailor.config.ts
|
|
588
|
+
export default defineConfig({
|
|
589
|
+
db: {
|
|
590
|
+
tailordb: {
|
|
591
|
+
files: ["./tailordb/*.ts"],
|
|
592
|
+
gqlOperations: { delete: false }, // Default for every type in this namespace
|
|
593
|
+
},
|
|
594
|
+
},
|
|
595
|
+
});
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
This default is re-evaluated on every `tailor-sdk deploy`, so changing it also updates types that already exist on the platform, not only newly created ones.
|
|
599
|
+
|
|
558
600
|
### Field Extraction (`pickFields` / `omitFields`)
|
|
559
601
|
|
|
560
602
|
Extract subsets of fields from a `TailorDBType` for reuse in resolvers, executors, seed schemas, etc.
|
|
@@ -635,6 +677,8 @@ Configure Permission and GQLPermission. For details, see the [TailorDB Permissio
|
|
|
635
677
|
|
|
636
678
|
**Important**: Following the secure-by-default principle, all operations are denied if permissions are not configured. You must explicitly grant permissions for each operation (create, read, update, delete).
|
|
637
679
|
|
|
680
|
+
`generate`/`deploy` reject a type that has no `.permission()`, or no `.gqlPermission()` while GraphQL operations are enabled for it (see [GraphQL Operations](#graphql-operations) above). Disable GraphQL exposure entirely with `.features({ gqlOperations: { create: false, update: false, delete: false, read: false } })` if a type only needs record-level permission.
|
|
681
|
+
|
|
638
682
|
```typescript
|
|
639
683
|
db.table("User", {
|
|
640
684
|
name: db.string(),
|
|
@@ -401,7 +401,7 @@ An exact-key policy applies to dispatches whose runtime key equals the policy ke
|
|
|
401
401
|
|
|
402
402
|
### Referencing a Policy from a Workflow
|
|
403
403
|
|
|
404
|
-
Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.
|
|
404
|
+
Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.startJobFunction()` (or its frozen alias `triggerJobFunction`). For exact-key policies, use `<policy>.key` directly — it's typed so only a value that came from a declared policy can be passed. For wildcard policies (`matchType: "prefix"`), there is no `<policy>.key` — call `<policy>.keyFor(suffix)` to build the concrete key. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator` — the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group), or a `def` field on a single `defineWorkflowExecutionPolicy`.
|
|
405
405
|
|
|
406
406
|
```typescript
|
|
407
407
|
import { createWorkflowJob } from "@tailor-platform/sdk";
|
|
@@ -427,7 +427,7 @@ export const mainJob = createWorkflowJob({
|
|
|
427
427
|
});
|
|
428
428
|
```
|
|
429
429
|
|
|
430
|
-
The same `executionPolicyKey` option is available on `tailor.workflow.
|
|
430
|
+
The same `executionPolicyKey` option is available on `tailor.workflow.startJobFunction(name, args, options)` (or the frozen alias `tailor.workflow.triggerJobFunction`) for jobs invoked by name.
|
|
431
431
|
|
|
432
432
|
## Triggering a Workflow from a Resolver
|
|
433
433
|
|