@geekmidas/constructs 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 (533) hide show
  1. package/CHANGELOG.md +437 -0
  2. package/README.md +193 -285
  3. package/dist/AWSScheduledFunction-BzGCUbkk.d.mts +117 -0
  4. package/dist/AWSScheduledFunction-BzGCUbkk.d.mts.map +1 -0
  5. package/dist/AWSScheduledFunction-C42adp8A.cjs +266 -0
  6. package/dist/AWSScheduledFunction-C42adp8A.cjs.map +1 -0
  7. package/dist/AWSScheduledFunction-CsNJhXQj.d.cts +117 -0
  8. package/dist/AWSScheduledFunction-CsNJhXQj.d.cts.map +1 -0
  9. package/dist/AWSScheduledFunction-KP6lqbsW.mjs +254 -0
  10. package/dist/AWSScheduledFunction-KP6lqbsW.mjs.map +1 -0
  11. package/dist/{Construct-B1vGBPme.mjs → Construct-BWF5HxaM.mjs} +37 -47
  12. package/dist/Construct-BWF5HxaM.mjs.map +1 -0
  13. package/dist/Construct-JlyQkBkv.d.cts +117 -0
  14. package/dist/Construct-JlyQkBkv.d.cts.map +1 -0
  15. package/dist/{Construct-DUSXuTHP.cjs → Construct-TGIM_E4o.cjs} +88 -67
  16. package/dist/Construct-TGIM_E4o.cjs.map +1 -0
  17. package/dist/Construct-pxwC6fDD.d.mts +117 -0
  18. package/dist/Construct-pxwC6fDD.d.mts.map +1 -0
  19. package/dist/{Endpoint-Du-NwPX2.d.mts → Endpoint-B0P_pEMr.d.mts} +85 -126
  20. package/dist/Endpoint-B0P_pEMr.d.mts.map +1 -0
  21. package/dist/{Endpoint-aCvBMPoH.d.cts → Endpoint-BLZ7r67m.d.cts} +84 -125
  22. package/dist/Endpoint-BLZ7r67m.d.cts.map +1 -0
  23. package/dist/{HonoEndpointAdaptor-PtPlbeKY.mjs → HonoEndpointAdaptor-BMVwx2cz.mjs} +69 -81
  24. package/dist/HonoEndpointAdaptor-BMVwx2cz.mjs.map +1 -0
  25. package/dist/{HonoEndpointAdaptor-zVzVLJEO.cjs → HonoEndpointAdaptor-DPDsDi-D.cjs} +77 -92
  26. package/dist/HonoEndpointAdaptor-DPDsDi-D.cjs.map +1 -0
  27. package/dist/Queue-BL68oDJ-.d.mts +66 -0
  28. package/dist/Queue-BL68oDJ-.d.mts.map +1 -0
  29. package/dist/Queue-DxJ6btRE.d.cts +66 -0
  30. package/dist/Queue-DxJ6btRE.d.cts.map +1 -0
  31. package/dist/Subscriber-BpVhcGhX.d.cts +47 -0
  32. package/dist/Subscriber-BpVhcGhX.d.cts.map +1 -0
  33. package/dist/Subscriber-DF6xsBAJ.d.mts +47 -0
  34. package/dist/Subscriber-DF6xsBAJ.d.mts.map +1 -0
  35. package/dist/Topic-DJXoDeMP.d.cts +60 -0
  36. package/dist/Topic-DJXoDeMP.d.cts.map +1 -0
  37. package/dist/Topic-DxWQBgMN.d.mts +60 -0
  38. package/dist/Topic-DxWQBgMN.d.mts.map +1 -0
  39. package/dist/adaptors/aws.cjs +205 -355
  40. package/dist/adaptors/aws.cjs.map +1 -1
  41. package/dist/adaptors/aws.d.cts +48 -126
  42. package/dist/adaptors/aws.d.cts.map +1 -1
  43. package/dist/adaptors/aws.d.mts +49 -127
  44. package/dist/adaptors/aws.d.mts.map +1 -1
  45. package/dist/adaptors/aws.mjs +178 -325
  46. package/dist/adaptors/aws.mjs.map +1 -1
  47. package/dist/adaptors/hono.cjs +9 -3
  48. package/dist/adaptors/hono.d.cts +15 -7
  49. package/dist/adaptors/hono.d.cts.map +1 -1
  50. package/dist/adaptors/hono.d.mts +17 -9
  51. package/dist/adaptors/hono.d.mts.map +1 -1
  52. package/dist/adaptors/hono.mjs +9 -2
  53. package/dist/adaptors/testing.cjs +209 -831
  54. package/dist/adaptors/testing.cjs.map +1 -1
  55. package/dist/adaptors/testing.d.cts +55 -351
  56. package/dist/adaptors/testing.d.cts.map +1 -1
  57. package/dist/adaptors/testing.d.mts +53 -349
  58. package/dist/adaptors/testing.d.mts.map +1 -1
  59. package/dist/adaptors/testing.mjs +195 -798
  60. package/dist/adaptors/testing.mjs.map +1 -1
  61. package/dist/{clone-UGJpvQnL.cjs → clone-I_WIpiFf.cjs} +8 -7
  62. package/dist/clone-I_WIpiFf.cjs.map +1 -0
  63. package/dist/{clone-EKNovYHu.mjs → clone-pdXxc0t3.mjs} +3 -3
  64. package/dist/clone-pdXxc0t3.mjs.map +1 -0
  65. package/dist/crons/index.cjs +66 -190
  66. package/dist/crons/index.cjs.map +1 -1
  67. package/dist/crons/index.d.cts +35 -70
  68. package/dist/crons/index.d.cts.map +1 -1
  69. package/dist/crons/index.d.mts +32 -70
  70. package/dist/crons/index.d.mts.map +1 -1
  71. package/dist/crons/index.mjs +63 -184
  72. package/dist/crons/index.mjs.map +1 -1
  73. package/dist/endpoints/index.cjs +761 -19
  74. package/dist/endpoints/index.cjs.map +1 -0
  75. package/dist/endpoints/index.d.cts +322 -22
  76. package/dist/endpoints/index.d.cts.map +1 -1
  77. package/dist/endpoints/index.d.mts +321 -22
  78. package/dist/endpoints/index.d.mts.map +1 -1
  79. package/dist/endpoints/index.mjs +751 -6
  80. package/dist/endpoints/index.mjs.map +1 -0
  81. package/dist/functions/index.cjs +5 -2
  82. package/dist/functions/index.d.cts +3 -3
  83. package/dist/functions/index.d.mts +3 -3
  84. package/dist/functions/index.mjs +5 -2
  85. package/dist/{functions-BFizikJU.mjs → functions-EqTloHjo.mjs} +331 -425
  86. package/dist/functions-EqTloHjo.mjs.map +1 -0
  87. package/dist/{functions-CfzJG9hK.cjs → functions-SqtCDc9c.cjs} +370 -459
  88. package/dist/functions-SqtCDc9c.cjs.map +1 -0
  89. package/dist/index-C7iynzLI.d.mts +139 -0
  90. package/dist/index-C7iynzLI.d.mts.map +1 -0
  91. package/dist/index-D4dM_WDY.d.cts +142 -0
  92. package/dist/index-D4dM_WDY.d.cts.map +1 -0
  93. package/dist/index.cjs +3 -6
  94. package/dist/index.d.cts +4 -27
  95. package/dist/index.d.mts +4 -27
  96. package/dist/index.mjs +3 -3
  97. package/dist/{Endpoint-BG4UJ9oA.mjs → lazyAccessors-CCTK19xj.mjs} +1040 -914
  98. package/dist/lazyAccessors-CCTK19xj.mjs.map +1 -0
  99. package/dist/{Endpoint-BoUg8ocM.cjs → lazyAccessors-D04oftGw.cjs} +1127 -960
  100. package/dist/lazyAccessors-D04oftGw.cjs.map +1 -0
  101. package/dist/monitors/index.cjs +49 -0
  102. package/dist/monitors/index.cjs.map +1 -0
  103. package/dist/monitors/index.d.cts +45 -0
  104. package/dist/monitors/index.d.cts.map +1 -0
  105. package/dist/monitors/index.d.mts +45 -0
  106. package/dist/monitors/index.d.mts.map +1 -0
  107. package/dist/monitors/index.mjs +48 -0
  108. package/dist/monitors/index.mjs.map +1 -0
  109. package/dist/processAudits-BJZT5gmy.cjs +92 -0
  110. package/dist/processAudits-BJZT5gmy.cjs.map +1 -0
  111. package/dist/processAudits-CwyaaSQc.mjs +80 -0
  112. package/dist/processAudits-CwyaaSQc.mjs.map +1 -0
  113. package/dist/publisher-BZgcrVPy.cjs +53 -0
  114. package/dist/publisher-BZgcrVPy.cjs.map +1 -0
  115. package/dist/publisher-CnpeMv-r.mjs +41 -0
  116. package/dist/publisher-CnpeMv-r.mjs.map +1 -0
  117. package/dist/queue/index.cjs +114 -6
  118. package/dist/queue/index.cjs.map +1 -0
  119. package/dist/queue/index.d.cts +45 -3
  120. package/dist/queue/index.d.cts.map +1 -0
  121. package/dist/queue/index.d.mts +44 -3
  122. package/dist/queue/index.d.mts.map +1 -0
  123. package/dist/queue/index.mjs +112 -3
  124. package/dist/queue/index.mjs.map +1 -0
  125. package/dist/subscribers/index.cjs +80 -111
  126. package/dist/subscribers/index.cjs.map +1 -1
  127. package/dist/subscribers/index.d.cts +43 -46
  128. package/dist/subscribers/index.d.cts.map +1 -1
  129. package/dist/subscribers/index.d.mts +42 -46
  130. package/dist/subscribers/index.d.mts.map +1 -1
  131. package/dist/subscribers/index.mjs +78 -108
  132. package/dist/subscribers/index.mjs.map +1 -1
  133. package/dist/{lambdaTelemetry-8vnmVZQ5.d.cts → telemetry-C--EgYVr.d.mts} +7 -4
  134. package/dist/telemetry-C--EgYVr.d.mts.map +1 -0
  135. package/dist/{lambdaTelemetry-8vnmVZQ5.d.mts → telemetry-Dqx-D3F7.d.cts} +7 -4
  136. package/dist/telemetry-Dqx-D3F7.d.cts.map +1 -0
  137. package/dist/topic/index.cjs +91 -3
  138. package/dist/topic/index.cjs.map +1 -0
  139. package/dist/topic/index.d.cts +32 -2
  140. package/dist/topic/index.d.cts.map +1 -0
  141. package/dist/topic/index.d.mts +32 -2
  142. package/dist/topic/index.d.mts.map +1 -0
  143. package/dist/topic/index.mjs +89 -2
  144. package/dist/topic/index.mjs.map +1 -0
  145. package/dist/{types-DMuSQeLL.d.cts → types-BdAaYDvd.d.cts} +5 -3
  146. package/dist/types-BdAaYDvd.d.cts.map +1 -0
  147. package/dist/{types-DMuSQeLL.d.mts → types-DNngH0fX.d.mts} +5 -3
  148. package/dist/types-DNngH0fX.d.mts.map +1 -0
  149. package/dist/types.d.cts +1 -1
  150. package/dist/types.d.mts +1 -1
  151. package/dist/types.mjs +0 -1
  152. package/package.json +55 -223
  153. package/src/Construct.ts +209 -0
  154. package/src/__benchmarks__/build-time-optimization.bench.ts +274 -0
  155. package/src/__benchmarks__/endpoint.bench.ts +494 -0
  156. package/src/__benchmarks__/fixtures.ts +241 -0
  157. package/src/__benchmarks__/hono-adaptor.bench.ts +533 -0
  158. package/src/__benchmarks__/hono-server.bench.ts +249 -0
  159. package/src/__benchmarks__/response-builder.bench.ts +428 -0
  160. package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +319 -0
  161. package/src/__benchmarks__/strategies/strategy-c-middleware.ts +530 -0
  162. package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +567 -0
  163. package/src/__tests__/Construct.environment.spec.ts +704 -0
  164. package/src/__tests__/builder-reuse.spec.ts +587 -0
  165. package/src/__tests__/monitor.spec.ts +636 -0
  166. package/src/__tests__/publisher.setting.spec.ts +508 -0
  167. package/src/__tests__/publisher.spec.ts +452 -0
  168. package/src/adaptors/aws.ts +6 -0
  169. package/src/adaptors/hono.ts +1 -0
  170. package/src/adaptors/testing.ts +11 -0
  171. package/src/clone.ts +38 -0
  172. package/src/crons/AWSScheduledFunction.ts +73 -0
  173. package/src/crons/Cron.ts +149 -0
  174. package/src/crons/CronBuilder.ts +261 -0
  175. package/src/crons/__tests__/AWSScheduledFunction.spec.ts +152 -0
  176. package/src/crons/__tests__/Cron.spec.ts +472 -0
  177. package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +273 -0
  178. package/src/crons/index.ts +12 -0
  179. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +698 -0
  180. package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +105 -0
  181. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +97 -0
  182. package/src/endpoints/Authorizer.ts +152 -0
  183. package/src/endpoints/Endpoint.ts +1287 -0
  184. package/src/endpoints/EndpointBuilder.ts +749 -0
  185. package/src/endpoints/EndpointFactory.ts +1179 -0
  186. package/src/endpoints/HonoEndpointAdaptor.ts +692 -0
  187. package/src/endpoints/MswEndpointAdaptor.ts +226 -0
  188. package/src/endpoints/TestEndpointAdaptor.ts +466 -0
  189. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +499 -0
  190. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +560 -0
  191. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +1304 -0
  192. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +626 -0
  193. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +732 -0
  194. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +296 -0
  195. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +951 -0
  196. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.responseType.spec.ts +111 -0
  197. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +307 -0
  198. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +629 -0
  199. package/src/endpoints/__tests__/Authorizer.spec.ts +286 -0
  200. package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +207 -0
  201. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +187 -0
  202. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +175 -0
  203. package/src/endpoints/__tests__/Endpoint.spec.ts +857 -0
  204. package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +451 -0
  205. package/src/endpoints/__tests__/EndpointBuilder.responseType.spec.ts +50 -0
  206. package/src/endpoints/__tests__/EndpointBuilder.spec.ts +531 -0
  207. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +492 -0
  208. package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +509 -0
  209. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +190 -0
  210. package/src/endpoints/__tests__/EndpointFactory.spec.ts +479 -0
  211. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +155 -0
  212. package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +703 -0
  213. package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +632 -0
  214. package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +577 -0
  215. package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1067 -0
  216. package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +317 -0
  217. package/src/endpoints/__tests__/HonoEndpointAdaptor.pgboss-publisher.spec.ts +289 -0
  218. package/src/endpoints/__tests__/HonoEndpointAdaptor.responseType.spec.ts +128 -0
  219. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1207 -0
  220. package/src/endpoints/__tests__/MswEndpointAdaptor.spec.ts +211 -0
  221. package/src/endpoints/__tests__/ResponseBuilder.spec.ts +235 -0
  222. package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +602 -0
  223. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +1044 -0
  224. package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +54 -0
  225. package/src/endpoints/__tests__/endpoint-types.test.ts +88 -0
  226. package/src/endpoints/__tests__/helpers.spec.ts +37 -0
  227. package/src/endpoints/__tests__/lazyAccessors.spec.ts +330 -0
  228. package/src/endpoints/__tests__/processAudits.spec.ts +631 -0
  229. package/src/endpoints/audit.ts +87 -0
  230. package/src/endpoints/helpers.ts +98 -0
  231. package/src/endpoints/index.ts +42 -0
  232. package/src/endpoints/lazyAccessors.ts +241 -0
  233. package/src/endpoints/parseHonoQuery.ts +16 -0
  234. package/src/endpoints/parseQueryParams.ts +32 -0
  235. package/src/endpoints/processAudits.ts +371 -0
  236. package/src/endpoints/rls.ts +67 -0
  237. package/src/functions/AWSLambdaFunction.ts +374 -0
  238. package/src/functions/BaseFunctionBuilder.ts +212 -0
  239. package/src/functions/Function.ts +238 -0
  240. package/src/functions/FunctionBuilder.ts +381 -0
  241. package/src/functions/FunctionExecutionWrapper.ts +216 -0
  242. package/src/functions/TestFunctionAdaptor.ts +252 -0
  243. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +513 -0
  244. package/src/functions/__tests__/Function.audits.spec.ts +393 -0
  245. package/src/functions/__tests__/Function.spec.ts +477 -0
  246. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +250 -0
  247. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +480 -0
  248. package/src/functions/index.ts +12 -0
  249. package/src/index.ts +29 -0
  250. package/src/monitor.ts +145 -0
  251. package/src/monitors/heartbeat.ts +86 -0
  252. package/src/monitors/index.ts +6 -0
  253. package/src/publisher.ts +93 -0
  254. package/src/queue/AWSLambdaQueueAdaptor.ts +162 -0
  255. package/src/queue/Queue.ts +128 -0
  256. package/src/queue/QueueBuilder.ts +115 -0
  257. package/src/queue/TestQueueAdaptor.ts +63 -0
  258. package/src/queue/__tests__/QueueBuilder.spec.ts +137 -0
  259. package/src/queue/index.ts +12 -0
  260. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +342 -0
  261. package/src/subscribers/Subscriber.ts +117 -0
  262. package/src/subscribers/SubscriberBuilder.ts +183 -0
  263. package/src/subscribers/TestSubscriberAdaptor.ts +133 -0
  264. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +1018 -0
  265. package/src/subscribers/__tests__/Subscriber.spec.ts +430 -0
  266. package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +652 -0
  267. package/src/subscribers/index.ts +6 -0
  268. package/src/telemetry.ts +103 -0
  269. package/src/topic/Topic.ts +103 -0
  270. package/src/topic/TopicBuilder.ts +53 -0
  271. package/src/topic/__tests__/TopicBuilder.spec.ts +82 -0
  272. package/src/topic/index.ts +11 -0
  273. package/src/types.ts +13 -0
  274. package/test.ts +91 -0
  275. package/tsconfig.json +9 -0
  276. package/tsdown.config.ts +35 -0
  277. package/dist/Construct-B1vGBPme.mjs.map +0 -1
  278. package/dist/Construct-BQALFCh2.d.cts +0 -230
  279. package/dist/Construct-BQALFCh2.d.cts.map +0 -1
  280. package/dist/Construct-DUSXuTHP.cjs.map +0 -1
  281. package/dist/Construct-QXnl3VqT.d.mts +0 -230
  282. package/dist/Construct-QXnl3VqT.d.mts.map +0 -1
  283. package/dist/Cron-DI3nKoic.d.cts +0 -45
  284. package/dist/Cron-DI3nKoic.d.cts.map +0 -1
  285. package/dist/Cron-uYAHPnp7.d.mts +0 -45
  286. package/dist/Cron-uYAHPnp7.d.mts.map +0 -1
  287. package/dist/CronBuilder-C0Ek1-RA.cjs +0 -121
  288. package/dist/CronBuilder-C0Ek1-RA.cjs.map +0 -1
  289. package/dist/CronBuilder-DaSUm2Na.d.mts +0 -47
  290. package/dist/CronBuilder-DaSUm2Na.d.mts.map +0 -1
  291. package/dist/CronBuilder-Dmix_Pen.mjs +0 -109
  292. package/dist/CronBuilder-Dmix_Pen.mjs.map +0 -1
  293. package/dist/CronBuilder-g1lZLWyG.d.cts +0 -47
  294. package/dist/CronBuilder-g1lZLWyG.d.cts.map +0 -1
  295. package/dist/Endpoint-BG4UJ9oA.mjs.map +0 -1
  296. package/dist/Endpoint-BoUg8ocM.cjs.map +0 -1
  297. package/dist/Endpoint-Du-NwPX2.d.mts.map +0 -1
  298. package/dist/Endpoint-aCvBMPoH.d.cts.map +0 -1
  299. package/dist/EndpointFactory-BDtsrEvJ.mjs +0 -791
  300. package/dist/EndpointFactory-BDtsrEvJ.mjs.map +0 -1
  301. package/dist/EndpointFactory-DJ7gXLpR.cjs +0 -833
  302. package/dist/EndpointFactory-DJ7gXLpR.cjs.map +0 -1
  303. package/dist/EndpointFactory-DMYdJCOj.d.mts +0 -363
  304. package/dist/EndpointFactory-DMYdJCOj.d.mts.map +0 -1
  305. package/dist/EndpointFactory-I7s1co3Y.d.cts +0 -363
  306. package/dist/EndpointFactory-I7s1co3Y.d.cts.map +0 -1
  307. package/dist/Function-DuqGcbOI.d.mts +0 -76
  308. package/dist/Function-DuqGcbOI.d.mts.map +0 -1
  309. package/dist/Function-Pu-1kKZz.d.cts +0 -76
  310. package/dist/Function-Pu-1kKZz.d.cts.map +0 -1
  311. package/dist/HonoEndpointAdaptor-PtPlbeKY.mjs.map +0 -1
  312. package/dist/HonoEndpointAdaptor-zVzVLJEO.cjs.map +0 -1
  313. package/dist/Queue-A3wfD0it.cjs +0 -109
  314. package/dist/Queue-A3wfD0it.cjs.map +0 -1
  315. package/dist/Queue-D6USGS4q.mjs +0 -104
  316. package/dist/Queue-D6USGS4q.mjs.map +0 -1
  317. package/dist/Queue-DlsHRzUp.d.mts +0 -105
  318. package/dist/Queue-DlsHRzUp.d.mts.map +0 -1
  319. package/dist/Queue-HPyi0e1i.d.cts +0 -105
  320. package/dist/Queue-HPyi0e1i.d.cts.map +0 -1
  321. package/dist/QueueBuilder-BjuF0UBl.cjs +0 -135
  322. package/dist/QueueBuilder-BjuF0UBl.cjs.map +0 -1
  323. package/dist/QueueBuilder-Cue73M4t.mjs +0 -118
  324. package/dist/QueueBuilder-Cue73M4t.mjs.map +0 -1
  325. package/dist/QueueBuilder-OSi6LkV9.d.cts +0 -75
  326. package/dist/QueueBuilder-OSi6LkV9.d.cts.map +0 -1
  327. package/dist/QueueBuilder-QHsnVt1P.d.mts +0 -75
  328. package/dist/QueueBuilder-QHsnVt1P.d.mts.map +0 -1
  329. package/dist/Subscriber-Bpp02cGr.d.cts +0 -61
  330. package/dist/Subscriber-Bpp02cGr.d.cts.map +0 -1
  331. package/dist/Subscriber-CtN9R48-.d.mts +0 -61
  332. package/dist/Subscriber-CtN9R48-.d.mts.map +0 -1
  333. package/dist/SubscriberBuilder-CDy4nHCz.mjs +0 -134
  334. package/dist/SubscriberBuilder-CDy4nHCz.mjs.map +0 -1
  335. package/dist/SubscriberBuilder-CuCMFpYW.d.mts +0 -67
  336. package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +0 -1
  337. package/dist/SubscriberBuilder-D_owVoHo.cjs +0 -145
  338. package/dist/SubscriberBuilder-D_owVoHo.cjs.map +0 -1
  339. package/dist/SubscriberBuilder-g3fAVWgs.d.cts +0 -67
  340. package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +0 -1
  341. package/dist/Topic-D74b5cgs.mjs +0 -99
  342. package/dist/Topic-D74b5cgs.mjs.map +0 -1
  343. package/dist/Topic-GHxcU8AG.cjs +0 -104
  344. package/dist/Topic-GHxcU8AG.cjs.map +0 -1
  345. package/dist/auth-BMCJN30Y.d.cts +0 -268
  346. package/dist/auth-BMCJN30Y.d.cts.map +0 -1
  347. package/dist/auth-CcuceLYo.d.mts +0 -268
  348. package/dist/auth-CcuceLYo.d.mts.map +0 -1
  349. package/dist/auth.cjs +0 -433
  350. package/dist/auth.cjs.map +0 -1
  351. package/dist/auth.d.cts +0 -2
  352. package/dist/auth.d.mts +0 -2
  353. package/dist/auth.mjs +0 -426
  354. package/dist/auth.mjs.map +0 -1
  355. package/dist/cache-CXh6GIgb.d.mts +0 -44
  356. package/dist/cache-CXh6GIgb.d.mts.map +0 -1
  357. package/dist/cache-DnGDGly3.d.cts +0 -44
  358. package/dist/cache-DnGDGly3.d.cts.map +0 -1
  359. package/dist/cache.cjs +0 -69
  360. package/dist/cache.cjs.map +0 -1
  361. package/dist/cache.d.cts +0 -2
  362. package/dist/cache.d.mts +0 -2
  363. package/dist/cache.mjs +0 -68
  364. package/dist/cache.mjs.map +0 -1
  365. package/dist/cipher-C1lEFX63.mjs +0 -225
  366. package/dist/cipher-C1lEFX63.mjs.map +0 -1
  367. package/dist/cipher-CVxfwLjk.cjs +0 -332
  368. package/dist/cipher-CVxfwLjk.cjs.map +0 -1
  369. package/dist/clone-EKNovYHu.mjs.map +0 -1
  370. package/dist/clone-UGJpvQnL.cjs.map +0 -1
  371. package/dist/construct-interface-B1AfqRl4.d.cts +0 -162
  372. package/dist/construct-interface-B1AfqRl4.d.cts.map +0 -1
  373. package/dist/construct-interface-DluK3_da.d.mts +0 -162
  374. package/dist/construct-interface-DluK3_da.d.mts.map +0 -1
  375. package/dist/construct-interface.cjs +0 -114
  376. package/dist/construct-interface.cjs.map +0 -1
  377. package/dist/construct-interface.d.cts +0 -2
  378. package/dist/construct-interface.d.mts +0 -2
  379. package/dist/construct-interface.mjs +0 -107
  380. package/dist/construct-interface.mjs.map +0 -1
  381. package/dist/credential.cjs +0 -156
  382. package/dist/credential.cjs.map +0 -1
  383. package/dist/credential.d.cts +0 -86
  384. package/dist/credential.d.cts.map +0 -1
  385. package/dist/credential.d.mts +0 -86
  386. package/dist/credential.d.mts.map +0 -1
  387. package/dist/credential.mjs +0 -152
  388. package/dist/credential.mjs.map +0 -1
  389. package/dist/database/kysely.cjs +0 -4
  390. package/dist/database/kysely.d.cts +0 -2
  391. package/dist/database/kysely.d.mts +0 -2
  392. package/dist/database/kysely.mjs +0 -2
  393. package/dist/email.cjs +0 -72
  394. package/dist/email.cjs.map +0 -1
  395. package/dist/email.d.cts +0 -46
  396. package/dist/email.d.cts.map +0 -1
  397. package/dist/email.d.mts +0 -46
  398. package/dist/email.d.mts.map +0 -1
  399. package/dist/email.mjs +0 -71
  400. package/dist/email.mjs.map +0 -1
  401. package/dist/encryption.cjs +0 -96
  402. package/dist/encryption.cjs.map +0 -1
  403. package/dist/encryption.d.cts +0 -117
  404. package/dist/encryption.d.cts.map +0 -1
  405. package/dist/encryption.d.mts +0 -117
  406. package/dist/encryption.d.mts.map +0 -1
  407. package/dist/encryption.mjs +0 -83
  408. package/dist/encryption.mjs.map +0 -1
  409. package/dist/external-api-MJ8id87V.d.mts +0 -105
  410. package/dist/external-api-MJ8id87V.d.mts.map +0 -1
  411. package/dist/external-api-O107yzZJ.d.cts +0 -105
  412. package/dist/external-api-O107yzZJ.d.cts.map +0 -1
  413. package/dist/external-api.cjs +0 -142
  414. package/dist/external-api.cjs.map +0 -1
  415. package/dist/external-api.d.cts +0 -2
  416. package/dist/external-api.d.mts +0 -2
  417. package/dist/external-api.mjs +0 -139
  418. package/dist/external-api.mjs.map +0 -1
  419. package/dist/file-server.cjs +0 -186
  420. package/dist/file-server.cjs.map +0 -1
  421. package/dist/file-server.d.cts +0 -152
  422. package/dist/file-server.d.cts.map +0 -1
  423. package/dist/file-server.d.mts +0 -152
  424. package/dist/file-server.d.mts.map +0 -1
  425. package/dist/file-server.mjs +0 -184
  426. package/dist/file-server.mjs.map +0 -1
  427. package/dist/functions-BFizikJU.mjs.map +0 -1
  428. package/dist/functions-CfzJG9hK.cjs.map +0 -1
  429. package/dist/index-BuzRvKOQ.d.cts +0 -115
  430. package/dist/index-BuzRvKOQ.d.cts.map +0 -1
  431. package/dist/index-CTkKOer4.d.mts +0 -115
  432. package/dist/index-CTkKOer4.d.mts.map +0 -1
  433. package/dist/index-CeEtxDmK.d.cts +0 -79
  434. package/dist/index-CeEtxDmK.d.cts.map +0 -1
  435. package/dist/index-CeEtxDmK.d.mts +0 -79
  436. package/dist/index-CeEtxDmK.d.mts.map +0 -1
  437. package/dist/index.d.cts.map +0 -1
  438. package/dist/index.d.mts.map +0 -1
  439. package/dist/kms-B-Hm3d5r.cjs +0 -85
  440. package/dist/kms-B-Hm3d5r.cjs.map +0 -1
  441. package/dist/kms-BdUlMJEZ.mjs +0 -85
  442. package/dist/kms-BdUlMJEZ.mjs.map +0 -1
  443. package/dist/kysely-Bii4l6eP.mjs +0 -370
  444. package/dist/kysely-Bii4l6eP.mjs.map +0 -1
  445. package/dist/kysely-CO_Dk43W.cjs +0 -383
  446. package/dist/kysely-CO_Dk43W.cjs.map +0 -1
  447. package/dist/kysely-D0bpzgPs.d.cts +0 -175
  448. package/dist/kysely-D0bpzgPs.d.cts.map +0 -1
  449. package/dist/kysely-DUqC3Ie0.d.mts +0 -175
  450. package/dist/kysely-DUqC3Ie0.d.mts.map +0 -1
  451. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +0 -1
  452. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +0 -1
  453. package/dist/lazyAccessors-CFanua0O.mjs +0 -174
  454. package/dist/lazyAccessors-CFanua0O.mjs.map +0 -1
  455. package/dist/lazyAccessors-hJKGv8Ay.cjs +0 -221
  456. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +0 -1
  457. package/dist/mobile-app.cjs +0 -73
  458. package/dist/mobile-app.cjs.map +0 -1
  459. package/dist/mobile-app.d.cts +0 -61
  460. package/dist/mobile-app.d.cts.map +0 -1
  461. package/dist/mobile-app.d.mts +0 -61
  462. package/dist/mobile-app.d.mts.map +0 -1
  463. package/dist/mobile-app.mjs +0 -72
  464. package/dist/mobile-app.mjs.map +0 -1
  465. package/dist/object-storage.cjs +0 -56
  466. package/dist/object-storage.cjs.map +0 -1
  467. package/dist/object-storage.d.cts +0 -32
  468. package/dist/object-storage.d.cts.map +0 -1
  469. package/dist/object-storage.d.mts +0 -32
  470. package/dist/object-storage.d.mts.map +0 -1
  471. package/dist/object-storage.mjs +0 -55
  472. package/dist/object-storage.mjs.map +0 -1
  473. package/dist/processAudits-BRRVVHUB.mjs +0 -131
  474. package/dist/processAudits-BRRVVHUB.mjs.map +0 -1
  475. package/dist/processAudits-DasOZjPl.cjs +0 -154
  476. package/dist/processAudits-DasOZjPl.cjs.map +0 -1
  477. package/dist/rest-api.cjs +0 -216
  478. package/dist/rest-api.cjs.map +0 -1
  479. package/dist/rest-api.d.cts +0 -241
  480. package/dist/rest-api.d.cts.map +0 -1
  481. package/dist/rest-api.d.mts +0 -241
  482. package/dist/rest-api.d.mts.map +0 -1
  483. package/dist/rest-api.mjs +0 -215
  484. package/dist/rest-api.mjs.map +0 -1
  485. package/dist/rolldown-runtime-y5ARvAq5.cjs +0 -35
  486. package/dist/runSubscriber-BHvJ8POr.mjs +0 -109
  487. package/dist/runSubscriber-BHvJ8POr.mjs.map +0 -1
  488. package/dist/runSubscriber-D8nLXIv1.cjs +0 -126
  489. package/dist/runSubscriber-D8nLXIv1.cjs.map +0 -1
  490. package/dist/shutdown-BMJmAhSt.cjs +0 -38
  491. package/dist/shutdown-BMJmAhSt.cjs.map +0 -1
  492. package/dist/shutdown-C7xa8x9S.mjs +0 -27
  493. package/dist/shutdown-C7xa8x9S.mjs.map +0 -1
  494. package/dist/site.cjs +0 -74
  495. package/dist/site.cjs.map +0 -1
  496. package/dist/site.d.cts +0 -104
  497. package/dist/site.d.cts.map +0 -1
  498. package/dist/site.d.mts +0 -104
  499. package/dist/site.d.mts.map +0 -1
  500. package/dist/site.mjs +0 -73
  501. package/dist/site.mjs.map +0 -1
  502. package/dist/stages-BSCF19o2.d.cts +0 -56
  503. package/dist/stages-BSCF19o2.d.cts.map +0 -1
  504. package/dist/stages-BSCF19o2.d.mts +0 -56
  505. package/dist/stages-BSCF19o2.d.mts.map +0 -1
  506. package/dist/surfaceEnv-CNimK76p.cjs +0 -56
  507. package/dist/surfaceEnv-CNimK76p.cjs.map +0 -1
  508. package/dist/surfaceEnv-wMT5QzgZ.mjs +0 -45
  509. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +0 -1
  510. package/dist/telemetry-B48RLjyk.d.cts +0 -40
  511. package/dist/telemetry-B48RLjyk.d.cts.map +0 -1
  512. package/dist/telemetry-DRtT1_0A.d.mts +0 -40
  513. package/dist/telemetry-DRtT1_0A.d.mts.map +0 -1
  514. package/dist/telemetry.cjs +0 -56
  515. package/dist/telemetry.cjs.map +0 -1
  516. package/dist/telemetry.d.cts +0 -2
  517. package/dist/telemetry.d.mts +0 -2
  518. package/dist/telemetry.mjs +0 -55
  519. package/dist/telemetry.mjs.map +0 -1
  520. package/dist/tracing-CxaZ98IB.mjs +0 -110
  521. package/dist/tracing-CxaZ98IB.mjs.map +0 -1
  522. package/dist/tracing-DPMidF_r.cjs +0 -127
  523. package/dist/tracing-DPMidF_r.cjs.map +0 -1
  524. package/dist/types-DMuSQeLL.d.cts.map +0 -1
  525. package/dist/types-DMuSQeLL.d.mts.map +0 -1
  526. package/dist/worker.cjs +0 -191
  527. package/dist/worker.cjs.map +0 -1
  528. package/dist/worker.d.cts +0 -171
  529. package/dist/worker.d.cts.map +0 -1
  530. package/dist/worker.d.mts +0 -171
  531. package/dist/worker.d.mts.map +0 -1
  532. package/dist/worker.mjs +0 -190
  533. package/dist/worker.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"external-api-O107yzZJ.d.cts","names":[],"sources":["../src/external-api.ts"],"mappings":";;;;;;;KAqDK,MAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;;;;;;;;;KAUlB,0CAEO,aAAa,gBAC3B,SAAS,sCACG,KAAK,aAAa;WACrB;;UAGG,mBAAmB,gBAAgB,kBAAkB;;;;;EAKrE,KAAK;;EAEL,aAAa;;EAEb,SAAS;IACR;IACA,aAAa,MAAM;QACd,UAAU,QAAQ;;cAGZ,YACZ,+BACA,gBAAgB,mBAAmB,kBACnC,8BACY,WAAW,OAAO;mBAeZ;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;mBAG9B;;UAGT;EAER,YACC,IAAI,cAAc,QACD,SAAS,mBAAmB,SAAS;;;;;;;MA0BnD,qBAAqB;EAIzB,WAAW;UAaG;;;UA6BE;EAChB,MAAM,SAAS,UAAU,WAAW,QAAQ;;;;;;cAOvC;;KAGD,cAAc,QAClB,aAAa,0BAA0B,oBACpC,iBAAiB,WAAW;;;;;;;KASpB;YACD;WACD;;WAGE;;WAEA,SAAS;;WAGT;;WAEA;;WAEA;;;;;;;;cAUC;;EAEZ,IAAI,gBAAc,SACR,cAAY;IACV,aAAa,cAAc;MACpC;;EAUH,MAAM,gBAAc,eACN;IACF;IAAc,aAAa,cAAc;MAClD;;;iBAYY,OAAO,iBAAiB,SAAS"}
