@geekmidas/testkit 10.0.0-alpha.98 → 10.0.0

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 (337) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +0 -74
  3. package/dist/Factory-BFVnMMCC.mjs +51 -0
  4. package/dist/Factory-BFVnMMCC.mjs.map +1 -0
  5. package/dist/Factory-BOX312yd.d.cts +147 -0
  6. package/dist/Factory-BOX312yd.d.cts.map +1 -0
  7. package/dist/Factory-BhjUOBWN.cjs +57 -0
  8. package/dist/Factory-BhjUOBWN.cjs.map +1 -0
  9. package/dist/Factory-SFupxRC2.d.mts +147 -0
  10. package/dist/Factory-SFupxRC2.d.mts.map +1 -0
  11. package/dist/Factory.cjs +2 -51
  12. package/dist/Factory.d.cts +3 -143
  13. package/dist/Factory.d.mts +3 -143
  14. package/dist/Factory.mjs +2 -50
  15. package/dist/KyselyFactory-BFqVIn_0.cjs +246 -0
  16. package/dist/KyselyFactory-BFqVIn_0.cjs.map +1 -0
  17. package/dist/KyselyFactory-DMswpwji.mjs +241 -0
  18. package/dist/KyselyFactory-DMswpwji.mjs.map +1 -0
  19. package/dist/KyselyFactory-Dy5zzV4B.d.cts +228 -0
  20. package/dist/KyselyFactory-Dy5zzV4B.d.cts.map +1 -0
  21. package/dist/KyselyFactory-vAxYodck.d.mts +228 -0
  22. package/dist/KyselyFactory-vAxYodck.d.mts.map +1 -0
  23. package/dist/KyselyFactory.cjs +4 -237
  24. package/dist/KyselyFactory.d.cts +4 -224
  25. package/dist/KyselyFactory.d.mts +4 -224
  26. package/dist/KyselyFactory.mjs +4 -236
  27. package/dist/ObjectionFactory-BWjB49-i.d.mts +241 -0
  28. package/dist/ObjectionFactory-BWjB49-i.d.mts.map +1 -0
  29. package/dist/ObjectionFactory-BeFBYcan.cjs +272 -0
  30. package/dist/ObjectionFactory-BeFBYcan.cjs.map +1 -0
  31. package/dist/ObjectionFactory-CD-WFuMJ.d.cts +241 -0
  32. package/dist/ObjectionFactory-CD-WFuMJ.d.cts.map +1 -0
  33. package/dist/ObjectionFactory-QCJ7u0Ql.mjs +267 -0
  34. package/dist/ObjectionFactory-QCJ7u0Ql.mjs.map +1 -0
  35. package/dist/ObjectionFactory.cjs +4 -265
  36. package/dist/ObjectionFactory.d.cts +4 -237
  37. package/dist/ObjectionFactory.d.mts +4 -237
  38. package/dist/ObjectionFactory.mjs +4 -264
  39. package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts +84 -0
  40. package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts.map +1 -0
  41. package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs +101 -0
  42. package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs.map +1 -0
  43. package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts +84 -0
  44. package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts.map +1 -0
  45. package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs +95 -0
  46. package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs.map +1 -0
  47. package/dist/PostgresKyselyMigrator.cjs +3 -94
  48. package/dist/PostgresKyselyMigrator.d.cts +3 -80
  49. package/dist/PostgresKyselyMigrator.d.mts +3 -80
  50. package/dist/PostgresKyselyMigrator.mjs +3 -93
  51. package/dist/{PostgresMigrator-CDPnnwMJ.d.cts → PostgresMigrator-C_QQ6q35.d.mts} +5 -11
  52. package/dist/PostgresMigrator-C_QQ6q35.d.mts.map +1 -0
  53. package/dist/{PostgresMigrator-CDPnnwMJ.d.mts → PostgresMigrator-CeYy-eHF.d.cts} +5 -11
  54. package/dist/PostgresMigrator-CeYy-eHF.d.cts.map +1 -0
  55. package/dist/PostgresMigrator-DVAY04qN.mjs +166 -0
  56. package/dist/PostgresMigrator-DVAY04qN.mjs.map +1 -0
  57. package/dist/PostgresMigrator-M9jpzOvN.cjs +172 -0
  58. package/dist/PostgresMigrator-M9jpzOvN.cjs.map +1 -0
  59. package/dist/PostgresMigrator.cjs +2 -178
  60. package/dist/PostgresMigrator.d.cts +1 -1
  61. package/dist/PostgresMigrator.d.mts +1 -1
  62. package/dist/PostgresMigrator.mjs +2 -175
  63. package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts +79 -0
  64. package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts.map +1 -0
  65. package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts +79 -0
  66. package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts.map +1 -0
  67. package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs +123 -0
  68. package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs.map +1 -0
  69. package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs +118 -0
  70. package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs.map +1 -0
  71. package/dist/PostgresObjectionMigrator.cjs +3 -118
  72. package/dist/PostgresObjectionMigrator.d.cts +3 -75
  73. package/dist/PostgresObjectionMigrator.d.mts +3 -75
  74. package/dist/PostgresObjectionMigrator.mjs +3 -117
  75. package/dist/VitestKyselyTransactionIsolator-0CqOsuc9.cjs +65 -0
  76. package/dist/VitestKyselyTransactionIsolator-0CqOsuc9.cjs.map +1 -0
  77. package/dist/VitestKyselyTransactionIsolator-CduJlHoT.d.cts +59 -0
  78. package/dist/VitestKyselyTransactionIsolator-CduJlHoT.d.cts.map +1 -0
  79. package/dist/VitestKyselyTransactionIsolator-CfSMOFlN.mjs +60 -0
  80. package/dist/VitestKyselyTransactionIsolator-CfSMOFlN.mjs.map +1 -0
  81. package/dist/VitestKyselyTransactionIsolator-Cswnnj0k.d.mts +59 -0
  82. package/dist/VitestKyselyTransactionIsolator-Cswnnj0k.d.mts.map +1 -0
  83. package/dist/VitestKyselyTransactionIsolator.cjs +3 -66
  84. package/dist/VitestKyselyTransactionIsolator.d.cts +3 -60
  85. package/dist/VitestKyselyTransactionIsolator.d.mts +3 -60
  86. package/dist/VitestKyselyTransactionIsolator.mjs +3 -65
  87. package/dist/VitestObjectionTransactionIsolator-B5J9jjKq.cjs +68 -0
  88. package/dist/VitestObjectionTransactionIsolator-B5J9jjKq.cjs.map +1 -0
  89. package/dist/VitestObjectionTransactionIsolator-BXoR6xdG.d.cts +60 -0
  90. package/dist/VitestObjectionTransactionIsolator-BXoR6xdG.d.cts.map +1 -0
  91. package/dist/VitestObjectionTransactionIsolator-CNo40EdC.mjs +63 -0
  92. package/dist/VitestObjectionTransactionIsolator-CNo40EdC.mjs.map +1 -0
  93. package/dist/VitestObjectionTransactionIsolator-x6hY5j4u.d.mts +60 -0
  94. package/dist/VitestObjectionTransactionIsolator-x6hY5j4u.d.mts.map +1 -0
  95. package/dist/VitestObjectionTransactionIsolator.cjs +3 -62
  96. package/dist/VitestObjectionTransactionIsolator.d.cts +3 -56
  97. package/dist/VitestObjectionTransactionIsolator.d.mts +3 -56
  98. package/dist/VitestObjectionTransactionIsolator.mjs +3 -61
  99. package/dist/VitestTransactionIsolator-BNWJqh9f.d.mts +207 -0
  100. package/dist/VitestTransactionIsolator-BNWJqh9f.d.mts.map +1 -0
  101. package/dist/VitestTransactionIsolator-CSroc7Df.d.cts +207 -0
  102. package/dist/VitestTransactionIsolator-CSroc7Df.d.cts.map +1 -0
  103. package/dist/VitestTransactionIsolator-CtZaOUjH.cjs +193 -0
  104. package/dist/VitestTransactionIsolator-CtZaOUjH.cjs.map +1 -0
  105. package/dist/VitestTransactionIsolator-D6ZxLWys.mjs +175 -0
  106. package/dist/VitestTransactionIsolator-D6ZxLWys.mjs.map +1 -0
  107. package/dist/VitestTransactionIsolator.cjs +4 -187
  108. package/dist/VitestTransactionIsolator.d.cts +2 -219
  109. package/dist/VitestTransactionIsolator.d.mts +2 -219
  110. package/dist/VitestTransactionIsolator.mjs +2 -184
  111. package/dist/aws.cjs +4 -3
  112. package/dist/aws.cjs.map +1 -1
  113. package/dist/aws.d.cts +8 -3
  114. package/dist/aws.d.cts.map +1 -1
  115. package/dist/aws.d.mts +8 -3
  116. package/dist/aws.d.mts.map +1 -1
  117. package/dist/aws.mjs +2 -1
  118. package/dist/aws.mjs.map +1 -1
  119. package/dist/benchmark.cjs +2 -2
  120. package/dist/benchmark.cjs.map +1 -1
  121. package/dist/benchmark.d.cts +6 -4
  122. package/dist/benchmark.d.cts.map +1 -1
  123. package/dist/benchmark.d.mts +6 -4
  124. package/dist/benchmark.d.mts.map +1 -1
  125. package/dist/benchmark.mjs +1 -1
  126. package/dist/benchmark.mjs.map +1 -1
  127. package/dist/better-auth.cjs +15 -31
  128. package/dist/better-auth.cjs.map +1 -1
  129. package/dist/better-auth.d.cts +4 -13142
  130. package/dist/better-auth.d.cts.map +1 -1
  131. package/dist/better-auth.d.mts +4 -13142
  132. package/dist/better-auth.d.mts.map +1 -1
  133. package/dist/better-auth.mjs +13 -29
  134. package/dist/better-auth.mjs.map +1 -1
  135. package/dist/{rolldown-runtime-VH7oDXx4.cjs → chunk-CUT6urMc.cjs} +10 -8
  136. package/dist/directory-Bpz5c5pj.d.cts +13 -0
  137. package/dist/directory-Bpz5c5pj.d.cts.map +1 -0
  138. package/dist/directory-BxjqmtCT.mjs +27 -0
  139. package/dist/directory-BxjqmtCT.mjs.map +1 -0
  140. package/dist/directory-CVrfTq1I.d.mts +13 -0
  141. package/dist/directory-CVrfTq1I.d.mts.map +1 -0
  142. package/dist/directory-DD_xQoSh.cjs +33 -0
  143. package/dist/directory-DD_xQoSh.cjs.map +1 -0
  144. package/dist/faker-B14IEMIN.cjs +304 -0
  145. package/dist/faker-B14IEMIN.cjs.map +1 -0
  146. package/dist/faker-BGKYFoCT.mjs +262 -0
  147. package/dist/faker-BGKYFoCT.mjs.map +1 -0
  148. package/dist/faker-Cg76aFNO.d.cts +166 -0
  149. package/dist/faker-Cg76aFNO.d.cts.map +1 -0
  150. package/dist/faker-DHh7xs4u.d.mts +166 -0
  151. package/dist/faker-DHh7xs4u.d.mts.map +1 -0
  152. package/dist/faker.cjs +8 -313
  153. package/dist/faker.d.cts +2 -169
  154. package/dist/faker.d.mts +2 -169
  155. package/dist/faker.mjs +2 -305
  156. package/dist/helpers.cjs +5 -6
  157. package/dist/helpers.cjs.map +1 -1
  158. package/dist/helpers.d.cts +5 -1
  159. package/dist/helpers.d.cts.map +1 -1
  160. package/dist/helpers.d.mts +5 -1
  161. package/dist/helpers.d.mts.map +1 -1
  162. package/dist/helpers.mjs +2 -1
  163. package/dist/helpers.mjs.map +1 -1
  164. package/dist/initScript.cjs +15 -15
  165. package/dist/initScript.cjs.map +1 -1
  166. package/dist/initScript.d.cts +4 -2
  167. package/dist/initScript.d.cts.map +1 -1
  168. package/dist/initScript.d.mts +4 -2
  169. package/dist/initScript.d.mts.map +1 -1
  170. package/dist/initScript.mjs +12 -10
  171. package/dist/initScript.mjs.map +1 -1
  172. package/dist/kysely.cjs +13 -10
  173. package/dist/kysely.cjs.map +1 -1
  174. package/dist/kysely.d.cts +14 -10
  175. package/dist/kysely.d.cts.map +1 -1
  176. package/dist/kysely.d.mts +14 -10
  177. package/dist/kysely.d.mts.map +1 -1
  178. package/dist/kysely.mjs +14 -10
  179. package/dist/kysely.mjs.map +1 -1
  180. package/dist/logger.cjs +4 -3
  181. package/dist/logger.cjs.map +1 -1
  182. package/dist/logger.d.cts +5 -1
  183. package/dist/logger.d.cts.map +1 -1
  184. package/dist/logger.d.mts +5 -1
  185. package/dist/logger.d.mts.map +1 -1
  186. package/dist/logger.mjs +2 -1
  187. package/dist/logger.mjs.map +1 -1
  188. package/dist/objection.cjs +13 -10
  189. package/dist/objection.cjs.map +1 -1
  190. package/dist/objection.d.cts +14 -10
  191. package/dist/objection.d.cts.map +1 -1
  192. package/dist/objection.d.mts +14 -10
  193. package/dist/objection.d.mts.map +1 -1
  194. package/dist/objection.mjs +14 -10
  195. package/dist/objection.mjs.map +1 -1
  196. package/dist/os/directory.cjs +2 -31
  197. package/dist/os/directory.d.cts +2 -9
  198. package/dist/os/directory.d.mts +2 -9
  199. package/dist/os/directory.mjs +2 -25
  200. package/dist/os/index.cjs +3 -3
  201. package/dist/os/index.d.cts +1 -1
  202. package/dist/os/index.d.mts +1 -1
  203. package/dist/os/index.mjs +3 -2
  204. package/dist/requestContext.cjs +11 -10
  205. package/dist/requestContext.cjs.map +1 -1
  206. package/dist/requestContext.d.cts +9 -5
  207. package/dist/requestContext.d.cts.map +1 -1
  208. package/dist/requestContext.d.mts +9 -5
  209. package/dist/requestContext.d.mts.map +1 -1
  210. package/dist/requestContext.mjs +3 -2
  211. package/dist/requestContext.mjs.map +1 -1
  212. package/dist/timer.cjs +2 -2
  213. package/dist/timer.cjs.map +1 -1
  214. package/dist/timer.d.cts +4 -1
  215. package/dist/timer.d.cts.map +1 -1
  216. package/dist/timer.d.mts +4 -1
  217. package/dist/timer.d.mts.map +1 -1
  218. package/dist/timer.mjs +1 -1
  219. package/dist/timer.mjs.map +1 -1
  220. package/package.json +25 -65
  221. package/src/Factory.ts +174 -0
  222. package/src/KyselyFactory.ts +391 -0
  223. package/src/ObjectionFactory.ts +412 -0
  224. package/src/PostgresKyselyMigrator.ts +104 -0
  225. package/src/PostgresMigrator.ts +193 -0
  226. package/src/PostgresObjectionMigrator.ts +138 -0
  227. package/src/VitestKyselyTransactionIsolator.ts +72 -0
  228. package/src/VitestObjectionTransactionIsolator.ts +75 -0
  229. package/src/VitestTransactionIsolator.ts +348 -0
  230. package/src/__tests__/Factory.spec.ts +178 -0
  231. package/src/__tests__/KyselyFactory.spec.ts +458 -0
  232. package/src/__tests__/ObjectionFactory.spec.ts +586 -0
  233. package/src/__tests__/PostgresKyselyMigrator.spec.ts +794 -0
  234. package/src/__tests__/PostgresMigrator.spec.ts +471 -0
  235. package/src/__tests__/PostgresObjectionMigrator.spec.ts +634 -0
  236. package/src/__tests__/VitestObjectionTransactionIsolator.spec.ts +138 -0
  237. package/src/__tests__/benchmark.spec.ts +140 -0
  238. package/src/__tests__/better-auth.spec.ts +21 -0
  239. package/src/__tests__/faker.spec.ts +231 -0
  240. package/src/__tests__/initScript.spec.ts +332 -0
  241. package/src/__tests__/integration.spec.ts +610 -0
  242. package/src/__tests__/requestContext.spec.ts +113 -0
  243. package/src/__tests__/utilities.spec.ts +211 -0
  244. package/src/aws.ts +131 -0
  245. package/src/benchmark.ts +48 -0
  246. package/src/better-auth.ts +310 -0
  247. package/src/faker.ts +349 -0
  248. package/src/helpers.ts +45 -0
  249. package/src/initScript.ts +122 -0
  250. package/src/kysely.ts +166 -0
  251. package/src/logger.ts +18 -0
  252. package/src/objection.ts +157 -0
  253. package/src/os/directory.ts +26 -0
  254. package/src/os/index.ts +1 -0
  255. package/src/requestContext.ts +119 -0
  256. package/src/timer.ts +3 -0
  257. package/test/globalSetup.ts +54 -0
  258. package/test/helpers.ts +268 -0
  259. package/test/migrations/1749664623372_user.ts +22 -0
  260. package/tsconfig.json +9 -0
  261. package/vitest.config.ts +8 -0
  262. package/dist/Factory.cjs.map +0 -1
  263. package/dist/Factory.d.cts.map +0 -1
  264. package/dist/Factory.d.mts.map +0 -1
  265. package/dist/Factory.mjs.map +0 -1
  266. package/dist/KyselyFactory.cjs.map +0 -1
  267. package/dist/KyselyFactory.d.cts.map +0 -1
  268. package/dist/KyselyFactory.d.mts.map +0 -1
  269. package/dist/KyselyFactory.mjs.map +0 -1
  270. package/dist/ObjectionFactory.cjs.map +0 -1
  271. package/dist/ObjectionFactory.d.cts.map +0 -1
  272. package/dist/ObjectionFactory.d.mts.map +0 -1
  273. package/dist/ObjectionFactory.mjs.map +0 -1
  274. package/dist/PostgresKyselyMigrator.cjs.map +0 -1
  275. package/dist/PostgresKyselyMigrator.d.cts.map +0 -1
  276. package/dist/PostgresKyselyMigrator.d.mts.map +0 -1
  277. package/dist/PostgresKyselyMigrator.mjs.map +0 -1
  278. package/dist/PostgresMigrator-CDPnnwMJ.d.cts.map +0 -1
  279. package/dist/PostgresMigrator-CDPnnwMJ.d.mts.map +0 -1
  280. package/dist/PostgresMigrator.cjs.map +0 -1
  281. package/dist/PostgresMigrator.mjs.map +0 -1
  282. package/dist/PostgresObjectionMigrator.cjs.map +0 -1
  283. package/dist/PostgresObjectionMigrator.d.cts.map +0 -1
  284. package/dist/PostgresObjectionMigrator.d.mts.map +0 -1
  285. package/dist/PostgresObjectionMigrator.mjs.map +0 -1
  286. package/dist/VitestKyselyTransactionIsolator.cjs.map +0 -1
  287. package/dist/VitestKyselyTransactionIsolator.d.cts.map +0 -1
  288. package/dist/VitestKyselyTransactionIsolator.d.mts.map +0 -1
  289. package/dist/VitestKyselyTransactionIsolator.mjs.map +0 -1
  290. package/dist/VitestObjectionTransactionIsolator.cjs.map +0 -1
  291. package/dist/VitestObjectionTransactionIsolator.d.cts.map +0 -1
  292. package/dist/VitestObjectionTransactionIsolator.d.mts.map +0 -1
  293. package/dist/VitestObjectionTransactionIsolator.mjs.map +0 -1
  294. package/dist/VitestTransactionIsolator.cjs.map +0 -1
  295. package/dist/VitestTransactionIsolator.d.cts.map +0 -1
  296. package/dist/VitestTransactionIsolator.d.mts.map +0 -1
  297. package/dist/VitestTransactionIsolator.mjs.map +0 -1
  298. package/dist/browser.cjs +0 -149
  299. package/dist/browser.cjs.map +0 -1
  300. package/dist/browser.d.cts +0 -62
  301. package/dist/browser.d.cts.map +0 -1
  302. package/dist/browser.d.mts +0 -62
  303. package/dist/browser.d.mts.map +0 -1
  304. package/dist/browser.mjs +0 -147
  305. package/dist/browser.mjs.map +0 -1
  306. package/dist/context.cjs +0 -80
  307. package/dist/context.cjs.map +0 -1
  308. package/dist/context.d.cts +0 -55
  309. package/dist/context.d.cts.map +0 -1
  310. package/dist/context.d.mts +0 -55
  311. package/dist/context.d.mts.map +0 -1
  312. package/dist/context.mjs +0 -73
  313. package/dist/context.mjs.map +0 -1
  314. package/dist/faker.cjs.map +0 -1
  315. package/dist/faker.d.cts.map +0 -1
  316. package/dist/faker.d.mts.map +0 -1
  317. package/dist/faker.mjs.map +0 -1
  318. package/dist/mailbox.cjs +0 -95
  319. package/dist/mailbox.cjs.map +0 -1
  320. package/dist/mailbox.d.cts +0 -58
  321. package/dist/mailbox.d.cts.map +0 -1
  322. package/dist/mailbox.d.mts +0 -58
  323. package/dist/mailbox.d.mts.map +0 -1
  324. package/dist/mailbox.mjs +0 -92
  325. package/dist/mailbox.mjs.map +0 -1
  326. package/dist/os/directory.cjs.map +0 -1
  327. package/dist/os/directory.d.cts.map +0 -1
  328. package/dist/os/directory.d.mts.map +0 -1
  329. package/dist/os/directory.mjs.map +0 -1
  330. package/dist/transactions.cjs +0 -239
  331. package/dist/transactions.cjs.map +0 -1
  332. package/dist/transactions.d.cts +0 -44
  333. package/dist/transactions.d.cts.map +0 -1
  334. package/dist/transactions.d.mts +0 -44
  335. package/dist/transactions.d.mts.map +0 -1
  336. package/dist/transactions.mjs +0 -234
  337. package/dist/transactions.mjs.map +0 -1
