Minor Changes
-
#1268
e6b2a23Thanks @toiroakr! - feat(auth): exposeenvin thebeforeLoginhook handlerThe
beforeLoginauth hook handler now receivesenvalongsideclaimsandidpConfigName, exposing the variables defined indefineConfig({ env })(the same values available viacontext.envin resolvers). This lets hooks branch on environment-specific configuration at runtime without relying onprocess.env, which is unavailable in the platform runtime. -
#1277
8d05f86Thanks @remiposo! - AddcreateKyselyMockto@tailor-platform/sdk/vitestfor unit-testing code that runs Kysely queries. It returns a real Kysely instance whose execution is mocked. You stage the rows each query returns, run your code, then assert what it did — the SQL and parameters of each query, how manyselects/inserts/updates/deletesran, and the value your code returned.import { createKyselyMock } from "@tailor-platform/sdk/vitest"; import type { Namespace } from "./generated/db"; const mock = createKyselyMock<Namespace["main-db"]>(); mock.enqueueResults([{ age: 30 }]); // the next query returns this row const { age } = await mock.db .selectFrom("User") .select("age") .where("email", "=", "a@b.com") .executeTakeFirstOrThrow(); await mock.db .updateTable("User") .set({ age: age + 1 }) .where("email", "=", "a@b.com") .execute(); expect(mock.updates).toHaveLength(1); expect(mock.updates[0].parameters).toEqual([31, "a@b.com"]); // the actual bound values expect(mock.updates[0].sql).toContain('update "User"'); // the compiled SQL
-
#1269
a230ba6Thanks @toiroakr! - feat(migration): exposeenvin migration scriptsThe migration
mainfunction now receives an optional second argument{ env }: MigrationContextexposing the variables defined indefineConfig({ env })— the same values available viacontext.envin resolvers and{ env }in workflow jobs. The values are injected at bundle time and theMigrationContexttype is exported from the generated./db. Existingmain(trx)scripts continue to work unchanged.