@geekmidas/testkit 10.0.0-alpha.4 → 10.0.0-alpha.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/README.md +74 -0
  2. package/dist/Factory.cjs +51 -2
  3. package/dist/Factory.cjs.map +1 -0
  4. package/dist/Factory.d.cts +143 -3
  5. package/dist/Factory.d.cts.map +1 -0
  6. package/dist/Factory.d.mts +143 -3
  7. package/dist/Factory.d.mts.map +1 -0
  8. package/dist/Factory.mjs +50 -2
  9. package/dist/Factory.mjs.map +1 -0
  10. package/dist/KyselyFactory.cjs +237 -4
  11. package/dist/KyselyFactory.cjs.map +1 -0
  12. package/dist/KyselyFactory.d.cts +224 -4
  13. package/dist/KyselyFactory.d.cts.map +1 -0
  14. package/dist/KyselyFactory.d.mts +224 -4
  15. package/dist/KyselyFactory.d.mts.map +1 -0
  16. package/dist/KyselyFactory.mjs +236 -4
  17. package/dist/KyselyFactory.mjs.map +1 -0
  18. package/dist/ObjectionFactory.cjs +265 -4
  19. package/dist/ObjectionFactory.cjs.map +1 -0
  20. package/dist/ObjectionFactory.d.cts +237 -4
  21. package/dist/ObjectionFactory.d.cts.map +1 -0
  22. package/dist/ObjectionFactory.d.mts +237 -4
  23. package/dist/ObjectionFactory.d.mts.map +1 -0
  24. package/dist/ObjectionFactory.mjs +264 -4
  25. package/dist/ObjectionFactory.mjs.map +1 -0
  26. package/dist/PostgresKyselyMigrator.cjs +94 -3
  27. package/dist/PostgresKyselyMigrator.cjs.map +1 -0
  28. package/dist/PostgresKyselyMigrator.d.cts +80 -3
  29. package/dist/PostgresKyselyMigrator.d.cts.map +1 -0
  30. package/dist/PostgresKyselyMigrator.d.mts +80 -3
  31. package/dist/PostgresKyselyMigrator.d.mts.map +1 -0
  32. package/dist/PostgresKyselyMigrator.mjs +93 -3
  33. package/dist/PostgresKyselyMigrator.mjs.map +1 -0
  34. package/dist/{PostgresMigrator-C_QQ6q35.d.mts → PostgresMigrator-CDPnnwMJ.d.cts} +11 -5
  35. package/dist/PostgresMigrator-CDPnnwMJ.d.cts.map +1 -0
  36. package/dist/{PostgresMigrator-CeYy-eHF.d.cts → PostgresMigrator-CDPnnwMJ.d.mts} +11 -5
  37. package/dist/PostgresMigrator-CDPnnwMJ.d.mts.map +1 -0
  38. package/dist/PostgresMigrator.cjs +178 -2
  39. package/dist/PostgresMigrator.cjs.map +1 -0
  40. package/dist/PostgresMigrator.d.cts +1 -1
  41. package/dist/PostgresMigrator.d.mts +1 -1
  42. package/dist/PostgresMigrator.mjs +175 -2
  43. package/dist/PostgresMigrator.mjs.map +1 -0
  44. package/dist/PostgresObjectionMigrator.cjs +118 -3
  45. package/dist/PostgresObjectionMigrator.cjs.map +1 -0
  46. package/dist/PostgresObjectionMigrator.d.cts +75 -3
  47. package/dist/PostgresObjectionMigrator.d.cts.map +1 -0
  48. package/dist/PostgresObjectionMigrator.d.mts +75 -3
  49. package/dist/PostgresObjectionMigrator.d.mts.map +1 -0
  50. package/dist/PostgresObjectionMigrator.mjs +117 -3
  51. package/dist/PostgresObjectionMigrator.mjs.map +1 -0
  52. package/dist/VitestKyselyTransactionIsolator.cjs +66 -3
  53. package/dist/VitestKyselyTransactionIsolator.cjs.map +1 -0
  54. package/dist/VitestKyselyTransactionIsolator.d.cts +60 -3
  55. package/dist/VitestKyselyTransactionIsolator.d.cts.map +1 -0
  56. package/dist/VitestKyselyTransactionIsolator.d.mts +60 -3
  57. package/dist/VitestKyselyTransactionIsolator.d.mts.map +1 -0
  58. package/dist/VitestKyselyTransactionIsolator.mjs +65 -3
  59. package/dist/VitestKyselyTransactionIsolator.mjs.map +1 -0
  60. package/dist/VitestObjectionTransactionIsolator.cjs +62 -3
  61. package/dist/VitestObjectionTransactionIsolator.cjs.map +1 -0
  62. package/dist/VitestObjectionTransactionIsolator.d.cts +56 -3
  63. package/dist/VitestObjectionTransactionIsolator.d.cts.map +1 -0
  64. package/dist/VitestObjectionTransactionIsolator.d.mts +56 -3
  65. package/dist/VitestObjectionTransactionIsolator.d.mts.map +1 -0
  66. package/dist/VitestObjectionTransactionIsolator.mjs +61 -3
  67. package/dist/VitestObjectionTransactionIsolator.mjs.map +1 -0
  68. package/dist/VitestTransactionIsolator.cjs +187 -4
  69. package/dist/VitestTransactionIsolator.cjs.map +1 -0
  70. package/dist/VitestTransactionIsolator.d.cts +219 -2
  71. package/dist/VitestTransactionIsolator.d.cts.map +1 -0
  72. package/dist/VitestTransactionIsolator.d.mts +219 -2
  73. package/dist/VitestTransactionIsolator.d.mts.map +1 -0
  74. package/dist/VitestTransactionIsolator.mjs +184 -2
  75. package/dist/VitestTransactionIsolator.mjs.map +1 -0
  76. package/dist/aws.cjs +3 -4
  77. package/dist/aws.cjs.map +1 -1
  78. package/dist/aws.d.cts +3 -8
  79. package/dist/aws.d.cts.map +1 -1
  80. package/dist/aws.d.mts +3 -8
  81. package/dist/aws.d.mts.map +1 -1
  82. package/dist/aws.mjs +1 -2
  83. package/dist/aws.mjs.map +1 -1
  84. package/dist/benchmark.cjs +2 -2
  85. package/dist/benchmark.cjs.map +1 -1
  86. package/dist/benchmark.d.cts +4 -6
  87. package/dist/benchmark.d.cts.map +1 -1
  88. package/dist/benchmark.d.mts +4 -6
  89. package/dist/benchmark.d.mts.map +1 -1
  90. package/dist/benchmark.mjs +1 -1
  91. package/dist/benchmark.mjs.map +1 -1
  92. package/dist/better-auth.cjs +17 -8
  93. package/dist/better-auth.cjs.map +1 -1
  94. package/dist/better-auth.d.cts +13142 -5
  95. package/dist/better-auth.d.cts.map +1 -1
  96. package/dist/better-auth.d.mts +13142 -5
  97. package/dist/better-auth.d.mts.map +1 -1
  98. package/dist/better-auth.mjs +15 -6
  99. package/dist/better-auth.mjs.map +1 -1
  100. package/dist/browser.cjs +127 -0
  101. package/dist/browser.cjs.map +1 -0
  102. package/dist/browser.d.cts +47 -0
  103. package/dist/browser.d.cts.map +1 -0
  104. package/dist/browser.d.mts +47 -0
  105. package/dist/browser.d.mts.map +1 -0
  106. package/dist/browser.mjs +125 -0
  107. package/dist/browser.mjs.map +1 -0
  108. package/dist/context.cjs +80 -0
  109. package/dist/context.cjs.map +1 -0
  110. package/dist/context.d.cts +55 -0
  111. package/dist/context.d.cts.map +1 -0
  112. package/dist/context.d.mts +55 -0
  113. package/dist/context.d.mts.map +1 -0
  114. package/dist/context.mjs +73 -0
  115. package/dist/context.mjs.map +1 -0
  116. package/dist/faker.cjs +313 -8
  117. package/dist/faker.cjs.map +1 -0
  118. package/dist/faker.d.cts +169 -2
  119. package/dist/faker.d.cts.map +1 -0
  120. package/dist/faker.d.mts +169 -2
  121. package/dist/faker.d.mts.map +1 -0
  122. package/dist/faker.mjs +305 -2
  123. package/dist/faker.mjs.map +1 -0
  124. package/dist/helpers.cjs +6 -5
  125. package/dist/helpers.cjs.map +1 -1
  126. package/dist/helpers.d.cts +1 -5
  127. package/dist/helpers.d.cts.map +1 -1
  128. package/dist/helpers.d.mts +1 -5
  129. package/dist/helpers.d.mts.map +1 -1
  130. package/dist/helpers.mjs +1 -2
  131. package/dist/helpers.mjs.map +1 -1
  132. package/dist/initScript.cjs +15 -15
  133. package/dist/initScript.cjs.map +1 -1
  134. package/dist/initScript.d.cts +2 -4
  135. package/dist/initScript.d.cts.map +1 -1
  136. package/dist/initScript.d.mts +2 -4
  137. package/dist/initScript.d.mts.map +1 -1
  138. package/dist/initScript.mjs +10 -12
  139. package/dist/initScript.mjs.map +1 -1
  140. package/dist/kysely.cjs +10 -13
  141. package/dist/kysely.cjs.map +1 -1
  142. package/dist/kysely.d.cts +10 -14
  143. package/dist/kysely.d.cts.map +1 -1
  144. package/dist/kysely.d.mts +10 -14
  145. package/dist/kysely.d.mts.map +1 -1
  146. package/dist/kysely.mjs +10 -14
  147. package/dist/kysely.mjs.map +1 -1
  148. package/dist/logger.cjs +3 -4
  149. package/dist/logger.cjs.map +1 -1
  150. package/dist/logger.d.cts +1 -5
  151. package/dist/logger.d.cts.map +1 -1
  152. package/dist/logger.d.mts +1 -5
  153. package/dist/logger.d.mts.map +1 -1
  154. package/dist/logger.mjs +1 -2
  155. package/dist/logger.mjs.map +1 -1
  156. package/dist/mailbox.cjs +95 -0
  157. package/dist/mailbox.cjs.map +1 -0
  158. package/dist/mailbox.d.cts +58 -0
  159. package/dist/mailbox.d.cts.map +1 -0
  160. package/dist/mailbox.d.mts +58 -0
  161. package/dist/mailbox.d.mts.map +1 -0
  162. package/dist/mailbox.mjs +92 -0
  163. package/dist/mailbox.mjs.map +1 -0
  164. package/dist/objection.cjs +10 -13
  165. package/dist/objection.cjs.map +1 -1
  166. package/dist/objection.d.cts +10 -14
  167. package/dist/objection.d.cts.map +1 -1
  168. package/dist/objection.d.mts +10 -14
  169. package/dist/objection.d.mts.map +1 -1
  170. package/dist/objection.mjs +10 -14
  171. package/dist/objection.mjs.map +1 -1
  172. package/dist/os/directory.cjs +31 -2
  173. package/dist/os/directory.cjs.map +1 -0
  174. package/dist/os/directory.d.cts +9 -2
  175. package/dist/os/directory.d.cts.map +1 -0
  176. package/dist/os/directory.d.mts +9 -2
  177. package/dist/os/directory.d.mts.map +1 -0
  178. package/dist/os/directory.mjs +25 -2
  179. package/dist/os/directory.mjs.map +1 -0
  180. package/dist/os/index.cjs +3 -3
  181. package/dist/os/index.d.cts +1 -1
  182. package/dist/os/index.d.mts +1 -1
  183. package/dist/os/index.mjs +2 -3
  184. package/dist/requestContext.cjs +10 -11
  185. package/dist/requestContext.cjs.map +1 -1
  186. package/dist/requestContext.d.cts +4 -8
  187. package/dist/requestContext.d.cts.map +1 -1
  188. package/dist/requestContext.d.mts +4 -8
  189. package/dist/requestContext.d.mts.map +1 -1
  190. package/dist/requestContext.mjs +1 -2
  191. package/dist/requestContext.mjs.map +1 -1
  192. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-VH7oDXx4.cjs} +8 -10
  193. package/dist/timer.cjs +2 -2
  194. package/dist/timer.cjs.map +1 -1
  195. package/dist/timer.d.cts +1 -4
  196. package/dist/timer.d.cts.map +1 -1
  197. package/dist/timer.d.mts +1 -4
  198. package/dist/timer.d.mts.map +1 -1
  199. package/dist/timer.mjs +1 -1
  200. package/dist/timer.mjs.map +1 -1
  201. package/dist/transactions.cjs +123 -0
  202. package/dist/transactions.cjs.map +1 -0
  203. package/dist/transactions.d.cts +44 -0
  204. package/dist/transactions.d.cts.map +1 -0
  205. package/dist/transactions.d.mts +44 -0
  206. package/dist/transactions.d.mts.map +1 -0
  207. package/dist/transactions.mjs +118 -0
  208. package/dist/transactions.mjs.map +1 -0
  209. package/package.json +51 -8
  210. package/dist/Factory-AWn1IulI.d.cts +0 -147
  211. package/dist/Factory-AWn1IulI.d.cts.map +0 -1
  212. package/dist/Factory-BFVnMMCC.mjs +0 -51
  213. package/dist/Factory-BFVnMMCC.mjs.map +0 -1
  214. package/dist/Factory-BhjUOBWN.cjs +0 -57
  215. package/dist/Factory-BhjUOBWN.cjs.map +0 -1
  216. package/dist/Factory-C15SSK8_.d.mts +0 -147
  217. package/dist/Factory-C15SSK8_.d.mts.map +0 -1
  218. package/dist/KyselyFactory-BFqVIn_0.cjs +0 -246
  219. package/dist/KyselyFactory-BFqVIn_0.cjs.map +0 -1
  220. package/dist/KyselyFactory-C9Snz24z.d.mts +0 -228
  221. package/dist/KyselyFactory-C9Snz24z.d.mts.map +0 -1
  222. package/dist/KyselyFactory-CxUJCi--.d.cts +0 -228
  223. package/dist/KyselyFactory-CxUJCi--.d.cts.map +0 -1
  224. package/dist/KyselyFactory-DMswpwji.mjs +0 -241
  225. package/dist/KyselyFactory-DMswpwji.mjs.map +0 -1
  226. package/dist/ObjectionFactory-BeFBYcan.cjs +0 -272
  227. package/dist/ObjectionFactory-BeFBYcan.cjs.map +0 -1
  228. package/dist/ObjectionFactory-CYvaa0kU.d.cts +0 -241
  229. package/dist/ObjectionFactory-CYvaa0kU.d.cts.map +0 -1
  230. package/dist/ObjectionFactory-Cf2WI4o_.d.mts +0 -241
  231. package/dist/ObjectionFactory-Cf2WI4o_.d.mts.map +0 -1
  232. package/dist/ObjectionFactory-QCJ7u0Ql.mjs +0 -267
  233. package/dist/ObjectionFactory-QCJ7u0Ql.mjs.map +0 -1
  234. package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts +0 -84
  235. package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts.map +0 -1
  236. package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs +0 -101
  237. package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs.map +0 -1
  238. package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts +0 -84
  239. package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts.map +0 -1
  240. package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs +0 -95
  241. package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs.map +0 -1
  242. package/dist/PostgresMigrator-C_QQ6q35.d.mts.map +0 -1
  243. package/dist/PostgresMigrator-CeYy-eHF.d.cts.map +0 -1
  244. package/dist/PostgresMigrator-DVAY04qN.mjs +0 -166
  245. package/dist/PostgresMigrator-DVAY04qN.mjs.map +0 -1
  246. package/dist/PostgresMigrator-M9jpzOvN.cjs +0 -172
  247. package/dist/PostgresMigrator-M9jpzOvN.cjs.map +0 -1
  248. package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts +0 -79
  249. package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts.map +0 -1
  250. package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts +0 -79
  251. package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts.map +0 -1
  252. package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs +0 -123
  253. package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs.map +0 -1
  254. package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs +0 -118
  255. package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs.map +0 -1
  256. package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs +0 -67
  257. package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs.map +0 -1
  258. package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs +0 -72
  259. package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs.map +0 -1
  260. package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts +0 -64
  261. package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts.map +0 -1
  262. package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts +0 -64
  263. package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts.map +0 -1
  264. package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs +0 -63
  265. package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs.map +0 -1
  266. package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts +0 -60
  267. package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts.map +0 -1
  268. package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts +0 -60
  269. package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts.map +0 -1
  270. package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs +0 -68
  271. package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs.map +0 -1
  272. package/dist/VitestTransactionIsolator-BLaw80cx.d.mts +0 -223
  273. package/dist/VitestTransactionIsolator-BLaw80cx.d.mts.map +0 -1
  274. package/dist/VitestTransactionIsolator-CvwPecpl.mjs +0 -188
  275. package/dist/VitestTransactionIsolator-CvwPecpl.mjs.map +0 -1
  276. package/dist/VitestTransactionIsolator-DyiX-QtK.cjs +0 -206
  277. package/dist/VitestTransactionIsolator-DyiX-QtK.cjs.map +0 -1
  278. package/dist/VitestTransactionIsolator-glcxyS_R.d.cts +0 -223
  279. package/dist/VitestTransactionIsolator-glcxyS_R.d.cts.map +0 -1
  280. package/dist/directory-BxjqmtCT.mjs +0 -27
  281. package/dist/directory-BxjqmtCT.mjs.map +0 -1
  282. package/dist/directory-DD_xQoSh.cjs +0 -33
  283. package/dist/directory-DD_xQoSh.cjs.map +0 -1
  284. package/dist/directory-DiQ_DkaF.d.mts +0 -13
  285. package/dist/directory-DiQ_DkaF.d.mts.map +0 -1
  286. package/dist/directory-zIEh5ZPl.d.cts +0 -13
  287. package/dist/directory-zIEh5ZPl.d.cts.map +0 -1
  288. package/dist/faker-B14IEMIN.cjs +0 -304
  289. package/dist/faker-B14IEMIN.cjs.map +0 -1
  290. package/dist/faker-B6bmbGCM.d.mts +0 -166
  291. package/dist/faker-B6bmbGCM.d.mts.map +0 -1
  292. package/dist/faker-BGKYFoCT.mjs +0 -262
  293. package/dist/faker-BGKYFoCT.mjs.map +0 -1
  294. package/dist/faker-DvxiCtxc.d.cts +0 -166
  295. package/dist/faker-DvxiCtxc.d.cts.map +0 -1