@@ -1,219 +1,2 @@
1
- import { Service } from "@geekmidas/services";
2
- import { TestAPI } from "vitest";
3
- //#region src/VitestTransactionIsolator.d.ts
4
- /**
5
- * Type definition for test fixtures that provide transaction access.
6
- * Used with Vitest's test.extend() API to inject transactions into tests.
7
- *
8
- * @template Transaction - The transaction type specific to the database driver
9
- * @template Extended - Additional context properties provided by the extend function
10
- */
11
- export interface DatabaseFixtures<Transaction, _Extended = object> {
12
- /**
13
- * The database transaction available to the test.
14
- * All database operations should use this transaction to ensure proper rollback.
15
- */
16
- trx: Transaction;
17
- }
18
- /**
19
- * Combined fixtures type that merges the base transaction fixture with extended context.
20
- */
21
- export type ExtendedDatabaseFixtures<Transaction, Extended = object> = DatabaseFixtures<Transaction> & Extended;
22
- /**
23
- * Function type for extending test context with additional properties.
24
- * Receives the transaction and returns additional context to be merged with { trx }.
25
- *
26
- * @template Transaction - The transaction type
27
- * @template Extended - The type of additional context to provide
28
- *
29
- * @example
30
- * ```typescript
31
- * const extendContext: ExtendContextFn<Transaction<DB>, { factory: KyselyFactory }> =
32
- * (trx) => ({ factory: new KyselyFactory(builders, seeds, trx) });
33
- * ```
34
- */
35
- export type ExtendContextFn<Transaction, Extended> = (trx: Transaction) => Extended | Promise<Extended>;
36
- /**
37
- * PostgreSQL transaction isolation levels.
38
- * Controls the visibility of concurrent transactions.
39
- *
40
- * @see https://www.postgresql.org/docs/current/transaction-iso.html
41
- */
42
- export declare enum IsolationLevel {
43
- /**
44
- * Lowest isolation level. Allows dirty reads.
45
- * Not recommended for testing.
46
- */
47
- READ_UNCOMMITTED = "READ UNCOMMITTED",
48
- /**
49
- * Default PostgreSQL isolation level.
50
- * Prevents dirty reads but allows non-repeatable reads.
51
- */
52
- READ_COMMITTED = "READ COMMITTED",
53
- /**
54
- * Prevents dirty reads and non-repeatable reads.
55
- * Recommended for most test scenarios.
56
- */
57
- REPEATABLE_READ = "REPEATABLE READ",
58
- /**
59
- * Highest isolation level. Prevents all phenomena.
60
- * May cause performance overhead in tests.
61
- */
62
- SERIALIZABLE = "SERIALIZABLE"
63
- }
64
- /**
65
- * Abstract base class for implementing database transaction isolation in Vitest tests.
66
- * Provides automatic transaction rollback after each test to maintain test isolation.
67
- * Subclasses must implement the transact() method for their specific database driver.
68
- *
69
- * @template TConn - The database connection type
70
- * @template Transaction - The transaction type
71
- *
72
- * @example
73
- * ```typescript
74
- * // Implement for your database driver
75
- * class MyDatabaseIsolator extends VitestPostgresTransactionIsolator<MyDB, MyTx> {
76
- * async transact(conn: MyDB, level: IsolationLevel, fn: (tx: MyTx) => Promise<void>) {
77
- * await conn.transaction(level, fn);
78
- * }
79
- * }
80
- *
81
- * // Use in tests
82
- * const isolator = new MyDatabaseIsolator(test);
83
- * const isolatedTest = isolator.wrapVitestWithTransaction(db);
84
- *
85
- * isolatedTest('should create user', async ({ trx }) => {
86
- * await trx.insert('users', { name: 'Test' });
87
- * // Data is automatically rolled back after test
88
- * });
89
- * ```
90
- */
91
- export declare abstract class VitestPostgresTransactionIsolator<TConn, Transaction> {
92
- private readonly api;
93
- /**
94
- * Abstract method to create a transaction with the specified isolation level.
95
- * Must be implemented by subclasses for specific database drivers.
96
- *
97
- * @param conn - The database connection
98
- * @param isolationLevel - The transaction isolation level
99
- * @param fn - The function to execute within the transaction
100
- * @returns Promise that resolves when the transaction completes
101
- */
102
- abstract transact(conn: TConn, isolationLevel: IsolationLevel, fn: (trx: Transaction) => Promise<void>): Promise<void>;
103
- abstract destroy(conn: TConn): Promise<void>;
104
- /**
105
- * Creates a new VitestPostgresTransactionIsolator instance.
106
- *
107
- * @param api - The Vitest test API (usually the `test` export from vitest)
108
- */
109
- constructor(api: TestAPI);
110
- /**
111
- * Creates a wrapped version of Vitest's test API that provides transaction isolation.
112
- * Each test will run within a database transaction that is automatically rolled back.
113
- *
114
- * @param options - Configuration options for transaction wrapping
115
- * @returns A wrapped test API with transaction support
116
- *
117
- * @example
118
- * ```typescript
119
- * const isolatedTest = isolator.wrapVitestWithTransaction({
120
- * connection: db,
121
- * setup: async (trx) => {
122
- * await trx.insert('settings', { key: 'test', value: 'true' });
123
- * },
124
- * fixtures: {
125
- * factory: (trx) => new Factory(trx),
126
- * },
127
- * });
128
- *
129
- * isolatedTest('test with transaction', async ({ trx, factory }) => {
130
- * const user = await factory.insert('user', { name: 'Test' });
131
- * expect(user).toBeDefined();
132
- * });
133
- * ```
134
- */
135
- wrapVitestWithTransaction<Extended extends Record<string, unknown> = {}>(options: TransactionWrapperOptions<TConn, Transaction, Extended>): TestAPI<DatabaseFixtures<Transaction, object> & Extended>;
136
- }
137
- export type DatabaseConnectionFn<Conn> = () => Conn | Promise<Conn>;
138
- /**
139
- * Where a connection comes from: a construct, or a function returning one.
140
- *
141
- * A construct is preferred, because it builds the client through the same
142
- * `connect()` production uses. A hand-rolled client missing `CamelCasePlugin`
143
- * writes `createdAt` where the app writes `created_at`, and the test passes
144
- * while production does not. The URL is read from `process.env`.
145
- */
146
- export type DatabaseConnection<Conn> = DatabaseConnectionFn<Conn> | ConnectableConstruct<Conn>;
147
- /**
148
- * Options for wrapping Vitest tests with database transaction isolation.
149
- */
150
- /**
151
- * Anything that owns a service handing back a connection — a database
152
- * construct, structurally, so testkit depends on no construct package.
153
- */
154
- export interface ConnectableConstruct<TConn> {
155
- readonly service: Service<string, TConn>;
156
- }
157
- export interface TransactionWrapperOptions<TConn, Transaction, Extended extends Record<string, unknown> = {}> {
158
- /** Where the connection comes from — a construct, or a function returning one */
159
- connection: DatabaseConnection<TConn>;
160
- /** Optional setup function to run within the transaction before each test */
161
- setup?: (trx: Transaction) => Promise<void>;
162
- /** Transaction isolation level (defaults to REPEATABLE_READ) */
163
- isolationLevel?: IsolationLevel;
164
- /** Additional fixtures that depend on the transaction */
165
- fixtures?: FixtureCreators<Transaction, Extended>;
166
- }
167
- /**
168
- * Type for fixture creator functions that depend on the transaction.
169
- * Each function receives the transaction and returns the fixture value.
170
- */
171
- export type FixtureCreators<Transaction, Extended extends Record<string, unknown>> = { [K in keyof Extended]: (trx: Transaction) => Extended[K] | Promise<Extended[K]>; };
172
- /**
173
- * The test API returned by extendWithFixtures.
174
- * Provides access to both the transaction (trx) and all extended fixtures.
175
- *
176
- * @template Transaction - The transaction type
177
- * @template Extended - The type of additional fixtures provided
178
- * @template BaseTest - The base wrapped test type
179
- */
180
- export type TestWithExtendedFixtures<Transaction, Extended extends Record<string, unknown>, BaseTest extends ReturnType<TestAPI['extend']> = ReturnType<TestAPI['extend']>> = BaseTest & {
181
- <C extends object>(name: string, fn: (context: DatabaseFixtures<Transaction> & Extended & C) => Promise<void>): void;
182
- <C extends object>(name: string, options: object, fn: (context: DatabaseFixtures<Transaction> & Extended & C) => Promise<void>): void;
183
- };
184
- /**
185
- * Extends a wrapped test API with additional fixtures that depend on the transaction.
186
- * This allows composing test context with factories, repositories, or other helpers.
187
- *
188
- * @template Transaction - The transaction type
189
- * @template Extended - The type of additional context to provide
190
- * @param wrappedTest - The base wrapped test from wrapVitestWithTransaction
191
- * @param fixtures - Object mapping fixture names to creator functions
192
- * @returns An extended test API with both trx and the additional fixtures
193
- *
194
- * @example
195
- * ```typescript
196
- * import { wrapVitestKyselyTransaction, extendWithFixtures } from '@geekmidas/testkit/kysely';
197
- *
198
- * // Create base wrapped test
199
- * const baseTest = wrapVitestKyselyTransaction(test, {
200
- * connection: db,
201
- * setup: createTestTables,
202
- * });
203
- *
204
- * // Extend with fixtures
205
- * const it = extendWithFixtures(baseTest, {
206
- * factory: (trx) => new KyselyFactory(builders, seeds, trx),
207
- * userRepo: (trx) => new UserRepository(trx),
208
- * });
209
- *
210
- * // Use in tests - trx and all fixtures are available
211
- * it('should create user with factory', async ({ trx, factory, userRepo }) => {
212
- * const user = await factory.insert('user', { name: 'Test' });
213
- * expect(user).toBeDefined();
214
- * });
215
- * ```
216
- */
217
- export declare function extendWithFixtures<Transaction, Extended extends Record<string, unknown>, T extends ReturnType<TestAPI['extend']> = any>(wrappedTest: T, fixtures: FixtureCreators<Transaction, Extended>): TestWithExtendedFixtures<Transaction, Extended, T>;
218
- //#endregion
219
- //# sourceMappingURL=VitestTransactionIsolator.d.mts.map
1
+ import { DatabaseConnection, DatabaseConnectionFn, DatabaseFixtures, ExtendContextFn, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions, VitestPostgresTransactionIsolator, extendWithFixtures } from "./VitestTransactionIsolator-BNWJqh9f.mjs";
2
+ export { DatabaseConnection, DatabaseConnectionFn, DatabaseFixtures, ExtendContextFn, ExtendedDatabaseFixtures, FixtureCreators, IsolationLevel, TestWithExtendedFixtures, TransactionWrapperOptions, VitestPostgresTransactionIsolator, extendWithFixtures };
@@ -1,185 +1,3 @@
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 };
1
+ import { IsolationLevel, VitestPostgresTransactionIsolator, extendWithFixtures } from "./VitestTransactionIsolator-D6ZxLWys.mjs";
184
2
 
