@tailor-platform/sdk 1.66.1 → 2.0.0-next.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.
- package/CHANGELOG.md +89 -2
- package/dist/application-DB2r36Et.mjs +3 -0
- package/dist/{application-DGDmL8i_.mjs → application-DqS1yBg3.mjs} +188 -128
- package/dist/application-DqS1yBg3.mjs.map +1 -0
- package/dist/{assert-CKfwrmCV.mjs → assert-DBxo8jPo.mjs} +1 -2
- package/dist/{assert-CKfwrmCV.mjs.map → assert-DBxo8jPo.mjs.map} +1 -1
- package/dist/{authconnection-D8SJGMpj.mjs → authconnection-D2MhtTN5.mjs} +2 -3
- package/dist/{authconnection-D8SJGMpj.mjs.map → authconnection-D2MhtTN5.mjs.map} +1 -1
- package/dist/{authconnection-BIYzEh2p.d.mts → authconnection-DvUQAjQS.d.mts} +1 -1
- package/dist/{brand-DlnJ375c.mjs → brand-Eo4pLXPJ.mjs} +1 -2
- package/dist/{brand-DlnJ375c.mjs.map → brand-Eo4pLXPJ.mjs.map} +1 -1
- package/dist/cli/index.mjs +78 -131
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +15 -154
- package/dist/cli/lib.mjs +9 -10
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/{client-boxXYevx.mjs → client-Dbohmtkv.mjs} +1 -2
- package/dist/{client-F0a4cWUM.mjs → client-z_oHGVNy.mjs} +8 -6
- package/dist/client-z_oHGVNy.mjs.map +1 -0
- package/dist/completion/zsh-worker.zsh +5 -19
- package/dist/configure/index.d.mts +8 -7
- package/dist/configure/index.mjs +11 -28
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{context-s0lxhu8_.mjs → context-Bd266-ru.mjs} +2 -3
- package/dist/{context-s0lxhu8_.mjs.map → context-Bd266-ru.mjs.map} +1 -1
- package/dist/{context-CUBwSBq4.d.mts → context-BuuIb8CC.d.mts} +1 -1
- package/dist/{crashreport-0EHy-ayY.mjs → crashreport-BsjAkFWw.mjs} +19 -10
- package/dist/{crashreport-0EHy-ayY.mjs.map → crashreport-BsjAkFWw.mjs.map} +1 -1
- package/dist/{crashreport-Bf6uT6mf.mjs → crashreport-pr6Rhvza.mjs} +1 -2
- package/dist/{enum-constants-C7DaWeQo.mjs → enum-constants-j9QBF0cB.mjs} +1 -2
- package/dist/enum-constants-j9QBF0cB.mjs.map +1 -0
- package/dist/{errors-EsY4XO6O.mjs → errors-Dtf2WPaW.mjs} +1 -2
- package/dist/{errors-EsY4XO6O.mjs.map → errors-Dtf2WPaW.mjs.map} +1 -1
- package/dist/{field-C4zdJLW5.mjs → field-DOsJCPFa.mjs} +1 -2
- package/dist/field-DOsJCPFa.mjs.map +1 -0
- package/dist/{file-BzK8z3X-.d.mts → file-BB8Vs9O_.d.mts} +1 -1
- package/dist/{file-B58Dm-2P.mjs → file-_oUZo76X.mjs} +2 -3
- package/dist/{file-B58Dm-2P.mjs.map → file-_oUZo76X.mjs.map} +1 -1
- package/dist/{file-utils-BHPxPXmn.mjs → file-utils-DcyIPFQh.mjs} +2 -3
- package/dist/{file-utils-BHPxPXmn.mjs.map → file-utils-DcyIPFQh.mjs.map} +1 -1
- package/dist/{globals-ByrCoDip.mjs → globals-Crz8o65k.mjs} +53 -5
- package/dist/globals-Crz8o65k.mjs.map +1 -0
- package/dist/http-adapter.generated-WgMnb7Sb.d.mts +580 -0
- package/dist/{iconv-kwrmd1U_.d.mts → iconv-Co-TOPuH.d.mts} +1 -1
- package/dist/{iconv-DreIffeM.mjs → iconv-D2vi8G36.mjs} +2 -3
- package/dist/{iconv-DreIffeM.mjs.map → iconv-D2vi8G36.mjs.map} +1 -1
- package/dist/{idp-Ch95ag8h.mjs → idp-BDbK5gjm.mjs} +2 -3
- package/dist/{idp-Ch95ag8h.mjs.map → idp-BDbK5gjm.mjs.map} +1 -1
- package/dist/{idp-BlBPtXJ-.d.mts → idp-DrhVrLmV.d.mts} +1 -1
- package/dist/{index-QpC0TNbH.d.mts → index-5vPyRu1y.d.mts} +2 -2
- package/dist/{index-Bhjep8cS.d.mts → index-B7AKc18V.d.mts} +2 -2
- package/dist/{index-BdLqzJDu.d.mts → index-BlpzXncY.d.mts} +25 -247
- package/dist/{index-DRhMpdnA.d.mts → index-CK7u9isy.d.mts} +8 -8
- package/dist/{index-CZ2r3qiO.d.mts → index-CNYe5lnW.d.mts} +2 -2
- package/dist/{index-Db2RvnEH.d.mts → index-DjUdWlzf.d.mts} +2 -2
- package/dist/index-ZePLwxw7.d.mts +208 -0
- package/dist/{interceptor-DOqRkCya.mjs → interceptor-D-q1rvRl.mjs} +1 -2
- package/dist/{interceptor-DOqRkCya.mjs.map → interceptor-D-q1rvRl.mjs.map} +1 -1
- package/dist/{job-BpsFXPbi.mjs → job-fuc3j1Ma.mjs} +9 -10
- package/dist/job-fuc3j1Ma.mjs.map +1 -0
- package/dist/kysely/index.mjs +0 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-D1e0Vwkd.mjs → kysely-type-DR8uzZTA.mjs} +2 -3
- package/dist/kysely-type-DR8uzZTA.mjs.map +1 -0
- package/dist/{logger-DpJyJvNz.mjs → logger-CxF-Ex5d.mjs} +1 -2
- package/dist/{logger-DpJyJvNz.mjs.map → logger-CxF-Ex5d.mjs.map} +1 -1
- package/dist/{mock-DMgIygjE.mjs → mock-BjFj5o1I.mjs} +9 -11
- package/dist/mock-BjFj5o1I.mjs.map +1 -0
- package/dist/{multiline-Cf9ODpr1.mjs → multiline-sfHpTZZK.mjs} +1 -2
- package/dist/{multiline-Cf9ODpr1.mjs.map → multiline-sfHpTZZK.mjs.map} +1 -1
- package/dist/{package-json-DcQApfPQ.mjs → package-json-8b0O9TlX.mjs} +1 -2
- package/dist/{package-json-DcQApfPQ.mjs.map → package-json-8b0O9TlX.mjs.map} +1 -1
- package/dist/package-json-Cv2Z-TqQ.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -2
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -2
- package/dist/plugin/index.d.mts +1 -3
- package/dist/plugin/index.mjs +0 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/registry-DdsYlL_P.mjs +51 -0
- package/dist/registry-DdsYlL_P.mjs.map +1 -0
- package/dist/{repl-editor-CJG3sz7A.mjs → repl-editor-DmGr9zMw.mjs} +2 -3
- package/dist/{repl-editor-CJG3sz7A.mjs.map → repl-editor-DmGr9zMw.mjs.map} +1 -1
- package/dist/{chunk-BkoGK1jX.mjs → rolldown-runtime-DXywRVcq.mjs} +0 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/authconnection.mjs +1 -2
- package/dist/runtime/context.d.mts +1 -1
- package/dist/runtime/context.mjs +1 -2
- package/dist/runtime/file.d.mts +1 -1
- package/dist/runtime/file.mjs +1 -2
- package/dist/runtime/globals.d.mts +6 -39
- package/dist/runtime/globals.mjs +0 -1
- package/dist/runtime/iconv.d.mts +1 -1
- package/dist/runtime/iconv.mjs +1 -2
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/idp.mjs +1 -2
- package/dist/runtime/index.d.mts +8 -8
- package/dist/runtime/index.mjs +7 -8
- package/dist/runtime/secretmanager.d.mts +1 -1
- package/dist/runtime/secretmanager.mjs +1 -2
- package/dist/runtime/workflow.d.mts +1 -1
- package/dist/runtime/workflow.mjs +1 -2
- package/dist/{runtime-2nzOZCUb.mjs → runtime-n9NCkjee.mjs} +65 -232
- package/dist/runtime-n9NCkjee.mjs.map +1 -0
- package/dist/{schema-1msIhXwA.mjs → schema-BhkpP5Hw.mjs} +3 -4
- package/dist/schema-BhkpP5Hw.mjs.map +1 -0
- package/dist/{secret-file-CWzF8rry.mjs → secret-file-DBqZhjFQ.mjs} +1 -2
- package/dist/{secret-file-CWzF8rry.mjs.map → secret-file-DBqZhjFQ.mjs.map} +1 -1
- package/dist/{secretmanager-CKLB3wAQ.d.mts → secretmanager-B3n4KHfm.d.mts} +1 -1
- package/dist/{secretmanager-B9h-U_8U.mjs → secretmanager-BVxw3ih_.mjs} +2 -3
- package/dist/{secretmanager-B9h-U_8U.mjs.map → secretmanager-BVxw3ih_.mjs.map} +1 -1
- package/dist/seed/index.mjs +0 -1
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-BH2FbrPV.mjs → seed-jf3008-h.mjs} +5 -16
- package/dist/seed-jf3008-h.mjs.map +1 -0
- package/dist/{service-wI3Hvrgx.mjs → service-CCL8ruDf.mjs} +3 -4
- package/dist/service-CCL8ruDf.mjs.map +1 -0
- package/dist/service-D6yonf2I.mjs +3 -0
- package/dist/{service-DMohAx8a2.mjs → service-DU1mVzri.mjs} +3 -4
- package/dist/service-DU1mVzri.mjs.map +1 -0
- package/dist/{telemetry-BQbbVo2t.mjs → telemetry-CdqJEzkj.mjs} +2 -3
- package/dist/{telemetry-BQbbVo2t.mjs.map → telemetry-CdqJEzkj.mjs.map} +1 -1
- package/dist/telemetry-ClwW5ohF.mjs +3 -0
- package/dist/test-env-key-D9kM6ETE.mjs +49 -0
- package/dist/test-env-key-D9kM6ETE.mjs.map +1 -0
- package/dist/type-source-DH_LH20p.mjs +13 -0
- package/dist/type-source-DH_LH20p.mjs.map +1 -0
- package/dist/{types-CmzfQP_m.mjs → types-B2RpYyA_.mjs} +2 -3
- package/dist/types-B2RpYyA_.mjs.map +1 -0
- package/dist/types-ClhIrW_C.mjs +4 -0
- package/dist/{tailordb-C-ar4XCX.d.mts → types-DCUhgpyI.d.mts} +142 -221
- package/dist/{plugin-DylAsA4Z.d.mts → types-DhO_VEZd.d.mts} +119 -179
- package/dist/types-DwDgacni.d.mts +338 -0
- package/dist/utils/test/index.d.mts +4 -3
- package/dist/utils/test/index.mjs +1 -2
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -2
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +42 -5
- package/dist/vitest/index.mjs +133 -4
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/setup.mjs +2 -3
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/{workflow-CMamswkK.d.mts → workflow-BbKvGLQg.d.mts} +1 -1
- package/dist/{workflow--aPbA8Uq.mjs → workflow-DgemCAz3.mjs} +2 -3
- package/dist/{workflow--aPbA8Uq.mjs.map → workflow-DgemCAz3.mjs.map} +1 -1
- package/dist/workflow.generated-DtQwEo-x.d.mts +671 -0
- package/docs/cli/application.md +0 -2
- package/docs/cli/crashreport.md +0 -2
- package/docs/cli/function.md +1 -1
- package/docs/cli/user.md +3 -3
- package/docs/cli/workspace.md +3 -3
- package/docs/configuration.md +0 -2
- package/docs/plugin/custom.md +2 -2
- package/docs/plugin/index.md +1 -1
- package/docs/runtime.md +3 -3
- package/docs/services/auth.md +0 -2
- package/docs/services/executor.md +0 -2
- package/docs/services/resolver.md +2 -4
- package/docs/services/tailordb.md +1 -1
- package/docs/services/workflow.md +13 -15
- package/docs/testing.md +18 -11
- package/package.json +9 -8
- package/dist/actor-D_2aJjYO.d.mts +0 -24
- package/dist/application-DGDmL8i_.mjs.map +0 -1
- package/dist/application-nTydHJm8.mjs +0 -4
- package/dist/cli/skills.d.mts +0 -1
- package/dist/cli/skills.mjs +0 -22
- package/dist/cli/skills.mjs.map +0 -1
- package/dist/client-F0a4cWUM.mjs.map +0 -1
- package/dist/enum-constants-C7DaWeQo.mjs.map +0 -1
- package/dist/env-B-g-qgE4.d.mts +0 -7
- package/dist/field-C4zdJLW5.mjs.map +0 -1
- package/dist/globals-ByrCoDip.mjs.map +0 -1
- package/dist/job-BpsFXPbi.mjs.map +0 -1
- package/dist/kysely-type-D1e0Vwkd.mjs.map +0 -1
- package/dist/mock-DMgIygjE.mjs.map +0 -1
- package/dist/package-json-wzO6nV9O.mjs +0 -4
- package/dist/registry-D0uB0OrK.mjs +0 -178
- package/dist/registry-D0uB0OrK.mjs.map +0 -1
- package/dist/runtime-2nzOZCUb.mjs.map +0 -1
- package/dist/schema-1msIhXwA.mjs.map +0 -1
- package/dist/seed-BH2FbrPV.mjs.map +0 -1
- package/dist/service-BHQIerYh.mjs +0 -4
- package/dist/service-DMohAx8a2.mjs.map +0 -1
- package/dist/service-wI3Hvrgx.mjs.map +0 -1
- package/dist/telemetry-w92bvGdC.mjs +0 -4
- package/dist/types-2Be3wSMc.mjs +0 -5
- package/dist/types-CmzfQP_m.mjs.map +0 -1
- package/dist/workflow.generated--1Qc15Et.d.mts +0 -1471
- package/docs/generator/builtin.md +0 -257
- package/docs/generator/custom.md +0 -147
- package/docs/generator/index.md +0 -66
package/docs/cli/function.md
CHANGED
|
@@ -209,7 +209,7 @@ $ tailor-sdk function logs <execution-id> --json
|
|
|
209
209
|
|
|
210
210
|
When viewing a specific execution that failed, the command displays error details with the stack trace mapped back to your original source files (clickable file links and code snippets, matching `function test-run` output).
|
|
211
211
|
|
|
212
|
-
Stack traces
|
|
212
|
+
Stack traces are mapped only when the execution includes a content hash for the exact build that ran. If the content hash is missing or the build is no longer available, the command falls back to a plain-text error display.
|
|
213
213
|
|
|
214
214
|
<!-- politty:command:function logs:notes:end -->
|
|
215
215
|
|
package/docs/cli/user.md
CHANGED
|
@@ -201,9 +201,9 @@ tailor-sdk user switch <user>
|
|
|
201
201
|
|
|
202
202
|
**Arguments**
|
|
203
203
|
|
|
204
|
-
| Argument | Description
|
|
205
|
-
| -------- |
|
|
206
|
-
| `user` | User email
|
|
204
|
+
| Argument | Description | Required |
|
|
205
|
+
| -------- | -------------------------------------------- | -------- |
|
|
206
|
+
| `user` | User email address or machine user client ID | Yes |
|
|
207
207
|
|
|
208
208
|
<!-- politty:command:user switch:arguments:end -->
|
|
209
209
|
|
package/docs/cli/workspace.md
CHANGED
|
@@ -79,7 +79,7 @@ tailor-sdk workspace create [options]
|
|
|
79
79
|
| `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID to workspace associate with | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
|
|
80
80
|
| `--folder-id <FOLDER_ID>` | `-f` | Folder ID to workspace associate with | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
|
|
81
81
|
| `--profile-name <PROFILE_NAME>` | `-p` | Profile name to create | No | - | - |
|
|
82
|
-
| `--profile-user <PROFILE_USER>` | - | User email for the profile (defaults to current user)
|
|
82
|
+
| `--profile-user <PROFILE_USER>` | - | User email address or machine user client ID for the profile (defaults to current user) | No | - | - |
|
|
83
83
|
| `--permission <PERMISSION>` | - | Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
|
|
84
84
|
|
|
85
85
|
<!-- politty:command:workspace create:options:end -->
|
|
@@ -243,7 +243,7 @@ tailor-sdk profile create [options] <name>
|
|
|
243
243
|
|
|
244
244
|
| Option | Alias | Description | Required | Default |
|
|
245
245
|
| ------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- |
|
|
246
|
-
| `--user <USER>` | `-u` | User email
|
|
246
|
+
| `--user <USER>` | `-u` | User email address or machine user client ID | Yes | - |
|
|
247
247
|
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | Yes | - |
|
|
248
248
|
| `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands while the profile is active. | No | `"write"` |
|
|
249
249
|
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). | No | - |
|
|
@@ -324,7 +324,7 @@ tailor-sdk profile update [options] <name>
|
|
|
324
324
|
|
|
325
325
|
| Option | Alias | Description | Required | Default |
|
|
326
326
|
| ------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
|
|
327
|
-
| `--user <USER>` | `-u` | New user email
|
|
327
|
+
| `--user <USER>` | `-u` | New user email address or machine user client ID | No | - |
|
|
328
328
|
| `--workspace-id <WORKSPACE_ID>` | `-w` | New workspace ID | No | - |
|
|
329
329
|
| `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands; 'write' lifts the restriction. | No | - |
|
|
330
330
|
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). Pass an empty string to clear. | No | - |
|
package/docs/configuration.md
CHANGED
package/docs/plugin/custom.md
CHANGED
|
@@ -18,7 +18,7 @@ const myPlugin: Plugin = {
|
|
|
18
18
|
export default myPlugin; // Required: must be default export
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
This is required so that
|
|
21
|
+
This is required so that other plugins and generation-time hooks can use plugin-generated TailorDB types via `getGeneratedType()`.
|
|
22
22
|
|
|
23
23
|
## Plugin Interface
|
|
24
24
|
|
|
@@ -276,7 +276,7 @@ import type {
|
|
|
276
276
|
|
|
277
277
|
## getGeneratedType Helper
|
|
278
278
|
|
|
279
|
-
The SDK provides an async `getGeneratedType()` helper function to retrieve plugin-generated TailorDB types. This enables
|
|
279
|
+
The SDK provides an async `getGeneratedType()` helper function to retrieve plugin-generated TailorDB types. This enables plugins and other tools to work with types generated by plugins.
|
|
280
280
|
|
|
281
281
|
```typescript
|
|
282
282
|
import { join } from "node:path";
|
package/docs/plugin/index.md
CHANGED
|
@@ -149,7 +149,7 @@ These hooks produce TailorDB types, resolvers, and executors that become part of
|
|
|
149
149
|
| `onResolverReady` | TailorDB types, Resolvers, Auth | Write output files |
|
|
150
150
|
| `onExecutorReady` | TailorDB types, Resolvers, Executors, Auth | Write output files |
|
|
151
151
|
|
|
152
|
-
These hooks receive all finalized data and produce output files (TypeScript code, etc.).
|
|
152
|
+
These hooks receive all finalized data and produce output files (TypeScript code, etc.). No `importPath` required.
|
|
153
153
|
|
|
154
154
|
A plugin can implement hooks from either or both phases.
|
|
155
155
|
|
package/docs/runtime.md
CHANGED
|
@@ -50,9 +50,7 @@ import type { ListUsersResponse, ClientConfig } from "@tailor-platform/sdk/runti
|
|
|
50
50
|
|
|
51
51
|
Most users do not need to touch the globals entry — `@tailor-platform/sdk/runtime` (and its subpath modules) cover the same surface without depending on any ambient declaration.
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
If you want to opt into the globals explicitly (or you are migrating ahead of v2.0), add a single side-effect import anywhere in your project:
|
|
53
|
+
Importing from `@tailor-platform/sdk` does not activate the ambient `tailor.*` / `tailordb.*` declarations. If you want to opt into the globals, add a single side-effect import anywhere in your project:
|
|
56
54
|
|
|
57
55
|
```ts
|
|
58
56
|
import "@tailor-platform/sdk/runtime/globals";
|
|
@@ -68,6 +66,8 @@ Or register the entry in `tsconfig.json`:
|
|
|
68
66
|
}
|
|
69
67
|
```
|
|
70
68
|
|
|
69
|
+
The globals entry exposes the lowercase `tailordb.*` namespace only. If your project still references the removed capital-cased `Tailordb.*` namespace from `@tailor-platform/function-types`, migrate before upgrading in two steps: run `pnpm dlx @tailor-platform/sdk-codemod v2/tailordb-namespace` to rewrite `Tailordb.*` references to lowercase `tailordb.*`, then add the `import "@tailor-platform/sdk/runtime/globals"` opt-in above so the rewritten references resolve.
|
|
70
|
+
|
|
71
71
|
## Namespaces
|
|
72
72
|
|
|
73
73
|
The runtime entry re-exports the following namespaces. Detailed signatures, parameters, and return types live in the JSDoc next to each export — hover the symbol in your IDE or browse the source.
|
package/docs/services/auth.md
CHANGED
|
@@ -310,8 +310,6 @@ export default createResolver({
|
|
|
310
310
|
|
|
311
311
|
Type narrowing is provided by the generated `tailor.d.ts` (the `MachineUserNameRegistry` interface). Run `tailor-sdk generate` (or `apply`) after defining new machine users to refresh it.
|
|
312
312
|
|
|
313
|
-
> **Deprecated:** The `auth.invoker("<name>")` helper is still available for backward compatibility. Prefer the string form — it does not require importing `auth` from `tailor.config.ts` into runtime files, avoiding bundling config-layer (Node-only) dependencies.
|
|
314
|
-
|
|
315
313
|
## OAuth 2.0 Clients
|
|
316
314
|
|
|
317
315
|
Configure OAuth 2.0 clients for third-party applications:
|
|
@@ -347,8 +347,6 @@ export default createExecutor({
|
|
|
347
347
|
});
|
|
348
348
|
```
|
|
349
349
|
|
|
350
|
-
> **Deprecated:** `auth.invoker("batch-processor")` still works, but is deprecated. Prefer the string form to avoid importing config-layer modules into runtime files.
|
|
351
|
-
|
|
352
350
|
## Event Payloads
|
|
353
351
|
|
|
354
352
|
Each trigger type provides specific context data in the callback functions.
|
|
@@ -240,7 +240,7 @@ Define actual resolver logic in the `body` function. Function arguments include:
|
|
|
240
240
|
|
|
241
241
|
### Using Kysely for Database Access
|
|
242
242
|
|
|
243
|
-
If you're generating Kysely types with
|
|
243
|
+
If you're generating Kysely types with `kyselyTypePlugin`, you can use `getDB` to execute typed queries:
|
|
244
244
|
|
|
245
245
|
```typescript
|
|
246
246
|
import { getDB } from "../generated/tailordb";
|
|
@@ -306,7 +306,7 @@ createResolver({
|
|
|
306
306
|
|
|
307
307
|
- When `publishEvents: true`, resolver execution events are published
|
|
308
308
|
- When not specified, it is **automatically set to `true`** if an executor uses this resolver with `resolverExecutedTrigger`
|
|
309
|
-
- When explicitly set to `false` while an executor uses this resolver, an error is thrown during `tailor
|
|
309
|
+
- When explicitly set to `false` while an executor uses this resolver, an error is thrown during `tailor-sdk deploy`
|
|
310
310
|
|
|
311
311
|
**Use cases:**
|
|
312
312
|
|
|
@@ -371,6 +371,4 @@ export default createResolver({
|
|
|
371
371
|
|
|
372
372
|
The machine user name is looked up in the auth service configured on your app (`machineUsers` in `defineAuth`). The namespace is resolved automatically — no need to import `auth` from `tailor.config.ts` in resolver files.
|
|
373
373
|
|
|
374
|
-
> **Deprecated:** `auth.invoker("batch-processor")` still works, but is deprecated. Importing `auth` into runtime files pulls config-layer (Node-only) dependencies into the bundle.
|
|
375
|
-
|
|
376
374
|
**Note:** `authInvoker` controls the permissions for database operations and other platform actions. The `user` object passed to `body` still reflects the original caller, while `invoker` reflects the principal actually running the body.
|
|
@@ -461,7 +461,7 @@ db.type("User", {
|
|
|
461
461
|
|
|
462
462
|
- When `publishEvents: true`, record creation/update/deletion events are published
|
|
463
463
|
- When not specified, it is **automatically set to `true`** if an executor uses this type with `recordCreatedTrigger`, `recordUpdatedTrigger`, or `recordDeletedTrigger`
|
|
464
|
-
- When explicitly set to `false` while an executor uses this type, an error is thrown during `tailor
|
|
464
|
+
- When explicitly set to `false` while an executor uses this type, an error is thrown during `tailor-sdk deploy`
|
|
465
465
|
|
|
466
466
|
**Use cases:**
|
|
467
467
|
|
|
@@ -105,11 +105,11 @@ import { sendNotification } from "./jobs/send-notification";
|
|
|
105
105
|
|
|
106
106
|
export const mainJob = createWorkflowJob({
|
|
107
107
|
name: "main-job",
|
|
108
|
-
body:
|
|
109
|
-
const customer =
|
|
108
|
+
body: (input: { customerId: string }) => {
|
|
109
|
+
const customer = fetchCustomer.trigger({
|
|
110
110
|
customerId: input.customerId,
|
|
111
111
|
});
|
|
112
|
-
const notification =
|
|
112
|
+
const notification = sendNotification.trigger({
|
|
113
113
|
message: "Order processed",
|
|
114
114
|
recipient: customer.email,
|
|
115
115
|
});
|
|
@@ -130,31 +130,31 @@ Using `.trigger()` inside a loop works correctly, as long as the loop is determi
|
|
|
130
130
|
// ✅ OK: deterministic loop — same calls in the same order on every execution
|
|
131
131
|
const regions = ["us", "eu", "ap"];
|
|
132
132
|
for (const region of regions) {
|
|
133
|
-
const result =
|
|
133
|
+
const result = fetchData.trigger({ region });
|
|
134
134
|
results.push(result);
|
|
135
135
|
}
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
```typescript
|
|
139
139
|
// ❌ Bad: non-deterministic — argument changes between executions
|
|
140
|
-
|
|
140
|
+
processJob.trigger({ timestamp: Date.now() });
|
|
141
141
|
|
|
142
142
|
// ✅ OK: call Date.now() in separated job
|
|
143
|
-
const timestamp =
|
|
144
|
-
|
|
143
|
+
const timestamp = timestampJob.trigger();
|
|
144
|
+
processJob.trigger({ timestamp });
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
```typescript
|
|
148
148
|
// ❌ Bad: non-deterministic — external data may change between executions
|
|
149
149
|
const items = await fetch("https://api.example.com/items").then((r) => r.json());
|
|
150
150
|
for (const item of items) {
|
|
151
|
-
|
|
151
|
+
processItem.trigger({ id: item.id });
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// ✅ OK: call fetch("https://api.example.com/items").then((r) => r.json()); in separated job
|
|
155
|
-
const items =
|
|
155
|
+
const items = fetchItemsJob.trigger();
|
|
156
156
|
for (const item of items) {
|
|
157
|
-
|
|
157
|
+
processItem.trigger({ id: item.id });
|
|
158
158
|
}
|
|
159
159
|
```
|
|
160
160
|
|
|
@@ -178,15 +178,15 @@ import { sendNotification } from "./jobs/send-notification";
|
|
|
178
178
|
// Jobs must be named exports
|
|
179
179
|
export const processOrder = createWorkflowJob({
|
|
180
180
|
name: "process-order",
|
|
181
|
-
body:
|
|
181
|
+
body: (input: { customerId: string }, { env, invoker }) => {
|
|
182
182
|
// `env` contains values from `tailor.config.ts` -> `env`.
|
|
183
183
|
// `invoker` is the principal running this job, overridden by `authInvoker`
|
|
184
184
|
// when set; `null` for anonymous calls.
|
|
185
185
|
// Trigger other jobs by calling .trigger() on the job object.
|
|
186
|
-
const customer =
|
|
186
|
+
const customer = fetchCustomer.trigger({
|
|
187
187
|
customerId: input.customerId,
|
|
188
188
|
});
|
|
189
|
-
|
|
189
|
+
sendNotification.trigger({
|
|
190
190
|
message: "Order processed",
|
|
191
191
|
recipient: customer.email,
|
|
192
192
|
});
|
|
@@ -383,8 +383,6 @@ export default createResolver({
|
|
|
383
383
|
});
|
|
384
384
|
```
|
|
385
385
|
|
|
386
|
-
> **Deprecated:** `auth.invoker("manager-machine-user")` still works but is deprecated. Using the string form avoids importing `auth` into runtime code.
|
|
387
|
-
|
|
388
386
|
See the full working example in the repository: [example/resolvers/triggerWorkflow.ts](https://github.com/tailor-platform/sdk/blob/main/example/resolvers/triggerWorkflow.ts).
|
|
389
387
|
|
|
390
388
|
## File Organization
|
package/docs/testing.md
CHANGED
|
@@ -12,7 +12,9 @@ Lean on unit tests for the day-to-day feedback loop — they run fast and exerci
|
|
|
12
12
|
Unit-test entrypoints exposed by the SDK:
|
|
13
13
|
|
|
14
14
|
- `resolver.body({ input, user, env })` — invoke a resolver
|
|
15
|
-
- `workflowJob.body(input, { env })`
|
|
15
|
+
- `workflowJob.body(input, { env })` — invoke a workflow job body directly
|
|
16
|
+
- `workflowJob.trigger(input)` — chain a workflow job through the workflow runtime
|
|
17
|
+
- `runWorkflowLocally(workflow, args)` — run a workflow chain locally with real job bodies
|
|
16
18
|
- `executor.operation.body(args)` — invoke a function-kind executor
|
|
17
19
|
|
|
18
20
|
Helpers under `@tailor-platform/sdk/test`:
|
|
@@ -23,6 +25,7 @@ Platform API mocks under `@tailor-platform/sdk/vitest` (for use with the [`tailo
|
|
|
23
25
|
|
|
24
26
|
- `mockTailordb` — TailorDB query stubs and call recording
|
|
25
27
|
- `mockWorkflow` — `tailor.workflow` job / wait / resolve mocks
|
|
28
|
+
- `runWorkflowLocally` — local full-chain workflow runner
|
|
26
29
|
- `mockSecretmanager`, `mockAuthconnection`, `mockIdp`, `mockFile`, `mockIconv` — corresponding platform API mocks
|
|
27
30
|
|
|
28
31
|
For tighter alignment with the production runtime — Node.js module blocking, Web-only globals, and platform API mocks — pair the resolver helpers with the [`tailor-runtime` Vitest environment](#runtime-environment-emulation-beta) below.
|
|
@@ -126,7 +129,7 @@ test("content-based mock", async () => {
|
|
|
126
129
|
|
|
127
130
|
### Workflow Mock
|
|
128
131
|
|
|
129
|
-
`.trigger()`
|
|
132
|
+
Workflow job `.trigger()` calls use the platform workflow runtime. Acquire `mockWorkflow()` when you want to provide trigger responses with `setJobHandler` / `enqueueResult` or assert on `triggeredJobs`. If no response is configured, the mock throws so missing job mocks fail loudly:
|
|
130
133
|
|
|
131
134
|
```typescript
|
|
132
135
|
import { mockWorkflow } from "@tailor-platform/sdk/vitest";
|
|
@@ -645,16 +648,16 @@ import { fulfillOrder, processPayment, sendConfirmation, validateOrder } from ".
|
|
|
645
648
|
|
|
646
649
|
describe("fulfillOrder", () => {
|
|
647
650
|
test("chains validate → pay → confirm", async () => {
|
|
648
|
-
using _validateSpy = vi.spyOn(validateOrder, "trigger").
|
|
651
|
+
using _validateSpy = vi.spyOn(validateOrder, "trigger").mockReturnValue({
|
|
649
652
|
valid: true,
|
|
650
653
|
orderId: "order-1",
|
|
651
654
|
});
|
|
652
|
-
using _paymentSpy = vi.spyOn(processPayment, "trigger").
|
|
655
|
+
using _paymentSpy = vi.spyOn(processPayment, "trigger").mockReturnValue({
|
|
653
656
|
transactionId: "txn-order-1",
|
|
654
657
|
amount: 100,
|
|
655
658
|
status: "completed",
|
|
656
659
|
});
|
|
657
|
-
using _confirmSpy = vi.spyOn(sendConfirmation, "trigger").
|
|
660
|
+
using _confirmSpy = vi.spyOn(sendConfirmation, "trigger").mockReturnValue({
|
|
658
661
|
orderId: "order-1",
|
|
659
662
|
transactionId: "txn-order-1",
|
|
660
663
|
confirmed: true,
|
|
@@ -708,22 +711,27 @@ describe("processWithApproval", () => {
|
|
|
708
711
|
|
|
709
712
|
#### Running a full workflow locally
|
|
710
713
|
|
|
711
|
-
To exercise the full chain with real job bodies,
|
|
714
|
+
To exercise the full chain with real job bodies, call `runWorkflowLocally(workflow, args)`. Dependent jobs run their real `.body()` functions, and trigger args/results cross the same JSON boundary as the platform, so a non-serializable payload fails the test exactly as it would in production:
|
|
712
715
|
|
|
713
716
|
```typescript
|
|
717
|
+
import { runWorkflowLocally } from "@tailor-platform/sdk/vitest";
|
|
714
718
|
import { describe, expect, test } from "vitest";
|
|
715
719
|
import workflow from "./order-fulfillment";
|
|
716
720
|
|
|
717
721
|
describe("order-fulfillment workflow", () => {
|
|
718
|
-
test("
|
|
719
|
-
const result = await workflow
|
|
722
|
+
test("runWorkflowLocally() executes all jobs", async () => {
|
|
723
|
+
const result = await runWorkflowLocally(workflow, { orderId: "order-3", amount: 300 });
|
|
720
724
|
|
|
721
725
|
expect(result).toMatchObject({ confirmed: true, paymentStatus: "completed" });
|
|
722
726
|
});
|
|
723
727
|
});
|
|
724
728
|
```
|
|
725
729
|
|
|
726
|
-
|
|
730
|
+
Pass `{ env }` as the third argument when job bodies need configuration values during the local run.
|
|
731
|
+
|
|
732
|
+
Like the platform runtime, the local runner re-runs the orchestrator body once per `.trigger()` call (N triggers means N+1 passes), so any side effects outside the trigger results fire on every pass. Keep the body deterministic and move repeatable side effects into the triggered jobs.
|
|
733
|
+
|
|
734
|
+
This helper is still a local runner. Use E2E tests when you need to verify deployed workflow scheduling, suspension, or replay behavior.
|
|
727
735
|
|
|
728
736
|
**Use when:** you want to verify orchestration end to end without the cost of a real deployment.
|
|
729
737
|
|
|
@@ -823,14 +831,13 @@ Use `startWorkflow` from the CLI helpers. It starts the workflow on the deployed
|
|
|
823
831
|
import { randomUUID } from "node:crypto";
|
|
824
832
|
import { startWorkflow } from "@tailor-platform/sdk/cli";
|
|
825
833
|
import { describe, expect, test } from "vitest";
|
|
826
|
-
import config from "../tailor.config";
|
|
827
834
|
import userProfileSync from "../src/workflow/sync-profile";
|
|
828
835
|
|
|
829
836
|
describe("user-profile-sync workflow", () => {
|
|
830
837
|
test("executes end to end", { timeout: 180_000 }, async () => {
|
|
831
838
|
const { executionId, wait } = await startWorkflow({
|
|
832
839
|
workflow: userProfileSync,
|
|
833
|
-
authInvoker:
|
|
840
|
+
authInvoker: "admin",
|
|
834
841
|
arg: {
|
|
835
842
|
name: "workflow-test",
|
|
836
843
|
email: `wf-${randomUUID()}@example.com`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.1",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
"directory": "packages/sdk"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
|
-
"tailor-sdk": "./dist/cli/index.mjs"
|
|
13
|
-
"tailor-sdk-skills": "./dist/cli/skills.mjs"
|
|
12
|
+
"tailor-sdk": "./dist/cli/index.mjs"
|
|
14
13
|
},
|
|
15
14
|
"files": [
|
|
16
15
|
"CHANGELOG.md",
|
|
@@ -139,8 +138,8 @@
|
|
|
139
138
|
"@badgateway/oauth2-client": "3.3.1",
|
|
140
139
|
"@bufbuild/protobuf": "2.12.0",
|
|
141
140
|
"@bufbuild/protovalidate": "1.2.0",
|
|
142
|
-
"@connectrpc/connect": "2.1.
|
|
143
|
-
"@connectrpc/connect-node": "2.1.
|
|
141
|
+
"@connectrpc/connect": "2.1.2",
|
|
142
|
+
"@connectrpc/connect-node": "2.1.2",
|
|
144
143
|
"@inquirer/core": "11.2.1",
|
|
145
144
|
"@inquirer/prompts": "8.5.2",
|
|
146
145
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
@@ -160,10 +159,10 @@
|
|
|
160
159
|
"chokidar": "5.0.0",
|
|
161
160
|
"confbox": "0.2.4",
|
|
162
161
|
"date-fns": "4.4.0",
|
|
163
|
-
"es-toolkit": "1.47.
|
|
162
|
+
"es-toolkit": "1.47.1",
|
|
164
163
|
"find-up-simple": "1.0.1",
|
|
165
164
|
"globals": "17.6.0",
|
|
166
|
-
"graphql": "16.14.
|
|
165
|
+
"graphql": "16.14.2",
|
|
167
166
|
"inflection": "3.0.2",
|
|
168
167
|
"kysely": "0.29.2",
|
|
169
168
|
"madge": "8.0.0",
|
|
@@ -175,7 +174,7 @@
|
|
|
175
174
|
"pgsql-ast-parser": "12.0.2",
|
|
176
175
|
"pkg-types": "2.3.1",
|
|
177
176
|
"politty": "0.6.0",
|
|
178
|
-
"rolldown": "1.1.
|
|
177
|
+
"rolldown": "1.1.1",
|
|
179
178
|
"semver": "7.8.4",
|
|
180
179
|
"sql-highlight": "6.1.0",
|
|
181
180
|
"std-env": "4.1.0",
|
|
@@ -230,6 +229,8 @@
|
|
|
230
229
|
"build": "tsdown && politty generate-worker --bin dist/cli/index.mjs --program tailor-sdk --shell zsh --verify",
|
|
231
230
|
"lint": "oxlint --type-aware .",
|
|
232
231
|
"check:public-api-jsdoc": "tsx scripts/check-public-api-jsdoc.ts",
|
|
232
|
+
"check:zod-isolation": "tsx scripts/check-zod-isolation.ts",
|
|
233
|
+
"check:import-cycles": "tsx scripts/check-import-cycles.ts",
|
|
233
234
|
"lint:fix": "oxlint --type-aware . --fix",
|
|
234
235
|
"typecheck": "tsc --noEmit",
|
|
235
236
|
"typecheck:go": "tsgo",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { A as InferredAttributeList, j as InferredAttributeMap } from "./tailordb-C-ar4XCX.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/types/actor.d.ts
|
|
4
|
-
/** User type enum values from the Tailor Platform server. */
|
|
5
|
-
type TailorActorType = "USER_TYPE_USER" | "USER_TYPE_MACHINE_USER" | "USER_TYPE_UNSPECIFIED";
|
|
6
|
-
/** Represents an actor in event triggers. */
|
|
7
|
-
type TailorActor = {
|
|
8
|
-
/** The ID of the workspace the user belongs to. */workspaceId: string; /** The ID of the user. */
|
|
9
|
-
userId: string;
|
|
10
|
-
/**
|
|
11
|
-
* A map of the user's attributes.
|
|
12
|
-
* Maps from server's `attributeMap` field.
|
|
13
|
-
*/
|
|
14
|
-
attributes: InferredAttributeMap | null;
|
|
15
|
-
/**
|
|
16
|
-
* A list of the user's attributes.
|
|
17
|
-
* Maps from server's `attributes` field.
|
|
18
|
-
*/
|
|
19
|
-
attributeList: InferredAttributeList; /** The type of the user. */
|
|
20
|
-
userType: TailorActorType;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { TailorActor as t };
|
|
24
|
-
//# sourceMappingURL=actor-D_2aJjYO.d.mts.map
|