@@ -1,142 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_credential = require("./credential.cjs");
3
- const require_tracing = require("./tracing-DPMidF_r.cjs");
4
- let _geekmidas_manifest = require("@geekmidas/manifest");
5
- //#region src/external-api.ts
6
- /**
7
- * `ExternalApi` — an HTTP API somebody else runs.
8
- *
9
- * Polar, Stripe, a payment gateway: nothing to provision, but an address that
10
- * changes by stage and credentials the provider issued for each one. Without a
11
- * construct every integration writes that switching by hand — an optional
12
- * `POLAR_URL`, a fake started somewhere, a client built in a service — and the
13
- * target cannot see any of it.
14
- *
15
- * ```ts
16
- * // constructs/polar.ts
17
- * export const polar = new ExternalApi('Polar', {
18
- * url: 'https://www.polaraccesslink.com',
19
- * credentials: z.object({ clientId: z.string(), clientSecret: z.string() }),
20
- * client: ({ url, credentials }) => new PolarClient(url, credentials),
21
- * });
22
- *
23
- * // test/fakes/polar.ts
24
- * export default fake.app(new Hono().post('/v3/oauth2/token', …), {
25
- * credentials: { clientId: 'fake', clientSecret: 'fake' },
26
- * });
27
- *
28
- * // in a handler — the real API deployed, the fake locally and in tests
29
- * .dependsOn([polar])
30
- * .handle(({ services }) => services.polar.exchangeCode(code))
31
- * ```
32
- *
33
- * Deployed, the URL is `url` — one for every stage, or one per stage name with
34
- * a `default` — and the credentials are the stage's `<ID>_CREDENTIALS`, one
35
- * JSON value read the way a `Credential`'s is. Locally and in tests both come
36
- * from the fake.
37
- *
38
- * **The construct never names its fake.** It is found by convention, at
39
- * `test/fakes/<id>.ts`, and read only by gkm and the generated test harness —
40
- * so a fake, and the recorded responses it answers from, cannot end up in a
41
- * deployed bundle however the bundler follows imports.
42
- */
43
- var ExternalApi = class {
44
- options;
45
- id;
46
- service;
47
- /** Read by both `declare()` and `connect()`, so the two cannot drift. */
48
- keys;
49
- /** The promise, so concurrent registrations share one client. */
50
- connected;
51
- constructor(id, options) {
52
- this.options = options;
53
- const canonical = (0, _geekmidas_manifest.canonicalId)(id);
54
- this.id = canonical;
55
- this.keys = {
56
- url: (0, _geekmidas_manifest.provideKey)(canonical, "url"),
57
- credentials: (0, _geekmidas_manifest.provideKey)(canonical, "credentials")
58
- };
59
- this.service = {
60
- serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
61
- register: (registerOptions) => {
62
- this.connected ??= this.connect(registerOptions);
63
- return this.connected;
64
- }
65
- };
66
- }
67
- /**
68
- * What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
69
- * is validated against where it is read. Public so a tool setting the value
70
- * (`gkm secrets:add`) can check it, and describe its fields, before it is
71
- * stored rather than at the first request.
72
- */
73
- get credentialsSchema() {
74
- return this.options.credentials;
75
- }
76
- declare() {
77
- return [{
78
- kind: "external-api",
79
- id: this.id,
80
- url: this.options.url,
81
- provides: [this.keys.url, this.keys.credentials]
82
- }];
83
- }
84
- async connect(options) {
85
- const { url } = options.envParser.create((get) => ({ url: get(this.keys.url).string() })).parse();
86
- const credentials = await require_credential.readCredentials(this.id, this.keys.credentials, this.options.credentials, options.envParser);
87
- const client = await this.options.client({
88
- url,
89
- credentials
90
- });
91
- return require_tracing.traceClient(this.id, client, { "server.address": hostOf(url) });
92
- }
93
- };
94
- function hostOf(url) {
95
- try {
96
- return new URL(url).host;
97
- } catch {
98
- return url;
99
- }
100
- }
101
- /**
102
- * Marks a fake. A registered symbol, so a fake built by a second copy of this
103
- * package — a linked workspace, two versions in a lockfile — is still one.
104
- */
105
- const FAKE = Symbol.for("@geekmidas/constructs/fake");
106
- /**
107
- * Build the fake `test/fakes/<id>.ts` default-exports.
108
- *
109
- * Pass the API's type to have the credentials checked against its schema —
110
- * `fake.app<typeof polar>(…)`.
111
- */
112
- const fake = {
113
- /** A working implementation of the API, kept beside the tests that use it. */
114
- app(handler, options) {
115
- return {
116
- [FAKE]: true,
117
- kind: "app",
118
- handler,
119
- credentials: options.credentials
120
- };
121
- },
122
- /** A local server the provider publishes — `stripe/stripe-mock`. */
123
- image(image, options) {
124
- return {
125
- [FAKE]: true,
126
- kind: "image",
127
- image,
128
- port: options.port,
129
- credentials: options.credentials
130
- };
131
- }
132
- };
133
- /** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
134
- function isFake(value) {
135
- return typeof value === "object" && value !== null && value[FAKE] === true;
136
- }
137
- //#endregion
138
- exports.ExternalApi = ExternalApi;
139
- exports.fake = fake;
140
- exports.isFake = isFake;
141
-
142
- //# sourceMappingURL=external-api.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"external-api.cjs","names":["canonicalId","provideKey","serviceKey","readCredentials","traceClient"],"sources":["../src/external-api.ts"],"sourcesContent":["/**\n * `ExternalApi` — an HTTP API somebody else runs.\n *\n * Polar, Stripe, a payment gateway: nothing to provision, but an address that\n * changes by stage and credentials the provider issued for each one. Without a\n * construct every integration writes that switching by hand — an optional\n * `POLAR_URL`, a fake started somewhere, a client built in a service — and the\n * target cannot see any of it.\n *\n * ```ts\n * // constructs/polar.ts\n * export const polar = new ExternalApi('Polar', {\n * url: 'https://www.polaraccesslink.com',\n * credentials: z.object({ clientId: z.string(), clientSecret: z.string() }),\n * client: ({ url, credentials }) => new PolarClient(url, credentials),\n * });\n *\n * // test/fakes/polar.ts\n * export default fake.app(new Hono().post('/v3/oauth2/token', …), {\n * credentials: { clientId: 'fake', clientSecret: 'fake' },\n * });\n *\n * // in a handler — the real API deployed, the fake locally and in tests\n * .dependsOn([polar])\n * .handle(({ services }) => services.polar.exchangeCode(code))\n * ```\n *\n * Deployed, the URL is `url` — one for every stage, or one per stage name with\n * a `default` — and the credentials are the stage's `<ID>_CREDENTIALS`, one\n * JSON value read the way a `Credential`'s is. Locally and in tests both come\n * from the fake.\n *\n * **The construct never names its fake.** It is found by convention, at\n * `test/fakes/<id>.ts`, and read only by gkm and the generated test harness —\n * so a fake, and the recorded responses it answers from, cannot end up in a\n * deployed bundle however the bundler follows imports.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Consumable } from './construct-interface';\nimport { readCredentials } from './credential';\nimport type { DeployedStage, LocalStage } from './stages';\nimport { traceClient } from './tracing';\n\n/** What a credentials schema yields. */\ntype Value<TSchema extends StandardSchemaV1> =\n\tStandardSchemaV1.InferOutput<TSchema>;\n\n/**\n * Where an external API answers: one URL for every stage, or one per stage\n * name with `default` for any stage not listed.\n *\n * Keyed by the stages `gkm.config.ts` declares once `.gkm/stages.d.ts` exists,\n * so a key that names no stage — `prodution` — is a type error rather than a\n * URL nothing reads. Without the file any key goes, as before.\n */\nexport type ExternalApiUrl =\n\t| string\n\t| (string extends LocalStage | DeployedStage\n\t\t\t? Readonly<Record<string, string>>\n\t\t\t: { readonly [S in LocalStage | DeployedStage]?: string } & {\n\t\t\t\t\treadonly default?: string;\n\t\t\t\t});\n\nexport interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {\n\t/**\n\t * Where it answers deployed: one URL for every stage, or one per stage\n\t * name, with `default` for any stage not listed.\n\t */\n\turl: ExternalApiUrl;\n\t/** What the stage's `<ID>_CREDENTIALS` must look like. */\n\tcredentials: TSchema;\n\t/** What a handler is handed, built from where it answers and the credentials. */\n\tclient: (connection: {\n\t\turl: string;\n\t\tcredentials: Value<TSchema>;\n\t}) => TClient | Promise<TClient>;\n}\n\nexport class ExternalApi<\n\tTName extends string = string,\n\tTSchema extends StandardSchemaV1 = StandardSchemaV1,\n\tTClient = unknown,\n> implements Consumable<TName, TClient>\n{\n\t// `Consumable` for the reason `Credential` gives: a client generic in\n\t// `TClient` cannot satisfy `Construct`'s conditional service type.\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, TClient>;\n\n\t/** Read by both `declare()` and `connect()`, so the two cannot drift. */\n\tprivate readonly keys: { url: string; credentials: string };\n\n\t/** The promise, so concurrent registrations share one client. */\n\tprivate connected?: Promise<TClient>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: ExternalApiOptions<TSchema, TClient>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\tcredentials: provideKey(canonical, 'credentials'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (registerOptions) => {\n\t\t\t\tthis.connected ??= this.connect(registerOptions);\n\t\t\t\treturn this.connected;\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * What the stage's `<ID>_CREDENTIALS` must look like — the schema the value\n\t * is validated against where it is read. Public so a tool setting the value\n\t * (`gkm secrets:add`) can check it, and describe its fields, before it is\n\t * stored rather than at the first request.\n\t */\n\tget credentialsSchema(): TSchema {\n\t\treturn this.options.credentials;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'external-api',\n\t\t\t\tid: this.id,\n\t\t\t\t// The stage-keyed map is a record of URLs to the manifest, which\n\t\t\t\t// reads it by whatever stage it is resolving.\n\t\t\t\turl: this.options.url as Readonly<Record<string, string>> | string,\n\t\t\t\tprovides: [this.keys.url, this.keys.credentials],\n\t\t\t},\n\t\t];\n\t}\n\n\tprivate async connect(options: ServiceRegisterOptions): Promise<TClient> {\n\t\tconst { url } = options.envParser\n\t\t\t.create((get) => ({ url: get(this.keys.url).string() }))\n\t\t\t.parse();\n\t\tconst credentials = await readCredentials(\n\t\t\tthis.id,\n\t\t\tthis.keys.credentials,\n\t\t\tthis.options.credentials,\n\t\t\toptions.envParser,\n\t\t);\n\n\t\tconst client = await this.options.client({ url, credentials });\n\t\t// Each call a span carrying this API's name — the parent of the fetch\n\t\t// it makes, which is traced already.\n\t\treturn traceClient(this.id, client, {\n\t\t\t'server.address': hostOf(url),\n\t\t});\n\t}\n}\n\nfunction hostOf(url: string): string {\n\ttry {\n\t\treturn new URL(url).host;\n\t} catch {\n\t\treturn url;\n\t}\n}\n\n/** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */\nexport interface FetchHandler {\n\tfetch(request: Request): Response | Promise<Response>;\n}\n\n/**\n * Marks a fake. A registered symbol, so a fake built by a second copy of this\n * package — a linked workspace, two versions in a lockfile — is still one.\n */\nconst FAKE = Symbol.for('@geekmidas/constructs/fake');\n\n/** What an external API's credentials look like going in, for a fake to supply. */\ntype CredentialsOf<TApi> =\n\tTApi extends ExternalApi<string, infer TSchema, unknown>\n\t\t? StandardSchemaV1.InferInput<TSchema>\n\t\t: unknown;\n\n/**\n * An external API's stand-in, as `test/fakes/<id>.ts` default-exports it.\n *\n * `credentials` are what the fake accepts, and what a local or test stage is\n * handed as `<ID>_CREDENTIALS` in place of the stage's own.\n */\nexport type Fake = {\n\treadonly [FAKE]: true;\n\treadonly credentials: unknown;\n} & (\n\t| {\n\t\t\treadonly kind: 'app';\n\t\t\t/** Served by gkm: in-process in a test, on its own port in `gkm dev`. */\n\t\t\treadonly handler: FetchHandler;\n\t }\n\t| {\n\t\t\treadonly kind: 'image';\n\t\t\t/** The provider's own local server, run as a container. */\n\t\t\treadonly image: string;\n\t\t\t/** The port it listens on inside the container. */\n\t\t\treadonly port: number;\n\t }\n);\n\n/**\n * Build the fake `test/fakes/<id>.ts` default-exports.\n *\n * Pass the API's type to have the credentials checked against its schema —\n * `fake.app<typeof polar>(…)`.\n */\nexport const fake = {\n\t/** A working implementation of the API, kept beside the tests that use it. */\n\tapp<TApi = unknown>(\n\t\thandler: FetchHandler,\n\t\toptions: { credentials: CredentialsOf<TApi> },\n\t): Fake {\n\t\treturn {\n\t\t\t[FAKE]: true,\n\t\t\tkind: 'app',\n\t\t\thandler,\n\t\t\tcredentials: options.credentials,\n\t\t};\n\t},\n\n\t/** A local server the provider publishes — `stripe/stripe-mock`. */\n\timage<TApi = unknown>(\n\t\timage: string,\n\t\toptions: { port: number; credentials: CredentialsOf<TApi> },\n\t): Fake {\n\t\treturn {\n\t\t\t[FAKE]: true,\n\t\t\tkind: 'image',\n\t\t\timage,\n\t\t\tport: options.port,\n\t\t\tcredentials: options.credentials,\n\t\t};\n\t},\n};\n\n/** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */\nexport function isFake(value: unknown): value is Fake {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t(value as { [FAKE]?: unknown })[FAKE] === true\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,IAAa,cAAb,MAKA;CAcmB;CAXlB;CACA;;CAGA;;CAGA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,MAAA,GAAKC,oBAAAA,WAAAA,CAAW,WAAW,KAAK;GAChC,cAAA,GAAaA,oBAAAA,WAAAA,CAAW,WAAW,aAAa;EACjD;EAGA,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,oBAAoB;IAC9B,KAAK,cAAc,KAAK,QAAQ,eAAe;IAC/C,OAAO,KAAK;GACb;EACD;CACD;;;;;;;CAQA,IAAI,oBAA6B;EAChC,OAAO,KAAK,QAAQ;CACrB;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GAGT,KAAK,KAAK,QAAQ;GAClB,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,WAAW;EAChD,CACD;CACD;CAEA,MAAc,QAAQ,SAAmD;EACxE,MAAM,EAAE,QAAQ,QAAQ,UACtB,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvD,MAAM;EACR,MAAM,cAAc,MAAMC,mBAAAA,gBACzB,KAAK,IACL,KAAK,KAAK,aACV,KAAK,QAAQ,aACb,QAAQ,SACT;EAEA,MAAM,SAAS,MAAM,KAAK,QAAQ,OAAO;GAAE;GAAK;EAAY,CAAC;EAG7D,OAAOC,gBAAAA,YAAY,KAAK,IAAI,QAAQ,EACnC,kBAAkB,OAAO,GAAG,EAC7B,CAAC;CACF;AACD;AAEA,SAAS,OAAO,KAAqB;CACpC,IAAI;EACH,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC;CACrB,QAAQ;EACP,OAAO;CACR;AACD;;;;;AAWA,MAAM,OAAO,OAAO,IAAI,4BAA4B;;;;;;;AAsCpD,MAAa,OAAO;;CAEnB,IACC,SACA,SACO;EACP,OAAO;IACL,OAAO;GACR,MAAM;GACN;GACA,aAAa,QAAQ;EACtB;CACD;;CAGA,MACC,OACA,SACO;EACP,OAAO;IACL,OAAO;GACR,MAAM;GACN;GACA,MAAM,QAAQ;GACd,aAAa,QAAQ;EACtB;CACD;AACD;;AAGA,SAAgB,OAAO,OAA+B;CACrD,OACC,OAAO,UAAU,YACjB,UAAU,QACT,MAA+B,UAAU;AAE5C"}
@@ -1,2 +0,0 @@
1
- import { a as FetchHandler, i as Fake, n as ExternalApiOptions, o as fake, r as ExternalApiUrl, s as isFake, t as ExternalApi } from "./external-api-O107yzZJ.cjs";
2
- export { ExternalApi, ExternalApiOptions, ExternalApiUrl, Fake, FetchHandler, fake, isFake };
@@ -1,2 +0,0 @@
1
- import { a as FetchHandler, i as Fake, n as ExternalApiOptions, o as fake, r as ExternalApiUrl, s as isFake, t as ExternalApi } from "./external-api-MJ8id87V.mjs";
2
- export { ExternalApi, ExternalApiOptions, ExternalApiUrl, Fake, FetchHandler, fake, isFake };
@@ -1,139 +0,0 @@
1
- import { readCredentials } from "./credential.mjs";
2
- import { r as traceClient } from "./tracing-CxaZ98IB.mjs";
3
- import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
4
- //#region src/external-api.ts
5
- /**
6
- * `ExternalApi` — an HTTP API somebody else runs.
7
- *
8
- * Polar, Stripe, a payment gateway: nothing to provision, but an address that
9
- * changes by stage and credentials the provider issued for each one. Without a
10
- * construct every integration writes that switching by hand — an optional
11
- * `POLAR_URL`, a fake started somewhere, a client built in a service — and the
12
- * target cannot see any of it.
13
- *
14
- * ```ts
15
- * // constructs/polar.ts
16
- * export const polar = new ExternalApi('Polar', {
17
- * url: 'https://www.polaraccesslink.com',
18
- * credentials: z.object({ clientId: z.string(), clientSecret: z.string() }),
19
- * client: ({ url, credentials }) => new PolarClient(url, credentials),
20
- * });
21
- *
22
- * // test/fakes/polar.ts
23
- * export default fake.app(new Hono().post('/v3/oauth2/token', …), {
24
- * credentials: { clientId: 'fake', clientSecret: 'fake' },
25
- * });
26
- *
27
- * // in a handler — the real API deployed, the fake locally and in tests
28
- * .dependsOn([polar])
29
- * .handle(({ services }) => services.polar.exchangeCode(code))
30
- * ```
31
- *
32
- * Deployed, the URL is `url` — one for every stage, or one per stage name with
33
- * a `default` — and the credentials are the stage's `<ID>_CREDENTIALS`, one
34
- * JSON value read the way a `Credential`'s is. Locally and in tests both come
35
- * from the fake.
36
- *
37
- * **The construct never names its fake.** It is found by convention, at
38
- * `test/fakes/<id>.ts`, and read only by gkm and the generated test harness —
39
- * so a fake, and the recorded responses it answers from, cannot end up in a
40
- * deployed bundle however the bundler follows imports.
41
- */
42
- var ExternalApi = class {
43
- options;
44
- id;
45
- service;
46
- /** Read by both `declare()` and `connect()`, so the two cannot drift. */
47
- keys;
48
- /** The promise, so concurrent registrations share one client. */
49
- connected;
50
- constructor(id, options) {
51
- this.options = options;
52
- const canonical = canonicalId(id);
53
- this.id = canonical;
54
- this.keys = {
55
- url: provideKey(canonical, "url"),
56
- credentials: provideKey(canonical, "credentials")
57
- };
58
- this.service = {
59
- serviceName: serviceKey(canonical),
60
- register: (registerOptions) => {
61
- this.connected ??= this.connect(registerOptions);
62
- return this.connected;
63
- }
64
- };
65
- }
66
- /**
67
- * What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
68
- * is validated against where it is read. Public so a tool setting the value
69
- * (`gkm secrets:add`) can check it, and describe its fields, before it is
70
- * stored rather than at the first request.
71
- */
72
- get credentialsSchema() {
73
- return this.options.credentials;
74
- }
75
- declare() {
76
- return [{
77
- kind: "external-api",
78
- id: this.id,
79
- url: this.options.url,
80
- provides: [this.keys.url, this.keys.credentials]
81
- }];
82
- }
83
- async connect(options) {
84
- const { url } = options.envParser.create((get) => ({ url: get(this.keys.url).string() })).parse();
85
- const credentials = await readCredentials(this.id, this.keys.credentials, this.options.credentials, options.envParser);
86
- const client = await this.options.client({
87
- url,
88
- credentials
89
- });
90
- return traceClient(this.id, client, { "server.address": hostOf(url) });
91
- }
92
- };
93
- function hostOf(url) {
94
- try {
95
- return new URL(url).host;
96
- } catch {
97
- return url;
98
- }
99
- }
100
- /**
101
- * Marks a fake. A registered symbol, so a fake built by a second copy of this
102
- * package — a linked workspace, two versions in a lockfile — is still one.
103
- */
104
- const FAKE = Symbol.for("@geekmidas/constructs/fake");
105
- /**
106
- * Build the fake `test/fakes/<id>.ts` default-exports.
107
- *
108
- * Pass the API's type to have the credentials checked against its schema —
109
- * `fake.app<typeof polar>(…)`.
110
- */
111
- const fake = {
112
- /** A working implementation of the API, kept beside the tests that use it. */
113
- app(handler, options) {
114
- return {
115
- [FAKE]: true,
116
- kind: "app",
117
- handler,
118
- credentials: options.credentials
119
- };
120
- },
121
- /** A local server the provider publishes — `stripe/stripe-mock`. */
122
- image(image, options) {
123
- return {
124
- [FAKE]: true,
125
- kind: "image",
126
- image,
127
- port: options.port,
128
- credentials: options.credentials
129
- };
130
- }
131
- };
132
- /** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
133
- function isFake(value) {
134
- return typeof value === "object" && value !== null && value[FAKE] === true;
135
- }
136
- //#endregion
137
- export { ExternalApi, fake, isFake };
138
-
139
- //# sourceMappingURL=external-api.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"external-api.mjs","names":[],"sources":["../src/external-api.ts"],"sourcesContent":["/**\n * `ExternalApi` — an HTTP API somebody else runs.\n *\n * Polar, Stripe, a payment gateway: nothing to provision, but an address that\n * changes by stage and credentials the provider issued for each one. Without a\n * construct every integration writes that switching by hand — an optional\n * `POLAR_URL`, a fake started somewhere, a client built in a service — and the\n * target cannot see any of it.\n *\n * ```ts\n * // constructs/polar.ts\n * export const polar = new ExternalApi('Polar', {\n * url: 'https://www.polaraccesslink.com',\n * credentials: z.object({ clientId: z.string(), clientSecret: z.string() }),\n * client: ({ url, credentials }) => new PolarClient(url, credentials),\n * });\n *\n * // test/fakes/polar.ts\n * export default fake.app(new Hono().post('/v3/oauth2/token', …), {\n * credentials: { clientId: 'fake', clientSecret: 'fake' },\n * });\n *\n * // in a handler — the real API deployed, the fake locally and in tests\n * .dependsOn([polar])\n * .handle(({ services }) => services.polar.exchangeCode(code))\n * ```\n *\n * Deployed, the URL is `url` — one for every stage, or one per stage name with\n * a `default` — and the credentials are the stage's `<ID>_CREDENTIALS`, one\n * JSON value read the way a `Credential`'s is. Locally and in tests both come\n * from the fake.\n *\n * **The construct never names its fake.** It is found by convention, at\n * `test/fakes/<id>.ts`, and read only by gkm and the generated test harness —\n * so a fake, and the recorded responses it answers from, cannot end up in a\n * deployed bundle however the bundler follows imports.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Consumable } from './construct-interface';\nimport { readCredentials } from './credential';\nimport type { DeployedStage, LocalStage } from './stages';\nimport { traceClient } from './tracing';\n\n/** What a credentials schema yields. */\ntype Value<TSchema extends StandardSchemaV1> =\n\tStandardSchemaV1.InferOutput<TSchema>;\n\n/**\n * Where an external API answers: one URL for every stage, or one per stage\n * name with `default` for any stage not listed.\n *\n * Keyed by the stages `gkm.config.ts` declares once `.gkm/stages.d.ts` exists,\n * so a key that names no stage — `prodution` — is a type error rather than a\n * URL nothing reads. Without the file any key goes, as before.\n */\nexport type ExternalApiUrl =\n\t| string\n\t| (string extends LocalStage | DeployedStage\n\t\t\t? Readonly<Record<string, string>>\n\t\t\t: { readonly [S in LocalStage | DeployedStage]?: string } & {\n\t\t\t\t\treadonly default?: string;\n\t\t\t\t});\n\nexport interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {\n\t/**\n\t * Where it answers deployed: one URL for every stage, or one per stage\n\t * name, with `default` for any stage not listed.\n\t */\n\turl: ExternalApiUrl;\n\t/** What the stage's `<ID>_CREDENTIALS` must look like. */\n\tcredentials: TSchema;\n\t/** What a handler is handed, built from where it answers and the credentials. */\n\tclient: (connection: {\n\t\turl: string;\n\t\tcredentials: Value<TSchema>;\n\t}) => TClient | Promise<TClient>;\n}\n\nexport class ExternalApi<\n\tTName extends string = string,\n\tTSchema extends StandardSchemaV1 = StandardSchemaV1,\n\tTClient = unknown,\n> implements Consumable<TName, TClient>\n{\n\t// `Consumable` for the reason `Credential` gives: a client generic in\n\t// `TClient` cannot satisfy `Construct`'s conditional service type.\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, TClient>;\n\n\t/** Read by both `declare()` and `connect()`, so the two cannot drift. */\n\tprivate readonly keys: { url: string; credentials: string };\n\n\t/** The promise, so concurrent registrations share one client. */\n\tprivate connected?: Promise<TClient>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: ExternalApiOptions<TSchema, TClient>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\tcredentials: provideKey(canonical, 'credentials'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (registerOptions) => {\n\t\t\t\tthis.connected ??= this.connect(registerOptions);\n\t\t\t\treturn this.connected;\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * What the stage's `<ID>_CREDENTIALS` must look like — the schema the value\n\t * is validated against where it is read. Public so a tool setting the value\n\t * (`gkm secrets:add`) can check it, and describe its fields, before it is\n\t * stored rather than at the first request.\n\t */\n\tget credentialsSchema(): TSchema {\n\t\treturn this.options.credentials;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'external-api',\n\t\t\t\tid: this.id,\n\t\t\t\t// The stage-keyed map is a record of URLs to the manifest, which\n\t\t\t\t// reads it by whatever stage it is resolving.\n\t\t\t\turl: this.options.url as Readonly<Record<string, string>> | string,\n\t\t\t\tprovides: [this.keys.url, this.keys.credentials],\n\t\t\t},\n\t\t];\n\t}\n\n\tprivate async connect(options: ServiceRegisterOptions): Promise<TClient> {\n\t\tconst { url } = options.envParser\n\t\t\t.create((get) => ({ url: get(this.keys.url).string() }))\n\t\t\t.parse();\n\t\tconst credentials = await readCredentials(\n\t\t\tthis.id,\n\t\t\tthis.keys.credentials,\n\t\t\tthis.options.credentials,\n\t\t\toptions.envParser,\n\t\t);\n\n\t\tconst client = await this.options.client({ url, credentials });\n\t\t// Each call a span carrying this API's name — the parent of the fetch\n\t\t// it makes, which is traced already.\n\t\treturn traceClient(this.id, client, {\n\t\t\t'server.address': hostOf(url),\n\t\t});\n\t}\n}\n\nfunction hostOf(url: string): string {\n\ttry {\n\t\treturn new URL(url).host;\n\t} catch {\n\t\treturn url;\n\t}\n}\n\n/** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */\nexport interface FetchHandler {\n\tfetch(request: Request): Response | Promise<Response>;\n}\n\n/**\n * Marks a fake. A registered symbol, so a fake built by a second copy of this\n * package — a linked workspace, two versions in a lockfile — is still one.\n */\nconst FAKE = Symbol.for('@geekmidas/constructs/fake');\n\n/** What an external API's credentials look like going in, for a fake to supply. */\ntype CredentialsOf<TApi> =\n\tTApi extends ExternalApi<string, infer TSchema, unknown>\n\t\t? StandardSchemaV1.InferInput<TSchema>\n\t\t: unknown;\n\n/**\n * An external API's stand-in, as `test/fakes/<id>.ts` default-exports it.\n *\n * `credentials` are what the fake accepts, and what a local or test stage is\n * handed as `<ID>_CREDENTIALS` in place of the stage's own.\n */\nexport type Fake = {\n\treadonly [FAKE]: true;\n\treadonly credentials: unknown;\n} & (\n\t| {\n\t\t\treadonly kind: 'app';\n\t\t\t/** Served by gkm: in-process in a test, on its own port in `gkm dev`. */\n\t\t\treadonly handler: FetchHandler;\n\t }\n\t| {\n\t\t\treadonly kind: 'image';\n\t\t\t/** The provider's own local server, run as a container. */\n\t\t\treadonly image: string;\n\t\t\t/** The port it listens on inside the container. */\n\t\t\treadonly port: number;\n\t }\n);\n\n/**\n * Build the fake `test/fakes/<id>.ts` default-exports.\n *\n * Pass the API's type to have the credentials checked against its schema —\n * `fake.app<typeof polar>(…)`.\n */\nexport const fake = {\n\t/** A working implementation of the API, kept beside the tests that use it. */\n\tapp<TApi = unknown>(\n\t\thandler: FetchHandler,\n\t\toptions: { credentials: CredentialsOf<TApi> },\n\t): Fake {\n\t\treturn {\n\t\t\t[FAKE]: true,\n\t\t\tkind: 'app',\n\t\t\thandler,\n\t\t\tcredentials: options.credentials,\n\t\t};\n\t},\n\n\t/** A local server the provider publishes — `stripe/stripe-mock`. */\n\timage<TApi = unknown>(\n\t\timage: string,\n\t\toptions: { port: number; credentials: CredentialsOf<TApi> },\n\t): Fake {\n\t\treturn {\n\t\t\t[FAKE]: true,\n\t\t\tkind: 'image',\n\t\t\timage,\n\t\t\tport: options.port,\n\t\t\tcredentials: options.credentials,\n\t\t};\n\t},\n};\n\n/** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */\nexport function isFake(value: unknown): value is Fake {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t(value as { [FAKE]?: unknown })[FAKE] === true\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,IAAa,cAAb,MAKA;CAcmB;CAXlB;CACA;;CAGA;;CAGA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,KAAK,WAAW,WAAW,KAAK;GAChC,aAAa,WAAW,WAAW,aAAa;EACjD;EAGA,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,oBAAoB;IAC9B,KAAK,cAAc,KAAK,QAAQ,eAAe;IAC/C,OAAO,KAAK;GACb;EACD;CACD;;;;;;;CAQA,IAAI,oBAA6B;EAChC,OAAO,KAAK,QAAQ;CACrB;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GAGT,KAAK,KAAK,QAAQ;GAClB,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,WAAW;EAChD,CACD;CACD;CAEA,MAAc,QAAQ,SAAmD;EACxE,MAAM,EAAE,QAAQ,QAAQ,UACtB,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvD,MAAM;EACR,MAAM,cAAc,MAAM,gBACzB,KAAK,IACL,KAAK,KAAK,aACV,KAAK,QAAQ,aACb,QAAQ,SACT;EAEA,MAAM,SAAS,MAAM,KAAK,QAAQ,OAAO;GAAE;GAAK;EAAY,CAAC;EAG7D,OAAO,YAAY,KAAK,IAAI,QAAQ,EACnC,kBAAkB,OAAO,GAAG,EAC7B,CAAC;CACF;AACD;AAEA,SAAS,OAAO,KAAqB;CACpC,IAAI;EACH,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC;CACrB,QAAQ;EACP,OAAO;CACR;AACD;;;;;AAWA,MAAM,OAAO,OAAO,IAAI,4BAA4B;;;;;;;AAsCpD,MAAa,OAAO;;CAEnB,IACC,SACA,SACO;EACP,OAAO;IACL,OAAO;GACR,MAAM;GACN;GACA,aAAa,QAAQ;EACtB;CACD;;CAGA,MACC,OACA,SACO;EACP,OAAO;IACL,OAAO;GACR,MAAM;GACN;GACA,MAAM,QAAQ;GACd,aAAa,QAAQ;EACtB;CACD;AACD;;AAGA,SAAgB,OAAO,OAA+B;CACrD,OACC,OAAO,UAAU,YACjB,UAAU,QACT,MAA+B,UAAU;AAE5C"}
@@ -1,186 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- let _geekmidas_manifest = require("@geekmidas/manifest");
3
- let _geekmidas_storage = require("@geekmidas/storage");
4
- //#region src/file-server.ts
5
- /**
6
- * `FileServer` — a domain that serves a bucket's objects.
7
- *
8
- * `ObjectStorage` is the bucket: it writes, it presigns, and its URL is never
9
- * public. Serving those objects on a domain is a different thing, and it is a
10
- * construct of its own rather than a flag on the bucket — see
11
- * `docs/design/constructs-paradigm.md`, "Why a separate construct, and what it
12
- * costs", for the comparison that rules the other two shapes out.
13
- *
14
- * ```ts
15
- * export const uploads = new FileServer('Uploads', { open: ['brand/**'] });
16
- *
17
- * uploads.getUploadURL({ path, contentType }) // an S3 presign at the bucket
18
- * uploads.url('brand/logo.png') // open path — no signature
19
- * uploads.signedUrl('invoices/7.pdf') // one object, one recipient
20
- * ```
21
- *
22
- * **One construct, one client, both halves.** How a file lands in the bucket is
23
- * the same whether or not it is served, so splitting the upload half from the
24
- * serving half would be ceremony rather than safety. The client is a *superset*
25
- * of `StorageClient`, made literal in the type, so anything taking
26
- * `services.uploads` keeps compiling when the construct behind it grows a
27
- * serving half.
28
- *
29
- * **The id names the bucket, not the surface.** This is the detail that has to
30
- * be right before anything ships, because getting it backwards is destructive:
31
- * the migration people actually perform is serving a bucket they already have,
32
- * and naming the bucket after the construct makes that edit *add* a node rather
33
- * than rename the one holding the data.
34
- */
35
- /** A key was asked to be served unsigned, and no open pattern admits it. */
36
- var NotOpen = class extends Error {
37
- key;
38
- open;
39
- constructor(key, open) {
40
- super(`'${key}' is not served without a signature. ` + (open.length ? `Open paths: ${open.join(", ")}. Use signedUrl() for anything else.` : "This file server declares no open paths, so every object needs signedUrl()."));
41
- this.key = key;
42
- this.open = open;
43
- this.name = "NotOpen";
44
- }
45
- };
46
- var FileServer = class {
47
- options;
48
- id;
49
- service;
50
- /** The id of the surface node, as opposed to the bucket's. */
51
- surfaceId;
52
- open;
53
- /**
54
- * Declared once and read by both `declare()` and `connect()`, so the keys the
55
- * target publishes and the keys the client reads cannot drift.
56
- */
57
- keys;
58
- constructor(id, options = {}) {
59
- this.options = options;
60
- const canonical = (0, _geekmidas_manifest.canonicalId)(id);
61
- this.id = canonical;
62
- this.open = options.open ?? [];
63
- const originId = options.origin?.id ?? canonical;
64
- this.surfaceId = `${canonical}Server`;
65
- this.keys = {
66
- origin: (0, _geekmidas_manifest.provideKey)(originId, "url"),
67
- server: (0, _geekmidas_manifest.provideKey)(this.surfaceId, "url")
68
- };
69
- this.service = {
70
- serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
71
- register: (registerOptions) => this.connect(registerOptions)
72
- };
73
- }
74
- /**
75
- * The served surface, as something an edge can point at.
76
- *
77
- * Depending on the `FileServer` itself points at the **bucket** — its
78
- * canonical node — which is right for a handler: it presigns and writes. But
79
- * a bucket's URL is never public, so a site depending on it gets nothing
80
- * inlined, which is correct and also useless.
81
- *
82
- * This is the other half: `.dependsOn([uploads.server])` points at the
83
- * surface, whose address *is* public, and is what puts
84
- * `VITE_UPLOADS_SERVER_URL` in a bundle. The same accessor shape
85
- * `database.reader()` uses, and for the same reason — one construct owning
86
- * two addresses needs a way to name the second.
87
- */
88
- get server() {
89
- const surface = this.declare().find((declaration) => declaration.id === this.surfaceId);
90
- return {
91
- id: this.surfaceId,
92
- declare: () => surface ? [surface] : []
93
- };
94
- }
95
- /**
96
- * The bucket and the surface over it — or just the surface, when the bucket
97
- * was declared elsewhere.
98
- *
99
- * The surface names its origin through `of`, which is what makes the
100
- * reference check work: an origin resolving to nothing is a build failure,
101
- * the same guarantee `assertDerivations` already gives a reader and a schema
102
- * tenant.
103
- */
104
- declare() {
105
- const origin = this.options.origin;
106
- const surface = {
107
- kind: "file-server",
108
- id: this.surfaceId,
109
- of: origin?.id ?? this.id,
110
- ...this.open.length ? { open: this.open } : {},
111
- provides: [this.keys.server]
112
- };
113
- if (origin) return [surface];
114
- return [{
115
- kind: "objects",
116
- id: this.id,
117
- provides: [this.keys.origin],
118
- ...this.options.versioned ? { versioned: true } : {}
119
- }, surface];
120
- }
121
- /**
122
- * The bucket's client, with the serving half added.
123
- *
124
- * Both addresses are read here, which is also how the environment reaches a
125
- * handler: the sniffer records what this reads, so `.dependsOn([uploads])`
126
- * carries the bucket URL and the server URL without either being written
127
- * down beside the handler.
128
- */
129
- async connect(options) {
130
- const { origin, server } = options.envParser.create((get) => ({
131
- origin: get(this.keys.origin).string(),
132
- server: get(this.keys.server).string()
133
- })).parse();
134
- const storage = (0, _geekmidas_storage.createStorageClient)(origin);
135
- const base = server.replace(/\/+$/, "");
136
- const serve = (key) => {
137
- if (!this.serves(key)) throw new NotOpen(key, this.open);
138
- return `${base}/${key.replace(/^\/+/, "")}`;
139
- };
140
- return Object.assign(Object.create(storage), {
141
- url: serve,
142
- openUrl: serve,
143
- signedUrl: (key, expiresIn) => storage.getDownloadURL({ path: key }, expiresIn)
144
- });
145
- }
146
- /**
147
- * Whether an open pattern admits a key.
148
- *
149
- * The runtime half of {@link Served}, and stricter than it: here a single
150
- * star stops at a segment boundary and a double star does not, which is the
151
- * distinction a template-literal type cannot draw and the infrastructure
152
- * does.
153
- */
154
- serves(key) {
155
- return this.open.some((pattern) => globToRegExp(pattern).test(key));
156
- }
157
- };
158
- /**
159
- * One open pattern as an anchored expression.
160
- *
161
- * A double star crosses `/`; a single star does not. Both are consumed in one
162
- * left-to-right pass rather than by substitution, so a pattern cannot be
163
- * rewritten into a placeholder that a later pass mistakes for literal text.
164
- */
165
- function globToRegExp(pattern) {
166
- let source = "";
167
- for (let index = 0; index < pattern.length; index++) {
168
- const character = pattern[index];
169
- if (character !== "*") {
170
- source += character?.replace(/[.+^${}()|[\]\\?]/, "\\$&") ?? "";
171
- continue;
172
- }
173
- if (pattern[index + 1] === "*") {
174
- source += ".*";
175
- index++;
176
- continue;
177
- }
178
- source += "[^/]*";
179
- }
180
- return new RegExp(`^${source}$`);
181
- }
182
- //#endregion
183
- exports.FileServer = FileServer;
184
- exports.NotOpen = NotOpen;
185
-
186
- //# sourceMappingURL=file-server.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-server.cjs","names":["canonicalId","provideKey","serviceKey","createStorageClient"],"sources":["../src/file-server.ts"],"sourcesContent":["/**\n * `FileServer` — a domain that serves a bucket's objects.\n *\n * `ObjectStorage` is the bucket: it writes, it presigns, and its URL is never\n * public. Serving those objects on a domain is a different thing, and it is a\n * construct of its own rather than a flag on the bucket — see\n * `docs/design/constructs-paradigm.md`, \"Why a separate construct, and what it\n * costs\", for the comparison that rules the other two shapes out.\n *\n * ```ts\n * export const uploads = new FileServer('Uploads', { open: ['brand/**'] });\n *\n * uploads.getUploadURL({ path, contentType }) // an S3 presign at the bucket\n * uploads.url('brand/logo.png') // open path — no signature\n * uploads.signedUrl('invoices/7.pdf') // one object, one recipient\n * ```\n *\n * **One construct, one client, both halves.** How a file lands in the bucket is\n * the same whether or not it is served, so splitting the upload half from the\n * serving half would be ceremony rather than safety. The client is a *superset*\n * of `StorageClient`, made literal in the type, so anything taking\n * `services.uploads` keeps compiling when the construct behind it grows a\n * serving half.\n *\n * **The id names the bucket, not the surface.** This is the detail that has to\n * be right before anything ships, because getting it backwards is destructive:\n * the migration people actually perform is serving a bucket they already have,\n * and naming the bucket after the construct makes that edit *add* a node rather\n * than rename the one holding the data.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { createStorageClient, type StorageClient } from '@geekmidas/storage';\nimport type { Construct, Declarable } from './construct-interface';\n\n/**\n * A key an open pattern admits.\n *\n * The same template-literal trick `ConstructName` uses, so `open` is checked at\n * the call site rather than only at the edge:\n *\n * ```ts\n * files.url('brand/logo.png') // ok\n * files.url(`avatars/${id}.png`) // ok — a template literal still matches\n * files.url('invoices/7.pdf') // not assignable — never served unsigned\n * ```\n *\n * A single star and a double star resolve to the same type, stated rather than\n * discovered: a template literal cannot exclude `/`, so this is a prefix-and-\n * suffix guard while the *exact* pattern is enforced by the bucket policy, by\n * the cache behaviour, and by this construct's own runtime check. The type says\n * plausibly open; the infrastructure says definitely.\n */\nexport type Served<P extends string> = P extends `${infer Head}**`\n\t? `${Head}${string}`\n\t: P extends `${infer Head}*${infer Tail}`\n\t\t? `${Head}${string}${Tail}`\n\t\t: P;\n\n/** What consuming a file server hands you: a bucket client that also serves. */\nexport interface FileServerClient<TOpen extends string = never>\n\textends StorageClient {\n\t/**\n\t * The unsigned address of an open object.\n\t *\n\t * Compile-checked against the declared patterns, *and* checked again at\n\t * runtime — a JavaScript caller gets no compiler, and minting an unsigned\n\t * URL for a private object is a leak rather than a mistake.\n\t *\n\t * @throws {NotOpen} when the key matches no declared pattern.\n\t */\n\turl(key: Served<TOpen>): string;\n\n\t/**\n\t * The same thing for a key the compiler cannot see.\n\t *\n\t * A fully dynamic key does not type, which is correct and is also the case\n\t * people will hit — so the escape hatch is a named method rather than a\n\t * cast, and it runs the *same* runtime check rather than being a way around\n\t * it.\n\t *\n\t * @throws {NotOpen} when the key matches no declared pattern.\n\t */\n\topenUrl(key: string): string;\n\n\t/**\n\t * A signed address for one object and one recipient.\n\t *\n\t * Today this is an **S3 presign at the bucket**, which is what works\n\t * unchanged against MinIO locally and against S3 deployed. It is deliberately\n\t * not described as a CDN URL: CloudFront signing is a different mechanism,\n\t * with different keys, against a different host, and it needs key material\n\t * this construct does not yet declare.\n\t *\n\t * @param expiresIn - minutes, matching `getUploadURL`.\n\t */\n\tsignedUrl(key: string, expiresIn?: number): Promise<string>;\n}\n\nexport interface FileServerOptions<TOpen extends string = never> {\n\t/**\n\t * Paths served without a signature. Everything else needs one.\n\t *\n\t * Private by default: a bucket where forgetting a flag publishes user\n\t * uploads is the wrong default, so this is an exception list, and listing it\n\t * in code means exactly one set of paths is unauthenticated and it is\n\t * reviewable in a diff.\n\t *\n\t * Uploading is deliberately *not* restricted to these. Writing to a path\n\t * that happens to be open is ordinary; the only asymmetry worth enforcing is\n\t * that you cannot hand out an unsigned URL for something the server would\n\t * refuse to serve unsigned.\n\t */\n\topen?: readonly TOpen[];\n\t/** Keep previous versions of an object. */\n\tversioned?: boolean;\n\t/**\n\t * A bucket declared elsewhere, instead of one of this server's own.\n\t *\n\t * `new FileServer('Uploads')` declares both nodes; this fronts a bucket that\n\t * already exists, which is also how the two edges come back when you want\n\t * them separately — a handler depending on the bucket writes, a handler\n\t * depending on the server mints URLs.\n\t */\n\torigin?: Declarable;\n}\n\n/** A key was asked to be served unsigned, and no open pattern admits it. */\nexport class NotOpen extends Error {\n\tconstructor(\n\t\treadonly key: string,\n\t\treadonly open: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`'${key}' is not served without a signature. ` +\n\t\t\t\t(open.length\n\t\t\t\t\t? `Open paths: ${open.join(', ')}. Use signedUrl() for anything else.`\n\t\t\t\t\t: 'This file server declares no open paths, so every object needs signedUrl().'),\n\t\t);\n\t\tthis.name = 'NotOpen';\n\t}\n}\n\nexport class FileServer<\n\tTName extends string = string,\n\tTOpen extends string = never,\n> implements Construct<TName, FileServerClient<TOpen>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, FileServerClient<TOpen>>;\n\n\t/** The id of the surface node, as opposed to the bucket's. */\n\treadonly surfaceId: string;\n\n\tprivate readonly open: readonly string[];\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the keys the\n\t * target publishes and the keys the client reads cannot drift.\n\t */\n\tprivate readonly keys: { origin: string; server: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: FileServerOptions<TOpen> = {},\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.open = options.open ?? [];\n\n\t\t// The surface takes the suffix and the bucket keeps the plain id, which\n\t\t// is what makes \"serve a bucket I already have\" an edit that adds a node\n\t\t// instead of renaming the one holding the data.\n\t\tconst originId = options.origin?.id ?? canonical;\n\t\tthis.surfaceId = `${canonical}Server`;\n\n\t\tthis.keys = {\n\t\t\torigin: provideKey(originId, 'url'),\n\t\t\tserver: provideKey(this.surfaceId, 'url'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (registerOptions) => this.connect(registerOptions),\n\t\t};\n\t}\n\n\t/**\n\t * The served surface, as something an edge can point at.\n\t *\n\t * Depending on the `FileServer` itself points at the **bucket** — its\n\t * canonical node — which is right for a handler: it presigns and writes. But\n\t * a bucket's URL is never public, so a site depending on it gets nothing\n\t * inlined, which is correct and also useless.\n\t *\n\t * This is the other half: `.dependsOn([uploads.server])` points at the\n\t * surface, whose address *is* public, and is what puts\n\t * `VITE_UPLOADS_SERVER_URL` in a bundle. The same accessor shape\n\t * `database.reader()` uses, and for the same reason — one construct owning\n\t * two addresses needs a way to name the second.\n\t */\n\tget server(): Declarable {\n\t\tconst surface = this.declare().find(\n\t\t\t(declaration) => declaration.id === this.surfaceId,\n\t\t);\n\n\t\treturn {\n\t\t\tid: this.surfaceId,\n\t\t\tdeclare: () => (surface ? [surface] : []),\n\t\t};\n\t}\n\n\t/**\n\t * The bucket and the surface over it — or just the surface, when the bucket\n\t * was declared elsewhere.\n\t *\n\t * The surface names its origin through `of`, which is what makes the\n\t * reference check work: an origin resolving to nothing is a build failure,\n\t * the same guarantee `assertDerivations` already gives a reader and a schema\n\t * tenant.\n\t */\n\tdeclare(): Declaration[] {\n\t\tconst origin = this.options.origin;\n\n\t\tconst surface: Declaration = {\n\t\t\tkind: 'file-server',\n\t\t\tid: this.surfaceId,\n\t\t\tof: origin?.id ?? this.id,\n\t\t\t...(this.open.length ? { open: this.open } : {}),\n\t\t\tprovides: [this.keys.server],\n\t\t};\n\n\t\t// A vended bucket is declared here; a given one already declares itself,\n\t\t// and declaring it twice is the duplication the whole model removes.\n\t\tif (origin) return [surface];\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'objects',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.origin],\n\t\t\t\t...(this.options.versioned ? { versioned: true } : {}),\n\t\t\t},\n\t\t\tsurface,\n\t\t];\n\t}\n\n\t/**\n\t * The bucket's client, with the serving half added.\n\t *\n\t * Both addresses are read here, which is also how the environment reaches a\n\t * handler: the sniffer records what this reads, so `.dependsOn([uploads])`\n\t * carries the bucket URL and the server URL without either being written\n\t * down beside the handler.\n\t */\n\tprivate async connect(\n\t\toptions: ServiceRegisterOptions,\n\t): Promise<FileServerClient<TOpen>> {\n\t\tconst { origin, server } = options.envParser\n\t\t\t.create((get) => ({\n\t\t\t\torigin: get(this.keys.origin).string(),\n\t\t\t\tserver: get(this.keys.server).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\tconst storage = createStorageClient(origin);\n\t\tconst base = server.replace(/\\/+$/, '');\n\n\t\tconst serve = (key: string): string => {\n\t\t\tif (!this.serves(key)) throw new NotOpen(key, this.open);\n\n\t\t\treturn `${base}/${key.replace(/^\\/+/, '')}`;\n\t\t};\n\n\t\t// Delegating rather than copying: the bucket half is whatever the driver\n\t\t// produced, including anything it grows later, and only the serving half\n\t\t// is added on top.\n\t\treturn Object.assign(Object.create(storage) as StorageClient, {\n\t\t\turl: serve as (key: Served<TOpen>) => string,\n\t\t\topenUrl: serve,\n\t\t\tsignedUrl: (key: string, expiresIn?: number) =>\n\t\t\t\tstorage.getDownloadURL({ path: key } as never, expiresIn),\n\t\t}) as FileServerClient<TOpen>;\n\t}\n\n\t/**\n\t * Whether an open pattern admits a key.\n\t *\n\t * The runtime half of {@link Served}, and stricter than it: here a single\n\t * star stops at a segment boundary and a double star does not, which is the\n\t * distinction a template-literal type cannot draw and the infrastructure\n\t * does.\n\t */\n\tprivate serves(key: string): boolean {\n\t\treturn this.open.some((pattern) => globToRegExp(pattern).test(key));\n\t}\n}\n\n/**\n * One open pattern as an anchored expression.\n *\n * A double star crosses `/`; a single star does not. Both are consumed in one\n * left-to-right pass rather than by substitution, so a pattern cannot be\n * rewritten into a placeholder that a later pass mistakes for literal text.\n */\nfunction globToRegExp(pattern: string): RegExp {\n\tlet source = '';\n\n\tfor (let index = 0; index < pattern.length; index++) {\n\t\tconst character = pattern[index];\n\n\t\tif (character !== '*') {\n\t\t\tsource += character?.replace(/[.+^${}()|[\\]\\\\?]/, '\\\\$&') ?? '';\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (pattern[index + 1] === '*') {\n\t\t\tsource += '.*';\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tsource += '[^/]*';\n\t}\n\n\treturn new RegExp(`^${source}$`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuIA,IAAa,UAAb,cAA6B,MAAM;CAExB;CACA;CAFV,YACC,KACA,MACC;EACD,MACC,IAAI,IAAI,0CACN,KAAK,SACH,eAAe,KAAK,KAAK,IAAI,EAAE,wCAC/B,8EACL;EARS,KAAA,MAAA;EACA,KAAA,OAAA;EAQT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,aAAb,MAIA;CAiBmB;CAhBlB;CACA;;CAGA;CAEA;;;;;CAMA;CAEA,YACC,IACA,UAAqD,CAAC,GACrD;EADgB,KAAA,UAAA;EAEjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO,QAAQ,QAAQ,CAAC;EAK7B,MAAM,WAAW,QAAQ,QAAQ,MAAM;EACvC,KAAK,YAAY,GAAG,UAAU;EAE9B,KAAK,OAAO;GACX,SAAA,GAAQC,oBAAAA,WAAAA,CAAW,UAAU,KAAK;GAClC,SAAA,GAAQA,oBAAAA,WAAAA,CAAW,KAAK,WAAW,KAAK;EACzC;EAGA,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,oBAAoB,KAAK,QAAQ,eAAe;EAC5D;CACD;;;;;;;;;;;;;;;CAgBA,IAAI,SAAqB;EACxB,MAAM,UAAU,KAAK,QAAQ,CAAC,CAAC,MAC7B,gBAAgB,YAAY,OAAO,KAAK,SAC1C;EAEA,OAAO;GACN,IAAI,KAAK;GACT,eAAgB,UAAU,CAAC,OAAO,IAAI,CAAC;EACxC;CACD;;;;;;;;;;CAWA,UAAyB;EACxB,MAAM,SAAS,KAAK,QAAQ;EAE5B,MAAM,UAAuB;GAC5B,MAAM;GACN,IAAI,KAAK;GACT,IAAI,QAAQ,MAAM,KAAK;GACvB,GAAI,KAAK,KAAK,SAAS,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC;GAC9C,UAAU,CAAC,KAAK,KAAK,MAAM;EAC5B;EAIA,IAAI,QAAQ,OAAO,CAAC,OAAO;EAE3B,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,MAAM;GAC3B,GAAI,KAAK,QAAQ,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;EACrD,GACA,OACD;CACD;;;;;;;;;CAUA,MAAc,QACb,SACmC;EACnC,MAAM,EAAE,QAAQ,WAAW,QAAQ,UACjC,QAAQ,SAAS;GACjB,QAAQ,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,OAAO;GACrC,QAAQ,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,OAAO;EACtC,EAAE,CAAC,CACF,MAAM;EAER,MAAM,WAAA,GAAUC,mBAAAA,oBAAAA,CAAoB,MAAM;EAC1C,MAAM,OAAO,OAAO,QAAQ,QAAQ,EAAE;EAEtC,MAAM,SAAS,QAAwB;GACtC,IAAI,CAAC,KAAK,OAAO,GAAG,GAAG,MAAM,IAAI,QAAQ,KAAK,KAAK,IAAI;GAEvD,OAAO,GAAG,KAAK,GAAG,IAAI,QAAQ,QAAQ,EAAE;EACzC;EAKA,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,GAAoB;GAC7D,KAAK;GACL,SAAS;GACT,YAAY,KAAa,cACxB,QAAQ,eAAe,EAAE,MAAM,IAAI,GAAY,SAAS;EAC1D,CAAC;CACF;;;;;;;;;CAUA,OAAe,KAAsB;EACpC,OAAO,KAAK,KAAK,MAAM,YAAY,aAAa,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;CACnE;AACD;;;;;;;;AASA,SAAS,aAAa,SAAyB;CAC9C,IAAI,SAAS;CAEb,KAAK,IAAI,QAAQ,GAAG,QAAQ,QAAQ,QAAQ,SAAS;EACpD,MAAM,YAAY,QAAQ;EAE1B,IAAI,cAAc,KAAK;GACtB,UAAU,WAAW,QAAQ,qBAAqB,MAAM,KAAK;GAC7D;EACD;EAEA,IAAI,QAAQ,QAAQ,OAAO,KAAK;GAC/B,UAAU;GACV;GACA;EACD;EAEA,UAAU;CACX;CAEA,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE;AAChC"}