185
- //# sourceMappingURL=VitestTransactionIsolator.mjs.map
3
+ export { IsolationLevel, VitestPostgresTransactionIsolator, extendWithFixtures };
package/dist/aws.cjs CHANGED
@@ -1,5 +1,6 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- let vitest = require("vitest");
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const vitest = require_chunk.__toESM(require("vitest"));
3
+
3
4
  //#region src/aws.ts
4
5
  /**
5
6
  * Shared test utilities for AWS Lambda adapter testing
@@ -117,9 +118,9 @@ function createMockV2Event(overrides = {}) {
117
118
  ...overrides
118
119
  };
119
120
  }
121
+
120
122
  //#endregion
121
123
  exports.createMockContext = createMockContext;
122
124
  exports.createMockV1Event = createMockV1Event;
123
125
  exports.createMockV2Event = createMockV2Event;
124
-
125
126
  //# sourceMappingURL=aws.cjs.map
package/dist/aws.cjs.map CHANGED
@@ -1 +1 @@
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"}
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"}
package/dist/aws.d.cts CHANGED
@@ -1,19 +1,24 @@
1
1
  import { APIGatewayProxyEvent, APIGatewayProxyEventV2, Context } from "aws-lambda";
2
+
2
3
  //#region src/aws.d.ts
4
+
3
5
  /**
4
6
  * Shared test utilities for AWS Lambda adapter testing
5
7
  */
