@tailor-platform/sdk 2.1.0 → 2.2.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 (80) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/{dist/cli/index.mjs → bin/tailor.mjs} +1 -1
  3. package/dist/{application-D77KJFKD.mjs → application-BpLeawBg.mjs} +6 -6
  4. package/dist/{application-D77KJFKD.mjs.map → application-BpLeawBg.mjs.map} +1 -1
  5. package/dist/application-BxLLiLsr.mjs +3 -0
  6. package/dist/cli/commands/deploy/tailordb/index.d.mts +2 -1
  7. package/dist/cli/commands/deploy/types.d.mts +2 -1
  8. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -4
  9. package/dist/cli/commands/tailordb/migrate/file-state.d.mts +1 -0
  10. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +2 -2
  11. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +8 -1
  12. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +5 -3
  13. package/dist/cli/lib.d.mts +4 -4
  14. package/dist/cli/lib.mjs +3 -482
  15. package/dist/cli/lib.mjs.map +1 -1
  16. package/dist/cli/main.mjs +975 -193
  17. package/dist/cli/main.mjs.map +1 -1
  18. package/dist/completion/zsh-worker.zsh +145 -2
  19. package/dist/configure/index.d.mts +2 -2
  20. package/dist/configure/services/index.d.mts +2 -1
  21. package/dist/configure/services/tailordb/index.d.mts +2 -1
  22. package/dist/configure/services/tailordb/schema.d.mts +46 -46
  23. package/dist/configure/services/tailordb/types.d.mts +30 -4
  24. package/dist/{crashreport-B5LqCTfF.mjs → crashreport-CIIfLnoO.mjs} +2 -2
  25. package/dist/{crashreport-B5LqCTfF.mjs.map → crashreport-CIIfLnoO.mjs.map} +1 -1
  26. package/dist/{crashreport-eI7ty7ok.mjs → crashreport-CINZ5dVN.mjs} +1 -1
  27. package/dist/errors-CWj21238.mjs +75 -0
  28. package/dist/errors-CWj21238.mjs.map +1 -0
  29. package/dist/kysely/index.d.mts +52 -5
  30. package/dist/kysely/index.mjs +7 -2
  31. package/dist/kysely/index.mjs.map +1 -1
  32. package/dist/{logger-CXQq9YIp.mjs → logger-DSdExfor.mjs} +83 -42
  33. package/dist/logger-DSdExfor.mjs.map +1 -0
  34. package/dist/plugin/builtin/seed/index.mjs +1 -1
  35. package/dist/{register-ts-hook-BU18uU44.mjs → register-ts-hook-CTth1eqj.mjs} +1587 -272
  36. package/dist/register-ts-hook-CTth1eqj.mjs.map +1 -0
  37. package/dist/schema--xYWRGfe.mjs.map +1 -1
  38. package/dist/seed/index.d.mts +52 -3
  39. package/dist/seed/index.mjs +200 -44
  40. package/dist/seed/index.mjs.map +1 -1
  41. package/dist/{seed-B-yckgQY.mjs → seed-xqM9WIHP.mjs} +8 -8
  42. package/dist/seed-xqM9WIHP.mjs.map +1 -0
  43. package/dist/{service-B5WynBHQ.mjs → service-CCwl3Avt.mjs} +3 -3
  44. package/dist/{service-B5WynBHQ.mjs.map → service-CCwl3Avt.mjs.map} +1 -1
  45. package/dist/service-_XmjSEGr.mjs +3 -0
  46. package/dist/{service-k1xy_A5G.mjs → service-goqlJJgA.mjs} +2 -2
  47. package/dist/{service-k1xy_A5G.mjs.map → service-goqlJJgA.mjs.map} +1 -1
  48. package/dist/{service_pb-D5--My_M.mjs → service_pb-BEWj1pOV.mjs} +2 -2
  49. package/dist/{service_pb-D5--My_M.mjs.map → service_pb-BEWj1pOV.mjs.map} +1 -1
  50. package/dist/{service_pb-i8CmnQP4.mjs → service_pb-BjlhvK9E.mjs} +1 -1
  51. package/dist/utils/test/index.d.mts +6 -3
  52. package/dist/utils/test/index.mjs +25 -13
  53. package/dist/utils/test/index.mjs.map +1 -1
  54. package/dist/vitest/index.d.mts +2 -1
  55. package/dist/vitest/index.mjs +84 -2
  56. package/dist/vitest/index.mjs.map +1 -1
  57. package/dist/vitest/mocks/file.d.mts +1 -1
  58. package/dist/vitest/pglite-kysely.d.mts +43 -0
  59. package/dist/{workspace_resource_pb-DXnO2AT-.mjs → workspace_resource_pb-HNIL_Vfj.mjs} +10 -2
  60. package/dist/{workspace_resource_pb-DXnO2AT-.mjs.map → workspace_resource_pb-HNIL_Vfj.mjs.map} +1 -1
  61. package/docs/cli/tailordb.md +87 -22
  62. package/docs/cli-reference.md +13 -11
  63. package/docs/configuration.md +1 -1
  64. package/docs/migration/v2.md +1 -1
  65. package/docs/plugin/custom.md +48 -48
  66. package/docs/plugin/index.md +24 -24
  67. package/docs/services/auth.md +10 -10
  68. package/docs/services/executor.md +1 -1
  69. package/docs/services/resolver.md +2 -2
  70. package/docs/services/tailordb-migration.md +375 -76
  71. package/docs/services/tailordb.md +28 -28
  72. package/docs/testing.md +2 -0
  73. package/package.json +12 -7
  74. package/dist/application-Af1zIqSI.mjs +0 -3
  75. package/dist/errors-D7583Zz7.mjs +0 -58
  76. package/dist/errors-D7583Zz7.mjs.map +0 -1
  77. package/dist/logger-CXQq9YIp.mjs.map +0 -1
  78. package/dist/register-ts-hook-BU18uU44.mjs.map +0 -1
  79. package/dist/seed-B-yckgQY.mjs.map +0 -1
  80. package/dist/service-M7OYziQP.mjs +0 -3
