Skip to content

Commit 67c8b0b

Browse files
Update SDK pages (#13)
Co-authored-by: anukiransolur <3693214+anukiransolur@users.noreply.github.com>
1 parent e5808f8 commit 67c8b0b

2 files changed

Lines changed: 85 additions & 5 deletions

File tree

docs/sdk/cli/function.md

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ tailor-sdk function [command]
2828

2929
**Commands**
3030

31-
| Command | Description |
32-
| --------------------------------- | ------------------------------------ |
33-
| [`function logs`](#function-logs) | List or get function execution logs. |
31+
| Command | Description |
32+
| ----------------------------------------- | --------------------------------------------------------------- |
33+
| [`function logs`](#function-logs) | List or get function execution logs. |
34+
| [`function test-run`](#function-test-run) | Run a function on the Tailor Platform server without deploying. |
3435

3536
<!-- politty:command:function:subcommands:end -->
3637
<!-- politty:command:function logs:heading:start -->
@@ -90,3 +91,82 @@ tailor-sdk function logs <execution-id>
9091
tailor-sdk function logs --json
9192
tailor-sdk function logs <execution-id> --json
9293
```
94+
95+
<!-- politty:command:function test-run:heading:start -->
96+
97+
## function test-run
98+
99+
<!-- politty:command:function test-run:heading:end -->
100+
<!-- politty:command:function test-run:description:start -->
101+
102+
Run a function on the Tailor Platform server without deploying.
103+
104+
<!-- politty:command:function test-run:description:end -->
105+
<!-- politty:command:function test-run:usage:start -->
106+
107+
**Usage**
108+
109+
```
110+
tailor-sdk function test-run [options] <file>
111+
```
112+
113+
<!-- politty:command:function test-run:usage:end -->
114+
<!-- politty:command:function test-run:arguments:start -->
115+
116+
**Arguments**
117+
118+
| Argument | Description | Required |
119+
| -------- | ------------------------- | -------- |
120+
| `file` | Path to the function file | Yes |
121+
122+
<!-- politty:command:function test-run:arguments:end -->
123+
<!-- politty:command:function test-run:options:start -->
124+
125+
**Options**
126+
127+
| Option | Alias | Description | Required | Default |
128+
| ------------------------------- | ----- | ------------------------------------------------------------------------ | -------- | -------------------- |
129+
| `--json` | `-j` | Output as JSON | No | `false` |
130+
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - |
131+
| `--profile <PROFILE>` | `-p` | Workspace profile | No | - |
132+
| `--name <NAME>` | `-n` | Workflow job name to run (matches the `name` field of createWorkflowJob) | No | - |
133+
| `--arg <ARG>` | `-a` | JSON argument to pass to the function | No | - |
134+
| `--machine-user <MACHINE_USER>` | `-m` | Machine user name for authentication | No | - |
135+
| `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` |
136+
137+
<!-- politty:command:function test-run:options:end -->
138+
<!-- politty:command:function test-run:examples:start -->
139+
140+
**Examples**
141+
142+
**Run a resolver with input arguments**
143+
144+
```bash
145+
$ tailor-sdk function test-run resolvers/add.ts --arg '{"input":{"a":1,"b":2}}'
146+
```
147+
148+
**Run a specific workflow job by name**
149+
150+
```bash
151+
$ tailor-sdk function test-run workflows/sample.ts --name validate-order
152+
```
153+
154+
**Run a pre-bundled .js file directly**
155+
156+
```bash
157+
$ tailor-sdk function test-run .tailor-sdk/resolvers/add.js --arg '{"input":{"a":1,"b":2}}'
158+
```
159+
160+
<!-- politty:command:function test-run:examples:end -->
161+
<!-- politty:command:function test-run:notes:start -->
162+
163+
**Notes**
164+
165+
You can pass either a source file (`.ts`) or a pre-bundled file (`.js`).
166+
When a `.js` file is provided, detection and bundling are skipped and the file is executed as-is.
167+
168+
> [!WARNING]
169+
> Workflow job `.trigger()` calls do not work in test-run mode.
170+
> Triggered jobs are not executed; only the target job's `body` function runs in isolation.
171+
172+
<!-- politty:command:function test-run:notes:end -->

docs/sdk/services/auth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ body: (context) => {
139139
When you want to use machine users without defining a `userProfile`, define `machineUserAttributes` instead. These attributes are used for:
140140

141141
- type-safe `machineUsers[*].attributes`
142-
- `context.user.attributes` typing (via `user-defined.d.ts`)
142+
- `context.user.attributes` typing (via `tailor.d.ts`)
143143

144144
```typescript
145145
import { defineAuth, t } from "@tailor-platform/sdk";
@@ -158,7 +158,7 @@ export const auth = defineAuth("my-auth", {
158158
});
159159
```
160160

161-
To update types in `user-defined.d.ts`, run:
161+
To update types in `tailor.d.ts`, run:
162162

163163
```bash
164164
tailor-sdk generate

0 commit comments

Comments
 (0)