@tailor-platform/sdk 1.29.0 → 1.31.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +3 -1
  3. package/dist/{application-Dl1d7w-b.mjs → application-B2-PymMz.mjs} +2 -2
  4. package/dist/{application-Clwpv84E.mjs → application-CASjzt3W.mjs} +341 -107
  5. package/dist/application-CASjzt3W.mjs.map +1 -0
  6. package/dist/cli/index.mjs +127 -96
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +210 -45
  9. package/dist/cli/lib.mjs +29 -29
  10. package/dist/cli/lib.mjs.map +1 -1
  11. package/dist/client-B0wrLUVK.mjs +6 -0
  12. package/dist/{client-CZmQBXAY.mjs → client-DfdgRZlQ.mjs} +25 -13
  13. package/dist/{client-CZmQBXAY.mjs.map → client-DfdgRZlQ.mjs.map} +1 -1
  14. package/dist/configure/index.d.mts +4 -4
  15. package/dist/configure/index.mjs +1 -1
  16. package/dist/{crash-report-CYrETw1c.mjs → crash-report-BMEhRxeg.mjs} +1 -1
  17. package/dist/{crash-report-DizNMVnm.mjs → crash-report-wNxS0IUJ.mjs} +2 -2
  18. package/dist/{crash-report-DizNMVnm.mjs.map → crash-report-wNxS0IUJ.mjs.map} +1 -1
  19. package/dist/{env-BuMbIknz.d.mts → env-BgdHfWDn.d.mts} +2 -2
  20. package/dist/{index-D1AM_02Y.d.mts → index-CdDzh-T2.d.mts} +2 -2
  21. package/dist/{index-CyapgSFI.d.mts → index-CxgBnxKM.d.mts} +2 -2
  22. package/dist/{index-B0Lrzywd.d.mts → index-D4Y81vh1.d.mts} +2 -2
  23. package/dist/{index-CbnLNm14.d.mts → index-FZMBoUWm.d.mts} +2 -2
  24. package/dist/{index-cD9sQLTh.d.mts → index-RXv15__b.d.mts} +4 -4
  25. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  26. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  27. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  28. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  29. package/dist/plugin/index.d.mts +2 -2
  30. package/dist/{plugin-D3a0-qe0.d.mts → plugin-DyVYXZWz.d.mts} +8 -8
  31. package/dist/{query-B1-hq2Hm.mjs → runtime-Ofe7nHEG.mjs} +667 -143
  32. package/dist/runtime-Ofe7nHEG.mjs.map +1 -0
  33. package/dist/{schema-BePzTFBV.mjs → schema-CNWt2FKQ.mjs} +3 -14
  34. package/dist/schema-CNWt2FKQ.mjs.map +1 -0
  35. package/dist/utils/test/index.d.mts +2 -2
  36. package/dist/{workflow.generated-BsgIlrH-.d.mts → workflow.generated-DMQ-cjyT.d.mts} +2 -2
  37. package/docs/cli/function.md +1 -1
  38. package/docs/cli/organization.md +426 -0
  39. package/docs/cli-reference.md +20 -2
  40. package/docs/quickstart.md +12 -0
  41. package/docs/services/resolver.md +59 -0
  42. package/docs/services/tailordb.md +78 -6
  43. package/package.json +15 -12
  44. package/dist/application-Clwpv84E.mjs.map +0 -1
  45. package/dist/client-CW4Oh3iz.mjs +0 -6
  46. package/dist/query-B1-hq2Hm.mjs.map +0 -1
  47. package/dist/schema-BePzTFBV.mjs.map +0 -1
