@geekmidas/testkit 10.0.0-alpha.3 → 10.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +31 -15
  93. package/dist/better-auth.cjs.map +1 -1
  94. package/dist/better-auth.d.cts +13142 -4
  95. package/dist/better-auth.d.cts.map +1 -1
  96. package/dist/better-auth.d.mts +13142 -4
  97. package/dist/better-auth.d.mts.map +1 -1
  98. package/dist/better-auth.mjs +29 -13
  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 +262 -8
  117. package/dist/faker.cjs.map +1 -0
  118. package/dist/faker.d.cts +162 -2
  119. package/dist/faker.d.cts.map +1 -0
  120. package/dist/faker.d.mts +162 -2
  121. package/dist/faker.d.mts.map +1 -0
  122. package/dist/faker.mjs +255 -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 +59 -16
  210. package/dist/Factory-BFVnMMCC.mjs +0 -51
  211. package/dist/Factory-BFVnMMCC.mjs.map +0 -1
  212. package/dist/Factory-BOX312yd.d.cts +0 -147
  213. package/dist/Factory-BOX312yd.d.cts.map +0 -1
  214. package/dist/Factory-BhjUOBWN.cjs +0 -57
  215. package/dist/Factory-BhjUOBWN.cjs.map +0 -1
  216. package/dist/Factory-C6W78ulZ.d.mts +0 -147
  217. package/dist/Factory-C6W78ulZ.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-Cc2UmOJk.d.mts +0 -228
  221. package/dist/KyselyFactory-Cc2UmOJk.d.mts.map +0 -1
  222. package/dist/KyselyFactory-DMswpwji.mjs +0 -241
  223. package/dist/KyselyFactory-DMswpwji.mjs.map +0 -1
  224. package/dist/KyselyFactory-Dy5zzV4B.d.cts +0 -228
  225. package/dist/KyselyFactory-Dy5zzV4B.d.cts.map +0 -1
  226. package/dist/ObjectionFactory-BYnPr9ZP.d.mts +0 -241
  227. package/dist/ObjectionFactory-BYnPr9ZP.d.mts.map +0 -1
  228. package/dist/ObjectionFactory-BeFBYcan.cjs +0 -272
  229. package/dist/ObjectionFactory-BeFBYcan.cjs.map +0 -1
  230. package/dist/ObjectionFactory-CD-WFuMJ.d.cts +0 -241
  231. package/dist/ObjectionFactory-CD-WFuMJ.d.cts.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-DGOcVlKD.d.cts +0 -13
  285. package/dist/directory-DGOcVlKD.d.cts.map +0 -1
  286. package/dist/directory-DiQ_DkaF.d.mts +0 -13
  287. package/dist/directory-DiQ_DkaF.d.mts.map +0 -1
  288. package/dist/faker-B14IEMIN.cjs +0 -304
  289. package/dist/faker-B14IEMIN.cjs.map +0 -1
  290. package/dist/faker-BGKYFoCT.mjs +0 -262
  291. package/dist/faker-BGKYFoCT.mjs.map +0 -1
  292. package/dist/faker-Cg76aFNO.d.cts +0 -166
  293. package/dist/faker-Cg76aFNO.d.cts.map +0 -1
  294. package/dist/faker-D9gz7KjY.d.mts +0 -166
  295. package/dist/faker-D9gz7KjY.d.mts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VitestTransactionIsolator.d.mts","names":[],"sources":["../src/VitestTransactionIsolator.ts"],"mappings":";;;;;;;;;;iBAWiB,iBAAiB,aAAa;;;;;EAK9C,KAAK;;;;;YAMM,yBACX,aACA,qBACG,iBAAiB,eAAe;;;;;;;;;;;;;;YAexB,gBAAgB,aAAa,aACxC,KAAK,gBACD,WAAW,QAAQ;;;;;;;oBAQZ;;;;;EAKX;;;;;EAKA;;;;;EAKA;;;;;EAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA8BqB,kCAAkC,OAAO;mBAsBjC;;;;;;;;;;WAZpB,SACR,MAAM,OACN,gBAAgB,gBAChB,KAAK,KAAK,gBAAgB,gBACxB;WAEM,QAAQ,MAAM,QAAQ;;;;;;EAM/B,YAA6B,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BlC,0BAA0B,iBAAiB,8BAC1C,SAAS,0BAA0B,OAAO,aAAa,YAAS,QAAA,iBAAA,uBAAA;;YA8FtD,qBAAqB,cAAc,OAAO,QAAQ;;;;;;;;;YAUlD,mBAAmB,QAC5B,qBAAqB,QACrB,qBAAqB;;;;;;;;iBAgBP,qBAAqB;WAC5B,SAAS,gBAAgB;;iBAGlB,0BAChB,OACA,aACA,iBAAiB;;EAGjB,YAAY,mBAAmB;;EAE/B,SAAS,KAAK,gBAAgB;;EAE9B,iBAAiB;;EAEjB,WAAW,gBAAgB,aAAa;;;;;;YAO7B,gBACX,aACA,iBAAiB,8BAEhB,WAAW,YACX,KAAK,gBACD,SAAS,KAAK,QAAQ,SAAS;;;;;;;;;YAWzB,yBACX,aACA,iBAAiB,yBACjB,iBAAiB,WAAW,qBAAqB,WAChD,sBAEE;GACF,kBACA,cACA,KACC,SAAS,iBAAiB,eAAe,WAAW,MAChD;GAEL,kBACA,cACA,iBACA,KACC,SAAS,iBAAiB,eAAe,WAAW,MAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqCS,mBACf,aACA,iBAAiB,yBAEjB,UAAU,WAAW,0BAErB,aAAa,GACb,UAAU,gBAAgB,aAAa,YACrC,yBAAyB,aAAa,UAAU"}
@@ -1,3 +1,185 @@
1
- import { IsolationLevel, VitestPostgresTransactionIsolator, extendWithFixtures } from "./VitestTransactionIsolator-CvwPecpl.mjs";
1
+ import { EnvironmentParser } from "@geekmidas/envkit";
2
+ import { serviceContext } from "@geekmidas/services";
3
+ //#region src/VitestTransactionIsolator.ts
4
+ /**
5
+ * PostgreSQL transaction isolation levels.
6
+ * Controls the visibility of concurrent transactions.
7
+ *
8
+ * @see https://www.postgresql.org/docs/current/transaction-iso.html
9
+ */
10
+ let IsolationLevel = /* @__PURE__ */ function(IsolationLevel) {
11
+ /**
12
+ * Lowest isolation level. Allows dirty reads.
13
+ * Not recommended for testing.
14
+ */
15
+ IsolationLevel["READ_UNCOMMITTED"] = "READ UNCOMMITTED";
16
+ /**
17
+ * Default PostgreSQL isolation level.
18
+ * Prevents dirty reads but allows non-repeatable reads.
19
+ */
20
+ IsolationLevel["READ_COMMITTED"] = "READ COMMITTED";
21
+ /**
22
+ * Prevents dirty reads and non-repeatable reads.
23
+ * Recommended for most test scenarios.
24
+ */
25
+ IsolationLevel["REPEATABLE_READ"] = "REPEATABLE READ";
26
+ /**
27
+ * Highest isolation level. Prevents all phenomena.
28
+ * May cause performance overhead in tests.
29
+ */
30
+ IsolationLevel["SERIALIZABLE"] = "SERIALIZABLE";
31
+ return IsolationLevel;
32
+ }({});
33
+ /**
34
+ * Abstract base class for implementing database transaction isolation in Vitest tests.
35
+ * Provides automatic transaction rollback after each test to maintain test isolation.
36
+ * Subclasses must implement the transact() method for their specific database driver.
37
+ *
38
+ * @template TConn - The database connection type
39
+ * @template Transaction - The transaction type
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Implement for your database driver
44
+ * class MyDatabaseIsolator extends VitestPostgresTransactionIsolator<MyDB, MyTx> {
45
+ * async transact(conn: MyDB, level: IsolationLevel, fn: (tx: MyTx) => Promise<void>) {
46
+ * await conn.transaction(level, fn);
47
+ * }
48
+ * }
49
+ *
50
+ * // Use in tests
51
+ * const isolator = new MyDatabaseIsolator(test);
52
+ * const isolatedTest = isolator.wrapVitestWithTransaction(db);
53
+ *
54
+ * isolatedTest('should create user', async ({ trx }) => {
55
+ * await trx.insert('users', { name: 'Test' });
56
+ * // Data is automatically rolled back after test
57
+ * });
58
+ * ```
59
+ */
60
+ var VitestPostgresTransactionIsolator = class {
61
+ api;
62
+ /**
63
+ * Creates a new VitestPostgresTransactionIsolator instance.
64
+ *
65
+ * @param api - The Vitest test API (usually the `test` export from vitest)
66
+ */
67
+ constructor(api) {
68
+ this.api = api;
69
+ }
70
+ /**
71
+ * Creates a wrapped version of Vitest's test API that provides transaction isolation.
72
+ * Each test will run within a database transaction that is automatically rolled back.
73
+ *
74
+ * @param options - Configuration options for transaction wrapping
75
+ * @returns A wrapped test API with transaction support
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const isolatedTest = isolator.wrapVitestWithTransaction({
80
+ * connection: db,
81
+ * setup: async (trx) => {
82
+ * await trx.insert('settings', { key: 'test', value: 'true' });
83
+ * },
84
+ * fixtures: {
85
+ * factory: (trx) => new Factory(trx),
86
+ * },
87
+ * });
88
+ *
89
+ * isolatedTest('test with transaction', async ({ trx, factory }) => {
90
+ * const user = await factory.insert('user', { name: 'Test' });
91
+ * expect(user).toBeDefined();
92
+ * });
93
+ * ```
94
+ */
95
+ wrapVitestWithTransaction(options) {
96
+ const { connection, setup, isolationLevel = "REPEATABLE READ", fixtures } = options;
97
+ let resolved;
98
+ const resolveConnection = async () => {
99
+ if (resolved === void 0) resolved = await (isConstruct(connection) ? connection.service.register({
100
+ envParser: new EnvironmentParser({ ...process.env }),
101
+ context: serviceContext
102
+ }) : connection());
103
+ return resolved;
104
+ };
105
+ const additionalFixtures = {};
106
+ if (fixtures) for (const [key, creator] of Object.entries(fixtures)) additionalFixtures[key] = async ({ trx }, use) => {
107
+ await use(await creator(trx));
108
+ };
109
+ return this.api.extend({
110
+ trx: async ({}, use) => {
111
+ class TestRollback extends Error {
112
+ constructor() {
113
+ super("Test rollback");
114
+ this.name = "TestRollback";
115
+ }
116
+ }
117
+ let testError;
118
+ const conn = await resolveConnection();
119
+ try {
120
+ await this.transact(conn, isolationLevel, async (transaction) => {
121
+ try {
122
+ await setup?.(transaction);
123
+ await use(transaction);
124
+ } catch (error) {
125
+ testError = error;
126
+ }
127
+ throw new TestRollback();
128
+ });
129
+ } catch (error) {
130
+ if (!(error instanceof TestRollback)) throw error;
131
+ if (testError) throw testError;
132
+ }
133
+ },
134
+ ...additionalFixtures
135
+ });
136
+ }
137
+ };
138
+ /** A construct is distinguished from a factory by owning a service. */
139
+ function isConstruct(connection) {
140
+ return typeof connection !== "function";
141
+ }
142
+ /**
143
+ * Extends a wrapped test API with additional fixtures that depend on the transaction.
144
+ * This allows composing test context with factories, repositories, or other helpers.
145
+ *
146
+ * @template Transaction - The transaction type
147
+ * @template Extended - The type of additional context to provide
148
+ * @param wrappedTest - The base wrapped test from wrapVitestWithTransaction
149
+ * @param fixtures - Object mapping fixture names to creator functions
150
+ * @returns An extended test API with both trx and the additional fixtures
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * import { wrapVitestKyselyTransaction, extendWithFixtures } from '@geekmidas/testkit/kysely';
155
+ *
156
+ * // Create base wrapped test
157
+ * const baseTest = wrapVitestKyselyTransaction(test, {
158
+ * connection: db,
159
+ * setup: createTestTables,
160
+ * });
161
+ *
162
+ * // Extend with fixtures
163
+ * const it = extendWithFixtures(baseTest, {
164
+ * factory: (trx) => new KyselyFactory(builders, seeds, trx),
165
+ * userRepo: (trx) => new UserRepository(trx),
166
+ * });
167
+ *
168
+ * // Use in tests - trx and all fixtures are available
169
+ * it('should create user with factory', async ({ trx, factory, userRepo }) => {
170
+ * const user = await factory.insert('user', { name: 'Test' });
171
+ * expect(user).toBeDefined();
172
+ * });
173
+ * ```
174
+ */
175
+ function extendWithFixtures(wrappedTest, fixtures) {
176
+ const fixtureDefinitions = {};
177
+ for (const [key, creator] of Object.entries(fixtures)) fixtureDefinitions[key] = async ({ trx }, use) => {
178
+ await use(await creator(trx));
179
+ };
180
+ return wrappedTest.extend(fixtureDefinitions);
181
+ }
182
+ //#endregion
183
+ export { IsolationLevel, VitestPostgresTransactionIsolator, extendWithFixtures };
2
184
 
