@geekmidas/testkit 10.0.0-alpha.2 → 10.0.0-alpha.20

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 (262) hide show
  1. package/dist/Factory.cjs +51 -2
  2. package/dist/Factory.cjs.map +1 -0
  3. package/dist/Factory.d.cts +143 -3
  4. package/dist/Factory.d.cts.map +1 -0
  5. package/dist/Factory.d.mts +143 -3
  6. package/dist/Factory.d.mts.map +1 -0
  7. package/dist/Factory.mjs +50 -2
  8. package/dist/Factory.mjs.map +1 -0
  9. package/dist/KyselyFactory.cjs +237 -4
  10. package/dist/KyselyFactory.cjs.map +1 -0
  11. package/dist/KyselyFactory.d.cts +224 -4
  12. package/dist/KyselyFactory.d.cts.map +1 -0
  13. package/dist/KyselyFactory.d.mts +224 -4
  14. package/dist/KyselyFactory.d.mts.map +1 -0
  15. package/dist/KyselyFactory.mjs +236 -4
  16. package/dist/KyselyFactory.mjs.map +1 -0
  17. package/dist/ObjectionFactory.cjs +265 -4
  18. package/dist/ObjectionFactory.cjs.map +1 -0
  19. package/dist/ObjectionFactory.d.cts +237 -4
  20. package/dist/ObjectionFactory.d.cts.map +1 -0
  21. package/dist/ObjectionFactory.d.mts +237 -4
  22. package/dist/ObjectionFactory.d.mts.map +1 -0
  23. package/dist/ObjectionFactory.mjs +264 -4
  24. package/dist/ObjectionFactory.mjs.map +1 -0
  25. package/dist/PostgresKyselyMigrator.cjs +94 -3
  26. package/dist/PostgresKyselyMigrator.cjs.map +1 -0
  27. package/dist/PostgresKyselyMigrator.d.cts +80 -3
  28. package/dist/PostgresKyselyMigrator.d.cts.map +1 -0
  29. package/dist/PostgresKyselyMigrator.d.mts +80 -3
  30. package/dist/PostgresKyselyMigrator.d.mts.map +1 -0
  31. package/dist/PostgresKyselyMigrator.mjs +93 -3
  32. package/dist/PostgresKyselyMigrator.mjs.map +1 -0
  33. package/dist/{PostgresMigrator-C_QQ6q35.d.mts → PostgresMigrator-CDPnnwMJ.d.cts} +11 -5
  34. package/dist/PostgresMigrator-CDPnnwMJ.d.cts.map +1 -0
  35. package/dist/{PostgresMigrator-CeYy-eHF.d.cts → PostgresMigrator-CDPnnwMJ.d.mts} +11 -5
  36. package/dist/PostgresMigrator-CDPnnwMJ.d.mts.map +1 -0
  37. package/dist/PostgresMigrator.cjs +178 -2
  38. package/dist/PostgresMigrator.cjs.map +1 -0
  39. package/dist/PostgresMigrator.d.cts +1 -1
  40. package/dist/PostgresMigrator.d.mts +1 -1
  41. package/dist/PostgresMigrator.mjs +175 -2
  42. package/dist/PostgresMigrator.mjs.map +1 -0
  43. package/dist/PostgresObjectionMigrator.cjs +118 -3
  44. package/dist/PostgresObjectionMigrator.cjs.map +1 -0
  45. package/dist/PostgresObjectionMigrator.d.cts +75 -3
  46. package/dist/PostgresObjectionMigrator.d.cts.map +1 -0
  47. package/dist/PostgresObjectionMigrator.d.mts +75 -3
  48. package/dist/PostgresObjectionMigrator.d.mts.map +1 -0
  49. package/dist/PostgresObjectionMigrator.mjs +117 -3
  50. package/dist/PostgresObjectionMigrator.mjs.map +1 -0
  51. package/dist/VitestKyselyTransactionIsolator.cjs +66 -3
  52. package/dist/VitestKyselyTransactionIsolator.cjs.map +1 -0
  53. package/dist/VitestKyselyTransactionIsolator.d.cts +60 -3
  54. package/dist/VitestKyselyTransactionIsolator.d.cts.map +1 -0
  55. package/dist/VitestKyselyTransactionIsolator.d.mts +60 -3
  56. package/dist/VitestKyselyTransactionIsolator.d.mts.map +1 -0
  57. package/dist/VitestKyselyTransactionIsolator.mjs +65 -3
  58. package/dist/VitestKyselyTransactionIsolator.mjs.map +1 -0
  59. package/dist/VitestObjectionTransactionIsolator.cjs +62 -3
  60. package/dist/VitestObjectionTransactionIsolator.cjs.map +1 -0
  61. package/dist/VitestObjectionTransactionIsolator.d.cts +56 -3
  62. package/dist/VitestObjectionTransactionIsolator.d.cts.map +1 -0
  63. package/dist/VitestObjectionTransactionIsolator.d.mts +56 -3
  64. package/dist/VitestObjectionTransactionIsolator.d.mts.map +1 -0
  65. package/dist/VitestObjectionTransactionIsolator.mjs +61 -3
  66. package/dist/VitestObjectionTransactionIsolator.mjs.map +1 -0
  67. package/dist/VitestTransactionIsolator.cjs +187 -4
  68. package/dist/VitestTransactionIsolator.cjs.map +1 -0
  69. package/dist/VitestTransactionIsolator.d.cts +219 -2
  70. package/dist/VitestTransactionIsolator.d.cts.map +1 -0
  71. package/dist/VitestTransactionIsolator.d.mts +219 -2
  72. package/dist/VitestTransactionIsolator.d.mts.map +1 -0
  73. package/dist/VitestTransactionIsolator.mjs +184 -2
  74. package/dist/VitestTransactionIsolator.mjs.map +1 -0
  75. package/dist/aws.cjs +3 -4
  76. package/dist/aws.cjs.map +1 -1
  77. package/dist/aws.d.cts +3 -8
  78. package/dist/aws.d.cts.map +1 -1
  79. package/dist/aws.d.mts +3 -8
  80. package/dist/aws.d.mts.map +1 -1
  81. package/dist/aws.mjs +1 -2
  82. package/dist/aws.mjs.map +1 -1
  83. package/dist/benchmark.cjs +2 -2
  84. package/dist/benchmark.cjs.map +1 -1
  85. package/dist/benchmark.d.cts +4 -6
  86. package/dist/benchmark.d.cts.map +1 -1
  87. package/dist/benchmark.d.mts +4 -6
  88. package/dist/benchmark.d.mts.map +1 -1
  89. package/dist/benchmark.mjs +1 -1
  90. package/dist/benchmark.mjs.map +1 -1
  91. package/dist/better-auth.cjs +31 -15
  92. package/dist/better-auth.cjs.map +1 -1
  93. package/dist/better-auth.d.cts +13142 -4
  94. package/dist/better-auth.d.cts.map +1 -1
  95. package/dist/better-auth.d.mts +13142 -4
  96. package/dist/better-auth.d.mts.map +1 -1
  97. package/dist/better-auth.mjs +29 -13
  98. package/dist/better-auth.mjs.map +1 -1
  99. package/dist/faker.cjs +262 -8
  100. package/dist/faker.cjs.map +1 -0
  101. package/dist/faker.d.cts +162 -2
  102. package/dist/faker.d.cts.map +1 -0
  103. package/dist/faker.d.mts +162 -2
  104. package/dist/faker.d.mts.map +1 -0
  105. package/dist/faker.mjs +255 -2
  106. package/dist/faker.mjs.map +1 -0
  107. package/dist/helpers.cjs +6 -5
  108. package/dist/helpers.cjs.map +1 -1
  109. package/dist/helpers.d.cts +1 -5
  110. package/dist/helpers.d.cts.map +1 -1
  111. package/dist/helpers.d.mts +1 -5
  112. package/dist/helpers.d.mts.map +1 -1
  113. package/dist/helpers.mjs +1 -2
  114. package/dist/helpers.mjs.map +1 -1
  115. package/dist/initScript.cjs +15 -15
  116. package/dist/initScript.cjs.map +1 -1
  117. package/dist/initScript.d.cts +2 -4
  118. package/dist/initScript.d.cts.map +1 -1
  119. package/dist/initScript.d.mts +2 -4
  120. package/dist/initScript.d.mts.map +1 -1
  121. package/dist/initScript.mjs +10 -12
  122. package/dist/initScript.mjs.map +1 -1
  123. package/dist/kysely.cjs +10 -13
  124. package/dist/kysely.cjs.map +1 -1
  125. package/dist/kysely.d.cts +10 -14
  126. package/dist/kysely.d.cts.map +1 -1
  127. package/dist/kysely.d.mts +10 -14
  128. package/dist/kysely.d.mts.map +1 -1
  129. package/dist/kysely.mjs +10 -14
  130. package/dist/kysely.mjs.map +1 -1
  131. package/dist/logger.cjs +3 -4
  132. package/dist/logger.cjs.map +1 -1
  133. package/dist/logger.d.cts +1 -5
  134. package/dist/logger.d.cts.map +1 -1
  135. package/dist/logger.d.mts +1 -5
  136. package/dist/logger.d.mts.map +1 -1
  137. package/dist/logger.mjs +1 -2
  138. package/dist/logger.mjs.map +1 -1
  139. package/dist/objection.cjs +10 -13
  140. package/dist/objection.cjs.map +1 -1
  141. package/dist/objection.d.cts +10 -14
  142. package/dist/objection.d.cts.map +1 -1
  143. package/dist/objection.d.mts +10 -14
  144. package/dist/objection.d.mts.map +1 -1
  145. package/dist/objection.mjs +10 -14
  146. package/dist/objection.mjs.map +1 -1
  147. package/dist/os/directory.cjs +31 -2
  148. package/dist/os/directory.cjs.map +1 -0
  149. package/dist/os/directory.d.cts +9 -2
  150. package/dist/os/directory.d.cts.map +1 -0
  151. package/dist/os/directory.d.mts +9 -2
  152. package/dist/os/directory.d.mts.map +1 -0
  153. package/dist/os/directory.mjs +25 -2
  154. package/dist/os/directory.mjs.map +1 -0
  155. package/dist/os/index.cjs +3 -3
  156. package/dist/os/index.d.cts +1 -1
  157. package/dist/os/index.d.mts +1 -1
  158. package/dist/os/index.mjs +2 -3
  159. package/dist/requestContext.cjs +10 -11
  160. package/dist/requestContext.cjs.map +1 -1
  161. package/dist/requestContext.d.cts +4 -8
  162. package/dist/requestContext.d.cts.map +1 -1
  163. package/dist/requestContext.d.mts +4 -8
  164. package/dist/requestContext.d.mts.map +1 -1
  165. package/dist/requestContext.mjs +1 -2
  166. package/dist/requestContext.mjs.map +1 -1
  167. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-VH7oDXx4.cjs} +8 -10
  168. package/dist/timer.cjs +2 -2
  169. package/dist/timer.cjs.map +1 -1
  170. package/dist/timer.d.cts +1 -4
  171. package/dist/timer.d.cts.map +1 -1
  172. package/dist/timer.d.mts +1 -4
  173. package/dist/timer.d.mts.map +1 -1
  174. package/dist/timer.mjs +1 -1
  175. package/dist/timer.mjs.map +1 -1
  176. package/package.json +18 -16
  177. package/dist/Factory-BFVnMMCC.mjs +0 -51
  178. package/dist/Factory-BFVnMMCC.mjs.map +0 -1
  179. package/dist/Factory-BhjUOBWN.cjs +0 -57
  180. package/dist/Factory-BhjUOBWN.cjs.map +0 -1
  181. package/dist/Factory-CVR3GdkW.d.mts +0 -147
  182. package/dist/Factory-CVR3GdkW.d.mts.map +0 -1
  183. package/dist/Factory-Cwzho3c8.d.cts +0 -147
  184. package/dist/Factory-Cwzho3c8.d.cts.map +0 -1
  185. package/dist/KyselyFactory-BFqVIn_0.cjs +0 -246
  186. package/dist/KyselyFactory-BFqVIn_0.cjs.map +0 -1
  187. package/dist/KyselyFactory-DMswpwji.mjs +0 -241
  188. package/dist/KyselyFactory-DMswpwji.mjs.map +0 -1
  189. package/dist/KyselyFactory-DRlMv-WT.d.mts +0 -228
  190. package/dist/KyselyFactory-DRlMv-WT.d.mts.map +0 -1
  191. package/dist/KyselyFactory-hMcVtvJq.d.cts +0 -228
  192. package/dist/KyselyFactory-hMcVtvJq.d.cts.map +0 -1
  193. package/dist/ObjectionFactory-BeFBYcan.cjs +0 -272
  194. package/dist/ObjectionFactory-BeFBYcan.cjs.map +0 -1
  195. package/dist/ObjectionFactory-DW-qwnqO.d.cts +0 -241
  196. package/dist/ObjectionFactory-DW-qwnqO.d.cts.map +0 -1
  197. package/dist/ObjectionFactory-DkJUf-uM.d.mts +0 -241
  198. package/dist/ObjectionFactory-DkJUf-uM.d.mts.map +0 -1
  199. package/dist/ObjectionFactory-QCJ7u0Ql.mjs +0 -267
  200. package/dist/ObjectionFactory-QCJ7u0Ql.mjs.map +0 -1
  201. package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts +0 -84
  202. package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts.map +0 -1
  203. package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs +0 -101
  204. package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs.map +0 -1
  205. package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts +0 -84
  206. package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts.map +0 -1
  207. package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs +0 -95
  208. package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs.map +0 -1
  209. package/dist/PostgresMigrator-C_QQ6q35.d.mts.map +0 -1
  210. package/dist/PostgresMigrator-CeYy-eHF.d.cts.map +0 -1
  211. package/dist/PostgresMigrator-DVAY04qN.mjs +0 -166
  212. package/dist/PostgresMigrator-DVAY04qN.mjs.map +0 -1
  213. package/dist/PostgresMigrator-M9jpzOvN.cjs +0 -172
  214. package/dist/PostgresMigrator-M9jpzOvN.cjs.map +0 -1
  215. package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts +0 -79
  216. package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts.map +0 -1
  217. package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts +0 -79
  218. package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts.map +0 -1
  219. package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs +0 -123
  220. package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs.map +0 -1
  221. package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs +0 -118
  222. package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs.map +0 -1
  223. package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs +0 -67
  224. package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs.map +0 -1
  225. package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs +0 -72
  226. package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs.map +0 -1
  227. package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts +0 -64
  228. package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts.map +0 -1
  229. package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts +0 -64
  230. package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts.map +0 -1
  231. package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs +0 -63
  232. package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs.map +0 -1
  233. package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts +0 -60
  234. package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts.map +0 -1
  235. package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts +0 -60
  236. package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts.map +0 -1
  237. package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs +0 -68
  238. package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs.map +0 -1
  239. package/dist/VitestTransactionIsolator-BLaw80cx.d.mts +0 -223
  240. package/dist/VitestTransactionIsolator-BLaw80cx.d.mts.map +0 -1
  241. package/dist/VitestTransactionIsolator-CvwPecpl.mjs +0 -188
  242. package/dist/VitestTransactionIsolator-CvwPecpl.mjs.map +0 -1
  243. package/dist/VitestTransactionIsolator-DyiX-QtK.cjs +0 -206
  244. package/dist/VitestTransactionIsolator-DyiX-QtK.cjs.map +0 -1
  245. package/dist/VitestTransactionIsolator-glcxyS_R.d.cts +0 -223
  246. package/dist/VitestTransactionIsolator-glcxyS_R.d.cts.map +0 -1
  247. package/dist/directory-BxjqmtCT.mjs +0 -27
  248. package/dist/directory-BxjqmtCT.mjs.map +0 -1
  249. package/dist/directory-C6DuuNyc.d.cts +0 -13
  250. package/dist/directory-C6DuuNyc.d.cts.map +0 -1
  251. package/dist/directory-DD_xQoSh.cjs +0 -33
  252. package/dist/directory-DD_xQoSh.cjs.map +0 -1
  253. package/dist/directory-DiQ_DkaF.d.mts +0 -13
  254. package/dist/directory-DiQ_DkaF.d.mts.map +0 -1
  255. package/dist/faker-B14IEMIN.cjs +0 -304
  256. package/dist/faker-B14IEMIN.cjs.map +0 -1
  257. package/dist/faker-BGKYFoCT.mjs +0 -262
  258. package/dist/faker-BGKYFoCT.mjs.map +0 -1
  259. package/dist/faker-Dg3trU4a.d.cts +0 -166
  260. package/dist/faker-Dg3trU4a.d.cts.map +0 -1
  261. package/dist/faker-DsYCplsG.d.mts +0 -166
  262. package/dist/faker-DsYCplsG.d.mts.map +0 -1
