@tailor-platform/sdk 1.10.1 → 1.11.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.
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./../../user-defined.d.ts" />
2
- import { et as TailorDBType, mt as TailorField } from "../../index-CoqePlnt.mjs";
3
- import { W as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-BQw6I-mY.mjs";
2
+ import { et as TailorDBType, mt as TailorField } from "../../index-DcOTucF6.mjs";
3
+ import { W as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-DnoS_Mi4.mjs";
4
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
5
 
6
6
  //#region src/utils/test/index.d.ts
@@ -6,7 +6,7 @@ Commands for managing executors and executor jobs.
6
6
 
7
7
  ## executor
8
8
 
9
- Manage executors and executor jobs.
9
+ Manage executors
10
10
 
11
11
  **Usage**
12
12
 
@@ -18,65 +18,63 @@ tailor-sdk executor [command]
18
18
 
19
19
  | Command | Description |
20
20
  | --------------------------------------- | ----------------------------- |
21
+ | [`executor list`](#executor-list) | List all executors |
22
+ | [`executor get`](#executor-get) | Get executor details |
21
23
  | [`executor jobs`](#executor-jobs) | List or get executor jobs. |
22
24
  | [`executor trigger`](#executor-trigger) | Trigger an executor manually. |
25
+ | [`executor webhook`](#executor-webhook) | Manage executor webhooks |
23
26
 
24
27
  <!-- politty:command:executor:end -->
25
- <!-- politty:command:executor trigger:start -->
26
28
 
27
- ### executor trigger
29
+ <!-- politty:command:executor list:start -->
28
30
 
29
- Trigger an executor manually.
31
+ ### executor list
32
+
33
+ List all executors
30
34
 
31
35
  **Usage**
32
36
 
33
37
  ```
34
- tailor-sdk executor trigger [options] <executorName>
38
+ tailor-sdk executor list [options]
35
39
  ```
36
40
 
37
- **Arguments**
41
+ **Options**
38
42
 
39
- | Argument | Description | Required |
40
- | -------------- | ------------- | -------- |
41
- | `executorName` | Executor name | Yes |
43
+ | Option | Alias | Description | Default |
44
+ | ------------------------------- | ----- | ----------------- | ------- |
45
+ | `--json` | `-j` | Output as JSON | `false` |
46
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | - |
47
+ | `--profile <PROFILE>` | `-p` | Workspace profile | - |
42
48
 
43
- **Options**
49
+ <!-- politty:command:executor list:end -->
44
50
 
45
- | Option | Alias | Description | Default |
46
- | ------------------------------- | ----- | ---------------------------------------------------------------------------------- | ------- |
47
- | `--json` | `-j` | Output as JSON | `false` |
48
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | - |
49
- | `--profile <PROFILE>` | `-p` | Workspace profile | - |
50
- | `--data <DATA>` | `-d` | Request body (JSON string) | - |
51
- | `--header <HEADER>` | `-H` | Request header (format: 'Key: Value', can be specified multiple times) | - |
52
- | `--wait` | `-W` | Wait for job completion and downstream execution (workflow/function) if applicable | `false` |
53
- | `--interval <INTERVAL>` | `-i` | Polling interval when using --wait (e.g., '3s', '500ms', '1m') | `"3s"` |
54
- | `--logs` | `-l` | Display function execution logs after completion (requires --wait) | `false` |
51
+ <!-- politty:command:executor get:start -->
55
52
 
56
- <!-- politty:command:executor trigger:end -->
53
+ ### executor get
57
54
 
58
- Only executors with `incomingWebhook` or `schedule` trigger types can be triggered manually. Executors with `event` trigger types (such as `recordCreated`, `recordUpdated`, `recordDeleted`) cannot be triggered manually.
55
+ Get executor details
59
56
 
60
- The `--data` and `--header` options are only available for `incomingWebhook` trigger type.
57
+ **Usage**
61
58
 
62
- **Usage Examples:**
59
+ ```
60
+ tailor-sdk executor get [options] <name>
61
+ ```
63
62
 
64
- ```bash
65
- # Trigger an executor
66
- tailor-sdk executor trigger my-executor
63
+ **Arguments**
67
64
 
68
- # Trigger with data
69
- tailor-sdk executor trigger my-executor -d '{"message": "hello"}'
65
+ | Argument | Description | Required |
66
+ | -------- | ------------- | -------- |
67
+ | `name` | Executor name | Yes |
70
68
 
71
- # Trigger with data and headers
72
- tailor-sdk executor trigger my-executor -d '{"message": "hello"}' -H "X-Custom: value" -H "X-Another: value2"
69
+ **Options**
73
70
 
74
- # Trigger and wait for completion
75
- tailor-sdk executor trigger my-executor -W
71
+ | Option | Alias | Description | Default |
72
+ | ------------------------------- | ----- | ----------------- | ------- |
73
+ | `--json` | `-j` | Output as JSON | `false` |
74
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | - |
75
+ | `--profile <PROFILE>` | `-p` | Workspace profile | - |
76
76
 
77
- # Trigger, wait, and show logs
78
- tailor-sdk executor trigger my-executor -W -l
79
- ```
77
+ <!-- politty:command:executor get:end -->
80
78
 
81
79
  <!-- politty:command:executor jobs:start -->
82
80
 
@@ -111,34 +109,123 @@ tailor-sdk executor jobs [options] <executorName> [jobId]
111
109
  | `--logs` | `-l` | Display function execution logs after completion (requires --wait) | `false` |
112
110
  | `--limit <LIMIT>` | - | Maximum number of jobs to list (default: 50, max: 1000) (list mode only) | - |
113
111
 
112
+ **Examples**
113
+
114
+ **List jobs for an executor (default: 50 jobs)**
115
+
116
+ ```bash
117
+ $ tailor-sdk executor jobs my-executor
118
+ ```
119
+
120
+ **Limit the number of jobs**
121
+
122
+ ```bash
123
+ $ tailor-sdk executor jobs my-executor --limit 10
124
+ ```
125
+
126
+ **Filter by status**
127
+
128
+ ```bash
129
+ $ tailor-sdk executor jobs my-executor -s RUNNING
130
+ ```
131
+
132
+ **Get job details**
133
+
134
+ ```bash
135
+ $ tailor-sdk executor jobs my-executor <job-id>
136
+ ```
137
+
138
+ **Get job details with attempts**
139
+
140
+ ```bash
141
+ $ tailor-sdk executor jobs my-executor <job-id> --attempts
142
+ ```
143
+
144
+ **Wait for job to complete**
145
+
146
+ ```bash
147
+ $ tailor-sdk executor jobs my-executor <job-id> -W
148
+ ```
149
+
150
+ **Wait for job with logs**
151
+
152
+ ```bash
153
+ $ tailor-sdk executor jobs my-executor <job-id> -W -l
154
+ ```
155
+
114
156
  <!-- politty:command:executor jobs:end -->
115
157
 
116
- **Usage Examples:**
158
+ <!-- politty:command:executor trigger:start -->
159
+
160
+ ### executor trigger
161
+
162
+ Trigger an executor manually.
163
+
164
+ **Usage**
165
+
166
+ ```
167
+ tailor-sdk executor trigger [options] <executorName>
168
+ ```
169
+
170
+ **Arguments**
171
+
172
+ | Argument | Description | Required |
173
+ | -------------- | ------------- | -------- |
174
+ | `executorName` | Executor name | Yes |
175
+
176
+ **Options**
177
+
178
+ | Option | Alias | Description | Default |
179
+ | ------------------------------- | ----- | ---------------------------------------------------------------------------------- | ------- |
180
+ | `--json` | `-j` | Output as JSON | `false` |
181
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | - |
182
+ | `--profile <PROFILE>` | `-p` | Workspace profile | - |
183
+ | `--data <DATA>` | `-d` | Request body (JSON string) | - |
184
+ | `--header <HEADER>` | `-H` | Request header (format: 'Key: Value', can be specified multiple times) | - |
185
+ | `--wait` | `-W` | Wait for job completion and downstream execution (workflow/function) if applicable | `false` |
186
+ | `--interval <INTERVAL>` | `-i` | Polling interval when using --wait (e.g., '3s', '500ms', '1m') | `"3s"` |
187
+ | `--logs` | `-l` | Display function execution logs after completion (requires --wait) | `false` |
188
+
189
+ **Examples**
190
+
191
+ **Trigger an executor**
192
+
193
+ ```bash
194
+ $ tailor-sdk executor trigger my-executor
195
+ ```
196
+
197
+ **Trigger with data**
117
198
 
118
199
  ```bash
119
- # List jobs for an executor (default: 50 jobs)
120
- tailor-sdk executor jobs my-executor
200
+ $ tailor-sdk executor trigger my-executor -d '{"message": "hello"}'
201
+ ```
121
202
 
122
- # Limit the number of jobs
123
- tailor-sdk executor jobs my-executor --limit 10
203
+ **Trigger with data and headers**
124
204
 
125
- # Filter by status
126
- tailor-sdk executor jobs my-executor -s RUNNING
205
+ ```bash
206
+ $ tailor-sdk executor trigger my-executor -d '{"message": "hello"}' -H "X-Custom: value" -H "X-Another: value2"
207
+ ```
127
208
 
128
- # Get job details
129
- tailor-sdk executor jobs my-executor <job-id>
209
+ **Trigger and wait for completion**
130
210
 
131
- # Get job details with attempts
132
- tailor-sdk executor jobs my-executor <job-id> --attempts
211
+ ```bash
212
+ $ tailor-sdk executor trigger my-executor -W
213
+ ```
133
214
 
134
- # Wait for job to complete
135
- tailor-sdk executor jobs my-executor <job-id> -W
215
+ **Trigger, wait, and show logs**
136
216
 
137
- # Wait for job with logs
138
- tailor-sdk executor jobs my-executor <job-id> -W -l
217
+ ```bash
218
+ $ tailor-sdk executor trigger my-executor -W -l
139
219
  ```
140
220
 
141
- ## Downstream Execution Tracking
221
+ **Notes**
222
+
223
+ Only executors with `INCOMING_WEBHOOK` or `SCHEDULE` trigger types can be triggered manually.
224
+ Executors with `EVENT` trigger types (such as `recordCreated`, `recordUpdated`, `recordDeleted`) cannot be triggered manually.
225
+
226
+ The `--data` and `--header` options are only available for `INCOMING_WEBHOOK` trigger type.
227
+
228
+ **Downstream Execution Tracking**
142
229
 
143
230
  When using `--wait`, the CLI tracks not only the executor job but also any downstream executions:
144
231
 
@@ -147,3 +234,47 @@ When using `--wait`, the CLI tracks not only the executor job but also any downs
147
234
  - **Webhook/GraphQL targets**: Only waits for the executor job itself
148
235
 
149
236
  The `--logs` option displays logs from the downstream execution when available.
237
+
238
+ <!-- politty:command:executor trigger:end -->
239
+
240
+ <!-- politty:command:executor webhook:start -->
241
+
242
+ ### executor webhook
243
+
244
+ Manage executor webhooks
245
+
246
+ **Usage**
247
+
248
+ ```
249
+ tailor-sdk executor webhook [command]
250
+ ```
251
+
252
+ **Commands**
253
+
254
+ | Command | Description |
255
+ | ------------------------------------------------- | --------------------------------------------- |
256
+ | [`executor webhook list`](#executor-webhook-list) | List executors with incoming webhook triggers |
257
+
258
+ <!-- politty:command:executor webhook:end -->
259
+
260
+ <!-- politty:command:executor webhook list:start -->
261
+
262
+ #### executor webhook list
263
+
264
+ List executors with incoming webhook triggers
265
+
266
+ **Usage**
267
+
268
+ ```
269
+ tailor-sdk executor webhook list [options]
270
+ ```
271
+
272
+ **Options**
273
+
274
+ | Option | Alias | Description | Default |
275
+ | ------------------------------- | ----- | ----------------- | ------- |
276
+ | `--json` | `-j` | Output as JSON | `false` |
277
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | - |
278
+ | `--profile <PROFILE>` | `-p` | Workspace profile | - |
279
+
280
+ <!-- politty:command:executor webhook list:end -->
@@ -56,6 +56,34 @@ export const fetchCustomer = createWorkflowJob({
56
56
  });
57
57
  ```
58
58
 
59
+ ## Input and Output Type Constraints
60
+
61
+ Workflow job inputs and outputs are serialized as JSON when passed between jobs. This imposes type constraints:
62
+
63
+ **Input types** must be JSON-compatible — only primitives (`string`, `number`, `boolean`, `null`), arrays, and plain objects are allowed. `Date`, `Map`, `Set`, functions, and other non-serializable types cannot be used.
64
+
65
+ ```typescript
66
+ // OK
67
+ export const myJob = createWorkflowJob({
68
+ name: "my-job",
69
+ body: async (input: { id: string; count: number; tags: string[] }) => {
70
+ // ...
71
+ },
72
+ });
73
+
74
+ // Compile error — Date is not allowed in input
75
+ export const badJob = createWorkflowJob({
76
+ name: "bad-job",
77
+ body: async (input: { createdAt: Date }) => {
78
+ // ...
79
+ },
80
+ });
81
+ ```
82
+
83
+ **Output types** are more permissive — `Date` and objects with `toJSON()` are allowed because they are serialized via `JSON.stringify` at runtime (e.g., `Date` becomes a string).
84
+
85
+ These constraints are enforced at compile time — you will get a type error if you use an unsupported type.
86
+
59
87
  ## Triggering Jobs
60
88
 
61
89
  Use `.trigger()` to start other jobs from within a job.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.10.1",
3
+ "version": "1.11.1",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,6 +51,7 @@
51
51
  "confbox": "0.2.2",
52
52
  "consola": "3.4.2",
53
53
  "date-fns": "4.1.0",
54
+ "es-toolkit": "^1.44.0",
54
55
  "find-up-simple": "1.0.1",
55
56
  "inflection": "3.0.2",
56
57
  "madge": "8.0.0",