@tailor-platform/sdk 1.47.0 → 1.48.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/dist/{actor-DhXSqWTW.d.mts → actor-BeIEiPYM.d.mts} +3 -3
  3. package/dist/application-BNkNt47b.mjs +4 -0
  4. package/dist/{application-TasSqBTD.mjs → application-DUENhx4Y.mjs} +124 -79
  5. package/dist/application-DUENhx4Y.mjs.map +1 -0
  6. package/dist/{brand-Ll48SMXe.mjs → brand-D-d15jx3.mjs} +1 -1
  7. package/dist/{brand-Ll48SMXe.mjs.map → brand-D-d15jx3.mjs.map} +1 -1
  8. package/dist/cli/index.mjs +15 -15
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +6 -6
  11. package/dist/cli/lib.mjs +4 -4
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/cli/skills.mjs.map +1 -1
  14. package/dist/{client-DYSkSLRr.mjs → client-CPW1N1Rs.mjs} +1 -1
  15. package/dist/client-_kHh0Pip.mjs +1061 -0
  16. package/dist/client-_kHh0Pip.mjs.map +1 -0
  17. package/dist/configure/index.d.mts +4 -4
  18. package/dist/configure/index.mjs +54 -6
  19. package/dist/configure/index.mjs.map +1 -1
  20. package/dist/{crashreport-CKJwnWsX.mjs → crashreport-CvmdFs4i.mjs} +5 -5
  21. package/dist/crashreport-CvmdFs4i.mjs.map +1 -0
  22. package/dist/{crashreport-B8lVOx0U.mjs → crashreport-DHJuSmUc.mjs} +1 -1
  23. package/dist/enum-constants-C3KSpsYj.mjs.map +1 -1
  24. package/dist/{errors-wNQxQQBH.mjs → errors-pMPXghkO.mjs} +1 -1
  25. package/dist/{errors-wNQxQQBH.mjs.map → errors-pMPXghkO.mjs.map} +1 -1
  26. package/dist/{field-BY2vbJ8f.mjs → field-DLSIuMTu.mjs} +1 -1
  27. package/dist/{field-BY2vbJ8f.mjs.map → field-DLSIuMTu.mjs.map} +1 -1
  28. package/dist/file-utils-DjNi_3U_.mjs.map +1 -1
  29. package/dist/index-BQ4oi0AI.d.mts +48 -0
  30. package/dist/{index-BbOTbZFf.d.mts → index-BjXN1SdY.d.mts} +2 -2
  31. package/dist/{index-BoU_52Du.d.mts → index-C--7W0UO.d.mts} +8 -16
  32. package/dist/{index-BRvNi5q9.d.mts → index-VJW98BSy.d.mts} +2 -2
  33. package/dist/{index-iy-hNfGp.d.mts → index-nV4ZC_Ve.d.mts} +2 -2
  34. package/dist/{interceptor-CBsqEWDK.mjs → interceptor-DTNS0EtF.mjs} +1 -1
  35. package/dist/{interceptor-CBsqEWDK.mjs.map → interceptor-DTNS0EtF.mjs.map} +1 -1
  36. package/dist/{job-BOvKyNdT.mjs → job-M3Avv_SV.mjs} +5 -5
  37. package/dist/job-M3Avv_SV.mjs.map +1 -0
  38. package/dist/kysely/index.mjs.map +1 -1
  39. package/dist/kysely-type-B8aRz_oC.mjs.map +1 -1
  40. package/dist/logger-DTNAMYGy.mjs.map +1 -1
  41. package/dist/{mock-BP-9O5On.mjs → mock-BfL09ULZ.mjs} +1 -1
  42. package/dist/{mock-BP-9O5On.mjs.map → mock-BfL09ULZ.mjs.map} +1 -1
  43. package/dist/multiline-e3IpANmS.mjs.map +1 -1
  44. package/dist/package-json-6Px8bDpG.mjs.map +1 -1
  45. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  46. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  47. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  48. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  49. package/dist/plugin/builtin/seed/index.mjs +1 -1
  50. package/dist/plugin/index.d.mts +2 -2
  51. package/dist/plugin/index.mjs.map +1 -1
  52. package/dist/{repl-editor-CZpLlOBj.mjs → repl-editor-jZ493eQI.mjs} +1 -1
  53. package/dist/{repl-editor-CZpLlOBj.mjs.map → repl-editor-jZ493eQI.mjs.map} +1 -1
  54. package/dist/{runtime-DDYL2Zf1.mjs → runtime-CNg0w27y.mjs} +400 -126
  55. package/dist/runtime-CNg0w27y.mjs.map +1 -0
  56. package/dist/{tailordb-Bg9-TZj1.mjs → schema-C5QjYEc-.mjs} +4 -44
  57. package/dist/schema-C5QjYEc-.mjs.map +1 -0
  58. package/dist/secret-file-BHpxGyNf.mjs +65 -0
  59. package/dist/secret-file-BHpxGyNf.mjs.map +1 -0
  60. package/dist/seed/index.mjs.map +1 -1
  61. package/dist/{seed-DrKY5yIF.mjs → seed-DjfAn0BC.mjs} +44 -19
  62. package/dist/seed-DjfAn0BC.mjs.map +1 -0
  63. package/dist/{service-obEU5gSM.mjs → service-DCgJxdg1.mjs} +2 -2
  64. package/dist/{service-obEU5gSM.mjs.map → service-DCgJxdg1.mjs.map} +1 -1
  65. package/dist/{tailor-db-field-Bn8ZC5lK.d.mts → tailor-db-field-4bMLe25-.d.mts} +5 -1
  66. package/dist/telemetry-C13VIFpT.mjs +4 -0
  67. package/dist/{telemetry-DcL8Fsm_.mjs → telemetry-C1Y56L5E.mjs} +1 -1
  68. package/dist/{telemetry-DcL8Fsm_.mjs.map → telemetry-C1Y56L5E.mjs.map} +1 -1
  69. package/dist/types-DoIG6Nij.mjs +5 -0
  70. package/dist/{types-Duhhsx3R.mjs → types-sir9UPht.mjs} +2 -2
  71. package/dist/{types-Duhhsx3R.mjs.map → types-sir9UPht.mjs.map} +1 -1
  72. package/dist/utils/test/index.d.mts +3 -3
  73. package/dist/utils/test/index.mjs +1 -1
  74. package/dist/utils/test/index.mjs.map +1 -1
  75. package/dist/vitest/environment.mjs +1 -1
  76. package/dist/vitest/environment.mjs.map +1 -1
  77. package/dist/vitest/index.mjs +1 -1
  78. package/dist/vitest/index.mjs.map +1 -1
  79. package/dist/vitest/setup.mjs +1 -1
  80. package/dist/vitest/setup.mjs.map +1 -1
  81. package/dist/{workflow.generated-i7PK4fg-.d.mts → workflow.generated-OYAu_6zX.d.mts} +12 -2
  82. package/docs/cli/application.md +4 -0
  83. package/docs/configuration.md +4 -0
  84. package/docs/generator/builtin.md +35 -4
  85. package/docs/services/workflow.md +0 -5
  86. package/package.json +15 -14
  87. package/postinstall.mjs +1 -1
  88. package/dist/application-CN9Htzup.mjs +0 -4
  89. package/dist/application-TasSqBTD.mjs.map +0 -1
  90. package/dist/client-COfsXV69.mjs +0 -16447
  91. package/dist/client-COfsXV69.mjs.map +0 -1
  92. package/dist/crashreport-CKJwnWsX.mjs.map +0 -1
  93. package/dist/index-BXyS7xKC.d.mts +0 -21
  94. package/dist/job-BOvKyNdT.mjs.map +0 -1
  95. package/dist/runtime-DDYL2Zf1.mjs.map +0 -1
  96. package/dist/seed-DrKY5yIF.mjs.map +0 -1
  97. package/dist/tailordb-Bg9-TZj1.mjs.map +0 -1
  98. package/dist/telemetry-21afNV9_.mjs +0 -4
  99. package/dist/types-BnphjkIJ.mjs +0 -5