package/dist/timer.d.cts CHANGED
@@ -1,7 +1,4 @@
1
1
  //#region src/timer.d.ts
2
- declare function waitFor(ms: number): Promise<unknown>;
3
- //# sourceMappingURL=timer.d.ts.map
4
-
2
+ export declare function waitFor(ms: number): Promise<unknown>;
5
3
  //#endregion
6
- export { waitFor };
7
4
  //# sourceMappingURL=timer.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timer.d.cts","names":[],"sources":["../src/timer.ts"],"sourcesContent":[],"mappings":";iBAAgB,OAAA,cAAkB;AAAlC"}
1
+ {"version":3,"file":"timer.d.cts","names":[],"sources":["../src/timer.ts"],"mappings":";wBAAgB,QAAQ,aAAU"}
package/dist/timer.d.mts CHANGED
@@ -1,7 +1,4 @@
1
1
  //#region src/timer.d.ts
2
- declare function waitFor(ms: number): Promise<unknown>;
3
- //# sourceMappingURL=timer.d.ts.map
4
-
2
+ export declare function waitFor(ms: number): Promise<unknown>;
5
3
  //#endregion
6
- export { waitFor };
7
4
  //# sourceMappingURL=timer.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timer.d.mts","names":[],"sources":["../src/timer.ts"],"sourcesContent":[],"mappings":";iBAAgB,OAAA,cAAkB;AAAlC"}
