|
1 | 1 | # @tailor-platform/function-types |
2 | 2 |
|
3 | | -## Usage |
| 3 | +**Deprecated.** These types are now built into [`@tailor-platform/sdk`](https://www.npmjs.com/package/@tailor-platform/sdk), which exposes the same `tailor.*` / `tailordb.*` runtime surface plus typed wrappers you can import directly instead of relying on ambient globals. New projects should use `@tailor-platform/sdk` instead of this package; existing projects should migrate using the steps below. |
| 4 | + |
| 5 | +This package will no longer receive updates for new runtime APIs (e.g. it never picked up `tailor.aigateway.get()`, while `@tailor-platform/sdk` will keep gaining new runtime APIs). |
| 6 | + |
| 7 | +## Migrating to `@tailor-platform/sdk` |
| 8 | + |
| 9 | +1. Add `@tailor-platform/sdk` and remove this package: |
| 10 | + |
| 11 | + ```sh |
| 12 | + npm i -D @tailor-platform/sdk |
| 13 | + npm uninstall @tailor-platform/function-types |
| 14 | + ``` |
| 15 | + |
| 16 | + If your project already depends on `@tailor-platform/sdk` (e.g. for `tailor.config.ts`, resolvers, or workflows), you can skip the install step. |
| 17 | + |
| 18 | +2. Update `tsconfig.json` to load the runtime globals from the SDK instead: |
| 19 | + |
| 20 | + ```diff |
| 21 | + { |
| 22 | + "compilerOptions": { |
| 23 | + - "types": ["@tailor-platform/function-types"] |
| 24 | + + "types": ["@tailor-platform/sdk/runtime/globals"] |
| 25 | + } |
| 26 | + } |
| 27 | + ``` |
| 28 | + |
| 29 | +3. No other code changes are required. The global `tailor.*` and `tailordb.*` identifiers keep the same names and shapes (including the legacy capitalized `Tailordb.Client`, which `@tailor-platform/sdk` also keeps around for compatibility with this package). |
| 30 | + |
| 31 | +### Prefer typed imports over ambient globals (optional) |
| 32 | + |
| 33 | +Instead of relying on the ambient `tailor` / `tailordb` globals, `@tailor-platform/sdk/runtime` exposes the same APIs as regular imports, which is easier to trace and doesn't require the `tsconfig.json` `types` change above: |
| 34 | + |
| 35 | +```typescript |
| 36 | +import { iconv, secretmanager, idp, workflow, context, authconnection, file } from "@tailor-platform/sdk/runtime"; |
| 37 | + |
| 38 | +const secret = await secretmanager.getSecret("my-vault", "API_KEY"); |
| 39 | +``` |
| 40 | + |
| 41 | +### Known gap: `tailor.aigateway` |
| 42 | + |
| 43 | +`@tailor-platform/sdk` does not yet expose a runtime equivalent of `tailor.aigateway.get(name)`. If your code uses it, keep this package installed alongside `@tailor-platform/sdk` for that one namespace until the SDK adds support, or reach out to the SDK team if you need this migrated sooner. |
| 44 | + |
| 45 | +## Legacy usage (this package) |
4 | 46 |
|
5 | | -Install package. |
6 | 47 | ```sh |
7 | 48 | npm i -D @tailor-platform/function-types |
8 | 49 | ``` |
9 | 50 |
|
10 | | -Add types to `tsconfig.json`. |
11 | | -``` |
| 51 | +```json |
12 | 52 | { |
13 | | - ... |
14 | 53 | "compilerOptions": { |
15 | | - ... |
16 | 54 | "types": ["@tailor-platform/function-types"] |
17 | 55 | } |
18 | 56 | } |
|
0 commit comments