Releases: Quramy/prisma-fabbrica
Releases · Quramy/prisma-fabbrica
v2.3.0
New feattures
What's Changed
- chore(deps): update dependency @types/node to v22.13.15 by @renovate in #448
- chore(deps): update dependency ts-jest to v29.3.1 by @renovate in #449
- chore(deps): update dependency @types/node to v22.14.0 by @renovate in #452
- chore(deps): update dependency typescript to v5.8.3 by @renovate in #454
- chore(deps): update dependency ts-jest to v29.3.2 by @renovate in #458
- chore(deps): update dependency typescript to v5.8.3 by @renovate in #459
- chore(deps): update dependency @types/node to v22.14.1 by @renovate in #457
- chore(deps): update dependency typescript to v5.8.3 by @renovate in #453
- chore(deps): update dependency @types/node to v22.15.3 by @renovate in #460
- fix(deps): update prisma monorepo to v6.7.0 by @renovate in #455
- chore(deps): update dependency @types/node to v22.15.17 by @renovate in #461
- feat: support new prisma client generator by @nissy-dev in #462
- docs: Amend README by @Quramy in #463
New Contributors
- @nissy-dev made their first contribution in #462
Full Changelog: v2.2.3...v2.3.0
v2.2.3
Bug fixes
- fix: append "/index.js" to Prisma client import by @kyota-fujikura in #451
New Contributors
- @kyota-fujikura made their first contribution in #451
Full Changelog: v2.2.2...v2.2.3
v2.2.2
v2.2.1
What's Changed
- docs: fix typo in README.md by @mochizukikotaro in #348
- fix: Check indexing access by @Quramy in #350
New Contributors
- @mochizukikotaro made their first contribution in #348
Full Changelog: v2.2.0...v2.2.1
v2.2.0
New Features
Transient fields
Transient fields allows to define arbitrary parameters to factories.
const UserFactory = defineUserFactory.withTransientFields({
loginCount: 0,
})({
defaultData: async ({ loginCount }) => ({
/* Do something using `loginCount` parameter */
}),
});
await UserFactory.create({
name: "Bob", // `name` field is defined in scehma.primsma
loginCount: 100, // `loginCount` field is NOT defined in schema but defined in factory
});
If you want more details, See docs
Callback functions
Allow to define callback functions when to define factories like this:
const UserFactory = defineUserFactory({
onAfterCreate: async (user) => {
await PostFactory.craete({
author: { connect: uesr },
});
},
});
await UserFactory.create();
Available callback functions are onAfterBuild
, onBeforeCreate
, and onAfterCreate
.
If you want more details, See docs
Improve createList
signature
createList
(or buildList
) method in factory interface accepts the 2nd argument.
The 2nd argument can be an object assignable to Partial<Prisma.MODEL.CreateInput>
.
// Insert 10 LoginHistory model records with the same `userId` field.
await LoginHistoryFactory.createList(10, { userId: "user001" });
Full Changelog: v2.1.5...v2.2.0