@@ -1,5 +1,5 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
- import { A as RelationType, Bt as InferredAttributeMap, D as DefinedDBFieldMetadata, Dt as ArrayFieldOutput, E as DBFieldMetadata, F as AuthConfig, Ft as FieldValidateInput, Ht as TailorUser, It as Validators, Jt as output, M as TailorDBServiceInput, Mt as FieldOutput, O as GqlOperationsConfig, Pt as TailorToTs, Wt as InferFieldsOutput, Y as TailorField, c as PluginConfigs, ht as BuiltinIdP, i as TailorDBType$1, j as SerialConfig, jt as FieldOptions, k as IndexDef, kt as EnumValue, qt as Prettify, r as TailorDBField$1, t as TailorAnyDBField$1 } from "./tailor-db-field-Bn8ZC5lK.mjs";
2
+ import { A as RelationType, Bt as InferredAttributeMap, D as DefinedDBFieldMetadata, Dt as ArrayFieldOutput, E as DBFieldMetadata, F as AuthConfig, Ft as FieldValidateInput, Ht as TailorUser, It as Validators, Jt as output, M as TailorDBServiceInput, Mt as FieldOutput, O as GqlOperationsConfig, Pt as TailorToTs, Wt as InferFieldsOutput, Y as TailorField, c as PluginConfigs, ht as BuiltinIdP, i as TailorDBType$1, j as SerialConfig, jt as FieldOptions, k as IndexDef, kt as EnumValue, qt as Prettify, r as TailorDBField$1, t as TailorAnyDBField$1 } from "./tailor-db-field-4bMLe25-.mjs";
3
3
  import { NonEmptyObject } from "type-fest";
