@tailor-platform/sdk 1.27.0 → 1.29.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 +24 -0
- package/dist/{application-CBJFUKrU.mjs → application-Clwpv84E.mjs} +9 -5
- package/dist/application-Clwpv84E.mjs.map +1 -0
- package/dist/{application-WyZetOky.mjs → application-Dl1d7w-b.mjs} +3 -3
- package/dist/chunk-DEt8GZDa.mjs +8 -0
- package/dist/cli/index.mjs +154 -21
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +5 -5
- package/dist/cli/skills.mjs +1 -1
- package/dist/client-CW4Oh3iz.mjs +6 -0
- package/dist/client-CZmQBXAY.mjs +16294 -0
- package/dist/client-CZmQBXAY.mjs.map +1 -0
- package/dist/configure/index.mjs +1 -1
- package/dist/{crash-report-Cot_9Esm.mjs → crash-report-CYrETw1c.mjs} +2 -2
- package/dist/{crash-report-Ju8cQF-l.mjs → crash-report-DizNMVnm.mjs} +3 -3
- package/dist/{crash-report-Ju8cQF-l.mjs.map → crash-report-DizNMVnm.mjs.map} +1 -1
- package/dist/{interceptor-B0d_GrI5.mjs → interceptor-DgQNmwWJ.mjs} +2 -2
- package/dist/{interceptor-B0d_GrI5.mjs.map → interceptor-DgQNmwWJ.mjs.map} +1 -1
- package/dist/kysely/index.mjs +1 -1
- package/dist/{package-json-DHfTiUCS.mjs → package-json-DiZWrkIA.mjs} +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.mjs +1 -1
- package/dist/{query-CgGbAmUg.mjs → query-B1-hq2Hm.mjs} +70 -28
- package/dist/query-B1-hq2Hm.mjs.map +1 -0
- package/dist/seed/index.mjs +1 -1
- package/dist/{telemetry-VvNfsyEE.mjs → telemetry-BSUlYTs-.mjs} +2 -2
- package/dist/{telemetry-VvNfsyEE.mjs.map → telemetry-BSUlYTs-.mjs.map} +1 -1
- package/dist/telemetry-BtN2l0f1.mjs +4 -0
- package/dist/utils/test/index.mjs +1 -1
- package/docs/cli/secret.md +16 -14
- package/docs/cli/user.md +21 -22
- package/docs/cli/workspace.md +0 -7
- package/docs/cli-reference.md +12 -10
- package/docs/configuration.md +19 -0
- package/docs/services/executor.md +46 -0
- package/docs/services/secret.md +81 -0
- package/package.json +8 -8
- package/dist/application-CBJFUKrU.mjs.map +0 -1
- package/dist/chunk-Cz-A8uMR.mjs +0 -3
- package/dist/client-C2_wgujH.mjs +0 -6
- package/dist/client-bTbnbQbB.mjs +0 -957
- package/dist/client-bTbnbQbB.mjs.map +0 -1
- package/dist/query-CgGbAmUg.mjs.map +0 -1
- package/dist/telemetry-BevrwWwF.mjs +0 -4
package/dist/seed/index.mjs
CHANGED
|
@@ -34,7 +34,7 @@ async function initTelemetry() {
|
|
|
34
34
|
import("@opentelemetry/exporter-trace-otlp-proto"),
|
|
35
35
|
import("@opentelemetry/resources"),
|
|
36
36
|
import("@opentelemetry/semantic-conventions"),
|
|
37
|
-
import("./package-json-
|
|
37
|
+
import("./package-json-DiZWrkIA.mjs")
|
|
38
38
|
]);
|
|
39
39
|
const version = (await readPackageJson()).version ?? "unknown";
|
|
40
40
|
_provider = new NodeTracerProvider({
|
|
@@ -81,4 +81,4 @@ async function withSpan(name, fn) {
|
|
|
81
81
|
|
|
82
82
|
//#endregion
|
|
83
83
|
export { shutdownTelemetry as n, withSpan as r, initTelemetry as t };
|
|
84
|
-
//# sourceMappingURL=telemetry-
|
|
84
|
+
//# sourceMappingURL=telemetry-BSUlYTs-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-
|
|
1
|
+
{"version":3,"file":"telemetry-BSUlYTs-.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,WADc,MAAM,iBAAiB,EACf,WAAW;AAWvC,aAAY,IAAI,mBAAmB;EACjC,UAVe,uBAAuB;IACrC,oBAAoB;IACpB,uBAAuB;GACzB,CAAC;EAQA,gBAAgB,CAAC,IAAI,mBANN,IAAI,kBAAkB,EACrC,KAAK,GAAG,QAAQ,SAAS,aAC1B,CAAC,CAIiD,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,aAAa,CAE9B,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"}
|
package/docs/cli/secret.md
CHANGED
|
@@ -243,13 +243,14 @@ tailor-sdk secret create [options]
|
|
|
243
243
|
|
|
244
244
|
**Options**
|
|
245
245
|
|
|
246
|
-
| Option | Alias | Description
|
|
247
|
-
| ------------------------------- | ----- |
|
|
248
|
-
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID
|
|
249
|
-
| `--profile <PROFILE>` | `-p` | Workspace profile
|
|
250
|
-
| `--vault-name <VAULT_NAME>` | `-V` | Vault name
|
|
251
|
-
| `--name <NAME>` | `-n` | Secret name
|
|
252
|
-
| `--value <VALUE>` | `-v` | Secret value
|
|
246
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
247
|
+
| ------------------------------- | ----- | ------------------------- | -------- | ------- | ------------------------------ |
|
|
248
|
+
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
|
|
249
|
+
| `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
250
|
+
| `--vault-name <VAULT_NAME>` | `-V` | Vault name | Yes | - | - |
|
|
251
|
+
| `--name <NAME>` | `-n` | Secret name | Yes | - | - |
|
|
252
|
+
| `--value <VALUE>` | `-v` | Secret value | Yes | - | - |
|
|
253
|
+
| `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
|
|
253
254
|
|
|
254
255
|
<!-- politty:command:secret create:options:end -->
|
|
255
256
|
|
|
@@ -284,13 +285,14 @@ tailor-sdk secret update [options]
|
|
|
284
285
|
|
|
285
286
|
**Options**
|
|
286
287
|
|
|
287
|
-
| Option | Alias | Description
|
|
288
|
-
| ------------------------------- | ----- |
|
|
289
|
-
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID
|
|
290
|
-
| `--profile <PROFILE>` | `-p` | Workspace profile
|
|
291
|
-
| `--vault-name <VAULT_NAME>` | `-V` | Vault name
|
|
292
|
-
| `--name <NAME>` | `-n` | Secret name
|
|
293
|
-
| `--value <VALUE>` | `-v` | Secret value
|
|
288
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
289
|
+
| ------------------------------- | ----- | ------------------------- | -------- | ------- | ------------------------------ |
|
|
290
|
+
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
|
|
291
|
+
| `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
292
|
+
| `--vault-name <VAULT_NAME>` | `-V` | Vault name | Yes | - | - |
|
|
293
|
+
| `--name <NAME>` | `-n` | Secret name | Yes | - | - |
|
|
294
|
+
| `--value <VALUE>` | `-v` | Secret value | Yes | - | - |
|
|
295
|
+
| `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
|
|
294
296
|
|
|
295
297
|
<!-- politty:command:secret update:options:end -->
|
|
296
298
|
|
package/docs/cli/user.md
CHANGED
|
@@ -19,11 +19,31 @@ Login to Tailor Platform.
|
|
|
19
19
|
**Usage**
|
|
20
20
|
|
|
21
21
|
```
|
|
22
|
-
tailor-sdk login
|
|
22
|
+
tailor-sdk login [options]
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
<!-- politty:command:login:usage:end -->
|
|
26
26
|
|
|
27
|
+
<!-- politty:command:login:options:start -->
|
|
28
|
+
|
|
29
|
+
**Options**
|
|
30
|
+
|
|
31
|
+
> One of the following option groups is required:
|
|
32
|
+
|
|
33
|
+
**User Login:**
|
|
34
|
+
|
|
35
|
+
_no options_
|
|
36
|
+
|
|
37
|
+
**Machine User Login:**
|
|
38
|
+
|
|
39
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
40
|
+
| --------------------------------- | ----- | --------------------------------- | -------- | ------- | -------------------------------------------- |
|
|
41
|
+
| `--machineuser <MACHINEUSER>` | - | Login as a platform machine user. | Yes | - | - |
|
|
42
|
+
| `--client-id <CLIENT_ID>` | - | Client ID | Yes | - | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` |
|
|
43
|
+
| `--client-secret <CLIENT_SECRET>` | - | Client secret | No | - | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` |
|
|
44
|
+
|
|
45
|
+
<!-- politty:command:login:options:end -->
|
|
46
|
+
|
|
27
47
|
<!-- politty:command:login:global-options-link:start -->
|
|
28
48
|
|
|
29
49
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
@@ -148,13 +168,6 @@ tailor-sdk user list
|
|
|
148
168
|
<!-- politty:command:user list:usage:end -->
|
|
149
169
|
|
|
150
170
|
<!-- politty:command:user list:options:start -->
|
|
151
|
-
|
|
152
|
-
**Options**
|
|
153
|
-
|
|
154
|
-
| Option | Alias | Description | Required | Default |
|
|
155
|
-
| -------- | ----- | -------------- | -------- | ------- |
|
|
156
|
-
| `--json` | `-j` | Output as JSON | No | `false` |
|
|
157
|
-
|
|
158
171
|
<!-- politty:command:user list:options:end -->
|
|
159
172
|
|
|
160
173
|
<!-- politty:command:user list:global-options-link:start -->
|
|
@@ -222,13 +235,6 @@ tailor-sdk user pat [command]
|
|
|
222
235
|
<!-- politty:command:user pat:usage:end -->
|
|
223
236
|
|
|
224
237
|
<!-- politty:command:user pat:options:start -->
|
|
225
|
-
|
|
226
|
-
**Options**
|
|
227
|
-
|
|
228
|
-
| Option | Alias | Description | Required | Default |
|
|
229
|
-
| -------- | ----- | -------------- | -------- | ------- |
|
|
230
|
-
| `--json` | `-j` | Output as JSON | No | `false` |
|
|
231
|
-
|
|
232
238
|
<!-- politty:command:user pat:options:end -->
|
|
233
239
|
|
|
234
240
|
<!-- politty:command:user pat:subcommands:start -->
|
|
@@ -272,13 +278,6 @@ tailor-sdk user pat list
|
|
|
272
278
|
<!-- politty:command:user pat list:usage:end -->
|
|
273
279
|
|
|
274
280
|
<!-- politty:command:user pat list:options:start -->
|
|
275
|
-
|
|
276
|
-
**Options**
|
|
277
|
-
|
|
278
|
-
| Option | Alias | Description | Required | Default |
|
|
279
|
-
| -------- | ----- | -------------- | -------- | ------- |
|
|
280
|
-
| `--json` | `-j` | Output as JSON | No | `false` |
|
|
281
|
-
|
|
282
281
|
<!-- politty:command:user pat list:options:end -->
|
|
283
282
|
|
|
284
283
|
<!-- politty:command:user pat list:global-options-link:start -->
|
package/docs/cli/workspace.md
CHANGED
|
@@ -274,13 +274,6 @@ tailor-sdk profile list
|
|
|
274
274
|
<!-- politty:command:profile list:usage:end -->
|
|
275
275
|
|
|
276
276
|
<!-- politty:command:profile list:options:start -->
|
|
277
|
-
|
|
278
|
-
**Options**
|
|
279
|
-
|
|
280
|
-
| Option | Alias | Description | Required | Default |
|
|
281
|
-
| -------- | ----- | -------------- | -------- | ------- |
|
|
282
|
-
| `--json` | `-j` | Output as JSON | No | `false` |
|
|
283
|
-
|
|
284
277
|
<!-- politty:command:profile list:options:end -->
|
|
285
278
|
|
|
286
279
|
<!-- politty:command:profile list:global-options-link:start -->
|
package/docs/cli-reference.md
CHANGED
|
@@ -53,16 +53,18 @@ tailor-sdk apply --env-file .env --env-file .env.production
|
|
|
53
53
|
|
|
54
54
|
You can use environment variables to configure workspace and authentication:
|
|
55
55
|
|
|
56
|
-
| Variable
|
|
57
|
-
|
|
|
58
|
-
| `TAILOR_PLATFORM_WORKSPACE_ID`
|
|
59
|
-
| `TAILOR_PLATFORM_TOKEN`
|
|
60
|
-
| `TAILOR_TOKEN`
|
|
61
|
-
| `TAILOR_PLATFORM_PROFILE`
|
|
62
|
-
| `TAILOR_PLATFORM_SDK_CONFIG_PATH`
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
56
|
+
| Variable | Description |
|
|
57
|
+
| -------------------------------------------- | --------------------------------------------------------------------------- |
|
|
58
|
+
| `TAILOR_PLATFORM_WORKSPACE_ID` | Workspace ID for deployment commands |
|
|
59
|
+
| `TAILOR_PLATFORM_TOKEN` | Authentication token (alternative to `login`) |
|
|
60
|
+
| `TAILOR_TOKEN` | **Deprecated.** Use `TAILOR_PLATFORM_TOKEN` instead |
|
|
61
|
+
| `TAILOR_PLATFORM_PROFILE` | Workspace profile name |
|
|
62
|
+
| `TAILOR_PLATFORM_SDK_CONFIG_PATH` | Path to SDK config file |
|
|
63
|
+
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` | Client ID for `login --machineuser` |
|
|
64
|
+
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | Client secret for `login --machineuser` |
|
|
65
|
+
| `VISUAL` / `EDITOR` | Preferred editor for commands that open files (e.g., `vim`, `code`, `nano`) |
|
|
66
|
+
| `TAILOR_CRASH_REPORTS_LOCAL` | Local crash log writing: `on` (default) or `off` |
|
|
67
|
+
| `TAILOR_CRASH_REPORTS_REMOTE` | Automatic crash report submission: `off` (default) or `on` |
|
|
66
68
|
|
|
67
69
|
### Authentication Token Priority
|
|
68
70
|
|
package/docs/configuration.md
CHANGED
|
@@ -145,6 +145,25 @@ export default defineConfig({
|
|
|
145
145
|
});
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
+
### Secret Manager
|
|
149
|
+
|
|
150
|
+
Configure secrets using `defineSecretManager()`. See [Secret Manager](./services/secret.md) for full documentation.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { defineSecretManager } from "@tailor-platform/sdk";
|
|
154
|
+
|
|
155
|
+
export const secrets = defineSecretManager({
|
|
156
|
+
"api-keys": {
|
|
157
|
+
"stripe-secret-key": process.env.STRIPE_SECRET_KEY!,
|
|
158
|
+
"sendgrid-api-key": process.env.SENDGRID_API_KEY!,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export default defineConfig({
|
|
163
|
+
secrets,
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
148
167
|
### Environment Variables
|
|
149
168
|
|
|
150
169
|
Define environment variables that can be accessed in resolvers, executors, and workflows:
|
|
@@ -99,6 +99,30 @@ resolverExecutedTrigger({
|
|
|
99
99
|
});
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
### IdP User Triggers
|
|
103
|
+
|
|
104
|
+
Fire when IdP users are created, updated, or deleted:
|
|
105
|
+
|
|
106
|
+
- `idpUserCreatedTrigger()`: Fires when a new IdP user is created
|
|
107
|
+
- `idpUserUpdatedTrigger()`: Fires when an IdP user is updated
|
|
108
|
+
- `idpUserDeletedTrigger()`: Fires when an IdP user is deleted
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
idpUserCreatedTrigger();
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Auth Access Token Triggers
|
|
115
|
+
|
|
116
|
+
Fire on auth access token lifecycle events:
|
|
117
|
+
|
|
118
|
+
- `authAccessTokenIssuedTrigger()`: Fires when a new access token is issued
|
|
119
|
+
- `authAccessTokenRefreshedTrigger()`: Fires when an access token is refreshed
|
|
120
|
+
- `authAccessTokenRevokedTrigger()`: Fires when an access token is revoked
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
authAccessTokenIssuedTrigger();
|
|
124
|
+
```
|
|
125
|
+
|
|
102
126
|
## Operation Types
|
|
103
127
|
|
|
104
128
|
### Function Operation
|
|
@@ -401,3 +425,25 @@ export default createExecutor({
|
|
|
401
425
|
},
|
|
402
426
|
});
|
|
403
427
|
```
|
|
428
|
+
|
|
429
|
+
### IdP User Event Payload
|
|
430
|
+
|
|
431
|
+
IdP user triggers receive user context:
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
interface IdpUserContext {
|
|
435
|
+
namespaceName: string; // IdP namespace name
|
|
436
|
+
userId: string; // The affected user ID
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Auth Access Token Event Payload
|
|
441
|
+
|
|
442
|
+
Auth access token triggers receive token context:
|
|
443
|
+
|
|
444
|
+
```typescript
|
|
445
|
+
interface AuthAccessTokenContext {
|
|
446
|
+
namespaceName: string; // Auth namespace name
|
|
447
|
+
userId: string; // The user associated with the token
|
|
448
|
+
}
|
|
449
|
+
```
|
package/docs/services/secret.md
CHANGED
|
@@ -32,8 +32,85 @@ workspace/
|
|
|
32
32
|
|
|
33
33
|
Secrets are key-value pairs stored within a vault. Secret values are encrypted at rest and only accessible at runtime by authorized services.
|
|
34
34
|
|
|
35
|
+
## Managing Secrets
|
|
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 apply`.
|
|
38
|
+
|
|
39
|
+
### Declarative Configuration
|
|
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 apply`.
|
|
42
|
+
|
|
43
|
+
Since secret values should not be committed to source control, use environment variables:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { defineConfig, defineSecretManager } from "@tailor-platform/sdk";
|
|
47
|
+
|
|
48
|
+
export const secrets = defineSecretManager({
|
|
49
|
+
"api-keys": {
|
|
50
|
+
"stripe-secret-key": process.env.STRIPE_SECRET_KEY!,
|
|
51
|
+
"sendgrid-api-key": process.env.SENDGRID_API_KEY!,
|
|
52
|
+
},
|
|
53
|
+
database: {
|
|
54
|
+
"analytics-connection-string": process.env.ANALYTICS_DB_URL!,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export default defineConfig({
|
|
59
|
+
name: "my-app",
|
|
60
|
+
secrets,
|
|
61
|
+
// ...other config
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The exported `secrets` object provides type-safe `get()` and `getAll()` methods for runtime access from resolvers, executors, and workflows.
|
|
66
|
+
|
|
35
67
|
## Using Secrets
|
|
36
68
|
|
|
69
|
+
### Runtime Access with `get()` / `getAll()`
|
|
70
|
+
|
|
71
|
+
Use the `secrets` object exported from `tailor.config.ts` to retrieve secret values at runtime. The vault and secret names are fully type-checked based on the `defineSecretManager()` configuration.
|
|
72
|
+
|
|
73
|
+
#### `get(vault, secret)`
|
|
74
|
+
|
|
75
|
+
Retrieves a single secret value.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { createResolver } from "@tailor-platform/sdk";
|
|
79
|
+
import { secrets } from "../tailor.config";
|
|
80
|
+
|
|
81
|
+
export default createResolver({
|
|
82
|
+
name: "call-stripe",
|
|
83
|
+
// ...
|
|
84
|
+
operation: async ({ input }) => {
|
|
85
|
+
const apiKey = await secrets.get("api-keys", "stripe-secret-key");
|
|
86
|
+
// Use apiKey to call the Stripe API
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### `getAll(vault, secrets)`
|
|
92
|
+
|
|
93
|
+
Retrieves multiple secret values at once from the same vault.
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { createResolver } from "@tailor-platform/sdk";
|
|
97
|
+
import { secrets } from "../tailor.config";
|
|
98
|
+
|
|
99
|
+
export default createResolver({
|
|
100
|
+
name: "send-notification",
|
|
101
|
+
// ...
|
|
102
|
+
operation: async ({ input }) => {
|
|
103
|
+
const [apiKey, webhookSecret] = await secrets.getAll("api-keys", [
|
|
104
|
+
"sendgrid-api-key",
|
|
105
|
+
"stripe-secret-key",
|
|
106
|
+
]);
|
|
107
|
+
// Use the retrieved secrets
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Both methods return `Promise<string | undefined>` (or an array of them for `getAll`).
|
|
113
|
+
|
|
37
114
|
### In Webhook Operations
|
|
38
115
|
|
|
39
116
|
Reference secrets in webhook headers using the vault/key syntax:
|
|
@@ -71,6 +148,10 @@ At runtime, these references are replaced with the actual secret values.
|
|
|
71
148
|
|
|
72
149
|
## CLI Management
|
|
73
150
|
|
|
151
|
+
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.
|
|
152
|
+
|
|
153
|
+
After ownership is released, the next `tailor-sdk apply` will treat the vault as an unmanaged resource and prompt for confirmation before taking any action on it.
|
|
154
|
+
|
|
74
155
|
### Create a Vault
|
|
75
156
|
|
|
76
157
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@opentelemetry/resources": "2.6.0",
|
|
90
90
|
"@opentelemetry/sdk-trace-node": "2.6.0",
|
|
91
91
|
"@opentelemetry/semantic-conventions": "1.40.0",
|
|
92
|
-
"@oxc-project/types": "0.
|
|
92
|
+
"@oxc-project/types": "0.120.0",
|
|
93
93
|
"@standard-schema/spec": "1.1.0",
|
|
94
94
|
"@tailor-platform/function-kysely-tailordb": "0.1.3",
|
|
95
95
|
"@toiroakr/lines-db": "0.9.0",
|
|
@@ -102,18 +102,18 @@
|
|
|
102
102
|
"find-up-simple": "1.0.1",
|
|
103
103
|
"globals": "17.0.0",
|
|
104
104
|
"inflection": "3.0.2",
|
|
105
|
-
"kysely": "0.28.
|
|
105
|
+
"kysely": "0.28.14",
|
|
106
106
|
"madge": "8.0.0",
|
|
107
107
|
"mime-types": "3.0.2",
|
|
108
108
|
"multiline-ts": "4.0.1",
|
|
109
109
|
"open": "11.0.0",
|
|
110
110
|
"ora": "9.0.0",
|
|
111
|
-
"oxc-parser": "0.
|
|
112
|
-
"p-limit": "7.
|
|
111
|
+
"oxc-parser": "0.119.0",
|
|
112
|
+
"p-limit": "7.3.0",
|
|
113
113
|
"pathe": "2.0.3",
|
|
114
114
|
"pgsql-ast-parser": "12.0.2",
|
|
115
115
|
"pkg-types": "2.3.0",
|
|
116
|
-
"politty": "0.4.
|
|
116
|
+
"politty": "0.4.11",
|
|
117
117
|
"rolldown": "1.0.0-rc.9",
|
|
118
118
|
"serve": "14.2.6",
|
|
119
119
|
"std-env": "3.10.0",
|
|
@@ -135,8 +135,8 @@
|
|
|
135
135
|
"@vitest/coverage-v8": "4.1.0",
|
|
136
136
|
"eslint": "9.39.4",
|
|
137
137
|
"eslint-plugin-jsdoc": "62.8.0",
|
|
138
|
-
"eslint-plugin-oxlint": "1.
|
|
139
|
-
"oxlint": "1.
|
|
138
|
+
"eslint-plugin-oxlint": "1.55.0",
|
|
139
|
+
"oxlint": "1.55.0",
|
|
140
140
|
"oxlint-tsgolint": "0.16.0",
|
|
141
141
|
"sonda": "0.11.1",
|
|
142
142
|
"tsdown": "0.21.2",
|