@@ -0,0 +1,426 @@
1
+ <!-- politty:command:organization:heading:start -->
2
+
3
+ ## organization
4
+
5
+ <!-- politty:command:organization:heading:end -->
6
+
7
+ <!-- politty:command:organization:description:start -->
8
+
9
+ Manage Tailor Platform organizations.
10
+
11
+ <!-- politty:command:organization:description:end -->
12
+
13
+ <!-- politty:command:organization:usage:start -->
14
+
15
+ **Usage**
16
+
17
+ ```
18
+ tailor-sdk organization [command]
19
+ ```
20
+
21
+ <!-- politty:command:organization:usage:end -->
22
+
23
+ <!-- politty:command:organization:global-options-link:start -->
24
+
25
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
26
+
27
+ <!-- politty:command:organization:global-options-link:end -->
28
+
29
+ <!-- politty:command:organization:subcommands:start -->
30
+
31
+ **Commands**
32
+
33
+ | Command | Description |
34
+ | --------------------------------------------- | ------------------------------------------------ |
35
+ | [`organization folder`](#organization-folder) | Manage organization folders. |
36
+ | [`organization get`](#organization-get) | Show detailed information about an organization. |
37
+ | [`organization list`](#organization-list) | List organizations you belong to. |
38
+ | [`organization tree`](#organization-tree) | Display organization folder hierarchy as a tree. |
39
+ | [`organization update`](#organization-update) | Update an organization's name. |
40
+
41
+ <!-- politty:command:organization:subcommands:end -->
42
+ <!-- politty:command:organization folder:heading:start -->
43
+
44
+ ### organization folder
45
+
46
+ <!-- politty:command:organization folder:heading:end -->
47
+
48
+ <!-- politty:command:organization folder:description:start -->
49
+
50
+ Manage organization folders.
51
+
52
+ <!-- politty:command:organization folder:description:end -->
53
+
54
+ <!-- politty:command:organization folder:usage:start -->
55
+
56
+ **Usage**
57
+
58
+ ```
59
+ tailor-sdk organization folder [command]
60
+ ```
61
+
62
+ <!-- politty:command:organization folder:usage:end -->
63
+
64
+ <!-- politty:command:organization folder:global-options-link:start -->
65
+
66
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
67
+
68
+ <!-- politty:command:organization folder:global-options-link:end -->
69
+
70
+ <!-- politty:command:organization folder:subcommands:start -->
71
+
72
+ **Commands**
73
+
74
+ | Command | Description |
75
+ | ----------------------------------------------------------- | ----------------------------------------- |
76
+ | [`organization folder create`](#organization-folder-create) | Create a new folder in an organization. |
77
+ | [`organization folder delete`](#organization-folder-delete) | Delete a folder from an organization. |
78
+ | [`organization folder get`](#organization-folder-get) | Show detailed information about a folder. |
79
+ | [`organization folder list`](#organization-folder-list) | List folders in an organization. |
80
+ | [`organization folder update`](#organization-folder-update) | Update a folder's name. |
81
+
82
+ <!-- politty:command:organization folder:subcommands:end -->
83
+ <!-- politty:command:organization folder create:heading:start -->
84
+
85
+ #### organization folder create
86
+
87
+ <!-- politty:command:organization folder create:heading:end -->
88
+
89
+ <!-- politty:command:organization folder create:description:start -->
90
+
91
+ Create a new folder in an organization.
92
+
93
+ <!-- politty:command:organization folder create:description:end -->
94
+
95
+ <!-- politty:command:organization folder create:usage:start -->
96
+
97
+ **Usage**
98
+
99
+ ```
100
+ tailor-sdk organization folder create [options]
101
+ ```
102
+
103
+ <!-- politty:command:organization folder create:usage:end -->
104
+
105
+ <!-- politty:command:organization folder create:options:start -->
106
+
107
+ **Options**
108
+
109
+ | Option | Alias | Description | Required | Default | Env |
110
+ | --------------------------------------- | ----- | ---------------- | -------- | ------- | --------------------------------- |
111
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
112
+ | `--parent-folder-id <PARENT_FOLDER_ID>` | - | Parent folder ID | No | - | - |
113
+ | `--name <NAME>` | `-n` | Folder name | Yes | - | - |
114
+
115
+ <!-- politty:command:organization folder create:options:end -->
116
+
117
+ <!-- politty:command:organization folder create:global-options-link:start -->
118
+
119
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
120
+
121
+ <!-- politty:command:organization folder create:global-options-link:end -->
122
+ <!-- politty:command:organization folder delete:heading:start -->
123
+
124
+ #### organization folder delete
125
+
126
+ <!-- politty:command:organization folder delete:heading:end -->
127
+
128
+ <!-- politty:command:organization folder delete:description:start -->
129
+
130
+ Delete a folder from an organization.
131
+
132
+ <!-- politty:command:organization folder delete:description:end -->
133
+
134
+ <!-- politty:command:organization folder delete:usage:start -->
135
+
136
+ **Usage**
137
+
138
+ ```
139
+ tailor-sdk organization folder delete [options]
140
+ ```
141
+
142
+ <!-- politty:command:organization folder delete:usage:end -->
143
+
144
+ <!-- politty:command:organization folder delete:options:start -->
145
+
146
+ **Options**
147
+
148
+ | Option | Alias | Description | Required | Default | Env |
149
+ | ------------------------------------- | ----- | ------------------------- | -------- | ------- | --------------------------------- |
150
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
151
+ | `--folder-id <FOLDER_ID>` | `-f` | Folder ID | Yes | - | `TAILOR_PLATFORM_FOLDER_ID` |
152
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
153
+
154
+ <!-- politty:command:organization folder delete:options:end -->
155
+
156
+ <!-- politty:command:organization folder delete:global-options-link:start -->
157
+
158
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
159
+
160
+ <!-- politty:command:organization folder delete:global-options-link:end -->
161
+ <!-- politty:command:organization folder get:heading:start -->
162
+
163
+ #### organization folder get
164
+
165
+ <!-- politty:command:organization folder get:heading:end -->
166
+
167
+ <!-- politty:command:organization folder get:description:start -->
168
+
169
+ Show detailed information about a folder.
170
+
171
+ <!-- politty:command:organization folder get:description:end -->
172
+
173
+ <!-- politty:command:organization folder get:usage:start -->
174
+
175
+ **Usage**
176
+
177
+ ```
178
+ tailor-sdk organization folder get [options]
179
+ ```
180
+
181
+ <!-- politty:command:organization folder get:usage:end -->
182
+
183
+ <!-- politty:command:organization folder get:options:start -->
184
+
185
+ **Options**
186
+
187
+ | Option | Alias | Description | Required | Default | Env |
188
+ | ------------------------------------- | ----- | --------------- | -------- | ------- | --------------------------------- |
189
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
190
+ | `--folder-id <FOLDER_ID>` | `-f` | Folder ID | Yes | - | `TAILOR_PLATFORM_FOLDER_ID` |
191
+
192
+ <!-- politty:command:organization folder get:options:end -->
193
+
194
+ <!-- politty:command:organization folder get:global-options-link:start -->
195
+
196
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
197
+
198
+ <!-- politty:command:organization folder get:global-options-link:end -->
199
+ <!-- politty:command:organization folder list:heading:start -->
200
+
201
+ #### organization folder list
202
+
203
+ <!-- politty:command:organization folder list:heading:end -->
204
+
205
+ <!-- politty:command:organization folder list:description:start -->
206
+
207
+ List folders in an organization.
208
+
209
+ <!-- politty:command:organization folder list:description:end -->
210
+
211
+ <!-- politty:command:organization folder list:usage:start -->
212
+
213
+ **Usage**
214
+
215
+ ```
216
+ tailor-sdk organization folder list [options]
217
+ ```
218
+
219
+ <!-- politty:command:organization folder list:usage:end -->
220
+
221
+ <!-- politty:command:organization folder list:options:start -->
222
+
223
+ **Options**
224
+
225
+ | Option | Alias | Description | Required | Default | Env |
226
+ | --------------------------------------- | ----- | ------------------------------------ | -------- | ------- | --------------------------------- |
227
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
228
+ | `--parent-folder-id <PARENT_FOLDER_ID>` | - | Parent folder ID to list children of | No | - | - |
229
+ | `--limit <LIMIT>` | `-l` | Maximum number of folders to list | No | - | - |
230
+
231
+ <!-- politty:command:organization folder list:options:end -->
232
+
233
+ <!-- politty:command:organization folder list:global-options-link:start -->
234
+
235
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
236
+
237
+ <!-- politty:command:organization folder list:global-options-link:end -->
238
+ <!-- politty:command:organization folder update:heading:start -->
239
+
240
+ #### organization folder update
241
+
242
+ <!-- politty:command:organization folder update:heading:end -->
243
+
244
+ <!-- politty:command:organization folder update:description:start -->
245
+
246
+ Update a folder's name.
247
+
248
+ <!-- politty:command:organization folder update:description:end -->
249
+
250
+ <!-- politty:command:organization folder update:usage:start -->
251
+
252
+ **Usage**
253
+
254
+ ```
255
+ tailor-sdk organization folder update [options]
256
+ ```
257
+
258
+ <!-- politty:command:organization folder update:usage:end -->
259
+
260
+ <!-- politty:command:organization folder update:options:start -->
261
+
262
+ **Options**
263
+
264
+ | Option | Alias | Description | Required | Default | Env |
265
+ | ------------------------------------- | ----- | --------------- | -------- | ------- | --------------------------------- |
266
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
267
+ | `--folder-id <FOLDER_ID>` | `-f` | Folder ID | Yes | - | `TAILOR_PLATFORM_FOLDER_ID` |
268
+ | `--name <NAME>` | `-n` | New folder name | Yes | - | - |
269
+
270
+ <!-- politty:command:organization folder update:options:end -->
271
+
272
+ <!-- politty:command:organization folder update:global-options-link:start -->
273
+
274
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
275
+
276
+ <!-- politty:command:organization folder update:global-options-link:end -->
277
+ <!-- politty:command:organization get:heading:start -->
278
+
279
+ ### organization get
280
+
281
+ <!-- politty:command:organization get:heading:end -->
282
+
283
+ <!-- politty:command:organization get:description:start -->
284
+
285
+ Show detailed information about an organization.
286
+
287
+ <!-- politty:command:organization get:description:end -->
288
+
289
+ <!-- politty:command:organization get:usage:start -->
290
+
291
+ **Usage**
292
+
293
+ ```
294
+ tailor-sdk organization get [options]
295
+ ```
296
+
297
+ <!-- politty:command:organization get:usage:end -->
298
+
299
+ <!-- politty:command:organization get:options:start -->
300
+
301
+ **Options**
302
+
303
+ | Option | Alias | Description | Required | Default | Env |
304
+ | ------------------------------------- | ----- | --------------- | -------- | ------- | --------------------------------- |
305
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
306
+
307
+ <!-- politty:command:organization get:options:end -->
308
+
309
+ <!-- politty:command:organization get:global-options-link:start -->
310
+
311
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
312
+
313
+ <!-- politty:command:organization get:global-options-link:end -->
314
+ <!-- politty:command:organization list:heading:start -->
315
+
316
+ ### organization list
317
+
318
+ <!-- politty:command:organization list:heading:end -->
319
+
320
+ <!-- politty:command:organization list:description:start -->
321
+
322
+ List organizations you belong to.
323
+
324
+ <!-- politty:command:organization list:description:end -->
325
+
326
+ <!-- politty:command:organization list:usage:start -->
327
+
328
+ **Usage**
329
+
330
+ ```
331
+ tailor-sdk organization list [options]
332
+ ```
333
+
334
+ <!-- politty:command:organization list:usage:end -->
335
+
336
+ <!-- politty:command:organization list:options:start -->
337
+
338
+ **Options**
339
+
340
+ | Option | Alias | Description | Required | Default |
341
+ | ----------------- | ----- | --------------------------------------- | -------- | ------- |
342
+ | `--limit <LIMIT>` | `-l` | Maximum number of organizations to list | No | - |
343
+
344
+ <!-- politty:command:organization list:options:end -->
345
+
346
+ <!-- politty:command:organization list:global-options-link:start -->
347
+
348
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
349
+
350
+ <!-- politty:command:organization list:global-options-link:end -->
351
+ <!-- politty:command:organization tree:heading:start -->
352
+
353
+ ### organization tree
354
+
355
+ <!-- politty:command:organization tree:heading:end -->
356
+
357
+ <!-- politty:command:organization tree:description:start -->
358
+
359
+ Display organization folder hierarchy as a tree.
360
+
361
+ <!-- politty:command:organization tree:description:end -->
362
+
363
+ <!-- politty:command:organization tree:usage:start -->
364
+
365
+ **Usage**
366
+
367
+ ```
368
+ tailor-sdk organization tree [options]
369
+ ```
370
+
371
+ <!-- politty:command:organization tree:usage:end -->
372
+
373
+ <!-- politty:command:organization tree:options:start -->
374
+
375
+ **Options**
376
+
377
+ | Option | Alias | Description | Required | Default | Env |
378
+ | ------------------------------------- | ----- | ------------------------------------- | -------- | ------- | --------------------------------- |
379
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID (show all if omitted) | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
380
+ | `--depth <DEPTH>` | `-d` | Maximum folder depth to display | No | - | - |
381
+
382
+ <!-- politty:command:organization tree:options:end -->
383
+
384
+ <!-- politty:command:organization tree:global-options-link:start -->
385
+
386
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
387
+
388
+ <!-- politty:command:organization tree:global-options-link:end -->
389
+ <!-- politty:command:organization update:heading:start -->
390
+
391
+ ### organization update
392
+
393
+ <!-- politty:command:organization update:heading:end -->
394
+
395
+ <!-- politty:command:organization update:description:start -->
396
+
397
+ Update an organization's name.
398
+
399
+ <!-- politty:command:organization update:description:end -->
400
+
401
+ <!-- politty:command:organization update:usage:start -->
402
+
403
+ **Usage**
404
+
405
+ ```
406
+ tailor-sdk organization update [options]
407
+ ```
408
+
409
+ <!-- politty:command:organization update:usage:end -->
410
+
411
+ <!-- politty:command:organization update:options:start -->
412
+
413
+ **Options**
414
+
415
+ | Option | Alias | Description | Required | Default | Env |
416
+ | ------------------------------------- | ----- | --------------------- | -------- | ------- | --------------------------------- |
417
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
418
+ | `--name <NAME>` | `-n` | New organization name | Yes | - | - |
419
+
420
+ <!-- politty:command:organization update:options:end -->
421
+
422
+ <!-- politty:command:organization update:global-options-link:start -->
423
+
424
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
425
+
426
+ <!-- politty:command:organization update:global-options-link:end -->
@@ -56,6 +56,8 @@ You can use environment variables to configure workspace and authentication:
56
56
  | Variable | Description |
57
57
  | -------------------------------------------- | --------------------------------------------------------------------------- |
58
58
  | `TAILOR_PLATFORM_WORKSPACE_ID` | Workspace ID for deployment commands |
59
+ | `TAILOR_PLATFORM_ORGANIZATION_ID` | Organization ID for organization commands |
60
+ | `TAILOR_PLATFORM_FOLDER_ID` | Folder ID for folder commands |
59
61
  | `TAILOR_PLATFORM_TOKEN` | Authentication token (alternative to `login`) |
60
62
  | `TAILOR_TOKEN` | **Deprecated.** Use `TAILOR_PLATFORM_TOKEN` instead |
61
63
  | `TAILOR_PLATFORM_PROFILE` | Workspace profile name |
@@ -129,9 +131,25 @@ Commands for authentication and user management.
129
131
  | [user pat delete](./cli/user.md#user-pat-delete) | Delete a personal access token |
130
132
  | [user pat update](./cli/user.md#user-pat-update) | Update a personal access token |
131
133
 
132
- ### [Workspace Commands](./cli/workspace.md)
134
+ ### Workspace & Organization Commands
133
135
 
134
- Commands for managing workspaces and profiles.
136
+ Commands for managing workspaces, profiles, organizations, and folders.
137
+
138
+ **[Organization Commands](./cli/organization.md)**
139
+
140
+ | Command | Description |
141
+ | ------------------------------------------------------------------------------ | ----------------------------------------------- |
142
+ | [organization list](./cli/organization.md#organization-list) | List organizations you belong to |
143
+ | [organization get](./cli/organization.md#organization-get) | Show detailed information about an organization |
144
+ | [organization update](./cli/organization.md#organization-update) | Update an organization's name |
145
+ | [organization tree](./cli/organization.md#organization-tree) | Display organization folder hierarchy as a tree |
146
+ | [organization folder list](./cli/organization.md#organization-folder-list) | List folders in an organization |
147
+ | [organization folder get](./cli/organization.md#organization-folder-get) | Show detailed information about a folder |
148
+ | [organization folder create](./cli/organization.md#organization-folder-create) | Create a new folder in an organization |
149
+ | [organization folder update](./cli/organization.md#organization-folder-update) | Update a folder's name |
150
+ | [organization folder delete](./cli/organization.md#organization-folder-delete) | Delete a folder from an organization |
151
+
152
+ **[Workspace Commands](./cli/workspace.md)**
135
153
 
136
154
  | Command | Description |
137
155
  | ------------------------------------------------------- | ---------------------- |
@@ -14,12 +14,18 @@ Contact us [here](https://www.tailor.tech/demo) to get started.
14
14
 
15
15
  The SDK requires Node.js 22 or later. Install Node.js via your package manager by following the official Node.js instructions.
16
16
 
17
+ Alternatively, you can use [Bun](https://bun.sh/) as the runtime.
18
+
19
+ > **Note:** Bun has a known issue with HTTP/2 connections that may cause intermittent failures during `apply` or `generate` commands ([bun#14249](https://github.com/oven-sh/bun/issues/14249), [bun#26719](https://github.com/oven-sh/bun/issues/26719)). If you encounter a connection error, retry the command.
20
+
17
21
  ### Create an Example App
18
22
 
19
23
  The following command creates a new project with the required configuration files and example code.
20
24
 
21
25
  ```bash
22
26
  npm create @tailor-platform/sdk -- --template hello-world example-app
27
+ # Or with Bun:
28
+ # bun create @tailor-platform/sdk --template hello-world example-app
23
29
  ```
24
30
 
25
31
  Before deploying your app, you need to create a workspace:
@@ -29,6 +35,10 @@ npx tailor-sdk login
29
35
  npx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
30
36
  npx tailor-sdk workspace list
31
37
 
38
+ # Or with Bun:
39
+ # bunx tailor-sdk login
40
+ # bunx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
41
+
32
42
  # OR
33
43
  # Create a new workspace using Tailor Platform Console
34
44
  # https://console.tailor.tech/
@@ -41,6 +51,8 @@ Run the apply command to deploy your project:
41
51
  ```bash
42
52
  cd example-app
43
53
  npm run deploy -- --workspace-id <your-workspace-id>
54
+ # Or with Bun:
55
+ # bun run deploy --workspace-id <your-workspace-id>
44
56
  ```
45
57
 
46
58
  You can now open the GraphQL Playground and execute the `hello` query:
@@ -120,6 +120,65 @@ createResolver({
120
120
  });
121
121
  ```
122
122
 
123
+ ### Custom Type Name (`typeName`)
124
+
125
+ Enum and nested object fields in input/output schemas generate protobuf type names automatically (e.g., `{ResolverName}{FieldName}`). Use `typeName()` to set a custom name:
126
+
127
+ ```typescript
128
+ createResolver({
129
+ name: "createOrder",
130
+ operation: "mutation",
131
+ input: {
132
+ address: t
133
+ .object({
134
+ street: t.string(),
135
+ city: t.string(),
136
+ zip: t.string(),
137
+ })
138
+ .typeName("ShippingAddress"),
139
+ status: t.enum(["pending", "confirmed", "shipped"]).typeName("OrderStatus"),
140
+ },
141
+ // ...
142
+ });
143
+ ```
144
+
145
+ **Constraints:**
146
+
147
+ - Only available on `enum()` and `object()` fields — calling on scalar types is a compile error
148
+ - Cannot be called twice on the same field
149
+ - Can be chained with `description()`
150
+
151
+ This is useful when the same logical type appears in multiple resolvers or when you want a predictable, human-readable name in the generated GraphQL schema.
152
+
153
+ **Warning:** Do not set `typeName` to an existing TailorDB type name on an `object()` that contains enum or nested fields. Child fields without an explicit `typeName` auto-generate names using `{parentTypeName}{FieldName}`, which can collide with the TailorDB type's own enum/nested type names.
154
+
155
+ ```typescript
156
+ // Collision — "Item" + "status" auto-generates "ItemStatus",
157
+ // which collides with the TailorDB Item type's status enum
158
+ output: t
159
+ .object({
160
+ id: t.uuid(),
161
+ status: t.enum(["ACTIVE", "INACTIVE"]),
162
+ })
163
+ .typeName("Item"),
164
+
165
+ // OK — use a distinct name that won't collide
166
+ output: t
167
+ .object({
168
+ id: t.uuid(),
169
+ status: t.enum(["ACTIVE", "INACTIVE"]),
170
+ })
171
+ .typeName("DeactivateItemOutput"),
172
+
173
+ // OK — explicitly set typeName on child enum too
174
+ output: t
175
+ .object({
176
+ id: t.uuid(),
177
+ status: t.enum(["ACTIVE", "INACTIVE"]).typeName("DeactivateItemStatus"),
178
+ })
179
+ .typeName("Item"),
180
+ ```
181
+
123
182
  ## Input Validation
124
183
 
125
184
  Add validation rules to input fields using the `validate` method:
@@ -243,10 +243,10 @@ export const customer = db
243
243
  });
244
244
  ```
245
245
 
246
- **⚠️ Important:** Field-level and type-level hooks cannot coexist on the same field. TypeScript will prevent this at compile time:
246
+ **Important:** Field-level and type-level hooks cannot coexist on the same field. TypeScript will prevent this at compile time:
247
247
 
248
248
  ```typescript
249
- // Compile error - cannot set hooks on the same field twice
249
+ // Compile error - cannot set hooks on the same field twice
250
250
  export const user = db
251
251
  .type("User", {
252
252
  name: db.string().hooks({ create: ({ data }) => data.firstName }), // Field-level
@@ -255,7 +255,7 @@ export const user = db
255
255
  name: { create: ({ data }) => data.lastName }, // Type-level - ERROR
256
256
  });
257
257
 
258
- // Correct - set hooks on different fields
258
+ // OK - set hooks on different fields
259
259
  export const user = db
260
260
  .type("User", {
261
261
  firstName: db.string().hooks({ create: () => "John" }), // Field-level on firstName
@@ -306,10 +306,10 @@ export const user = db
306
306
  });
307
307
  ```
308
308
 
309
- **⚠️ Important:** Field-level and type-level validation cannot coexist on the same field. TypeScript will prevent this at compile time:
309
+ **Important:** Field-level and type-level validation cannot coexist on the same field. TypeScript will prevent this at compile time:
310
310
 
311
311
  ```typescript
312
- // Compile error - cannot set validation on the same field twice
312
+ // Compile error - cannot set validation on the same field twice
313
313
  export const user = db
314
314
  .type("User", {
315
315
  name: db.string().validate(({ value }) => value.length > 0), // Field-level
@@ -318,7 +318,7 @@ export const user = db
318
318
  name: [({ value }) => value.length < 100, "Too long"], // Type-level - ERROR
319
319
  });
320
320
 
321
- // Correct - set validation on different fields
321
+ // OK - set validation on different fields
322
322
  export const user = db
323
323
  .type("User", {
324
324
  name: db.string().validate(({ value }) => value.length > 0), // Field-level on name
@@ -449,6 +449,78 @@ db.type("User", {
449
449
  });
450
450
  ```
451
451
 
452
+ ### Field Extraction (`pickFields` / `omitFields`)
453
+
454
+ Extract subsets of fields from a `TailorDBType` for reuse in resolvers, executors, seed schemas, etc.
455
+
456
+ #### `pickFields(keys, options)`
457
+
458
+ Select specific fields and optionally modify their properties:
459
+
460
+ ```typescript
461
+ const user = db.type("User", {
462
+ id: db.uuid(),
463
+ name: db.string(),
464
+ email: db.string().unique(),
465
+ ...db.fields.timestamps(),
466
+ });
467
+
468
+ // Pick id and createdAt, making them optional
469
+ user.pickFields(["id", "createdAt"], { optional: true });
470
+ ```
471
+
472
+ Available options:
473
+
474
+ | Option | Effect |
475
+ | ---------- | ------------------------------------- |
476
+ | `optional` | Makes the selected fields optional |
477
+ | `array` | Makes the selected fields array types |
478
+
479
+ #### `omitFields(keys)`
480
+
481
+ Return all fields except the specified ones:
482
+
483
+ ```typescript
484
+ // All fields except id and createdAt
485
+ user.omitFields(["id", "createdAt"]);
486
+ ```
487
+
488
+ #### Common Pattern: Input Schema Composition
489
+
490
+ The typical use case is combining `pickFields` and `omitFields` with spread syntax to build input schemas where identifiers are optional but other fields remain required:
491
+
492
+ ```typescript
493
+ import { createResolver, t } from "@tailor-platform/sdk";
494
+ import { user } from "../tailordb/user";
495
+
496
+ export default createResolver({
497
+ name: "createUser",
498
+ operation: "mutation",
499
+ input: {
500
+ // id/createdAt are optional (auto-generated), other fields are required
501
+ ...user.pickFields(["id", "createdAt"], { optional: true }),
502
+ ...user.omitFields(["id", "createdAt"]),
503
+ },
504
+ output: t.object({ id: t.uuid() }),
505
+ body: async (context) => {
506
+ // ...
507
+ return { id: "..." };
508
+ },
509
+ });
510
+ ```
511
+
512
+ This is also used in seed data schemas:
513
+
514
+ ```typescript
515
+ import { t } from "@tailor-platform/sdk";
516
+ import { invoice } from "../../tailordb/invoice";
517
+
518
+ const schemaType = t.object({
519
+ ...invoice.pickFields(["id", "createdAt"], { optional: true }),
520
+ ...invoice.omitFields(["id", "createdAt", "invoiceNumber", "sequentialId"]),
521
+ });
522
+ ```
523
+
452
524
  ### Permissions
453
525
 
454
526
  Configure Permission and GQLPermission. For details, see the [TailorDB Permission documentation](https://docs.tailor.tech/guides/tailordb/permission).