4
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
5
 
@@ -1164,6 +1164,16 @@ type WorkflowServiceInput = WorkflowServiceConfig;
1164
1164
  interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
1165
1165
  /** Application name (required). */
1166
1166
  name: string;
1167
+ /**
1168
+ * Stable identifier used to track the application across renames.
1169
+ * Managed by the SDK: auto-generated and written into `tailor.config.ts`
1170
+ * on first `deploy`. Delete this field if you want the SDK to assign a
1171
+ * new id on the next `deploy` — typical case: `tailor.config.ts` was
1172
+ * copied from another project and the new application should not share
1173
+ * the original's id. Existing resources are re-tagged with the new id;
1174
+ * data is preserved.
1175
+ */
1176
+ id?: string;
1167
1177
  /** Environment variables accessible via `context.env` in resolvers and via the second argument `{ env }` in workflow job bodies. */
1168
1178
  env?: Env;
1169
1179
  /** Allowed CORS origins. Must be an array of strings, e.g. `["https://example.com"]`. */
@@ -1207,4 +1217,4 @@ type ConcurrencyPolicy = {
1207
1217
  };
1208
1218
  //#endregion
1209
1219
  export { PermissionCondition as A, IdPInput as C, TailorDBInstance as D, TailorDBField as E, AllowedValues as F, AllowedValuesOutput as I, TailorTypePermission as M, unsafeAllowAllGqlPermission as N, TailorDBType as O, unsafeAllowAllTypePermission as P, IdPGqlOperationsInput as S, TailorAnyDBType as T, IdPExternalConfig as _, ExecutorServiceInput as a, IdPEmailConfig as b, ResolverServiceInput as c, StaticWebsiteConfig as d, StaticWebsiteDefinitionBrand as f, IdPConfig as g, SecretsDefinitionBrand as h, ExecutorServiceConfig as i, TailorTypeGqlPermission as j, db as k, WorkflowServiceConfig as l, SecretsConfig as m, RetryPolicy as n, ResolverExternalConfig as o, StaticWebsiteInput as p, AppConfig as r, ResolverServiceConfig as s, ConcurrencyPolicy as t, WorkflowServiceInput as u, IdPUserField as v, TailorAnyDBField as w, IdPGqlOperations as x, IdpDefinitionBrand as y };