3
- export { IsolationLevel, VitestPostgresTransactionIsolator, extendWithFixtures };
185
+ //# sourceMappingURL=VitestTransactionIsolator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VitestTransactionIsolator.mjs","names":[],"sources":["../src/VitestTransactionIsolator.ts"],"sourcesContent":["import { EnvironmentParser } from '@geekmidas/envkit';\nimport { type Service, serviceContext } from '@geekmidas/services';\nimport type { TestAPI } from 'vitest';\n\n/**\n * Type definition for test fixtures that provide transaction access.\n * Used with Vitest's test.extend() API to inject transactions into tests.\n *\n * @template Transaction - The transaction type specific to the database driver\n * @template Extended - Additional context properties provided by the extend function\n */\nexport interface DatabaseFixtures<Transaction, _Extended = object> {\n\t/**\n\t * The database transaction available to the test.\n\t * All database operations should use this transaction to ensure proper rollback.\n\t */\n\ttrx: Transaction;\n}\n\n/**\n * Combined fixtures type that merges the base transaction fixture with extended context.\n */\nexport type ExtendedDatabaseFixtures<\n\tTransaction,\n\tExtended = object,\n> = DatabaseFixtures<Transaction> & Extended;\n\n/**\n * Function type for extending test context with additional properties.\n * Receives the transaction and returns additional context to be merged with { trx }.\n *\n * @template Transaction - The transaction type\n * @template Extended - The type of additional context to provide\n *\n * @example\n * ```typescript\n * const extendContext: ExtendContextFn<Transaction<DB>, { factory: KyselyFactory }> =\n * (trx) => ({ factory: new KyselyFactory(builders, seeds, trx) });\n * ```\n */\nexport type ExtendContextFn<Transaction, Extended> = (\n\ttrx: Transaction,\n) => Extended | Promise<Extended>;\n\n/**\n * PostgreSQL transaction isolation levels.\n * Controls the visibility of concurrent transactions.\n *\n * @see https://www.postgresql.org/docs/current/transaction-iso.html\n */\nexport enum IsolationLevel {\n\t/**\n\t * Lowest isolation level. Allows dirty reads.\n\t * Not recommended for testing.\n\t */\n\tREAD_UNCOMMITTED = 'READ UNCOMMITTED',\n\t/**\n\t * Default PostgreSQL isolation level.\n\t * Prevents dirty reads but allows non-repeatable reads.\n\t */\n\tREAD_COMMITTED = 'READ COMMITTED',\n\t/**\n\t * Prevents dirty reads and non-repeatable reads.\n\t * Recommended for most test scenarios.\n\t */\n\tREPEATABLE_READ = 'REPEATABLE READ',\n\t/**\n\t * Highest isolation level. Prevents all phenomena.\n\t * May cause performance overhead in tests.\n\t */\n\tSERIALIZABLE = 'SERIALIZABLE',\n}\n\n/**\n * Abstract base class for implementing database transaction isolation in Vitest tests.\n * Provides automatic transaction rollback after each test to maintain test isolation.\n * Subclasses must implement the transact() method for their specific database driver.\n *\n * @template TConn - The database connection type\n * @template Transaction - The transaction type\n *\n * @example\n * ```typescript\n * // Implement for your database driver\n * class MyDatabaseIsolator extends VitestPostgresTransactionIsolator<MyDB, MyTx> {\n * async transact(conn: MyDB, level: IsolationLevel, fn: (tx: MyTx) => Promise<void>) {\n * await conn.transaction(level, fn);\n * }\n * }\n *\n * // Use in tests\n * const isolator = new MyDatabaseIsolator(test);\n * const isolatedTest = isolator.wrapVitestWithTransaction(db);\n *\n * isolatedTest('should create user', async ({ trx }) => {\n * await trx.insert('users', { name: 'Test' });\n * // Data is automatically rolled back after test\n * });\n * ```\n */\nexport abstract class VitestPostgresTransactionIsolator<TConn, Transaction> {\n\t/**\n\t * Abstract method to create a transaction with the specified isolation level.\n\t * Must be implemented by subclasses for specific database drivers.\n\t *\n\t * @param conn - The database connection\n\t * @param isolationLevel - The transaction isolation level\n\t * @param fn - The function to execute within the transaction\n\t * @returns Promise that resolves when the transaction completes\n\t */\n\tabstract transact(\n\t\tconn: TConn,\n\t\tisolationLevel: IsolationLevel,\n\t\tfn: (trx: Transaction) => Promise<void>,\n\t): Promise<void>;\n\n\tabstract destroy(conn: TConn): Promise<void>;\n\t/**\n\t * Creates a new VitestPostgresTransactionIsolator instance.\n\t *\n\t * @param api - The Vitest test API (usually the `test` export from vitest)\n\t */\n\tconstructor(private readonly api: TestAPI) {}\n\n\t/**\n\t * Creates a wrapped version of Vitest's test API that provides transaction isolation.\n\t * Each test will run within a database transaction that is automatically rolled back.\n\t *\n\t * @param options - Configuration options for transaction wrapping\n\t * @returns A wrapped test API with transaction support\n\t *\n\t * @example\n\t * ```typescript\n\t * const isolatedTest = isolator.wrapVitestWithTransaction({\n\t * connection: db,\n\t * setup: async (trx) => {\n\t * await trx.insert('settings', { key: 'test', value: 'true' });\n\t * },\n\t * fixtures: {\n\t * factory: (trx) => new Factory(trx),\n\t * },\n\t * });\n\t *\n\t * isolatedTest('test with transaction', async ({ trx, factory }) => {\n\t * const user = await factory.insert('user', { name: 'Test' });\n\t * expect(user).toBeDefined();\n\t * });\n\t * ```\n\t */\n\twrapVitestWithTransaction<Extended extends Record<string, unknown> = {}>(\n\t\toptions: TransactionWrapperOptions<TConn, Transaction, Extended>,\n\t) {\n\t\tconst {\n\t\t\tconnection,\n\t\t\tsetup,\n\t\t\tisolationLevel = IsolationLevel.REPEATABLE_READ,\n\t\t\tfixtures,\n\t\t} = options;\n\n\t\t// Resolved once per file, not once per test. The fixture below runs for\n\t\t// every test, and opening a pool each time leaves one connection per test\n\t\t// alive — a file of fifty tests exhausts the server.\n\t\tlet resolved: TConn | undefined;\n\t\tconst resolveConnection = async (): Promise<TConn> => {\n\t\t\tif (resolved === undefined) {\n\t\t\t\tresolved = await (isConstruct(connection)\n\t\t\t\t\t? connection.service.register({\n\t\t\t\t\t\t\t// Spread: `process.env` is a ProcessEnv, not a plain object.\n\t\t\t\t\t\t\tenvParser: new EnvironmentParser({ ...process.env }),\n\t\t\t\t\t\t\tcontext: serviceContext,\n\t\t\t\t\t\t})\n\t\t\t\t\t: connection());\n\t\t\t}\n\t\t\treturn resolved;\n\t\t};\n\n\t\t// Build fixture definitions for additional fixtures that depend on trx\n\t\tconst additionalFixtures: Record<string, unknown> = {};\n\t\tif (fixtures) {\n\t\t\tfor (const [key, creator] of Object.entries(fixtures)) {\n\t\t\t\tadditionalFixtures[key] = async (\n\t\t\t\t\t{ trx }: { trx: Transaction },\n\t\t\t\t\tuse: (value: unknown) => Promise<void>,\n\t\t\t\t) => {\n\t\t\t\t\tconst value = await (creator as (trx: Transaction) => unknown)(trx);\n\t\t\t\t\tawait use(value);\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\ttype CombinedFixtures = DatabaseFixtures<Transaction> & Extended;\n\n\t\t// Cast to bypass Vitest's strict fixture typing which can't infer\n\t\t// dynamically built fixture objects\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst api = this.api as TestAPI & {\n\t\t\textend: <T>(fixtures: any) => TestAPI<T>;\n\t\t};\n\n\t\treturn api.extend<CombinedFixtures>({\n\t\t\t// This fixture automatically provides a transaction to each test\n\t\t\t// biome-ignore lint/correctness/noEmptyPattern: this has to be like this to satisfy Biome\n\t\t\ttrx: async ({}: {}, use: (value: Transaction) => Promise<void>) => {\n\t\t\t\t// Create a custom error class for rollback\n\t\t\t\tclass TestRollback extends Error {\n\t\t\t\t\tconstructor() {\n\t\t\t\t\t\tsuper('Test rollback');\n\t\t\t\t\t\tthis.name = 'TestRollback';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet testError: Error | undefined;\n\t\t\t\tconst conn = await resolveConnection();\n\t\t\t\ttry {\n\t\t\t\t\tawait this.transact(conn, isolationLevel, async (transaction) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Provide the transaction to the test\n\t\t\t\t\t\t\tawait setup?.(transaction);\n\t\t\t\t\t\t\tawait use(transaction);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t// Capture any test errors\n\t\t\t\t\t\t\ttestError = error as Error;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Always throw to trigger rollback\n\t\t\t\t\t\tthrow new TestRollback();\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Only rethrow if it's not our rollback error\n\t\t\t\t\tif (!(error instanceof TestRollback)) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the test had an error, throw it now\n\t\t\t\t\tif (testError) {\n\t\t\t\t\t\tthrow testError;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t...additionalFixtures,\n\t\t});\n\t}\n}\n\nexport type DatabaseConnectionFn<Conn> = () => Conn | Promise<Conn>;\n\n/**\n * Where a connection comes from: a construct, or a function returning one.\n *\n * A construct is preferred, because it builds the client through the same\n * `connect()` production uses. A hand-rolled client missing `CamelCasePlugin`\n * writes `createdAt` where the app writes `created_at`, and the test passes\n * while production does not. The URL is read from `process.env`.\n */\nexport type DatabaseConnection<Conn> =\n\t| DatabaseConnectionFn<Conn>\n\t| ConnectableConstruct<Conn>;\n\n/** A construct is distinguished from a factory by owning a service. */\nfunction isConstruct<Conn>(\n\tconnection: DatabaseConnection<Conn>,\n): connection is ConnectableConstruct<Conn> {\n\treturn typeof connection !== 'function';\n}\n\n/**\n * Options for wrapping Vitest tests with database transaction isolation.\n */\n/**\n * Anything that owns a service handing back a connection — a database\n * construct, structurally, so testkit depends on no construct package.\n */\nexport interface ConnectableConstruct<TConn> {\n\treadonly service: Service<string, TConn>;\n}\n\nexport interface TransactionWrapperOptions<\n\tTConn,\n\tTransaction,\n\tExtended extends Record<string, unknown> = {},\n> {\n\t/** Where the connection comes from — a construct, or a function returning one */\n\tconnection: DatabaseConnection<TConn>;\n\t/** Optional setup function to run within the transaction before each test */\n\tsetup?: (trx: Transaction) => Promise<void>;\n\t/** Transaction isolation level (defaults to REPEATABLE_READ) */\n\tisolationLevel?: IsolationLevel;\n\t/** Additional fixtures that depend on the transaction */\n\tfixtures?: FixtureCreators<Transaction, Extended>;\n}\n\n/**\n * Type for fixture creator functions that depend on the transaction.\n * Each function receives the transaction and returns the fixture value.\n */\nexport type FixtureCreators<\n\tTransaction,\n\tExtended extends Record<string, unknown>,\n> = {\n\t[K in keyof Extended]: (\n\t\ttrx: Transaction,\n\t) => Extended[K] | Promise<Extended[K]>;\n};\n\n/**\n * The test API returned by extendWithFixtures.\n * Provides access to both the transaction (trx) and all extended fixtures.\n *\n * @template Transaction - The transaction type\n * @template Extended - The type of additional fixtures provided\n * @template BaseTest - The base wrapped test type\n */\nexport type TestWithExtendedFixtures<\n\tTransaction,\n\tExtended extends Record<string, unknown>,\n\tBaseTest extends ReturnType<TestAPI['extend']> = ReturnType<\n\t\tTestAPI['extend']\n\t>,\n> = BaseTest & {\n\t<C extends object>(\n\t\tname: string,\n\t\tfn: (\n\t\t\tcontext: DatabaseFixtures<Transaction> & Extended & C,\n\t\t) => Promise<void>,\n\t): void;\n\t<C extends object>(\n\t\tname: string,\n\t\toptions: object,\n\t\tfn: (\n\t\t\tcontext: DatabaseFixtures<Transaction> & Extended & C,\n\t\t) => Promise<void>,\n\t): void;\n};\n\n/**\n * Extends a wrapped test API with additional fixtures that depend on the transaction.\n * This allows composing test context with factories, repositories, or other helpers.\n *\n * @template Transaction - The transaction type\n * @template Extended - The type of additional context to provide\n * @param wrappedTest - The base wrapped test from wrapVitestWithTransaction\n * @param fixtures - Object mapping fixture names to creator functions\n * @returns An extended test API with both trx and the additional fixtures\n *\n * @example\n * ```typescript\n * import { wrapVitestKyselyTransaction, extendWithFixtures } from '@geekmidas/testkit/kysely';\n *\n * // Create base wrapped test\n * const baseTest = wrapVitestKyselyTransaction(test, {\n * connection: db,\n * setup: createTestTables,\n * });\n *\n * // Extend with fixtures\n * const it = extendWithFixtures(baseTest, {\n * factory: (trx) => new KyselyFactory(builders, seeds, trx),\n * userRepo: (trx) => new UserRepository(trx),\n * });\n *\n * // Use in tests - trx and all fixtures are available\n * it('should create user with factory', async ({ trx, factory, userRepo }) => {\n * const user = await factory.insert('user', { name: 'Test' });\n * expect(user).toBeDefined();\n * });\n * ```\n */\nexport function extendWithFixtures<\n\tTransaction,\n\tExtended extends Record<string, unknown>,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tT extends ReturnType<TestAPI['extend']> = any,\n>(\n\twrappedTest: T,\n\tfixtures: FixtureCreators<Transaction, Extended>,\n): TestWithExtendedFixtures<Transaction, Extended, T> {\n\t// Build fixture definitions for Vitest's extend API\n\tconst fixtureDefinitions: Record<string, any> = {};\n\n\tfor (const [key, creator] of Object.entries(fixtures)) {\n\t\tfixtureDefinitions[key] = async (\n\t\t\t{ trx }: { trx: Transaction },\n\t\t\tuse: (value: unknown) => Promise<void>,\n\t\t) => {\n\t\t\tconst value = await (creator as (trx: Transaction) => unknown)(trx);\n\t\t\tawait use(value);\n\t\t};\n\t}\n\n\treturn (wrappedTest as any).extend(fixtureDefinitions);\n}\n"],"mappings":";;;;;;;;;AAkDA,IAAY,iBAAL,yBAAA,gBAAA;;;;;CAKN,eAAA,sBAAA;;;;;CAKA,eAAA,oBAAA;;;;;CAKA,eAAA,qBAAA;;;;;CAKA,eAAA,kBAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAsB,oCAAtB,MAA4E;CAsB9C;;;;;;CAA7B,YAAY,KAA+B;EAAd,KAAA,MAAA;CAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B5C,0BACC,SACC;EACD,MAAM,EACL,YACA,OACA,iBAAA,mBACA,aACG;EAKJ,IAAI;EACJ,MAAM,oBAAoB,YAA4B;GACrD,IAAI,aAAa,KAAA,GAChB,WAAW,OAAO,YAAY,UAAU,IACrC,WAAW,QAAQ,SAAS;IAE5B,WAAW,IAAI,kBAAkB,EAAE,GAAG,QAAQ,IAAI,CAAC;IACnD,SAAS;GACV,CAAC,IACA,WAAW;GAEf,OAAO;EACR;EAGA,MAAM,qBAA8C,CAAC;EACrD,IAAI,UACH,KAAK,MAAM,CAAC,KAAK,YAAY,OAAO,QAAQ,QAAQ,GACnD,mBAAmB,OAAO,OACzB,EAAE,OACF,QACI;GAEJ,MAAM,IAAI,MADW,QAA0C,GAAG,CACnD;EAChB;EAaF,OAJY,KAAK,IAIN,OAAyB;GAGnC,KAAK,OAAO,IAAQ,QAA+C;IAElE,MAAM,qBAAqB,MAAM;KAChC,cAAc;MACb,MAAM,eAAe;MACrB,KAAK,OAAO;KACb;IACD;IAEA,IAAI;IACJ,MAAM,OAAO,MAAM,kBAAkB;IACrC,IAAI;KACH,MAAM,KAAK,SAAS,MAAM,gBAAgB,OAAO,gBAAgB;MAChE,IAAI;OAEH,MAAM,QAAQ,WAAW;OACzB,MAAM,IAAI,WAAW;MACtB,SAAS,OAAO;OAEf,YAAY;MACb;MAGA,MAAM,IAAI,aAAa;KACxB,CAAC;IACF,SAAS,OAAO;KAEf,IAAI,EAAE,iBAAiB,eACtB,MAAM;KAIP,IAAI,WACH,MAAM;IAER;GACD;GACA,GAAG;EACJ,CAAC;CACF;AACD;;AAiBA,SAAS,YACR,YAC2C;CAC3C,OAAO,OAAO,eAAe;AAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA,SAAgB,mBAMf,aACA,UACqD;CAErD,MAAM,qBAA0C,CAAC;CAEjD,KAAK,MAAM,CAAC,KAAK,YAAY,OAAO,QAAQ,QAAQ,GACnD,mBAAmB,OAAO,OACzB,EAAE,OACF,QACI;EAEJ,MAAM,IAAI,MADW,QAA0C,GAAG,CACnD;CAChB;CAGD,OAAQ,YAAoB,OAAO,kBAAkB;AACtD"}
package/dist/aws.cjs CHANGED
@@ -1,6 +1,5 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const vitest = require_chunk.__toESM(require("vitest"));
3
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let vitest = require("vitest");
4
3
  //#region src/aws.ts