@@ -6,7 +6,7 @@ Auth is a service for configuring authentication and authorization in your Tailo
6
6
 
7
7
  Auth provides:
8
8
 
9
- - User profile mapping to TailorDB types
9
+ - User profile mapping to TailorDB tables
10
10
  - Machine users for service-to-service authentication
11
11
  - OAuth 2.0 client configuration
12
12
  - Identity provider integration
@@ -68,11 +68,11 @@ export default defineConfig({
68
68
 
69
69
  ## User Profile
70
70
 
71
- Maps authenticated identities to a TailorDB type:
71
+ Maps authenticated identities to a TailorDB table:
72
72
 
73
73
  ```typescript
74
74
  userProfile: {
75
- type: user, // TailorDB type for user records
75
+ type: user, // TailorDB table for user records
76
76
  usernameField: "email", // Field used as username (must be unique)
77
77
  attributes: {
78
78
  role: true, // Enable 'role' as a user attribute
@@ -80,7 +80,7 @@ userProfile: {
80
80
  },
81
81
  ```
82
82
 
83
- Example TailorDB type for user profile:
83
+ Example TailorDB table for user profile:
84
84
 
85
85
  ```typescript
86
86
  // tailordb/user.ts
@@ -93,9 +93,9 @@ export const user = db.table("User", {
93
93
  });
94
94
  ```
95
95
 
96
- **type**: The TailorDB type that stores user records.
96
+ **type**: The TailorDB table that stores user records.
97
97
 
98
- **namespace** (optional): The TailorDB namespace where the user type is defined. Usually auto-resolved from your `db` configuration, so you don't need to specify it. Required only when multiple TailorDB namespaces exist and the type lives in an external TailorDB:
98
+ **namespace** (optional): The TailorDB namespace where the user table is defined. Usually auto-resolved from your `db` configuration, so you don't need to specify it. Required only when multiple TailorDB namespaces exist and the table lives in an external TailorDB:
99
99
 
100
100
  ```typescript
101
101
  userProfile: {
@@ -105,9 +105,9 @@ userProfile: {
105
105
  },
106
106
  ```
107
107
 
108
- **usernameField**: The field in the TailorDB type used as the username. This field must have a unique constraint (`.unique()`) since it is used to uniquely identify users.
108
+ **usernameField**: The field in the TailorDB table used as the username. This field must have a unique constraint (`.unique()`) since it is used to uniquely identify users.
109
109
 
110
- **attributes**: Specifies which fields from the TailorDB type are used as user attributes. Set to `true` to enable a field. Machine user definitions must assign values to attributes derived from required fields; attributes derived from optional fields may be omitted (see [Machine Users](#machine-users)). Only fields with ValueOperand types (string, boolean, string[], boolean[]) can be used as attributes. The `id` field and datetime/date/time types are excluded.
110
+ **attributes**: Specifies which fields from the TailorDB table are used as user attributes. Set to `true` to enable a field. Machine user definitions must assign values to attributes derived from required fields; attributes derived from optional fields may be omitted (see [Machine Users](#machine-users)). Only fields with ValueOperand types (string, boolean, string[], boolean[]) can be used as attributes. The `id` field and datetime/date/time types are excluded.
111
111
 
112
112
  ## Attribute List
113
113
 
@@ -122,9 +122,9 @@ userProfile: {
122
122
  },
123
123
  ```
124
124
 
125
- **attributeList**: An array of field names from the TailorDB type. These fields will be exposed as an ordered list of UUIDs. Only UUID-type fields (non-array) can be included in the attribute list.
125
+ **attributeList**: An array of field names from the TailorDB table. These fields will be exposed as an ordered list of UUIDs. Only UUID-type fields (non-array) can be included in the attribute list.
126
126
 
127
- Example TailorDB type with UUID fields for attribute list:
127
+ Example TailorDB table with UUID fields for attribute list:
128
128
 
129
129
  ```typescript
130
130
  // tailordb/user.ts
@@ -406,7 +406,7 @@ interface RecordCreatedContext<T> {
406
406
  rawEvent: "tailordb.type_record.created"; // Full event type string
407
407
  workspaceId: string; // Workspace identifier
408
408
  appNamespace: string; // Application/namespace name
409
- typeName: string; // TailorDB type name
409
+ typeName: string; // TailorDB table name
410
410
  newRecord: T; // The newly created record
411
411
  }
412
412
  ```
@@ -150,11 +150,11 @@ createResolver({
150
150
 
151
151
  This is useful when the same logical type appears in multiple resolvers or when you want a predictable, human-readable name in the generated GraphQL schema.
152
152
 
153
- **Warning:** Do not set `typeName` to an existing TailorDB type name on an `object()` that contains enum or nested fields. Child fields without an explicit `typeName` auto-generate names using `{parentTypeName}{FieldName}`, which can collide with the TailorDB type's own enum/nested type names.
153
+ **Warning:** Do not set `typeName` to an existing TailorDB table name on an `object()` that contains enum or nested fields. Child fields without an explicit `typeName` auto-generate names using `{parentTypeName}{FieldName}`, which can collide with the TailorDB table's own enum/nested type names.
154
154
 
155
155
  ```typescript
156
156
  // Collision — "Item" + "status" auto-generates "ItemStatus",
157
- // which collides with the TailorDB Item type's status enum
157
+ // which collides with the TailorDB Item table's status enum
158
158
  output: t
159
159
  .object({
160
160
  id: t.uuid(),