1210
- //# sourceMappingURL=workflow.generated-i7PK4fg-.d.mts.map
1220
+ //# sourceMappingURL=workflow.generated-OYAu_6zX.d.mts.map
@@ -136,6 +136,10 @@ See [Global Options](../cli-reference.md#global-options) for options available t
136
136
 
137
137
  <!-- politty:command:deploy:global-options-link:end -->
138
138
 
139
+ **Config File Modification:**
140
+
141
+ On first run, `deploy` automatically injects a stable `id: "<uuid>"` field into your `defineConfig({...})` call in `tailor.config.ts`. This UUID is used to track your application across renames so the SDK can recognize ownership across renames. Commit the generated id to version control. See [Configuration](../configuration.md#application-settings) for details.
142
+
139
143
  **Migration Handling:**
140
144
 
141
145
  When migrations are configured (`db.tailordb.migration` in config), the `deploy` command automatically:
@@ -19,6 +19,8 @@ For service-specific documentation, see:
19
19
  import { defineConfig } from "@tailor-platform/sdk";
20
20
 
21
21
  export default defineConfig({
22
+ // SDK-managed app id — do not edit, except when copying this config to a separate app.
23
+ // id: "<uuid>" — written here automatically on first run
22
24
  name: "my-app",
23
25
  cors: ["https://example.com"],
24
26
  allowedIpAddresses: ["192.168.1.0/24"],
@@ -28,6 +30,8 @@ export default defineConfig({
28
30
 
29
31
  **Name**: Set the application name.
30
32
 
33
+ **Id (auto-managed)**: A stable identifier used to recognize resources managed by the SDK across renames. On first `deploy`, the SDK injects an `id: "<uuid>"` field into your `defineConfig({...})` call and commits it to `tailor.config.ts`. Keep it under version control; do not edit it by hand. Delete it only if you want the SDK to assign a new id on the next `deploy` — typically when `tailor.config.ts` was copied from another project and the new application should not share the original's id. Auto-injection requires `defineConfig({...})` to be called with an inline object literal: if the argument is a separate variable (e.g. `defineConfig(config)`), or if `tailor.config.ts` is a wrapper that re-exports `defineConfig` from another file, the SDK cannot inject — add the `id` field manually to the file that contains the actual `defineConfig({...})` object literal.
34
+
31
35
  **CORS**: Specify CORS settings as an array. You can also include Static Website URL references (e.g. `website.url`) in this array; see [Static Website](./services/staticwebsite.md).
32
36
 
33
37
  **Allowed IP Addresses**: Specify IP addresses allowed to access the application in CIDR format.
@@ -183,10 +183,41 @@ Generates seed data configuration files for database initialization.
183
183
  ["@tailor-platform/seed", { distPath: "./seed", machineUserName: "admin" }];
184
184
  ```
185
185
 
186
- | Option | Type | Description |
187
- | ----------------- | -------- | -------------------------------------------------------- |
188
- | `distPath` | `string` | Output directory path (required) |
189
- | `machineUserName` | `string` | Default machine user name (can be overridden at runtime) |
186
+ | Option | Type | Description |
187
+ | -------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
188
+ | `distPath` | `string` | Output directory path (required) |
189
+ | `machineUserName` | `string` | Default machine user name (can be overridden at runtime) |
190
+ | `disableIdpUserSync` | `{ userToIdp?: boolean; idpToUser?: boolean }` | Skip emitting individual `_User <-> userProfile` foreign keys. Both directions are emitted by default. See [IdP user synchronization](#idp-user-synchronization). |
191
+
192
+ ### IdP user synchronization
193
+
194
+ When `auth.userProfile` is configured, the seed plugin treats the userProfile
195
+ type (e.g. `User`) and the IdP-managed `_User` table as a pair. By default it
196
+ emits foreign keys in both directions so that `validate` rejects any row in
197
+ either table that does not have a matching counterpart:
198
+
199
+ | Direction | Foreign key | Catches |
200
+ | ----------- | ---------------------------------------------- | ---------------------------------------------- |
201
+ | `idpToUser` | `_User.name` → `<userProfile>.<usernameField>` | Creating an IdP credential with no profile row |
202
+ | `userToIdp` | `<userProfile>.<usernameField>` → `_User.name` | Creating a profile row with no IdP credential |
203
+
204
+ Neither direction is enforced by the runtime. In production it is normal for
205
+ one side to exist without the other — for example a userProfile row exists
206
+ the moment a user is invited, but the corresponding `_User` row appears only
207
+ after the user finishes signing up. To seed such states, set the relevant
208
+ direction in `disableIdpUserSync` to `true`:
209
+
210
+ ```typescript
211
+ // Allow seeding invited-but-not-registered userProfile rows.
212
+ // Still rejects _User rows without a matching userProfile row.
213
+ ["@tailor-platform/seed", { distPath: "./seed", disableIdpUserSync: { userToIdp: true } }];
214
+
215
+ // Allow seeding _User rows whose userProfile does not exist yet.
216
+ // Still rejects userProfile rows without a matching _User row.
217
+ ["@tailor-platform/seed", { distPath: "./seed", disableIdpUserSync: { idpToUser: true } }];
218
+ ```
219
+
220
+ Omitted directions default to `false` (FK emitted).
190
221
 
191
222
  ### Output
192
223
 
@@ -106,9 +106,6 @@ import { sendNotification } from "./jobs/send-notification";
106
106
  export const mainJob = createWorkflowJob({
107
107
  name: "main-job",
108
108
  body: async (input: { customerId: string }) => {
109
- // You can write `await` for type-safety in your source.
110
- // During deployment bundling, job.trigger() calls are transformed to a synchronous
111
- // runtime call and `await` is removed.
112
109
  const customer = await fetchCustomer.trigger({
113
110
  customerId: input.customerId,
114
111
  });
@@ -121,8 +118,6 @@ export const mainJob = createWorkflowJob({
121
118
  });
122
119
  ```
123
120
 
124
- **Important:** On the Tailor runtime, job triggers are executed synchronously. This means `Promise.all([jobA.trigger(), jobB.trigger()])` will not run jobs in parallel.
125
-
126
121
  ### Deterministic Execution Requirement
127
122
 
128
123
  Workflow jobs use a **suspend/resume execution model**. When a job calls `.trigger()`, the runtime suspends the current job, executes the triggered job, and then **re-executes the calling job from the beginning** with cached results from previous triggers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.47.0",
3
+ "version": "1.48.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -21,6 +21,10 @@
21
21
  "skills"
22
22
  ],
23
23
  "type": "module",
24
+ "sideEffects": [
25
+ "./dist/cli/**/*.mjs",
26
+ "./dist/vitest/setup.mjs"
27
+ ],
24
28
  "main": "./dist/configure/index.mjs",
25
29
  "types": "./dist/configure/index.d.mts",
26
30
  "exports": {
@@ -91,8 +95,8 @@
91
95
  "@bufbuild/protobuf": "2.12.0",
92
96
  "@connectrpc/connect": "2.1.1",
93
97
  "@connectrpc/connect-node": "2.1.1",
94
- "@inquirer/core": "11.1.9",
95
- "@inquirer/prompts": "8.4.2",
98
+ "@inquirer/core": "11.1.10",
99
+ "@inquirer/prompts": "8.4.3",
96
100
  "@jridgewell/trace-mapping": "0.3.31",
97
101
  "@liam-hq/cli": "0.7.24",
98
102
  "@napi-rs/keyring": "1.3.0",
@@ -127,7 +131,7 @@
127
131
  "pgsql-ast-parser": "12.0.2",
128
132
  "pkg-types": "2.3.1",
129
133
  "politty": "0.4.15",
130
- "rolldown": "1.0.0-rc.18",
134
+ "rolldown": "1.0.0",
131
135
  "semver": "7.7.4",
132
136
  "serve": "14.2.6",
133
137
  "sql-highlight": "6.1.0",
@@ -136,28 +140,24 @@
136
140
  "ts-cron-validator": "1.1.5",
137
141
  "tsx": "4.21.0",
138
142
  "type-fest": "5.6.0",
143
+ "undici": "6.25.0",
139
144
  "xdg-basedir": "5.1.0",
140
145
  "zod": "4.3.6"
141
146
  },
142
147
  "devDependencies": {
143
- "@eslint/js": "10.0.1",
144
148
  "@opentelemetry/sdk-trace-base": "2.7.1",
145
149
  "@types/madge": "5.0.3",
146
150
  "@types/mime-types": "3.0.1",
147
- "@types/node": "24.12.2",
151
+ "@types/node": "24.12.3",
148
152
  "@types/semver": "7.7.1",
149
- "@typescript/native-preview": "7.0.0-dev.20260503.1",
153
+ "@typescript/native-preview": "7.0.0-dev.20260516.1",
150
154
  "@vitest/coverage-v8": "4.1.5",
151
- "eslint": "10.3.0",
152
- "eslint-plugin-jsdoc": "62.9.0",
153
- "eslint-plugin-oxlint": "1.61.0",
154
155
  "oxfmt": "0.46.0",
155
156
  "oxlint": "1.61.0",
156
157
  "oxlint-tsgolint": "0.22.1",
157
158
  "sonda": "0.11.1",
158
- "tsdown": "0.21.10",
159
+ "tsdown": "0.22.0",
159
160
  "typescript": "5.9.3",
160
- "typescript-eslint": "8.59.1",
161
161
  "vitest": "4.1.5",
162
162
  "zinfer": "0.1.8"
163
163
  },
@@ -185,8 +185,9 @@
185
185
  "docs:check": "vitest run --project=unit src/cli/docs.test.ts",
186
186
  "docs:update": "POLITTY_DOCS_UPDATE=true vitest run --project=unit src/cli/docs.test.ts",
187
187
  "build": "tsdown",
188
- "lint": "oxlint --type-aware . && eslint --cache .",
189
- "lint:fix": "oxlint --type-aware . --fix && eslint --cache . --fix",
188
+ "lint": "oxlint --type-aware .",
189
+ "check:public-api-jsdoc": "tsx scripts/check-public-api-jsdoc.ts",
190
+ "lint:fix": "oxlint --type-aware . --fix",
190
191
  "typecheck": "tsc --noEmit",
191
192
  "typecheck:go": "tsgo",
192
193
  "perf:typecheck": "bash scripts/perf/exec.sh",
package/postinstall.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { existsSync } from "node:fs";
4
+ import { register } from "node:module";
4
5
  import { dirname, resolve } from "node:path";
5
6
  import { pathToFileURL } from "node:url";
6
- import { register } from "node:module";
7
7
  import { findUpSync } from "find-up-simple";
8
8
 
9
9
  const __dirname = import.meta.dirname;
@@ -1,4 +0,0 @@
1
-
2
- import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-TasSqBTD.mjs";
3
-
4
- export { defineApplication };