diff --git a/.changeset/auth-forced-id.md b/.changeset/auth-forced-id.md deleted file mode 100644 index 18dc746d4..000000000 --- a/.changeset/auth-forced-id.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"kitcn": patch ---- - -## Patches - -- Fix Better Auth creates that carry their own id (`forceAllowId`) failing with ``Unexpected field `_id` ``: organization invitations on Better Auth 1.7.16 with default options, and `reserveVerificationValue` (magic link and email OTP for unverified users, SIWE, SAML). The row now gets its Convex id, and Better Auth reads it back under that id. A second `reserveVerificationValue` for the same identifier is still refused while the first row exists. A forced-id `oauthClientAssertion` create (`private_key_jwt`) is refused, so a replayed assertion cannot get in. diff --git a/.changeset/orm-lazy-tables.md b/.changeset/orm-lazy-tables.md deleted file mode 100644 index 8a081ce79..000000000 --- a/.changeset/orm-lazy-tables.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -"kitcn": minor ---- - -## Breaking changes - -- Build ORM tables on first use. `convexTable(...)` no longer throws definition errors (invalid indexes, constraints, extra config). They throw when the schema is pushed, when `kitcn codegen` runs, or when `schema.export()` is called. - -```ts -// Before: throws here -const posts = convexTable('posts', { text: text() }, () => [searchIndex('s')]); - -// After: throws on push and codegen, or in a test with schema.export() -const schema = defineSchema({ posts }); -schema.export(); -``` - -- Reference columns in extra config through the table argument. A column builder variable shared across tables and used directly in an index throws an ownership error at push. - -```ts -// Before -const tenantId = text().notNull(); -const a = convexTable('a', { tenantId }, () => [index('a_t').on(tenantId)]); - -// After -const a = convexTable('a', { tenantId }, (t) => [index('a_t').on(t.tenantId)]); -``` - -- Require `rlsPolicy(...).link(table)` at module scope, in `schema.ts` or in the module that declares the table. A linked policy applies to its table as soon as it is linked. - -```ts -// Before: linked inside another table's extra config -const posts = convexTable('posts', { body: text() }, () => [ - rlsPolicy('read_users', { for: 'select' }).link(users), -]); - -// After: link at module scope -export const readUsers = rlsPolicy('read_users', { for: 'select' }).link(users); -``` - -## Patches - -- Preserve self-referencing foreign keys whose callbacks read table metadata through `getTableConfig`. -- Preserve foreign-key targets and required fields when column builders are reused across tables or in a discriminator. -- Improve cold Convex function start: a query or insert builds only the tables it touches, and query contexts no longer build every table's query builder and foreign-key graph. The first update or delete still reads every table's foreign keys, and `createOrm` without the aggregate capability still builds every table. -- Fix broken `references(() => ...)` callbacks surfacing on the first ORM call instead of on push, and passing on a retry. -- Improve `kitcn codegen` speed on large projects: a module that many Convex modules import evaluates once per run instead of once per importer. diff --git a/bun.lock b/bun.lock index 02bceca04..58f9e06ba 100644 --- a/bun.lock +++ b/bun.lock @@ -121,7 +121,7 @@ }, "packages/kitcn": { "name": "kitcn", - "version": "0.33.12", + "version": "0.34.0", "bin": { "kitcn": "./dist/cli.mjs", "intent": "./bin/intent.js", @@ -181,7 +181,7 @@ }, "packages/resend": { "name": "@kitcn/resend", - "version": "0.33.12", + "version": "0.34.0", "dependencies": { "svix": "^1.84.1", }, diff --git a/packages/kitcn/CHANGELOG.md b/packages/kitcn/CHANGELOG.md index 42d0cf8ed..e7a3edb60 100644 --- a/packages/kitcn/CHANGELOG.md +++ b/packages/kitcn/CHANGELOG.md @@ -1,5 +1,65 @@ # kitcn +## 0.34.0 + +### Minor Changes + +- [#494](https://github.com/udecode/kitcn/pull/494) [`182403a`](https://github.com/udecode/kitcn/commit/182403a7c4c6976a96b1fdbaf842bfa98904386e) Thanks [@EfficiencyCorp](https://github.com/EfficiencyCorp)! - ## Breaking changes + + - Build ORM tables on first use. `convexTable(...)` no longer throws definition errors (invalid indexes, constraints, extra config). They throw when the schema is pushed, when `kitcn codegen` runs, or when `schema.export()` is called. + + ```ts + // Before: throws here + const posts = convexTable("posts", { text: text() }, () => [ + searchIndex("s"), + ]); + + // After: throws on push and codegen, or in a test with schema.export() + const schema = defineSchema({ posts }); + schema.export(); + ``` + + - Reference columns in extra config through the table argument. A column builder variable shared across tables and used directly in an index throws an ownership error at push. + + ```ts + // Before + const tenantId = text().notNull(); + const a = convexTable("a", { tenantId }, () => [index("a_t").on(tenantId)]); + + // After + const a = convexTable("a", { tenantId }, (t) => [ + index("a_t").on(t.tenantId), + ]); + ``` + + - Require `rlsPolicy(...).link(table)` at module scope, in `schema.ts` or in the module that declares the table. A linked policy applies to its table as soon as it is linked. + + ```ts + // Before: linked inside another table's extra config + const posts = convexTable("posts", { body: text() }, () => [ + rlsPolicy("read_users", { for: "select" }).link(users), + ]); + + // After: link at module scope + export const readUsers = rlsPolicy("read_users", { for: "select" }).link( + users + ); + ``` + + ## Patches + + - Preserve self-referencing foreign keys whose callbacks read table metadata through `getTableConfig`. + - Preserve foreign-key targets and required fields when column builders are reused across tables or in a discriminator. + - Improve cold Convex function start: a query or insert builds only the tables it touches, and query contexts no longer build every table's query builder and foreign-key graph. The first update or delete still reads every table's foreign keys, and `createOrm` without the aggregate capability still builds every table. + - Fix broken `references(() => ...)` callbacks surfacing on the first ORM call instead of on push, and passing on a retry. + - Improve `kitcn codegen` speed on large projects: a module that many Convex modules import evaluates once per run instead of once per importer. + +### Patch Changes + +- [#495](https://github.com/udecode/kitcn/pull/495) [`a2eb3fe`](https://github.com/udecode/kitcn/commit/a2eb3fee2bfa51191715ae6b99df0980570af47c) Thanks [@EfficiencyCorp](https://github.com/EfficiencyCorp)! - ## Patches + + - Fix Better Auth creates that carry their own id (`forceAllowId`) failing with `` Unexpected field `_id` ``: organization invitations on Better Auth 1.7.16 with default options, and `reserveVerificationValue` (magic link and email OTP for unverified users, SIWE, SAML). The row now gets its Convex id, and Better Auth reads it back under that id. A second `reserveVerificationValue` for the same identifier is still refused while the first row exists. A forced-id `oauthClientAssertion` create (`private_key_jwt`) is refused, so a replayed assertion cannot get in. + ## 0.33.12 ### Patch Changes diff --git a/packages/kitcn/package.json b/packages/kitcn/package.json index de3e3d7e4..c0b8e260a 100644 --- a/packages/kitcn/package.json +++ b/packages/kitcn/package.json @@ -1,6 +1,6 @@ { "name": "kitcn", - "version": "0.33.12", + "version": "0.34.0", "description": "kitcn - React Query integration and CLI tools for Convex", "keywords": [ "convex", diff --git a/packages/resend/CHANGELOG.md b/packages/resend/CHANGELOG.md index 58d9d453a..0ecff4742 100644 --- a/packages/resend/CHANGELOG.md +++ b/packages/resend/CHANGELOG.md @@ -1,5 +1,7 @@ # @kitcn/resend +## 0.34.0 + ## 0.33.12 ### Patch Changes diff --git a/packages/resend/package.json b/packages/resend/package.json index e1a86f4dc..5dae695ce 100644 --- a/packages/resend/package.json +++ b/packages/resend/package.json @@ -1,6 +1,6 @@ { "name": "@kitcn/resend", - "version": "0.33.12", + "version": "0.34.0", "description": "kitcn Resend plugin", "type": "module", "sideEffects": false,