@geekmidas/testkit 0.3.1 → 0.6.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.
Files changed (209) hide show
  1. package/dist/Factory-BFVnMMCC.mjs.map +1 -1
  2. package/dist/Factory-BhjUOBWN.cjs.map +1 -1
  3. package/dist/{Factory-BK06XuDA.d.cts → Factory-Bx0AJXZB.d.cts} +3 -2
  4. package/dist/Factory-Bx0AJXZB.d.cts.map +1 -0
  5. package/dist/{Factory-BcGJjLc8.d.mts → Factory-SFupxRC2.d.mts} +2 -1
  6. package/dist/Factory-SFupxRC2.d.mts.map +1 -0
  7. package/dist/Factory.d.cts +2 -2
  8. package/dist/Factory.d.mts +1 -1
  9. package/dist/KyselyFactory-BFqVIn_0.cjs.map +1 -1
  10. package/dist/KyselyFactory-DMswpwji.mjs.map +1 -1
  11. package/dist/{KyselyFactory-Bu9ssWZP.d.cts → KyselyFactory-KLeKH43i.d.cts} +4 -3
  12. package/dist/KyselyFactory-KLeKH43i.d.cts.map +1 -0
  13. package/dist/{KyselyFactory-Cj-EultY.d.mts → KyselyFactory-vAxYodck.d.mts} +3 -2
  14. package/dist/KyselyFactory-vAxYodck.d.mts.map +1 -0
  15. package/dist/KyselyFactory.d.cts +3 -3
  16. package/dist/KyselyFactory.d.mts +2 -2
  17. package/dist/{ObjectionFactory-DL4qkuF1.d.mts → ObjectionFactory-BWjB49-i.d.mts} +3 -2
  18. package/dist/ObjectionFactory-BWjB49-i.d.mts.map +1 -0
  19. package/dist/ObjectionFactory-BeFBYcan.cjs.map +1 -1
  20. package/dist/ObjectionFactory-QCJ7u0Ql.mjs.map +1 -1
  21. package/dist/{ObjectionFactory-tKWZOiYO.d.cts → ObjectionFactory-aMGvAKt9.d.cts} +4 -3
  22. package/dist/ObjectionFactory-aMGvAKt9.d.cts.map +1 -0
  23. package/dist/ObjectionFactory.d.cts +3 -3
  24. package/dist/ObjectionFactory.d.mts +2 -2
  25. package/dist/{PostgresKyselyMigrator-upT-hmrz.mjs → PostgresKyselyMigrator-6sE1KOni.mjs} +2 -2
  26. package/dist/PostgresKyselyMigrator-6sE1KOni.mjs.map +1 -0
  27. package/dist/{PostgresKyselyMigrator-CIx3AFSR.d.mts → PostgresKyselyMigrator-CBltSOq5.d.cts} +3 -2
  28. package/dist/PostgresKyselyMigrator-CBltSOq5.d.cts.map +1 -0
  29. package/dist/{PostgresKyselyMigrator-CfytARcA.cjs → PostgresKyselyMigrator-D6IbPq8t.cjs} +2 -2
  30. package/dist/PostgresKyselyMigrator-D6IbPq8t.cjs.map +1 -0
  31. package/dist/{PostgresKyselyMigrator-CQ3aUoy_.d.cts → PostgresKyselyMigrator-DrVWncqd.d.mts} +3 -2
  32. package/dist/PostgresKyselyMigrator-DrVWncqd.d.mts.map +1 -0
  33. package/dist/PostgresKyselyMigrator.cjs +2 -2
  34. package/dist/PostgresKyselyMigrator.d.cts +2 -2
  35. package/dist/PostgresKyselyMigrator.d.mts +2 -2
  36. package/dist/PostgresKyselyMigrator.mjs +2 -2
  37. package/dist/{PostgresMigrator-DbuJGAVy.mjs → PostgresMigrator-BjjenqSd.mjs} +2 -2
  38. package/dist/PostgresMigrator-BjjenqSd.mjs.map +1 -0
  39. package/dist/{PostgresMigrator-D5UkK1_K.d.cts → PostgresMigrator-Bres0U6E.d.cts} +2 -1
  40. package/dist/PostgresMigrator-Bres0U6E.d.cts.map +1 -0
  41. package/dist/{PostgresMigrator-DFcNdCvD.cjs → PostgresMigrator-D6dQn0x2.cjs} +2 -2
  42. package/dist/PostgresMigrator-D6dQn0x2.cjs.map +1 -0
  43. package/dist/{PostgresMigrator-DQaRxoaY.d.mts → PostgresMigrator-S-YYosAC.d.mts} +2 -1
  44. package/dist/PostgresMigrator-S-YYosAC.d.mts.map +1 -0
  45. package/dist/PostgresMigrator.cjs +1 -1
  46. package/dist/PostgresMigrator.d.cts +1 -1
  47. package/dist/PostgresMigrator.d.mts +1 -1
  48. package/dist/PostgresMigrator.mjs +1 -1
  49. package/dist/{PostgresObjectionMigrator-CZHHcCOv.d.cts → PostgresObjectionMigrator-CPfBAP7r.d.cts} +3 -2
  50. package/dist/PostgresObjectionMigrator-CPfBAP7r.d.cts.map +1 -0
  51. package/dist/{PostgresObjectionMigrator-BG6ymgnt.cjs → PostgresObjectionMigrator-DK8ODIHQ.cjs} +2 -2
  52. package/dist/PostgresObjectionMigrator-DK8ODIHQ.cjs.map +1 -0
  53. package/dist/{PostgresObjectionMigrator-D_hCcrQu.d.mts → PostgresObjectionMigrator-DVEqB5tp.d.mts} +3 -2
  54. package/dist/PostgresObjectionMigrator-DVEqB5tp.d.mts.map +1 -0
  55. package/dist/{PostgresObjectionMigrator-DPj2pOpX.mjs → PostgresObjectionMigrator-D_QxXbIN.mjs} +2 -2
  56. package/dist/PostgresObjectionMigrator-D_QxXbIN.mjs.map +1 -0
  57. package/dist/PostgresObjectionMigrator.cjs +2 -2
  58. package/dist/PostgresObjectionMigrator.d.cts +2 -2
  59. package/dist/PostgresObjectionMigrator.d.mts +2 -2
  60. package/dist/PostgresObjectionMigrator.mjs +2 -2
  61. package/dist/{VitestKyselyTransactionIsolator-D3EZZhjZ.d.cts → VitestKyselyTransactionIsolator-CduJlHoT.d.cts} +4 -3
  62. package/dist/VitestKyselyTransactionIsolator-CduJlHoT.d.cts.map +1 -0
  63. package/dist/{VitestKyselyTransactionIsolator-Dxlp1u0f.d.mts → VitestKyselyTransactionIsolator-Cswnnj0k.d.mts} +4 -3
  64. package/dist/VitestKyselyTransactionIsolator-Cswnnj0k.d.mts.map +1 -0
  65. package/dist/{VitestKyselyTransactionIsolator-EvDLk5zg.cjs → VitestKyselyTransactionIsolator-D7RRXOBa.cjs} +2 -2
  66. package/dist/VitestKyselyTransactionIsolator-D7RRXOBa.cjs.map +1 -0
  67. package/dist/{VitestKyselyTransactionIsolator-CNURW8y6.mjs → VitestKyselyTransactionIsolator-DceyIqr4.mjs} +2 -2
  68. package/dist/VitestKyselyTransactionIsolator-DceyIqr4.mjs.map +1 -0
  69. package/dist/VitestKyselyTransactionIsolator.cjs +1 -1
  70. package/dist/VitestKyselyTransactionIsolator.d.cts +2 -2
  71. package/dist/VitestKyselyTransactionIsolator.d.mts +2 -2
  72. package/dist/VitestKyselyTransactionIsolator.mjs +1 -1
  73. package/dist/{VitestObjectionTransactionIsolator-1TpsPqfG.d.cts → VitestObjectionTransactionIsolator-BXoR6xdG.d.cts} +4 -3
  74. package/dist/VitestObjectionTransactionIsolator-BXoR6xdG.d.cts.map +1 -0
  75. package/dist/{VitestObjectionTransactionIsolator-CM5KTAFA.cjs → VitestObjectionTransactionIsolator-CdLRrzNf.cjs} +2 -2
  76. package/dist/VitestObjectionTransactionIsolator-CdLRrzNf.cjs.map +1 -0
  77. package/dist/{VitestObjectionTransactionIsolator-jQFaCz0u.mjs → VitestObjectionTransactionIsolator-OF2osYY5.mjs} +2 -2
  78. package/dist/VitestObjectionTransactionIsolator-OF2osYY5.mjs.map +1 -0
  79. package/dist/{VitestObjectionTransactionIsolator-i9jIgU8Q.d.mts → VitestObjectionTransactionIsolator-x6hY5j4u.d.mts} +4 -3
  80. package/dist/VitestObjectionTransactionIsolator-x6hY5j4u.d.mts.map +1 -0
  81. package/dist/VitestObjectionTransactionIsolator.cjs +1 -1
  82. package/dist/VitestObjectionTransactionIsolator.d.cts +2 -2
  83. package/dist/VitestObjectionTransactionIsolator.d.mts +2 -2
  84. package/dist/VitestObjectionTransactionIsolator.mjs +1 -1
  85. package/dist/{VitestTransactionIsolator-BvR19bYn.d.mts → VitestTransactionIsolator-BNWJqh9f.d.mts} +3 -2
  86. package/dist/VitestTransactionIsolator-BNWJqh9f.d.mts.map +1 -0
  87. package/dist/VitestTransactionIsolator-CMfJXZP8.cjs.map +1 -1
  88. package/dist/{VitestTransactionIsolator-CwQaxZLP.d.cts → VitestTransactionIsolator-CSroc7Df.d.cts} +3 -2
  89. package/dist/VitestTransactionIsolator-CSroc7Df.d.cts.map +1 -0
  90. package/dist/VitestTransactionIsolator-DQ7tLqgV.mjs.map +1 -1
  91. package/dist/VitestTransactionIsolator.d.cts +1 -1
  92. package/dist/VitestTransactionIsolator.d.mts +1 -1
  93. package/dist/aws.cjs.map +1 -1
  94. package/dist/aws.d.cts +2 -0
  95. package/dist/aws.d.cts.map +1 -0
  96. package/dist/aws.d.mts +2 -0
  97. package/dist/aws.d.mts.map +1 -0
  98. package/dist/aws.mjs.map +1 -1
  99. package/dist/benchmark.cjs.map +1 -1
  100. package/dist/benchmark.d.cts +1 -0
  101. package/dist/benchmark.d.cts.map +1 -0
  102. package/dist/benchmark.d.mts +1 -0
  103. package/dist/benchmark.d.mts.map +1 -0
  104. package/dist/benchmark.mjs.map +1 -1
  105. package/dist/better-auth.cjs +29 -30
  106. package/dist/better-auth.cjs.map +1 -1
  107. package/dist/better-auth.d.cts +2 -2
  108. package/dist/better-auth.d.cts.map +1 -0
  109. package/dist/better-auth.d.mts.map +1 -0
  110. package/dist/better-auth.mjs +29 -30
  111. package/dist/better-auth.mjs.map +1 -1
  112. package/dist/directory-B-Ozljzk.mjs.map +1 -1
  113. package/dist/directory-BVC8g7cX.cjs.map +1 -1
  114. package/dist/{directory-DlkPEzL4.d.cts → directory-CVrfTq1I.d.mts} +2 -1
  115. package/dist/directory-CVrfTq1I.d.mts.map +1 -0
  116. package/dist/directory-Cys9g76X.d.cts +13 -0
  117. package/dist/directory-Cys9g76X.d.cts.map +1 -0
  118. package/dist/faker-B14IEMIN.cjs.map +1 -1
  119. package/dist/faker-BGKYFoCT.mjs.map +1 -1
  120. package/dist/{faker-Cg76aFNO.d.cts → faker-BSH1EMtg.d.cts} +3 -3
  121. package/dist/faker-BSH1EMtg.d.cts.map +1 -0
  122. package/dist/faker-DHh7xs4u.d.mts.map +1 -0
  123. package/dist/faker.d.cts +1 -1
  124. package/dist/helpers.cjs.map +1 -1
  125. package/dist/helpers.d.cts +1 -0
  126. package/dist/helpers.d.cts.map +1 -0
  127. package/dist/helpers.d.mts +1 -0
  128. package/dist/helpers.d.mts.map +1 -0
  129. package/dist/helpers.mjs.map +1 -1
  130. package/dist/kysely.cjs +3 -3
  131. package/dist/kysely.cjs.map +1 -1
  132. package/dist/kysely.d.cts +8 -7
  133. package/dist/kysely.d.cts.map +1 -0
  134. package/dist/kysely.d.mts +7 -6
  135. package/dist/kysely.d.mts.map +1 -0
  136. package/dist/kysely.mjs +3 -3
  137. package/dist/kysely.mjs.map +1 -1
  138. package/dist/logger.cjs.map +1 -1
  139. package/dist/logger.d.cts +1 -0
  140. package/dist/logger.d.cts.map +1 -0
  141. package/dist/logger.d.mts +1 -0
  142. package/dist/logger.d.mts.map +1 -0
  143. package/dist/logger.mjs.map +1 -1
  144. package/dist/objection.cjs +3 -3
  145. package/dist/objection.cjs.map +1 -1
  146. package/dist/objection.d.cts +8 -7
  147. package/dist/objection.d.cts.map +1 -0
  148. package/dist/objection.d.mts +7 -6
  149. package/dist/objection.d.mts.map +1 -0
  150. package/dist/objection.mjs +3 -3
  151. package/dist/objection.mjs.map +1 -1
  152. package/dist/os/directory.d.cts +1 -1
  153. package/dist/os/directory.d.mts +1 -1
  154. package/dist/os/index.d.cts +1 -1
  155. package/dist/os/index.d.mts +1 -1
  156. package/dist/timer.cjs.map +1 -1
  157. package/dist/timer.d.cts +2 -0
  158. package/dist/timer.d.cts.map +1 -0
  159. package/dist/timer.d.mts +2 -0
  160. package/dist/timer.d.mts.map +1 -0
  161. package/dist/timer.mjs.map +1 -1
  162. package/package.json +39 -5
  163. package/src/Factory.ts +72 -72
  164. package/src/KyselyFactory.ts +330 -330
  165. package/src/ObjectionFactory.ts +354 -355
  166. package/src/PostgresKyselyMigrator.ts +37 -37
  167. package/src/PostgresMigrator.ts +107 -107
  168. package/src/PostgresObjectionMigrator.ts +91 -91
  169. package/src/VitestKyselyTransactionIsolator.ts +27 -27
  170. package/src/VitestObjectionTransactionIsolator.ts +39 -39
  171. package/src/VitestTransactionIsolator.ts +196 -195
  172. package/src/__tests__/Factory.spec.ts +163 -155
  173. package/src/__tests__/KyselyFactory.spec.ts +443 -439
  174. package/src/__tests__/ObjectionFactory.spec.ts +563 -557
  175. package/src/__tests__/PostgresKyselyMigrator.spec.ts +641 -641
  176. package/src/__tests__/PostgresMigrator.spec.ts +341 -341
  177. package/src/__tests__/PostgresObjectionMigrator.spec.ts +578 -578
  178. package/src/__tests__/VitestObjectionTransactionIsolator.spec.ts +114 -114
  179. package/src/__tests__/benchmark.spec.ts +140 -0
  180. package/src/__tests__/better-auth.spec.ts +15 -15
  181. package/src/__tests__/faker.spec.ts +226 -137
  182. package/src/__tests__/integration.spec.ts +597 -597
  183. package/src/__tests__/utilities.spec.ts +211 -0
  184. package/src/aws.ts +104 -104
  185. package/src/benchmark.ts +12 -12
  186. package/src/better-auth.ts +286 -301
  187. package/src/faker.ts +153 -153
  188. package/src/helpers.ts +6 -6
  189. package/src/kysely.ts +33 -33
  190. package/src/logger.ts +10 -10
  191. package/src/objection.ts +31 -31
  192. package/src/os/directory.ts +11 -10
  193. package/src/timer.ts +1 -1
  194. package/test/globalSetup.ts +45 -45
  195. package/test/helpers.ts +189 -189
  196. package/test/migrations/1749664623372_user.ts +13 -13
  197. package/tsconfig.json +9 -0
  198. package/vitest.config.ts +4 -4
  199. package/dist/PostgresKyselyMigrator-CfytARcA.cjs.map +0 -1
  200. package/dist/PostgresKyselyMigrator-upT-hmrz.mjs.map +0 -1
  201. package/dist/PostgresMigrator-DFcNdCvD.cjs.map +0 -1
  202. package/dist/PostgresMigrator-DbuJGAVy.mjs.map +0 -1
  203. package/dist/PostgresObjectionMigrator-BG6ymgnt.cjs.map +0 -1
  204. package/dist/PostgresObjectionMigrator-DPj2pOpX.mjs.map +0 -1
  205. package/dist/VitestKyselyTransactionIsolator-CNURW8y6.mjs.map +0 -1
  206. package/dist/VitestKyselyTransactionIsolator-EvDLk5zg.cjs.map +0 -1
  207. package/dist/VitestObjectionTransactionIsolator-CM5KTAFA.cjs.map +0 -1
  208. package/dist/VitestObjectionTransactionIsolator-jQFaCz0u.mjs.map +0 -1
  209. package/dist/directory-BPf1LgNX.d.mts +0 -12