6
8
  /**
7
9
  * Creates a mock AWS Lambda Context for testing
8
10
  */
9
- export declare function createMockContext(): Context;
11
+ declare function createMockContext(): Context;
10
12
  /**
11
13
  * Creates a mock AWS API Gateway V1 (REST API) event for testing
12
14
  */
13
- export declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
15
+ declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
14
16
  /**
15
17
  * Creates a mock AWS API Gateway V2 (HTTP API) event for testing
16
18
  */
17
- export declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
19
+ declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
20
+ //# sourceMappingURL=aws.d.ts.map
21
+
18
22
  //#endregion
23
+ export { createMockContext, createMockV1Event, createMockV2Event };
19
24
  //# sourceMappingURL=aws.d.cts.map
@@ -1 +1 @@
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"}
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"}
package/dist/aws.d.mts CHANGED
@@ -1,19 +1,24 @@
1
1
  import { APIGatewayProxyEvent, APIGatewayProxyEventV2, Context } from "aws-lambda";
2
+
2
3
  //#region src/aws.d.ts
4
+
3
5
  /**
4
6
  * Shared test utilities for AWS Lambda adapter testing
5
7
  */
6
8
  /**
7
9
  * Creates a mock AWS Lambda Context for testing
8
10
  */
9
- export declare function createMockContext(): Context;
11
+ declare function createMockContext(): Context;
10
12
  /**
11
13
  * Creates a mock AWS API Gateway V1 (REST API) event for testing
12
14
  */