5
4
  /**
6
5
  * Shared test utilities for AWS Lambda adapter testing
@@ -118,9 +117,9 @@ function createMockV2Event(overrides = {}) {
118
117
  ...overrides
119
118
  };
120
119
  }
121
-
122
120
  //#endregion
123
121
  exports.createMockContext = createMockContext;
124
122
  exports.createMockV1Event = createMockV1Event;
125
123
  exports.createMockV2Event = createMockV2Event;
124
+
126
125
  //# sourceMappingURL=aws.cjs.map
package/dist/aws.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"aws.cjs","names":["overrides: Partial<APIGatewayProxyEvent>","overrides: Partial<APIGatewayProxyEventV2>"],"sources":["../src/aws.ts"],"sourcesContent":["import type {\n\tAPIGatewayProxyEvent,\n\tAPIGatewayProxyEventV2,\n\tContext,\n} from 'aws-lambda';\nimport { vi } from 'vitest';\n\n/**\n * Shared test utilities for AWS Lambda adapter testing\n */\n\n/**\n * Creates a mock AWS Lambda Context for testing\n */\nexport function createMockContext(): Context {\n\treturn {\n\t\tawsRequestId: 'test-request-id',\n\t\tcallbackWaitsForEmptyEventLoop: false,\n\t\tfunctionName: 'test-function',\n\t\tfunctionVersion: '1',\n\t\tinvokedFunctionArn:\n\t\t\t'arn:aws:lambda:us-east-1:123456789012:function:test-function',\n\t\tmemoryLimitInMB: '128',\n\t\tlogGroupName: '/aws/lambda/test-function',\n\t\tlogStreamName: '2024/01/01/[$LATEST]abcdef123456',\n\t\tgetRemainingTimeInMillis: () => 5000,\n\t\tdone: vi.fn(),\n\t\tfail: vi.fn(),\n\t\tsucceed: vi.fn(),\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V1 (REST API) event for testing\n */\nexport function createMockV1Event(\n\toverrides: Partial<APIGatewayProxyEvent> = {},\n): APIGatewayProxyEvent {\n\treturn {\n\t\tbody: null,\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\tmultiValueHeaders: {},\n\t\thttpMethod: 'GET',\n\t\tisBase64Encoded: false,\n\t\tpath: '/test',\n\t\tpathParameters: null,\n\t\tqueryStringParameters: null,\n\t\tmultiValueQueryStringParameters: null,\n\t\tstageVariables: null,\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tauthorizer: null,\n\t\t\tprotocol: 'HTTP/1.1',\n\t\t\thttpMethod: 'GET',\n\t\t\tpath: '/test',\n\t\t\tstage: 'test',\n\t\t\trequestId: 'request-id',\n\t\t\trequestTimeEpoch: 1704067200000,\n\t\t\tresourceId: 'resource-id',\n\t\t\tresourcePath: '/test',\n\t\t\tidentity: {\n\t\t\t\taccessKey: null,\n\t\t\t\taccountId: null,\n\t\t\t\tapiKey: null,\n\t\t\t\tapiKeyId: null,\n\t\t\t\tcaller: null,\n\t\t\t\tcognitoAuthenticationProvider: null,\n\t\t\t\tcognitoAuthenticationType: null,\n\t\t\t\tcognitoIdentityId: null,\n\t\t\t\tcognitoIdentityPoolId: null,\n\t\t\t\tprincipalOrgId: null,\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuser: null,\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t\tuserArn: null,\n\t\t\t\tclientCert: null,\n\t\t\t},\n\t\t},\n\t\tresource: '/test',\n\t\t...overrides,\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V2 (HTTP API) event for testing\n */\nexport function createMockV2Event(\n\toverrides: Partial<APIGatewayProxyEventV2> = {},\n): APIGatewayProxyEventV2 {\n\treturn {\n\t\tversion: '2.0',\n\t\trouteKey: 'GET /test',\n\t\trawPath: '/test',\n\t\trawQueryString: '',\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tdomainName: 'test.example.com',\n\t\t\tdomainPrefix: 'api',\n\t\t\trequestId: 'request-id',\n\t\t\trouteKey: 'GET /test',\n\t\t\tstage: 'test',\n\t\t\ttime: '01/Jan/2024:00:00:00 +0000',\n\t\t\ttimeEpoch: 1704067200000,\n\t\t\thttp: {\n\t\t\t\tmethod: 'GET',\n\t\t\t\tpath: '/test',\n\t\t\t\tprotocol: 'HTTP/1.1',\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t},\n\t\t},\n\t\tbody: undefined,\n\t\tpathParameters: undefined,\n\t\tisBase64Encoded: false,\n\t\tstageVariables: undefined,\n\t\tqueryStringParameters: undefined,\n\t\tcookies: undefined,\n\t\t...overrides,\n\t};\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,oBAA6B;AAC5C,QAAO;EACN,cAAc;EACd,gCAAgC;EAChC,cAAc;EACd,iBAAiB;EACjB,oBACC;EACD,iBAAiB;EACjB,cAAc;EACd,eAAe;EACf,0BAA0B,MAAM;EAChC,MAAM,UAAG,IAAI;EACb,MAAM,UAAG,IAAI;EACb,SAAS,UAAG,IAAI;CAChB;AACD;;;;AAKD,SAAgB,kBACfA,YAA2C,CAAE,GACtB;AACvB,QAAO;EACN,MAAM;EACN,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACN;EACD,mBAAmB,CAAE;EACrB,YAAY;EACZ,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,uBAAuB;EACvB,iCAAiC;EACjC,gBAAgB;EAChB,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,UAAU;GACV,YAAY;GACZ,MAAM;GACN,OAAO;GACP,WAAW;GACX,kBAAkB;GAClB,YAAY;GACZ,cAAc;GACd,UAAU;IACT,WAAW;IACX,WAAW;IACX,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,+BAA+B;IAC/B,2BAA2B;IAC3B,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,UAAU;IACV,MAAM;IACN,WAAW;IACX,SAAS;IACT,YAAY;GACZ;EACD;EACD,UAAU;EACV,GAAG;CACH;AACD;;;;AAKD,SAAgB,kBACfC,YAA6C,CAAE,GACtB;AACzB,QAAO;EACN,SAAS;EACT,UAAU;EACV,SAAS;EACT,gBAAgB;EAChB,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACN;EACD,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,cAAc;GACd,WAAW;GACX,UAAU;GACV,OAAO;GACP,MAAM;GACN,WAAW;GACX,MAAM;IACL,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,WAAW;GACX;EACD;EACD;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA,GAAG;CACH;AACD"}
1
+ {"version":3,"file":"aws.cjs","names":["vi"],"sources":["../src/aws.ts"],"sourcesContent":["import type {\n\tAPIGatewayProxyEvent,\n\tAPIGatewayProxyEventV2,\n\tContext,\n} from 'aws-lambda';\nimport { vi } from 'vitest';\n\n/**\n * Shared test utilities for AWS Lambda adapter testing\n */\n\n/**\n * Creates a mock AWS Lambda Context for testing\n */\nexport function createMockContext(): Context {\n\treturn {\n\t\tawsRequestId: 'test-request-id',\n\t\tcallbackWaitsForEmptyEventLoop: false,\n\t\tfunctionName: 'test-function',\n\t\tfunctionVersion: '1',\n\t\tinvokedFunctionArn:\n\t\t\t'arn:aws:lambda:us-east-1:123456789012:function:test-function',\n\t\tmemoryLimitInMB: '128',\n\t\tlogGroupName: '/aws/lambda/test-function',\n\t\tlogStreamName: '2024/01/01/[$LATEST]abcdef123456',\n\t\tgetRemainingTimeInMillis: () => 5000,\n\t\tdone: vi.fn(),\n\t\tfail: vi.fn(),\n\t\tsucceed: vi.fn(),\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V1 (REST API) event for testing\n */\nexport function createMockV1Event(\n\toverrides: Partial<APIGatewayProxyEvent> = {},\n): APIGatewayProxyEvent {\n\treturn {\n\t\tbody: null,\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\tmultiValueHeaders: {},\n\t\thttpMethod: 'GET',\n\t\tisBase64Encoded: false,\n\t\tpath: '/test',\n\t\tpathParameters: null,\n\t\tqueryStringParameters: null,\n\t\tmultiValueQueryStringParameters: null,\n\t\tstageVariables: null,\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tauthorizer: null,\n\t\t\tprotocol: 'HTTP/1.1',\n\t\t\thttpMethod: 'GET',\n\t\t\tpath: '/test',\n\t\t\tstage: 'test',\n\t\t\trequestId: 'request-id',\n\t\t\trequestTimeEpoch: 1704067200000,\n\t\t\tresourceId: 'resource-id',\n\t\t\tresourcePath: '/test',\n\t\t\tidentity: {\n\t\t\t\taccessKey: null,\n\t\t\t\taccountId: null,\n\t\t\t\tapiKey: null,\n\t\t\t\tapiKeyId: null,\n\t\t\t\tcaller: null,\n\t\t\t\tcognitoAuthenticationProvider: null,\n\t\t\t\tcognitoAuthenticationType: null,\n\t\t\t\tcognitoIdentityId: null,\n\t\t\t\tcognitoIdentityPoolId: null,\n\t\t\t\tprincipalOrgId: null,\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuser: null,\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t\tuserArn: null,\n\t\t\t\tclientCert: null,\n\t\t\t},\n\t\t},\n\t\tresource: '/test',\n\t\t...overrides,\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V2 (HTTP API) event for testing\n */\nexport function createMockV2Event(\n\toverrides: Partial<APIGatewayProxyEventV2> = {},\n): APIGatewayProxyEventV2 {\n\treturn {\n\t\tversion: '2.0',\n\t\trouteKey: 'GET /test',\n\t\trawPath: '/test',\n\t\trawQueryString: '',\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tdomainName: 'test.example.com',\n\t\t\tdomainPrefix: 'api',\n\t\t\trequestId: 'request-id',\n\t\t\trouteKey: 'GET /test',\n\t\t\tstage: 'test',\n\t\t\ttime: '01/Jan/2024:00:00:00 +0000',\n\t\t\ttimeEpoch: 1704067200000,\n\t\t\thttp: {\n\t\t\t\tmethod: 'GET',\n\t\t\t\tpath: '/test',\n\t\t\t\tprotocol: 'HTTP/1.1',\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t},\n\t\t},\n\t\tbody: undefined,\n\t\tpathParameters: undefined,\n\t\tisBase64Encoded: false,\n\t\tstageVariables: undefined,\n\t\tqueryStringParameters: undefined,\n\t\tcookies: undefined,\n\t\t...overrides,\n\t};\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgB,oBAA6B;CAC5C,OAAO;EACN,cAAc;EACd,gCAAgC;EAChC,cAAc;EACd,iBAAiB;EACjB,oBACC;EACD,iBAAiB;EACjB,cAAc;EACd,eAAe;EACf,gCAAgC;EAChC,MAAMA,OAAAA,GAAG,GAAG;EACZ,MAAMA,OAAAA,GAAG,GAAG;EACZ,SAASA,OAAAA,GAAG,GAAG;CAChB;AACD;;;;AAKA,SAAgB,kBACf,YAA2C,CAAC,GACrB;CACvB,OAAO;EACN,MAAM;EACN,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACP;EACA,mBAAmB,CAAC;EACpB,YAAY;EACZ,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,uBAAuB;EACvB,iCAAiC;EACjC,gBAAgB;EAChB,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,UAAU;GACV,YAAY;GACZ,MAAM;GACN,OAAO;GACP,WAAW;GACX,kBAAkB;GAClB,YAAY;GACZ,cAAc;GACd,UAAU;IACT,WAAW;IACX,WAAW;IACX,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,+BAA+B;IAC/B,2BAA2B;IAC3B,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,UAAU;IACV,MAAM;IACN,WAAW;IACX,SAAS;IACT,YAAY;GACb;EACD;EACA,UAAU;EACV,GAAG;CACJ;AACD;;;;AAKA,SAAgB,kBACf,YAA6C,CAAC,GACrB;CACzB,OAAO;EACN,SAAS;EACT,UAAU;EACV,SAAS;EACT,gBAAgB;EAChB,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACP;EACA,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,cAAc;GACd,WAAW;GACX,UAAU;GACV,OAAO;GACP,MAAM;GACN,WAAW;GACX,MAAM;IACL,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,WAAW;GACZ;EACD;EACA,MAAM,KAAA;EACN,gBAAgB,KAAA;EAChB,iBAAiB;EACjB,gBAAgB,KAAA;EAChB,uBAAuB,KAAA;EACvB,SAAS,KAAA;EACT,GAAG;CACJ;AACD"}
package/dist/aws.d.cts CHANGED
@@ -1,24 +1,19 @@
1
1
  import { APIGatewayProxyEvent, APIGatewayProxyEventV2, Context } from "aws-lambda";
2
-
3
2
  //#region src/aws.d.ts
4
-
5
3
  /**
6
4
  * Shared test utilities for AWS Lambda adapter testing
7
5
  */
8
6
  /**
9
7
  * Creates a mock AWS Lambda Context for testing
10
8
  */
11
- declare function createMockContext(): Context;
9
+ export declare function createMockContext(): Context;
12
10
  /**
13
11
  * Creates a mock AWS API Gateway V1 (REST API) event for testing
14
12
  */
15
- declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
13
+ export declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
16
14
  /**
17
15
  * Creates a mock AWS API Gateway V2 (HTTP API) event for testing
18
16
  */
19
- declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
20
- //# sourceMappingURL=aws.d.ts.map
21
-
17
+ export declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
22
18
  //#endregion
23
- export { createMockContext, createMockV1Event, createMockV2Event };
24
19
  //# sourceMappingURL=aws.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aws.d.cts","names":[],"sources":["../src/aws.ts"],"sourcesContent":[],"mappings":";;;;;;AAcA;AAqBA;;;AACY,iBAtBI,iBAAA,CAAA,CAsBJ,EAtByB,OAsBzB;;AACW;AAsDvB;AAAiC,iBAxDjB,iBAAA,CAwDiB,SAAA,CAAA,EAvDrB,OAuDqB,CAvDb,oBAuDa,CAAA,CAAA,EAtD9B,oBAsD8B;;;;AAER,iBAFT,iBAAA,CAES,SAAA,CAAA,EADb,OACa,CADL,sBACK,CAAA,CAAA,EAAtB,sBAAsB"}
1
+ {"version":3,"file":"aws.d.cts","names":[],"sources":["../src/aws.ts"],"mappings":";;;;;;;;wBAcgB,qBAAqB;;;;wBAqBrB,kBACf,YAAW,QAAQ,wBACjB;;;;wBAsDa,kBACf,YAAW,QAAQ,0BACjB"}
package/dist/aws.d.mts CHANGED
@@ -1,24 +1,19 @@
1
1
  import { APIGatewayProxyEvent, APIGatewayProxyEventV2, Context } from "aws-lambda";
2
-
3
2
  //#region src/aws.d.ts
4
-
5
3
  /**
6
4
  * Shared test utilities for AWS Lambda adapter testing
7
5
  */
8
6
  /**
9
7
  * Creates a mock AWS Lambda Context for testing
10
8
  */
11
- declare function createMockContext(): Context;
9
+ export declare function createMockContext(): Context;
12
10
  /**
13
11
  * Creates a mock AWS API Gateway V1 (REST API) event for testing
14
12
  */
15
- declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
13
+ export declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
16
14
  /**
17
15
  * Creates a mock AWS API Gateway V2 (HTTP API) event for testing
18
16
  */
19
- declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
20
- //# sourceMappingURL=aws.d.ts.map
21
-
17
+ export declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
22
18
  //#endregion
23
- export { createMockContext, createMockV1Event, createMockV2Event };
24
19
  //# sourceMappingURL=aws.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aws.d.mts","names":[],"sources":["../src/aws.ts"],"sourcesContent":[],"mappings":";;;;;;AAcA;AAqBA;;;AACY,iBAtBI,iBAAA,CAAA,CAsBJ,EAtByB,OAsBzB;;AACW;AAsDvB;AAAiC,iBAxDjB,iBAAA,CAwDiB,SAAA,CAAA,EAvDrB,OAuDqB,CAvDb,oBAuDa,CAAA,CAAA,EAtD9B,oBAsD8B;;;;AAER,iBAFT,iBAAA,CAES,SAAA,CAAA,EADb,OACa,CADL,sBACK,CAAA,CAAA,EAAtB,sBAAsB"}
1
+ {"version":3,"file":"aws.d.mts","names":[],"sources":["../src/aws.ts"],"mappings":";;;;;;;;wBAcgB,qBAAqB;;;;wBAqBrB,kBACf,YAAW,QAAQ,wBACjB;;;;wBAsDa,kBACf,YAAW,QAAQ,0BACjB"}
package/dist/aws.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { vi } from "vitest";
2
-
3
2
  //#region src/aws.ts
4
3
  /**
5
4
  * Shared test utilities for AWS Lambda adapter testing
@@ -117,7 +116,7 @@ function createMockV2Event(overrides = {}) {
117
116
  ...overrides
118
117
  };
119
118
  }
120
-
121
119
  //#endregion
122
120
  export { createMockContext, createMockV1Event, createMockV2Event };
121
+
123
122
  //# sourceMappingURL=aws.mjs.map
package/dist/aws.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"aws.mjs","names":["overrides: Partial<APIGatewayProxyEvent>","overrides: Partial<APIGatewayProxyEventV2>"],"sources":["../src/aws.ts"],"sourcesContent":["import type {\n\tAPIGatewayProxyEvent,\n\tAPIGatewayProxyEventV2,\n\tContext,\n} from 'aws-lambda';\nimport { vi } from 'vitest';\n\n/**\n * Shared test utilities for AWS Lambda adapter testing\n */\n\n/**\n * Creates a mock AWS Lambda Context for testing\n */\nexport function createMockContext(): Context {\n\treturn {\n\t\tawsRequestId: 'test-request-id',\n\t\tcallbackWaitsForEmptyEventLoop: false,\n\t\tfunctionName: 'test-function',\n\t\tfunctionVersion: '1',\n\t\tinvokedFunctionArn:\n\t\t\t'arn:aws:lambda:us-east-1:123456789012:function:test-function',\n\t\tmemoryLimitInMB: '128',\n\t\tlogGroupName: '/aws/lambda/test-function',\n\t\tlogStreamName: '2024/01/01/[$LATEST]abcdef123456',\n\t\tgetRemainingTimeInMillis: () => 5000,\n\t\tdone: vi.fn(),\n\t\tfail: vi.fn(),\n\t\tsucceed: vi.fn(),\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V1 (REST API) event for testing\n */\nexport function createMockV1Event(\n\toverrides: Partial<APIGatewayProxyEvent> = {},\n): APIGatewayProxyEvent {\n\treturn {\n\t\tbody: null,\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\tmultiValueHeaders: {},\n\t\thttpMethod: 'GET',\n\t\tisBase64Encoded: false,\n\t\tpath: '/test',\n\t\tpathParameters: null,\n\t\tqueryStringParameters: null,\n\t\tmultiValueQueryStringParameters: null,\n\t\tstageVariables: null,\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tauthorizer: null,\n\t\t\tprotocol: 'HTTP/1.1',\n\t\t\thttpMethod: 'GET',\n\t\t\tpath: '/test',\n\t\t\tstage: 'test',\n\t\t\trequestId: 'request-id',\n\t\t\trequestTimeEpoch: 1704067200000,\n\t\t\tresourceId: 'resource-id',\n\t\t\tresourcePath: '/test',\n\t\t\tidentity: {\n\t\t\t\taccessKey: null,\n\t\t\t\taccountId: null,\n\t\t\t\tapiKey: null,\n\t\t\t\tapiKeyId: null,\n\t\t\t\tcaller: null,\n\t\t\t\tcognitoAuthenticationProvider: null,\n\t\t\t\tcognitoAuthenticationType: null,\n\t\t\t\tcognitoIdentityId: null,\n\t\t\t\tcognitoIdentityPoolId: null,\n\t\t\t\tprincipalOrgId: null,\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuser: null,\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t\tuserArn: null,\n\t\t\t\tclientCert: null,\n\t\t\t},\n\t\t},\n\t\tresource: '/test',\n\t\t...overrides,\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V2 (HTTP API) event for testing\n */\nexport function createMockV2Event(\n\toverrides: Partial<APIGatewayProxyEventV2> = {},\n): APIGatewayProxyEventV2 {\n\treturn {\n\t\tversion: '2.0',\n\t\trouteKey: 'GET /test',\n\t\trawPath: '/test',\n\t\trawQueryString: '',\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tdomainName: 'test.example.com',\n\t\t\tdomainPrefix: 'api',\n\t\t\trequestId: 'request-id',\n\t\t\trouteKey: 'GET /test',\n\t\t\tstage: 'test',\n\t\t\ttime: '01/Jan/2024:00:00:00 +0000',\n\t\t\ttimeEpoch: 1704067200000,\n\t\t\thttp: {\n\t\t\t\tmethod: 'GET',\n\t\t\t\tpath: '/test',\n\t\t\t\tprotocol: 'HTTP/1.1',\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t},\n\t\t},\n\t\tbody: undefined,\n\t\tpathParameters: undefined,\n\t\tisBase64Encoded: false,\n\t\tstageVariables: undefined,\n\t\tqueryStringParameters: undefined,\n\t\tcookies: undefined,\n\t\t...overrides,\n\t};\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgB,oBAA6B;AAC5C,QAAO;EACN,cAAc;EACd,gCAAgC;EAChC,cAAc;EACd,iBAAiB;EACjB,oBACC;EACD,iBAAiB;EACjB,cAAc;EACd,eAAe;EACf,0BAA0B,MAAM;EAChC,MAAM,GAAG,IAAI;EACb,MAAM,GAAG,IAAI;EACb,SAAS,GAAG,IAAI;CAChB;AACD;;;;AAKD,SAAgB,kBACfA,YAA2C,CAAE,GACtB;AACvB,QAAO;EACN,MAAM;EACN,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACN;EACD,mBAAmB,CAAE;EACrB,YAAY;EACZ,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,uBAAuB;EACvB,iCAAiC;EACjC,gBAAgB;EAChB,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,UAAU;GACV,YAAY;GACZ,MAAM;GACN,OAAO;GACP,WAAW;GACX,kBAAkB;GAClB,YAAY;GACZ,cAAc;GACd,UAAU;IACT,WAAW;IACX,WAAW;IACX,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,+BAA+B;IAC/B,2BAA2B;IAC3B,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,UAAU;IACV,MAAM;IACN,WAAW;IACX,SAAS;IACT,YAAY;GACZ;EACD;EACD,UAAU;EACV,GAAG;CACH;AACD;;;;AAKD,SAAgB,kBACfC,YAA6C,CAAE,GACtB;AACzB,QAAO;EACN,SAAS;EACT,UAAU;EACV,SAAS;EACT,gBAAgB;EAChB,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACN;EACD,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,cAAc;GACd,WAAW;GACX,UAAU;GACV,OAAO;GACP,MAAM;GACN,WAAW;GACX,MAAM;IACL,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,WAAW;GACX;EACD;EACD;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA,GAAG;CACH;AACD"}
1
+ {"version":3,"file":"aws.mjs","names":[],"sources":["../src/aws.ts"],"sourcesContent":["import type {\n\tAPIGatewayProxyEvent,\n\tAPIGatewayProxyEventV2,\n\tContext,\n} from 'aws-lambda';\nimport { vi } from 'vitest';\n\n/**\n * Shared test utilities for AWS Lambda adapter testing\n */\n\n/**\n * Creates a mock AWS Lambda Context for testing\n */\nexport function createMockContext(): Context {\n\treturn {\n\t\tawsRequestId: 'test-request-id',\n\t\tcallbackWaitsForEmptyEventLoop: false,\n\t\tfunctionName: 'test-function',\n\t\tfunctionVersion: '1',\n\t\tinvokedFunctionArn:\n\t\t\t'arn:aws:lambda:us-east-1:123456789012:function:test-function',\n\t\tmemoryLimitInMB: '128',\n\t\tlogGroupName: '/aws/lambda/test-function',\n\t\tlogStreamName: '2024/01/01/[$LATEST]abcdef123456',\n\t\tgetRemainingTimeInMillis: () => 5000,\n\t\tdone: vi.fn(),\n\t\tfail: vi.fn(),\n\t\tsucceed: vi.fn(),\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V1 (REST API) event for testing\n */\nexport function createMockV1Event(\n\toverrides: Partial<APIGatewayProxyEvent> = {},\n): APIGatewayProxyEvent {\n\treturn {\n\t\tbody: null,\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\tmultiValueHeaders: {},\n\t\thttpMethod: 'GET',\n\t\tisBase64Encoded: false,\n\t\tpath: '/test',\n\t\tpathParameters: null,\n\t\tqueryStringParameters: null,\n\t\tmultiValueQueryStringParameters: null,\n\t\tstageVariables: null,\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tauthorizer: null,\n\t\t\tprotocol: 'HTTP/1.1',\n\t\t\thttpMethod: 'GET',\n\t\t\tpath: '/test',\n\t\t\tstage: 'test',\n\t\t\trequestId: 'request-id',\n\t\t\trequestTimeEpoch: 1704067200000,\n\t\t\tresourceId: 'resource-id',\n\t\t\tresourcePath: '/test',\n\t\t\tidentity: {\n\t\t\t\taccessKey: null,\n\t\t\t\taccountId: null,\n\t\t\t\tapiKey: null,\n\t\t\t\tapiKeyId: null,\n\t\t\t\tcaller: null,\n\t\t\t\tcognitoAuthenticationProvider: null,\n\t\t\t\tcognitoAuthenticationType: null,\n\t\t\t\tcognitoIdentityId: null,\n\t\t\t\tcognitoIdentityPoolId: null,\n\t\t\t\tprincipalOrgId: null,\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuser: null,\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t\tuserArn: null,\n\t\t\t\tclientCert: null,\n\t\t\t},\n\t\t},\n\t\tresource: '/test',\n\t\t...overrides,\n\t};\n}\n\n/**\n * Creates a mock AWS API Gateway V2 (HTTP API) event for testing\n */\nexport function createMockV2Event(\n\toverrides: Partial<APIGatewayProxyEventV2> = {},\n): APIGatewayProxyEventV2 {\n\treturn {\n\t\tversion: '2.0',\n\t\trouteKey: 'GET /test',\n\t\trawPath: '/test',\n\t\trawQueryString: '',\n\t\theaders: {\n\t\t\t'content-type': 'application/json',\n\t\t\t'user-agent': 'test-agent',\n\t\t\thost: 'test.example.com',\n\t\t},\n\t\trequestContext: {\n\t\t\taccountId: '123456789012',\n\t\t\tapiId: 'api-id',\n\t\t\tdomainName: 'test.example.com',\n\t\t\tdomainPrefix: 'api',\n\t\t\trequestId: 'request-id',\n\t\t\trouteKey: 'GET /test',\n\t\t\tstage: 'test',\n\t\t\ttime: '01/Jan/2024:00:00:00 +0000',\n\t\t\ttimeEpoch: 1704067200000,\n\t\t\thttp: {\n\t\t\t\tmethod: 'GET',\n\t\t\t\tpath: '/test',\n\t\t\t\tprotocol: 'HTTP/1.1',\n\t\t\t\tsourceIp: '127.0.0.1',\n\t\t\t\tuserAgent: 'test-agent',\n\t\t\t},\n\t\t},\n\t\tbody: undefined,\n\t\tpathParameters: undefined,\n\t\tisBase64Encoded: false,\n\t\tstageVariables: undefined,\n\t\tqueryStringParameters: undefined,\n\t\tcookies: undefined,\n\t\t...overrides,\n\t};\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,oBAA6B;CAC5C,OAAO;EACN,cAAc;EACd,gCAAgC;EAChC,cAAc;EACd,iBAAiB;EACjB,oBACC;EACD,iBAAiB;EACjB,cAAc;EACd,eAAe;EACf,gCAAgC;EAChC,MAAM,GAAG,GAAG;EACZ,MAAM,GAAG,GAAG;EACZ,SAAS,GAAG,GAAG;CAChB;AACD;;;;AAKA,SAAgB,kBACf,YAA2C,CAAC,GACrB;CACvB,OAAO;EACN,MAAM;EACN,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACP;EACA,mBAAmB,CAAC;EACpB,YAAY;EACZ,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,uBAAuB;EACvB,iCAAiC;EACjC,gBAAgB;EAChB,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,UAAU;GACV,YAAY;GACZ,MAAM;GACN,OAAO;GACP,WAAW;GACX,kBAAkB;GAClB,YAAY;GACZ,cAAc;GACd,UAAU;IACT,WAAW;IACX,WAAW;IACX,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,+BAA+B;IAC/B,2BAA2B;IAC3B,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,UAAU;IACV,MAAM;IACN,WAAW;IACX,SAAS;IACT,YAAY;GACb;EACD;EACA,UAAU;EACV,GAAG;CACJ;AACD;;;;AAKA,SAAgB,kBACf,YAA6C,CAAC,GACrB;CACzB,OAAO;EACN,SAAS;EACT,UAAU;EACV,SAAS;EACT,gBAAgB;EAChB,SAAS;GACR,gBAAgB;GAChB,cAAc;GACd,MAAM;EACP;EACA,gBAAgB;GACf,WAAW;GACX,OAAO;GACP,YAAY;GACZ,cAAc;GACd,WAAW;GACX,UAAU;GACV,OAAO;GACP,MAAM;GACN,WAAW;GACX,MAAM;IACL,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,WAAW;GACZ;EACD;EACA,MAAM,KAAA;EACN,gBAAgB,KAAA;EAChB,iBAAiB;EACjB,gBAAgB,KAAA;EAChB,uBAAuB,KAAA;EACvB,SAAS,KAAA;EACT,GAAG;CACJ;AACD"}
@@ -1,4 +1,4 @@
1
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/benchmark.ts
3
3
  /**
4
4
  * Generates an array of test records for benchmark data sets.
@@ -40,10 +40,10 @@ function randomIpAddress() {
40
40
  const octet = () => Math.floor(Math.random() * 256);
41
41
  return `${octet()}.${octet()}.${octet()}.${octet()}`;
42
42
  }
43
-
44
43
  //#endregion
45
44
  exports.generateCacheKeys = generateCacheKeys;
46
45
  exports.generateIpAddresses = generateIpAddresses;
47
46
  exports.generateTestData = generateTestData;
48
47
  exports.randomIpAddress = randomIpAddress;
48
+
49
49
  //# sourceMappingURL=benchmark.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"benchmark.cjs","names":["count: number","prefix: string","subnet: string"],"sources":["../src/benchmark.ts"],"sourcesContent":["/**\n * Generates an array of test records for benchmark data sets.\n *\n * @param count - Number of records to generate\n * @returns Array of test data objects\n */\nexport function generateTestData(\n\tcount: number,\n): Array<{ id: string; name: string; value: number }> {\n\treturn Array.from({ length: count }, (_, i) => ({\n\t\tid: `id-${i}`,\n\t\tname: `Item ${i}`,\n\t\tvalue: Math.random() * 1000,\n\t}));\n}\n\n/**\n * Generates unique keys for cache benchmarks to avoid collisions.\n *\n * @param prefix - Key prefix\n * @param count - Number of keys to generate\n * @returns Array of unique cache keys\n */\nexport function generateCacheKeys(prefix: string, count: number): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${prefix}:${i}`);\n}\n\n/**\n * Generates IP addresses for rate limit benchmarks.\n *\n * @param count - Number of IPs to generate\n * @param subnet - Subnet prefix (default: '192.168.1')\n * @returns Array of IP addresses\n */\nexport function generateIpAddresses(\n\tcount: number,\n\tsubnet: string = '192.168.1',\n): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${subnet}.${i % 256}`);\n}\n\n/**\n * Creates a random IP address for rate limit benchmarks.\n */\nexport function randomIpAddress(): string {\n\tconst octet = () => Math.floor(Math.random() * 256);\n\treturn `${octet()}.${octet()}.${octet()}.${octet()}`;\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,iBACfA,OACqD;AACrD,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO;EAC/C,KAAK,KAAK,EAAE;EACZ,OAAO,OAAO,EAAE;EAChB,OAAO,KAAK,QAAQ,GAAG;CACvB,GAAE;AACH;;;;;;;;AASD,SAAgB,kBAAkBC,QAAgBD,OAAyB;AAC1E,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,EAAE,EAAE;AAChE;;;;;;;;AASD,SAAgB,oBACfA,OACAE,SAAiB,aACN;AACX,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,IAAI,IAAI,EAAE;AACtE;;;;AAKD,SAAgB,kBAA0B;CACzC,MAAM,QAAQ,MAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAI;AACnD,SAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC;AACnD"}
1
+ {"version":3,"file":"benchmark.cjs","names":[],"sources":["../src/benchmark.ts"],"sourcesContent":["/**\n * Generates an array of test records for benchmark data sets.\n *\n * @param count - Number of records to generate\n * @returns Array of test data objects\n */\nexport function generateTestData(\n\tcount: number,\n): Array<{ id: string; name: string; value: number }> {\n\treturn Array.from({ length: count }, (_, i) => ({\n\t\tid: `id-${i}`,\n\t\tname: `Item ${i}`,\n\t\tvalue: Math.random() * 1000,\n\t}));\n}\n\n/**\n * Generates unique keys for cache benchmarks to avoid collisions.\n *\n * @param prefix - Key prefix\n * @param count - Number of keys to generate\n * @returns Array of unique cache keys\n */\nexport function generateCacheKeys(prefix: string, count: number): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${prefix}:${i}`);\n}\n\n/**\n * Generates IP addresses for rate limit benchmarks.\n *\n * @param count - Number of IPs to generate\n * @param subnet - Subnet prefix (default: '192.168.1')\n * @returns Array of IP addresses\n */\nexport function generateIpAddresses(\n\tcount: number,\n\tsubnet: string = '192.168.1',\n): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${subnet}.${i % 256}`);\n}\n\n/**\n * Creates a random IP address for rate limit benchmarks.\n */\nexport function randomIpAddress(): string {\n\tconst octet = () => Math.floor(Math.random() * 256);\n\treturn `${octet()}.${octet()}.${octet()}.${octet()}`;\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,iBACf,OACqD;CACrD,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,OAAO;EAC/C,IAAI,MAAM;EACV,MAAM,QAAQ;EACd,OAAO,KAAK,OAAO,IAAI;CACxB,EAAE;AACH;;;;;;;;AASA,SAAgB,kBAAkB,QAAgB,OAAyB;CAC1E,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,GAAG;AAChE;;;;;;;;AASA,SAAgB,oBACf,OACA,SAAiB,aACN;CACX,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,KAAK;AACtE;;;;AAKA,SAAgB,kBAA0B;CACzC,MAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;CAClD,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM;AAClD"}
@@ -5,7 +5,7 @@
5
5
  * @param count - Number of records to generate
6
6
  * @returns Array of test data objects
7
7
  */
8
- declare function generateTestData(count: number): Array<{
8
+ export declare function generateTestData(count: number): Array<{
9
9
  id: string;
10
10
  name: string;
11
11
  value: number;
@@ -17,7 +17,7 @@ declare function generateTestData(count: number): Array<{
17
17
  * @param count - Number of keys to generate
18
18
  * @returns Array of unique cache keys
19
19
  */
20
- declare function generateCacheKeys(prefix: string, count: number): string[];
20
+ export declare function generateCacheKeys(prefix: string, count: number): string[];
21
21
  /**
22
22
  * Generates IP addresses for rate limit benchmarks.
23
23
  *
@@ -25,12 +25,10 @@ declare function generateCacheKeys(prefix: string, count: number): string[];
25
25
  * @param subnet - Subnet prefix (default: '192.168.1')
26
26
  * @returns Array of IP addresses
27
27
  */
28
- declare function generateIpAddresses(count: number, subnet?: string): string[];
28
+ export declare function generateIpAddresses(count: number, subnet?: string): string[];
29
29
  /**
30
30
  * Creates a random IP address for rate limit benchmarks.
31
31
  */
32
- declare function randomIpAddress(): string;
33
- //# sourceMappingURL=benchmark.d.ts.map
32
+ export declare function randomIpAddress(): string;
34
33
  //#endregion
35
- export { generateCacheKeys, generateIpAddresses, generateTestData, randomIpAddress };
36
34
  //# sourceMappingURL=benchmark.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"benchmark.d.cts","names":[],"sources":["../src/benchmark.ts"],"sourcesContent":[],"mappings":";;AAMA;AAiBA;AAWA;AAUA;;iBAtCgB,gBAAA,iBAEb;;;;;;;;;;;;iBAea,iBAAA;;;;;;;;iBAWA,mBAAA;;;;iBAUA,eAAA,CAAA"}
1
+ {"version":3,"file":"benchmark.d.cts","names":[],"sources":["../src/benchmark.ts"],"mappings":";;;;;;;wBAMgB,iBACf,gBACE;EAAQ;EAAY;EAAc;;;;;;;;;wBAerB,kBAAkB,gBAAgB;;;;;;;;wBAWlC,oBACf,eACA;;;;wBAQe"}
@@ -5,7 +5,7 @@
5
5
  * @param count - Number of records to generate
6
6
  * @returns Array of test data objects
7
7
  */
8
- declare function generateTestData(count: number): Array<{
8
+ export declare function generateTestData(count: number): Array<{
9
9
  id: string;
10
10
  name: string;
11
11
  value: number;
@@ -17,7 +17,7 @@ declare function generateTestData(count: number): Array<{
17
17
  * @param count - Number of keys to generate
18
18
  * @returns Array of unique cache keys
19
19
  */
20
- declare function generateCacheKeys(prefix: string, count: number): string[];
20
+ export declare function generateCacheKeys(prefix: string, count: number): string[];
21
21
  /**
22
22
  * Generates IP addresses for rate limit benchmarks.
23
23
  *
@@ -25,12 +25,10 @@ declare function generateCacheKeys(prefix: string, count: number): string[];
25
25
  * @param subnet - Subnet prefix (default: '192.168.1')
26
26
  * @returns Array of IP addresses
27
27
  */
28
- declare function generateIpAddresses(count: number, subnet?: string): string[];
28
+ export declare function generateIpAddresses(count: number, subnet?: string): string[];
29
29
  /**
30
30
  * Creates a random IP address for rate limit benchmarks.
31
31
  */
32
- declare function randomIpAddress(): string;
33
- //# sourceMappingURL=benchmark.d.ts.map
32
+ export declare function randomIpAddress(): string;
34
33
  //#endregion
35
- export { generateCacheKeys, generateIpAddresses, generateTestData, randomIpAddress };
36
34
  //# sourceMappingURL=benchmark.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"benchmark.d.mts","names":[],"sources":["../src/benchmark.ts"],"sourcesContent":[],"mappings":";;AAMA;AAiBA;AAWA;AAUA;;iBAtCgB,gBAAA,iBAEb;;;;;;;;;;;;iBAea,iBAAA;;;;;;;;iBAWA,mBAAA;;;;iBAUA,eAAA,CAAA"}
1
+ {"version":3,"file":"benchmark.d.mts","names":[],"sources":["../src/benchmark.ts"],"mappings":";;;;;;;wBAMgB,iBACf,gBACE;EAAQ;EAAY;EAAc;;;;;;;;;wBAerB,kBAAkB,gBAAgB;;;;;;;;wBAWlC,oBACf,eACA;;;;wBAQe"}
@@ -39,7 +39,7 @@ function randomIpAddress() {
39
39
  const octet = () => Math.floor(Math.random() * 256);
40
40
  return `${octet()}.${octet()}.${octet()}.${octet()}`;
41
41
  }
42
-
43
42
  //#endregion
44
43
  export { generateCacheKeys, generateIpAddresses, generateTestData, randomIpAddress };
44
+
45
45
  //# sourceMappingURL=benchmark.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"benchmark.mjs","names":["count: number","prefix: string","subnet: string"],"sources":["../src/benchmark.ts"],"sourcesContent":["/**\n * Generates an array of test records for benchmark data sets.\n *\n * @param count - Number of records to generate\n * @returns Array of test data objects\n */\nexport function generateTestData(\n\tcount: number,\n): Array<{ id: string; name: string; value: number }> {\n\treturn Array.from({ length: count }, (_, i) => ({\n\t\tid: `id-${i}`,\n\t\tname: `Item ${i}`,\n\t\tvalue: Math.random() * 1000,\n\t}));\n}\n\n/**\n * Generates unique keys for cache benchmarks to avoid collisions.\n *\n * @param prefix - Key prefix\n * @param count - Number of keys to generate\n * @returns Array of unique cache keys\n */\nexport function generateCacheKeys(prefix: string, count: number): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${prefix}:${i}`);\n}\n\n/**\n * Generates IP addresses for rate limit benchmarks.\n *\n * @param count - Number of IPs to generate\n * @param subnet - Subnet prefix (default: '192.168.1')\n * @returns Array of IP addresses\n */\nexport function generateIpAddresses(\n\tcount: number,\n\tsubnet: string = '192.168.1',\n): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${subnet}.${i % 256}`);\n}\n\n/**\n * Creates a random IP address for rate limit benchmarks.\n */\nexport function randomIpAddress(): string {\n\tconst octet = () => Math.floor(Math.random() * 256);\n\treturn `${octet()}.${octet()}.${octet()}.${octet()}`;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,iBACfA,OACqD;AACrD,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO;EAC/C,KAAK,KAAK,EAAE;EACZ,OAAO,OAAO,EAAE;EAChB,OAAO,KAAK,QAAQ,GAAG;CACvB,GAAE;AACH;;;;;;;;AASD,SAAgB,kBAAkBC,QAAgBD,OAAyB;AAC1E,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,EAAE,EAAE;AAChE;;;;;;;;AASD,SAAgB,oBACfA,OACAE,SAAiB,aACN;AACX,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,IAAI,IAAI,EAAE;AACtE;;;;AAKD,SAAgB,kBAA0B;CACzC,MAAM,QAAQ,MAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAI;AACnD,SAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC;AACnD"}
1
+ {"version":3,"file":"benchmark.mjs","names":[],"sources":["../src/benchmark.ts"],"sourcesContent":["/**\n * Generates an array of test records for benchmark data sets.\n *\n * @param count - Number of records to generate\n * @returns Array of test data objects\n */\nexport function generateTestData(\n\tcount: number,\n): Array<{ id: string; name: string; value: number }> {\n\treturn Array.from({ length: count }, (_, i) => ({\n\t\tid: `id-${i}`,\n\t\tname: `Item ${i}`,\n\t\tvalue: Math.random() * 1000,\n\t}));\n}\n\n/**\n * Generates unique keys for cache benchmarks to avoid collisions.\n *\n * @param prefix - Key prefix\n * @param count - Number of keys to generate\n * @returns Array of unique cache keys\n */\nexport function generateCacheKeys(prefix: string, count: number): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${prefix}:${i}`);\n}\n\n/**\n * Generates IP addresses for rate limit benchmarks.\n *\n * @param count - Number of IPs to generate\n * @param subnet - Subnet prefix (default: '192.168.1')\n * @returns Array of IP addresses\n */\nexport function generateIpAddresses(\n\tcount: number,\n\tsubnet: string = '192.168.1',\n): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${subnet}.${i % 256}`);\n}\n\n/**\n * Creates a random IP address for rate limit benchmarks.\n */\nexport function randomIpAddress(): string {\n\tconst octet = () => Math.floor(Math.random() * 256);\n\treturn `${octet()}.${octet()}.${octet()}.${octet()}`;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,iBACf,OACqD;CACrD,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,OAAO;EAC/C,IAAI,MAAM;EACV,MAAM,QAAQ;EACd,OAAO,KAAK,OAAO,IAAI;CACxB,EAAE;AACH;;;;;;;;AASA,SAAgB,kBAAkB,QAAgB,OAAyB;CAC1E,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,GAAG;AAChE;;;;;;;;AASA,SAAgB,oBACf,OACA,SAAiB,aACN;CACX,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,KAAK;AACtE;;;;AAKA,SAAgB,kBAA0B;CACzC,MAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG;CAClD,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM;AAClD"}