@tailor-platform/sdk 1.70.1 → 1.72.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 (41) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/{authconnection-BIYzEh2p.d.mts → authconnection-CqfaJfrC.d.mts} +8 -15
  3. package/dist/{authconnection-Ds2Ahpum.mjs → authconnection-D7lsvsKY.mjs} +2 -2
  4. package/dist/authconnection-D7lsvsKY.mjs.map +1 -0
  5. package/dist/cli/index.mjs +781 -185
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +7 -6
  8. package/dist/cli/lib.mjs +1 -1
  9. package/dist/completion/zsh-worker.zsh +124 -25
  10. package/dist/configure/index.d.mts +5 -4
  11. package/dist/configure/index.mjs.map +1 -1
  12. package/dist/{index-C-vsbx27.d.mts → index-BDBU7x-i.d.mts} +2 -2
  13. package/dist/{index-dKNk8hjo.d.mts → index-BSlv_YrG.d.mts} +2 -2
  14. package/dist/{index-BAEaAqmz.d.mts → index-BzGqTY5x.d.mts} +16 -4
  15. package/dist/{index-CKI0eZP6.d.mts → index-D3_Au3wu.d.mts} +2 -2
  16. package/dist/{index-CrqOgUF2.d.mts → index-DtFRlrww.d.mts} +2 -2
  17. package/dist/{index-DESLU9kI.d.mts → index-jeE3UvF2.d.mts} +2 -2
  18. package/dist/mock-wf5qeZLi.mjs.map +1 -1
  19. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  20. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  21. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  22. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  23. package/dist/runtime/authconnection.d.mts +1 -1
  24. package/dist/runtime/authconnection.mjs +1 -1
  25. package/dist/runtime/globals.d.mts +1 -1
  26. package/dist/runtime/index.d.mts +2 -2
  27. package/dist/runtime/index.mjs +1 -1
  28. package/dist/{runtime-BpHVwifd.mjs → runtime-Cd375HD-.mjs} +23 -10
  29. package/dist/runtime-Cd375HD-.mjs.map +1 -0
  30. package/dist/{types-Dynq4AJv.d.mts → types-aqnqTCfO.d.mts} +4 -342
  31. package/dist/types-v_ErzNUF.d.mts +345 -0
  32. package/dist/utils/test/index.d.mts +2 -2
  33. package/dist/vitest/index.d.mts +4 -3
  34. package/dist/{workflow.generated-DJULCuRr.d.mts → workflow.generated-Da1zECDw.d.mts} +3 -2
  35. package/docs/cli/setup.md +129 -19
  36. package/docs/cli-reference.md +9 -4
  37. package/docs/services/auth.md +10 -8
  38. package/docs/testing.md +1 -1
  39. package/package.json +1 -1
  40. package/dist/authconnection-Ds2Ahpum.mjs.map +0 -1
  41. package/dist/runtime-BpHVwifd.mjs.map +0 -1
@@ -308,7 +308,7 @@ export default createResolver({
308
308
  });
309
309
  ```
310
310
 
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.
311
+ Type narrowing is provided by the generated `tailor.d.ts` (the `MachineUserNameRegistry` interface). Run `tailor-sdk generate` (or `deploy`) after defining new machine users to refresh it.
312
312
 
313
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
314
 
@@ -365,7 +365,7 @@ See [IdP](./idp.md) for configuring identity providers.
365
365
 
366
366
  ## Auth Connections
367
367
 
368
- Auth connections enable OAuth2 authentication with external providers (Google, Microsoft 365, QuickBooks, etc.) for application-to-application flows. Functions can access connection tokens at runtime via `tailor.authconnection.getConnectionToken()`.
368
+ Auth connections enable OAuth2 authentication with external providers (Google, Microsoft 365, QuickBooks, etc.) for application-to-application flows. Functions can access connection tokens at runtime via `authconnection.getConnectionToken()` (from `@tailor-platform/sdk/runtime`).
369
369
 
370
370
  For the official Tailor Platform documentation, see [AuthConnection Guide](https://docs.tailor.tech/guides/auth/authconnection).
371
371
 
@@ -429,23 +429,25 @@ The authorize command opens a browser for the OAuth2 flow. The authorization cod
429
429
  | `authUrl` | `string` | No | Override for the authorization endpoint. |
430
430
  | `tokenUrl` | `string` | No | Override for the token endpoint. |
431
431
 
432
- ### `auth.getConnectionToken()`
432
+ ### Retrieving Connection Tokens
433
433
 
434
- `auth.getConnectionToken()` retrieves connection tokens at runtime by calling `tailor.authconnection.getConnectionToken()` internally. When `connections` is defined in `defineAuth()`, the connection name is type-checked and autocompleted against the defined keys:
434
+ Use `authconnection.getConnectionToken()` from `@tailor-platform/sdk/runtime` to retrieve connection tokens at runtime. The connection name is type-checked and autocompleted against the connections defined in `defineAuth()`'s `connections`:
435
435
 
436
436
  ```typescript
