@geekmidas/testkit 10.0.0-alpha.12 → 10.0.0-alpha.13
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.
- package/dist/Factory.cjs +51 -2
- package/dist/Factory.cjs.map +1 -0
- package/dist/Factory.d.cts +143 -3
- package/dist/Factory.d.cts.map +1 -0
- package/dist/Factory.d.mts +143 -3
- package/dist/Factory.d.mts.map +1 -0
- package/dist/Factory.mjs +50 -2
- package/dist/Factory.mjs.map +1 -0
- package/dist/KyselyFactory.cjs +237 -4
- package/dist/KyselyFactory.cjs.map +1 -0
- package/dist/KyselyFactory.d.cts +224 -4
- package/dist/KyselyFactory.d.cts.map +1 -0
- package/dist/KyselyFactory.d.mts +224 -4
- package/dist/KyselyFactory.d.mts.map +1 -0
- package/dist/KyselyFactory.mjs +236 -4
- package/dist/KyselyFactory.mjs.map +1 -0
- package/dist/ObjectionFactory.cjs +265 -4
- package/dist/ObjectionFactory.cjs.map +1 -0
- package/dist/ObjectionFactory.d.cts +237 -4
- package/dist/ObjectionFactory.d.cts.map +1 -0
- package/dist/ObjectionFactory.d.mts +237 -4
- package/dist/ObjectionFactory.d.mts.map +1 -0
- package/dist/ObjectionFactory.mjs +264 -4
- package/dist/ObjectionFactory.mjs.map +1 -0
- package/dist/PostgresKyselyMigrator.cjs +94 -3
- package/dist/PostgresKyselyMigrator.cjs.map +1 -0
- package/dist/PostgresKyselyMigrator.d.cts +80 -3
- package/dist/PostgresKyselyMigrator.d.cts.map +1 -0
- package/dist/PostgresKyselyMigrator.d.mts +80 -3
- package/dist/PostgresKyselyMigrator.d.mts.map +1 -0
- package/dist/PostgresKyselyMigrator.mjs +93 -3
- package/dist/PostgresKyselyMigrator.mjs.map +1 -0
- package/dist/{PostgresMigrator-C_QQ6q35.d.mts → PostgresMigrator-CoHQ95cT.d.cts} +2 -3
- package/dist/PostgresMigrator-CoHQ95cT.d.cts.map +1 -0
- package/dist/{PostgresMigrator-CeYy-eHF.d.cts → PostgresMigrator-CoHQ95cT.d.mts} +2 -3
- package/dist/PostgresMigrator-CoHQ95cT.d.mts.map +1 -0
- package/dist/PostgresMigrator.cjs +169 -2
- package/dist/PostgresMigrator.cjs.map +1 -0
- package/dist/PostgresMigrator.d.cts +1 -1
- package/dist/PostgresMigrator.d.mts +1 -1
- package/dist/PostgresMigrator.mjs +166 -2
- package/dist/PostgresMigrator.mjs.map +1 -0
- package/dist/PostgresObjectionMigrator.cjs +118 -3
- package/dist/PostgresObjectionMigrator.cjs.map +1 -0
- package/dist/PostgresObjectionMigrator.d.cts +75 -3
- package/dist/PostgresObjectionMigrator.d.cts.map +1 -0
- package/dist/PostgresObjectionMigrator.d.mts +75 -3
- package/dist/PostgresObjectionMigrator.d.mts.map +1 -0
- package/dist/PostgresObjectionMigrator.mjs +117 -3
- package/dist/PostgresObjectionMigrator.mjs.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.cjs +66 -3
- package/dist/VitestKyselyTransactionIsolator.cjs.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.d.cts +60 -3
- package/dist/VitestKyselyTransactionIsolator.d.cts.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.d.mts +60 -3
- package/dist/VitestKyselyTransactionIsolator.d.mts.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.mjs +65 -3
- package/dist/VitestKyselyTransactionIsolator.mjs.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.cjs +62 -3
- package/dist/VitestObjectionTransactionIsolator.cjs.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.d.cts +56 -3
- package/dist/VitestObjectionTransactionIsolator.d.cts.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.d.mts +56 -3
- package/dist/VitestObjectionTransactionIsolator.d.mts.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.mjs +61 -3
- package/dist/VitestObjectionTransactionIsolator.mjs.map +1 -0
- package/dist/VitestTransactionIsolator.cjs +187 -4
- package/dist/VitestTransactionIsolator.cjs.map +1 -0
- package/dist/VitestTransactionIsolator.d.cts +219 -2
- package/dist/VitestTransactionIsolator.d.cts.map +1 -0
- package/dist/VitestTransactionIsolator.d.mts +219 -2
- package/dist/VitestTransactionIsolator.d.mts.map +1 -0
- package/dist/VitestTransactionIsolator.mjs +184 -2
- package/dist/VitestTransactionIsolator.mjs.map +1 -0
- package/dist/aws.cjs +3 -4
- package/dist/aws.cjs.map +1 -1
- package/dist/aws.d.cts +3 -8
- package/dist/aws.d.cts.map +1 -1
- package/dist/aws.d.mts +3 -8
- package/dist/aws.d.mts.map +1 -1
- package/dist/aws.mjs +1 -2
- package/dist/aws.mjs.map +1 -1
- package/dist/benchmark.cjs +2 -2
- package/dist/benchmark.cjs.map +1 -1
- package/dist/benchmark.d.cts +4 -6
- package/dist/benchmark.d.cts.map +1 -1
- package/dist/benchmark.d.mts +4 -6
- package/dist/benchmark.d.mts.map +1 -1
- package/dist/benchmark.mjs +1 -1
- package/dist/benchmark.mjs.map +1 -1
- package/dist/better-auth.cjs +4 -4
- package/dist/better-auth.cjs.map +1 -1
- package/dist/better-auth.d.cts +13142 -5
- package/dist/better-auth.d.cts.map +1 -1
- package/dist/better-auth.d.mts +13142 -5
- package/dist/better-auth.d.mts.map +1 -1
- package/dist/better-auth.mjs +2 -2
- package/dist/better-auth.mjs.map +1 -1
- package/dist/faker.cjs +262 -8
- package/dist/faker.cjs.map +1 -0
- package/dist/faker.d.cts +162 -2
- package/dist/faker.d.cts.map +1 -0
- package/dist/faker.d.mts +162 -2
- package/dist/faker.d.mts.map +1 -0
- package/dist/faker.mjs +255 -2
- package/dist/faker.mjs.map +1 -0
- package/dist/helpers.cjs +6 -5
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +1 -5
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +1 -5
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +1 -2
- package/dist/helpers.mjs.map +1 -1
- package/dist/initScript.cjs +15 -15
- package/dist/initScript.cjs.map +1 -1
- package/dist/initScript.d.cts +2 -4
- package/dist/initScript.d.cts.map +1 -1
- package/dist/initScript.d.mts +2 -4
- package/dist/initScript.d.mts.map +1 -1
- package/dist/initScript.mjs +10 -12
- package/dist/initScript.mjs.map +1 -1
- package/dist/kysely.cjs +10 -13
- package/dist/kysely.cjs.map +1 -1
- package/dist/kysely.d.cts +10 -14
- package/dist/kysely.d.cts.map +1 -1
- package/dist/kysely.d.mts +10 -14
- package/dist/kysely.d.mts.map +1 -1
- package/dist/kysely.mjs +10 -14
- package/dist/kysely.mjs.map +1 -1
- package/dist/logger.cjs +3 -4
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +1 -5
- package/dist/logger.d.cts.map +1 -1
- package/dist/logger.d.mts +1 -5
- package/dist/logger.d.mts.map +1 -1
- package/dist/logger.mjs +1 -2
- package/dist/logger.mjs.map +1 -1
- package/dist/objection.cjs +10 -13
- package/dist/objection.cjs.map +1 -1
- package/dist/objection.d.cts +10 -14
- package/dist/objection.d.cts.map +1 -1
- package/dist/objection.d.mts +10 -14
- package/dist/objection.d.mts.map +1 -1
- package/dist/objection.mjs +10 -14
- package/dist/objection.mjs.map +1 -1
- package/dist/os/directory.cjs +31 -2
- package/dist/os/directory.cjs.map +1 -0
- package/dist/os/directory.d.cts +9 -2
- package/dist/os/directory.d.cts.map +1 -0
- package/dist/os/directory.d.mts +9 -2
- package/dist/os/directory.d.mts.map +1 -0
- package/dist/os/directory.mjs +25 -2
- package/dist/os/directory.mjs.map +1 -0
- package/dist/os/index.cjs +3 -3
- package/dist/os/index.d.cts +1 -1
- package/dist/os/index.d.mts +1 -1
- package/dist/os/index.mjs +2 -3
- package/dist/requestContext.cjs +10 -11
- package/dist/requestContext.cjs.map +1 -1
- package/dist/requestContext.d.cts +4 -8
- package/dist/requestContext.d.cts.map +1 -1
- package/dist/requestContext.d.mts +4 -8
- package/dist/requestContext.d.mts.map +1 -1
- package/dist/requestContext.mjs +1 -2
- package/dist/requestContext.mjs.map +1 -1
- package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-VH7oDXx4.cjs} +8 -10
- package/dist/timer.cjs +2 -2
- package/dist/timer.cjs.map +1 -1
- package/dist/timer.d.cts +1 -4
- package/dist/timer.d.cts.map +1 -1
- package/dist/timer.d.mts +1 -4
- package/dist/timer.d.mts.map +1 -1
- package/dist/timer.mjs +1 -1
- package/dist/timer.mjs.map +1 -1
- package/package.json +8 -8
- package/dist/Factory-BFVnMMCC.mjs +0 -51
- package/dist/Factory-BFVnMMCC.mjs.map +0 -1
- package/dist/Factory-BhjUOBWN.cjs +0 -57
- package/dist/Factory-BhjUOBWN.cjs.map +0 -1
- package/dist/Factory-Bx0AJXZB.d.cts +0 -147
- package/dist/Factory-Bx0AJXZB.d.cts.map +0 -1
- package/dist/Factory-ClyZLRsO.d.mts +0 -147
- package/dist/Factory-ClyZLRsO.d.mts.map +0 -1
- package/dist/KyselyFactory-BFqVIn_0.cjs +0 -246
- package/dist/KyselyFactory-BFqVIn_0.cjs.map +0 -1
- package/dist/KyselyFactory-CTZmiGI9.d.mts +0 -228
- package/dist/KyselyFactory-CTZmiGI9.d.mts.map +0 -1
- package/dist/KyselyFactory-DMswpwji.mjs +0 -241
- package/dist/KyselyFactory-DMswpwji.mjs.map +0 -1
- package/dist/KyselyFactory-KLeKH43i.d.cts +0 -228
- package/dist/KyselyFactory-KLeKH43i.d.cts.map +0 -1
- package/dist/ObjectionFactory-BeFBYcan.cjs +0 -272
- package/dist/ObjectionFactory-BeFBYcan.cjs.map +0 -1
- package/dist/ObjectionFactory-DDrKwAoO.d.mts +0 -241
- package/dist/ObjectionFactory-DDrKwAoO.d.mts.map +0 -1
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs +0 -267
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs.map +0 -1
- package/dist/ObjectionFactory-aMGvAKt9.d.cts +0 -241
- package/dist/ObjectionFactory-aMGvAKt9.d.cts.map +0 -1
- package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts +0 -84
- package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts.map +0 -1
- package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs +0 -101
- package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs.map +0 -1
- package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts +0 -84
- package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts.map +0 -1
- package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs +0 -95
- package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs.map +0 -1
- package/dist/PostgresMigrator-C_QQ6q35.d.mts.map +0 -1
- package/dist/PostgresMigrator-CeYy-eHF.d.cts.map +0 -1
- package/dist/PostgresMigrator-DVAY04qN.mjs +0 -166
- package/dist/PostgresMigrator-DVAY04qN.mjs.map +0 -1
- package/dist/PostgresMigrator-M9jpzOvN.cjs +0 -172
- package/dist/PostgresMigrator-M9jpzOvN.cjs.map +0 -1
- package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts +0 -79
- package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts.map +0 -1
- package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts +0 -79
- package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts.map +0 -1
- package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs +0 -123
- package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs.map +0 -1
- package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs +0 -118
- package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs +0 -67
- package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs +0 -72
- package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts +0 -64
- package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts +0 -64
- package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs +0 -63
- package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts +0 -60
- package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts +0 -60
- package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs +0 -68
- package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs.map +0 -1
- package/dist/VitestTransactionIsolator-BLaw80cx.d.mts +0 -223
- package/dist/VitestTransactionIsolator-BLaw80cx.d.mts.map +0 -1
- package/dist/VitestTransactionIsolator-CvwPecpl.mjs +0 -188
- package/dist/VitestTransactionIsolator-CvwPecpl.mjs.map +0 -1
- package/dist/VitestTransactionIsolator-DyiX-QtK.cjs +0 -206
- package/dist/VitestTransactionIsolator-DyiX-QtK.cjs.map +0 -1
- package/dist/VitestTransactionIsolator-glcxyS_R.d.cts +0 -223
- package/dist/VitestTransactionIsolator-glcxyS_R.d.cts.map +0 -1
- package/dist/directory-BIcVWgJk.d.cts +0 -13
- package/dist/directory-BIcVWgJk.d.cts.map +0 -1
- package/dist/directory-BxjqmtCT.mjs +0 -27
- package/dist/directory-BxjqmtCT.mjs.map +0 -1
- package/dist/directory-CYXmolu1.d.mts +0 -13
- package/dist/directory-CYXmolu1.d.mts.map +0 -1
- package/dist/directory-DD_xQoSh.cjs +0 -33
- package/dist/directory-DD_xQoSh.cjs.map +0 -1
- package/dist/faker-B14IEMIN.cjs +0 -304
- package/dist/faker-B14IEMIN.cjs.map +0 -1
- package/dist/faker-BGKYFoCT.mjs +0 -262
- package/dist/faker-BGKYFoCT.mjs.map +0 -1
- package/dist/faker-BSH1EMtg.d.cts +0 -166
- package/dist/faker-BSH1EMtg.d.cts.map +0 -1
- package/dist/faker-BcjUfHxx.d.mts +0 -166
- package/dist/faker-BcjUfHxx.d.mts.map +0 -1
package/dist/kysely.cjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
const require_faker = require(
|
|
3
|
-
const require_KyselyFactory = require(
|
|
4
|
-
require(
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const require_VitestKyselyTransactionIsolator = require('./VitestKyselyTransactionIsolator-BjJSXryR.cjs');
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_faker = require("./faker.cjs");
|
|
3
|
+
const require_KyselyFactory = require("./KyselyFactory.cjs");
|
|
4
|
+
const require_PostgresKyselyMigrator = require("./PostgresKyselyMigrator.cjs");
|
|
5
|
+
const require_VitestTransactionIsolator = require("./VitestTransactionIsolator.cjs");
|
|
6
|
+
const require_VitestKyselyTransactionIsolator = require("./VitestKyselyTransactionIsolator.cjs");
|
|
9
7
|
//#region src/kysely.ts
|
|
10
8
|
/**
|
|
11
9
|
* Creates a wrapped Vitest test API with automatic transaction rollback for Kysely.
|
|
@@ -55,8 +53,7 @@ const require_VitestKyselyTransactionIsolator = require('./VitestKyselyTransacti
|
|
|
55
53
|
* ```
|
|
56
54
|
*/
|
|
57
55
|
function wrapVitestKyselyTransaction(api, options) {
|
|
58
|
-
|
|
59
|
-
return wrapper.wrapVitestWithTransaction(options);
|
|
56
|
+
return new require_VitestKyselyTransactionIsolator.VitestKyselyTransactionIsolator(api).wrapVitestWithTransaction(options);
|
|
60
57
|
}
|
|
61
58
|
/**
|
|
62
59
|
* Extends a Kysely transaction-wrapped test with additional fixtures.
|
|
@@ -110,16 +107,16 @@ function wrapVitestKyselyTransaction(api, options) {
|
|
|
110
107
|
* });
|
|
111
108
|
* ```
|
|
112
109
|
*/
|
|
113
|
-
function extendWithFixtures
|
|
110
|
+
function extendWithFixtures(wrappedTest, fixtures) {
|
|
114
111
|
return require_VitestTransactionIsolator.extendWithFixtures(wrappedTest, fixtures);
|
|
115
112
|
}
|
|
116
|
-
|
|
117
113
|
//#endregion
|
|
118
114
|
exports.IsolationLevel = require_VitestTransactionIsolator.IsolationLevel;
|
|
119
115
|
exports.KyselyFactory = require_KyselyFactory.KyselyFactory;
|
|
120
116
|
exports.PostgresKyselyMigrator = require_PostgresKyselyMigrator.PostgresKyselyMigrator;
|
|
121
117
|
exports.VitestKyselyTransactionIsolator = require_VitestKyselyTransactionIsolator.VitestKyselyTransactionIsolator;
|
|
122
|
-
exports.extendWithFixtures = extendWithFixtures
|
|
118
|
+
exports.extendWithFixtures = extendWithFixtures;
|
|
123
119
|
exports.faker = require_faker.faker;
|
|
124
120
|
exports.wrapVitestKyselyTransaction = wrapVitestKyselyTransaction;
|
|
121
|
+
|
|
125
122
|
//# sourceMappingURL=kysely.cjs.map
|
package/dist/kysely.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kysely.cjs","names":["
|
|
1
|
+
{"version":3,"file":"kysely.cjs","names":["VitestKyselyTransactionIsolator","baseExtendWithFixtures"],"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,4BAGd,KAAc,SAAuD;CAGtE,OAAO,IAFaA,wCAAAA,gCAA0C,GAEjD,CAAC,CAAC,0BAA0B,OAAO;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,mBAId,aAAgB,UAA4D;CAC7E,OAAOC,kCAAAA,mBACN,aACA,QACD;AACD"}
|
package/dist/kysely.d.cts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { FakerFactory, faker } from "./faker
|
|
2
|
-
import { ExtractSeedAttrs, FactorySeed } from "./Factory
|
|
3
|
-
import { KyselyFactory } from "./KyselyFactory
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-DJasVuIZ.cjs";
|
|
1
|
+
import { FakerFactory, faker } from "./faker.cjs";
|
|
2
|
+
import { ExtractSeedAttrs, FactorySeed } from "./Factory.cjs";
|
|
3
|
+
import { KyselyFactory } from "./KyselyFactory.cjs";
|
|
4
|
+
import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator.cjs";
|
|
5
|
+
import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator.cjs";
|
|
6
|
+
import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator.cjs";
|
|
8
7
|
import { Kysely, Transaction } from "kysely";
|
|
9
8
|
import { TestAPI } from "vitest";
|
|
10
|
-
|
|
11
9
|
//#region src/kysely.d.ts
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* Kysely-specific options for transaction wrapping.
|
|
15
12
|
*/
|
|
16
|
-
interface KyselyTransactionOptions<Database, Extended extends Record<string, unknown> = {}> {
|
|
13
|
+
export interface KyselyTransactionOptions<Database, Extended extends Record<string, unknown> = {}> {
|
|
17
14
|
/** Function that creates or returns a Kysely database instance */
|
|
18
15
|
connection: DatabaseConnection<Kysely<Database>>;
|
|
19
16
|
/** Optional setup function to run within the transaction before each test */
|
|
@@ -70,7 +67,7 @@ interface KyselyTransactionOptions<Database, Extended extends Record<string, unk
|
|
|
70
67
|
* });
|
|
71
68
|
* ```
|
|
72
69
|
*/
|
|
73
|
-
declare function wrapVitestKyselyTransaction<Database, Extended extends Record<string, unknown> = {}>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>): TestAPI<DatabaseFixtures<Transaction<Database>, object> & Extended>;
|
|
70
|
+
export declare function wrapVitestKyselyTransaction<Database, Extended extends Record<string, unknown> = {}>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>): TestAPI<DatabaseFixtures<Transaction<Database>, object> & Extended>;
|
|
74
71
|
/**
|
|
75
72
|
* Extends a Kysely transaction-wrapped test with additional fixtures.
|
|
76
73
|
* Each fixture receives the transaction and can create dependencies like factories or repositories.
|
|
@@ -123,8 +120,7 @@ declare function wrapVitestKyselyTransaction<Database, Extended extends Record<s
|
|
|
123
120
|
* });
|
|
124
121
|
* ```
|
|
125
122
|
*/
|
|
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
|
|
123
|
+
export 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>;
|
|
128
124
|
//#endregion
|
|
129
|
-
export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, KyselyFactory,
|
|
125
|
+
export { type DatabaseFixtures, type ExtendedDatabaseFixtures, type ExtractSeedAttrs, type FactorySeed, type FakerFactory, type FixtureCreators, IsolationLevel, KyselyFactory, PostgresKyselyMigrator, type TestWithExtendedFixtures, type TransactionWrapperOptions, VitestKyselyTransactionIsolator, faker };
|
|
130
126
|
//# sourceMappingURL=kysely.d.cts.map
|
package/dist/kysely.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kysely.d.cts","names":[],"sources":["../src/kysely.ts"],"
|
|
1
|
+
{"version":3,"file":"kysely.d.cts","names":["_$__VitestTransactionIsolator0.DatabaseFixtures","_$__VitestTransactionIsolator0.TestWithExtendedFixtures"],"sources":["../src/kysely.ts"],"mappings":";;;;;;;;;;;;iBA+BiB,yBAChB,UACA,iBAAiB;;EAGjB,YAAY,mBAAmB,OAAO;;EAEtC,SAAS,KAAK,YAAY,cAAc;;EAExC,iBAAiB;;EAEjB,WAAW,gBAAgB,YAAY,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqDnC,4BACf,UACA,iBAAiB,8BAChB,KAAK,SAAS,SAAS,yBAAyB,UAAU,YAAS,QAAAA,iBAAA,YAAA,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0DrD,mBACf,UACA,iBAAiB,yBACjB,UAAU,WAAW,qBAAqB,WAAW,oBACpD,aAAa,GAAG,UAAU,gBAAgB,YAAY,WAAW,YAASC,yBAAA,YAAA,WAAA,UAAA"}
|
package/dist/kysely.d.mts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { FakerFactory, faker } from "./faker
|
|
2
|
-
import { ExtractSeedAttrs, FactorySeed } from "./Factory
|
|
3
|
-
import { KyselyFactory } from "./KyselyFactory
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-CwlTo6yf.mjs";
|
|
1
|
+
import { FakerFactory, faker } from "./faker.mjs";
|
|
2
|
+
import { ExtractSeedAttrs, FactorySeed } from "./Factory.mjs";
|
|
3
|
+
import { KyselyFactory } from "./KyselyFactory.mjs";
|
|
4
|
+
import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator.mjs";
|
|
5
|
+
import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator.mjs";
|
|
6
|
+
import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator.mjs";
|
|
8
7
|
import { TestAPI } from "vitest";
|
|
9
8
|
import { Kysely, Transaction } from "kysely";
|
|
10
|
-
|
|
11
9
|
//#region src/kysely.d.ts
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* Kysely-specific options for transaction wrapping.
|
|
15
12
|
*/
|
|
16
|
-
interface KyselyTransactionOptions<Database, Extended extends Record<string, unknown> = {}> {
|
|
13
|
+
export interface KyselyTransactionOptions<Database, Extended extends Record<string, unknown> = {}> {
|
|
17
14
|
/** Function that creates or returns a Kysely database instance */
|
|
18
15
|
connection: DatabaseConnection<Kysely<Database>>;
|
|
19
16
|
/** Optional setup function to run within the transaction before each test */
|
|
@@ -70,7 +67,7 @@ interface KyselyTransactionOptions<Database, Extended extends Record<string, unk
|
|
|
70
67
|
* });
|
|
71
68
|
* ```
|
|
72
69
|
*/
|
|
73
|
-
declare function wrapVitestKyselyTransaction<Database, Extended extends Record<string, unknown> = {}>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>): TestAPI<DatabaseFixtures<Transaction<Database>, object> & Extended>;
|
|
70
|
+
export declare function wrapVitestKyselyTransaction<Database, Extended extends Record<string, unknown> = {}>(api: TestAPI, options: KyselyTransactionOptions<Database, Extended>): TestAPI<DatabaseFixtures<Transaction<Database>, object> & Extended>;
|
|
74
71
|
/**
|
|
75
72
|
* Extends a Kysely transaction-wrapped test with additional fixtures.
|
|
76
73
|
* Each fixture receives the transaction and can create dependencies like factories or repositories.
|
|
@@ -123,8 +120,7 @@ declare function wrapVitestKyselyTransaction<Database, Extended extends Record<s
|
|
|
123
120
|
* });
|
|
124
121
|
* ```
|
|
125
122
|
*/
|
|
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
|
|
123
|
+
export 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>;
|
|
128
124
|
//#endregion
|
|
129
|
-
export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, KyselyFactory,
|
|
125
|
+
export { type DatabaseFixtures, type ExtendedDatabaseFixtures, type ExtractSeedAttrs, type FactorySeed, type FakerFactory, type FixtureCreators, IsolationLevel, KyselyFactory, PostgresKyselyMigrator, type TestWithExtendedFixtures, type TransactionWrapperOptions, VitestKyselyTransactionIsolator, faker };
|
|
130
126
|
//# sourceMappingURL=kysely.d.mts.map
|
package/dist/kysely.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kysely.d.mts","names":[],"sources":["../src/kysely.ts"],"
|
|
1
|
+
{"version":3,"file":"kysely.d.mts","names":["_$__VitestTransactionIsolator0.DatabaseFixtures","_$__VitestTransactionIsolator0.TestWithExtendedFixtures"],"sources":["../src/kysely.ts"],"mappings":";;;;;;;;;;;;iBA+BiB,yBAChB,UACA,iBAAiB;;EAGjB,YAAY,mBAAmB,OAAO;;EAEtC,SAAS,KAAK,YAAY,cAAc;;EAExC,iBAAiB;;EAEjB,WAAW,gBAAgB,YAAY,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqDnC,4BACf,UACA,iBAAiB,8BAChB,KAAK,SAAS,SAAS,yBAAyB,UAAU,YAAS,QAAAA,iBAAA,YAAA,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0DrD,mBACf,UACA,iBAAiB,yBACjB,UAAU,WAAW,qBAAqB,WAAW,oBACpD,aAAa,GAAG,UAAU,gBAAgB,YAAY,WAAW,YAASC,yBAAA,YAAA,WAAA,UAAA"}
|
package/dist/kysely.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import { IsolationLevel, extendWithFixtures } from "./VitestTransactionIsolator-CvwPecpl.mjs";
|
|
7
|
-
import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator-1Saieke7.mjs";
|
|
8
|
-
|
|
1
|
+
import { faker } from "./faker.mjs";
|
|
2
|
+
import { KyselyFactory } from "./KyselyFactory.mjs";
|
|
3
|
+
import { PostgresKyselyMigrator } from "./PostgresKyselyMigrator.mjs";
|
|
4
|
+
import { IsolationLevel, extendWithFixtures as extendWithFixtures$1 } from "./VitestTransactionIsolator.mjs";
|
|
5
|
+
import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolator.mjs";
|
|
9
6
|
//#region src/kysely.ts
|
|
10
7
|
/**
|
|
11
8
|
* Creates a wrapped Vitest test API with automatic transaction rollback for Kysely.
|
|
@@ -55,8 +52,7 @@ import { VitestKyselyTransactionIsolator } from "./VitestKyselyTransactionIsolat
|
|
|
55
52
|
* ```
|
|
56
53
|
*/
|
|
57
54
|
function wrapVitestKyselyTransaction(api, options) {
|
|
58
|
-
|
|
59
|
-
return wrapper.wrapVitestWithTransaction(options);
|
|
55
|
+
return new VitestKyselyTransactionIsolator(api).wrapVitestWithTransaction(options);
|
|
60
56
|
}
|
|
61
57
|
/**
|
|
62
58
|
* Extends a Kysely transaction-wrapped test with additional fixtures.
|
|
@@ -110,10 +106,10 @@ function wrapVitestKyselyTransaction(api, options) {
|
|
|
110
106
|
* });
|
|
111
107
|
* ```
|
|
112
108
|
*/
|
|
113
|
-
function extendWithFixtures
|
|
114
|
-
return extendWithFixtures(wrappedTest, fixtures);
|
|
109
|
+
function extendWithFixtures(wrappedTest, fixtures) {
|
|
110
|
+
return extendWithFixtures$1(wrappedTest, fixtures);
|
|
115
111
|
}
|
|
116
|
-
|
|
117
112
|
//#endregion
|
|
118
|
-
export { IsolationLevel, KyselyFactory, PostgresKyselyMigrator, VitestKyselyTransactionIsolator, extendWithFixtures
|
|
113
|
+
export { IsolationLevel, KyselyFactory, PostgresKyselyMigrator, VitestKyselyTransactionIsolator, extendWithFixtures, faker, wrapVitestKyselyTransaction };
|
|
114
|
+
|
|
119
115
|
//# sourceMappingURL=kysely.mjs.map
|
package/dist/kysely.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kysely.mjs","names":["
|
|
1
|
+
{"version":3,"file":"kysely.mjs","names":["baseExtendWithFixtures"],"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,4BAGd,KAAc,SAAuD;CAGtE,OAAO,IAFa,gCAA0C,GAEjD,CAAC,CAAC,0BAA0B,OAAO;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,mBAId,aAAgB,UAA4D;CAC7E,OAAOA,qBACN,aACA,QACD;AACD"}
|
package/dist/logger.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let vitest = require("vitest");
|
|
4
3
|
//#region src/logger.ts
|
|
5
4
|
/**
|
|
6
5
|
* Creates a mock Logger for testing
|
|
@@ -17,7 +16,7 @@ function createMockLogger() {
|
|
|
17
16
|
};
|
|
18
17
|
return logger;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
//#endregion
|
|
22
20
|
exports.createMockLogger = createMockLogger;
|
|
21
|
+
|
|
23
22
|
//# sourceMappingURL=logger.cjs.map
|
package/dist/logger.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.cjs","names":["
|
|
1
|
+
{"version":3,"file":"logger.cjs","names":["vi"],"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,MAAM,SAAiB;EACtB,OAAOA,OAAAA,GAAG,GAAG;EACb,MAAMA,OAAAA,GAAG,GAAG;EACZ,MAAMA,OAAAA,GAAG,GAAG;EACZ,OAAOA,OAAAA,GAAG,GAAG;EACb,OAAOA,OAAAA,GAAG,GAAG;EACb,OAAOA,OAAAA,GAAG,GAAG;EACb,OAAOA,OAAAA,GAAG,SAAS,MAAM;CAC1B;CACA,OAAO;AACR"}
|
package/dist/logger.d.cts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { Logger } from "@geekmidas/logger";
|
|
2
|
-
|
|
3
2
|
//#region src/logger.d.ts
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Creates a mock Logger for testing
|
|
7
5
|
*/
|
|
8
|
-
declare function createMockLogger(): Logger;
|
|
9
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
6
|
+
export declare function createMockLogger(): Logger;
|
|
10
7
|
//#endregion
|
|
11
|
-
export { createMockLogger };
|
|
12
8
|
//# sourceMappingURL=logger.d.cts.map
|
package/dist/logger.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.cts","names":[],"sources":["../src/logger.ts"],"
|
|
1
|
+
{"version":3,"file":"logger.d.cts","names":[],"sources":["../src/logger.ts"],"mappings":";;;;;wBAMgB,oBAAoB"}
|
package/dist/logger.d.mts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { Logger } from "@geekmidas/logger";
|
|
2
|
-
|
|
3
2
|
//#region src/logger.d.ts
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Creates a mock Logger for testing
|
|
7
5
|
*/
|
|
8
|
-
declare function createMockLogger(): Logger;
|
|
9
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
6
|
+
export declare function createMockLogger(): Logger;
|
|
10
7
|
//#endregion
|
|
11
|
-
export { createMockLogger };
|
|
12
8
|
//# sourceMappingURL=logger.d.mts.map
|
package/dist/logger.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.mts","names":[],"sources":["../src/logger.ts"],"
|
|
1
|
+
{"version":3,"file":"logger.d.mts","names":[],"sources":["../src/logger.ts"],"mappings":";;;;;wBAMgB,oBAAoB"}
|
package/dist/logger.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { vi } from "vitest";
|
|
2
|
-
|
|
3
2
|
//#region src/logger.ts
|
|
4
3
|
/**
|
|
5
4
|
* Creates a mock Logger for testing
|
|
@@ -16,7 +15,7 @@ function createMockLogger() {
|
|
|
16
15
|
};
|
|
17
16
|
return logger;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
//#endregion
|
|
21
19
|
export { createMockLogger };
|
|
20
|
+
|
|
22
21
|
//# sourceMappingURL=logger.mjs.map
|
package/dist/logger.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.mjs","names":[
|
|
1
|
+
{"version":3,"file":"logger.mjs","names":[],"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,MAAM,SAAiB;EACtB,OAAO,GAAG,GAAG;EACb,MAAM,GAAG,GAAG;EACZ,MAAM,GAAG,GAAG;EACZ,OAAO,GAAG,GAAG;EACb,OAAO,GAAG,GAAG;EACb,OAAO,GAAG,GAAG;EACb,OAAO,GAAG,SAAS,MAAM;CAC1B;CACA,OAAO;AACR"}
|
package/dist/objection.cjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
const require_faker = require(
|
|
3
|
-
const require_ObjectionFactory = require(
|
|
4
|
-
require(
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const require_VitestObjectionTransactionIsolator = require('./VitestObjectionTransactionIsolator-DDoJTu7e.cjs');
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_faker = require("./faker.cjs");
|
|
3
|
+
const require_ObjectionFactory = require("./ObjectionFactory.cjs");
|
|
4
|
+
const require_PostgresObjectionMigrator = require("./PostgresObjectionMigrator.cjs");
|
|
5
|
+
const require_VitestTransactionIsolator = require("./VitestTransactionIsolator.cjs");
|
|
6
|
+
const require_VitestObjectionTransactionIsolator = require("./VitestObjectionTransactionIsolator.cjs");
|
|
9
7
|
//#region src/objection.ts
|
|
10
8
|
/**
|
|
11
9
|
* Creates a wrapped Vitest test API with automatic transaction rollback for Objection.js.
|
|
@@ -52,8 +50,7 @@ const require_VitestObjectionTransactionIsolator = require('./VitestObjectionTra
|
|
|
52
50
|
* ```
|
|
53
51
|
*/
|
|
54
52
|
function wrapVitestObjectionTransaction(api, options) {
|
|
55
|
-
|
|
56
|
-
return wrapper.wrapVitestWithTransaction(options);
|
|
53
|
+
return new require_VitestObjectionTransactionIsolator.VitestObjectionTransactionIsolator(api).wrapVitestWithTransaction(options);
|
|
57
54
|
}
|
|
58
55
|
/**
|
|
59
56
|
* Extends an Objection.js transaction-wrapped test with additional fixtures.
|
|
@@ -103,16 +100,16 @@ function wrapVitestObjectionTransaction(api, options) {
|
|
|
103
100
|
* });
|
|
104
101
|
* ```
|
|
105
102
|
*/
|
|
106
|
-
function extendWithFixtures
|
|
103
|
+
function extendWithFixtures(wrappedTest, fixtures) {
|
|
107
104
|
return require_VitestTransactionIsolator.extendWithFixtures(wrappedTest, fixtures);
|
|
108
105
|
}
|
|
109
|
-
|
|
110
106
|
//#endregion
|
|
111
107
|
exports.IsolationLevel = require_VitestTransactionIsolator.IsolationLevel;
|
|
112
108
|
exports.ObjectionFactory = require_ObjectionFactory.ObjectionFactory;
|
|
113
109
|
exports.PostgresObjectionMigrator = require_PostgresObjectionMigrator.PostgresObjectionMigrator;
|
|
114
110
|
exports.VitestObjectionTransactionIsolator = require_VitestObjectionTransactionIsolator.VitestObjectionTransactionIsolator;
|
|
115
|
-
exports.extendWithFixtures = extendWithFixtures
|
|
111
|
+
exports.extendWithFixtures = extendWithFixtures;
|
|
116
112
|
exports.faker = require_faker.faker;
|
|
117
113
|
exports.wrapVitestObjectionTransaction = wrapVitestObjectionTransaction;
|
|
114
|
+
|
|
118
115
|
//# sourceMappingURL=objection.cjs.map
|
package/dist/objection.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objection.cjs","names":["
|
|
1
|
+
{"version":3,"file":"objection.cjs","names":["VitestObjectionTransactionIsolator","baseExtendWithFixtures"],"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,+BAEd,KAAc,SAAgD;CAG/D,OAAO,IAFaA,2CAAAA,mCAAmC,GAE1C,CAAC,CAAC,0BAA0B,OAAO;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,mBAGd,aAAgB,UAAuD;CACxE,OAAOC,kCAAAA,mBACN,aACA,QACD;AACD"}
|
package/dist/objection.d.cts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { FakerFactory, faker } from "./faker
|
|
2
|
-
import { ExtractSeedAttrs, FactorySeed } from "./Factory
|
|
3
|
-
import { ObjectionFactory } from "./ObjectionFactory
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-CTTjvTPO.cjs";
|
|
1
|
+
import { FakerFactory, faker } from "./faker.cjs";
|
|
2
|
+
import { ExtractSeedAttrs, FactorySeed } from "./Factory.cjs";
|
|
3
|
+
import { ObjectionFactory } from "./ObjectionFactory.cjs";
|
|
4
|
+
import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator.cjs";
|
|
5
|
+
import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator.cjs";
|
|
6
|
+
import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator.cjs";
|
|
8
7
|
import { Knex } from "knex";
|
|
9
8
|
import { TestAPI } from "vitest";
|
|
10
|
-
|
|
11
9
|
//#region src/objection.d.ts
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* Objection.js-specific options for transaction wrapping.
|
|
15
12
|
*/
|
|
16
|
-
interface ObjectionTransactionOptions<Extended extends Record<string, unknown> = {}> {
|
|
13
|
+
export interface ObjectionTransactionOptions<Extended extends Record<string, unknown> = {}> {
|
|
17
14
|
/** Function that creates or returns a Knex database connection */
|
|
18
15
|
connection: DatabaseConnection<Knex>;
|
|
19
16
|
/** Optional setup function to run within the transaction before each test */
|
|
@@ -67,7 +64,7 @@ interface ObjectionTransactionOptions<Extended extends Record<string, unknown> =
|
|
|
67
64
|
* });
|
|
68
65
|
* ```
|
|
69
66
|
*/
|
|
70
|
-
declare function wrapVitestObjectionTransaction<Extended extends Record<string, unknown> = {}>(api: TestAPI, options: ObjectionTransactionOptions<Extended>): TestAPI<DatabaseFixtures<Knex.Transaction<any, any[]>, object> & Extended>;
|
|
67
|
+
export declare function wrapVitestObjectionTransaction<Extended extends Record<string, unknown> = {}>(api: TestAPI, options: ObjectionTransactionOptions<Extended>): TestAPI<DatabaseFixtures<Knex.Transaction<any, any[]>, object> & Extended>;
|
|
71
68
|
/**
|
|
72
69
|
* Extends an Objection.js transaction-wrapped test with additional fixtures.
|
|
73
70
|
* Each fixture receives the transaction and can create dependencies like factories or repositories.
|
|
@@ -116,8 +113,7 @@ declare function wrapVitestObjectionTransaction<Extended extends Record<string,
|
|
|
116
113
|
* });
|
|
117
114
|
* ```
|
|
118
115
|
*/
|
|
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
|
|
116
|
+
export 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>;
|
|
121
117
|
//#endregion
|
|
122
|
-
export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, ObjectionFactory,
|
|
118
|
+
export { type DatabaseFixtures, type ExtendedDatabaseFixtures, type ExtractSeedAttrs, type FactorySeed, type FakerFactory, type FixtureCreators, IsolationLevel, ObjectionFactory, PostgresObjectionMigrator, type TestWithExtendedFixtures, type TransactionWrapperOptions, VitestObjectionTransactionIsolator, faker };
|
|
123
119
|
//# sourceMappingURL=objection.d.cts.map
|
package/dist/objection.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objection.d.cts","names":[],"sources":["../src/objection.ts"],"
|
|
1
|
+
{"version":3,"file":"objection.d.cts","names":["_$__VitestTransactionIsolator0.DatabaseFixtures","_$__VitestTransactionIsolator0.TestWithExtendedFixtures"],"sources":["../src/objection.ts"],"mappings":";;;;;;;;;;;;iBAgCiB,4BAChB,iBAAiB;;EAGjB,YAAY,mBAAmB;;EAE/B,SAAS,KAAK,KAAK,gBAAgB;;EAEnC,iBAAiB;;EAEjB,WAAW,gBAAgB,KAAK,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkD9B,+BACf,iBAAiB,8BAChB,KAAK,SAAS,SAAS,4BAA4B,YAAS,QAAAA,iBAAA,KAAA,mCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsD9C,mBACf,iBAAiB,yBACjB,UAAU,WAAW,qBAAqB,WAAW,oBACpD,aAAa,GAAG,UAAU,gBAAgB,KAAK,aAAa,YAASC,yBAAA,KAAA,yBAAA,UAAA"}
|
package/dist/objection.d.mts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { FakerFactory, faker } from "./faker
|
|
2
|
-
import { ExtractSeedAttrs, FactorySeed } from "./Factory
|
|
3
|
-
import { ObjectionFactory } from "./ObjectionFactory
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator-CyZG6nq4.mjs";
|
|
1
|
+
import { FakerFactory, faker } from "./faker.mjs";
|
|
2
|
+
import { ExtractSeedAttrs, FactorySeed } from "./Factory.mjs";
|
|
3
|
+
import { ObjectionFactory } from "./ObjectionFactory.mjs";
|
|
4
|
+
import { PostgresObjectionMigrator } from "./PostgresObjectionMigrator.mjs";
|
|
5
|
+
import { DatabaseConnection, DatabaseFixtures, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions } from "./VitestTransactionIsolator.mjs";
|
|
6
|
+
import { VitestObjectionTransactionIsolator } from "./VitestObjectionTransactionIsolator.mjs";
|
|
8
7
|
import { TestAPI } from "vitest";
|
|
9
8
|
import { Knex } from "knex";
|
|
10
|
-
|
|
11
9
|
//#region src/objection.d.ts
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* Objection.js-specific options for transaction wrapping.
|
|
15
12
|
*/
|
|
16
|
-
interface ObjectionTransactionOptions<Extended extends Record<string, unknown> = {}> {
|
|
13
|
+
export interface ObjectionTransactionOptions<Extended extends Record<string, unknown> = {}> {
|
|
17
14
|
/** Function that creates or returns a Knex database connection */
|
|
18
15
|
connection: DatabaseConnection<Knex>;
|
|
19
16
|
/** Optional setup function to run within the transaction before each test */
|
|
@@ -67,7 +64,7 @@ interface ObjectionTransactionOptions<Extended extends Record<string, unknown> =
|
|
|
67
64
|
* });
|
|
68
65
|
* ```
|
|
69
66
|
*/
|
|
70
|
-
declare function wrapVitestObjectionTransaction<Extended extends Record<string, unknown> = {}>(api: TestAPI, options: ObjectionTransactionOptions<Extended>): TestAPI<DatabaseFixtures<Knex.Transaction<any, any[]>, object> & Extended>;
|
|
67
|
+
export declare function wrapVitestObjectionTransaction<Extended extends Record<string, unknown> = {}>(api: TestAPI, options: ObjectionTransactionOptions<Extended>): TestAPI<DatabaseFixtures<Knex.Transaction<any, any[]>, object> & Extended>;
|
|
71
68
|
/**
|
|
72
69
|
* Extends an Objection.js transaction-wrapped test with additional fixtures.
|
|
73
70
|
* Each fixture receives the transaction and can create dependencies like factories or repositories.
|
|
@@ -116,8 +113,7 @@ declare function wrapVitestObjectionTransaction<Extended extends Record<string,
|
|
|
116
113
|
* });
|
|
117
114
|
* ```
|
|
118
115
|
*/
|
|
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
|
|
116
|
+
export 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>;
|
|
121
117
|
//#endregion
|
|
122
|
-
export { DatabaseFixtures, ExtendedDatabaseFixtures, ExtractSeedAttrs, FactorySeed, FakerFactory, FixtureCreators, IsolationLevel, ObjectionFactory,
|
|
118
|
+
export { type DatabaseFixtures, type ExtendedDatabaseFixtures, type ExtractSeedAttrs, type FactorySeed, type FakerFactory, type FixtureCreators, IsolationLevel, ObjectionFactory, PostgresObjectionMigrator, type TestWithExtendedFixtures, type TransactionWrapperOptions, VitestObjectionTransactionIsolator, faker };
|
|
123
119
|
//# sourceMappingURL=objection.d.mts.map
|
package/dist/objection.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objection.d.mts","names":[],"sources":["../src/objection.ts"],"
|
|
1
|
+
{"version":3,"file":"objection.d.mts","names":["_$__VitestTransactionIsolator0.DatabaseFixtures","_$__VitestTransactionIsolator0.TestWithExtendedFixtures"],"sources":["../src/objection.ts"],"mappings":";;;;;;;;;;;;iBAgCiB,4BAChB,iBAAiB;;EAGjB,YAAY,mBAAmB;;EAE/B,SAAS,KAAK,KAAK,gBAAgB;;EAEnC,iBAAiB;;EAEjB,WAAW,gBAAgB,KAAK,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkD9B,+BACf,iBAAiB,8BAChB,KAAK,SAAS,SAAS,4BAA4B,YAAS,QAAAA,iBAAA,KAAA,mCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsD9C,mBACf,iBAAiB,yBACjB,UAAU,WAAW,qBAAqB,WAAW,oBACpD,aAAa,GAAG,UAAU,gBAAgB,KAAK,aAAa,YAASC,yBAAA,KAAA,yBAAA,UAAA"}
|