1
+ {"version":3,"file":"timer.d.mts","names":[],"sources":["../src/timer.ts"],"mappings":";wBAAgB,QAAQ,aAAU"}
package/dist/timer.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  function waitFor(ms) {
3
3
  return new Promise((resolve) => setTimeout(resolve, ms));
4
4
  }
5
-
6
5
  //#endregion
7
6
  export { waitFor };
7
+
8
8
  //# sourceMappingURL=timer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"timer.mjs","names":["ms: number"],"sources":["../src/timer.ts"],"sourcesContent":["export function waitFor(ms: number) {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";AAAA,SAAgB,QAAQA,IAAY;AACnC,QAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG;AACvD"}
1
+ {"version":3,"file":"timer.mjs","names":[],"sources":["../src/timer.ts"],"sourcesContent":["export function waitFor(ms: number) {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";AAAA,SAAgB,QAAQ,IAAY;CACnC,OAAO,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;AACxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/testkit",
3
- "version": "10.0.0-alpha.2",
3
+ "version": "10.0.0-alpha.20",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -119,16 +119,18 @@
119
119
  "dist"
120
120
  ],
121
121
  "dependencies": {
122
- "@faker-js/faker": "~9.9.0",
123
- "@geekmidas/envkit": "^10.0.0-alpha.2",
124
- "@geekmidas/logger": "^10.0.0-alpha.2",
125
- "@geekmidas/services": "^10.0.0-alpha.2"
122
+ "@faker-js/faker": "~10.6.0",
123
+ "@geekmidas/envkit": "^10.0.0-alpha.20",
124
+ "@geekmidas/logger": "^10.0.0-alpha.20",
125
+ "@geekmidas/services": "^10.0.0-alpha.20"
126
126
  },
127
127
  "devDependencies": {
128
- "@types/pg": "~8.15.4",
129
- "@geekmidas/envkit": "^10.0.0-alpha.2",
130
- "@geekmidas/logger": "^10.0.0-alpha.2",
131
- "@geekmidas/services": "^10.0.0-alpha.2"
128
+ "@better-auth/test-utils": "~1.7.6",
129
+ "@types/pg": "~8.23.1",
130
+ "better-auth": "~1.7.6",
131
+ "@geekmidas/envkit": "^10.0.0-alpha.20",
132
+ "@geekmidas/logger": "^10.0.0-alpha.20",
133
+ "@geekmidas/services": "^10.0.0-alpha.20"
132
134
  },
133
135
  "repository": {
134
136
  "type": "git",
@@ -139,14 +141,14 @@
139
141
  "access": "public"
140
142
  },
141
143
  "peerDependencies": {
142
- "kysely": "~0.29.4",
143
- "pg": "~8.16.3",
144
- "knex": "~3.1.0",
145
- "objection": "~3.1.5",
144
+ "kysely": "~0.29.6",
145
+ "pg": ">=8.23.0",
146
+ "knex": ">=3.3.0",
147
+ "objection": ">=3.1.5",
146
148
  "db-errors": "~0.2.3",
147
- "vitest": "~3.2.4",
148
- "@types/aws-lambda": ">=8.10.92",
149
- "better-auth": ">=1.3.34"
149
+ "vitest": "~5.0.2",
150
+ "@types/aws-lambda": ">=8.10.163",
151
+ "better-auth": ">=1.7.5"
150
152
  },
151
153
  "peerDependenciesMeta": {
152
154
  "kysely": {
@@ -1,51 +0,0 @@
1
- //#region src/Factory.ts
2
- /**
3
- * Abstract base class for database factories used in testing.
4
- * Provides a standardized interface for creating test data using builder and seed patterns.
5
- *
6
- * @template Builders - Record of builder functions for creating individual entities
7
- * @template Seeds - Record of seed functions for creating complex test scenarios
8
- *
9
- * @example
10
- * ```typescript
11
- * // Define builders for creating individual records
12
- * const builders = {
13
- * user: (attrs) => ({ name: 'Test User', email: 'test@example.com', ...attrs }),
14
- * post: (attrs) => ({ title: 'Test Post', content: 'Content', ...attrs })
15
- * };
16
- *
17
- * // Define seeds for complex scenarios
18
- * const seeds = {
19
- * userWithPosts: async (attrs, factory) => {
20
- * const user = await factory.insert('user', attrs);
21
- * await factory.insertMany(3, 'post', { userId: user.id });
22
- * return user;
23
- * }
24
- * };
25
- * ```
26
- */
27
- var Factory = class {
28
- /**
29
- * Creates a typed seed function with proper type inference.
30
- * This is a utility method to help with TypeScript type checking when defining seeds.
31
- *
32
- * @template Seed - The seed function type
33
- * @param seedFn - The seed function to wrap
34
- * @returns The same seed function with proper typing
35
- *
36
- * @example
37
- * ```typescript
38
- * const userWithPostsSeed = Factory.createSeed(async ({ attrs, factory, db }) => {
39
- * const user = await factory.insert('user', attrs);
40
- * return user;
41
- * });
42
- * ```
43
- */
44
- static createSeed(seedFn) {
45
- return seedFn;
46
- }
47
- };
48
-
49
- //#endregion
50
- export { Factory };
51
- //# sourceMappingURL=Factory-BFVnMMCC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Factory-BFVnMMCC.mjs","names":["seedFn: Seed"],"sources":["../src/Factory.ts"],"sourcesContent":["import type { FakerFactory } from './faker';\n\n/**\n * Abstract base class for database factories used in testing.\n * Provides a standardized interface for creating test data using builder and seed patterns.\n *\n * @template Builders - Record of builder functions for creating individual entities\n * @template Seeds - Record of seed functions for creating complex test scenarios\n *\n * @example\n * ```typescript\n * // Define builders for creating individual records\n * const builders = {\n * user: (attrs) => ({ name: 'Test User', email: 'test@example.com', ...attrs }),\n * post: (attrs) => ({ title: 'Test Post', content: 'Content', ...attrs })\n * };\n *\n * // Define seeds for complex scenarios\n * const seeds = {\n * userWithPosts: async (attrs, factory) => {\n * const user = await factory.insert('user', attrs);\n * await factory.insertMany(3, 'post', { userId: user.id });\n * return user;\n * }\n * };\n * ```\n */\nexport abstract class Factory<\n\tBuilders extends Record<string, any>,\n\tSeeds extends Record<string, any>,\n> {\n\t/**\n\t * Creates a typed seed function with proper type inference.\n\t * This is a utility method to help with TypeScript type checking when defining seeds.\n\t *\n\t * @template Seed - The seed function type\n\t * @param seedFn - The seed function to wrap\n\t * @returns The same seed function with proper typing\n\t *\n\t * @example\n\t * ```typescript\n\t * const userWithPostsSeed = Factory.createSeed(async ({ attrs, factory, db }) => {\n\t * const user = await factory.insert('user', attrs);\n\t * return user;\n\t * });\n\t * ```\n\t */\n\tstatic createSeed<Seed extends FactorySeed>(seedFn: Seed): Seed {\n\t\treturn seedFn;\n\t}\n\t/**\n\t * Inserts an object into the database using a builder function.\n\t *\n\t * @param builderName - The name of the builder to use\n\t * @param attrs - The attributes to insert\n\t */\n\tabstract insert<K extends keyof Builders>(\n\t\tbuilderName: K,\n\t\tattrs?: Parameters<Builders[K]>[0],\n\t): Promise<Awaited<ReturnType<Builders[K]>>>;\n\n\t/**\n\t * Inserts multiple objects into the database\n\t *\n\t * @param count - Number of objects to insert\n\t * @param builderName - The name of the builder to use\n\t * @param attrs - The attributes to insert\n\t */\n\tabstract insertMany<K extends keyof Builders>(\n\t\tcount: number,\n\t\tbuilderName: K,\n\t\tattrs?:\n\t\t\t| Parameters<Builders[K]>[0]\n\t\t\t| ((\n\t\t\t\t\tidx: number,\n\t\t\t\t\tfaker: FakerFactory,\n\t\t\t ) => Promise<Parameters<Builders[K]>[0]>),\n\t): Promise<Awaited<ReturnType<Builders[K]>>[]>;\n\n\t/**\n\t * Seeds the database using a seed function.\n\t *\n\t * @param seedName - The name of the seed to use\n\t * @returns The result of the seed function\n\t * @param attrs - The attributes to pass to the seed function\n\t */\n\tabstract seed<K extends keyof Seeds>(\n\t\tseedName: K,\n\t\tattrs?: ExtractSeedAttrs<Seeds[K]>,\n\t): ReturnType<Seeds[K]>;\n}\n\n/**\n * Type definition for a factory builder function that can work with different database types.\n * Builders are responsible for creating individual database records with default values and relationships.\n *\n * @template Attrs - The attributes/input type for the builder\n * @template Factory - The factory instance type\n * @template Result - The type of object returned by the builder\n * @template DB - The database connection type (Kysely, Knex, etc.)\n *\n * @param attrs - Partial attributes to override defaults\n * @param factory - The factory instance for creating related records\n * @param db - The database connection\n * @returns The created record or a promise resolving to it\n *\n * @example\n * ```typescript\n * const userBuilder: MixedFactoryBuilder<UserAttrs, Factory, User, Kysely<DB>> =\n * async (attrs, factory, db) => {\n * return {\n * id: faker.string.uuid(),\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * ...attrs\n * };\n * };\n * ```\n */\nexport type MixedFactoryBuilder<\n\tAttrs = any,\n\tFactory = any,\n\tResult = any,\n\tDB = any,\n> = (attrs: Attrs, factory: Factory, db: DB) => Result | Promise<Result>;\n\n/**\n * Type definition for a factory seed function used to create complex test scenarios.\n * Seeds typically create multiple related records to set up a complete test environment.\n *\n * @template Attrs - The attributes/input type for the seed\n * @template Factory - The factory instance type\n * @template Result - The type of object returned by the seed\n * @template DB - The database connection type (Kysely, Knex, etc.)\n *\n * @param context - Object containing attrs, factory, and db\n * @param context.attrs - Configuration attributes for the seed\n * @param context.factory - The factory instance for creating records\n * @param context.db - The database connection\n * @returns A promise resolving to the seed result\n *\n * @example\n * ```typescript\n * const userWithPostsSeed: FactorySeed<{ postCount?: number }, Factory, User, DB> =\n * async ({ attrs, factory, db }) => {\n * const user = await factory.insert('user', attrs);\n * const postCount = attrs.postCount || 3;\n *\n * for (let i = 0; i < postCount; i++) {\n * await factory.insert('post', { userId: user.id });\n * }\n *\n * return user;\n * };\n * ```\n */\nexport type FactorySeed<\n\tAttrs = any,\n\tFactory = any,\n\tResult = any,\n\tDB = any,\n> = (context: { attrs: Attrs; factory: Factory; db: DB }) => Promise<Result>;\n\n/**\n * Helper type to extract the Attrs type from a FactorySeed function.\n * Used internally by Factory implementations to correctly type the seed method parameters.\n */\nexport type ExtractSeedAttrs<T> = T extends (context: {\n\tattrs: infer A;\n\tfactory: any;\n\tdb: any;\n}) => any\n\t? A\n\t: never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAsB,UAAtB,MAGE;;;;;;;;;;;;;;;;;CAiBD,OAAO,WAAqCA,QAAoB;AAC/D,SAAO;CACP;AAyCD"}
@@ -1,57 +0,0 @@
1
-
2
- //#region src/Factory.ts
3
- /**
4
- * Abstract base class for database factories used in testing.
5
- * Provides a standardized interface for creating test data using builder and seed patterns.
6
- *
7
- * @template Builders - Record of builder functions for creating individual entities
8
- * @template Seeds - Record of seed functions for creating complex test scenarios
9
- *
10
- * @example
11
- * ```typescript
12
- * // Define builders for creating individual records
13
- * const builders = {
14
- * user: (attrs) => ({ name: 'Test User', email: 'test@example.com', ...attrs }),
15
- * post: (attrs) => ({ title: 'Test Post', content: 'Content', ...attrs })
16
- * };
17
- *
18
- * // Define seeds for complex scenarios
19
- * const seeds = {
20
- * userWithPosts: async (attrs, factory) => {
21
- * const user = await factory.insert('user', attrs);
22
- * await factory.insertMany(3, 'post', { userId: user.id });
23
- * return user;
24
- * }
25
- * };
26
- * ```
27
- */
28
- var Factory = class {
29
- /**
30
- * Creates a typed seed function with proper type inference.
31
- * This is a utility method to help with TypeScript type checking when defining seeds.
32
- *
33
- * @template Seed - The seed function type
34
- * @param seedFn - The seed function to wrap
35
- * @returns The same seed function with proper typing
36
- *
37
- * @example
38
- * ```typescript
39
- * const userWithPostsSeed = Factory.createSeed(async ({ attrs, factory, db }) => {
40
- * const user = await factory.insert('user', attrs);
41
- * return user;
42
- * });
43
- * ```
44
- */
45
- static createSeed(seedFn) {
46
- return seedFn;
47
- }
48
- };
49
-
50
- //#endregion
51
- Object.defineProperty(exports, 'Factory', {
52
- enumerable: true,
53
- get: function () {
54
- return Factory;
55
- }
56
- });
57
- //# sourceMappingURL=Factory-BhjUOBWN.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Factory-BhjUOBWN.cjs","names":["seedFn: Seed"],"sources":["../src/Factory.ts"],"sourcesContent":["import type { FakerFactory } from './faker';\n\n/**\n * Abstract base class for database factories used in testing.\n * Provides a standardized interface for creating test data using builder and seed patterns.\n *\n * @template Builders - Record of builder functions for creating individual entities\n * @template Seeds - Record of seed functions for creating complex test scenarios\n *\n * @example\n * ```typescript\n * // Define builders for creating individual records\n * const builders = {\n * user: (attrs) => ({ name: 'Test User', email: 'test@example.com', ...attrs }),\n * post: (attrs) => ({ title: 'Test Post', content: 'Content', ...attrs })\n * };\n *\n * // Define seeds for complex scenarios\n * const seeds = {\n * userWithPosts: async (attrs, factory) => {\n * const user = await factory.insert('user', attrs);\n * await factory.insertMany(3, 'post', { userId: user.id });\n * return user;\n * }\n * };\n * ```\n */\nexport abstract class Factory<\n\tBuilders extends Record<string, any>,\n\tSeeds extends Record<string, any>,\n> {\n\t/**\n\t * Creates a typed seed function with proper type inference.\n\t * This is a utility method to help with TypeScript type checking when defining seeds.\n\t *\n\t * @template Seed - The seed function type\n\t * @param seedFn - The seed function to wrap\n\t * @returns The same seed function with proper typing\n\t *\n\t * @example\n\t * ```typescript\n\t * const userWithPostsSeed = Factory.createSeed(async ({ attrs, factory, db }) => {\n\t * const user = await factory.insert('user', attrs);\n\t * return user;\n\t * });\n\t * ```\n\t */\n\tstatic createSeed<Seed extends FactorySeed>(seedFn: Seed): Seed {\n\t\treturn seedFn;\n\t}\n\t/**\n\t * Inserts an object into the database using a builder function.\n\t *\n\t * @param builderName - The name of the builder to use\n\t * @param attrs - The attributes to insert\n\t */\n\tabstract insert<K extends keyof Builders>(\n\t\tbuilderName: K,\n\t\tattrs?: Parameters<Builders[K]>[0],\n\t): Promise<Awaited<ReturnType<Builders[K]>>>;\n\n\t/**\n\t * Inserts multiple objects into the database\n\t *\n\t * @param count - Number of objects to insert\n\t * @param builderName - The name of the builder to use\n\t * @param attrs - The attributes to insert\n\t */\n\tabstract insertMany<K extends keyof Builders>(\n\t\tcount: number,\n\t\tbuilderName: K,\n\t\tattrs?:\n\t\t\t| Parameters<Builders[K]>[0]\n\t\t\t| ((\n\t\t\t\t\tidx: number,\n\t\t\t\t\tfaker: FakerFactory,\n\t\t\t ) => Promise<Parameters<Builders[K]>[0]>),\n\t): Promise<Awaited<ReturnType<Builders[K]>>[]>;\n\n\t/**\n\t * Seeds the database using a seed function.\n\t *\n\t * @param seedName - The name of the seed to use\n\t * @returns The result of the seed function\n\t * @param attrs - The attributes to pass to the seed function\n\t */\n\tabstract seed<K extends keyof Seeds>(\n\t\tseedName: K,\n\t\tattrs?: ExtractSeedAttrs<Seeds[K]>,\n\t): ReturnType<Seeds[K]>;\n}\n\n/**\n * Type definition for a factory builder function that can work with different database types.\n * Builders are responsible for creating individual database records with default values and relationships.\n *\n * @template Attrs - The attributes/input type for the builder\n * @template Factory - The factory instance type\n * @template Result - The type of object returned by the builder\n * @template DB - The database connection type (Kysely, Knex, etc.)\n *\n * @param attrs - Partial attributes to override defaults\n * @param factory - The factory instance for creating related records\n * @param db - The database connection\n * @returns The created record or a promise resolving to it\n *\n * @example\n * ```typescript\n * const userBuilder: MixedFactoryBuilder<UserAttrs, Factory, User, Kysely<DB>> =\n * async (attrs, factory, db) => {\n * return {\n * id: faker.string.uuid(),\n * name: faker.person.fullName(),\n * email: faker.internet.email(),\n * ...attrs\n * };\n * };\n * ```\n */\nexport type MixedFactoryBuilder<\n\tAttrs = any,\n\tFactory = any,\n\tResult = any,\n\tDB = any,\n> = (attrs: Attrs, factory: Factory, db: DB) => Result | Promise<Result>;\n\n/**\n * Type definition for a factory seed function used to create complex test scenarios.\n * Seeds typically create multiple related records to set up a complete test environment.\n *\n * @template Attrs - The attributes/input type for the seed\n * @template Factory - The factory instance type\n * @template Result - The type of object returned by the seed\n * @template DB - The database connection type (Kysely, Knex, etc.)\n *\n * @param context - Object containing attrs, factory, and db\n * @param context.attrs - Configuration attributes for the seed\n * @param context.factory - The factory instance for creating records\n * @param context.db - The database connection\n * @returns A promise resolving to the seed result\n *\n * @example\n * ```typescript\n * const userWithPostsSeed: FactorySeed<{ postCount?: number }, Factory, User, DB> =\n * async ({ attrs, factory, db }) => {\n * const user = await factory.insert('user', attrs);\n * const postCount = attrs.postCount || 3;\n *\n * for (let i = 0; i < postCount; i++) {\n * await factory.insert('post', { userId: user.id });\n * }\n *\n * return user;\n * };\n * ```\n */\nexport type FactorySeed<\n\tAttrs = any,\n\tFactory = any,\n\tResult = any,\n\tDB = any,\n> = (context: { attrs: Attrs; factory: Factory; db: DB }) => Promise<Result>;\n\n/**\n * Helper type to extract the Attrs type from a FactorySeed function.\n * Used internally by Factory implementations to correctly type the seed method parameters.\n */\nexport type ExtractSeedAttrs<T> = T extends (context: {\n\tattrs: infer A;\n\tfactory: any;\n\tdb: any;\n}) => any\n\t? A\n\t: never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAsB,UAAtB,MAGE;;;;;;;;;;;;;;;;;CAiBD,OAAO,WAAqCA,QAAoB;AAC/D,SAAO;CACP;AAyCD"}
@@ -1,147 +0,0 @@
1
- import { FakerFactory } from "./faker-DsYCplsG.mjs";
2
-
3
- //#region src/Factory.d.ts
4
-
5
- /**
6
- * Abstract base class for database factories used in testing.
7
- * Provides a standardized interface for creating test data using builder and seed patterns.
8
- *
9
- * @template Builders - Record of builder functions for creating individual entities
10
- * @template Seeds - Record of seed functions for creating complex test scenarios
11
- *
12
- * @example
13
- * ```typescript
14
- * // Define builders for creating individual records
15
- * const builders = {
16
- * user: (attrs) => ({ name: 'Test User', email: 'test@example.com', ...attrs }),
17
- * post: (attrs) => ({ title: 'Test Post', content: 'Content', ...attrs })
18
- * };
19
- *
20
- * // Define seeds for complex scenarios
21
- * const seeds = {
22
- * userWithPosts: async (attrs, factory) => {
23
- * const user = await factory.insert('user', attrs);
24
- * await factory.insertMany(3, 'post', { userId: user.id });
25
- * return user;
26
- * }
27
- * };
28
- * ```
29
- */
30
- declare abstract class Factory<Builders extends Record<string, any>, Seeds extends Record<string, any>> {
31
- /**
32
- * Creates a typed seed function with proper type inference.
33
- * This is a utility method to help with TypeScript type checking when defining seeds.
34
- *
35
- * @template Seed - The seed function type
36
- * @param seedFn - The seed function to wrap
37
- * @returns The same seed function with proper typing
38
- *
39
- * @example
40
- * ```typescript
41
- * const userWithPostsSeed = Factory.createSeed(async ({ attrs, factory, db }) => {
42
- * const user = await factory.insert('user', attrs);
43
- * return user;
44
- * });
45
- * ```
46
- */
47
- static createSeed<Seed extends FactorySeed>(seedFn: Seed): Seed;
48
- /**
49
- * Inserts an object into the database using a builder function.
50
- *
51
- * @param builderName - The name of the builder to use
52
- * @param attrs - The attributes to insert
53
- */
54
- abstract insert<K extends keyof Builders>(builderName: K, attrs?: Parameters<Builders[K]>[0]): Promise<Awaited<ReturnType<Builders[K]>>>;
55
- /**
56
- * Inserts multiple objects into the database
57
- *
58
- * @param count - Number of objects to insert
59
- * @param builderName - The name of the builder to use
60
- * @param attrs - The attributes to insert
61
- */
62
- abstract insertMany<K extends keyof Builders>(count: number, builderName: K, attrs?: Parameters<Builders[K]>[0] | ((idx: number, faker: FakerFactory) => Promise<Parameters<Builders[K]>[0]>)): Promise<Awaited<ReturnType<Builders[K]>>[]>;
63
- /**
64
- * Seeds the database using a seed function.
65
- *
66
- * @param seedName - The name of the seed to use
67
- * @returns The result of the seed function
68
- * @param attrs - The attributes to pass to the seed function
69
- */
70
- abstract seed<K extends keyof Seeds>(seedName: K, attrs?: ExtractSeedAttrs<Seeds[K]>): ReturnType<Seeds[K]>;
71
- }
72
- /**
73
- * Type definition for a factory builder function that can work with different database types.
74
- * Builders are responsible for creating individual database records with default values and relationships.
75
- *
76
- * @template Attrs - The attributes/input type for the builder
77
- * @template Factory - The factory instance type
78
- * @template Result - The type of object returned by the builder
79
- * @template DB - The database connection type (Kysely, Knex, etc.)
80
- *
81
- * @param attrs - Partial attributes to override defaults
82
- * @param factory - The factory instance for creating related records
83
- * @param db - The database connection
84
- * @returns The created record or a promise resolving to it
85
- *
86
- * @example
87
- * ```typescript
88
- * const userBuilder: MixedFactoryBuilder<UserAttrs, Factory, User, Kysely<DB>> =
89
- * async (attrs, factory, db) => {
90
- * return {
91
- * id: faker.string.uuid(),
92
- * name: faker.person.fullName(),
93
- * email: faker.internet.email(),
94
- * ...attrs
95
- * };
96
- * };
97
- * ```
98
- */
99
- type MixedFactoryBuilder<Attrs = any, Factory = any, Result = any, DB = any> = (attrs: Attrs, factory: Factory, db: DB) => Result | Promise<Result>;
100
- /**
101
- * Type definition for a factory seed function used to create complex test scenarios.
102
- * Seeds typically create multiple related records to set up a complete test environment.
103
- *
104
- * @template Attrs - The attributes/input type for the seed
105
- * @template Factory - The factory instance type
106
- * @template Result - The type of object returned by the seed
107
- * @template DB - The database connection type (Kysely, Knex, etc.)
108
- *
109
- * @param context - Object containing attrs, factory, and db
110
- * @param context.attrs - Configuration attributes for the seed
111
- * @param context.factory - The factory instance for creating records
112
- * @param context.db - The database connection
113
- * @returns A promise resolving to the seed result
114
- *
115
- * @example
116
- * ```typescript
117
- * const userWithPostsSeed: FactorySeed<{ postCount?: number }, Factory, User, DB> =
118
- * async ({ attrs, factory, db }) => {
119
- * const user = await factory.insert('user', attrs);
120
- * const postCount = attrs.postCount || 3;
121
- *
122
- * for (let i = 0; i < postCount; i++) {
123
- * await factory.insert('post', { userId: user.id });
124
- * }
125
- *
126
- * return user;
127
- * };
128
- * ```
129
- */
130
- type FactorySeed<Attrs = any, Factory = any, Result = any, DB = any> = (context: {
131
- attrs: Attrs;
132
- factory: Factory;
133
- db: DB;
134
- }) => Promise<Result>;
135
- /**
136
- * Helper type to extract the Attrs type from a FactorySeed function.
137
- * Used internally by Factory implementations to correctly type the seed method parameters.
138
- */
139
- type ExtractSeedAttrs<T> = T extends ((context: {
140
- attrs: infer A;
141
- factory: any;
142
- db: any;
143
- }) => any) ? A : never;
144
- //# sourceMappingURL=Factory.d.ts.map
145
- //#endregion
146
- export { ExtractSeedAttrs, Factory, FactorySeed, MixedFactoryBuilder };
147
- //# sourceMappingURL=Factory-CVR3GdkW.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Factory-CVR3GdkW.d.mts","names":[],"sources":["../src/Factory.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;;;;;;;;;;;;;;;;;;;;AAiD6B,uBAjDP,OAiDO,CAAA,iBAhDX,MAgDW,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,cA/Cd,MA+Cc,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA;EAAQ;;;;;;;;;;;;;;;;EAavB,OAAA,UAAA,CAAA,aA1CkB,WA0ClB,CAAA,CAAA,MAAA,EA1CuC,IA0CvC,CAAA,EA1C8C,IA0C9C;EA8BF;;;;;;EAK0C,SAAW,MAAA,CAAA,UAAA,MApEhC,QAoEgC,CAAA,CAAA,WAAA,EAnElD,CAmEkD,EAAA,KAAA,CAAA,EAlEvD,UAkEuD,CAlE5C,QAkE4C,CAlEnC,CAkEmC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAjE7D,OAiE6D,CAjErD,OAiEqD,CAjE7C,UAiE6C,CAjElC,QAiEkC,CAjEzB,CAiEyB,CAAA,CAAA,CAAA,CAAA;EAAM;AAAP;AAgChE;;;;;EAKsD,SAAe,UAAA,CAAA,UAAA,MA7FhC,QA6FgC,CAAA,CAAA,KAAA,EAAA,MAAA,EAAA,WAAA,EA3FtD,CA2FsD,EAAA,KAAA,CAAA,EAzFhE,UAyFgE,CAzFrD,QAyFqD,CAzF5C,CAyF4C,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA,MAAA,EAAA,KAAA,EAtFzD,YAsFyD,EAAA,GArF3D,OAqF2D,CArFnD,UAqFmD,CArFxC,QAqFwC,CArF/B,CAqF+B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EApFjE,OAoFiE,CApFzD,OAoFyD,CApFjD,UAoFiD,CApFtC,QAoFsC,CApF7B,CAoF6B,CAAA,CAAA,CAAA,EAAA,CAAA;EAAM;AAAP;AAMpE;;;;AAKI;gCAtF2B,iBACnB,WACF,iBAAiB,MAAM,MAC7B,WAAW,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BT,kFAKA,gBAAgB,aAAa,OAAO,SAAS,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCrD;SAKW;WAAgB;MAAa;MAAS,QAAQ;;;;;KAMzD,sBAAsB;;;;aAK/B"}
@@ -1,147 +0,0 @@
1
- import { FakerFactory } from "./faker-Dg3trU4a.cjs";
2
-
3
- //#region src/Factory.d.ts
4
-
5
- /**
6
- * Abstract base class for database factories used in testing.
7
- * Provides a standardized interface for creating test data using builder and seed patterns.
8
- *
9
- * @template Builders - Record of builder functions for creating individual entities
10
- * @template Seeds - Record of seed functions for creating complex test scenarios
11
- *
12
- * @example
13
- * ```typescript
14
- * // Define builders for creating individual records
15
- * const builders = {
16
- * user: (attrs) => ({ name: 'Test User', email: 'test@example.com', ...attrs }),
17
- * post: (attrs) => ({ title: 'Test Post', content: 'Content', ...attrs })
18
- * };
19
- *
20
- * // Define seeds for complex scenarios
21
- * const seeds = {
22
- * userWithPosts: async (attrs, factory) => {
23
- * const user = await factory.insert('user', attrs);
24
- * await factory.insertMany(3, 'post', { userId: user.id });
25
- * return user;
26
- * }
27
- * };
28
- * ```
29
- */
30
- declare abstract class Factory<Builders extends Record<string, any>, Seeds extends Record<string, any>> {
31
- /**
32
- * Creates a typed seed function with proper type inference.
33
- * This is a utility method to help with TypeScript type checking when defining seeds.
34
- *
35
- * @template Seed - The seed function type
36
- * @param seedFn - The seed function to wrap
37
- * @returns The same seed function with proper typing
38
- *
39
- * @example
40
- * ```typescript
41
- * const userWithPostsSeed = Factory.createSeed(async ({ attrs, factory, db }) => {
42
- * const user = await factory.insert('user', attrs);
43
- * return user;
44
- * });
45
- * ```
46
- */
47
- static createSeed<Seed extends FactorySeed>(seedFn: Seed): Seed;
48
- /**
49
- * Inserts an object into the database using a builder function.
50
- *
51
- * @param builderName - The name of the builder to use
52
- * @param attrs - The attributes to insert
53
- */
54
- abstract insert<K extends keyof Builders>(builderName: K, attrs?: Parameters<Builders[K]>[0]): Promise<Awaited<ReturnType<Builders[K]>>>;
55
- /**
56
- * Inserts multiple objects into the database
57
- *
58
- * @param count - Number of objects to insert
59
- * @param builderName - The name of the builder to use
60
- * @param attrs - The attributes to insert
61
- */
62
- abstract insertMany<K extends keyof Builders>(count: number, builderName: K, attrs?: Parameters<Builders[K]>[0] | ((idx: number, faker: FakerFactory) => Promise<Parameters<Builders[K]>[0]>)): Promise<Awaited<ReturnType<Builders[K]>>[]>;
63
- /**
64
- * Seeds the database using a seed function.
65
- *
66
- * @param seedName - The name of the seed to use
67
- * @returns The result of the seed function
68
- * @param attrs - The attributes to pass to the seed function
69
- */
70
- abstract seed<K extends keyof Seeds>(seedName: K, attrs?: ExtractSeedAttrs<Seeds[K]>): ReturnType<Seeds[K]>;
71
- }
72
- /**
73
- * Type definition for a factory builder function that can work with different database types.
74
- * Builders are responsible for creating individual database records with default values and relationships.
75
- *
76
- * @template Attrs - The attributes/input type for the builder
77
- * @template Factory - The factory instance type
78
- * @template Result - The type of object returned by the builder
79
- * @template DB - The database connection type (Kysely, Knex, etc.)
80
- *
81
- * @param attrs - Partial attributes to override defaults
82
- * @param factory - The factory instance for creating related records
83
- * @param db - The database connection
84
- * @returns The created record or a promise resolving to it
85
- *
86
- * @example
87
- * ```typescript
88
- * const userBuilder: MixedFactoryBuilder<UserAttrs, Factory, User, Kysely<DB>> =
89
- * async (attrs, factory, db) => {
90
- * return {
91
- * id: faker.string.uuid(),
92
- * name: faker.person.fullName(),
93
- * email: faker.internet.email(),
94
- * ...attrs
95
- * };
96
- * };
97
- * ```
98
- */
99
- type MixedFactoryBuilder<Attrs = any, Factory = any, Result = any, DB = any> = (attrs: Attrs, factory: Factory, db: DB) => Result | Promise<Result>;
100
- /**
101
- * Type definition for a factory seed function used to create complex test scenarios.
102
- * Seeds typically create multiple related records to set up a complete test environment.
103
- *
104
- * @template Attrs - The attributes/input type for the seed
105
- * @template Factory - The factory instance type
106
- * @template Result - The type of object returned by the seed
107
- * @template DB - The database connection type (Kysely, Knex, etc.)
108
- *
109
- * @param context - Object containing attrs, factory, and db
110
- * @param context.attrs - Configuration attributes for the seed
111
- * @param context.factory - The factory instance for creating records
112
- * @param context.db - The database connection
113
- * @returns A promise resolving to the seed result
114
- *
115
- * @example
116
- * ```typescript
117
- * const userWithPostsSeed: FactorySeed<{ postCount?: number }, Factory, User, DB> =
118
- * async ({ attrs, factory, db }) => {
119
- * const user = await factory.insert('user', attrs);
120
- * const postCount = attrs.postCount || 3;
121
- *
122
- * for (let i = 0; i < postCount; i++) {
123
- * await factory.insert('post', { userId: user.id });
124
- * }
125
- *
126
- * return user;
127
- * };
128
- * ```
129
- */
130
- type FactorySeed<Attrs = any, Factory = any, Result = any, DB = any> = (context: {
131
- attrs: Attrs;
132
- factory: Factory;
133
- db: DB;
134
- }) => Promise<Result>;
135
- /**
136
- * Helper type to extract the Attrs type from a FactorySeed function.
137
- * Used internally by Factory implementations to correctly type the seed method parameters.
138
- */
139
- type ExtractSeedAttrs<T> = T extends ((context: {
140
- attrs: infer A;
141
- factory: any;
142
- db: any;
143
- }) => any) ? A : never;
144
- //# sourceMappingURL=Factory.d.ts.map
145
- //#endregion
146
- export { ExtractSeedAttrs, Factory, FactorySeed, MixedFactoryBuilder };
147
- //# sourceMappingURL=Factory-Cwzho3c8.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Factory-Cwzho3c8.d.cts","names":[],"sources":["../src/Factory.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;;;;;;;;;;;;;;;;;;;;AAiD6B,uBAjDP,OAiDO,CAAA,iBAhDX,MAgDW,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,cA/Cd,MA+Cc,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA;EAAQ;;;;;;;;;;;;;;;;EAavB,OAAA,UAAA,CAAA,aA1CkB,WA0ClB,CAAA,CAAA,MAAA,EA1CuC,IA0CvC,CAAA,EA1C8C,IA0C9C;EA8BF;;;;;;EAK0C,SAAW,MAAA,CAAA,UAAA,MApEhC,QAoEgC,CAAA,CAAA,WAAA,EAnElD,CAmEkD,EAAA,KAAA,CAAA,EAlEvD,UAkEuD,CAlE5C,QAkE4C,CAlEnC,CAkEmC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAjE7D,OAiE6D,CAjErD,OAiEqD,CAjE7C,UAiE6C,CAjElC,QAiEkC,CAjEzB,CAiEyB,CAAA,CAAA,CAAA,CAAA;EAAM;AAAP;AAgChE;;;;;EAKsD,SAAe,UAAA,CAAA,UAAA,MA7FhC,QA6FgC,CAAA,CAAA,KAAA,EAAA,MAAA,EAAA,WAAA,EA3FtD,CA2FsD,EAAA,KAAA,CAAA,EAzFhE,UAyFgE,CAzFrD,QAyFqD,CAzF5C,CAyF4C,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA,MAAA,EAAA,KAAA,EAtFzD,YAsFyD,EAAA,GArF3D,OAqF2D,CArFnD,UAqFmD,CArFxC,QAqFwC,CArF/B,CAqF+B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EApFjE,OAoFiE,CApFzD,OAoFyD,CApFjD,UAoFiD,CApFtC,QAoFsC,CApF7B,CAoF6B,CAAA,CAAA,CAAA,EAAA,CAAA;EAAM;AAAP;AAMpE;;;;AAKI;gCAtF2B,iBACnB,WACF,iBAAiB,MAAM,MAC7B,WAAW,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BT,kFAKA,gBAAgB,aAAa,OAAO,SAAS,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCrD;SAKW;WAAgB;MAAa;MAAS,QAAQ;;;;;KAMzD,sBAAsB;;;;aAK/B"}