13
- export declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
15
+ declare function createMockV1Event(overrides?: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent;
14
16
  /**
15
17
  * Creates a mock AWS API Gateway V2 (HTTP API) event for testing
16
18
  */
17
- export declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
19
+ declare function createMockV2Event(overrides?: Partial<APIGatewayProxyEventV2>): APIGatewayProxyEventV2;
20
+ //# sourceMappingURL=aws.d.ts.map
21
+
18
22
  //#endregion
23
+ export { createMockContext, createMockV1Event, createMockV2Event };
19
24
  //# sourceMappingURL=aws.d.mts.map
@@ -1 +1 @@
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"}
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"}
package/dist/aws.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { vi } from "vitest";
2
+
2
3
  //#region src/aws.ts
3
4
  /**
4
5
  * Shared test utilities for AWS Lambda adapter testing
@@ -116,7 +117,7 @@ function createMockV2Event(overrides = {}) {
116
117
  ...overrides
117
118
  };
118
119
  }
120
+
119
121
  //#endregion
120
122
  export { createMockContext, createMockV1Event, createMockV2Event };
121
-
122
123
  //# sourceMappingURL=aws.mjs.map
package/dist/aws.mjs.map CHANGED
@@ -1 +1 @@
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
+ {"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,4 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+
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
+
43
44
  //#endregion
44
45
  exports.generateCacheKeys = generateCacheKeys;
45
46
  exports.generateIpAddresses = generateIpAddresses;
46
47
  exports.generateTestData = generateTestData;
47
48
  exports.randomIpAddress = randomIpAddress;
48
-
49
49
  //# sourceMappingURL=benchmark.cjs.map
@@ -1 +1 @@
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"}
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"}
@@ -5,7 +5,7 @@
5
5
  * @param count - Number of records to generate
6
6
  * @returns Array of test data objects
7
7
  */
8
- export declare function generateTestData(count: number): Array<{
8
+ declare function generateTestData(count: number): Array<{
9
9
  id: string;
10
10
  name: string;
11
11
  value: number;
@@ -17,7 +17,7 @@ export 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
- export declare function generateCacheKeys(prefix: string, count: number): string[];
20
+ declare function generateCacheKeys(prefix: string, count: number): string[];
21
21
  /**
22
22
  * Generates IP addresses for rate limit benchmarks.
23
23
  *
@@ -25,10 +25,12 @@ export 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
- export declare function generateIpAddresses(count: number, subnet?: string): string[];
28
+ declare function generateIpAddresses(count: number, subnet?: string): string[];
29
29
  /**
30
30
  * Creates a random IP address for rate limit benchmarks.
31
31
  */
32
- export declare function randomIpAddress(): string;
32
+ declare function randomIpAddress(): string;
33
+ //# sourceMappingURL=benchmark.d.ts.map
33
34
  //#endregion
35
+ export { generateCacheKeys, generateIpAddresses, generateTestData, randomIpAddress };
34
36
  //# sourceMappingURL=benchmark.d.cts.map
@@ -1 +1 @@
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"}
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"}