@tailor-platform/sdk 2.20.0 → 2.21.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.
- package/CHANGELOG.md +35 -0
- package/dist/application-D4913edS.mjs +199 -0
- package/dist/application-D4913edS.mjs.map +1 -0
- package/dist/application-DBHaxmJE.mjs +1 -0
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/main.d.mts +1 -0
- package/dist/cli/main.mjs +35 -35
- package/dist/cli/main.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +654 -131
- package/dist/configure/index.d.mts +2 -1
- package/dist/configure/index.mjs +12 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/secrets/index.d.mts +14 -0
- package/dist/configure/services/tailordb/schema.d.mts +3 -2
- package/dist/configure/types/secret-vault-name.d.mts +32 -0
- package/dist/{crashreport-Cyuz1qiu.mjs → crashreport-BAz-ph5O.mjs} +3 -3
- package/dist/{crashreport-Cyuz1qiu.mjs.map → crashreport-BAz-ph5O.mjs.map} +1 -1
- package/dist/crashreport-BfOkOFgc.mjs +1 -0
- package/dist/{date-B7-oyTGE.mjs → date-Dri6Yas-.mjs} +2 -2
- package/dist/date-Dri6Yas-.mjs.map +1 -0
- package/dist/{errors-BjJnpXkK.mjs → errors-sNtg2Mv3.mjs} +2 -2
- package/dist/{errors-BjJnpXkK.mjs.map → errors-sNtg2Mv3.mjs.map} +1 -1
- package/dist/es-builtins-SfvXRVoG.mjs +2 -0
- package/dist/{es-builtins-BHCXINQp.mjs.map → es-builtins-SfvXRVoG.mjs.map} +1 -1
- package/dist/field-parse-DhnFs9WG.mjs +2 -0
- package/dist/field-parse-DhnFs9WG.mjs.map +1 -0
- package/dist/{globals-CMHSnj4w.mjs → globals-BCmGX05J.mjs} +2 -2
- package/dist/{globals-CMHSnj4w.mjs.map → globals-BCmGX05J.mjs.map} +1 -1
- package/dist/guards-DsX7dJCP.mjs +2 -0
- package/dist/{guards-ForsrxnH.mjs.map → guards-DsX7dJCP.mjs.map} +1 -1
- package/dist/{kysely-type-B_oA8D1k.mjs → kysely-type-C-iyFFH7.mjs} +2 -2
- package/dist/{kysely-type-B_oA8D1k.mjs.map → kysely-type-C-iyFFH7.mjs.map} +1 -1
- package/dist/{logger-72hM4JWZ.mjs → logger-Cp5U2IDI.mjs} +2 -2
- package/dist/{logger-72hM4JWZ.mjs.map → logger-Cp5U2IDI.mjs.map} +1 -1
- package/dist/manager-C0dE7pd0.mjs +2 -0
- package/dist/{manager-qfbUL7ru.mjs.map → manager-C0dE7pd0.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs.map +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/index.mjs +1 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/register-ts-hook-YtsAGTMD.mjs +921 -0
- package/dist/{register-ts-hook-FsCX38LQ.mjs.map → register-ts-hook-YtsAGTMD.mjs.map} +1 -1
- package/dist/registry-BijIDRVA.mjs +2 -0
- package/dist/{registry-HlEaGvl5.mjs.map → registry-BijIDRVA.mjs.map} +1 -1
- package/dist/repl-editor-DGJBfIt1.mjs +2 -0
- package/dist/{repl-editor-BG1aDOfH.mjs.map → repl-editor-DGJBfIt1.mjs.map} +1 -1
- package/dist/runtime/field-parse.d.mts +17 -1
- package/dist/runtime/index.d.mts +2 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/secretmanager.d.mts +8 -20
- package/dist/schema-CRtAmDcl.mjs +2 -0
- package/dist/{schema-BKvcWdVf.mjs.map → schema-CRtAmDcl.mjs.map} +1 -1
- package/dist/secretmanager-vHQoXdQz.mjs.map +1 -1
- package/dist/seed/index.mjs +2 -2
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{service-B4Gh_bbL.mjs → service-8xznUrPU.mjs} +2 -2
- package/dist/{service-B4Gh_bbL.mjs.map → service-8xznUrPU.mjs.map} +1 -1
- package/dist/{service-CuqkHP1r.mjs → service-BrGSi2IQ.mjs} +3 -3
- package/dist/{service-CuqkHP1r.mjs.map → service-BrGSi2IQ.mjs.map} +1 -1
- package/dist/service-DWMm-4Vm.mjs +1 -0
- package/dist/service_pb-DNskuJQC.mjs +1 -0
- package/dist/service_pb-y2GYIgfs.mjs +2 -0
- package/dist/{service_pb-DprmLNsq.mjs.map → service_pb-y2GYIgfs.mjs.map} +1 -1
- package/dist/tailordb-ddl-DqInYupv.mjs +7 -0
- package/dist/{tailordb-ddl-Fgm2cNvT.mjs.map → tailordb-ddl-DqInYupv.mjs.map} +1 -1
- package/dist/utils/test/index.mjs +1 -1
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.mjs +1 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/setup.mjs +1 -1
- package/dist/workspace_resource_pb-D2njwgsE.mjs +2 -0
- package/dist/{workspace_resource_pb-BOoRts_z.mjs.map → workspace_resource_pb-D2njwgsE.mjs.map} +1 -1
- package/docs/migration/v3.md +64 -0
- package/docs/services/resolver.md +21 -0
- package/docs/services/secret.md +20 -15
- package/package.json +12 -12
- package/dist/application-B6NYnrhv.mjs +0 -199
- package/dist/application-B6NYnrhv.mjs.map +0 -1
- package/dist/application-BlbyGJsd.mjs +0 -1
- package/dist/crashreport-CgymxQDu.mjs +0 -1
- package/dist/date-B7-oyTGE.mjs.map +0 -1
- package/dist/es-builtins-BHCXINQp.mjs +0 -2
- package/dist/field-parse-BbNyotv5.mjs +0 -2
- package/dist/field-parse-BbNyotv5.mjs.map +0 -1
- package/dist/guards-ForsrxnH.mjs +0 -2
- package/dist/manager-qfbUL7ru.mjs +0 -2
- package/dist/register-ts-hook-FsCX38LQ.mjs +0 -917
- package/dist/registry-HlEaGvl5.mjs +0 -2
- package/dist/repl-editor-BG1aDOfH.mjs +0 -2
- package/dist/schema-BKvcWdVf.mjs +0 -2
- package/dist/service-BgrEteZ2.mjs +0 -1
- package/dist/service_pb-DKrsO1_u.mjs +0 -1
- package/dist/service_pb-DprmLNsq.mjs +0 -2
- package/dist/tailordb-ddl-Fgm2cNvT.mjs +0 -7
- package/dist/workspace_resource_pb-BOoRts_z.mjs +0 -2
package/docs/migration/v3.md
CHANGED
|
@@ -165,3 +165,67 @@ Do not change unrelated upload APIs or already explicit encodings.
|
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
</details>
|
|
168
|
+
|
|
169
|
+
## secrets.get()/getAll() (defineSecretManager) removed — use secretmanager from @tailor-platform/sdk/runtime
|
|
170
|
+
|
|
171
|
+
**Migration:** Manual
|
|
172
|
+
|
|
173
|
+
The `get()`/`getAll()` methods on the object `defineSecretManager()` returns are removed in v3. Importing that object into a resolver, executor, or workflow file bundles the raw values passed to `defineSecretManager()` into that function's deployed code, which fails to build once any value comes from `process.env`. `secretmanager.getSecret()`/`getSecrets()` from `@tailor-platform/sdk/runtime` read the same secrets without importing the config object.
|
|
174
|
+
|
|
175
|
+
Before:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
import { secrets } from "../tailor.config";
|
|
179
|
+
|
|
180
|
+
const apiKey = await secrets.get("api-keys", "stripe-secret-key");
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
After:
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
import { secretmanager } from "@tailor-platform/sdk/runtime";
|
|
187
|
+
|
|
188
|
+
const apiKey = await secretmanager.getSecret("api-keys", "stripe-secret-key");
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Before:
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
import { secrets } from "../tailor.config";
|
|
195
|
+
|
|
196
|
+
const [apiKey, webhookSecret] = await secrets.getAll("api-keys", [
|
|
197
|
+
"sendgrid-api-key",
|
|
198
|
+
"stripe-secret-key",
|
|
199
|
+
]);
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
After:
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
import { secretmanager } from "@tailor-platform/sdk/runtime";
|
|
206
|
+
|
|
207
|
+
const { "sendgrid-api-key": apiKey, "stripe-secret-key": webhookSecret } =
|
|
208
|
+
await secretmanager.getSecrets("api-keys", ["sendgrid-api-key", "stripe-secret-key"]);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
<details>
|
|
212
|
+
<summary>Prompt for an AI agent (to perform this migration)</summary>
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
`secrets.get()`/`getAll()` on the object `defineSecretManager()` returns are removed in v3.
|
|
216
|
+
Replace the import with `import { secretmanager } from "@tailor-platform/sdk/runtime";` and
|
|
217
|
+
call `secretmanager.getSecret(vault, name)` in place of `secrets.get(vault, name)`.
|
|
218
|
+
|
|
219
|
+
`getAll()` needs more than a rename: `secrets.getAll(vault, names)` returned an array of
|
|
220
|
+
values in the same order as `names`, while `secretmanager.getSecrets(vault, names)` returns
|
|
221
|
+
a partial record keyed by each requested name (a name with no value is omitted instead of
|
|
222
|
+
being `undefined` at its index). Rewrite positional destructuring (`const [a, b] = await
|
|
223
|
+
secrets.getAll(v, ["A", "B"])`) into keyed destructuring (`const { A: a, B: b } = await
|
|
224
|
+
secretmanager.getSecrets(v, ["A", "B"])`).
|
|
225
|
+
|
|
226
|
+
Also review: a `secrets` object re-exported or re-assigned to another name before use, and a
|
|
227
|
+
file that already imports something else named `secretmanager` (rename one of the two on
|
|
228
|
+
conflict).
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
</details>
|
|
@@ -141,6 +141,27 @@ GraphQL still accepts and returns `YYYY-MM-DD` strings. The SDK converts input t
|
|
|
141
141
|
|
|
142
142
|
This option also works in nested objects and with `array: true` or `optional: true`. Input must be a valid calendar date, and output must be a valid `Date` with a 4-digit UTC year (0000-9999). Both deployed resolvers and `tailor function run` perform these conversions.
|
|
143
143
|
|
|
144
|
+
A resolver bundle only includes the conversion code for the representations (`as: "date"` or `as: "temporal"`) its `input` and `output` use. To parse other values with such fields inside `body`, for example an external API response, use `parseDateFields` instead of `.parse()`. It takes the same arguments and returns the same result as `.parse()`. Calling `.parse()` on a field whose representation the bundle leaves out throws an error that points to `parseDateFields`.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { parseDateFields } from "@tailor-platform/sdk/runtime";
|
|
148
|
+
|
|
149
|
+
const payload = t.object({ due: t.date({ as: "date" }) });
|
|
150
|
+
|
|
151
|
+
createResolver({
|
|
152
|
+
name: "importDueDate",
|
|
153
|
+
operation: "mutation",
|
|
154
|
+
input: { id: t.string() },
|
|
155
|
+
body: async ({ input }) => {
|
|
156
|
+
const response = await fetchDueDate(input.id);
|
|
157
|
+
const result = parseDateFields(payload, { value: response, data: response, invoker: null });
|
|
158
|
+
if (result.issues) throw new Error(result.issues[0].message);
|
|
159
|
+
return result.value.due.toISOString();
|
|
160
|
+
},
|
|
161
|
+
output: t.string(),
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
144
165
|
An executor subscribing to the resolver with `resolverExecutedTrigger` receives the event as JSON, so `result` holds the `YYYY-MM-DD` string rather than a `Date`.
|
|
145
166
|
|
|
146
167
|
Use `t.date({ as: "temporal" })` to work with the [`Temporal.PlainDate`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate) value instead:
|
package/docs/services/secret.md
CHANGED
|
@@ -62,7 +62,7 @@ export default defineConfig({
|
|
|
62
62
|
});
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
The exported `secrets` object
|
|
65
|
+
The exported `secrets` object also carries the values you passed in, so import it only where you build your `tailor.config.ts` config (the file itself, or a helper module you import into it) — never from a resolver, executor, or workflow file. This `secrets` object's `get()`/`getAll()` methods are deprecated for the same reason and will be removed in a future major version; to read a secret at runtime, use the `secretmanager` API described below instead.
|
|
66
66
|
|
|
67
67
|
### Skipping Secrets with Missing Values
|
|
68
68
|
|
|
@@ -91,50 +91,55 @@ This allows you to set secret values once (e.g., via local `tailor deploy` or th
|
|
|
91
91
|
|
|
92
92
|
## Using Secrets
|
|
93
93
|
|
|
94
|
-
### Runtime Access with `
|
|
94
|
+
### Runtime Access with `secretmanager`
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
Read secret values at runtime with the `secretmanager` API from `@tailor-platform/sdk/runtime`, the same module you use for other platform runtime APIs (`idp`, `workflow`, `authconnection`, etc.). Pass the vault and secret names as strings. Once `tailor generate`/`tailor deploy` has run, vault names are autocompleted from `defineSecretManager()` (any other string still works, since vaults can also be managed imperatively via the CLI — see [Managing Secrets](#managing-secrets)), and inside a declared vault, secret names are checked against that vault's configuration.
|
|
97
97
|
|
|
98
|
-
#### `
|
|
98
|
+
#### `getSecret(vault, name)`
|
|
99
99
|
|
|
100
100
|
Retrieves a single secret value.
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
103
|
import { createResolver } from "@tailor-platform/sdk";
|
|
104
|
-
import {
|
|
104
|
+
import { secretmanager } from "@tailor-platform/sdk/runtime";
|
|
105
105
|
|
|
106
106
|
export default createResolver({
|
|
107
107
|
name: "call-stripe",
|
|
108
|
+
operation: "query",
|
|
108
109
|
// ...
|
|
109
|
-
|
|
110
|
-
const apiKey = await
|
|
110
|
+
body: async ({ input }) => {
|
|
111
|
+
const apiKey = await secretmanager.getSecret("api-keys", "stripe-secret-key");
|
|
111
112
|
// Use apiKey to call the Stripe API
|
|
113
|
+
|
|
114
|
+
// await secretmanager.getSecret("api-keys", "unknown-key"); // Type error — "api-keys" only has "stripe-secret-key" and "sendgrid-api-key"
|
|
115
|
+
// await secretmanager.getSecret("cli-managed-vault", "anything"); // Fine — "cli-managed-vault" isn't declared in defineSecretManager(), so its secret names aren't checked
|
|
112
116
|
},
|
|
113
117
|
});
|
|
114
118
|
```
|
|
115
119
|
|
|
116
|
-
#### `
|
|
120
|
+
#### `getSecrets(vault, names)`
|
|
117
121
|
|
|
118
122
|
Retrieves multiple secret values at once from the same vault.
|
|
119
123
|
|
|
120
124
|
```typescript
|
|
121
125
|
import { createResolver } from "@tailor-platform/sdk";
|
|
122
|
-
import {
|
|
126
|
+
import { secretmanager } from "@tailor-platform/sdk/runtime";
|
|
123
127
|
|
|
124
128
|
export default createResolver({
|
|
125
129
|
name: "send-notification",
|
|
130
|
+
operation: "query",
|
|
126
131
|
// ...
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
"sendgrid-api-key",
|
|
130
|
-
"stripe-secret-key",
|
|
131
|
-
]);
|
|
132
|
+
body: async ({ input }) => {
|
|
133
|
+
const { "sendgrid-api-key": apiKey, "stripe-secret-key": webhookSecret } =
|
|
134
|
+
await secretmanager.getSecrets("api-keys", ["sendgrid-api-key", "stripe-secret-key"]);
|
|
132
135
|
// Use the retrieved secrets
|
|
133
136
|
},
|
|
134
137
|
});
|
|
135
138
|
```
|
|
136
139
|
|
|
137
|
-
|
|
140
|
+
`getSecret` returns `Promise<string | undefined>`; `getSecrets` returns a `Promise` of a partial record keyed by the requested names, omitting any name that has no value.
|
|
141
|
+
|
|
142
|
+
Import `secretmanager` directly in resolver, executor, and workflow files — never the `secrets` object from `tailor.config.ts` (see [Declarative Configuration](#declarative-configuration) above).
|
|
138
143
|
|
|
139
144
|
### In Webhook Operations
|
|
140
145
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"@0no-co/graphql.web": "1.3.4",
|
|
153
153
|
"@badgateway/oauth2-client": "3.3.1",
|
|
154
154
|
"@bufbuild/protobuf": "2.15.0",
|
|
155
|
-
"@bufbuild/protovalidate": "1.
|
|
155
|
+
"@bufbuild/protovalidate": "1.3.0",
|
|
156
156
|
"@connectrpc/connect": "2.2.0",
|
|
157
157
|
"@connectrpc/connect-node": "2.2.0",
|
|
158
158
|
"@inquirer/core": "12.0.3",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"@opentelemetry/sdk-trace-node": "2.11.0",
|
|
166
166
|
"@opentelemetry/semantic-conventions": "1.43.0",
|
|
167
167
|
"@oxc-project/types": "0.149.0",
|
|
168
|
-
"@politty/zod": "0.
|
|
168
|
+
"@politty/zod": "0.3.0",
|
|
169
169
|
"@secretlint/core": "13.0.5",
|
|
170
170
|
"@secretlint/secretlint-rule-preset-recommend": "13.0.5",
|
|
171
171
|
"@standard-schema/spec": "1.1.0",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"@toiroakr/lines-db": "0.12.7",
|
|
174
174
|
"@toiroakr/read-multiline": "0.4.1",
|
|
175
175
|
"@urql/core": "6.0.3",
|
|
176
|
-
"amaro": "1.1
|
|
176
|
+
"amaro": "1.2.1",
|
|
177
177
|
"confbox": "0.3.1",
|
|
178
178
|
"date-fns": "4.4.0",
|
|
179
179
|
"es-toolkit": "1.52.0",
|
|
@@ -183,15 +183,15 @@
|
|
|
183
183
|
"globals": "17.12.0",
|
|
184
184
|
"graphql": "17.0.2",
|
|
185
185
|
"inflection": "3.0.2",
|
|
186
|
-
"kysely": "0.29.
|
|
186
|
+
"kysely": "0.29.6",
|
|
187
187
|
"mime-types": "3.0.2",
|
|
188
188
|
"open": "11.0.4",
|
|
189
189
|
"oxc-parser": "0.149.0",
|
|
190
|
-
"p-limit": "7.3.
|
|
190
|
+
"p-limit": "7.3.3",
|
|
191
191
|
"pathe": "2.0.3",
|
|
192
192
|
"pgsql-ast-parser": "12.0.2",
|
|
193
193
|
"pkg-types": "2.3.3",
|
|
194
|
-
"rolldown": "1.2.
|
|
194
|
+
"rolldown": "1.2.9",
|
|
195
195
|
"semver": "7.8.5",
|
|
196
196
|
"sql-highlight": "6.1.0",
|
|
197
197
|
"std-env": "4.2.0",
|
|
@@ -208,18 +208,18 @@
|
|
|
208
208
|
"@tailor-platform/shared": "^0.0.0",
|
|
209
209
|
"@tailor-platform/tailor-proto": "^0.0.1",
|
|
210
210
|
"@types/mime-types": "3.0.1",
|
|
211
|
-
"@types/node": "24.13.
|
|
211
|
+
"@types/node": "24.13.6",
|
|
212
212
|
"@types/semver": "7.8.0",
|
|
213
213
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
214
|
-
"@vitest/coverage-v8": "5.0.
|
|
215
|
-
"eslint-plugin-zod": "4.
|
|
214
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
215
|
+
"eslint-plugin-zod": "4.14.2",
|
|
216
216
|
"oxfmt": "0.67.0",
|
|
217
217
|
"oxlint": "1.82.0",
|
|
218
|
-
"oxlint-tsgolint": "7.0.
|
|
218
|
+
"oxlint-tsgolint": "7.0.2002",
|
|
219
219
|
"sonda": "0.14.0",
|
|
220
220
|
"tsdown": "0.23.0",
|
|
221
221
|
"typescript": "6.0.3",
|
|
222
|
-
"vitest": "5.0.
|
|
222
|
+
"vitest": "5.0.1",
|
|
223
223
|
"zinfer": "0.4.7"
|
|
224
224
|
},
|
|
225
225
|
"peerDependencies": {
|