@tailor-platform/sdk 1.28.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 +18 -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 +54 -19
- 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-WYq8RvYp.mjs → query-B1-hq2Hm.mjs} +69 -27
- 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/user.md +21 -22
- package/docs/cli/workspace.md +0 -7
- package/docs/cli-reference.md +12 -10
- package/docs/services/executor.md +46 -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-WYq8RvYp.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/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
|
|
|
@@ -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/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",
|