package/dist/faker.d.mts CHANGED
@@ -1,2 +1,169 @@
1
- import { FakerFactory, Timestamps, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-B6bmbGCM.mjs";
2
- export { FakerFactory, Timestamps, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
1
+ //#region src/faker.d.ts
2
+ /**
3
+ * Generates random timestamp fields for database records.
4
+ * Creates a createdAt date in the past and an updatedAt date between creation and now.
5
+ * Milliseconds are set to 0 for cleaner database storage.
6
+ *
7
+ * @returns Object with createdAt and updatedAt Date fields
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const { createdAt, updatedAt } = timestamps();
12
+ * console.log(createdAt); // 2023-05-15T10:30:00.000Z
13
+ * console.log(updatedAt); // 2023-11-20T14:45:00.000Z
14
+ *
15
+ * // Use in factory
16
+ * const user = {
17
+ * name: 'John Doe',
18
+ * ...timestamps()
19
+ * };
20
+ * ```
21
+ */
22
+ export declare function timestamps(): Timestamps;
23
+ /**
24
+ * Generates a reverse domain name identifier.
25
+ * Useful for creating unique identifiers that follow domain naming conventions.
26
+ *
27
+ * @param suffix - Optional suffix to append to the identifier
28
+ * @returns A reverse domain name string (e.g., "com.example.feature123")
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * console.log(identifier()); // "com.example.widget1"
33
+ * console.log(identifier('user')); // "org.acme.user"
34
+ * console.log(identifier('api')); // "net.demo.api"
35
+ * ```
36
+ */
37
+ export declare function identifier(suffix?: string): string;
38
+ /**
39
+ * Generates sequential numbers for a named sequence.
40
+ * Useful for creating unique IDs or numbered test data.
41
+ * Each named sequence maintains its own counter.
42
+ *
43
+ * @param name - The sequence name (default: 'default')
44
+ * @returns The next number in the sequence
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * console.log(sequence()); // 1
49
+ * console.log(sequence()); // 2
50
+ * console.log(sequence('user')); // 1
51
+ * console.log(sequence('user')); // 2
52
+ * console.log(sequence()); // 3
53
+ *
54
+ * // Use in factories
55
+ * const email = `user${sequence('email')}@example.com`;
56
+ * ```
57
+ */
58
+ export declare function sequence(name?: string): number;
59
+ /**
60
+ * Resets a named sequence counter to a specific value.
61
+ * Useful for resetting sequences between test suites.
62
+ *
63
+ * @param name - The sequence name to reset (default: 'default')
64
+ * @param value - The new starting value (default: 0)
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * sequence('user'); // 1
69
+ * sequence('user'); // 2
70
+ * resetSequence('user');
71
+ * sequence('user'); // 1
72
+ *
73
+ * resetSequence('order', 1000);
74
+ * sequence('order'); // 1001
75
+ * ```
76
+ */
77
+ export declare function resetSequence(name?: string, value?: number): void;
78
+ /**
79
+ * Resets all sequence counters.
80
+ * Useful for cleaning up between test suites to ensure predictable sequences.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // In test setup
85
+ * beforeEach(() => {
86
+ * resetAllSequences();
87
+ * });
88
+ *
89
+ * it('starts sequences from 1', () => {
90
+ * expect(sequence()).toBe(1);
91
+ * expect(sequence('user')).toBe(1);
92
+ * });
93
+ * ```
94
+ */
95
+ export declare function resetAllSequences(): void;
96
+ /**
97
+ * Generates a random price as a number.
98
+ * Converts faker's string price to a numeric value.
99
+ *
100
+ * @returns A random price number
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const productPrice = price(); // 29.99
105
+ * const total = price() * quantity; // Numeric calculation
106
+ * ```
107
+ */
108
+ declare function price(): number;
109
+ /**
110
+ * A birthdate for someone of the given age today: exactly `min` years old, or
111
+ * anywhere from `min` to `max` inclusive.
112
+ *
113
+ * Through faker's own `date.birthdate`, so seeding faker makes it repeatable.
114
+ *
115
+ * @param min - The youngest age, in whole years
116
+ * @param max - The oldest age, in whole years (default: `min`)
117
+ * @returns The birthdate
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * faker.age(18); // someone who is 18 today
122
+ * faker.age(18, 24); // someone aged 18 to 24
123
+ * ```
124
+ */
125
+ declare function age(min: number, max?: number): Date;
126
+ /** An age range no one can be: a negative age, or an oldest below a youngest. */
127
+ export declare class AgeRangeInvalid extends Error {
128
+ readonly min: number;
129
+ readonly max: number;
130
+ constructor(min: number, max: number);
131
+ }
132
+ type Coordinate = {
133
+ lat: number;
134
+ lng: number;
135
+ };
136
+ export declare function coordinateInRadius(center: Coordinate, radius: number): Coordinate;
137
+ declare function coordinateOutsideRadius(center: Coordinate, minRadiusMeters: number, maxRadiusMeters: number): Coordinate;
138
+ export declare const faker: Readonly<import("@faker-js/faker").Faker & {
139
+ internet: import("@faker-js/faker").InternetModule;
140
+ seed: (seed?: number) => number;
141
+ timestamps: typeof timestamps;
142
+ identifier: typeof identifier;
143
+ sequence: typeof sequence;
144
+ resetSequence: typeof resetSequence;
145
+ resetAllSequences: typeof resetAllSequences;
146
+ price: typeof price;
147
+ age: typeof age;
148
+ coordinates: {
149
+ within: typeof coordinateInRadius;
150
+ outside: typeof coordinateOutsideRadius;
151
+ };
152
+ }>;
153
+ /**
154
+ * Type definition for timestamp fields.
155
+ * Used by the timestamps() function to generate date fields.
156
+ */
157
+ export type Timestamps = {
158
+ /** The creation date */
159
+ createdAt: Date;
160
+ /** The last update date */
161
+ updatedAt: Date;
162
+ };
163
+ /**
164
+ * Type definition for the enhanced faker factory.
165
+ * Includes all standard faker methods plus custom extensions.
166
+ */
167
+ export type FakerFactory = typeof faker;
168
+ //#endregion
169
+ //# sourceMappingURL=faker.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faker.d.mts","names":[],"sources":["../src/faker.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;wBAkFgB,cAAc;;;;;;;;;;;;;;;wBA2Bd,WAAW;;;;;;;;;;;;;;;;;;;;;wBAmCX,SAAS;;;;;;;;;;;;;;;;;;;wBA2BT,cAAc,eAAkB;;;;;;;;;;;;;;;;;;wBA0BhC;;;;;;;;;;;;;iBAgBP;;;;;;;;;;;;;;;;;iBAoBA,IAAI,aAAa,eAAoB;;qBAOjC,wBAAwB;WAE1B;WACA;EAFV,YACU,aACA;;KAWN;EACJ;EACA;;wBAGe,mBACf,QAAQ,YACR,iBACE;iBA8BM,wBACR,QAAQ,YACR,yBACA,0BACE;qBA8EU,OAAK,mCAAA;;EAKF,OAAA;;;;;;;;;IASb,eAAM;IACN,gBAAO;;;;;;;YASE;;EAEX,WAAW;;EAEX,WAAW;;;;;;YAOA,sBAAsB"}
package/dist/faker.mjs CHANGED
@@ -1,3 +1,306 @@
1
- import { coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps } from "./faker-BGKYFoCT.mjs";
1
+ import { faker as faker$1 } from "@faker-js/faker";
2
+ //#region src/faker.ts
3
+ /**
4
+ * Atomic counter implementation for thread-safe sequence generation.
5
+ * Provides a clean abstraction for generating sequential numbers in tests.
6
+ * While JavaScript is single-threaded, this class makes the intent explicit.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const counter = new AtomicCounter(100);
11
+ * console.log(counter.increment()); // 101
12
+ * console.log(counter.increment()); // 102
13
+ * console.log(counter.get()); // 102
14
+ * counter.reset(200);
15
+ * console.log(counter.increment()); // 201
16
+ * ```
17
+ */
18
+ var AtomicCounter = class {
19
+ /**
20
+ * The current counter value.
21
+ * @private
22
+ */
23
+ value;
24
+ /**
25
+ * Creates a new atomic counter.
26
+ * @param initialValue - The starting value (default: 0)
27
+ */
28
+ constructor(initialValue = 0) {
29
+ this.value = initialValue;
30
+ }
31
+ /**
32
+ * Increments the counter and returns the new value.
33
+ * @returns The incremented value
34
+ */
35
+ increment() {
36
+ return ++this.value;
37
+ }
38
+ /**
39
+ * Gets the current counter value without incrementing.
40
+ * @returns The current value
41
+ */
42
+ get() {
43
+ return this.value;
44
+ }
45
+ /**
46
+ * Resets the counter to a specific value.
47
+ * @param value - The new value (default: 0)
48
+ */
49
+ reset(value = 0) {
50
+ this.value = value;
51
+ }
52
+ };
53
+ /**
54
+ * Generates random timestamp fields for database records.
55
+ * Creates a createdAt date in the past and an updatedAt date between creation and now.
56
+ * Milliseconds are set to 0 for cleaner database storage.
57
+ *
58
+ * @returns Object with createdAt and updatedAt Date fields
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const { createdAt, updatedAt } = timestamps();
63
+ * console.log(createdAt); // 2023-05-15T10:30:00.000Z
64
+ * console.log(updatedAt); // 2023-11-20T14:45:00.000Z
65
+ *
66
+ * // Use in factory
67
+ * const user = {
68
+ * name: 'John Doe',
69
+ * ...timestamps()
70
+ * };
71
+ * ```
72
+ */
73
+ function timestamps() {
74
+ const createdAt = faker.date.past();
75
+ const updatedAt = faker.date.between({
76
+ from: createdAt,
77
+ to: /* @__PURE__ */ new Date()
78
+ });
79
+ createdAt.setMilliseconds(0);
80
+ updatedAt.setMilliseconds(0);
81
+ return {
82
+ createdAt,
83
+ updatedAt
84
+ };
85
+ }
86
+ /**
87
+ * Generates a reverse domain name identifier.
88
+ * Useful for creating unique identifiers that follow domain naming conventions.
89
+ *
90
+ * @param suffix - Optional suffix to append to the identifier
91
+ * @returns A reverse domain name string (e.g., "com.example.feature123")
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * console.log(identifier()); // "com.example.widget1"
96
+ * console.log(identifier('user')); // "org.acme.user"
97
+ * console.log(identifier('api')); // "net.demo.api"
98
+ * ```
99
+ */
100
+ function identifier(suffix) {
101
+ return [
102
+ faker.internet.domainSuffix(),
103
+ faker.internet.domainWord(),
104
+ suffix ? suffix : faker.internet.domainWord() + sequence("identifier")
105
+ ].join(".");
106
+ }
107
+ /**
108
+ * Storage for named sequence counters.
109
+ * Each sequence maintains its own independent counter.
110
+ * @private
111
+ */
112
+ const sequences = /* @__PURE__ */ new Map();
113
+ /**
114
+ * Generates sequential numbers for a named sequence.
115
+ * Useful for creating unique IDs or numbered test data.
116
+ * Each named sequence maintains its own counter.
117
+ *
118
+ * @param name - The sequence name (default: 'default')
119
+ * @returns The next number in the sequence
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * console.log(sequence()); // 1
124
+ * console.log(sequence()); // 2
125
+ * console.log(sequence('user')); // 1
126
+ * console.log(sequence('user')); // 2
127
+ * console.log(sequence()); // 3
128
+ *
129
+ * // Use in factories
130
+ * const email = `user${sequence('email')}@example.com`;
131
+ * ```
132
+ */
133
+ function sequence(name = "default") {
134
+ if (!sequences.has(name)) sequences.set(name, new AtomicCounter());
135
+ return sequences.get(name).increment();
136
+ }
137
+ /**
138
+ * Resets a named sequence counter to a specific value.
139
+ * Useful for resetting sequences between test suites.
140
+ *
141
+ * @param name - The sequence name to reset (default: 'default')
142
+ * @param value - The new starting value (default: 0)
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * sequence('user'); // 1
147
+ * sequence('user'); // 2
148
+ * resetSequence('user');
149
+ * sequence('user'); // 1
150
+ *
151
+ * resetSequence('order', 1000);
152
+ * sequence('order'); // 1001
153
+ * ```
154
+ */
155
+ function resetSequence(name = "default", value = 0) {
156
+ if (sequences.has(name)) sequences.get(name).reset(value);
157
+ else sequences.set(name, new AtomicCounter(value));
158
+ }
159
+ /**
160
+ * Resets all sequence counters.
161
+ * Useful for cleaning up between test suites to ensure predictable sequences.
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * // In test setup
166
+ * beforeEach(() => {
167
+ * resetAllSequences();
168
+ * });
169
+ *
170
+ * it('starts sequences from 1', () => {
171
+ * expect(sequence()).toBe(1);
172
+ * expect(sequence('user')).toBe(1);
173
+ * });
174
+ * ```
175
+ */
176
+ function resetAllSequences() {
177
+ sequences.clear();
178
+ }
179
+ /**
180
+ * Generates a random price as a number.
181
+ * Converts faker's string price to a numeric value.
182
+ *
183
+ * @returns A random price number
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * const productPrice = price(); // 29.99
188
+ * const total = price() * quantity; // Numeric calculation
189
+ * ```
190
+ */
191
+ function price() {
192
+ return +faker.commerce.price();
193
+ }
194
+ /**
195
+ * A birthdate for someone of the given age today: exactly `min` years old, or
196
+ * anywhere from `min` to `max` inclusive.
197
+ *
198
+ * Through faker's own `date.birthdate`, so seeding faker makes it repeatable.
199
+ *
200
+ * @param min - The youngest age, in whole years
201
+ * @param max - The oldest age, in whole years (default: `min`)
202
+ * @returns The birthdate
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * faker.age(18); // someone who is 18 today
207
+ * faker.age(18, 24); // someone aged 18 to 24
208
+ * ```
209
+ */
210
+ function age(min, max = min) {
211
+ if (min < 0 || max < min) throw new AgeRangeInvalid(min, max);
212
+ return faker$1.date.birthdate({
213
+ mode: "age",
214
+ min,
215
+ max
216
+ });
217
+ }
218
+ /** An age range no one can be: a negative age, or an oldest below a youngest. */
219
+ var AgeRangeInvalid = class extends Error {
220
+ min;
221
+ max;
222
+ constructor(min, max) {
223
+ super(`faker.age(${min}, ${max}) asks for an age no one can be. Pass the youngest age first and the oldest second, neither negative: faker.age(18) or faker.age(18, 24).`);
224
+ this.min = min;
225
+ this.max = max;
226
+ this.name = "AgeRangeInvalid";
227
+ }
228
+ };
229
+ function coordinateInRadius(center, radius) {
230
+ const d = radius / 6378137;
231
+ const theta = 2 * Math.PI * Math.random();
232
+ const r = d * Math.sqrt(Math.random());
233
+ const lat1 = center.lat * Math.PI / 180;
234
+ const lng1 = center.lng * Math.PI / 180;
235
+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
236
+ const lng2 = lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2));
237
+ return {
238
+ lat: lat2 * 180 / Math.PI,
239
+ lng: lng2 * 180 / Math.PI
240
+ };
241
+ }
242
+ function coordinateOutsideRadius(center, minRadiusMeters, maxRadiusMeters) {
243
+ const earth = 6378137;
244
+ const minD = minRadiusMeters / earth;
245
+ const maxD = maxRadiusMeters / earth;
246
+ const theta = 2 * Math.PI * Math.random();
247
+ const r = Math.sqrt(minD * minD + (maxD * maxD - minD * minD) * Math.random());
248
+ const lat1 = center.lat * Math.PI / 180;
249
+ const lng1 = center.lng * Math.PI / 180;
250
+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(r) + Math.cos(lat1) * Math.sin(r) * Math.cos(theta));
251
+ const normalizedLng = ((lng1 + Math.atan2(Math.sin(theta) * Math.sin(r) * Math.cos(lat1), Math.cos(r) - Math.sin(lat1) * Math.sin(lat2))) * 180 / Math.PI + 540) % 360 - 180;
252
+ return {
253
+ lat: lat2 * 180 / Math.PI,
254
+ lng: normalizedLng
255
+ };
256
+ }
257
+ /**
258
+ * Enhanced faker instance with additional utility methods for testing.
259
+ * Extends @faker-js/faker with custom methods for common test data generation patterns.
260
+ *
261
+ * @example
262
+ * ```typescript
263
+ * import { faker } from '@geekmidas/testkit';
264
+ *
265
+ * // Use standard faker methods
266
+ * const name = faker.person.fullName();
267
+ * const email = faker.internet.email();
268
+ *
269
+ * // Use custom extensions
270
+ * const { createdAt, updatedAt } = faker.timestamps();
271
+ * const id = faker.identifier('user');
272
+ * const orderNumber = faker.sequence('order');
273
+ * const productPrice = faker.price();
274
+ * ```
275
+ */
276
+ /**
277
+ * `faker.internet`, with every address lowercase.
278
+ *
279
+ * An auth server stores addresses lowercased — Better Auth does — so a test
280
+ * that signs in as faker's `Ada.Lovelace@…` and reads back `ada.lovelace@…`
281
+ * fails only when faker happened to capitalise: a flake, not a bug. The rest
282
+ * of the module is faker's own, through the prototype.
283
+ */
284
+ const internet = Object.assign(Object.create(faker$1.internet), {
285
+ email: (...args) => faker$1.internet.email(...args).toLowerCase(),
286
+ exampleEmail: (...args) => faker$1.internet.exampleEmail(...args).toLowerCase()
287
+ });
288
+ const faker = Object.freeze(Object.assign({}, faker$1, {
289
+ internet,
290
+ seed: (seed) => faker$1.seed(seed),
291
+ timestamps,
292
+ identifier,
293
+ sequence,
294
+ resetSequence,
295
+ resetAllSequences,
296
+ price,
297
+ age,
298
+ coordinates: {
299
+ within: coordinateInRadius,
300
+ outside: coordinateOutsideRadius
301
+ }
302
+ }));
303
+ //#endregion
304
+ export { AgeRangeInvalid, coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
2
305
 
3
- export { coordinateInRadius, faker, identifier, resetAllSequences, resetSequence, sequence, timestamps };
306
+ //# sourceMappingURL=faker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faker.mjs","names":["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\n/**\n * A birthdate for someone of the given age today: exactly `min` years old, or\n * anywhere from `min` to `max` inclusive.\n *\n * Through faker's own `date.birthdate`, so seeding faker makes it repeatable.\n *\n * @param min - The youngest age, in whole years\n * @param max - The oldest age, in whole years (default: `min`)\n * @returns The birthdate\n *\n * @example\n * ```typescript\n * faker.age(18); // someone who is 18 today\n * faker.age(18, 24); // someone aged 18 to 24\n * ```\n */\nfunction age(min: number, max: number = min): Date {\n\tif (min < 0 || max < min) throw new AgeRangeInvalid(min, max);\n\n\treturn baseFaker.date.birthdate({ mode: 'age', min, max });\n}\n\n/** An age range no one can be: a negative age, or an oldest below a youngest. */\nexport class AgeRangeInvalid extends Error {\n\tconstructor(\n\t\treadonly min: number,\n\t\treadonly max: number,\n\t) {\n\t\tsuper(\n\t\t\t`faker.age(${min}, ${max}) asks for an age no one can be. Pass the ` +\n\t\t\t\t'youngest age first and the oldest second, neither negative: ' +\n\t\t\t\t'faker.age(18) or faker.age(18, 24).',\n\t\t);\n\t\tthis.name = 'AgeRangeInvalid';\n\t}\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 */\n/**\n * `faker.internet`, with every address lowercase.\n *\n * An auth server stores addresses lowercased — Better Auth does — so a test\n * that signs in as faker's `Ada.Lovelace@…` and reads back `ada.lovelace@…`\n * fails only when faker happened to capitalise: a flake, not a bug. The rest\n * of the module is faker's own, through the prototype.\n */\nconst internet: typeof baseFaker.internet = Object.assign(\n\tObject.create(baseFaker.internet),\n\t{\n\t\temail: (...args: Parameters<typeof baseFaker.internet.email>) =>\n\t\t\tbaseFaker.internet.email(...args).toLowerCase(),\n\t\texampleEmail: (\n\t\t\t...args: Parameters<typeof baseFaker.internet.exampleEmail>\n\t\t) => baseFaker.internet.exampleEmail(...args).toLowerCase(),\n\t},\n);\n\nexport const faker = Object.freeze(\n\tObject.assign({}, baseFaker, {\n\t\tinternet,\n\t\t// A prototype method, so the spread above leaves it behind. The modules\n\t\t// copied across still draw from `baseFaker`, so seeding it seeds them.\n\t\tseed: (seed?: number) => baseFaker.seed(seed),\n\t\ttimestamps,\n\t\tidentifier,\n\t\tsequence,\n\t\tresetSequence,\n\t\tresetAllSequences,\n\t\tprice,\n\t\tage,\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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"}
package/dist/helpers.cjs CHANGED
@@ -1,7 +1,8 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const pg = require_chunk.__toESM(require("pg"));
3
- const kysely = require_chunk.__toESM(require("kysely"));
4
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
3
+ let pg = require("pg");
4
+ pg = require_rolldown_runtime.__toESM(pg, 1);
5
+ let kysely = require("kysely");
5
6
  //#region src/helpers.ts
6
7
  /**
7
8
  * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.
@@ -43,7 +44,7 @@ function createKyselyDb(config) {
43
44
  plugins: [new kysely.CamelCasePlugin()]
44
45
  });
45
46
  }
46
-
47
47
  //#endregion
48
48
  exports.createKyselyDb = createKyselyDb;
49
+
49
50
  //# sourceMappingURL=helpers.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.cjs","names":["config: any","Kysely","PostgresDialect","CamelCasePlugin"],"sources":["../src/helpers.ts"],"sourcesContent":["import { CamelCasePlugin, Kysely, PostgresDialect } from 'kysely';\nimport pg from 'pg';\n\n/**\n * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.\n * This is a convenience function for quickly setting up a Kysely connection for testing.\n *\n * @template Database - The database schema type\n * @param config - PostgreSQL connection configuration (pg.Pool config)\n * @returns A configured Kysely instance\n *\n * @example\n * ```typescript\n * interface Database {\n * users: UsersTable;\n * posts: PostsTable;\n * }\n *\n * // Create from connection string\n * const db = createKyselyDb<Database>({\n * connectionString: 'postgresql://user:pass@localhost:5432/testdb'\n * });\n *\n * // Create with detailed config\n * const db = createKyselyDb<Database>({\n * host: 'localhost',\n * port: 5432,\n * database: 'testdb',\n * user: 'testuser',\n * password: 'testpass',\n * max: 10 // connection pool size\n * });\n *\n * // Use in tests\n * const users = await db.selectFrom('users').selectAll().execute();\n * ```\n */\nexport function createKyselyDb<Database>(config: any): Kysely<Database> {\n\treturn new Kysely({\n\t\tdialect: new PostgresDialect({\n\t\t\tpool: new pg.Pool(config),\n\t\t}),\n\t\tplugins: [new CamelCasePlugin()],\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,eAAyBA,QAA+B;AACvE,QAAO,IAAIC,cAAO;EACjB,SAAS,IAAIC,uBAAgB,EAC5B,MAAM,IAAI,WAAG,KAAK,QAClB;EACD,SAAS,CAAC,IAAIC,wBAAkB;CAChC;AACD"}
1
+ {"version":3,"file":"helpers.cjs","names":["Kysely","PostgresDialect","CamelCasePlugin"],"sources":["../src/helpers.ts"],"sourcesContent":["import { CamelCasePlugin, Kysely, PostgresDialect } from 'kysely';\nimport pg from 'pg';\n\n/**\n * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.\n * This is a convenience function for quickly setting up a Kysely connection for testing.\n *\n * @template Database - The database schema type\n * @param config - PostgreSQL connection configuration (pg.Pool config)\n * @returns A configured Kysely instance\n *\n * @example\n * ```typescript\n * interface Database {\n * users: UsersTable;\n * posts: PostsTable;\n * }\n *\n * // Create from connection string\n * const db = createKyselyDb<Database>({\n * connectionString: 'postgresql://user:pass@localhost:5432/testdb'\n * });\n *\n * // Create with detailed config\n * const db = createKyselyDb<Database>({\n * host: 'localhost',\n * port: 5432,\n * database: 'testdb',\n * user: 'testuser',\n * password: 'testpass',\n * max: 10 // connection pool size\n * });\n *\n * // Use in tests\n * const users = await db.selectFrom('users').selectAll().execute();\n * ```\n */\nexport function createKyselyDb<Database>(config: any): Kysely<Database> {\n\treturn new Kysely({\n\t\tdialect: new PostgresDialect({\n\t\t\tpool: new pg.Pool(config),\n\t\t}),\n\t\tplugins: [new CamelCasePlugin()],\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,eAAyB,QAA+B;CACvE,OAAO,IAAIA,OAAAA,OAAO;EACjB,SAAS,IAAIC,OAAAA,gBAAgB,EAC5B,MAAM,IAAI,GAAA,QAAG,KAAK,MAAM,EACzB,CAAC;EACD,SAAS,CAAC,IAAIC,OAAAA,gBAAgB,CAAC;CAChC,CAAC;AACF"}
@@ -1,7 +1,5 @@
1
1
  import { Kysely } from "kysely";
2
-
3
2
  //#region src/helpers.d.ts
4
-
5
3
  /**
6
4
  * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.
7
5
  * This is a convenience function for quickly setting up a Kysely connection for testing.
@@ -36,8 +34,6 @@ import { Kysely } from "kysely";
36
34
  * const users = await db.selectFrom('users').selectAll().execute();
37
35
  * ```
38
36
  */
39
- declare function createKyselyDb<Database>(config: any): Kysely<Database>;
40
- //# sourceMappingURL=helpers.d.ts.map
37
+ export declare function createKyselyDb<Database>(config: any): Kysely<Database>;
41
38
  //#endregion
42
- export { createKyselyDb };
43
39
  //# sourceMappingURL=helpers.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.cts","names":[],"sources":["../src/helpers.ts"],"sourcesContent":[],"mappings":";;;;;;AAqCA;;;;AAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA7C,uCAAuC,OAAO"}
1
+ {"version":3,"file":"helpers.d.cts","names":[],"sources":["../src/helpers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqCgB,eAAe,UAAU,cAAc,OAAO"}
@@ -1,7 +1,5 @@
1
1
  import { Kysely } from "kysely";
2
-
3
2
  //#region src/helpers.d.ts
4
-
5
3
  /**
6
4
  * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.
7
5
  * This is a convenience function for quickly setting up a Kysely connection for testing.
@@ -36,8 +34,6 @@ import { Kysely } from "kysely";
36
34
  * const users = await db.selectFrom('users').selectAll().execute();
37
35
  * ```
38
36
  */
39
- declare function createKyselyDb<Database>(config: any): Kysely<Database>;
40
- //# sourceMappingURL=helpers.d.ts.map
37
+ export declare function createKyselyDb<Database>(config: any): Kysely<Database>;
41
38
  //#endregion
42
- export { createKyselyDb };
43
39
  //# sourceMappingURL=helpers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../src/helpers.ts"],"sourcesContent":[],"mappings":";;;;;;AAqCA;;;;AAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA7C,uCAAuC,OAAO"}
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../src/helpers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqCgB,eAAe,UAAU,cAAc,OAAO"}
package/dist/helpers.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import pg from "pg";
2
2
  import { CamelCasePlugin, Kysely, PostgresDialect } from "kysely";
3
-
4
3
  //#region src/helpers.ts
5
4
  /**
6
5
  * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.
@@ -42,7 +41,7 @@ function createKyselyDb(config) {
42
41
  plugins: [new CamelCasePlugin()]
43
42
  });
44
43
  }
45
-
46
44
  //#endregion
47
45
  export { createKyselyDb };
46
+
48
47
  //# sourceMappingURL=helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":["config: any"],"sources":["../src/helpers.ts"],"sourcesContent":["import { CamelCasePlugin, Kysely, PostgresDialect } from 'kysely';\nimport pg from 'pg';\n\n/**\n * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.\n * This is a convenience function for quickly setting up a Kysely connection for testing.\n *\n * @template Database - The database schema type\n * @param config - PostgreSQL connection configuration (pg.Pool config)\n * @returns A configured Kysely instance\n *\n * @example\n * ```typescript\n * interface Database {\n * users: UsersTable;\n * posts: PostsTable;\n * }\n *\n * // Create from connection string\n * const db = createKyselyDb<Database>({\n * connectionString: 'postgresql://user:pass@localhost:5432/testdb'\n * });\n *\n * // Create with detailed config\n * const db = createKyselyDb<Database>({\n * host: 'localhost',\n * port: 5432,\n * database: 'testdb',\n * user: 'testuser',\n * password: 'testpass',\n * max: 10 // connection pool size\n * });\n *\n * // Use in tests\n * const users = await db.selectFrom('users').selectAll().execute();\n * ```\n */\nexport function createKyselyDb<Database>(config: any): Kysely<Database> {\n\treturn new Kysely({\n\t\tdialect: new PostgresDialect({\n\t\t\tpool: new pg.Pool(config),\n\t\t}),\n\t\tplugins: [new CamelCasePlugin()],\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,eAAyBA,QAA+B;AACvE,QAAO,IAAI,OAAO;EACjB,SAAS,IAAI,gBAAgB,EAC5B,MAAM,IAAI,GAAG,KAAK,QAClB;EACD,SAAS,CAAC,IAAI,iBAAkB;CAChC;AACD"}
1
+ {"version":3,"file":"helpers.mjs","names":[],"sources":["../src/helpers.ts"],"sourcesContent":["import { CamelCasePlugin, Kysely, PostgresDialect } from 'kysely';\nimport pg from 'pg';\n\n/**\n * Creates a Kysely database instance with PostgreSQL dialect and camelCase plugin.\n * This is a convenience function for quickly setting up a Kysely connection for testing.\n *\n * @template Database - The database schema type\n * @param config - PostgreSQL connection configuration (pg.Pool config)\n * @returns A configured Kysely instance\n *\n * @example\n * ```typescript\n * interface Database {\n * users: UsersTable;\n * posts: PostsTable;\n * }\n *\n * // Create from connection string\n * const db = createKyselyDb<Database>({\n * connectionString: 'postgresql://user:pass@localhost:5432/testdb'\n * });\n *\n * // Create with detailed config\n * const db = createKyselyDb<Database>({\n * host: 'localhost',\n * port: 5432,\n * database: 'testdb',\n * user: 'testuser',\n * password: 'testpass',\n * max: 10 // connection pool size\n * });\n *\n * // Use in tests\n * const users = await db.selectFrom('users').selectAll().execute();\n * ```\n */\nexport function createKyselyDb<Database>(config: any): Kysely<Database> {\n\treturn new Kysely({\n\t\tdialect: new PostgresDialect({\n\t\t\tpool: new pg.Pool(config),\n\t\t}),\n\t\tplugins: [new CamelCasePlugin()],\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,eAAyB,QAA+B;CACvE,OAAO,IAAI,OAAO;EACjB,SAAS,IAAI,gBAAgB,EAC5B,MAAM,IAAI,GAAG,KAAK,MAAM,EACzB,CAAC;EACD,SAAS,CAAC,IAAI,gBAAgB,CAAC;CAChC,CAAC;AACF"}