@tailor-platform/sdk 2.19.0 → 2.20.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 +16 -0
- package/dist/{application-BYlhYQyh.mjs → application-B6NYnrhv.mjs} +32 -32
- package/dist/application-B6NYnrhv.mjs.map +1 -0
- package/dist/application-BlbyGJsd.mjs +1 -0
- package/dist/cli/commands/deploy/application.d.mts +1 -0
- package/dist/cli/commands/deploy/apply-phases.d.mts +1 -1
- package/dist/cli/commands/deploy/deploy.d.mts +1 -1
- package/dist/cli/commands/deploy/deployment-target.d.mts +1 -0
- package/dist/cli/commands/deploy/executor.d.mts +1 -1
- package/dist/cli/commands/deploy/function-registry.d.mts +1 -1
- package/dist/cli/commands/deploy/resolver.d.mts +1 -0
- package/dist/cli/commands/deploy/secret-manager.d.mts +1 -1
- package/dist/cli/commands/deploy/tailordb/migration-validation.d.mts +1 -1
- package/dist/cli/commands/deploy/tailordb/plan.d.mts +1 -1
- package/dist/cli/commands/deploy/types.d.mts +1 -1
- package/dist/cli/commands/deploy/workflow.d.mts +1 -0
- package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +1 -1
- package/dist/cli/lib.d.mts +1 -1
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/main.mjs +21 -21
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/services/application.d.mts +2 -0
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/{register-ts-hook-Djjnj5R8.mjs → register-ts-hook-FsCX38LQ.mjs} +50 -50
- package/dist/register-ts-hook-FsCX38LQ.mjs.map +1 -0
- package/docs/configuration.md +18 -1
- package/docs/services/staticwebsite.md +17 -0
- package/package.json +4 -4
- package/dist/application-BYlhYQyh.mjs.map +0 -1
- package/dist/application-KZRJHv2j.mjs +0 -1
- package/dist/register-ts-hook-Djjnj5R8.mjs.map +0 -1
package/docs/configuration.md
CHANGED
|
@@ -245,6 +245,23 @@ export default defineConfig({
|
|
|
245
245
|
});
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
+
A value can reference a [static website](./services/staticwebsite.md#type-safe-url-references) through its `url` property, the same reference `cors` and OAuth2 redirect URIs accept. Resolver, executor, workflow job, and auth before-login hook code, and TailorDB migration scripts, then read the deployed website URL:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
const website = defineStaticWebSite("my-frontend", { description: "Frontend" });
|
|
252
|
+
|
|
253
|
+
export default defineConfig({
|
|
254
|
+
name: "my-app",
|
|
255
|
+
env: {
|
|
256
|
+
siteUrl: website.url, // https://my-frontend.example.com
|
|
257
|
+
callbackUrl: `${website.url}/callback`, // https://my-frontend.example.com/callback
|
|
258
|
+
},
|
|
259
|
+
staticWebsites: [website],
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
This resolves even when the same deploy both creates the website and reads its URL — one `deploy` call is enough, with no second, manually-triggered `deploy` needed. If the referenced website does not exist at all, the CLI warns and leaves the unresolved reference in place. If the reference still can't be resolved after this deploy's rebuild, the deploy fails instead of shipping the unresolved reference. This platform lookup only happens during `deploy`; `function run` passes the literal `<name>:url` string unchanged, since it never talks to the platform to resolve it.
|
|
264
|
+
|
|
248
265
|
`tailor.config.ts` runs locally when an SDK command loads the config. If values come from your shell or an env file, SDK commands can load them before config evaluation with the global [`--env-file`](./cli-reference.md#environment-file-loading) and `--env-file-if-exists` options:
|
|
249
266
|
|
|
250
267
|
```typescript
|
|
@@ -260,7 +277,7 @@ export default defineConfig({
|
|
|
260
277
|
|
|
261
278
|
If the same config defines an auth before-login hook, make sure the config module can be evaluated without Node-only globals in the platform runtime. Avoid arbitrary `process.env` reads in that module; pass literal values, or values generated into a config module before deployment, and read them from the hook's `env` argument.
|
|
262
279
|
|
|
263
|
-
When the SDK deploys application code or runs detected service code with `function run`, it passes the
|
|
280
|
+
When the SDK deploys application code or runs detected service code with `function run`, it passes the values `tailor.config.ts` evaluated to as the `env` argument -- except a static website `<name>:url` reference, which only `deploy` resolves (see above). Do not read `process.env` from deployed resolvers, executors, workflow jobs, auth hooks, or migration scripts; Node-side environment variables are not available there. Put sensitive values in [Secret Manager](./services/secret.md) instead of `env`.
|
|
264
281
|
|
|
265
282
|
| Code location | Runtime access |
|
|
266
283
|
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -113,6 +113,23 @@ const auth = defineAuth("my-auth", {
|
|
|
113
113
|
});
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### Application Environment Variables
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const website = defineStaticWebSite("my-frontend", {
|
|
120
|
+
description: "Frontend application",
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export default defineConfig({
|
|
124
|
+
env: {
|
|
125
|
+
siteUrl: website.url, // https://my-frontend.example.com
|
|
126
|
+
},
|
|
127
|
+
staticWebsites: [website],
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Resolver, executor, workflow job, and auth before-login hook code, and TailorDB migration scripts, that read [`env`](../configuration.md#environment-variables) receive the deployed URL, even when the same deploy both creates the website and reads its URL — one `deploy` call resolves it, with no second, manually-triggered `deploy` needed. If the referenced website does not exist at all, the CLI warns and leaves the unresolved reference in place. If the reference still can't be resolved after this deploy's rebuild, the deploy fails instead of shipping the unresolved reference. This platform lookup only happens during `deploy`; `function run` passes the literal `<name>:url` string unchanged, since it never talks to the platform to resolve it.
|
|
132
|
+
|
|
116
133
|
## Complete Example
|
|
117
134
|
|
|
118
135
|
```typescript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"inflection": "3.0.2",
|
|
186
186
|
"kysely": "0.29.5",
|
|
187
187
|
"mime-types": "3.0.2",
|
|
188
|
-
"open": "11.0.
|
|
188
|
+
"open": "11.0.4",
|
|
189
189
|
"oxc-parser": "0.149.0",
|
|
190
190
|
"p-limit": "7.3.2",
|
|
191
191
|
"pathe": "2.0.3",
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"@types/semver": "7.8.0",
|
|
213
213
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
214
214
|
"@vitest/coverage-v8": "5.0.0",
|
|
215
|
-
"eslint-plugin-zod": "4.
|
|
215
|
+
"eslint-plugin-zod": "4.13.1",
|
|
216
216
|
"oxfmt": "0.67.0",
|
|
217
217
|
"oxlint": "1.82.0",
|
|
218
218
|
"oxlint-tsgolint": "7.0.2001",
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
"tsdown": "0.23.0",
|
|
221
221
|
"typescript": "6.0.3",
|
|
222
222
|
"vitest": "5.0.0",
|
|
223
|
-
"zinfer": "0.4.
|
|
223
|
+
"zinfer": "0.4.7"
|
|
224
224
|
},
|
|
225
225
|
"peerDependencies": {
|
|
226
226
|
"@electric-sql/pglite": ">=0.2.0",
|