@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.
- package/CHANGELOG.md +84 -0
- package/{dist/cli/index.mjs → bin/tailor.mjs} +1 -1
- package/dist/{application-D77KJFKD.mjs → application-BpLeawBg.mjs} +6 -6
- package/dist/{application-D77KJFKD.mjs.map → application-BpLeawBg.mjs.map} +1 -1
- package/dist/application-BxLLiLsr.mjs +3 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +2 -1
- package/dist/cli/commands/deploy/types.d.mts +2 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -4
- package/dist/cli/commands/tailordb/migrate/file-state.d.mts +1 -0
- package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +2 -2
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +8 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +5 -3
- package/dist/cli/lib.d.mts +4 -4
- package/dist/cli/lib.mjs +3 -482
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +975 -193
- package/dist/cli/main.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +145 -2
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/services/index.d.mts +2 -1
- package/dist/configure/services/tailordb/index.d.mts +2 -1
- package/dist/configure/services/tailordb/schema.d.mts +46 -46
- package/dist/configure/services/tailordb/types.d.mts +30 -4
- package/dist/{crashreport-B5LqCTfF.mjs → crashreport-CIIfLnoO.mjs} +2 -2
- package/dist/{crashreport-B5LqCTfF.mjs.map → crashreport-CIIfLnoO.mjs.map} +1 -1
- package/dist/{crashreport-eI7ty7ok.mjs → crashreport-CINZ5dVN.mjs} +1 -1
- package/dist/errors-CWj21238.mjs +75 -0
- package/dist/errors-CWj21238.mjs.map +1 -0
- package/dist/kysely/index.d.mts +52 -5
- package/dist/kysely/index.mjs +7 -2
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{logger-CXQq9YIp.mjs → logger-DSdExfor.mjs} +83 -42
- package/dist/logger-DSdExfor.mjs.map +1 -0
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/{register-ts-hook-BU18uU44.mjs → register-ts-hook-CTth1eqj.mjs} +1587 -272
- package/dist/register-ts-hook-CTth1eqj.mjs.map +1 -0
- package/dist/schema--xYWRGfe.mjs.map +1 -1
- package/dist/seed/index.d.mts +52 -3
- package/dist/seed/index.mjs +200 -44
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-B-yckgQY.mjs → seed-xqM9WIHP.mjs} +8 -8
- package/dist/seed-xqM9WIHP.mjs.map +1 -0
- package/dist/{service-B5WynBHQ.mjs → service-CCwl3Avt.mjs} +3 -3
- package/dist/{service-B5WynBHQ.mjs.map → service-CCwl3Avt.mjs.map} +1 -1
- package/dist/service-_XmjSEGr.mjs +3 -0
- package/dist/{service-k1xy_A5G.mjs → service-goqlJJgA.mjs} +2 -2
- package/dist/{service-k1xy_A5G.mjs.map → service-goqlJJgA.mjs.map} +1 -1
- package/dist/{service_pb-D5--My_M.mjs → service_pb-BEWj1pOV.mjs} +2 -2
- package/dist/{service_pb-D5--My_M.mjs.map → service_pb-BEWj1pOV.mjs.map} +1 -1
- package/dist/{service_pb-i8CmnQP4.mjs → service_pb-BjlhvK9E.mjs} +1 -1
- package/dist/utils/test/index.d.mts +6 -3
- package/dist/utils/test/index.mjs +25 -13
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/index.d.mts +2 -1
- package/dist/vitest/index.mjs +84 -2
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/file.d.mts +1 -1
- package/dist/vitest/pglite-kysely.d.mts +43 -0
- package/dist/{workspace_resource_pb-DXnO2AT-.mjs → workspace_resource_pb-HNIL_Vfj.mjs} +10 -2
- package/dist/{workspace_resource_pb-DXnO2AT-.mjs.map → workspace_resource_pb-HNIL_Vfj.mjs.map} +1 -1
- package/docs/cli/tailordb.md +87 -22
- package/docs/cli-reference.md +13 -11
- package/docs/configuration.md +1 -1
- package/docs/migration/v2.md +1 -1
- package/docs/plugin/custom.md +48 -48
- package/docs/plugin/index.md +24 -24
- package/docs/services/auth.md +10 -10
- package/docs/services/executor.md +1 -1
- package/docs/services/resolver.md +2 -2
- package/docs/services/tailordb-migration.md +375 -76
- package/docs/services/tailordb.md +28 -28
- package/docs/testing.md +2 -0
- package/package.json +12 -7
- package/dist/application-Af1zIqSI.mjs +0 -3
- package/dist/errors-D7583Zz7.mjs +0 -58
- package/dist/errors-D7583Zz7.mjs.map +0 -1
- package/dist/logger-CXQq9YIp.mjs.map +0 -1
- package/dist/register-ts-hook-BU18uU44.mjs.map +0 -1
- package/dist/seed-B-yckgQY.mjs.map +0 -1
- package/dist/service-M7OYziQP.mjs +0 -3
package/docs/services/auth.md
CHANGED
|
@@ -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
|
|
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
|
|
71
|
+
Maps authenticated identities to a TailorDB table:
|
|
72
72
|
|
|
73
73
|
```typescript
|
|
74
74
|
userProfile: {
|
|
75
|
-
type: user, // TailorDB
|
|
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
|
|
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
|
|
96
|
+
**type**: The TailorDB table that stores user records.
|
|
97
97
|
|
|
98
|
-
**namespace** (optional): The TailorDB namespace where the user
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
157
|
+
// which collides with the TailorDB Item table's status enum
|
|
158
158
|
output: t
|
|
159
159
|
.object({
|
|
160
160
|
id: t.uuid(),
|