@@ -1 +1 @@
1
- {"version":3,"file":"kysely.cjs","names":["api: TestAPI","options: KyselyTransactionOptions<Database, Extended>","VitestKyselyTransactionIsolator","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Transaction<Database>, Extended>"],"sources":["../src/kysely.ts"],"sourcesContent":["import type { Kysely, Transaction } from 'kysely';\nimport type { TestAPI } from 'vitest';\nimport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nimport {\n type DatabaseConnection,\n type FixtureCreators,\n type IsolationLevel,\n extendWithFixtures as baseExtendWithFixtures,\n} from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific exports for test utilities.\n * Provides factories, migrators, and transaction isolators for Kysely ORM.\n */\n\nexport { KyselyFactory } from './KyselyFactory';\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { PostgresKyselyMigrator } from './PostgresKyselyMigrator';\nexport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\nexport type {\n DatabaseFixtures,\n ExtendedDatabaseFixtures,\n FixtureCreators,\n TestWithExtendedFixtures,\n TransactionWrapperOptions,\n} from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific options for transaction wrapping.\n */\nexport interface KyselyTransactionOptions<\n Database,\n Extended extends Record<string, unknown> = {},\n> {\n /** Function that creates or returns a Kysely database instance */\n connection: DatabaseConnection<Kysely<Database>>;\n /** Optional setup function to run within the transaction before each test */\n setup?: (trx: Transaction<Database>) => Promise<void>;\n /** Transaction isolation level (defaults to REPEATABLE_READ) */\n isolationLevel?: IsolationLevel;\n /** Additional fixtures that depend on the transaction */\n fixtures?: FixtureCreators<Transaction<Database>, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { faker, type FakerFactory } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Kysely.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Database - The database schema type\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction } from '@geekmidas/testkit/kysely';\n * import { db } from './database';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestKyselyTransaction(test, {\n * connection: db,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await trx\n * .insertInto('users')\n * .values({ name: 'Test User', email: 'test@example.com' })\n * .returningAll()\n * .executeTakeFirst();\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestKyselyTransaction<DB, { factory: Factory }>(test, {\n * connection: db,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestKyselyTransaction<\n Database,\n Extended extends Record<string, unknown> = {},\n>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>) {\n const wrapper = new VitestKyselyTransactionIsolator<Database>(api);\n\n return wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends a Kysely transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Database - The database schema type\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestKyselyTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction, extendWithFixtures, KyselyFactory } from '@geekmidas/testkit/kysely';\n *\n * // Define your builders\n * const builders = {\n * user: KyselyFactory.createBuilder<DB, 'users'>('users', ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestKyselyTransaction<DB>(test, {\n * connection: db,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<DB, { factory: KyselyFactory<DB, typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new KyselyFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await trx\n * .selectFrom('users')\n * .where('id', '=', user.id)\n * .selectAll()\n * .executeTakeFirst();\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n Database,\n Extended extends Record<string, unknown>,\n T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Transaction<Database>, Extended>) {\n return baseExtendWithFixtures<Transaction<Database>, Extended, T>(\n wrappedTest,\n fixtures,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,SAAgB,4BAGdA,KAAcC,SAAuD;CACrE,MAAM,UAAU,IAAIC,wEAA0C;AAE9D,QAAO,QAAQ,0BAA0B,QAAQ;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDD,SAAgBC,qBAIdC,aAAgBC,UAA4D;AAC5E,QAAO,qDACL,aACA,SACD;AACF"}
1
+ {"version":3,"file":"kysely.cjs","names":["api: TestAPI","options: KyselyTransactionOptions<Database, Extended>","VitestKyselyTransactionIsolator","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Transaction<Database>, Extended>"],"sources":["../src/kysely.ts"],"sourcesContent":["import type { Kysely, Transaction } from 'kysely';\nimport type { TestAPI } from 'vitest';\nimport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nimport {\n\textendWithFixtures as baseExtendWithFixtures,\n\ttype DatabaseConnection,\n\ttype FixtureCreators,\n\ttype IsolationLevel,\n} from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific exports for test utilities.\n * Provides factories, migrators, and transaction isolators for Kysely ORM.\n */\n\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { KyselyFactory } from './KyselyFactory';\nexport { PostgresKyselyMigrator } from './PostgresKyselyMigrator';\nexport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nexport type {\n\tDatabaseFixtures,\n\tExtendedDatabaseFixtures,\n\tFixtureCreators,\n\tTestWithExtendedFixtures,\n\tTransactionWrapperOptions,\n} from './VitestTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific options for transaction wrapping.\n */\nexport interface KyselyTransactionOptions<\n\tDatabase,\n\tExtended extends Record<string, unknown> = {},\n> {\n\t/** Function that creates or returns a Kysely database instance */\n\tconnection: DatabaseConnection<Kysely<Database>>;\n\t/** Optional setup function to run within the transaction before each test */\n\tsetup?: (trx: Transaction<Database>) => Promise<void>;\n\t/** Transaction isolation level (defaults to REPEATABLE_READ) */\n\tisolationLevel?: IsolationLevel;\n\t/** Additional fixtures that depend on the transaction */\n\tfixtures?: FixtureCreators<Transaction<Database>, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { type FakerFactory, faker } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Kysely.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Database - The database schema type\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction } from '@geekmidas/testkit/kysely';\n * import { db } from './database';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestKyselyTransaction(test, {\n * connection: db,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await trx\n * .insertInto('users')\n * .values({ name: 'Test User', email: 'test@example.com' })\n * .returningAll()\n * .executeTakeFirst();\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestKyselyTransaction<DB, { factory: Factory }>(test, {\n * connection: db,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestKyselyTransaction<\n\tDatabase,\n\tExtended extends Record<string, unknown> = {},\n>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>) {\n\tconst wrapper = new VitestKyselyTransactionIsolator<Database>(api);\n\n\treturn wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends a Kysely transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Database - The database schema type\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestKyselyTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction, extendWithFixtures, KyselyFactory } from '@geekmidas/testkit/kysely';\n *\n * // Define your builders\n * const builders = {\n * user: KyselyFactory.createBuilder<DB, 'users'>('users', ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestKyselyTransaction<DB>(test, {\n * connection: db,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<DB, { factory: KyselyFactory<DB, typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new KyselyFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await trx\n * .selectFrom('users')\n * .where('id', '=', user.id)\n * .selectAll()\n * .executeTakeFirst();\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n\tDatabase,\n\tExtended extends Record<string, unknown>,\n\tT extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Transaction<Database>, Extended>) {\n\treturn baseExtendWithFixtures<Transaction<Database>, Extended, T>(\n\t\twrappedTest,\n\t\tfixtures,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,SAAgB,4BAGdA,KAAcC,SAAuD;CACtE,MAAM,UAAU,IAAIC,wEAA0C;AAE9D,QAAO,QAAQ,0BAA0B,QAAQ;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDD,SAAgBC,qBAIdC,aAAgBC,UAA4D;AAC7E,QAAO,qDACN,aACA,SACA;AACD"}
package/dist/kysely.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { FakerFactory, faker } from "./faker-Cg76aFNO.cjs";
2
- import { ExtractSeedAttrs, FactorySeed } from "./Factory-BK06XuDA.cjs";
3
- import { KyselyFactory } from "./KyselyFactory-Bu9ssWZP.cjs";
4
- import "./PostgresMigrator-D5UkK1_K.cjs";
5
- import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-CQ3aUoy_.cjs";
6
- import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-CwQaxZLP.cjs";
7
- import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-D3EZZhjZ.cjs";
1
+ import { FakerFactory, faker } from "./faker-BSH1EMtg.cjs";
2
+ import { ExtractSeedAttrs, FactorySeed } from "./Factory-Bx0AJXZB.cjs";
3
+ import { KyselyFactory } from "./KyselyFactory-KLeKH43i.cjs";
4
+ import "./PostgresMigrator-Bres0U6E.cjs";
5
+ import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-CBltSOq5.cjs";
6
+ import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-CSroc7Df.cjs";
7
+ import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-CduJlHoT.cjs";
8
8
  import { Kysely, Transaction } from "kysely";
9
9
  import { TestAPI } from "vitest";
10
10
 
@@ -124,6 +124,7 @@ declare function wrapVitestKyselyTransaction<Database, Extended extends Record<s
124
124
  * ```
125
125
  */
126
126
  declare function extendWithFixtures<Database, Extended extends Record<string, unknown>, T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>>(wrappedTest: T, fixtures: FixtureCreators<Transaction<Database>, Extended>): TestWithExtendedFixtures<Transaction<Database>, Extended, T>;
127
+ //# sourceMappingURL=kysely.d.ts.map
127
128
  //#endregion
128
129
  export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, KyselyFactory, KyselyTransactionOptions, PostgresKyselyMigrator, TestWithExtendedFixtures, TransactionWrapperOptions, VitestKyselyTransactionIsolator, extendWithFixtures, faker, wrapVitestKyselyTransaction };
129
130
  //# sourceMappingURL=kysely.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kysely.d.cts","names":[],"sources":["../src/kysely.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;AAoCa,UALI,wBAKJ,CAAA,QAAA,EAAA,iBAHK,MAGL,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA;EAAkB;EAEI,UAApB,EAFF,kBAEE,CAFiB,MAEjB,CAFwB,QAExB,CAAA,CAAA;EAAW;EAAsB,KAE9B,CAAA,EAAA,CAAA,GAAA,EAFH,WAEG,CAFS,QAET,CAAA,EAAA,GAFuB,OAEvB,CAAA,IAAA,CAAA;EAAc;EAEgB,cAApB,CAAA,EAFV,cAEU;EAAW;EAAoB,QAA/C,CAAA,EAAA,eAAA,CAAgB,WAAhB,CAA4B,QAA5B,CAAA,EAAuC,QAAvC,CAAA;AAAe;;;;;;;;;;;;AAwD0C;AA0DrE;;;;;;;;;;;;;;;;;AAI4E;;;;;;;;;;;;;;;;;;iBAjE5D,uDAEE,mCACX,kBAAkB,yBAAyB,UAAU,YAAS,QAAA,iBAAA,YAAA,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0DrD,8CAEE,mCACP,WAAW,qBAAqB,WAAW,iCACvC,aAAa,gBAAgB,YAAY,WAAW,YAAS,yBAAA,YAAA,WAAA,UAAA"}
package/dist/kysely.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { FakerFactory, faker } from "./faker-DHh7xs4u.mjs";
2
- import { ExtractSeedAttrs, FactorySeed } from "./Factory-BcGJjLc8.mjs";
3
- import { KyselyFactory } from "./KyselyFactory-Cj-EultY.mjs";
4
- import "./PostgresMigrator-DQaRxoaY.mjs";
5
- import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-CIx3AFSR.mjs";
6
- import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-BvR19bYn.mjs";
7
- import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-Dxlp1u0f.mjs";
2
+ import { ExtractSeedAttrs, FactorySeed } from "./Factory-SFupxRC2.mjs";
3
+ import { KyselyFactory } from "./KyselyFactory-vAxYodck.mjs";
4
+ import "./PostgresMigrator-S-YYosAC.mjs";
5
+ import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-DrVWncqd.mjs";
6
+ import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-BNWJqh9f.mjs";
7
+ import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-Cswnnj0k.mjs";
8
8
  import { Kysely, Transaction } from "kysely";
9
9
  import { TestAPI } from "vitest";
10
10
 
@@ -124,6 +124,7 @@ declare function wrapVitestKyselyTransaction<Database, Extended extends Record<s
124
124
  * ```
125
125
  */
126
126
  declare function extendWithFixtures<Database, Extended extends Record<string, unknown>, T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>>(wrappedTest: T, fixtures: FixtureCreators<Transaction<Database>, Extended>): TestWithExtendedFixtures<Transaction<Database>, Extended, T>;
127
+ //# sourceMappingURL=kysely.d.ts.map
127
128
  //#endregion
128
129
  export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, KyselyFactory, KyselyTransactionOptions, PostgresKyselyMigrator, TestWithExtendedFixtures, TransactionWrapperOptions, VitestKyselyTransactionIsolator, extendWithFixtures, faker, wrapVitestKyselyTransaction };
129
130
  //# sourceMappingURL=kysely.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kysely.d.mts","names":[],"sources":["../src/kysely.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;AAoCa,UALI,wBAKJ,CAAA,QAAA,EAAA,iBAHK,MAGL,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA;EAAkB;EAEI,UAApB,EAFF,kBAEE,CAFiB,MAEjB,CAFwB,QAExB,CAAA,CAAA;EAAW;EAAsB,KAE9B,CAAA,EAAA,CAAA,GAAA,EAFH,WAEG,CAFS,QAET,CAAA,EAAA,GAFuB,OAEvB,CAAA,IAAA,CAAA;EAAc;EAEgB,cAApB,CAAA,EAFV,cAEU;EAAW;EAAoB,QAA/C,CAAA,EAAA,eAAA,CAAgB,WAAhB,CAA4B,QAA5B,CAAA,EAAuC,QAAvC,CAAA;AAAe;;;;;;;;;;;;AAwD0C;AA0DrE;;;;;;;;;;;;;;;;;AAI4E;;;;;;;;;;;;;;;;;;iBAjE5D,uDAEE,mCACX,kBAAkB,yBAAyB,UAAU,YAAS,QAAA,iBAAA,YAAA,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0DrD,8CAEE,mCACP,WAAW,qBAAqB,WAAW,iCACvC,aAAa,gBAAgB,YAAY,WAAW,YAAS,yBAAA,YAAA,WAAA,UAAA"}
package/dist/kysely.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import "./Factory-BFVnMMCC.mjs";
2
2
  import { faker } from "./faker-BGKYFoCT.mjs";
3
3
  import { KyselyFactory } from "./KyselyFactory-DMswpwji.mjs";
4
- import "./PostgresMigrator-DbuJGAVy.mjs";
5
- import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-upT-hmrz.mjs";
4
+ import "./PostgresMigrator-BjjenqSd.mjs";
5
+ import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator-6sE1KOni.mjs";
6
6
  import { IsolationLevel, extendWithFixtures } from "./VitestTransactionIsolator-DQ7tLqgV.mjs";
7
- import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-CNURW8y6.mjs";
7
+ import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-DceyIqr4.mjs";
8
8
 
9
9
  //#region src/kysely.ts
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"kysely.mjs","names":["api: TestAPI","options: KyselyTransactionOptions<Database, Extended>","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Transaction<Database>, Extended>"],"sources":["../src/kysely.ts"],"sourcesContent":["import type { Kysely, Transaction } from 'kysely';\nimport type { TestAPI } from 'vitest';\nimport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nimport {\n type DatabaseConnection,\n type FixtureCreators,\n type IsolationLevel,\n extendWithFixtures as baseExtendWithFixtures,\n} from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific exports for test utilities.\n * Provides factories, migrators, and transaction isolators for Kysely ORM.\n */\n\nexport { KyselyFactory } from './KyselyFactory';\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { PostgresKyselyMigrator } from './PostgresKyselyMigrator';\nexport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\nexport type {\n DatabaseFixtures,\n ExtendedDatabaseFixtures,\n FixtureCreators,\n TestWithExtendedFixtures,\n TransactionWrapperOptions,\n} from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific options for transaction wrapping.\n */\nexport interface KyselyTransactionOptions<\n Database,\n Extended extends Record<string, unknown> = {},\n> {\n /** Function that creates or returns a Kysely database instance */\n connection: DatabaseConnection<Kysely<Database>>;\n /** Optional setup function to run within the transaction before each test */\n setup?: (trx: Transaction<Database>) => Promise<void>;\n /** Transaction isolation level (defaults to REPEATABLE_READ) */\n isolationLevel?: IsolationLevel;\n /** Additional fixtures that depend on the transaction */\n fixtures?: FixtureCreators<Transaction<Database>, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { faker, type FakerFactory } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Kysely.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Database - The database schema type\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction } from '@geekmidas/testkit/kysely';\n * import { db } from './database';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestKyselyTransaction(test, {\n * connection: db,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await trx\n * .insertInto('users')\n * .values({ name: 'Test User', email: 'test@example.com' })\n * .returningAll()\n * .executeTakeFirst();\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestKyselyTransaction<DB, { factory: Factory }>(test, {\n * connection: db,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestKyselyTransaction<\n Database,\n Extended extends Record<string, unknown> = {},\n>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>) {\n const wrapper = new VitestKyselyTransactionIsolator<Database>(api);\n\n return wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends a Kysely transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Database - The database schema type\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestKyselyTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction, extendWithFixtures, KyselyFactory } from '@geekmidas/testkit/kysely';\n *\n * // Define your builders\n * const builders = {\n * user: KyselyFactory.createBuilder<DB, 'users'>('users', ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestKyselyTransaction<DB>(test, {\n * connection: db,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<DB, { factory: KyselyFactory<DB, typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new KyselyFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await trx\n * .selectFrom('users')\n * .where('id', '=', user.id)\n * .selectAll()\n * .executeTakeFirst();\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n Database,\n Extended extends Record<string, unknown>,\n T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Transaction<Database>, Extended>) {\n return baseExtendWithFixtures<Transaction<Database>, Extended, T>(\n wrappedTest,\n fixtures,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,SAAgB,4BAGdA,KAAcC,SAAuD;CACrE,MAAM,UAAU,IAAI,gCAA0C;AAE9D,QAAO,QAAQ,0BAA0B,QAAQ;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDD,SAAgBC,qBAIdC,aAAgBC,UAA4D;AAC5E,QAAO,mBACL,aACA,SACD;AACF"}
1
+ {"version":3,"file":"kysely.mjs","names":["api: TestAPI","options: KyselyTransactionOptions<Database, Extended>","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Transaction<Database>, Extended>"],"sources":["../src/kysely.ts"],"sourcesContent":["import type { Kysely, Transaction } from 'kysely';\nimport type { TestAPI } from 'vitest';\nimport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nimport {\n\textendWithFixtures as baseExtendWithFixtures,\n\ttype DatabaseConnection,\n\ttype FixtureCreators,\n\ttype IsolationLevel,\n} from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific exports for test utilities.\n * Provides factories, migrators, and transaction isolators for Kysely ORM.\n */\n\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { KyselyFactory } from './KyselyFactory';\nexport { PostgresKyselyMigrator } from './PostgresKyselyMigrator';\nexport { VitestKyselyTransactionIsolator } from './VitestKyselyTransactionIsolator';\nexport type {\n\tDatabaseFixtures,\n\tExtendedDatabaseFixtures,\n\tFixtureCreators,\n\tTestWithExtendedFixtures,\n\tTransactionWrapperOptions,\n} from './VitestTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\n\n/**\n * Kysely-specific options for transaction wrapping.\n */\nexport interface KyselyTransactionOptions<\n\tDatabase,\n\tExtended extends Record<string, unknown> = {},\n> {\n\t/** Function that creates or returns a Kysely database instance */\n\tconnection: DatabaseConnection<Kysely<Database>>;\n\t/** Optional setup function to run within the transaction before each test */\n\tsetup?: (trx: Transaction<Database>) => Promise<void>;\n\t/** Transaction isolation level (defaults to REPEATABLE_READ) */\n\tisolationLevel?: IsolationLevel;\n\t/** Additional fixtures that depend on the transaction */\n\tfixtures?: FixtureCreators<Transaction<Database>, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { type FakerFactory, faker } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Kysely.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Database - The database schema type\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction } from '@geekmidas/testkit/kysely';\n * import { db } from './database';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestKyselyTransaction(test, {\n * connection: db,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await trx\n * .insertInto('users')\n * .values({ name: 'Test User', email: 'test@example.com' })\n * .returningAll()\n * .executeTakeFirst();\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestKyselyTransaction<DB, { factory: Factory }>(test, {\n * connection: db,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestKyselyTransaction<\n\tDatabase,\n\tExtended extends Record<string, unknown> = {},\n>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>) {\n\tconst wrapper = new VitestKyselyTransactionIsolator<Database>(api);\n\n\treturn wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends a Kysely transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Database - The database schema type\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestKyselyTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestKyselyTransaction, extendWithFixtures, KyselyFactory } from '@geekmidas/testkit/kysely';\n *\n * // Define your builders\n * const builders = {\n * user: KyselyFactory.createBuilder<DB, 'users'>('users', ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestKyselyTransaction<DB>(test, {\n * connection: db,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<DB, { factory: KyselyFactory<DB, typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new KyselyFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await trx\n * .selectFrom('users')\n * .where('id', '=', user.id)\n * .selectAll()\n * .executeTakeFirst();\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n\tDatabase,\n\tExtended extends Record<string, unknown>,\n\tT extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Transaction<Database>, Extended>) {\n\treturn baseExtendWithFixtures<Transaction<Database>, Extended, T>(\n\t\twrappedTest,\n\t\tfixtures,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,SAAgB,4BAGdA,KAAcC,SAAuD;CACtE,MAAM,UAAU,IAAI,gCAA0C;AAE9D,QAAO,QAAQ,0BAA0B,QAAQ;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDD,SAAgBC,qBAIdC,aAAgBC,UAA4D;AAC7E,QAAO,mBACN,aACA,SACA;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.cjs","names":["logger: Logger"],"sources":["../src/logger.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport { vi } from 'vitest';\n\n/**\n * Creates a mock Logger for testing\n */\nexport function createMockLogger(): Logger {\n const logger: Logger = {\n debug: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n fatal: vi.fn(),\n trace: vi.fn(),\n child: vi.fn(() => logger),\n };\n return logger;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,mBAA2B;CACzC,MAAMA,SAAiB;EACrB,OAAO,UAAG,IAAI;EACd,MAAM,UAAG,IAAI;EACb,MAAM,UAAG,IAAI;EACb,OAAO,UAAG,IAAI;EACd,OAAO,UAAG,IAAI;EACd,OAAO,UAAG,IAAI;EACd,OAAO,UAAG,GAAG,MAAM,OAAO;CAC3B;AACD,QAAO;AACR"}
1
+ {"version":3,"file":"logger.cjs","names":["logger: Logger"],"sources":["../src/logger.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport { vi } from 'vitest';\n\n/**\n * Creates a mock Logger for testing\n */\nexport function createMockLogger(): Logger {\n\tconst logger: Logger = {\n\t\tdebug: vi.fn(),\n\t\tinfo: vi.fn(),\n\t\twarn: vi.fn(),\n\t\terror: vi.fn(),\n\t\tfatal: vi.fn(),\n\t\ttrace: vi.fn(),\n\t\tchild: vi.fn(() => logger),\n\t};\n\treturn logger;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,mBAA2B;CAC1C,MAAMA,SAAiB;EACtB,OAAO,UAAG,IAAI;EACd,MAAM,UAAG,IAAI;EACb,MAAM,UAAG,IAAI;EACb,OAAO,UAAG,IAAI;EACd,OAAO,UAAG,IAAI;EACd,OAAO,UAAG,IAAI;EACd,OAAO,UAAG,GAAG,MAAM,OAAO;CAC1B;AACD,QAAO;AACP"}
package/dist/logger.d.cts CHANGED
@@ -6,6 +6,7 @@ import { Logger } from "@geekmidas/logger";
6
6
  * Creates a mock Logger for testing
7
7
  */
8
8
  declare function createMockLogger(): Logger;
9
+ //# sourceMappingURL=logger.d.ts.map
9
10
  //#endregion
10
11
  export { createMockLogger };
11
12
  //# sourceMappingURL=logger.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.cts","names":[],"sources":["../src/logger.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;iBAAgB,gBAAA,CAAA,GAAoB"}
package/dist/logger.d.mts CHANGED
@@ -6,6 +6,7 @@ import { Logger } from "@geekmidas/logger";
6
6
  * Creates a mock Logger for testing
7
7
  */
8
8
  declare function createMockLogger(): Logger;
9
+ //# sourceMappingURL=logger.d.ts.map
9
10
  //#endregion
10
11
  export { createMockLogger };
11
12
  //# sourceMappingURL=logger.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.mts","names":[],"sources":["../src/logger.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;iBAAgB,gBAAA,CAAA,GAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.mjs","names":["logger: Logger"],"sources":["../src/logger.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport { vi } from 'vitest';\n\n/**\n * Creates a mock Logger for testing\n */\nexport function createMockLogger(): Logger {\n const logger: Logger = {\n debug: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n fatal: vi.fn(),\n trace: vi.fn(),\n child: vi.fn(() => logger),\n };\n return logger;\n}\n"],"mappings":";;;;;;AAMA,SAAgB,mBAA2B;CACzC,MAAMA,SAAiB;EACrB,OAAO,GAAG,IAAI;EACd,MAAM,GAAG,IAAI;EACb,MAAM,GAAG,IAAI;EACb,OAAO,GAAG,IAAI;EACd,OAAO,GAAG,IAAI;EACd,OAAO,GAAG,IAAI;EACd,OAAO,GAAG,GAAG,MAAM,OAAO;CAC3B;AACD,QAAO;AACR"}
1
+ {"version":3,"file":"logger.mjs","names":["logger: Logger"],"sources":["../src/logger.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport { vi } from 'vitest';\n\n/**\n * Creates a mock Logger for testing\n */\nexport function createMockLogger(): Logger {\n\tconst logger: Logger = {\n\t\tdebug: vi.fn(),\n\t\tinfo: vi.fn(),\n\t\twarn: vi.fn(),\n\t\terror: vi.fn(),\n\t\tfatal: vi.fn(),\n\t\ttrace: vi.fn(),\n\t\tchild: vi.fn(() => logger),\n\t};\n\treturn logger;\n}\n"],"mappings":";;;;;;AAMA,SAAgB,mBAA2B;CAC1C,MAAMA,SAAiB;EACtB,OAAO,GAAG,IAAI;EACd,MAAM,GAAG,IAAI;EACb,MAAM,GAAG,IAAI;EACb,OAAO,GAAG,IAAI;EACd,OAAO,GAAG,IAAI;EACd,OAAO,GAAG,IAAI;EACd,OAAO,GAAG,GAAG,MAAM,OAAO;CAC1B;AACD,QAAO;AACP"}
@@ -1,10 +1,10 @@
1
1
  require('./Factory-BhjUOBWN.cjs');
2
2
  const require_faker = require('./faker-B14IEMIN.cjs');
3
3
  const require_ObjectionFactory = require('./ObjectionFactory-BeFBYcan.cjs');
4
- require('./PostgresMigrator-DFcNdCvD.cjs');
5
- const require_PostgresObjectionMigrator = require('./PostgresObjectionMigrator-BG6ymgnt.cjs');
4
+ require('./PostgresMigrator-D6dQn0x2.cjs');
5
+ const require_PostgresObjectionMigrator = require('./PostgresObjectionMigrator-DK8ODIHQ.cjs');
6
6
  const require_VitestTransactionIsolator = require('./VitestTransactionIsolator-CMfJXZP8.cjs');
7
- const require_VitestObjectionTransactionIsolator = require('./VitestObjectionTransactionIsolator-CM5KTAFA.cjs');
7
+ const require_VitestObjectionTransactionIsolator = require('./VitestObjectionTransactionIsolator-CdLRrzNf.cjs');
8
8
 
9
9
  //#region src/objection.ts
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"objection.cjs","names":["api: TestAPI","options: ObjectionTransactionOptions<Extended>","VitestObjectionTransactionIsolator","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Knex.Transaction, Extended>"],"sources":["../src/objection.ts"],"sourcesContent":["import type { Knex } from 'knex';\nimport type { TestAPI } from 'vitest';\nimport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nimport {\n type DatabaseConnection,\n type FixtureCreators,\n type IsolationLevel,\n extendWithFixtures as baseExtendWithFixtures,\n} from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific exports for test utilities.\n * Provides factory implementation for creating test data with Objection.js ORM\n * and transaction isolation for test suites.\n */\n\nexport { ObjectionFactory } from './ObjectionFactory';\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\nexport { PostgresObjectionMigrator } from './PostgresObjectionMigrator';\nexport type {\n DatabaseFixtures,\n ExtendedDatabaseFixtures,\n FixtureCreators,\n TestWithExtendedFixtures,\n TransactionWrapperOptions,\n} from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific options for transaction wrapping.\n */\nexport interface ObjectionTransactionOptions<\n Extended extends Record<string, unknown> = {},\n> {\n /** Function that creates or returns a Knex database connection */\n connection: DatabaseConnection<Knex>;\n /** Optional setup function to run within the transaction before each test */\n setup?: (trx: Knex.Transaction) => Promise<void>;\n /** Transaction isolation level (defaults to REPEATABLE_READ) */\n isolationLevel?: IsolationLevel;\n /** Additional fixtures that depend on the transaction */\n fixtures?: FixtureCreators<Knex.Transaction, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { faker, type FakerFactory } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Objection.js.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction } from '@geekmidas/testkit/objection';\n * import { knex } from './database';\n * import { User } from './models';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await User.query(trx)\n * .insert({ name: 'Test User', email: 'test@example.com' });\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestObjectionTransaction<{ factory: Factory }>(test, {\n * connection: knex,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestObjectionTransaction<\n Extended extends Record<string, unknown> = {},\n>(api: TestAPI, options: ObjectionTransactionOptions<Extended>) {\n const wrapper = new VitestObjectionTransactionIsolator(api);\n\n return wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends an Objection.js transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestObjectionTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction, extendWithFixtures, ObjectionFactory } from '@geekmidas/testkit/objection';\n * import { User } from './models';\n *\n * // Define your builders\n * const builders = {\n * user: ObjectionFactory.createBuilder(User, ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<{ factory: ObjectionFactory<typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new ObjectionFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await User.query(trx).findById(user.id);\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n Extended extends Record<string, unknown>,\n T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Knex.Transaction, Extended>) {\n return baseExtendWithFixtures<Knex.Transaction, Extended, T>(\n wrappedTest,\n fixtures,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,SAAgB,+BAEdA,KAAcC,SAAgD;CAC9D,MAAM,UAAU,IAAIC,8EAAmC;AAEvD,QAAO,QAAQ,0BAA0B,QAAQ;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDD,SAAgBC,qBAGdC,aAAgBC,UAAuD;AACvE,QAAO,qDACL,aACA,SACD;AACF"}
1
+ {"version":3,"file":"objection.cjs","names":["api: TestAPI","options: ObjectionTransactionOptions<Extended>","VitestObjectionTransactionIsolator","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Knex.Transaction, Extended>"],"sources":["../src/objection.ts"],"sourcesContent":["import type { Knex } from 'knex';\nimport type { TestAPI } from 'vitest';\nimport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nimport {\n\textendWithFixtures as baseExtendWithFixtures,\n\ttype DatabaseConnection,\n\ttype FixtureCreators,\n\ttype IsolationLevel,\n} from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific exports for test utilities.\n * Provides factory implementation for creating test data with Objection.js ORM\n * and transaction isolation for test suites.\n */\n\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { ObjectionFactory } from './ObjectionFactory';\nexport { PostgresObjectionMigrator } from './PostgresObjectionMigrator';\nexport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nexport type {\n\tDatabaseFixtures,\n\tExtendedDatabaseFixtures,\n\tFixtureCreators,\n\tTestWithExtendedFixtures,\n\tTransactionWrapperOptions,\n} from './VitestTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific options for transaction wrapping.\n */\nexport interface ObjectionTransactionOptions<\n\tExtended extends Record<string, unknown> = {},\n> {\n\t/** Function that creates or returns a Knex database connection */\n\tconnection: DatabaseConnection<Knex>;\n\t/** Optional setup function to run within the transaction before each test */\n\tsetup?: (trx: Knex.Transaction) => Promise<void>;\n\t/** Transaction isolation level (defaults to REPEATABLE_READ) */\n\tisolationLevel?: IsolationLevel;\n\t/** Additional fixtures that depend on the transaction */\n\tfixtures?: FixtureCreators<Knex.Transaction, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { type FakerFactory, faker } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Objection.js.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction } from '@geekmidas/testkit/objection';\n * import { knex } from './database';\n * import { User } from './models';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await User.query(trx)\n * .insert({ name: 'Test User', email: 'test@example.com' });\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestObjectionTransaction<{ factory: Factory }>(test, {\n * connection: knex,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestObjectionTransaction<\n\tExtended extends Record<string, unknown> = {},\n>(api: TestAPI, options: ObjectionTransactionOptions<Extended>) {\n\tconst wrapper = new VitestObjectionTransactionIsolator(api);\n\n\treturn wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends an Objection.js transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestObjectionTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction, extendWithFixtures, ObjectionFactory } from '@geekmidas/testkit/objection';\n * import { User } from './models';\n *\n * // Define your builders\n * const builders = {\n * user: ObjectionFactory.createBuilder(User, ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<{ factory: ObjectionFactory<typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new ObjectionFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await User.query(trx).findById(user.id);\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n\tExtended extends Record<string, unknown>,\n\tT extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Knex.Transaction, Extended>) {\n\treturn baseExtendWithFixtures<Knex.Transaction, Extended, T>(\n\t\twrappedTest,\n\t\tfixtures,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,SAAgB,+BAEdA,KAAcC,SAAgD;CAC/D,MAAM,UAAU,IAAIC,8EAAmC;AAEvD,QAAO,QAAQ,0BAA0B,QAAQ;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDD,SAAgBC,qBAGdC,aAAgBC,UAAuD;AACxE,QAAO,qDACN,aACA,SACA;AACD"}
@@ -1,10 +1,10 @@
1
- import { FakerFactory, faker } from "./faker-Cg76aFNO.cjs";
2
- import { ExtractSeedAttrs, FactorySeed } from "./Factory-BK06XuDA.cjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-tKWZOiYO.cjs";
4
- import "./PostgresMigrator-D5UkK1_K.cjs";
5
- import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-CZHHcCOv.cjs";
6
- import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-CwQaxZLP.cjs";
7
- import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-1TpsPqfG.cjs";
1
+ import { FakerFactory, faker } from "./faker-BSH1EMtg.cjs";
2
+ import { ExtractSeedAttrs, FactorySeed } from "./Factory-Bx0AJXZB.cjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-aMGvAKt9.cjs";
4
+ import "./PostgresMigrator-Bres0U6E.cjs";
5
+ import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-CPfBAP7r.cjs";
6
+ import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-CSroc7Df.cjs";
7
+ import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-BXoR6xdG.cjs";
8
8
  import { Knex } from "knex";
9
9
  import { TestAPI } from "vitest";
10
10
 
@@ -117,6 +117,7 @@ declare function wrapVitestObjectionTransaction<Extended extends Record<string,
117
117
  * ```
118
118
  */
119
119
  declare function extendWithFixtures<Extended extends Record<string, unknown>, T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>>(wrappedTest: T, fixtures: FixtureCreators<Knex.Transaction, Extended>): TestWithExtendedFixtures<Knex.Transaction<any, any[]>, Extended, T>;
120
+ //# sourceMappingURL=objection.d.ts.map
120
121
  //#endregion
121
122
  export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, ObjectionFactory, ObjectionTransactionOptions, PostgresObjectionMigrator, TestWithExtendedFixtures, TransactionWrapperOptions, VitestObjectionTransactionIsolator, extendWithFixtures, faker, wrapVitestObjectionTransaction };
122
123
  //# sourceMappingURL=objection.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objection.d.cts","names":[],"sources":["../src/objection.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;AAsCoC,UANnB,2BAMmB,CAAA,iBALlB,MAKkB,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA;EAAO;EAEX,UAEC,EANpB,kBAMoB,CAND,IAMC,CAAA;EAAW;EAAU,KAA1C,CAAA,EAAA,CAAA,GAAA,EAJG,IAAA,CAAK,WAIR,EAAA,GAJwB,OAIxB,CAAA,IAAA,CAAA;EAAe;EAkDX,cAAA,CAAA,EApDE,cAoDF;EAA8B;EAAA,QAC5B,CAAA,EAnDN,eAmDM,CAnDU,IAAA,CAAK,WAmDf,EAnD4B,QAmD5B,CAAA;;;;;;;AAC4C;AAsD9D;;;;;;;;;;;;;;;AAGuE;;;;;;;;;;;;;;;;;;;;;;;iBA3DvD,gDACE,mCACX,kBAAkB,4BAA4B,YAAS,QAAA,iBAAA,IAAA,CAAA,mCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsD9C,oCACE,mCACP,WAAW,qBAAqB,WAAW,iCACvC,aAAa,gBAAgB,IAAA,CAAK,aAAa,YAAS,yBAAA,IAAA,CAAA,yBAAA,UAAA"}
@@ -1,10 +1,10 @@
1
1
  import { FakerFactory, faker } from "./faker-DHh7xs4u.mjs";
2
- import { ExtractSeedAttrs, FactorySeed } from "./Factory-BcGJjLc8.mjs";
3
- import { ObjectionFactory } from "./ObjectionFactory-DL4qkuF1.mjs";
4
- import "./PostgresMigrator-DQaRxoaY.mjs";
5
- import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-D_hCcrQu.mjs";
6
- import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-BvR19bYn.mjs";
7
- import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-i9jIgU8Q.mjs";
2
+ import { ExtractSeedAttrs, FactorySeed } from "./Factory-SFupxRC2.mjs";
3
+ import { ObjectionFactory } from "./ObjectionFactory-BWjB49-i.mjs";
4
+ import "./PostgresMigrator-S-YYosAC.mjs";
5
+ import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-DVEqB5tp.mjs";
6
+ import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator-BNWJqh9f.mjs";
7
+ import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-x6hY5j4u.mjs";
8
8
  import { TestAPI } from "vitest";
9
9
  import { Knex } from "knex";
10
10
 
@@ -117,6 +117,7 @@ declare function wrapVitestObjectionTransaction<Extended extends Record<string,
117
117
  * ```
118
118
  */
119
119
  declare function extendWithFixtures<Extended extends Record<string, unknown>, T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>>(wrappedTest: T, fixtures: FixtureCreators<Knex.Transaction, Extended>): TestWithExtendedFixtures<Knex.Transaction<any, any[]>, Extended, T>;
120
+ //# sourceMappingURL=objection.d.ts.map
120
121
  //#endregion
121
122
  export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, ObjectionFactory, ObjectionTransactionOptions, PostgresObjectionMigrator, TestWithExtendedFixtures, TransactionWrapperOptions, VitestObjectionTransactionIsolator, extendWithFixtures, faker, wrapVitestObjectionTransaction };
122
123
  //# sourceMappingURL=objection.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objection.d.mts","names":[],"sources":["../src/objection.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;AAsCoC,UANnB,2BAMmB,CAAA,iBALlB,MAKkB,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA;EAAO;EAEX,UAEC,EANpB,kBAMoB,CAND,IAMC,CAAA;EAAW;EAAU,KAA1C,CAAA,EAAA,CAAA,GAAA,EAJG,IAAA,CAAK,WAIR,EAAA,GAJwB,OAIxB,CAAA,IAAA,CAAA;EAAe;EAkDX,cAAA,CAAA,EApDE,cAoDF;EAA8B;EAAA,QAC5B,CAAA,EAnDN,eAmDM,CAnDU,IAAA,CAAK,WAmDf,EAnD4B,QAmD5B,CAAA;;;;;;;AAC4C;AAsD9D;;;;;;;;;;;;;;;AAGuE;;;;;;;;;;;;;;;;;;;;;;;iBA3DvD,gDACE,mCACX,kBAAkB,4BAA4B,YAAS,QAAA,iBAAA,IAAA,CAAA,mCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsD9C,oCACE,mCACP,WAAW,qBAAqB,WAAW,iCACvC,aAAa,gBAAgB,IAAA,CAAK,aAAa,YAAS,yBAAA,IAAA,CAAA,yBAAA,UAAA"}
@@ -1,10 +1,10 @@
1
1
  import "./Factory-BFVnMMCC.mjs";
2
2
  import { faker } from "./faker-BGKYFoCT.mjs";
3
3
  import { ObjectionFactory } from "./ObjectionFactory-QCJ7u0Ql.mjs";
4
- import "./PostgresMigrator-DbuJGAVy.mjs";
5
- import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-DPj2pOpX.mjs";
4
+ import "./PostgresMigrator-BjjenqSd.mjs";
5
+ import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator-D_QxXbIN.mjs";
6
6
  import { IsolationLevel, extendWithFixtures } from "./VitestTransactionIsolator-DQ7tLqgV.mjs";
7
- import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-jQFaCz0u.mjs";
7
+ import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-OF2osYY5.mjs";
8
8
 
9
9
  //#region src/objection.ts
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"objection.mjs","names":["api: TestAPI","options: ObjectionTransactionOptions<Extended>","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Knex.Transaction, Extended>"],"sources":["../src/objection.ts"],"sourcesContent":["import type { Knex } from 'knex';\nimport type { TestAPI } from 'vitest';\nimport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nimport {\n type DatabaseConnection,\n type FixtureCreators,\n type IsolationLevel,\n extendWithFixtures as baseExtendWithFixtures,\n} from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific exports for test utilities.\n * Provides factory implementation for creating test data with Objection.js ORM\n * and transaction isolation for test suites.\n */\n\nexport { ObjectionFactory } from './ObjectionFactory';\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\nexport { PostgresObjectionMigrator } from './PostgresObjectionMigrator';\nexport type {\n DatabaseFixtures,\n ExtendedDatabaseFixtures,\n FixtureCreators,\n TestWithExtendedFixtures,\n TransactionWrapperOptions,\n} from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific options for transaction wrapping.\n */\nexport interface ObjectionTransactionOptions<\n Extended extends Record<string, unknown> = {},\n> {\n /** Function that creates or returns a Knex database connection */\n connection: DatabaseConnection<Knex>;\n /** Optional setup function to run within the transaction before each test */\n setup?: (trx: Knex.Transaction) => Promise<void>;\n /** Transaction isolation level (defaults to REPEATABLE_READ) */\n isolationLevel?: IsolationLevel;\n /** Additional fixtures that depend on the transaction */\n fixtures?: FixtureCreators<Knex.Transaction, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { faker, type FakerFactory } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Objection.js.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction } from '@geekmidas/testkit/objection';\n * import { knex } from './database';\n * import { User } from './models';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await User.query(trx)\n * .insert({ name: 'Test User', email: 'test@example.com' });\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestObjectionTransaction<{ factory: Factory }>(test, {\n * connection: knex,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestObjectionTransaction<\n Extended extends Record<string, unknown> = {},\n>(api: TestAPI, options: ObjectionTransactionOptions<Extended>) {\n const wrapper = new VitestObjectionTransactionIsolator(api);\n\n return wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends an Objection.js transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestObjectionTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction, extendWithFixtures, ObjectionFactory } from '@geekmidas/testkit/objection';\n * import { User } from './models';\n *\n * // Define your builders\n * const builders = {\n * user: ObjectionFactory.createBuilder(User, ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<{ factory: ObjectionFactory<typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new ObjectionFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await User.query(trx).findById(user.id);\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n Extended extends Record<string, unknown>,\n T extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Knex.Transaction, Extended>) {\n return baseExtendWithFixtures<Knex.Transaction, Extended, T>(\n wrappedTest,\n fixtures,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,SAAgB,+BAEdA,KAAcC,SAAgD;CAC9D,MAAM,UAAU,IAAI,mCAAmC;AAEvD,QAAO,QAAQ,0BAA0B,QAAQ;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDD,SAAgBC,qBAGdC,aAAgBC,UAAuD;AACvE,QAAO,mBACL,aACA,SACD;AACF"}
1
+ {"version":3,"file":"objection.mjs","names":["api: TestAPI","options: ObjectionTransactionOptions<Extended>","extendWithFixtures","wrappedTest: T","fixtures: FixtureCreators<Knex.Transaction, Extended>"],"sources":["../src/objection.ts"],"sourcesContent":["import type { Knex } from 'knex';\nimport type { TestAPI } from 'vitest';\nimport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nimport {\n\textendWithFixtures as baseExtendWithFixtures,\n\ttype DatabaseConnection,\n\ttype FixtureCreators,\n\ttype IsolationLevel,\n} from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific exports for test utilities.\n * Provides factory implementation for creating test data with Objection.js ORM\n * and transaction isolation for test suites.\n */\n\nexport type { ExtractSeedAttrs, FactorySeed } from './Factory';\nexport { ObjectionFactory } from './ObjectionFactory';\nexport { PostgresObjectionMigrator } from './PostgresObjectionMigrator';\nexport { VitestObjectionTransactionIsolator } from './VitestObjectionTransactionIsolator';\nexport type {\n\tDatabaseFixtures,\n\tExtendedDatabaseFixtures,\n\tFixtureCreators,\n\tTestWithExtendedFixtures,\n\tTransactionWrapperOptions,\n} from './VitestTransactionIsolator';\nexport { IsolationLevel } from './VitestTransactionIsolator';\n\n/**\n * Objection.js-specific options for transaction wrapping.\n */\nexport interface ObjectionTransactionOptions<\n\tExtended extends Record<string, unknown> = {},\n> {\n\t/** Function that creates or returns a Knex database connection */\n\tconnection: DatabaseConnection<Knex>;\n\t/** Optional setup function to run within the transaction before each test */\n\tsetup?: (trx: Knex.Transaction) => Promise<void>;\n\t/** Transaction isolation level (defaults to REPEATABLE_READ) */\n\tisolationLevel?: IsolationLevel;\n\t/** Additional fixtures that depend on the transaction */\n\tfixtures?: FixtureCreators<Knex.Transaction, Extended>;\n}\n\n// Re-export faker and FakerFactory for type portability in declaration files\nexport { type FakerFactory, faker } from './faker';\n\n/**\n * Creates a wrapped Vitest test API with automatic transaction rollback for Objection.js.\n * Each test runs in an isolated database transaction that is rolled back after completion.\n * This ensures tests don't affect each other's data and run faster than truncating tables.\n *\n * @template Extended - Additional fixtures to provide\n * @param api - The Vitest test API (usually `test` from vitest)\n * @param options - Configuration options for transaction wrapping\n * @returns A wrapped test API that provides transaction isolation\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction } from '@geekmidas/testkit/objection';\n * import { knex } from './database';\n * import { User } from './models';\n *\n * // Create isolated test with automatic rollback\n * const isolatedTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * });\n *\n * // Use in tests - each test gets its own transaction\n * isolatedTest('should create user', async ({ trx }) => {\n * const user = await User.query(trx)\n * .insert({ name: 'Test User', email: 'test@example.com' });\n *\n * expect(user).toBeDefined();\n * });\n *\n * // With fixtures for factories\n * const it = wrapVitestObjectionTransaction<{ factory: Factory }>(test, {\n * connection: knex,\n * fixtures: {\n * factory: (trx) => new Factory(trx),\n * },\n * });\n *\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user.id).toBeDefined();\n * });\n * ```\n */\nexport function wrapVitestObjectionTransaction<\n\tExtended extends Record<string, unknown> = {},\n>(api: TestAPI, options: ObjectionTransactionOptions<Extended>) {\n\tconst wrapper = new VitestObjectionTransactionIsolator(api);\n\n\treturn wrapper.wrapVitestWithTransaction(options);\n}\n\n/**\n * Extends an Objection.js transaction-wrapped test with additional fixtures.\n * Each fixture receives the transaction and can create dependencies like factories or repositories.\n *\n * @template Extended - The type of additional fixtures to provide\n * @param wrappedTest - The base wrapped test from wrapVitestObjectionTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { test } from 'vitest';\n * import { wrapVitestObjectionTransaction, extendWithFixtures, ObjectionFactory } from '@geekmidas/testkit/objection';\n * import { User } from './models';\n *\n * // Define your builders\n * const builders = {\n * user: ObjectionFactory.createBuilder(User, ({ faker }) => ({\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * })),\n * };\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestObjectionTransaction(test, {\n * connection: knex,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures - each fixture receives the transaction\n * const it = extendWithFixtures<{ factory: ObjectionFactory<typeof builders, {}> }>(\n * baseTest,\n * {\n * factory: (trx) => new ObjectionFactory(builders, {}, trx),\n * }\n * );\n *\n * // Use in tests - both trx and factory are available\n * it('should create user with factory', async ({ trx, factory }) => {\n * const user = await factory.insert('user', { name: 'Test User' });\n * expect(user.id).toBeDefined();\n *\n * // Verify in database\n * const found = await User.query(trx).findById(user.id);\n * expect(found?.name).toBe('Test User');\n * });\n * ```\n */\nexport function extendWithFixtures<\n\tExtended extends Record<string, unknown>,\n\tT extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>,\n>(wrappedTest: T, fixtures: FixtureCreators<Knex.Transaction, Extended>) {\n\treturn baseExtendWithFixtures<Knex.Transaction, Extended, T>(\n\t\twrappedTest,\n\t\tfixtures,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,SAAgB,+BAEdA,KAAcC,SAAgD;CAC/D,MAAM,UAAU,IAAI,mCAAmC;AAEvD,QAAO,QAAQ,0BAA0B,QAAQ;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDD,SAAgBC,qBAGdC,aAAgBC,UAAuD;AACxE,QAAO,mBACN,aACA,SACA;AACD"}
@@ -1,2 +1,2 @@
1
- import { DirectoryFixtures, itWithDir } from "../directory-DlkPEzL4.cjs";
1
+ import { DirectoryFixtures, itWithDir } from "../directory-Cys9g76X.cjs";
2
2
  export { DirectoryFixtures, itWithDir };
@@ -1,2 +1,2 @@
1
- import { DirectoryFixtures, itWithDir } from "../directory-BPf1LgNX.mjs";
1
+ import { DirectoryFixtures, itWithDir } from "../directory-CVrfTq1I.mjs";
2
2
  export { DirectoryFixtures, itWithDir };
@@ -1,2 +1,2 @@
1
- import { itWithDir } from "../directory-DlkPEzL4.cjs";
1
+ import { itWithDir } from "../directory-Cys9g76X.cjs";
2
2
  export { itWithDir };
@@ -1,2 +1,2 @@
1
- import { itWithDir } from "../directory-BPf1LgNX.mjs";
1
+ import { itWithDir } from "../directory-CVrfTq1I.mjs";
2
2
  export { itWithDir };
@@ -1 +1 @@
1
- {"version":3,"file":"timer.cjs","names":["ms: number"],"sources":["../src/timer.ts"],"sourcesContent":["export function waitFor(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";;AAAA,SAAgB,QAAQA,IAAY;AAClC,QAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG;AACxD"}
1
+ {"version":3,"file":"timer.cjs","names":["ms: number"],"sources":["../src/timer.ts"],"sourcesContent":["export function waitFor(ms: number) {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";;AAAA,SAAgB,QAAQA,IAAY;AACnC,QAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG;AACvD"}
package/dist/timer.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  //#region src/timer.d.ts
2
2
  declare function waitFor(ms: number): Promise<unknown>;
3
+ //# sourceMappingURL=timer.d.ts.map
4
+
3
5
  //#endregion
4
6
  export { waitFor };
5
7
  //# sourceMappingURL=timer.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.d.cts","names":[],"sources":["../src/timer.ts"],"sourcesContent":[],"mappings":";iBAAgB,OAAA,cAAkB;AAAlC"}
package/dist/timer.d.mts CHANGED
@@ -1,5 +1,7 @@
1
1
  //#region src/timer.d.ts
2
2
  declare function waitFor(ms: number): Promise<unknown>;
3
+ //# sourceMappingURL=timer.d.ts.map
4
+
3
5
  //#endregion
4
6
  export { waitFor };
5
7
  //# sourceMappingURL=timer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.d.mts","names":[],"sources":["../src/timer.ts"],"sourcesContent":[],"mappings":";iBAAgB,OAAA,cAAkB;AAAlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"timer.mjs","names":["ms: number"],"sources":["../src/timer.ts"],"sourcesContent":["export function waitFor(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";AAAA,SAAgB,QAAQA,IAAY;AAClC,QAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG;AACxD"}
1
+ {"version":3,"file":"timer.mjs","names":["ms: number"],"sources":["../src/timer.ts"],"sourcesContent":["export function waitFor(ms: number) {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";AAAA,SAAgB,QAAQA,IAAY;AACnC,QAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG;AACvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/testkit",
3
- "version": "0.3.1",
3
+ "version": "0.6.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -51,11 +51,12 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@faker-js/faker": "~9.9.0",
55
- "@geekmidas/logger": "0.1.0"
54
+ "@faker-js/faker": "~9.9.0"
56
55
  },
57
56
  "devDependencies": {
58
- "@types/pg": "~8.15.4"
57
+ "@types/pg": "~8.15.4",
58
+ "@geekmidas/envkit": "^0.3.0",
59
+ "@geekmidas/logger": "^0.4.0"
59
60
  },
60
61
  "repository": {
61
62
  "type": "git",
@@ -74,6 +75,39 @@
74
75
  "vitest": "~3.2.4",
75
76
  "@types/aws-lambda": ">=8.10.92",
76
77
  "better-auth": ">=1.3.34",
77
- "@geekmidas/envkit": "0.1.0"
78
+ "@geekmidas/envkit": "^0.3.0",
79
+ "@geekmidas/logger": "^0.4.0"
80
+ },
81
+ "peerDependenciesMeta": {
82
+ "@geekmidas/envkit": {
83
+ "optional": true
84
+ },
85
+ "@geekmidas/logger": {
86
+ "optional": true
87
+ },
88
+ "kysely": {
89
+ "optional": true
90
+ },
91
+ "pg": {
92
+ "optional": true
93
+ },
94
+ "knex": {
95
+ "optional": true
96
+ },
97
+ "objection": {
98
+ "optional": true
99
+ },
100
+ "db-errors": {
101
+ "optional": true
102
+ },
103
+ "vitest": {
104
+ "optional": true
105
+ },
106
+ "@types/aws-lambda": {
107
+ "optional": true
108
+ },
109
+ "better-auth": {
110
+ "optional": true
111
+ }
78
112
  }
79
113
  }