Skip to content

@tailor-platform/sdk@1.54.0

Latest

Choose a tag to compare

@tailor-platform-pr-trigger tailor-platform-pr-trigger released this 02 Jun 08:25
· 4 commits to main since this release
34bb263

Minor Changes

  • #1268 e6b2a23 Thanks @toiroakr! - feat(auth): expose env in the beforeLogin hook handler

    The beforeLogin auth hook handler now receives env alongside claims and idpConfigName, exposing the variables defined in defineConfig({ env }) (the same values available via context.env in resolvers). This lets hooks branch on environment-specific configuration at runtime without relying on process.env, which is unavailable in the platform runtime.

  • #1277 8d05f86 Thanks @remiposo! - Add createKyselyMock to @tailor-platform/sdk/vitest for 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 many selects/inserts/updates/deletes ran, 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 a230ba6 Thanks @toiroakr! - feat(migration): expose env in migration scripts

    The migration main function now receives an optional second argument { env }: MigrationContext exposing the variables defined in defineConfig({ env }) — the same values available via context.env in resolvers and { env } in workflow jobs. The values are injected at bundle time and the MigrationContext type is exported from the generated ./db. Existing main(trx) scripts continue to work unchanged.

Patch Changes