437
- import { auth } from "../tailor.config";
437
+ import { authconnection } from "@tailor-platform/sdk/runtime";
438
438
 
439
439
  // In a resolver, executor, or workflow:
440
- const tokens = await auth.getConnectionToken("google-connection");
440
+ const tokens = await authconnection.getConnectionToken("google-connection");
441
441
  const response = await fetch("https://www.googleapis.com/...", {
442
442
  headers: { Authorization: `Bearer ${tokens.access_token}` },
443
443
  });
444
444
 
445
- // auth.getConnectionToken("unknown"); // Type error — only "google-connection" is allowed
445
+ // authconnection.getConnectionToken("unknown"); // Type error — only "google-connection" is allowed
446
446
  ```
447
447
 
448
- When `connections` is not defined, `getConnectionToken()` accepts any string. This supports connections managed entirely via the CLI.
448
+ Type narrowing is provided by the generated `tailor.d.ts` (the `ConnectionNameRegistry` interface). Run `tailor-sdk generate` (or `deploy`) after defining new connections to refresh it. Before the first generate, or when `connections` is not defined in `defineAuth()`, `getConnectionToken()` accepts any string this also supports connections managed entirely via the CLI.
449
+
450
+ > **Deprecated:** `auth.getConnectionToken("<name>")` still works, but is deprecated. Importing `auth` from `tailor.config.ts` into runtime files pulls config-layer (Node-only) dependencies into the bundle.
449
451
 
450
452
  See [Built-in Interfaces](https://docs.tailor.tech/guides/function/builtin-interfaces.html#auth-connection) for the full runtime API.
451
453
 
package/docs/testing.md CHANGED
@@ -185,7 +185,7 @@ import { mockAuthconnection } from "@tailor-platform/sdk/vitest";
185
185
  test("returns configured token", async () => {
186
186
  using ac = mockAuthconnection();
187
187
  ac.setTokens({
188
- google: { access_token: "ya29.xxx", expires_in: 3600 },
188
+ google: { access_token: "ya29.xxx" },
189
189
  });
190
190
 
191
191
  const token = await tailor.authconnection.getConnectionToken("google");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.70.1",
3
+ "version": "1.72.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"authconnection-Ds2Ahpum.mjs","names":[],"sources":["../src/runtime/authconnection.ts"],"sourcesContent":["/**\n * Auth connection utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.authconnection` runtime API.\n * At runtime this delegates to `globalThis.tailor.authconnection`. Use\n * `mockAuthconnection` from `@tailor-platform/sdk/vitest` to mock in unit tests.\n * @example\n * import { authconnection } from \"@tailor-platform/sdk/runtime\";\n *\n * const token = await authconnection.getConnectionToken(\"my-connection\");\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Platform API surface for `tailor.authconnection`. Describes the shape the\n * platform runtime injects on `globalThis.tailor.authconnection`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as authconnection from\n * \"@tailor-platform/sdk/runtime/authconnection\"` or pick individual methods.\n */\nexport interface TailorAuthconnectionAPI {\n /**\n * Returns the access token for the given auth connection.\n * @param connectionName - Auth connection name as defined in tailor.config\n * @returns Token payload (provider-specific shape)\n */\n getConnectionToken(connectionName: string): Promise<any>;\n}\n\nconst api = (): TailorAuthconnectionAPI =>\n (globalThis as { tailor: { authconnection: TailorAuthconnectionAPI } }).tailor.authconnection;\n\n/**\n * See {@link TailorAuthconnectionAPI.getConnectionToken}.\n * @param args - Forwarded to {@link TailorAuthconnectionAPI.getConnectionToken}\n * @returns Token payload (provider-specific shape)\n */\nexport const getConnectionToken: TailorAuthconnectionAPI[\"getConnectionToken\"] = (...args) =>\n api().getConnectionToken(...args);\n"],"mappings":";;;;;AA+BA,MAAM,YACH,WAAuE,OAAO;;;;;;AAOjF,MAAa,sBAAqE,GAAG,SACnF,IAAI,CAAC,CAAC,mBAAmB,GAAG,IAAI"}