@geekmidas/testkit 10.0.0-alpha.3 → 10.0.0-alpha.30
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/README.md +74 -0
- 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-CDPnnwMJ.d.cts} +11 -5
- package/dist/PostgresMigrator-CDPnnwMJ.d.cts.map +1 -0
- package/dist/{PostgresMigrator-CeYy-eHF.d.cts → PostgresMigrator-CDPnnwMJ.d.mts} +11 -5
- package/dist/PostgresMigrator-CDPnnwMJ.d.mts.map +1 -0
- package/dist/PostgresMigrator.cjs +178 -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 +175 -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 +31 -15
- package/dist/better-auth.cjs.map +1 -1
- package/dist/better-auth.d.cts +13142 -4
- package/dist/better-auth.d.cts.map +1 -1
- package/dist/better-auth.d.mts +13142 -4
- package/dist/better-auth.d.mts.map +1 -1
- package/dist/better-auth.mjs +29 -13
- package/dist/better-auth.mjs.map +1 -1
- package/dist/browser.cjs +127 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +47 -0
- package/dist/browser.d.cts.map +1 -0
- package/dist/browser.d.mts +47 -0
- package/dist/browser.d.mts.map +1 -0
- package/dist/browser.mjs +125 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/context.cjs +80 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +55 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.mts +55 -0
- package/dist/context.d.mts.map +1 -0
- package/dist/context.mjs +73 -0
- package/dist/context.mjs.map +1 -0
- 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/mailbox.cjs +95 -0
- package/dist/mailbox.cjs.map +1 -0
- package/dist/mailbox.d.cts +58 -0
- package/dist/mailbox.d.cts.map +1 -0
- package/dist/mailbox.d.mts +58 -0
- package/dist/mailbox.d.mts.map +1 -0
- package/dist/mailbox.mjs +92 -0
- package/dist/mailbox.mjs.map +1 -0
- 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/dist/transactions.cjs +123 -0
- package/dist/transactions.cjs.map +1 -0
- package/dist/transactions.d.cts +44 -0
- package/dist/transactions.d.cts.map +1 -0
- package/dist/transactions.d.mts +44 -0
- package/dist/transactions.d.mts.map +1 -0
- package/dist/transactions.mjs +118 -0
- package/dist/transactions.mjs.map +1 -0
- package/package.json +59 -16
- package/dist/Factory-BFVnMMCC.mjs +0 -51
- package/dist/Factory-BFVnMMCC.mjs.map +0 -1
- package/dist/Factory-BOX312yd.d.cts +0 -147
- package/dist/Factory-BOX312yd.d.cts.map +0 -1
- package/dist/Factory-BhjUOBWN.cjs +0 -57
- package/dist/Factory-BhjUOBWN.cjs.map +0 -1
- package/dist/Factory-C6W78ulZ.d.mts +0 -147
- package/dist/Factory-C6W78ulZ.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-Cc2UmOJk.d.mts +0 -228
- package/dist/KyselyFactory-Cc2UmOJk.d.mts.map +0 -1
- package/dist/KyselyFactory-DMswpwji.mjs +0 -241
- package/dist/KyselyFactory-DMswpwji.mjs.map +0 -1
- package/dist/KyselyFactory-Dy5zzV4B.d.cts +0 -228
- package/dist/KyselyFactory-Dy5zzV4B.d.cts.map +0 -1
- package/dist/ObjectionFactory-BYnPr9ZP.d.mts +0 -241
- package/dist/ObjectionFactory-BYnPr9ZP.d.mts.map +0 -1
- package/dist/ObjectionFactory-BeFBYcan.cjs +0 -272
- package/dist/ObjectionFactory-BeFBYcan.cjs.map +0 -1
- package/dist/ObjectionFactory-CD-WFuMJ.d.cts +0 -241
- package/dist/ObjectionFactory-CD-WFuMJ.d.cts.map +0 -1
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs +0 -267
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs.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-BxjqmtCT.mjs +0 -27
- package/dist/directory-BxjqmtCT.mjs.map +0 -1
- package/dist/directory-DD_xQoSh.cjs +0 -33
- package/dist/directory-DD_xQoSh.cjs.map +0 -1
- package/dist/directory-DGOcVlKD.d.cts +0 -13
- package/dist/directory-DGOcVlKD.d.cts.map +0 -1
- package/dist/directory-DiQ_DkaF.d.mts +0 -13
- package/dist/directory-DiQ_DkaF.d.mts.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-Cg76aFNO.d.cts +0 -166
- package/dist/faker-Cg76aFNO.d.cts.map +0 -1
- package/dist/faker-D9gz7KjY.d.mts +0 -166
- package/dist/faker-D9gz7KjY.d.mts.map +0 -1
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { Service } from "@geekmidas/services";
|
|
2
|
-
import { TestAPI } from "vitest";
|
|
3
|
-
|
|
4
|
-
//#region src/VitestTransactionIsolator.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Type definition for test fixtures that provide transaction access.
|
|
8
|
-
* Used with Vitest's test.extend() API to inject transactions into tests.
|
|
9
|
-
*
|
|
10
|
-
* @template Transaction - The transaction type specific to the database driver
|
|
11
|
-
* @template Extended - Additional context properties provided by the extend function
|
|
12
|
-
*/
|
|
13
|
-
interface DatabaseFixtures<Transaction, _Extended = object> {
|
|
14
|
-
/**
|
|
15
|
-
* The database transaction available to the test.
|
|
16
|
-
* All database operations should use this transaction to ensure proper rollback.
|
|
17
|
-
*/
|
|
18
|
-
trx: Transaction;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Combined fixtures type that merges the base transaction fixture with extended context.
|
|
22
|
-
*/
|
|
23
|
-
type ExtendedDatabaseFixtures<Transaction, Extended = object> = DatabaseFixtures<Transaction> & Extended;
|
|
24
|
-
/**
|
|
25
|
-
* Function type for extending test context with additional properties.
|
|
26
|
-
* Receives the transaction and returns additional context to be merged with { trx }.
|
|
27
|
-
*
|
|
28
|
-
* @template Transaction - The transaction type
|
|
29
|
-
* @template Extended - The type of additional context to provide
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const extendContext: ExtendContextFn<Transaction<DB>, { factory: KyselyFactory }> =
|
|
34
|
-
* (trx) => ({ factory: new KyselyFactory(builders, seeds, trx) });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
type ExtendContextFn<Transaction, Extended> = (trx: Transaction) => Extended | Promise<Extended>;
|
|
38
|
-
/**
|
|
39
|
-
* PostgreSQL transaction isolation levels.
|
|
40
|
-
* Controls the visibility of concurrent transactions.
|
|
41
|
-
*
|
|
42
|
-
* @see https://www.postgresql.org/docs/current/transaction-iso.html
|
|
43
|
-
*/
|
|
44
|
-
declare enum IsolationLevel {
|
|
45
|
-
/**
|
|
46
|
-
* Lowest isolation level. Allows dirty reads.
|
|
47
|
-
* Not recommended for testing.
|
|
48
|
-
*/
|
|
49
|
-
READ_UNCOMMITTED = "READ UNCOMMITTED",
|
|
50
|
-
/**
|
|
51
|
-
* Default PostgreSQL isolation level.
|
|
52
|
-
* Prevents dirty reads but allows non-repeatable reads.
|
|
53
|
-
*/
|
|
54
|
-
READ_COMMITTED = "READ COMMITTED",
|
|
55
|
-
/**
|
|
56
|
-
* Prevents dirty reads and non-repeatable reads.
|
|
57
|
-
* Recommended for most test scenarios.
|
|
58
|
-
*/
|
|
59
|
-
REPEATABLE_READ = "REPEATABLE READ",
|
|
60
|
-
/**
|
|
61
|
-
* Highest isolation level. Prevents all phenomena.
|
|
62
|
-
* May cause performance overhead in tests.
|
|
63
|
-
*/
|
|
64
|
-
SERIALIZABLE = "SERIALIZABLE",
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Abstract base class for implementing database transaction isolation in Vitest tests.
|
|
68
|
-
* Provides automatic transaction rollback after each test to maintain test isolation.
|
|
69
|
-
* Subclasses must implement the transact() method for their specific database driver.
|
|
70
|
-
*
|
|
71
|
-
* @template TConn - The database connection type
|
|
72
|
-
* @template Transaction - The transaction type
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* // Implement for your database driver
|
|
77
|
-
* class MyDatabaseIsolator extends VitestPostgresTransactionIsolator<MyDB, MyTx> {
|
|
78
|
-
* async transact(conn: MyDB, level: IsolationLevel, fn: (tx: MyTx) => Promise<void>) {
|
|
79
|
-
* await conn.transaction(level, fn);
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
*
|
|
83
|
-
* // Use in tests
|
|
84
|
-
* const isolator = new MyDatabaseIsolator(test);
|
|
85
|
-
* const isolatedTest = isolator.wrapVitestWithTransaction(db);
|
|
86
|
-
*
|
|
87
|
-
* isolatedTest('should create user', async ({ trx }) => {
|
|
88
|
-
* await trx.insert('users', { name: 'Test' });
|
|
89
|
-
* // Data is automatically rolled back after test
|
|
90
|
-
* });
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
declare abstract class VitestPostgresTransactionIsolator<TConn, Transaction> {
|
|
94
|
-
private readonly api;
|
|
95
|
-
/**
|
|
96
|
-
* Abstract method to create a transaction with the specified isolation level.
|
|
97
|
-
* Must be implemented by subclasses for specific database drivers.
|
|
98
|
-
*
|
|
99
|
-
* @param conn - The database connection
|
|
100
|
-
* @param isolationLevel - The transaction isolation level
|
|
101
|
-
* @param fn - The function to execute within the transaction
|
|
102
|
-
* @returns Promise that resolves when the transaction completes
|
|
103
|
-
*/
|
|
104
|
-
abstract transact(conn: TConn, isolationLevel: IsolationLevel, fn: (trx: Transaction) => Promise<void>): Promise<void>;
|
|
105
|
-
abstract destroy(conn: TConn): Promise<void>;
|
|
106
|
-
/**
|
|
107
|
-
* Creates a new VitestPostgresTransactionIsolator instance.
|
|
108
|
-
*
|
|
109
|
-
* @param api - The Vitest test API (usually the `test` export from vitest)
|
|
110
|
-
*/
|
|
111
|
-
constructor(api: TestAPI);
|
|
112
|
-
/**
|
|
113
|
-
* Creates a wrapped version of Vitest's test API that provides transaction isolation.
|
|
114
|
-
* Each test will run within a database transaction that is automatically rolled back.
|
|
115
|
-
*
|
|
116
|
-
* @param options - Configuration options for transaction wrapping
|
|
117
|
-
* @returns A wrapped test API with transaction support
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```typescript
|
|
121
|
-
* const isolatedTest = isolator.wrapVitestWithTransaction({
|
|
122
|
-
* connection: db,
|
|
123
|
-
* setup: async (trx) => {
|
|
124
|
-
* await trx.insert('settings', { key: 'test', value: 'true' });
|
|
125
|
-
* },
|
|
126
|
-
* fixtures: {
|
|
127
|
-
* factory: (trx) => new Factory(trx),
|
|
128
|
-
* },
|
|
129
|
-
* });
|
|
130
|
-
*
|
|
131
|
-
* isolatedTest('test with transaction', async ({ trx, factory }) => {
|
|
132
|
-
* const user = await factory.insert('user', { name: 'Test' });
|
|
133
|
-
* expect(user).toBeDefined();
|
|
134
|
-
* });
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
wrapVitestWithTransaction<Extended extends Record<string, unknown> = {}>(options: TransactionWrapperOptions<TConn, Transaction, Extended>): TestAPI<DatabaseFixtures<Transaction, object> & Extended>;
|
|
138
|
-
}
|
|
139
|
-
type DatabaseConnectionFn<Conn> = () => Conn | Promise<Conn>;
|
|
140
|
-
/**
|
|
141
|
-
* Where a connection comes from: a construct, or a function returning one.
|
|
142
|
-
*
|
|
143
|
-
* A construct is preferred, because it builds the client through the same
|
|
144
|
-
* `connect()` production uses. A hand-rolled client missing `CamelCasePlugin`
|
|
145
|
-
* writes `createdAt` where the app writes `created_at`, and the test passes
|
|
146
|
-
* while production does not. The URL is read from `process.env`.
|
|
147
|
-
*/
|
|
148
|
-
type DatabaseConnection<Conn> = DatabaseConnectionFn<Conn> | ConnectableConstruct<Conn>;
|
|
149
|
-
/**
|
|
150
|
-
* Options for wrapping Vitest tests with database transaction isolation.
|
|
151
|
-
*/
|
|
152
|
-
/**
|
|
153
|
-
* Anything that owns a service handing back a connection — a database
|
|
154
|
-
* construct, structurally, so testkit depends on no construct package.
|
|
155
|
-
*/
|
|
156
|
-
interface ConnectableConstruct<TConn> {
|
|
157
|
-
readonly service: Service<string, TConn>;
|
|
158
|
-
}
|
|
159
|
-
interface TransactionWrapperOptions<TConn, Transaction, Extended extends Record<string, unknown> = {}> {
|
|
160
|
-
/** Where the connection comes from — a construct, or a function returning one */
|
|
161
|
-
connection: DatabaseConnection<TConn>;
|
|
162
|
-
/** Optional setup function to run within the transaction before each test */
|
|
163
|
-
setup?: (trx: Transaction) => Promise<void>;
|
|
164
|
-
/** Transaction isolation level (defaults to REPEATABLE_READ) */
|
|
165
|
-
isolationLevel?: IsolationLevel;
|
|
166
|
-
/** Additional fixtures that depend on the transaction */
|
|
167
|
-
fixtures?: FixtureCreators<Transaction, Extended>;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Type for fixture creator functions that depend on the transaction.
|
|
171
|
-
* Each function receives the transaction and returns the fixture value.
|
|
172
|
-
*/
|
|
173
|
-
type FixtureCreators<Transaction, Extended extends Record<string, unknown>> = { [K in keyof Extended]: (trx: Transaction) => Extended[K] | Promise<Extended[K]> };
|
|
174
|
-
/**
|
|
175
|
-
* The test API returned by extendWithFixtures.
|
|
176
|
-
* Provides access to both the transaction (trx) and all extended fixtures.
|
|
177
|
-
*
|
|
178
|
-
* @template Transaction - The transaction type
|
|
179
|
-
* @template Extended - The type of additional fixtures provided
|
|
180
|
-
* @template BaseTest - The base wrapped test type
|
|
181
|
-
*/
|
|
182
|
-
type TestWithExtendedFixtures<Transaction, Extended extends Record<string, unknown>, BaseTest extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>> = BaseTest & {
|
|
183
|
-
<C extends object>(name: string, fn: (context: DatabaseFixtures<Transaction> & Extended & C) => Promise<void>): void;
|
|
184
|
-
<C extends object>(name: string, options: object, fn: (context: DatabaseFixtures<Transaction> & Extended & C) => Promise<void>): void;
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* Extends a wrapped test API with additional fixtures that depend on the transaction.
|
|
188
|
-
* This allows composing test context with factories, repositories, or other helpers.
|
|
189
|
-
*
|
|
190
|
-
* @template Transaction - The transaction type
|
|
191
|
-
* @template Extended - The type of additional context to provide
|
|
192
|
-
* @param wrappedTest - The base wrapped test from wrapVitestWithTransaction
|
|
193
|
-
* @param fixtures - Object mapping fixture names to creator functions
|
|
194
|
-
* @returns An extended test API with both trx and the additional fixtures
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* ```typescript
|
|
198
|
-
* import { wrapVitestKyselyTransaction, extendWithFixtures } from '@geekmidas/testkit/kysely';
|
|
199
|
-
*
|
|
200
|
-
* // Create base wrapped test
|
|
201
|
-
* const baseTest = wrapVitestKyselyTransaction(test, {
|
|
202
|
-
* connection: db,
|
|
203
|
-
* setup: createTestTables,
|
|
204
|
-
* });
|
|
205
|
-
*
|
|
206
|
-
* // Extend with fixtures
|
|
207
|
-
* const it = extendWithFixtures(baseTest, {
|
|
208
|
-
* factory: (trx) => new KyselyFactory(builders, seeds, trx),
|
|
209
|
-
* userRepo: (trx) => new UserRepository(trx),
|
|
210
|
-
* });
|
|
211
|
-
*
|
|
212
|
-
* // Use in tests - trx and all fixtures are available
|
|
213
|
-
* it('should create user with factory', async ({ trx, factory, userRepo }) => {
|
|
214
|
-
* const user = await factory.insert('user', { name: 'Test' });
|
|
215
|
-
* expect(user).toBeDefined();
|
|
216
|
-
* });
|
|
217
|
-
* ```
|
|
218
|
-
*/
|
|
219
|
-
declare function extendWithFixtures<Transaction, Extended extends Record<string, unknown>, T extends ReturnType<TestAPI['extend']> = any>(wrappedTest: T, fixtures: FixtureCreators<Transaction, Extended>): TestWithExtendedFixtures<Transaction, Extended, T>;
|
|
220
|
-
//# sourceMappingURL=VitestTransactionIsolator.d.ts.map
|
|
221
|
-
//#endregion
|
|
222
|
-
export { ConnectableConstruct, DatabaseConnection, DatabaseConnectionFn, DatabaseFixtures, ExtendContextFn, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions, VitestPostgresTransactionIsolator, extendWithFixtures };
|
|
223
|
-
//# sourceMappingURL=VitestTransactionIsolator-glcxyS_R.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VitestTransactionIsolator-glcxyS_R.d.cts","names":[],"sources":["../src/VitestTransactionIsolator.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;AAWA;;;;AAGoC,UAdnB,gBAcmB,CAAA,WAAA,EAAA,YAAA,MAAA,CAAA,CAAA;EAAQ;AAe5C;;;EACiB,GACZ,EA1BC,WA0BD;;;AAAkB;AAQvB;AAkDsB,KA9EV,wBA8EU,CAAA,WAAiC,EAAA,WAAA,MAAA,CAAA,GA3EnD,gBA2EmD,CA3ElC,WA2EkC,CAAA,GA3EnB,QA2EmB;;;;;;;;;;;;;;AAkD5C,KA9GC,eA8GD,CAAA,WAAA,EAAA,QAAA,CAAA,GAAA,CAAA,GAAA,EA7GL,WA6GK,EAAA,GA5GN,QA4GM,GA5GK,OA4GL,CA5Ga,QA4Gb,CAAA;;;;;AAAuD;AA8FlE;AAAgC,aAlMpB,cAAA;EAkMoB;;;AAA6B;EAUjD,gBAAA,GAAA,kBAAkB;EAAA;;;;EAEF,cAAzB,GAAA,gBAAA;EAAoB;AAgBvB;;;EACwC,eAArB,GAAA,iBAAA;EAAO;AAG1B;;;EAGwB,YAGQ,GAAA,cAAA;;;;;;;;AAML;AAO3B;;;;;;;;;;AAM2B;AAW3B;;;;;;;;;AAUY,uBA9NU,iCA8NV,CAAA,KAAA,EAAA,WAAA,CAAA,CAAA;EAAgB,iBAAgB,GAAA;EAAQ;;;;;;;AAQtC;AAqCd;EAAkC,SAAA,QAAA,CAAA,IAAA,EAhQ1B,KAgQ0B,EAAA,cAAA,EA/PhB,cA+PgB,EAAA,EAAA,EAAA,CAAA,GAAA,EA9PtB,WA8PsB,EAAA,GA9PN,OA8PM,CAAA,IAAA,CAAA,CAAA,EA7P9B,OA6P8B,CAAA,IAAA,CAAA;EAAA,SAEhB,OAAA,CAAA,IAAA,EA7PM,KA6PN,CAAA,EA7Pc,OA6Pd,CAAA,IAAA,CAAA;EAAM;;;;;EAKwB,WAArC,CAAA,GAAA,EA5PwB,OA4PxB;EAAe;;;;AACC;;;;;;;;;;;;;;;;;;;;;6CAlOiB,uCACjC,0BAA0B,OAAO,aAAa,YAAS,QAAA,iBAAA,uBAAA;;KA8FtD,mCAAmC,OAAO,QAAQ;;;;;;;;;KAUlD,2BACT,qBAAqB,QACrB,qBAAqB;;;;;;;;UAgBP;oBACE,gBAAgB;;UAGlB,+DAGC;;cAGL,mBAAmB;;gBAEjB,gBAAgB;;mBAEb;;aAEN,gBAAgB,aAAa;;;;;;KAO7B,8CAEM,yCAEL,iBACN,gBACD,SAAS,KAAK,QAAQ,SAAS;;;;;;;;;KAWzB,uDAEM,0CACA,WAAW,qBAAqB,WAChD,sBAEE;iDAIQ,iBAAiB,eAAe,WAAW,MAChD;kEAMK,iBAAiB,eAAe,WAAW,MAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCS,iDAEE,mCAEP,WAAW,uCAER,aACH,gBAAgB,aAAa,YACrC,yBAAyB,aAAa,UAAU"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { it } from "vitest";
|
|
2
|
-
import crypto from "node:crypto";
|
|
3
|
-
import fs from "node:fs/promises";
|
|
4
|
-
import os from "node:os";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
|
|
7
|
-
//#region src/os/directory.ts
|
|
8
|
-
const itWithDir = it.extend({ dir: async ({}, use) => {
|
|
9
|
-
const tempDir = os.tmpdir();
|
|
10
|
-
const directoryName = crypto.randomUUID().replace(/-/g, "").toUpperCase();
|
|
11
|
-
const dir = path.join(tempDir, directoryName);
|
|
12
|
-
await fs.mkdir(dir, { recursive: true });
|
|
13
|
-
await use(dir);
|
|
14
|
-
await fs.rm(dir, {
|
|
15
|
-
recursive: true,
|
|
16
|
-
force: true
|
|
17
|
-
});
|
|
18
|
-
const keystoreDir = path.join(os.homedir(), ".gkm", directoryName);
|
|
19
|
-
await fs.rm(keystoreDir, {
|
|
20
|
-
recursive: true,
|
|
21
|
-
force: true
|
|
22
|
-
});
|
|
23
|
-
} });
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { itWithDir };
|
|
27
|
-
//# sourceMappingURL=directory-BxjqmtCT.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory-BxjqmtCT.mjs","names":[],"sources":["../src/os/directory.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { it } from 'vitest';\n\nexport const itWithDir = it.extend<DirectoryFixtures>({\n\t// This fixture automatically provides a transaction to each test\n\t// biome-ignore lint/correctness/noEmptyPattern: this has to be like this to satisfy Biome\n\tdir: async ({}, use) => {\n\t\tconst tempDir = os.tmpdir();\n\t\tconst directoryName = crypto.randomUUID().replace(/-/g, '').toUpperCase();\n\t\tconst dir = path.join(tempDir, directoryName);\n\t\tawait fs.mkdir(dir, { recursive: true });\n\t\tawait use(dir);\n\t\tawait fs.rm(dir, { recursive: true, force: true });\n\n\t\t// Clean up keystore directory that may have been created at ~/.gkm/{directoryName}\n\t\tconst keystoreDir = path.join(os.homedir(), '.gkm', directoryName);\n\t\tawait fs.rm(keystoreDir, { recursive: true, force: true });\n\t},\n});\n\nexport interface DirectoryFixtures {\n\tdir: string;\n}\n"],"mappings":";;;;;;;AAMA,MAAa,YAAY,GAAG,OAA0B,EAGrD,KAAK,OAAO,EAAE,EAAE,QAAQ;CACvB,MAAM,UAAU,GAAG,QAAQ;CAC3B,MAAM,gBAAgB,OAAO,YAAY,CAAC,QAAQ,MAAM,GAAG,CAAC,aAAa;CACzE,MAAM,MAAM,KAAK,KAAK,SAAS,cAAc;AAC7C,OAAM,GAAG,MAAM,KAAK,EAAE,WAAW,KAAM,EAAC;AACxC,OAAM,IAAI,IAAI;AACd,OAAM,GAAG,GAAG,KAAK;EAAE,WAAW;EAAM,OAAO;CAAM,EAAC;CAGlD,MAAM,cAAc,KAAK,KAAK,GAAG,SAAS,EAAE,QAAQ,cAAc;AAClE,OAAM,GAAG,GAAG,aAAa;EAAE,WAAW;EAAM,OAAO;CAAM,EAAC;AAC1D,EACD,EAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const vitest = require_chunk.__toESM(require("vitest"));
|
|
3
|
-
const node_crypto = require_chunk.__toESM(require("node:crypto"));
|
|
4
|
-
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
5
|
-
const node_os = require_chunk.__toESM(require("node:os"));
|
|
6
|
-
const node_path = require_chunk.__toESM(require("node:path"));
|
|
7
|
-
|
|
8
|
-
//#region src/os/directory.ts
|
|
9
|
-
const itWithDir = vitest.it.extend({ dir: async ({}, use) => {
|
|
10
|
-
const tempDir = node_os.default.tmpdir();
|
|
11
|
-
const directoryName = node_crypto.default.randomUUID().replace(/-/g, "").toUpperCase();
|
|
12
|
-
const dir = node_path.default.join(tempDir, directoryName);
|
|
13
|
-
await node_fs_promises.default.mkdir(dir, { recursive: true });
|
|
14
|
-
await use(dir);
|
|
15
|
-
await node_fs_promises.default.rm(dir, {
|
|
16
|
-
recursive: true,
|
|
17
|
-
force: true
|
|
18
|
-
});
|
|
19
|
-
const keystoreDir = node_path.default.join(node_os.default.homedir(), ".gkm", directoryName);
|
|
20
|
-
await node_fs_promises.default.rm(keystoreDir, {
|
|
21
|
-
recursive: true,
|
|
22
|
-
force: true
|
|
23
|
-
});
|
|
24
|
-
} });
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
Object.defineProperty(exports, 'itWithDir', {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () {
|
|
30
|
-
return itWithDir;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=directory-DD_xQoSh.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory-DD_xQoSh.cjs","names":[],"sources":["../src/os/directory.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { it } from 'vitest';\n\nexport const itWithDir = it.extend<DirectoryFixtures>({\n\t// This fixture automatically provides a transaction to each test\n\t// biome-ignore lint/correctness/noEmptyPattern: this has to be like this to satisfy Biome\n\tdir: async ({}, use) => {\n\t\tconst tempDir = os.tmpdir();\n\t\tconst directoryName = crypto.randomUUID().replace(/-/g, '').toUpperCase();\n\t\tconst dir = path.join(tempDir, directoryName);\n\t\tawait fs.mkdir(dir, { recursive: true });\n\t\tawait use(dir);\n\t\tawait fs.rm(dir, { recursive: true, force: true });\n\n\t\t// Clean up keystore directory that may have been created at ~/.gkm/{directoryName}\n\t\tconst keystoreDir = path.join(os.homedir(), '.gkm', directoryName);\n\t\tawait fs.rm(keystoreDir, { recursive: true, force: true });\n\t},\n});\n\nexport interface DirectoryFixtures {\n\tdir: string;\n}\n"],"mappings":";;;;;;;;AAMA,MAAa,YAAY,UAAG,OAA0B,EAGrD,KAAK,OAAO,EAAE,EAAE,QAAQ;CACvB,MAAM,UAAU,gBAAG,QAAQ;CAC3B,MAAM,gBAAgB,oBAAO,YAAY,CAAC,QAAQ,MAAM,GAAG,CAAC,aAAa;CACzE,MAAM,MAAM,kBAAK,KAAK,SAAS,cAAc;AAC7C,OAAM,yBAAG,MAAM,KAAK,EAAE,WAAW,KAAM,EAAC;AACxC,OAAM,IAAI,IAAI;AACd,OAAM,yBAAG,GAAG,KAAK;EAAE,WAAW;EAAM,OAAO;CAAM,EAAC;CAGlD,MAAM,cAAc,kBAAK,KAAK,gBAAG,SAAS,EAAE,QAAQ,cAAc;AAClE,OAAM,yBAAG,GAAG,aAAa;EAAE,WAAW;EAAM,OAAO;CAAM,EAAC;AAC1D,EACD,EAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as vitest6 from "vitest";
|
|
2
|
-
|
|
3
|
-
//#region src/os/directory.d.ts
|
|
4
|
-
declare const itWithDir: vitest6.TestAPI<{
|
|
5
|
-
dir: string;
|
|
6
|
-
}>;
|
|
7
|
-
interface DirectoryFixtures {
|
|
8
|
-
dir: string;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=directory.d.ts.map
|
|
11
|
-
//#endregion
|
|
12
|
-
export { DirectoryFixtures, itWithDir };
|
|
13
|
-
//# sourceMappingURL=directory-DGOcVlKD.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory-DGOcVlKD.d.cts","names":[],"sources":["../src/os/directory.ts"],"sourcesContent":[],"mappings":";;;cAMa,WAeX,OAAA,CAfoB;;;AAAT,UAiBI,iBAAA,CAjBK;EAiBL,GAAA,EAAA,MAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as vitest5 from "vitest";
|
|
2
|
-
|
|
3
|
-
//#region src/os/directory.d.ts
|
|
4
|
-
declare const itWithDir: vitest5.TestAPI<{
|
|
5
|
-
dir: string;
|
|
6
|
-
}>;
|
|
7
|
-
interface DirectoryFixtures {
|
|
8
|
-
dir: string;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=directory.d.ts.map
|
|
11
|
-
//#endregion
|
|
12
|
-
export { DirectoryFixtures, itWithDir };
|
|
13
|
-
//# sourceMappingURL=directory-DiQ_DkaF.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory-DiQ_DkaF.d.mts","names":[],"sources":["../src/os/directory.ts"],"sourcesContent":[],"mappings":";;;cAMa,WAeX,OAAA,CAfoB;;;AAAT,UAiBI,iBAAA,CAjBK;EAiBL,GAAA,EAAA,MAAA"}
|
package/dist/faker-B14IEMIN.cjs
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const __faker_js_faker = require_chunk.__toESM(require("@faker-js/faker"));
|
|
3
|
-
|
|
4
|
-
//#region src/faker.ts
|
|
5
|
-
/**
|
|
6
|
-
* Atomic counter implementation for thread-safe sequence generation.
|
|
7
|
-
* Provides a clean abstraction for generating sequential numbers in tests.
|
|
8
|
-
* While JavaScript is single-threaded, this class makes the intent explicit.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const counter = new AtomicCounter(100);
|
|
13
|
-
* console.log(counter.increment()); // 101
|
|
14
|
-
* console.log(counter.increment()); // 102
|
|
15
|
-
* console.log(counter.get()); // 102
|
|
16
|
-
* counter.reset(200);
|
|
17
|
-
* console.log(counter.increment()); // 201
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
var AtomicCounter = class {
|
|
21
|
-
/**
|
|
22
|
-
* The current counter value.
|
|
23
|
-
* @private
|
|
24
|
-
*/
|
|
25
|
-
value;
|
|
26
|
-
/**
|
|
27
|
-
* Creates a new atomic counter.
|
|
28
|
-
* @param initialValue - The starting value (default: 0)
|
|
29
|
-
*/
|
|
30
|
-
constructor(initialValue = 0) {
|
|
31
|
-
this.value = initialValue;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Increments the counter and returns the new value.
|
|
35
|
-
* @returns The incremented value
|
|
36
|
-
*/
|
|
37
|
-
increment() {
|
|
38
|
-
return ++this.value;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Gets the current counter value without incrementing.
|
|
42
|
-
* @returns The current value
|
|
43
|
-
*/
|
|
44
|
-
get() {
|
|
45
|
-
return this.value;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Resets the counter to a specific value.
|
|
49
|
-
* @param value - The new value (default: 0)
|
|
50
|
-
*/
|
|
51
|
-
reset(value = 0) {
|
|
52
|
-
this.value = value;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Generates random timestamp fields for database records.
|
|
57
|
-
* Creates a createdAt date in the past and an updatedAt date between creation and now.
|
|
58
|
-
* Milliseconds are set to 0 for cleaner database storage.
|
|
59
|
-
*
|
|
60
|
-
* @returns Object with createdAt and updatedAt Date fields
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* const { createdAt, updatedAt } = timestamps();
|
|
65
|
-
* console.log(createdAt); // 2023-05-15T10:30:00.000Z
|
|
66
|
-
* console.log(updatedAt); // 2023-11-20T14:45:00.000Z
|
|
67
|
-
*
|
|
68
|
-
* // Use in factory
|
|
69
|
-
* const user = {
|
|
70
|
-
* name: 'John Doe',
|
|
71
|
-
* ...timestamps()
|
|
72
|
-
* };
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
function timestamps() {
|
|
76
|
-
const createdAt = faker.date.past();
|
|
77
|
-
const updatedAt = faker.date.between({
|
|
78
|
-
from: createdAt,
|
|
79
|
-
to: /* @__PURE__ */ new Date()
|
|
80
|
-
});
|
|
81
|
-
createdAt.setMilliseconds(0);
|
|
82
|
-
updatedAt.setMilliseconds(0);
|
|
83
|
-
return {
|
|
84
|
-
createdAt,
|
|
85
|
-
updatedAt
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Generates a reverse domain name identifier.
|
|
90
|
-
* Useful for creating unique identifiers that follow domain naming conventions.
|
|
91
|
-
*
|
|
92
|
-
* @param suffix - Optional suffix to append to the identifier
|
|
93
|
-
* @returns A reverse domain name string (e.g., "com.example.feature123")
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* console.log(identifier()); // "com.example.widget1"
|
|
98
|
-
* console.log(identifier('user')); // "org.acme.user"
|
|
99
|
-
* console.log(identifier('api')); // "net.demo.api"
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
function identifier(suffix) {
|
|
103
|
-
return [
|
|
104
|
-
faker.internet.domainSuffix(),
|
|
105
|
-
faker.internet.domainWord(),
|
|
106
|
-
suffix ? suffix : faker.internet.domainWord() + sequence("identifier")
|
|
107
|
-
].join(".");
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Storage for named sequence counters.
|
|
111
|
-
* Each sequence maintains its own independent counter.
|
|
112
|
-
* @private
|
|
113
|
-
*/
|
|
114
|
-
const sequences = /* @__PURE__ */ new Map();
|
|
115
|
-
/**
|
|
116
|
-
* Generates sequential numbers for a named sequence.
|
|
117
|
-
* Useful for creating unique IDs or numbered test data.
|
|
118
|
-
* Each named sequence maintains its own counter.
|
|
119
|
-
*
|
|
120
|
-
* @param name - The sequence name (default: 'default')
|
|
121
|
-
* @returns The next number in the sequence
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```typescript
|
|
125
|
-
* console.log(sequence()); // 1
|
|
126
|
-
* console.log(sequence()); // 2
|
|
127
|
-
* console.log(sequence('user')); // 1
|
|
128
|
-
* console.log(sequence('user')); // 2
|
|
129
|
-
* console.log(sequence()); // 3
|
|
130
|
-
*
|
|
131
|
-
* // Use in factories
|
|
132
|
-
* const email = `user${sequence('email')}@example.com`;
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
|
-
function sequence(name = "default") {
|
|
136
|
-
if (!sequences.has(name)) sequences.set(name, new AtomicCounter());
|
|
137
|
-
const counter = sequences.get(name);
|
|
138
|
-
return counter.increment();
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Resets a named sequence counter to a specific value.
|
|
142
|
-
* Useful for resetting sequences between test suites.
|
|
143
|
-
*
|
|
144
|
-
* @param name - The sequence name to reset (default: 'default')
|
|
145
|
-
* @param value - The new starting value (default: 0)
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* sequence('user'); // 1
|
|
150
|
-
* sequence('user'); // 2
|
|
151
|
-
* resetSequence('user');
|
|
152
|
-
* sequence('user'); // 1
|
|
153
|
-
*
|
|
154
|
-
* resetSequence('order', 1000);
|
|
155
|
-
* sequence('order'); // 1001
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
function resetSequence(name = "default", value = 0) {
|
|
159
|
-
if (sequences.has(name)) {
|
|
160
|
-
const counter = sequences.get(name);
|
|
161
|
-
counter.reset(value);
|
|
162
|
-
} else sequences.set(name, new AtomicCounter(value));
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Resets all sequence counters.
|
|
166
|
-
* Useful for cleaning up between test suites to ensure predictable sequences.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* // In test setup
|
|
171
|
-
* beforeEach(() => {
|
|
172
|
-
* resetAllSequences();
|
|
173
|
-
* });
|
|
174
|
-
*
|
|
175
|
-
* it('starts sequences from 1', () => {
|
|
176
|
-
* expect(sequence()).toBe(1);
|
|
177
|
-
* expect(sequence('user')).toBe(1);
|
|
178
|
-
* });
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
|
-
function resetAllSequences() {
|
|
182
|
-
sequences.clear();
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Generates a random price as a number.
|
|
186
|
-
* Converts faker's string price to a numeric value.
|
|
187
|
-
*
|
|
188
|
-
* @returns A random price number
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* ```typescript
|
|
192
|
-
* const productPrice = price(); // 29.99
|
|
193
|
-
* const total = price() * quantity; // Numeric calculation
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
function price() {
|
|
197
|
-
return +faker.commerce.price();
|
|
198
|
-
}
|
|
199
|
-
function coordinateInRadius(center, radius) {
|
|
200
|
-
const earth = 6378137;
|
|
201
|
-
const d = radius / earth;
|
|
202
|
-
const theta = 2 * Math.PI * Math.random();
|
|
203
|
-
const r = d * Math.sqrt(Math.random());
|
|
204
|
-
const lat1 = center.lat * Math.PI / 180;
|
|
205
|
-
const lng1 = center.lng * Math.PI / 180;
|
|
206
|
-
const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
|
|
207
|
-
const lng2 = lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2));
|
|
208
|
-
return {
|
|
209
|
-
lat: lat2 * 180 / Math.PI,
|
|
210
|
-
lng: lng2 * 180 / Math.PI
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
function coordinateOutsideRadius(center, minRadiusMeters, maxRadiusMeters) {
|
|
214
|
-
const earth = 6378137;
|
|
215
|
-
const minD = minRadiusMeters / earth;
|
|
216
|
-
const maxD = maxRadiusMeters / earth;
|
|
217
|
-
const theta = 2 * Math.PI * Math.random();
|
|
218
|
-
const r = Math.sqrt(minD * minD + (maxD * maxD - minD * minD) * Math.random());
|
|
219
|
-
const lat1 = center.lat * Math.PI / 180;
|
|
220
|
-
const lng1 = center.lng * Math.PI / 180;
|
|
221
|
-
const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
|
|
222
|
-
const lng2 = lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2));
|
|
223
|
-
const normalizedLng = (lng2 * 180 / Math.PI + 540) % 360 - 180;
|
|
224
|
-
return {
|
|
225
|
-
lat: lat2 * 180 / Math.PI,
|
|
226
|
-
lng: normalizedLng
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Enhanced faker instance with additional utility methods for testing.
|
|
231
|
-
* Extends @faker-js/faker with custom methods for common test data generation patterns.
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```typescript
|
|
235
|
-
* import { faker } from '@geekmidas/testkit';
|
|
236
|
-
*
|
|
237
|
-
* // Use standard faker methods
|
|
238
|
-
* const name = faker.person.fullName();
|
|
239
|
-
* const email = faker.internet.email();
|
|
240
|
-
*
|
|
241
|
-
* // Use custom extensions
|
|
242
|
-
* const { createdAt, updatedAt } = faker.timestamps();
|
|
243
|
-
* const id = faker.identifier('user');
|
|
244
|
-
* const orderNumber = faker.sequence('order');
|
|
245
|
-
* const productPrice = faker.price();
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
const faker = Object.freeze(Object.assign({}, __faker_js_faker.faker, {
|
|
249
|
-
timestamps,
|
|
250
|
-
identifier,
|
|
251
|
-
sequence,
|
|
252
|
-
resetSequence,
|
|
253
|
-
resetAllSequences,
|
|
254
|
-
price,
|
|
255
|
-
coordinates: {
|
|
256
|
-
within: coordinateInRadius,
|
|
257
|
-
outside: coordinateOutsideRadius
|
|
258
|
-
}
|
|
259
|
-
}));
|
|
260
|
-
|
|
261
|
-
//#endregion
|
|
262
|
-
Object.defineProperty(exports, 'coordinateInRadius', {
|
|
263
|
-
enumerable: true,
|
|
264
|
-
get: function () {
|
|
265
|
-
return coordinateInRadius;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
Object.defineProperty(exports, 'faker', {
|
|
269
|
-
enumerable: true,
|
|
270
|
-
get: function () {
|
|
271
|
-
return faker;
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
Object.defineProperty(exports, 'identifier', {
|
|
275
|
-
enumerable: true,
|
|
276
|
-
get: function () {
|
|
277
|
-
return identifier;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
Object.defineProperty(exports, 'resetAllSequences', {
|
|
281
|
-
enumerable: true,
|
|
282
|
-
get: function () {
|
|
283
|
-
return resetAllSequences;
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
Object.defineProperty(exports, 'resetSequence', {
|
|
287
|
-
enumerable: true,
|
|
288
|
-
get: function () {
|
|
289
|
-
return resetSequence;
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
Object.defineProperty(exports, 'sequence', {
|
|
293
|
-
enumerable: true,
|
|
294
|
-
get: function () {
|
|
295
|
-
return sequence;
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
Object.defineProperty(exports, 'timestamps', {
|
|
299
|
-
enumerable: true,
|
|
300
|
-
get: function () {
|
|
301
|
-
return timestamps;
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
//# sourceMappingURL=faker-B14IEMIN.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"faker-B14IEMIN.cjs","names":["suffix?: string","center: Coordinate","radius: number","minRadiusMeters: number","maxRadiusMeters: number","baseFaker"],"sources":["../src/faker.ts"],"sourcesContent":["import { faker as baseFaker } from '@faker-js/faker';\n\n// NOTE: This is a simple way to extend `faker` with additional methods\n\n/**\n * Atomic counter implementation for thread-safe sequence generation.\n * Provides a clean abstraction for generating sequential numbers in tests.\n * While JavaScript is single-threaded, this class makes the intent explicit.\n *\n * @example\n * ```typescript\n * const counter = new AtomicCounter(100);\n * console.log(counter.increment()); // 101\n * console.log(counter.increment()); // 102\n * console.log(counter.get()); // 102\n * counter.reset(200);\n * console.log(counter.increment()); // 201\n * ```\n */\nclass AtomicCounter {\n\t/**\n\t * The current counter value.\n\t * @private\n\t */\n\tprivate value: number;\n\n\t/**\n\t * Creates a new atomic counter.\n\t * @param initialValue - The starting value (default: 0)\n\t */\n\tconstructor(initialValue = 0) {\n\t\tthis.value = initialValue;\n\t}\n\n\t/**\n\t * Increments the counter and returns the new value.\n\t * @returns The incremented value\n\t */\n\tincrement(): number {\n\t\t// In Node.js, JavaScript is single-threaded within the event loop,\n\t\t// so this operation is already atomic. However, this class provides\n\t\t// a cleaner abstraction and makes the intent explicit.\n\t\treturn ++this.value;\n\t}\n\n\t/**\n\t * Gets the current counter value without incrementing.\n\t * @returns The current value\n\t */\n\tget(): number {\n\t\treturn this.value;\n\t}\n\n\t/**\n\t * Resets the counter to a specific value.\n\t * @param value - The new value (default: 0)\n\t */\n\treset(value = 0): void {\n\t\tthis.value = value;\n\t}\n}\n\n/**\n * Generates random timestamp fields for database records.\n * Creates a createdAt date in the past and an updatedAt date between creation and now.\n * Milliseconds are set to 0 for cleaner database storage.\n *\n * @returns Object with createdAt and updatedAt Date fields\n *\n * @example\n * ```typescript\n * const { createdAt, updatedAt } = timestamps();\n * console.log(createdAt); // 2023-05-15T10:30:00.000Z\n * console.log(updatedAt); // 2023-11-20T14:45:00.000Z\n *\n * // Use in factory\n * const user = {\n * name: 'John Doe',\n * ...timestamps()\n * };\n * ```\n */\nexport function timestamps(): Timestamps {\n\tconst createdAt = faker.date.past();\n\tconst updatedAt = faker.date.between({\n\t\tfrom: createdAt,\n\t\tto: new Date(),\n\t});\n\n\tcreatedAt.setMilliseconds(0);\n\tupdatedAt.setMilliseconds(0);\n\n\treturn { createdAt, updatedAt };\n}\n\n/**\n * Generates a reverse domain name identifier.\n * Useful for creating unique identifiers that follow domain naming conventions.\n *\n * @param suffix - Optional suffix to append to the identifier\n * @returns A reverse domain name string (e.g., \"com.example.feature123\")\n *\n * @example\n * ```typescript\n * console.log(identifier()); // \"com.example.widget1\"\n * console.log(identifier('user')); // \"org.acme.user\"\n * console.log(identifier('api')); // \"net.demo.api\"\n * ```\n */\nexport function identifier(suffix?: string): string {\n\treturn [\n\t\tfaker.internet.domainSuffix(),\n\t\tfaker.internet.domainWord(),\n\t\tsuffix ? suffix : faker.internet.domainWord() + sequence('identifier'),\n\t].join('.');\n}\n\n/**\n * Storage for named sequence counters.\n * Each sequence maintains its own independent counter.\n * @private\n */\nconst sequences = new Map<string, AtomicCounter>();\n\n/**\n * Generates sequential numbers for a named sequence.\n * Useful for creating unique IDs or numbered test data.\n * Each named sequence maintains its own counter.\n *\n * @param name - The sequence name (default: 'default')\n * @returns The next number in the sequence\n *\n * @example\n * ```typescript\n * console.log(sequence()); // 1\n * console.log(sequence()); // 2\n * console.log(sequence('user')); // 1\n * console.log(sequence('user')); // 2\n * console.log(sequence()); // 3\n *\n * // Use in factories\n * const email = `user${sequence('email')}@example.com`;\n * ```\n */\nexport function sequence(name = 'default'): number {\n\tif (!sequences.has(name)) {\n\t\tsequences.set(name, new AtomicCounter());\n\t}\n\n\tconst counter = sequences.get(name) as AtomicCounter;\n\treturn counter.increment();\n}\n\n/**\n * Resets a named sequence counter to a specific value.\n * Useful for resetting sequences between test suites.\n *\n * @param name - The sequence name to reset (default: 'default')\n * @param value - The new starting value (default: 0)\n *\n * @example\n * ```typescript\n * sequence('user'); // 1\n * sequence('user'); // 2\n * resetSequence('user');\n * sequence('user'); // 1\n *\n * resetSequence('order', 1000);\n * sequence('order'); // 1001\n * ```\n */\nexport function resetSequence(name = 'default', value = 0): void {\n\tif (sequences.has(name)) {\n\t\tconst counter = sequences.get(name) as AtomicCounter;\n\t\tcounter.reset(value);\n\t} else {\n\t\tsequences.set(name, new AtomicCounter(value));\n\t}\n}\n\n/**\n * Resets all sequence counters.\n * Useful for cleaning up between test suites to ensure predictable sequences.\n *\n * @example\n * ```typescript\n * // In test setup\n * beforeEach(() => {\n * resetAllSequences();\n * });\n *\n * it('starts sequences from 1', () => {\n * expect(sequence()).toBe(1);\n * expect(sequence('user')).toBe(1);\n * });\n * ```\n */\nexport function resetAllSequences(): void {\n\tsequences.clear();\n}\n\n/**\n * Generates a random price as a number.\n * Converts faker's string price to a numeric value.\n *\n * @returns A random price number\n *\n * @example\n * ```typescript\n * const productPrice = price(); // 29.99\n * const total = price() * quantity; // Numeric calculation\n * ```\n */\nfunction price(): number {\n\treturn +faker.commerce.price();\n}\n\ntype Coordinate = {\n\tlat: number;\n\tlng: number;\n};\n\nexport function coordinateInRadius(\n\tcenter: Coordinate,\n\tradius: number,\n): Coordinate {\n\t// Earth's radius in meters\n\tconst earth = 6378137;\n\t// Convert radius from meters to degrees\n\tconst d = radius / earth;\n\n\t// Random bearing and distance\n\tconst theta = 2 * Math.PI * Math.random();\n\tconst r = d * Math.sqrt(Math.random());\n\n\tconst lat1 = (center.lat * Math.PI) / 180;\n\tconst lng1 = (center.lng * Math.PI) / 180;\n\n\tconst lat2 = Math.asin(\n\t\tMath.sin(lat1) * Math.cos(r) +\n\t\t\tMath.cos(lat1) * Math.sin(r) * Math.cos(theta),\n\t);\n\tconst lng2 =\n\t\tlng1 +\n\t\tMath.atan2(\n\t\t\tMath.sin(theta) * Math.sin(r) * Math.cos(lat1),\n\t\t\tMath.cos(r) - Math.sin(lat1) * Math.sin(lat2),\n\t\t);\n\n\treturn {\n\t\tlat: (lat2 * 180) / Math.PI,\n\t\tlng: (lng2 * 180) / Math.PI,\n\t};\n}\n\nfunction coordinateOutsideRadius(\n\tcenter: Coordinate,\n\tminRadiusMeters: number,\n\tmaxRadiusMeters: number,\n): Coordinate {\n\t// Earth's radius in meters\n\tconst earth = 6378137;\n\n\t// Convert radii from meters to radians\n\tconst minD = minRadiusMeters / earth;\n\tconst maxD = maxRadiusMeters / earth;\n\n\t// Random bearing\n\tconst theta = 2 * Math.PI * Math.random();\n\n\t// Random distance in annular ring (uniform distribution by area)\n\t// For uniform distribution in annulus: r = sqrt(r_min² + (r_max² - r_min²) * random)\n\tconst r = Math.sqrt(\n\t\tminD * minD + (maxD * maxD - minD * minD) * Math.random(),\n\t);\n\n\tconst lat1 = (center.lat * Math.PI) / 180;\n\tconst lng1 = (center.lng * Math.PI) / 180;\n\n\tconst lat2 = Math.asin(\n\t\tMath.sin(lat1) * Math.cos(r) +\n\t\t\tMath.cos(lat1) * Math.sin(r) * Math.cos(theta),\n\t);\n\tconst lng2 =\n\t\tlng1 +\n\t\tMath.atan2(\n\t\t\tMath.sin(theta) * Math.sin(r) * Math.cos(lat1),\n\t\t\tMath.cos(r) - Math.sin(lat1) * Math.sin(lat2),\n\t\t);\n\n\t// Normalize longitude to [-180, 180]\n\tconst normalizedLng = (((lng2 * 180) / Math.PI + 540) % 360) - 180;\n\n\treturn {\n\t\tlat: (lat2 * 180) / Math.PI,\n\t\tlng: normalizedLng,\n\t};\n}\n\n/**\n * Enhanced faker instance with additional utility methods for testing.\n * Extends @faker-js/faker with custom methods for common test data generation patterns.\n *\n * @example\n * ```typescript\n * import { faker } from '@geekmidas/testkit';\n *\n * // Use standard faker methods\n * const name = faker.person.fullName();\n * const email = faker.internet.email();\n *\n * // Use custom extensions\n * const { createdAt, updatedAt } = faker.timestamps();\n * const id = faker.identifier('user');\n * const orderNumber = faker.sequence('order');\n * const productPrice = faker.price();\n * ```\n */\nexport const faker = Object.freeze(\n\tObject.assign({}, baseFaker, {\n\t\ttimestamps,\n\t\tidentifier,\n\t\tsequence,\n\t\tresetSequence,\n\t\tresetAllSequences,\n\t\tprice,\n\t\tcoordinates: {\n\t\t\twithin: coordinateInRadius,\n\t\t\toutside: coordinateOutsideRadius,\n\t\t},\n\t}),\n);\n\n/**\n * Type definition for timestamp fields.\n * Used by the timestamps() function to generate date fields.\n */\nexport type Timestamps = {\n\t/** The creation date */\n\tcreatedAt: Date;\n\t/** The last update date */\n\tupdatedAt: Date;\n};\n\n/**\n * Type definition for the enhanced faker factory.\n * Includes all standard faker methods plus custom extensions.\n */\nexport type FakerFactory = typeof faker;\n"],"mappings":"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"}
|