@tailor-platform/sdk 1.76.2 → 1.79.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 +38 -0
- package/dist/application-BB6BlUfk.mjs +3 -0
- package/dist/{application-CqjCcZ2n.mjs → application-fjqb-Gh8.mjs} +57 -10
- package/dist/application-fjqb-Gh8.mjs.map +1 -0
- package/dist/cli/commands/deploy/deploy.d.mts +8 -3
- package/dist/cli/commands/show.d.mts +9 -3
- 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 +47 -22
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +2 -2
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/shared/workspace-name.d.mts +1 -0
- package/dist/cli/skills.mjs +1 -1
- package/dist/completion/zsh-worker.zsh +18 -1
- package/dist/configure/index.mjs +202 -7
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/idp/index.d.mts +1 -4
- package/dist/configure/services/tailordb/schema.d.mts +1 -7
- package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
- package/dist/configure/types/type.d.mts +1 -9
- package/dist/{crashreport-DZDr-TvH.mjs → crashreport-BNWUM6Kf.mjs} +2 -2
- package/dist/{crashreport-DZDr-TvH.mjs.map → crashreport-BNWUM6Kf.mjs.map} +1 -1
- package/dist/{crashreport-np4-_DX2.mjs → crashreport-BafWvjjX.mjs} +1 -1
- package/dist/errors-DVFS0AZk.mjs +100 -0
- package/dist/errors-DVFS0AZk.mjs.map +1 -0
- package/dist/{globals-z6zYMjlr.mjs → globals-B-n_3uYu.mjs} +11 -5
- package/dist/globals-B-n_3uYu.mjs.map +1 -0
- package/dist/{logger-BEiZZ3qT.mjs → logger-BwS4ppwO.mjs} +3 -3
- package/dist/logger-BwS4ppwO.mjs.map +1 -0
- package/dist/{registry-CTgoVWc_.mjs → registry-CXi7rJq7.mjs} +4 -3
- package/dist/registry-CXi7rJq7.mjs.map +1 -0
- package/dist/runtime/field-parse.d.mts +11 -0
- package/dist/runtime/globals.d.mts +4 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/workflow.d.mts +79 -15
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{runtime-DlklyuHN.mjs → runtime-CjMeYuPA.mjs} +1169 -539
- package/dist/runtime-CjMeYuPA.mjs.map +1 -0
- package/dist/{schema-DbTR1c6M.mjs → schema-CYrle8JZ.mjs} +222 -4
- package/dist/schema-CYrle8JZ.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-CghpdV-9.mjs +3 -0
- package/dist/{service-DBFZQloR.mjs → service-Cp0I7ZFe.mjs} +3 -3
- package/dist/{service-DBFZQloR.mjs.map → service-Cp0I7ZFe.mjs.map} +1 -1
- package/dist/{service-BCRJ-3NV.mjs → service-D12iQGcS.mjs} +2 -2
- package/dist/{service-BCRJ-3NV.mjs.map → service-D12iQGcS.mjs.map} +1 -1
- package/dist/{test-env-key-IPapa1KJ.mjs → test-env-key-DuZycyWM.mjs} +2 -2
- package/dist/{test-env-key-IPapa1KJ.mjs.map → test-env-key-DuZycyWM.mjs.map} +1 -1
- package/dist/types/auth.generated.d.mts +9 -36
- package/dist/types/executor.generated.d.mts +19 -59
- package/dist/types/idp.generated.d.mts +518 -517
- package/dist/types/resolver.generated.d.mts +6 -2
- package/dist/types/tailordb.generated.d.mts +8 -7
- package/dist/utils/test/index.mjs +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +8 -8
- package/dist/vitest/index.mjs +635 -195
- 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 +24 -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-CkIDJpdg.mjs +69 -0
- package/dist/workflow-CkIDJpdg.mjs.map +1 -0
- package/docs/cli/application.md +58 -11
- package/docs/cli/setup.md +1 -1
- package/docs/cli/workspace.md +6 -4
- package/docs/cli-reference.md +12 -8
- package/docs/runtime.md +5 -6
- package/docs/services/aigateway.md +2 -0
- package/docs/services/tailordb.md +44 -0
- package/docs/services/workflow.md +3 -3
- package/docs/testing.md +105 -91
- package/package.json +7 -7
- package/dist/application-6zsDLGKv.mjs +0 -3
- package/dist/application-CqjCcZ2n.mjs.map +0 -1
- package/dist/configure/types/field-runtime.d.mts +0 -17
- package/dist/errors-Dtf2WPaW.mjs +0 -42
- package/dist/errors-Dtf2WPaW.mjs.map +0 -1
- package/dist/field-runtime-D4QWRiB1.mjs +0 -203
- package/dist/field-runtime-D4QWRiB1.mjs.map +0 -1
- package/dist/globals-z6zYMjlr.mjs.map +0 -1
- package/dist/logger-BEiZZ3qT.mjs.map +0 -1
- package/dist/registry-CTgoVWc_.mjs.map +0 -1
- package/dist/runtime-DlklyuHN.mjs.map +0 -1
- package/dist/schema-DbTR1c6M.mjs.map +0 -1
- package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
- package/dist/service-CPMlIg3X.mjs +0 -3
- package/dist/types-BzJ7A_fn.mjs +0 -199
- package/dist/types-BzJ7A_fn.mjs.map +0 -1
- package/dist/types-CG9H7HuE.mjs +0 -4
- package/dist/workflow-DSwnYPPP.mjs +0 -45
- package/dist/workflow-DSwnYPPP.mjs.map +0 -1
package/docs/cli/application.md
CHANGED
|
@@ -59,19 +59,66 @@ tailor-sdk deploy [options]
|
|
|
59
59
|
|
|
60
60
|
**Options**
|
|
61
61
|
|
|
62
|
-
| Option
|
|
63
|
-
|
|
|
64
|
-
| `--workspace-id <WORKSPACE_ID>`
|
|
65
|
-
| `--profile <PROFILE>`
|
|
66
|
-
| `--config <CONFIG>`
|
|
67
|
-
| `--yes`
|
|
68
|
-
| `--
|
|
69
|
-
| `--
|
|
70
|
-
| `--
|
|
71
|
-
| `--
|
|
72
|
-
| `--
|
|
62
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
63
|
+
| --------------------------------------- | ----- | ------------------------------------------------------------------------------------ | -------- | -------------------- | --------------------------------- |
|
|
64
|
+
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
|
|
65
|
+
| `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
66
|
+
| `--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` |
|
|
67
|
+
| `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
|
|
68
|
+
| `--create-workspace` | - | Create a workspace when the account has none | No | - | - |
|
|
69
|
+
| `--workspace-name <WORKSPACE_NAME>` | - | Name for a workspace created during deploy | No | - | - |
|
|
70
|
+
| `--workspace-region <WORKSPACE_REGION>` | - | Region for a workspace created during deploy | No | - | - |
|
|
71
|
+
| `--organization-id <ORGANIZATION_ID>` | - | Organization ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
|
|
72
|
+
| `--folder-id <FOLDER_ID>` | - | Folder ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
|
|
73
|
+
| `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
|
|
74
|
+
| `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - | - |
|
|
75
|
+
| `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
|
|
76
|
+
| `--no-cache` | - | Disable bundle caching for this run | No | - | - |
|
|
77
|
+
| `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
|
|
73
78
|
|
|
74
79
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
80
|
+
**Workspace Selection:**
|
|
81
|
+
|
|
82
|
+
After validating the configuration file, `deploy` resolves a workspace before bundling the
|
|
83
|
+
application. Explicit configuration takes precedence in this order: `--workspace-id`,
|
|
84
|
+
`TAILOR_PLATFORM_WORKSPACE_ID`, and the selected profile. Otherwise, `deploy` reuses the workspace
|
|
85
|
+
previously selected for that configuration from project-local state. Each config file keeps an
|
|
86
|
+
independent selection, including when multiple configs share a directory. An explicit workspace also
|
|
87
|
+
updates this selection. Saved selections are verified against the workspaces currently visible to
|
|
88
|
+
the authenticated user before reuse, and `deploy` warns when it uses one.
|
|
89
|
+
|
|
90
|
+
When the project has no saved selection, `deploy` discovers the account's workspaces:
|
|
91
|
+
|
|
92
|
+
- One or more workspaces open a selection prompt in an interactive terminal, with an option to
|
|
93
|
+
create a new workspace. With one workspace in non-interactive or JSON mode, it is selected
|
|
94
|
+
automatically. With multiple workspaces, pass `--workspace-id` instead.
|
|
95
|
+
- No workspaces open a guided creation flow in an interactive terminal. The flow asks for a name,
|
|
96
|
+
fetches the available regions from the Platform, and confirms before creating anything. After
|
|
97
|
+
creation, the output shows how to reuse the workspace with `--workspace-id` or
|
|
98
|
+
`TAILOR_PLATFORM_WORKSPACE_ID` from CI or another machine.
|
|
99
|
+
|
|
100
|
+
In CI and other non-interactive environments, workspace creation must be explicit:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
tailor-sdk deploy \
|
|
104
|
+
--create-workspace \
|
|
105
|
+
--workspace-name example-workspace \
|
|
106
|
+
--workspace-region us-west
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`--create-workspace` only creates when the account has no workspace. If the existing workspace
|
|
110
|
+
matches the requested name, region, organization, and folder, `deploy` reuses it so the same command
|
|
111
|
+
is safe to rerun. If multiple workspaces exist, the flag never creates another one or guesses which
|
|
112
|
+
workspace to use. `--yes` skips deployment confirmation but does not authorize workspace creation.
|
|
113
|
+
|
|
114
|
+
If a saved workspace has been deleted or is no longer accessible, interactive terminals return to
|
|
115
|
+
workspace selection. Non-interactive environments stop with `WORKSPACE_CONTEXT_STALE` instead of
|
|
116
|
+
silently switching to another workspace. Automatically selected targets are printed with their
|
|
117
|
+
region, organization, and workspace ID.
|
|
118
|
+
|
|
119
|
+
`--dry-run` never creates a workspace or writes project context. When an account has no workspace,
|
|
120
|
+
create one explicitly before requesting a deployment plan.
|
|
121
|
+
|
|
75
122
|
**Config File Modification:**
|
|
76
123
|
|
|
77
124
|
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/setup.md
CHANGED
|
@@ -174,7 +174,7 @@ tailor-sdk setup tag [options]
|
|
|
174
174
|
| Option | Alias | Description | Required | Default |
|
|
175
175
|
| ----------------------------- | ----- | ---------------------------------------------------------------------------- | -------- | ------- |
|
|
176
176
|
| `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
|
|
177
|
-
| `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (defaults to v
|
|
177
|
+
| `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (defaults to v*) | No | `"v*"` |
|
|
178
178
|
| `--branch <BRANCH>` | - | Tag-reachability guard branch (no guard when omitted) | No | - |
|
|
179
179
|
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
|
|
180
180
|
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
package/docs/cli/workspace.md
CHANGED
|
@@ -106,6 +106,7 @@ tailor-sdk 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 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-sdk 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
|
@@ -11,12 +11,13 @@ tailor-sdk <command> [options]
|
|
|
11
11
|
## Global Options
|
|
12
12
|
|
|
13
13
|
<a id="global-options"></a>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
|
17
|
-
| `--env-file
|
|
18
|
-
| `--
|
|
19
|
-
| `--
|
|
14
|
+
|
|
15
|
+
| Option | Alias | Description | Required | Default |
|
|
16
|
+
| ------------------------------------------- | ----- | --------------------------------------------------- | -------- | ------- |
|
|
17
|
+
| `--env-file <ENV_FILE>` | `-e` | Path to the environment file (error if not found) | No | - |
|
|
18
|
+
| `--env-file-if-exists <ENV_FILE_IF_EXISTS>` | - | Path to the environment file (ignored if not found) | No | - |
|
|
19
|
+
| `--verbose` | - | Enable verbose logging | No | `false` |
|
|
20
|
+
| `--json` | `-j` | Output as JSON | No | `false` |
|
|
20
21
|
|
|
21
22
|
### JSON Output
|
|
22
23
|
|
|
@@ -27,8 +28,11 @@ human-readable text or empty stdout.
|
|
|
27
28
|
Commands that only perform side effects and do not define a structured result may leave stdout empty
|
|
28
29
|
even when `--json` is passed.
|
|
29
30
|
|
|
30
|
-
Errors, warnings, progress, and diagnostic messages are written to stderr.
|
|
31
|
-
|
|
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.
|
|
32
36
|
|
|
33
37
|
## Common Options
|
|
34
38
|
|
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
|
|
|
@@ -79,7 +79,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
|
|
|
79
79
|
- `secretmanager` — secret-vault access (`getSecret`, `getSecrets`)
|
|
80
80
|
- `authconnection` — OAuth-style connection tokens (`getConnectionToken`)
|
|
81
81
|
- `idp` — IdP user management (`new Client({ namespace })`)
|
|
82
|
-
- `workflow` — workflow & job control (`
|
|
82
|
+
- `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `startJobFunction`, `wait`, `resolve`; the pre-alignment names `triggerWorkflow`, `resumeWorkflow`, `triggerJobFunction` are kept as frozen aliases)
|
|
83
83
|
- `context` — execution context (`getInvoker`)
|
|
84
84
|
- `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`, `openDownloadStream` _(deprecated)_)
|
|
85
85
|
- `aigateway` — AI Gateway URL resolution (`get`)
|
|
@@ -95,17 +95,16 @@ import { expect, test } from "vitest";
|
|
|
95
95
|
|
|
96
96
|
test("encodes via iconv", () => {
|
|
97
97
|
using iconvM = mockIconv();
|
|
98
|
-
iconvM.
|
|
98
|
+
iconvM.convert.mockReturnValue(new Uint8Array([0x82, 0xa0]));
|
|
99
99
|
|
|
100
100
|
const out = iconv.convert("あ", "UTF-8", "Shift_JIS");
|
|
101
101
|
|
|
102
102
|
expect(out).toEqual(new Uint8Array([0x82, 0xa0]));
|
|
103
|
-
expect(iconvM.
|
|
103
|
+
expect(iconvM.convert).toHaveBeenCalledWith("あ", "UTF-8", "Shift_JIS");
|
|
104
104
|
}); // iconvM disposed here — the iconv mock is removed (previous state restored)
|
|
105
105
|
|
|
106
106
|
test("reads from a vault", async () => {
|
|
107
|
-
using sm = mockSecretmanager();
|
|
108
|
-
sm.setSecrets({ "my-vault": { API_KEY: "sk-123" } });
|
|
107
|
+
using sm = mockSecretmanager({ secrets: { "my-vault": { API_KEY: "sk-123" } } });
|
|
109
108
|
|
|
110
109
|
await expect(secretmanager.getSecret("my-vault", "API_KEY")).resolves.toBe("sk-123");
|
|
111
110
|
});
|
|
@@ -111,3 +111,5 @@ const { url } = await aigateway.get("my-aigateway");
|
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
Type narrowing is provided by the generated `tailor.d.ts` (the `AIGatewayNameRegistry` interface). Run `tailor-sdk generate` (or `deploy`) after defining new AI Gateways to refresh it. Before the first generate run, `get()` accepts any string.
|
|
114
|
+
|
|
115
|
+
The same URL is also shown by `tailor-sdk show`, which lists the URL of each AI Gateway defined in `aiGateways` once it has been deployed.
|
|
@@ -550,6 +550,48 @@ db.type("User", {
|
|
|
550
550
|
});
|
|
551
551
|
```
|
|
552
552
|
|
|
553
|
+
#### GraphQL Operations
|
|
554
|
+
|
|
555
|
+
Control which GraphQL operations (`create`, `update`, `delete`, `read`) are exposed for a type. All operations are enabled by default.
|
|
556
|
+
|
|
557
|
+
```typescript
|
|
558
|
+
db.type("Order", {
|
|
559
|
+
status: db.string(),
|
|
560
|
+
}).features({
|
|
561
|
+
gqlOperations: {
|
|
562
|
+
delete: false, // Disable the delete mutation
|
|
563
|
+
},
|
|
564
|
+
});
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
Use the `"query"` alias to disable all mutations at once (read-only type: `create`/`update`/`delete` false, `read` true):
|
|
568
|
+
|
|
569
|
+
```typescript
|
|
570
|
+
db.type("AuditLog", {
|
|
571
|
+
action: db.string(),
|
|
572
|
+
}).features({
|
|
573
|
+
gqlOperations: "query",
|
|
574
|
+
});
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
**Namespace-level default**
|
|
578
|
+
|
|
579
|
+
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.
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
// tailor.config.ts
|
|
583
|
+
export default defineConfig({
|
|
584
|
+
db: {
|
|
585
|
+
tailordb: {
|
|
586
|
+
files: ["./tailordb/*.ts"],
|
|
587
|
+
gqlOperations: { delete: false }, // Default for every type in this namespace
|
|
588
|
+
},
|
|
589
|
+
},
|
|
590
|
+
});
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
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.
|
|
594
|
+
|
|
553
595
|
### Field Extraction (`pickFields` / `omitFields`)
|
|
554
596
|
|
|
555
597
|
Extract subsets of fields from a `TailorDBType` for reuse in resolvers, executors, seed schemas, etc.
|
|
@@ -630,6 +672,8 @@ Configure Permission and GQLPermission. For details, see the [TailorDB Permissio
|
|
|
630
672
|
|
|
631
673
|
**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).
|
|
632
674
|
|
|
675
|
+
`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.
|
|
676
|
+
|
|
633
677
|
```typescript
|
|
634
678
|
db.type("User", {
|
|
635
679
|
name: db.string(),
|
|
@@ -397,11 +397,11 @@ export default defineConfig({
|
|
|
397
397
|
|
|
398
398
|
`key` accepts `[a-z0-9_:.-]` and must start with `[a-z0-9]`. An exact key must also end with `[a-z0-9]`; a wildcard prefix (`matchType: "prefix"`) may end with any of those characters, since the platform appends a trailing `*` after it. The platform-registered key — including that trailing `*` when wildcarded — is 2 to 64 characters long, so a wildcard prefix must be at most 63 characters. `foo:bar` is a valid exact key; `tenant-api` with `matchType: "prefix"` registers `tenant-api*` as a wildcard prefix.
|
|
399
399
|
|
|
400
|
-
An exact-key policy applies to dispatches whose runtime key equals the policy key. A wildcard policy applies to every dispatch whose runtime key begins with the prefix; each concrete resolved key gets its own independent pool of the declared size (a `cap = 3` wildcard yields three concurrent dispatches per resolved key, not three across every match).
|
|
400
|
+
An exact-key policy applies to dispatches whose runtime key equals the policy key. A wildcard policy applies to every dispatch whose runtime key begins with the prefix; each concrete resolved key gets its own independent pool of the declared size (a `cap = 3` wildcard yields three concurrent dispatches per resolved key, not three across every match). When a dispatch matches more than one policy (for example, an exact key that also falls under a wildcard prefix, or two wildcard prefixes where one starts with the other), every matching policy's cap is enforced independently, and the tightest one blocks.
|
|
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
|
|