@tailor-platform/sdk 1.45.1 → 1.46.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 +46 -0
- package/dist/application-B4zVVNRS.mjs.map +1 -1
- package/dist/cli/index.mjs +71 -49
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +7 -7
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +1 -1
- package/dist/{crash-report-BUHzuzDn.mjs → crashreport-6mcMyWu4.mjs} +1 -1
- package/dist/{crash-report-CtYCva4d.mjs → crashreport-DGeGj9BF.mjs} +8 -8
- package/dist/crashreport-DGeGj9BF.mjs.map +1 -0
- package/dist/{index-DUKJPEwq.d.mts → index-PB0otrDj.d.mts} +3 -3
- package/dist/{runtime-D5AJYWnF.mjs → runtime-B67skpW-.mjs} +258 -98
- package/dist/runtime-B67skpW-.mjs.map +1 -0
- package/dist/telemetry-21afNV9_.mjs +4 -0
- package/dist/{telemetry-DXitz4RH.mjs → telemetry-DcL8Fsm_.mjs} +1 -1
- package/dist/{telemetry-DXitz4RH.mjs.map → telemetry-DcL8Fsm_.mjs.map} +1 -1
- package/dist/utils/test/index.d.mts +1 -1
- package/docs/cli/application.md +19 -17
- package/docs/cli/crashreport.md +119 -0
- package/docs/cli/executor.md +9 -9
- package/docs/cli/function.md +5 -5
- package/docs/cli/tailordb.md +1 -1
- package/docs/cli/workflow.md +8 -8
- package/docs/cli-reference.md +8 -8
- package/docs/generator/builtin.md +36 -0
- package/docs/quickstart.md +2 -2
- package/docs/services/auth.md +2 -2
- package/docs/services/secret.md +4 -4
- package/docs/services/tailordb-migration.md +10 -10
- package/docs/services/tailordb.md +1 -1
- package/package.json +9 -10
- package/dist/crash-report-CtYCva4d.mjs.map +0 -1
- package/dist/runtime-D5AJYWnF.mjs.map +0 -1
- package/dist/telemetry-BvI1EgMG.mjs +0 -4
- package/docs/cli/crash-report.md +0 -118
- /package/dist/{application-BIzicxMA.mjs → application-Boa_11Nv.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-
|
|
1
|
+
{"version":3,"file":"telemetry-DcL8Fsm_.mjs","names":[],"sources":["../src/cli/telemetry/config.ts","../src/cli/telemetry/index.ts"],"sourcesContent":["/**\n * Telemetry configuration parsed from standard OpenTelemetry environment variables.\n * Tracing is enabled when OTEL_EXPORTER_OTLP_ENDPOINT is set.\n */\nexport interface TelemetryConfig {\n readonly enabled: boolean;\n readonly endpoint: string;\n}\n\n/**\n * Parse telemetry configuration from standard OpenTelemetry environment variables.\n * Tracing is enabled when OTEL_EXPORTER_OTLP_ENDPOINT is set.\n * @returns Telemetry configuration\n */\nexport function parseTelemetryConfig(): TelemetryConfig {\n const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? \"\";\n const enabled = endpoint.length > 0;\n\n return {\n enabled,\n endpoint,\n };\n}\n","import { trace, SpanStatusCode, type Span } from \"@opentelemetry/api\";\nimport { parseTelemetryConfig, type TelemetryConfig } from \"./config\";\n\nlet _config: TelemetryConfig | undefined;\nlet _initialized = false;\nlet _provider: { register: () => void; shutdown: () => Promise<void> } | undefined;\n\n/**\n * Check whether telemetry is currently enabled.\n * @returns true if telemetry has been initialized and is enabled\n */\nexport function isTelemetryEnabled(): boolean {\n return _config?.enabled ?? false;\n}\n\n/**\n * Initialize telemetry if OTEL_EXPORTER_OTLP_ENDPOINT is set.\n * When disabled, this is a no-op with zero overhead beyond reading env vars.\n * @returns Promise that resolves when initialization completes\n */\nexport async function initTelemetry(): Promise<void> {\n if (_initialized) return;\n _initialized = true;\n\n _config = parseTelemetryConfig();\n if (!_config.enabled) return;\n\n // Dynamic imports - only loaded when tracing is enabled\n const [\n { NodeTracerProvider, BatchSpanProcessor },\n { OTLPTraceExporter },\n { resourceFromAttributes },\n { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION },\n { readPackageJson },\n ] = await Promise.all([\n import(\"@opentelemetry/sdk-trace-node\"),\n import(\"@opentelemetry/exporter-trace-otlp-proto\"),\n import(\"@opentelemetry/resources\"),\n import(\"@opentelemetry/semantic-conventions\"),\n import(\"@/cli/shared/package-json\"),\n ]);\n\n const packageJson = await readPackageJson();\n const version = packageJson.version ?? \"unknown\";\n\n const resource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: \"tailor-sdk\",\n [ATTR_SERVICE_VERSION]: version,\n });\n\n const exporter = new OTLPTraceExporter({\n url: `${_config.endpoint}/v1/traces`,\n });\n\n _provider = new NodeTracerProvider({\n resource,\n spanProcessors: [new BatchSpanProcessor(exporter)],\n });\n\n _provider.register();\n}\n\n/**\n * Shutdown the telemetry provider, flushing all pending spans.\n * Must be called before process exit to ensure traces are exported.\n * @returns Promise that resolves when shutdown completes\n */\nexport async function shutdownTelemetry(): Promise<void> {\n if (!_provider) return;\n await _provider.shutdown();\n}\n\n/**\n * Execute a function within a new span. Records exceptions and sets span status.\n * When no TracerProvider is registered, the OTel API automatically provides\n * noop spans with zero overhead.\n * @param name - Span name\n * @param fn - Function to execute within the span\n * @returns Result of fn\n */\nexport async function withSpan<T>(name: string, fn: (span: Span) => Promise<T>): Promise<T> {\n const tracer = trace.getTracer(\"tailor-sdk\");\n\n return tracer.startActiveSpan(name, async (span) => {\n try {\n const result = await fn(span);\n span.setStatus({ code: SpanStatusCode.OK });\n return result;\n } catch (error) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n if (error instanceof Error) {\n span.recordException(error);\n }\n throw error;\n } finally {\n span.end();\n }\n });\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgB,uBAAwC;CACtD,MAAM,WAAW,QAAQ,IAAI,+BAA+B;AAG5D,QAAO;EACL,SAHc,SAAS,SAAS;EAIhC;EACD;;;;;AClBH,IAAI;AACJ,IAAI,eAAe;AACnB,IAAI;;;;;;AAeJ,eAAsB,gBAA+B;AACnD,KAAI,aAAc;AAClB,gBAAe;AAEf,WAAU,sBAAsB;AAChC,KAAI,CAAC,QAAQ,QAAS;CAGtB,MAAM,CACJ,EAAE,oBAAoB,sBACtB,EAAE,qBACF,EAAE,0BACF,EAAE,mBAAmB,wBACrB,EAAE,qBACA,MAAM,QAAQ,IAAI;EACpB,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACR,CAAC;CAGF,MAAM,WAAU,MADU,iBAAiB,EACf,WAAW;AAWvC,aAAY,IAAI,mBAAmB;EACjC,UAVe,uBAAuB;IACrC,oBAAoB;IACpB,uBAAuB;GACzB,CAOS;EACR,gBAAgB,CAAC,IAAI,mBAAmB,IANrB,kBAAkB,EACrC,KAAK,GAAG,QAAQ,SAAS,aAC1B,CAIiD,CAAC,CAAC;EACnD,CAAC;AAEF,WAAU,UAAU;;;;;;;AAQtB,eAAsB,oBAAmC;AACvD,KAAI,CAAC,UAAW;AAChB,OAAM,UAAU,UAAU;;;;;;;;;;AAW5B,eAAsB,SAAY,MAAc,IAA4C;AAG1F,QAFe,MAAM,UAAU,aAElB,CAAC,gBAAgB,MAAM,OAAO,SAAS;AAClD,MAAI;GACF,MAAM,SAAS,MAAM,GAAG,KAAK;AAC7B,QAAK,UAAU,EAAE,MAAM,eAAe,IAAI,CAAC;AAC3C,UAAO;WACA,OAAO;AACd,QAAK,UAAU,EAAE,MAAM,eAAe,OAAO,CAAC;AAC9C,OAAI,iBAAiB,MACnB,MAAK,gBAAgB,MAAM;AAE7B,SAAM;YACE;AACR,QAAK,KAAK;;GAEZ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
2
|
import { Vt as TailorInvoker } from "../../tailor-db-field-Hx9OqPWY.mjs";
|
|
3
3
|
import { O as TailorDBType } from "../../workflow.generated-DFljpJh7.mjs";
|
|
4
|
-
import { dt as WORKFLOW_TEST_ENV_KEY, n as output, xt as TailorField } from "../../index-
|
|
4
|
+
import { dt as WORKFLOW_TEST_ENV_KEY, n as output, xt as TailorField } from "../../index-PB0otrDj.mjs";
|
|
5
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
6
|
|
|
7
7
|
//#region src/utils/test/mock.d.ts
|
package/docs/cli/application.md
CHANGED
|
@@ -89,29 +89,31 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
89
89
|
|
|
90
90
|
<!-- politty:command:generate:global-options-link:end -->
|
|
91
91
|
|
|
92
|
-
<!-- politty:command:
|
|
92
|
+
<!-- politty:command:deploy:heading:start -->
|
|
93
93
|
|
|
94
|
-
##
|
|
94
|
+
## deploy
|
|
95
95
|
|
|
96
|
-
<!-- politty:command:
|
|
96
|
+
<!-- politty:command:deploy:heading:end -->
|
|
97
97
|
|
|
98
|
-
<!-- politty:command:
|
|
98
|
+
<!-- politty:command:deploy:description:start -->
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
Deploy your application by applying the Tailor configuration.
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
**Aliases:** `apply`
|
|
103
103
|
|
|
104
|
-
<!-- politty:command:
|
|
104
|
+
<!-- politty:command:deploy:description:end -->
|
|
105
|
+
|
|
106
|
+
<!-- politty:command:deploy:usage:start -->
|
|
105
107
|
|
|
106
108
|
**Usage**
|
|
107
109
|
|
|
108
110
|
```
|
|
109
|
-
tailor-sdk
|
|
111
|
+
tailor-sdk deploy [options]
|
|
110
112
|
```
|
|
111
113
|
|
|
112
|
-
<!-- politty:command:
|
|
114
|
+
<!-- politty:command:deploy:usage:end -->
|
|
113
115
|
|
|
114
|
-
<!-- politty:command:
|
|
116
|
+
<!-- politty:command:deploy:options:start -->
|
|
115
117
|
|
|
116
118
|
**Options**
|
|
117
119
|
|
|
@@ -126,17 +128,17 @@ tailor-sdk apply [options]
|
|
|
126
128
|
| `--no-cache` | - | Disable bundle caching for this run | No | - | - |
|
|
127
129
|
| `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
|
|
128
130
|
|
|
129
|
-
<!-- politty:command:
|
|
131
|
+
<!-- politty:command:deploy:options:end -->
|
|
130
132
|
|
|
131
|
-
<!-- politty:command:
|
|
133
|
+
<!-- politty:command:deploy:global-options-link:start -->
|
|
132
134
|
|
|
133
135
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
134
136
|
|
|
135
|
-
<!-- politty:command:
|
|
137
|
+
<!-- politty:command:deploy:global-options-link:end -->
|
|
136
138
|
|
|
137
139
|
**Migration Handling:**
|
|
138
140
|
|
|
139
|
-
When migrations are configured (`db.tailordb.migration` in config), the `
|
|
141
|
+
When migrations are configured (`db.tailordb.migration` in config), the `deploy` command automatically:
|
|
140
142
|
|
|
141
143
|
1. Detects pending migration scripts that haven't been executed
|
|
142
144
|
2. Applies schema changes in a safe order (pre-migration → script execution → post-migration)
|
|
@@ -147,18 +149,18 @@ See [TailorDB Commands](./tailordb.md#automatic-migration-execution) for details
|
|
|
147
149
|
|
|
148
150
|
**Schema Check:**
|
|
149
151
|
|
|
150
|
-
By default, `
|
|
152
|
+
By default, `deploy` performs two verification steps:
|
|
151
153
|
|
|
152
154
|
1. **Local schema check**: Verifies that local schema changes match the migration files. This ensures migrations are properly generated before deployment.
|
|
153
155
|
2. **Remote schema check**: Verifies that the remote schema matches the expected state based on migration history. This detects schema drift caused by manual changes or other developers.
|
|
154
156
|
|
|
155
|
-
If remote schema drift is detected, the
|
|
157
|
+
If remote schema drift is detected, the deploy will fail with an error showing the differences. This helps prevent applying migrations to an inconsistent state.
|
|
156
158
|
|
|
157
159
|
Use `--no-schema-check` to skip both verifications (not recommended for production).
|
|
158
160
|
|
|
159
161
|
**Plan Output:**
|
|
160
162
|
|
|
161
|
-
Before applying changes, `
|
|
163
|
+
Before applying changes, `deploy` shows a preview of the planned resource changes.
|
|
162
164
|
|
|
163
165
|
- `+` means the resource will be created
|
|
164
166
|
- `~` means the resource will be updated
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Crash Report Commands
|
|
2
|
+
|
|
3
|
+
Commands for managing crash reports.
|
|
4
|
+
|
|
5
|
+
<!-- politty:command:crashreport:heading:start -->
|
|
6
|
+
|
|
7
|
+
## crashreport
|
|
8
|
+
|
|
9
|
+
<!-- politty:command:crashreport:heading:end -->
|
|
10
|
+
|
|
11
|
+
<!-- politty:command:crashreport:description:start -->
|
|
12
|
+
|
|
13
|
+
Manage crash reports.
|
|
14
|
+
|
|
15
|
+
**Aliases:** `crash-report`
|
|
16
|
+
|
|
17
|
+
<!-- politty:command:crashreport:description:end -->
|
|
18
|
+
|
|
19
|
+
<!-- politty:command:crashreport:usage:start -->
|
|
20
|
+
|
|
21
|
+
**Usage**
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
tailor-sdk crashreport [command]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<!-- politty:command:crashreport:usage:end -->
|
|
28
|
+
|
|
29
|
+
<!-- politty:command:crashreport:global-options-link:start -->
|
|
30
|
+
|
|
31
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
32
|
+
|
|
33
|
+
<!-- politty:command:crashreport:global-options-link:end -->
|
|
34
|
+
|
|
35
|
+
<!-- politty:command:crashreport:subcommands:start -->
|
|
36
|
+
|
|
37
|
+
**Commands**
|
|
38
|
+
|
|
39
|
+
| Command | Description |
|
|
40
|
+
| --------------------------------------- | ---------------------------------------------- |
|
|
41
|
+
| [`crashreport list`](#crashreport-list) | List local crash report files. |
|
|
42
|
+
| [`crashreport send`](#crashreport-send) | Submit a crash report to help improve the SDK. |
|
|
43
|
+
|
|
44
|
+
<!-- politty:command:crashreport:subcommands:end -->
|
|
45
|
+
<!-- politty:command:crashreport list:heading:start -->
|
|
46
|
+
|
|
47
|
+
### crashreport list
|
|
48
|
+
|
|
49
|
+
<!-- politty:command:crashreport list:heading:end -->
|
|
50
|
+
|
|
51
|
+
<!-- politty:command:crashreport list:description:start -->
|
|
52
|
+
|
|
53
|
+
List local crash report files.
|
|
54
|
+
|
|
55
|
+
<!-- politty:command:crashreport list:description:end -->
|
|
56
|
+
|
|
57
|
+
<!-- politty:command:crashreport list:usage:start -->
|
|
58
|
+
|
|
59
|
+
**Usage**
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
tailor-sdk crashreport list [options]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
<!-- politty:command:crashreport list:usage:end -->
|
|
66
|
+
|
|
67
|
+
<!-- politty:command:crashreport list:options:start -->
|
|
68
|
+
|
|
69
|
+
**Options**
|
|
70
|
+
|
|
71
|
+
| Option | Alias | Description | Required | Default |
|
|
72
|
+
| ----------------- | ----- | -------------------------------------------------------- | -------- | -------- |
|
|
73
|
+
| `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` |
|
|
74
|
+
| `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - |
|
|
75
|
+
|
|
76
|
+
<!-- politty:command:crashreport list:options:end -->
|
|
77
|
+
|
|
78
|
+
<!-- politty:command:crashreport list:global-options-link:start -->
|
|
79
|
+
|
|
80
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
81
|
+
|
|
82
|
+
<!-- politty:command:crashreport list:global-options-link:end -->
|
|
83
|
+
<!-- politty:command:crashreport send:heading:start -->
|
|
84
|
+
|
|
85
|
+
### crashreport send
|
|
86
|
+
|
|
87
|
+
<!-- politty:command:crashreport send:heading:end -->
|
|
88
|
+
|
|
89
|
+
<!-- politty:command:crashreport send:description:start -->
|
|
90
|
+
|
|
91
|
+
Submit a crash report to help improve the SDK.
|
|
92
|
+
|
|
93
|
+
<!-- politty:command:crashreport send:description:end -->
|
|
94
|
+
|
|
95
|
+
<!-- politty:command:crashreport send:usage:start -->
|
|
96
|
+
|
|
97
|
+
**Usage**
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
tailor-sdk crashreport send [options]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
<!-- politty:command:crashreport send:usage:end -->
|
|
104
|
+
|
|
105
|
+
<!-- politty:command:crashreport send:options:start -->
|
|
106
|
+
|
|
107
|
+
**Options**
|
|
108
|
+
|
|
109
|
+
| Option | Alias | Description | Required | Default |
|
|
110
|
+
| --------------- | ----- | ----------------------------- | -------- | ------- |
|
|
111
|
+
| `--file <FILE>` | - | Path to the crash report file | Yes | - |
|
|
112
|
+
|
|
113
|
+
<!-- politty:command:crashreport send:options:end -->
|
|
114
|
+
|
|
115
|
+
<!-- politty:command:crashreport send:global-options-link:start -->
|
|
116
|
+
|
|
117
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
118
|
+
|
|
119
|
+
<!-- politty:command:crashreport send:global-options-link:end -->
|
package/docs/cli/executor.md
CHANGED
|
@@ -151,7 +151,7 @@ List or get executor jobs.
|
|
|
151
151
|
**Usage**
|
|
152
152
|
|
|
153
153
|
```
|
|
154
|
-
tailor-sdk executor jobs [options] <
|
|
154
|
+
tailor-sdk executor jobs [options] <executor-name> [job-id]
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
<!-- politty:command:executor jobs:usage:end -->
|
|
@@ -160,10 +160,10 @@ tailor-sdk executor jobs [options] <executorName> [jobId]
|
|
|
160
160
|
|
|
161
161
|
**Arguments**
|
|
162
162
|
|
|
163
|
-
| Argument
|
|
164
|
-
|
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
163
|
+
| Argument | Description | Required |
|
|
164
|
+
| --------------- | --------------------------------------- | -------- |
|
|
165
|
+
| `executor-name` | Executor name | Yes |
|
|
166
|
+
| `job-id` | Job ID (if provided, shows job details) | No |
|
|
167
167
|
|
|
168
168
|
<!-- politty:command:executor jobs:arguments:end -->
|
|
169
169
|
|
|
@@ -256,7 +256,7 @@ Trigger an executor manually.
|
|
|
256
256
|
**Usage**
|
|
257
257
|
|
|
258
258
|
```
|
|
259
|
-
tailor-sdk executor trigger [options] <
|
|
259
|
+
tailor-sdk executor trigger [options] <executor-name>
|
|
260
260
|
```
|
|
261
261
|
|
|
262
262
|
<!-- politty:command:executor trigger:usage:end -->
|
|
@@ -265,9 +265,9 @@ tailor-sdk executor trigger [options] <executorName>
|
|
|
265
265
|
|
|
266
266
|
**Arguments**
|
|
267
267
|
|
|
268
|
-
| Argument
|
|
269
|
-
|
|
|
270
|
-
| `
|
|
268
|
+
| Argument | Description | Required |
|
|
269
|
+
| --------------- | ------------- | -------- |
|
|
270
|
+
| `executor-name` | Executor name | Yes |
|
|
271
271
|
|
|
272
272
|
<!-- politty:command:executor trigger:arguments:end -->
|
|
273
273
|
|
package/docs/cli/function.md
CHANGED
|
@@ -139,7 +139,7 @@ List or get function execution logs.
|
|
|
139
139
|
**Usage**
|
|
140
140
|
|
|
141
141
|
```
|
|
142
|
-
tailor-sdk function logs [options] [
|
|
142
|
+
tailor-sdk function logs [options] [execution-id]
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
<!-- politty:command:function logs:usage:end -->
|
|
@@ -148,9 +148,9 @@ tailor-sdk function logs [options] [executionId]
|
|
|
148
148
|
|
|
149
149
|
**Arguments**
|
|
150
150
|
|
|
151
|
-
| Argument
|
|
152
|
-
|
|
|
153
|
-
| `
|
|
151
|
+
| Argument | Description | Required |
|
|
152
|
+
| -------------- | --------------------------------------------------- | -------- |
|
|
153
|
+
| `execution-id` | Execution ID (if provided, shows details with logs) | No |
|
|
154
154
|
|
|
155
155
|
<!-- politty:command:function logs:arguments:end -->
|
|
156
156
|
|
|
@@ -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 original source files via the inline sourcemap (clickable file links and code snippets, matching `function test-run` output).
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
The download is pinned to the bundle that actually ran using the execution's content hash, so stack traces stay accurate across redeploys when the server retains old bundles. The command falls back to a plain-text error display when the pinned bundle cannot be retrieved, or when the execution was recorded before content hashes started being tracked and the function was redeployed after it ran.
|
|
213
213
|
|
|
214
214
|
<!-- politty:command:function logs:notes:end -->
|
|
215
215
|
|
package/docs/cli/tailordb.md
CHANGED
|
@@ -135,7 +135,7 @@ Manage TailorDB schema migrations.
|
|
|
135
135
|
|
|
136
136
|
<!-- politty:command:tailordb migration:description:end -->
|
|
137
137
|
|
|
138
|
-
Note: Migration scripts are automatically executed during `tailor-sdk
|
|
138
|
+
Note: Migration scripts are automatically executed during `tailor-sdk deploy`. See [Automatic Migration Execution](../services/tailordb-migration.md#automatic-migration-execution) for details.
|
|
139
139
|
|
|
140
140
|
<!-- politty:command:tailordb migration:usage:start -->
|
|
141
141
|
|
package/docs/cli/workflow.md
CHANGED
|
@@ -202,7 +202,7 @@ List or get workflow executions.
|
|
|
202
202
|
**Usage**
|
|
203
203
|
|
|
204
204
|
```
|
|
205
|
-
tailor-sdk workflow executions [options] [
|
|
205
|
+
tailor-sdk workflow executions [options] [execution-id]
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
<!-- politty:command:workflow executions:usage:end -->
|
|
@@ -211,9 +211,9 @@ tailor-sdk workflow executions [options] [executionId]
|
|
|
211
211
|
|
|
212
212
|
**Arguments**
|
|
213
213
|
|
|
214
|
-
| Argument
|
|
215
|
-
|
|
|
216
|
-
| `
|
|
214
|
+
| Argument | Description | Required |
|
|
215
|
+
| -------------- | ----------------------------------------- | -------- |
|
|
216
|
+
| `execution-id` | Execution ID (if provided, shows details) | No |
|
|
217
217
|
|
|
218
218
|
<!-- politty:command:workflow executions:arguments:end -->
|
|
219
219
|
|
|
@@ -257,7 +257,7 @@ Resume a failed or pending workflow execution.
|
|
|
257
257
|
**Usage**
|
|
258
258
|
|
|
259
259
|
```
|
|
260
|
-
tailor-sdk workflow resume [options] <
|
|
260
|
+
tailor-sdk workflow resume [options] <execution-id>
|
|
261
261
|
```
|
|
262
262
|
|
|
263
263
|
<!-- politty:command:workflow resume:usage:end -->
|
|
@@ -266,9 +266,9 @@ tailor-sdk workflow resume [options] <executionId>
|
|
|
266
266
|
|
|
267
267
|
**Arguments**
|
|
268
268
|
|
|
269
|
-
| Argument
|
|
270
|
-
|
|
|
271
|
-
| `
|
|
269
|
+
| Argument | Description | Required |
|
|
270
|
+
| -------------- | ------------------- | -------- |
|
|
271
|
+
| `execution-id` | Failed execution ID | Yes |
|
|
272
272
|
|
|
273
273
|
<!-- politty:command:workflow resume:arguments:end -->
|
|
274
274
|
|
package/docs/cli-reference.md
CHANGED
|
@@ -43,10 +43,10 @@ Both `--env-file` and `--env-file-if-exists` can be specified multiple times and
|
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
# Load .env (required) and .env.local (optional, if exists)
|
|
46
|
-
tailor-sdk
|
|
46
|
+
tailor-sdk deploy --env-file .env --env-file-if-exists .env.local
|
|
47
47
|
|
|
48
48
|
# Load multiple files
|
|
49
|
-
tailor-sdk
|
|
49
|
+
tailor-sdk deploy --env-file .env --env-file .env.production
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## Environment Variables
|
|
@@ -99,7 +99,7 @@ Commands for managing Tailor Platform applications (work with `tailor.config.ts`
|
|
|
99
99
|
| ----------------------------------------------- | ------------------------------------------------------------------- |
|
|
100
100
|
| [init](./cli/application.md#init) | Initialize a new project using create-sdk. |
|
|
101
101
|
| [generate](./cli/application.md#generate) | Generate files using Tailor configuration. |
|
|
102
|
-
| [
|
|
102
|
+
| [deploy](./cli/application.md#deploy) | Deploy your application by applying the Tailor configuration. |
|
|
103
103
|
| [remove](./cli/application.md#remove) | Remove all resources managed by the application from the workspace. |
|
|
104
104
|
| [show](./cli/application.md#show) | Show information about the deployed application. |
|
|
105
105
|
| [open](./cli/application.md#open) | Open Tailor Platform Console. |
|
|
@@ -255,14 +255,14 @@ Commands for managing and deploying static websites.
|
|
|
255
255
|
| [staticwebsite list](./cli/staticwebsite.md#staticwebsite-list) | List all static websites in a workspace. |
|
|
256
256
|
| [staticwebsite get](./cli/staticwebsite.md#staticwebsite-get) | Get details of a specific static website. |
|
|
257
257
|
|
|
258
|
-
### [Crash Report Commands](./cli/
|
|
258
|
+
### [Crash Report Commands](./cli/crashreport.md)
|
|
259
259
|
|
|
260
260
|
Commands for managing crash reports.
|
|
261
261
|
|
|
262
|
-
| Command
|
|
263
|
-
|
|
|
264
|
-
| [
|
|
265
|
-
| [
|
|
262
|
+
| Command | Description |
|
|
263
|
+
| --------------------------------------------------------- | ---------------------------------------------- |
|
|
264
|
+
| [crashreport list](./cli/crashreport.md#crashreport-list) | List local crash report files. |
|
|
265
|
+
| [crashreport send](./cli/crashreport.md#crashreport-send) | Submit a crash report to help improve the SDK. |
|
|
266
266
|
|
|
267
267
|
### [Setup Commands](./cli/setup.md)
|
|
268
268
|
|
|
@@ -57,6 +57,42 @@ body: async (input, { env }) => {
|
|
|
57
57
|
};
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Raw SQL
|
|
61
|
+
|
|
62
|
+
For queries that the Kysely query builder can't express, use the `sql` tag re-exported from `@tailor-platform/sdk/kysely`. Plain value substitutions (`${...}`) are sent as bound parameters, so user-supplied values are parameterized safely. SQL fragments produced by Kysely helpers (for example `sql.raw(...)`, identifiers, refs) are inlined into the generated SQL string by design — do not pass untrusted input through those.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { sql } from "@tailor-platform/sdk/kysely";
|
|
66
|
+
import { getDB } from "./generated/tailordb";
|
|
67
|
+
|
|
68
|
+
createResolver({
|
|
69
|
+
name: "supplierCountByState",
|
|
70
|
+
operation: "query",
|
|
71
|
+
input: { country: t.string() },
|
|
72
|
+
output: t.object({
|
|
73
|
+
rows: t.array(t.object({ state: t.string(), count: t.int() })),
|
|
74
|
+
}),
|
|
75
|
+
body: async ({ input }) => {
|
|
76
|
+
const db = getDB("tailordb");
|
|
77
|
+
const { rows } = await sql<{ state: string; count: number }>`
|
|
78
|
+
SELECT state, COUNT(*) AS count
|
|
79
|
+
FROM "Supplier"
|
|
80
|
+
WHERE country = ${input.country}
|
|
81
|
+
GROUP BY state
|
|
82
|
+
`.execute(db);
|
|
83
|
+
return { rows };
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The same `sql` tag works inside `db.transaction().execute(async (trx) => ...)` by passing `trx` to `.execute()`:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
await db.transaction().execute(async (trx) => {
|
|
92
|
+
await sql`UPDATE "Supplier" SET state = ${state} WHERE id = ${id}`.execute(trx);
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
60
96
|
## @tailor-platform/enum-constants
|
|
61
97
|
|
|
62
98
|
Extracts enum constants from TailorDB type definitions.
|
package/docs/quickstart.md
CHANGED
|
@@ -16,7 +16,7 @@ The SDK requires Node.js 22 or later. Install Node.js via your package manager b
|
|
|
16
16
|
|
|
17
17
|
Alternatively, you can use [Bun](https://bun.sh/) as the runtime.
|
|
18
18
|
|
|
19
|
-
> **Note:** Bun has a known issue with HTTP/2 connections that may cause intermittent failures during `
|
|
19
|
+
> **Note:** Bun has a known issue with HTTP/2 connections that may cause intermittent failures during `deploy` or `generate` commands ([bun#14249](https://github.com/oven-sh/bun/issues/14249), [bun#26719](https://github.com/oven-sh/bun/issues/26719)). If you encounter a connection error, retry the command.
|
|
20
20
|
|
|
21
21
|
### Create an Example App
|
|
22
22
|
|
|
@@ -46,7 +46,7 @@ npx tailor-sdk workspace list
|
|
|
46
46
|
|
|
47
47
|
### Deploy Your App
|
|
48
48
|
|
|
49
|
-
Run the
|
|
49
|
+
Run the deploy command to deploy your project:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
cd example-app
|
package/docs/services/auth.md
CHANGED
|
@@ -388,7 +388,7 @@ export const auth = defineAuth("my-auth", {
|
|
|
388
388
|
});
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
-
After `tailor-sdk
|
|
391
|
+
After `tailor-sdk deploy`, authorize the connection:
|
|
392
392
|
|
|
393
393
|
```bash
|
|
394
394
|
tailor-sdk authconnection authorize --name google-connection \
|
|
@@ -448,7 +448,7 @@ tailor-sdk authconnection list
|
|
|
448
448
|
tailor-sdk authconnection revoke --name google-connection
|
|
449
449
|
```
|
|
450
450
|
|
|
451
|
-
Connection creation is handled by `tailor-sdk
|
|
451
|
+
Connection creation is handled by `tailor-sdk deploy` via the config.
|
|
452
452
|
|
|
453
453
|
See [Auth Resource Commands](../cli/auth.md) for full CLI documentation.
|
|
454
454
|
|
package/docs/services/secret.md
CHANGED
|
@@ -34,11 +34,11 @@ Secrets are key-value pairs stored within a vault. Secret values are encrypted a
|
|
|
34
34
|
|
|
35
35
|
## Managing Secrets
|
|
36
36
|
|
|
37
|
-
There are two ways to manage secrets: declaratively via `defineSecretManager()` in `tailor.config.ts`, or imperatively via the [CLI](#cli-management). Management is scoped per vault — **do not mix both approaches for the same vault**. When a vault is defined in config, the config becomes the source of truth: any secrets in that vault not present in the config will be deleted on `tailor-sdk
|
|
37
|
+
There are two ways to manage secrets: declaratively via `defineSecretManager()` in `tailor.config.ts`, or imperatively via the [CLI](#cli-management). Management is scoped per vault — **do not mix both approaches for the same vault**. When a vault is defined in config, the config becomes the source of truth: any secrets in that vault not present in the config will be deleted on `tailor-sdk deploy`.
|
|
38
38
|
|
|
39
39
|
### Declarative Configuration
|
|
40
40
|
|
|
41
|
-
Define your secrets in `tailor.config.ts` using `defineSecretManager()`. Each key is a vault name, and its value is a record of secret names to their values. These values are deployed to each vault on `tailor-sdk
|
|
41
|
+
Define your secrets in `tailor.config.ts` using `defineSecretManager()`. Each key is a vault name, and its value is a record of secret names to their values. These values are deployed to each vault on `tailor-sdk deploy`.
|
|
42
42
|
|
|
43
43
|
Since secret values should not be committed to source control, use environment variables:
|
|
44
44
|
|
|
@@ -87,7 +87,7 @@ When `ignoreNullishValues: true`:
|
|
|
87
87
|
- Skipped secrets are shown in the deploy output for visibility
|
|
88
88
|
- Secrets removed from the config entirely are still deleted (orphan cleanup)
|
|
89
89
|
|
|
90
|
-
This allows you to set secret values once (e.g., via local `tailor-sdk
|
|
90
|
+
This allows you to set secret values once (e.g., via local `tailor-sdk deploy` or the CLI) and then deploy from CI without needing the actual values in CI environment variables.
|
|
91
91
|
|
|
92
92
|
## Using Secrets
|
|
93
93
|
|
|
@@ -175,7 +175,7 @@ At runtime, these references are replaced with the actual secret values.
|
|
|
175
175
|
|
|
176
176
|
Use the CLI to manage vaults that are **not** defined in `defineSecretManager()`. If you attempt to modify a vault that is managed by the config, the CLI will show a warning and ask for confirmation. Once confirmed, the CLI releases the vault's ownership label so it is no longer managed by config.
|
|
177
177
|
|
|
178
|
-
After ownership is released, the next `tailor-sdk
|
|
178
|
+
After ownership is released, the next `tailor-sdk deploy` will treat the vault as an unmanaged resource and prompt for confirmation before taking any action on it.
|
|
179
179
|
|
|
180
180
|
### Create a Vault
|
|
181
181
|
|
|
@@ -12,7 +12,7 @@ For the CLI command reference, see [`tailordb migration`](../cli/tailordb.md#tai
|
|
|
12
12
|
|
|
13
13
|
- **Local snapshot–based diff detection** — each migration is generated by diffing your current type definitions against the previous snapshot stored in `migrations/<NNNN>/`.
|
|
14
14
|
- **Transaction-wrapped data migrations** — each `migrate.ts` script runs inside a database transaction on the platform; if the script throws, all changes in that migration roll back.
|
|
15
|
-
- **Automatic execution during `apply`** — `tailor-sdk
|
|
15
|
+
- **Automatic execution during `apply`** — `tailor-sdk deploy` detects pending migrations, runs the two-stage type update (pre-migration → script → post-migration), and updates the migration checkpoint label.
|
|
16
16
|
- **Type-safe scripts** — the generated `db.ts` provides Kysely types that reflect the schema state **before** the migration runs, so transformations are written against the actual data shape.
|
|
17
17
|
|
|
18
18
|
**Files in `migrations/`**
|
|
@@ -45,7 +45,7 @@ When you start with no `migrations/` directory:
|
|
|
45
45
|
tailor-sdk tailordb migration generate
|
|
46
46
|
```
|
|
47
47
|
This creates `migrations/0000/schema.json` from your current types.
|
|
48
|
-
4. Run `tailor-sdk
|
|
48
|
+
4. Run `tailor-sdk deploy`. The migration label is set to `0000` on the deployed namespace.
|
|
49
49
|
|
|
50
50
|
### Adding migrations to an existing project
|
|
51
51
|
|
|
@@ -53,7 +53,7 @@ If you already have a deployed workspace whose schema matches your local type de
|
|
|
53
53
|
|
|
54
54
|
1. Add the `migration` block to `tailor.config.ts`.
|
|
55
55
|
2. Run `tailor-sdk tailordb migration generate` to create `0000/schema.json` from current local types.
|
|
56
|
-
3. Run `tailor-sdk
|
|
56
|
+
3. Run `tailor-sdk deploy`. Because remote schema already matches, no script runs; only the migration label is set.
|
|
57
57
|
|
|
58
58
|
If your local types and remote schema have **diverged**, reconcile them before introducing migrations — either update local types to match remote, or accept that the first non-`0000` migration will reflect that gap.
|
|
59
59
|
|
|
@@ -109,7 +109,7 @@ A typical change cycle:
|
|
|
109
109
|
|
|
110
110
|
4. **Apply.**
|
|
111
111
|
```bash
|
|
112
|
-
tailor-sdk
|
|
112
|
+
tailor-sdk deploy
|
|
113
113
|
```
|
|
114
114
|
The pre-migration phase relaxes the new field to optional, the script runs and populates values, then the post-migration phase enforces `required: true`.
|
|
115
115
|
|
|
@@ -210,7 +210,7 @@ The same pattern works for switching between scalar and array.
|
|
|
210
210
|
|
|
211
211
|
## Automatic Migration Execution
|
|
212
212
|
|
|
213
|
-
When you run `tailor-sdk
|
|
213
|
+
When you run `tailor-sdk deploy`, the SDK detects pending migrations (anything past the current `sdk-migration` label on the deployed namespace) and runs them in order before continuing with the rest of the apply.
|
|
214
214
|
|
|
215
215
|
### Per-migration phases
|
|
216
216
|
|
|
@@ -243,7 +243,7 @@ Namespace: tailordb
|
|
|
243
243
|
To bypass both checks (not recommended outside of recovery scenarios):
|
|
244
244
|
|
|
245
245
|
```bash
|
|
246
|
-
tailor-sdk
|
|
246
|
+
tailor-sdk deploy --no-schema-check
|
|
247
247
|
```
|
|
248
248
|
|
|
249
249
|
### Example output
|
|
@@ -299,7 +299,7 @@ Migration numbers are assigned sequentially, so two developers branching off the
|
|
|
299
299
|
|
|
300
300
|
1. Run `migration generate --init` to start over from `0000`.
|
|
301
301
|
2. Run `tailor-sdk tailordb migration set 0` against the deployed namespace.
|
|
302
|
-
3. Run `tailor-sdk
|
|
302
|
+
3. Run `tailor-sdk deploy` — the new `0000` becomes the baseline.
|
|
303
303
|
|
|
304
304
|
Coordinate this with your team because everyone else's local migrations will be invalidated.
|
|
305
305
|
|
|
@@ -315,7 +315,7 @@ After a failure:
|
|
|
315
315
|
|
|
316
316
|
1. Read the `Logs:` block in the apply output to find the cause.
|
|
317
317
|
2. Fix `migrate.ts` (or the data it depends on).
|
|
318
|
-
3. Re-run `tailor-sdk
|
|
318
|
+
3. Re-run `tailor-sdk deploy`. The same migration runs again because its label was never bumped.
|
|
319
319
|
4. If the pre-migration relaxation is causing problems for application code in the meantime, accept the temporary optionality or roll forward with a fix; do not try to manually re-tighten the schema, or you'll create remote drift.
|
|
320
320
|
|
|
321
321
|
If a migration **succeeds in script** but the post-migration phase fails (rare; usually due to constraint violation that the script should have prevented), the situation is the same as above plus the data changes from the script are persisted. Investigate, fix, and re-run.
|
|
@@ -345,7 +345,7 @@ The machine user needs read/write access to every type the migration script touc
|
|
|
345
345
|
|
|
346
346
|
If you see `No machine user available for migration execution`, either:
|
|
347
347
|
|
|
348
|
-
- Add `machineUsers: { ... }` to your auth config and `tailor-sdk
|
|
348
|
+
- Add `machineUsers: { ... }` to your auth config and `tailor-sdk deploy` it, or
|
|
349
349
|
- Set `migration.machineUser` to an existing machine user name in the db config.
|
|
350
350
|
|
|
351
351
|
## Multi-Namespace Coordination
|
|
@@ -409,7 +409,7 @@ For genuinely different schemas across environments, prefer separate workspaces
|
|
|
409
409
|
|
|
410
410
|
**Cause:** Runtime error in your `migrate.ts`, a permission error from the machine user, or a constraint violation when post-migration tightens types.
|
|
411
411
|
|
|
412
|
-
**Resolution:** Read the `Logs:` block. Fix the script or the data assumption it relies on, and re-run `tailor-sdk
|
|
412
|
+
**Resolution:** Read the `Logs:` block. Fix the script or the data assumption it relies on, and re-run `tailor-sdk deploy`. The label is not bumped on failure, so the same migration retries.
|
|
413
413
|
|
|
414
414
|
### `migrate.ts` not found for a migration that needs one
|
|
415
415
|
|
|
@@ -589,6 +589,6 @@ db.type("User", {
|
|
|
589
589
|
|
|
590
590
|
## Migrations
|
|
591
591
|
|
|
592
|
-
When you change a TailorDB type definition, the SDK can generate a migration that captures the diff and, for breaking changes, runs a data transformation script during `tailor-sdk
|
|
592
|
+
When you change a TailorDB type definition, the SDK can generate a migration that captures the diff and, for breaking changes, runs a data transformation script during `tailor-sdk deploy`. See the [TailorDB Migrations guide](./tailordb-migration.md) for the full workflow, configuration, supported change types, team coordination, and troubleshooting.
|
|
593
593
|
|
|
594
594
|
For the CLI command reference, see [`tailordb migration`](../cli/tailordb.md#tailordb-migration).
|