@zonastery/bursar 2.0.3 → 2.0.5

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 (376) hide show
  1. package/README.md +1 -1
  2. package/dist/billing/auto-recharge-port.d.ts +3 -2
  3. package/dist/billing/auto-recharge-port.d.ts.map +1 -1
  4. package/dist/billing/auto-recharge-port.js.map +1 -1
  5. package/dist/billing/auto-recharge-service.d.ts.map +1 -1
  6. package/dist/billing/auto-recharge-service.js +3 -3
  7. package/dist/billing/auto-recharge-service.js.map +1 -1
  8. package/dist/billing/billing-service.d.ts +3 -2
  9. package/dist/billing/billing-service.d.ts.map +1 -1
  10. package/dist/billing/billing-service.js +2 -10
  11. package/dist/billing/billing-service.js.map +1 -1
  12. package/dist/billing/billing-store.d.ts +6 -6
  13. package/dist/billing/billing-store.d.ts.map +1 -1
  14. package/dist/billing/billing-store.js.map +1 -1
  15. package/dist/billing/contracts.d.ts +8 -7
  16. package/dist/billing/contracts.d.ts.map +1 -1
  17. package/dist/billing/contracts.js.map +1 -1
  18. package/dist/billing/event-handlers.d.ts +5 -9
  19. package/dist/billing/event-handlers.d.ts.map +1 -1
  20. package/dist/billing/event-handlers.js +191 -285
  21. package/dist/billing/event-handlers.js.map +1 -1
  22. package/dist/billing/event-processor.d.ts +1 -1
  23. package/dist/billing/event-processor.d.ts.map +1 -1
  24. package/dist/billing/event-processor.js +32 -23
  25. package/dist/billing/event-processor.js.map +1 -1
  26. package/dist/billing/financial-event-handlers.d.ts +3 -9
  27. package/dist/billing/financial-event-handlers.d.ts.map +1 -1
  28. package/dist/billing/financial-event-handlers.js +10 -12
  29. package/dist/billing/financial-event-handlers.js.map +1 -1
  30. package/dist/billing/index.d.ts +1 -1
  31. package/dist/billing/index.d.ts.map +1 -1
  32. package/dist/billing/index.js.map +1 -1
  33. package/dist/billing/management.d.ts +3 -2
  34. package/dist/billing/management.d.ts.map +1 -1
  35. package/dist/billing/management.js.map +1 -1
  36. package/dist/billing/policy-window.js.map +1 -1
  37. package/dist/billing/postgres/repositories/auto-recharge.d.ts +2 -1
  38. package/dist/billing/postgres/repositories/auto-recharge.d.ts.map +1 -1
  39. package/dist/billing/postgres/repositories/auto-recharge.js +58 -40
  40. package/dist/billing/postgres/repositories/auto-recharge.js.map +1 -1
  41. package/dist/billing/postgres/repositories/customer.d.ts.map +1 -1
  42. package/dist/billing/postgres/repositories/customer.js.map +1 -1
  43. package/dist/billing/postgres/repositories/dispute.d.ts +2 -1
  44. package/dist/billing/postgres/repositories/dispute.d.ts.map +1 -1
  45. package/dist/billing/postgres/repositories/dispute.js.map +1 -1
  46. package/dist/billing/postgres/repositories/event.d.ts +2 -2
  47. package/dist/billing/postgres/repositories/event.d.ts.map +1 -1
  48. package/dist/billing/postgres/repositories/event.js.map +1 -1
  49. package/dist/billing/postgres/repositories/invoice.d.ts +2 -1
  50. package/dist/billing/postgres/repositories/invoice.d.ts.map +1 -1
  51. package/dist/billing/postgres/repositories/invoice.js +8 -12
  52. package/dist/billing/postgres/repositories/invoice.js.map +1 -1
  53. package/dist/billing/postgres/repositories/offer.d.ts.map +1 -1
  54. package/dist/billing/postgres/repositories/offer.js +5 -0
  55. package/dist/billing/postgres/repositories/offer.js.map +1 -1
  56. package/dist/billing/postgres/repositories/payment.d.ts +4 -4
  57. package/dist/billing/postgres/repositories/payment.d.ts.map +1 -1
  58. package/dist/billing/postgres/repositories/payment.js +1 -1
  59. package/dist/billing/postgres/repositories/payment.js.map +1 -1
  60. package/dist/billing/postgres/repositories/preferences.d.ts.map +1 -1
  61. package/dist/billing/postgres/repositories/preferences.js.map +1 -1
  62. package/dist/billing/postgres/repositories/refund.d.ts.map +1 -1
  63. package/dist/billing/postgres/repositories/refund.js.map +1 -1
  64. package/dist/billing/postgres/repositories/subscription-change.d.ts.map +1 -1
  65. package/dist/billing/postgres/repositories/subscription-change.js +1 -9
  66. package/dist/billing/postgres/repositories/subscription-change.js.map +1 -1
  67. package/dist/billing/postgres/repositories/subscription.d.ts +11 -11
  68. package/dist/billing/postgres/repositories/subscription.d.ts.map +1 -1
  69. package/dist/billing/postgres/repositories/subscription.js +29 -30
  70. package/dist/billing/postgres/repositories/subscription.js.map +1 -1
  71. package/dist/billing/postgres/repositories/topup.d.ts +1 -1
  72. package/dist/billing/postgres/repositories/topup.d.ts.map +1 -1
  73. package/dist/billing/postgres/repositories/topup.js.map +1 -1
  74. package/dist/billing/postgres/store.d.ts +6 -5
  75. package/dist/billing/postgres/store.d.ts.map +1 -1
  76. package/dist/billing/postgres/store.js +15 -13
  77. package/dist/billing/postgres/store.js.map +1 -1
  78. package/dist/billing/types/auto-recharge.d.ts +2 -1
  79. package/dist/billing/types/auto-recharge.d.ts.map +1 -1
  80. package/dist/billing/types/auto-recharge.js.map +1 -1
  81. package/dist/billing/types/documents.d.ts +2 -1
  82. package/dist/billing/types/documents.d.ts.map +1 -1
  83. package/dist/billing/types/documents.js.map +1 -1
  84. package/dist/billing/types/events.d.ts +3 -2
  85. package/dist/billing/types/events.d.ts.map +1 -1
  86. package/dist/billing/types/events.js +73 -39
  87. package/dist/billing/types/events.js.map +1 -1
  88. package/dist/billing/types/subscriptions.d.ts +4 -1
  89. package/dist/billing/types/subscriptions.d.ts.map +1 -1
  90. package/dist/billing/types/subscriptions.js.map +1 -1
  91. package/dist/breakdown.d.ts +3 -2
  92. package/dist/breakdown.d.ts.map +1 -1
  93. package/dist/breakdown.js.map +1 -1
  94. package/dist/bursar.d.ts.map +1 -1
  95. package/dist/bursar.js +4 -3
  96. package/dist/bursar.js.map +1 -1
  97. package/dist/catalog.d.ts.map +1 -1
  98. package/dist/catalog.js +45 -42
  99. package/dist/catalog.js.map +1 -1
  100. package/dist/commerce/errors.d.ts.map +1 -1
  101. package/dist/commerce/errors.js.map +1 -1
  102. package/dist/commerce/provider-registry.d.ts.map +1 -1
  103. package/dist/commerce/provider-registry.js +11 -6
  104. package/dist/commerce/provider-registry.js.map +1 -1
  105. package/dist/commerce/service.d.ts +1 -1
  106. package/dist/commerce/service.d.ts.map +1 -1
  107. package/dist/commerce/service.js +16 -22
  108. package/dist/commerce/service.js.map +1 -1
  109. package/dist/commerce/types.d.ts.map +1 -1
  110. package/dist/commerce/types.js.map +1 -1
  111. package/dist/config/parse-access.d.ts +5 -2
  112. package/dist/config/parse-access.d.ts.map +1 -1
  113. package/dist/config/parse-access.js +60 -41
  114. package/dist/config/parse-access.js.map +1 -1
  115. package/dist/config/parse-commerce.d.ts +2 -1
  116. package/dist/config/parse-commerce.d.ts.map +1 -1
  117. package/dist/config/parse-commerce.js +49 -29
  118. package/dist/config/parse-commerce.js.map +1 -1
  119. package/dist/config/parse-credits.d.ts +2 -1
  120. package/dist/config/parse-credits.d.ts.map +1 -1
  121. package/dist/config/parse-credits.js +39 -23
  122. package/dist/config/parse-credits.js.map +1 -1
  123. package/dist/config/parse-plans.d.ts +7 -2
  124. package/dist/config/parse-plans.d.ts.map +1 -1
  125. package/dist/config/parse-plans.js +49 -22
  126. package/dist/config/parse-plans.js.map +1 -1
  127. package/dist/config/parse-pricing.d.ts +2 -1
  128. package/dist/config/parse-pricing.d.ts.map +1 -1
  129. package/dist/config/parse-pricing.js +41 -31
  130. package/dist/config/parse-pricing.js.map +1 -1
  131. package/dist/config/parse-utils.d.ts +15 -11
  132. package/dist/config/parse-utils.d.ts.map +1 -1
  133. package/dist/config/parse-utils.js +90 -27
  134. package/dist/config/parse-utils.js.map +1 -1
  135. package/dist/config/types.d.ts.map +1 -1
  136. package/dist/config/types.js.map +1 -1
  137. package/dist/config.d.ts +6 -5
  138. package/dist/config.d.ts.map +1 -1
  139. package/dist/config.js +65 -35
  140. package/dist/config.js.map +1 -1
  141. package/dist/credits/amount.d.ts +1 -1
  142. package/dist/credits/amount.d.ts.map +1 -1
  143. package/dist/credits/amount.js +5 -4
  144. package/dist/credits/amount.js.map +1 -1
  145. package/dist/credits/catalog-runtime.d.ts.map +1 -1
  146. package/dist/credits/catalog-runtime.js +2 -3
  147. package/dist/credits/catalog-runtime.js.map +1 -1
  148. package/dist/credits/events.d.ts +12 -1
  149. package/dist/credits/events.d.ts.map +1 -1
  150. package/dist/credits/events.js +35 -21
  151. package/dist/credits/events.js.map +1 -1
  152. package/dist/credits/lease-workflow.d.ts +2 -1
  153. package/dist/credits/lease-workflow.d.ts.map +1 -1
  154. package/dist/credits/lease-workflow.js +3 -2
  155. package/dist/credits/lease-workflow.js.map +1 -1
  156. package/dist/credits/low-balance-monitor.d.ts +2 -1
  157. package/dist/credits/low-balance-monitor.d.ts.map +1 -1
  158. package/dist/credits/low-balance-monitor.js.map +1 -1
  159. package/dist/credits/postgres/repositories/analytics.d.ts +2 -2
  160. package/dist/credits/postgres/repositories/analytics.d.ts.map +1 -1
  161. package/dist/credits/postgres/repositories/analytics.js +14 -6
  162. package/dist/credits/postgres/repositories/analytics.js.map +1 -1
  163. package/dist/credits/postgres/repositories/balance.d.ts.map +1 -1
  164. package/dist/credits/postgres/repositories/balance.js +6 -6
  165. package/dist/credits/postgres/repositories/balance.js.map +1 -1
  166. package/dist/credits/postgres/repositories/bucket.d.ts.map +1 -1
  167. package/dist/credits/postgres/repositories/bucket.js.map +1 -1
  168. package/dist/credits/postgres/repositories/catalog.d.ts +5 -4
  169. package/dist/credits/postgres/repositories/catalog.d.ts.map +1 -1
  170. package/dist/credits/postgres/repositories/catalog.js +4 -3
  171. package/dist/credits/postgres/repositories/catalog.js.map +1 -1
  172. package/dist/credits/postgres/repositories/deduction.d.ts.map +1 -1
  173. package/dist/credits/postgres/repositories/deduction.js +2 -2
  174. package/dist/credits/postgres/repositories/deduction.js.map +1 -1
  175. package/dist/credits/postgres/repositories/lease.d.ts +2 -2
  176. package/dist/credits/postgres/repositories/lease.d.ts.map +1 -1
  177. package/dist/credits/postgres/repositories/lease.js.map +1 -1
  178. package/dist/credits/postgres/repositories/plan.d.ts +11 -11
  179. package/dist/credits/postgres/repositories/plan.d.ts.map +1 -1
  180. package/dist/credits/postgres/repositories/plan.js.map +1 -1
  181. package/dist/credits/postgres/repositories/team.d.ts +2 -2
  182. package/dist/credits/postgres/repositories/team.d.ts.map +1 -1
  183. package/dist/credits/postgres/repositories/team.js.map +1 -1
  184. package/dist/credits/postgres/store.d.ts +3 -2
  185. package/dist/credits/postgres/store.d.ts.map +1 -1
  186. package/dist/credits/postgres/store.js +17 -10
  187. package/dist/credits/postgres/store.js.map +1 -1
  188. package/dist/credits/postgres/value-mappers.d.ts +4 -3
  189. package/dist/credits/postgres/value-mappers.d.ts.map +1 -1
  190. package/dist/credits/postgres/value-mappers.js +10 -11
  191. package/dist/credits/postgres/value-mappers.js.map +1 -1
  192. package/dist/credits/queries.d.ts.map +1 -1
  193. package/dist/credits/queries.js.map +1 -1
  194. package/dist/credits/service.d.ts.map +1 -1
  195. package/dist/credits/service.js +10 -5
  196. package/dist/credits/service.js.map +1 -1
  197. package/dist/credits/store.d.ts +5 -4
  198. package/dist/credits/store.d.ts.map +1 -1
  199. package/dist/credits/store.js.map +1 -1
  200. package/dist/credits/types/account.d.ts +5 -4
  201. package/dist/credits/types/account.d.ts.map +1 -1
  202. package/dist/credits/types/account.js.map +1 -1
  203. package/dist/credits/types/catalog.d.ts +2 -1
  204. package/dist/credits/types/catalog.d.ts.map +1 -1
  205. package/dist/credits/types/catalog.js.map +1 -1
  206. package/dist/credits/types/grants.d.ts.map +1 -1
  207. package/dist/credits/types/grants.js.map +1 -1
  208. package/dist/credits/types/ledger.d.ts +3 -2
  209. package/dist/credits/types/ledger.d.ts.map +1 -1
  210. package/dist/credits/types/ledger.js.map +1 -1
  211. package/dist/engine.d.ts +2 -2
  212. package/dist/engine.d.ts.map +1 -1
  213. package/dist/engine.js +39 -10
  214. package/dist/engine.js.map +1 -1
  215. package/dist/errors.d.ts +7 -4
  216. package/dist/errors.d.ts.map +1 -1
  217. package/dist/errors.js +18 -11
  218. package/dist/errors.js.map +1 -1
  219. package/dist/expr/ast.d.ts.map +1 -1
  220. package/dist/expr/ast.js.map +1 -1
  221. package/dist/expr/evaluator.js.map +1 -1
  222. package/dist/expr/parser.d.ts.map +1 -1
  223. package/dist/expr/parser.js.map +1 -1
  224. package/dist/expr/tokenizer.d.ts.map +1 -1
  225. package/dist/expr/tokenizer.js +34 -12
  226. package/dist/expr/tokenizer.js.map +1 -1
  227. package/dist/expr.d.ts.map +1 -1
  228. package/dist/expr.js +12 -6
  229. package/dist/expr.js.map +1 -1
  230. package/dist/generated/pricing-config.schema.json +0 -12
  231. package/dist/generated/pricing-config.types.d.ts +2 -8
  232. package/dist/generated/pricing-config.types.d.ts.map +1 -1
  233. package/dist/generated/pricing-config.types.js.map +1 -1
  234. package/dist/integrations/better-auth.d.ts +4 -1
  235. package/dist/integrations/better-auth.d.ts.map +1 -1
  236. package/dist/integrations/better-auth.js +7 -4
  237. package/dist/integrations/better-auth.js.map +1 -1
  238. package/dist/load-config-file.d.ts +2 -1
  239. package/dist/load-config-file.d.ts.map +1 -1
  240. package/dist/load-config-file.js +19 -13
  241. package/dist/load-config-file.js.map +1 -1
  242. package/dist/metrics.d.ts +2 -1
  243. package/dist/metrics.d.ts.map +1 -1
  244. package/dist/metrics.js.map +1 -1
  245. package/dist/node.d.ts +1 -1
  246. package/dist/node.d.ts.map +1 -1
  247. package/dist/node.js.map +1 -1
  248. package/dist/providers/_shared.d.ts +8 -5
  249. package/dist/providers/_shared.d.ts.map +1 -1
  250. package/dist/providers/_shared.js +15 -11
  251. package/dist/providers/_shared.js.map +1 -1
  252. package/dist/providers/dodo/better-auth-core.d.ts +30 -0
  253. package/dist/providers/dodo/better-auth-core.d.ts.map +1 -0
  254. package/dist/providers/dodo/better-auth-core.js +14 -0
  255. package/dist/providers/dodo/better-auth-core.js.map +1 -0
  256. package/dist/providers/dodo/better-auth.d.ts +5 -9
  257. package/dist/providers/dodo/better-auth.d.ts.map +1 -1
  258. package/dist/providers/dodo/better-auth.js +16 -13
  259. package/dist/providers/dodo/better-auth.js.map +1 -1
  260. package/dist/providers/dodo/client-contract.d.ts +12 -10
  261. package/dist/providers/dodo/client-contract.d.ts.map +1 -1
  262. package/dist/providers/dodo/client-contract.js.map +1 -1
  263. package/dist/providers/dodo/event-mapper.d.ts +7 -4
  264. package/dist/providers/dodo/event-mapper.d.ts.map +1 -1
  265. package/dist/providers/dodo/event-mapper.js +121 -113
  266. package/dist/providers/dodo/event-mapper.js.map +1 -1
  267. package/dist/providers/dodo/nextjs-core.d.ts +22 -0
  268. package/dist/providers/dodo/nextjs-core.d.ts.map +1 -0
  269. package/dist/providers/dodo/nextjs-core.js +14 -0
  270. package/dist/providers/dodo/nextjs-core.js.map +1 -0
  271. package/dist/providers/dodo/nextjs.d.ts +5 -7
  272. package/dist/providers/dodo/nextjs.d.ts.map +1 -1
  273. package/dist/providers/dodo/nextjs.js +11 -10
  274. package/dist/providers/dodo/nextjs.js.map +1 -1
  275. package/dist/providers/dodo/provider.d.ts +3 -3
  276. package/dist/providers/dodo/provider.d.ts.map +1 -1
  277. package/dist/providers/dodo/provider.js +42 -35
  278. package/dist/providers/dodo/provider.js.map +1 -1
  279. package/dist/providers/dodo/react-native-core.d.ts +56 -0
  280. package/dist/providers/dodo/react-native-core.d.ts.map +1 -0
  281. package/dist/providers/dodo/react-native-core.js +56 -0
  282. package/dist/providers/dodo/react-native-core.js.map +1 -0
  283. package/dist/providers/dodo/react-native.d.ts +6 -50
  284. package/dist/providers/dodo/react-native.d.ts.map +1 -1
  285. package/dist/providers/dodo/react-native.js +5 -49
  286. package/dist/providers/dodo/react-native.js.map +1 -1
  287. package/dist/providers/dodo/webhook-bridge.d.ts +4 -2
  288. package/dist/providers/dodo/webhook-bridge.d.ts.map +1 -1
  289. package/dist/providers/dodo/webhook-bridge.js.map +1 -1
  290. package/dist/providers/environment.d.ts +1 -1
  291. package/dist/providers/environment.d.ts.map +1 -1
  292. package/dist/providers/environment.js +4 -2
  293. package/dist/providers/environment.js.map +1 -1
  294. package/dist/providers/mock/provider.d.ts.map +1 -1
  295. package/dist/providers/mock/provider.js +5 -10
  296. package/dist/providers/mock/provider.js.map +1 -1
  297. package/dist/providers/stripe/event-mapper.d.ts.map +1 -1
  298. package/dist/providers/stripe/event-mapper.js +33 -9
  299. package/dist/providers/stripe/event-mapper.js.map +1 -1
  300. package/dist/providers/stripe/provider.d.ts.map +1 -1
  301. package/dist/providers/stripe/provider.js +101 -61
  302. package/dist/providers/stripe/provider.js.map +1 -1
  303. package/dist/providers/types.d.ts.map +1 -1
  304. package/dist/providers/types.js.map +1 -1
  305. package/dist/retry.d.ts.map +1 -1
  306. package/dist/retry.js +16 -9
  307. package/dist/retry.js.map +1 -1
  308. package/dist/shared/diagnostics.d.ts +5 -5
  309. package/dist/shared/diagnostics.d.ts.map +1 -1
  310. package/dist/shared/diagnostics.js +32 -22
  311. package/dist/shared/diagnostics.js.map +1 -1
  312. package/dist/shared/idempotency.d.ts +4 -3
  313. package/dist/shared/idempotency.d.ts.map +1 -1
  314. package/dist/shared/idempotency.js +21 -10
  315. package/dist/shared/idempotency.js.map +1 -1
  316. package/dist/shared/json.d.ts +28 -0
  317. package/dist/shared/json.d.ts.map +1 -0
  318. package/dist/shared/json.js +41 -0
  319. package/dist/shared/json.js.map +1 -0
  320. package/dist/shared/logger.d.ts +10 -4
  321. package/dist/shared/logger.d.ts.map +1 -1
  322. package/dist/shared/logger.js +28 -4
  323. package/dist/shared/logger.js.map +1 -1
  324. package/dist/shared/postgres-client.d.ts +8 -6
  325. package/dist/shared/postgres-client.d.ts.map +1 -1
  326. package/dist/shared/postgres-client.js +69 -47
  327. package/dist/shared/postgres-client.js.map +1 -1
  328. package/dist/shared/postgres-errors.d.ts +1 -1
  329. package/dist/shared/postgres-errors.d.ts.map +1 -1
  330. package/dist/shared/postgres-errors.js +32 -31
  331. package/dist/shared/postgres-errors.js.map +1 -1
  332. package/dist/shared/postgres-types.d.ts +3 -2
  333. package/dist/shared/postgres-types.d.ts.map +1 -1
  334. package/dist/shared/postgres-types.js.map +1 -1
  335. package/dist/shared/postgres-validation.d.ts +7 -6
  336. package/dist/shared/postgres-validation.d.ts.map +1 -1
  337. package/dist/shared/postgres-validation.js +17 -10
  338. package/dist/shared/postgres-validation.js.map +1 -1
  339. package/dist/storage/adapters/clickhouse.d.ts +11 -4
  340. package/dist/storage/adapters/clickhouse.d.ts.map +1 -1
  341. package/dist/storage/adapters/clickhouse.js +8 -6
  342. package/dist/storage/adapters/clickhouse.js.map +1 -1
  343. package/dist/storage/adapters/s3.d.ts +28 -5
  344. package/dist/storage/adapters/s3.d.ts.map +1 -1
  345. package/dist/storage/adapters/s3.js +48 -33
  346. package/dist/storage/adapters/s3.js.map +1 -1
  347. package/dist/storage/diagnostics.d.ts +1 -1
  348. package/dist/storage/diagnostics.d.ts.map +1 -1
  349. package/dist/storage/diagnostics.js +13 -12
  350. package/dist/storage/diagnostics.js.map +1 -1
  351. package/dist/storage/maintenance.d.ts.map +1 -1
  352. package/dist/storage/maintenance.js +31 -25
  353. package/dist/storage/maintenance.js.map +1 -1
  354. package/dist/storage/outbox-worker.d.ts +1 -1
  355. package/dist/storage/outbox-worker.d.ts.map +1 -1
  356. package/dist/storage/outbox-worker.js +18 -18
  357. package/dist/storage/outbox-worker.js.map +1 -1
  358. package/dist/storage/ports.d.ts +10 -7
  359. package/dist/storage/ports.d.ts.map +1 -1
  360. package/dist/storage/ports.js.map +1 -1
  361. package/dist/storage/postgres-repository.d.ts +3 -1
  362. package/dist/storage/postgres-repository.d.ts.map +1 -1
  363. package/dist/storage/postgres-repository.js +10 -4
  364. package/dist/storage/postgres-repository.js.map +1 -1
  365. package/dist/storage/runtime.d.ts +1 -1
  366. package/dist/storage/runtime.d.ts.map +1 -1
  367. package/dist/storage/runtime.js +165 -182
  368. package/dist/storage/runtime.js.map +1 -1
  369. package/dist/telemetry/index.d.ts +10 -6
  370. package/dist/telemetry/index.d.ts.map +1 -1
  371. package/dist/telemetry/index.js +26 -23
  372. package/dist/telemetry/index.js.map +1 -1
  373. package/dist/telemetry/opentelemetry.d.ts.map +1 -1
  374. package/dist/telemetry/opentelemetry.js +3 -3
  375. package/dist/telemetry/opentelemetry.js.map +1 -1
  376. package/package.json +40 -40
package/dist/retry.js CHANGED
@@ -1,6 +1,15 @@
1
1
  import pRetry from "p-retry";
2
+ import { z } from "zod";
2
3
  import { isRetryableBursarError } from "./errors.js";
3
4
  const MAX_TIMER_MS = 2_147_483_647;
5
+ const abortSignalSchema = z.custom((value) => z
6
+ .object({
7
+ aborted: z.boolean(),
8
+ addEventListener: z.function(),
9
+ removeEventListener: z.function(),
10
+ throwIfAborted: z.function(),
11
+ })
12
+ .safeParse(value).success, "signal must be an AbortSignal");
4
13
  function finiteNumber(value, name, minimum, maximum = Number.MAX_VALUE) {
5
14
  if (!Number.isFinite(value) || value < minimum || value > maximum) {
6
15
  throw new RangeError(`${name} must be a finite number between ${minimum} and ${maximum}`);
@@ -16,24 +25,22 @@ function finiteNumber(value, name, minimum, maximum = Number.MAX_VALUE) {
16
25
  * make a mutation's commit outcome indeterminate.
17
26
  */
18
27
  export async function retryBursarOperation(operation, options = {}) {
19
- if (typeof operation !== "function")
28
+ if (!z.function().safeParse(operation).success) {
20
29
  throw new TypeError("operation must be a function");
21
- if (options.jitter !== undefined && typeof options.jitter !== "boolean") {
30
+ }
31
+ if (options.jitter !== undefined && !z.boolean().safeParse(options.jitter).success) {
22
32
  throw new TypeError("jitter must be a boolean");
23
33
  }
24
- if (options.unref !== undefined && typeof options.unref !== "boolean") {
34
+ if (options.unref !== undefined && !z.boolean().safeParse(options.unref).success) {
25
35
  throw new TypeError("unref must be a boolean");
26
36
  }
27
- if (options.shouldRetry !== undefined && typeof options.shouldRetry !== "function") {
37
+ if (options.shouldRetry !== undefined && !z.function().safeParse(options.shouldRetry).success) {
28
38
  throw new TypeError("shouldRetry must be a function");
29
39
  }
30
- if (options.onRetry !== undefined && typeof options.onRetry !== "function") {
40
+ if (options.onRetry !== undefined && !z.function().safeParse(options.onRetry).success) {
31
41
  throw new TypeError("onRetry must be a function");
32
42
  }
33
- if (options.signal !== undefined &&
34
- (typeof options.signal !== "object" ||
35
- options.signal === null ||
36
- typeof options.signal.throwIfAborted !== "function")) {
43
+ if (options.signal !== undefined && !abortSignalSchema.safeParse(options.signal).success) {
37
44
  throw new TypeError("signal must be an AbortSignal");
38
45
  }
39
46
  const maxAttempts = options.maxAttempts ?? 3;
package/dist/retry.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,YAAY,GAAG,aAAa,CAAC;AA4BnC,SAAS,YAAY,CACnB,KAAa,EACb,IAAY,EACZ,OAAe,EACf,OAAO,GAAG,MAAM,CAAC,SAAS;IAE1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,OAAO,IAAI,KAAK,GAAG,OAAO,EAAE,CAAC;QAClE,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,oCAAoC,OAAO,QAAQ,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,SAAmC,EACnC,UAA8B,EAAE;IAEhC,IAAI,OAAO,SAAS,KAAK,UAAU;QAAE,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAC;IACzF,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACxE,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACtE,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAC;IACjD,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AC,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3E,MAAM,YAAY,GAAG,YAAY,CAC/B,OAAO,CAAC,YAAY,IAAI,MAAM,EAC9B,cAAc,EACd,CAAC,EACD,YAAY,CACb,CAAC;IAEF,OAAO,MAAM,CAAC,SAAS,EAAE;QACvB,OAAO,EAAE,WAAW,GAAG,CAAC;QACxB,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,UAAU;QACtB,MAAM;QACN,SAAS,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;QACjC,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;QAC7B,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,EAAE;YAC1D,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW;gBAC/B,CAAC,CAAC,MAAM,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC;gBAClC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,CAAC,KAAK;gBAAE,OAAO,KAAK,CAAC;YACzB,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import pRetry from \"p-retry\";\n\nimport { isRetryableBursarError } from \"./errors.js\";\n\nconst MAX_TIMER_MS = 2_147_483_647;\n\nexport interface BursarRetryOptions {\n /** Total attempts, including the first call. Defaults to 3. */\n maxAttempts?: number;\n /** Initial exponential-backoff delay. Defaults to 250 ms. */\n baseDelayMs?: number;\n /** Maximum delay between attempts. Defaults to 2 seconds. */\n maxDelayMs?: number;\n /** Exponential-backoff multiplier. Defaults to 2. */\n factor?: number;\n /** Randomize backoff to prevent a thundering herd. Defaults to true. */\n jitter?: boolean;\n /** Maximum elapsed retry budget. Defaults to 30 seconds. */\n maxElapsedMs?: number;\n /** Abort retries and pending backoff when this signal is aborted. */\n signal?: AbortSignal;\n /** Allow Node.js to exit while waiting to retry. Defaults to false. */\n unref?: boolean;\n /**\n * Override the default `error.retryable` decision. This does not make an\n * operation idempotent; mutation retries must reuse their idempotency key.\n */\n shouldRetry?: (error: Error) => boolean | Promise<boolean>;\n /** Observer invoked immediately before each retry is scheduled. */\n onRetry?: (error: Error, nextAttempt: number, delayMs: number) => void | Promise<void>;\n}\n\nfunction finiteNumber(\n value: number,\n name: string,\n minimum: number,\n maximum = Number.MAX_VALUE,\n): number {\n if (!Number.isFinite(value) || value < minimum || value > maximum) {\n throw new RangeError(`${name} must be a finite number between ${minimum} and ${maximum}`);\n }\n return value;\n}\n\n/**\n * Execute an operation with bounded, cancellable exponential backoff.\n *\n * Retries are deliberately opt-in at the error level: by default only typed\n * Bursar errors whose `retryable` flag is true are attempted again. The\n * operation must be read-only or idempotent because a transport failure can\n * make a mutation's commit outcome indeterminate.\n */\nexport async function retryBursarOperation<T>(\n operation: () => PromiseLike<T> | T,\n options: BursarRetryOptions = {},\n): Promise<T> {\n if (typeof operation !== \"function\") throw new TypeError(\"operation must be a function\");\n if (options.jitter !== undefined && typeof options.jitter !== \"boolean\") {\n throw new TypeError(\"jitter must be a boolean\");\n }\n if (options.unref !== undefined && typeof options.unref !== \"boolean\") {\n throw new TypeError(\"unref must be a boolean\");\n }\n if (options.shouldRetry !== undefined && typeof options.shouldRetry !== \"function\") {\n throw new TypeError(\"shouldRetry must be a function\");\n }\n if (options.onRetry !== undefined && typeof options.onRetry !== \"function\") {\n throw new TypeError(\"onRetry must be a function\");\n }\n if (\n options.signal !== undefined &&\n (typeof options.signal !== \"object\" ||\n options.signal === null ||\n typeof options.signal.throwIfAborted !== \"function\")\n ) {\n throw new TypeError(\"signal must be an AbortSignal\");\n }\n\n const maxAttempts = options.maxAttempts ?? 3;\n if (!Number.isSafeInteger(maxAttempts) || maxAttempts < 1) {\n throw new RangeError(\"maxAttempts must be a positive safe integer\");\n }\n\n const baseDelayMs = finiteNumber(options.baseDelayMs ?? 250, \"baseDelayMs\", 0, MAX_TIMER_MS);\n const maxDelayMs = finiteNumber(\n options.maxDelayMs ?? Math.max(2_000, baseDelayMs),\n \"maxDelayMs\",\n 0,\n MAX_TIMER_MS,\n );\n if (maxDelayMs < baseDelayMs) {\n throw new RangeError(\"maxDelayMs must be greater than or equal to baseDelayMs\");\n }\n const factor = finiteNumber(options.factor ?? 2, \"factor\", Number.EPSILON);\n const maxElapsedMs = finiteNumber(\n options.maxElapsedMs ?? 30_000,\n \"maxElapsedMs\",\n 0,\n MAX_TIMER_MS,\n );\n\n return pRetry(operation, {\n retries: maxAttempts - 1,\n minTimeout: baseDelayMs,\n maxTimeout: maxDelayMs,\n factor,\n randomize: options.jitter ?? true,\n maxRetryTime: maxElapsedMs,\n signal: options.signal,\n unref: options.unref ?? false,\n shouldRetry: async ({ error, attemptNumber, retryDelay }) => {\n const retry = options.shouldRetry\n ? await options.shouldRetry(error)\n : isRetryableBursarError(error);\n if (!retry) return false;\n await options.onRetry?.(error, attemptNumber + 1, retryDelay);\n return true;\n },\n });\n}\n"]}
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAChC,CAAC,KAAK,EAAE,EAAE,CACR,CAAC;KACE,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,gBAAgB,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC9B,mBAAmB,EAAE,CAAC,CA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,MAAM,YAAY,GAAG,YAAY,CAC/B,OAAO,CAAC,YAAY,IAAI,MAAM,EAC9B,cAAc,EACd,CAAC,EACD,YAAY,CACb,CAAC;IAEF,OAAO,MAAM,CAAC,SAAS,EAAE;QACvB,OAAO,EAAE,WAAW,GAAG,CAAC;QACxB,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,UAAU;QACtB,MAAM;QACN,SAAS,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;QACjC,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;QAC7B,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,EAAE;YAC1D,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW;gBAC/B,CAAC,CAAC,MAAM,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC;gBAClC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,CAAC,KAAK;gBAAE,OAAO,KAAK,CAAC;YACzB,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import pRetry from \"p-retry\";\nimport { z } from \"zod\";\n\nimport { isRetryableBursarError } from \"./errors.js\";\n\nconst MAX_TIMER_MS = 2_147_483_647;\n\nconst abortSignalSchema = z.custom<AbortSignal>(\n (value) =>\n z\n .object({\n aborted: z.boolean(),\n addEventListener: z.function(),\n removeEventListener: z.function(),\n throwIfAborted: z.function(),\n })\n .safeParse(value).success,\n \"signal must be an AbortSignal\",\n);\n\nexport interface BursarRetryOptions {\n /** Total attempts, including the first call. Defaults to 3. */\n maxAttempts?: number;\n /** Initial exponential-backoff delay. Defaults to 250 ms. */\n baseDelayMs?: number;\n /** Maximum delay between attempts. Defaults to 2 seconds. */\n maxDelayMs?: number;\n /** Exponential-backoff multiplier. Defaults to 2. */\n factor?: number;\n /** Randomize backoff to prevent a thundering herd. Defaults to true. */\n jitter?: boolean;\n /** Maximum elapsed retry budget. Defaults to 30 seconds. */\n maxElapsedMs?: number;\n /** Abort retries and pending backoff when this signal is aborted. */\n signal?: AbortSignal;\n /** Allow Node.js to exit while waiting to retry. Defaults to false. */\n unref?: boolean;\n /**\n * Override the default `error.retryable` decision. This does not make an\n * operation idempotent; mutation retries must reuse their idempotency key.\n */\n shouldRetry?: (error: Error) => boolean | Promise<boolean>;\n /** Observer invoked immediately before each retry is scheduled. */\n onRetry?: (error: Error, nextAttempt: number, delayMs: number) => void | Promise<void>;\n}\n\nfunction finiteNumber(\n value: number,\n name: string,\n minimum: number,\n maximum = Number.MAX_VALUE,\n): number {\n if (!Number.isFinite(value) || value < minimum || value > maximum) {\n throw new RangeError(`${name} must be a finite number between ${minimum} and ${maximum}`);\n }\n return value;\n}\n\n/**\n * Execute an operation with bounded, cancellable exponential backoff.\n *\n * Retries are deliberately opt-in at the error level: by default only typed\n * Bursar errors whose `retryable` flag is true are attempted again. The\n * operation must be read-only or idempotent because a transport failure can\n * make a mutation's commit outcome indeterminate.\n */\nexport async function retryBursarOperation<T>(\n operation: () => PromiseLike<T> | T,\n options: BursarRetryOptions = {},\n): Promise<T> {\n if (!z.function().safeParse(operation).success) {\n throw new TypeError(\"operation must be a function\");\n }\n if (options.jitter !== undefined && !z.boolean().safeParse(options.jitter).success) {\n throw new TypeError(\"jitter must be a boolean\");\n }\n if (options.unref !== undefined && !z.boolean().safeParse(options.unref).success) {\n throw new TypeError(\"unref must be a boolean\");\n }\n if (options.shouldRetry !== undefined && !z.function().safeParse(options.shouldRetry).success) {\n throw new TypeError(\"shouldRetry must be a function\");\n }\n if (options.onRetry !== undefined && !z.function().safeParse(options.onRetry).success) {\n throw new TypeError(\"onRetry must be a function\");\n }\n if (options.signal !== undefined && !abortSignalSchema.safeParse(options.signal).success) {\n throw new TypeError(\"signal must be an AbortSignal\");\n }\n\n const maxAttempts = options.maxAttempts ?? 3;\n if (!Number.isSafeInteger(maxAttempts) || maxAttempts < 1) {\n throw new RangeError(\"maxAttempts must be a positive safe integer\");\n }\n\n const baseDelayMs = finiteNumber(options.baseDelayMs ?? 250, \"baseDelayMs\", 0, MAX_TIMER_MS);\n const maxDelayMs = finiteNumber(\n options.maxDelayMs ?? Math.max(2_000, baseDelayMs),\n \"maxDelayMs\",\n 0,\n MAX_TIMER_MS,\n );\n if (maxDelayMs < baseDelayMs) {\n throw new RangeError(\"maxDelayMs must be greater than or equal to baseDelayMs\");\n }\n const factor = finiteNumber(options.factor ?? 2, \"factor\", Number.EPSILON);\n const maxElapsedMs = finiteNumber(\n options.maxElapsedMs ?? 30_000,\n \"maxElapsedMs\",\n 0,\n MAX_TIMER_MS,\n );\n\n return pRetry(operation, {\n retries: maxAttempts - 1,\n minTimeout: baseDelayMs,\n maxTimeout: maxDelayMs,\n factor,\n randomize: options.jitter ?? true,\n maxRetryTime: maxElapsedMs,\n signal: options.signal,\n unref: options.unref ?? false,\n shouldRetry: async ({ error, attemptNumber, retryDelay }) => {\n const retry = options.shouldRetry\n ? await options.shouldRetry(error)\n : isRetryableBursarError(error);\n if (!retry) return false;\n await options.onRetry?.(error, attemptNumber + 1, retryDelay);\n return true;\n },\n });\n}\n"]}
@@ -1,15 +1,15 @@
1
1
  /** Maximum diagnostic length accepted by the SQL layer. */
2
2
  export declare const PERSISTED_DIAGNOSTIC_MAX_CHARACTERS = 8192;
3
3
  /** Return trimmed, non-empty text accepted by diagnostic SQL constraints. */
4
- export declare function boundedDiagnosticMessage(value: unknown, fallback?: string): string;
4
+ export declare function boundedDiagnosticMessage(cause: unknown, fallback?: string): string;
5
5
  /** Normalize an optional diagnostic while preserving an absent value. */
6
- export declare function optionalBoundedDiagnosticMessage(value: unknown): string | null;
7
- export declare function diagnosticErrorCode(value: unknown): string | null;
6
+ export declare function optionalBoundedDiagnosticMessage(cause: unknown): string | null;
7
+ export declare function diagnosticErrorCode(cause: unknown): string | null;
8
8
  /** Return a fixed error type without consulting mutable names or constructors. */
9
- export declare function diagnosticErrorType(value: unknown): string;
9
+ export declare function diagnosticErrorType(cause: unknown): string;
10
10
  /**
11
11
  * Return a persistence-safe diagnostic that never includes an exception
12
12
  * message, payload fragment, URL, identifier, or arbitrary metadata.
13
13
  */
14
- export declare function persistedDiagnosticSummary(value: unknown, fallback?: string): string;
14
+ export declare function persistedDiagnosticSummary(cause: unknown, fallback?: string): string;
15
15
  //# sourceMappingURL=diagnostics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/shared/diagnostics.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAO,MAAM,mCAAmC,OAAQ,CAAC;AAIzD,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAqB,GAAG,MAAM,CAS9F;AAED,yEAAyE;AACzE,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE9E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAOjE;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAe1D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAqB,GAAG,MAAM,CAKhG"}
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/shared/diagnostics.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,eAAO,MAAM,mCAAmC,OAAQ,CAAC;AAIzD,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAqB,GAAG,MAAM,CAiB9F;AAED,yEAAyE;AACzE,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE9E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAOjE;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAe1D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAqB,GAAG,MAAM,CAKhG"}
@@ -1,51 +1,62 @@
1
+ import { isBursarError, isBursarErrorCode } from "../errors.js";
1
2
  /** Maximum diagnostic length accepted by the SQL layer. */
2
3
  export const PERSISTED_DIAGNOSTIC_MAX_CHARACTERS = 8_192;
3
4
  const DIAGNOSTIC_CODE_MAX_CHARACTERS = 128;
4
5
  /** Return trimmed, non-empty text accepted by diagnostic SQL constraints. */
5
- export function boundedDiagnosticMessage(value, fallback = "operation_failed") {
6
- let message = value instanceof Error ? value.message : value == null ? "" : String(value);
6
+ export function boundedDiagnosticMessage(cause, fallback = "operation_failed") {
7
+ let message = "";
8
+ if (cause instanceof Error)
9
+ message = cause.message;
10
+ else if (cause !== null && cause !== undefined) {
11
+ try {
12
+ message = String(cause);
13
+ }
14
+ catch {
15
+ message = "";
16
+ }
17
+ }
7
18
  message = message.replaceAll("\0", "\uFFFD").trim();
8
- if (!message && value instanceof Error)
9
- message = value.name;
19
+ if (!message && cause instanceof Error)
20
+ message = cause.name;
10
21
  const normalizedFallback = fallback.replaceAll("\0", "\uFFFD").trim() || "operation_failed";
11
22
  return Array.from(message || normalizedFallback)
12
23
  .slice(0, PERSISTED_DIAGNOSTIC_MAX_CHARACTERS)
13
24
  .join("");
14
25
  }
15
26
  /** Normalize an optional diagnostic while preserving an absent value. */
16
- export function optionalBoundedDiagnosticMessage(value) {
17
- return value == null ? null : boundedDiagnosticMessage(value);
27
+ export function optionalBoundedDiagnosticMessage(cause) {
28
+ return cause == null ? null : boundedDiagnosticMessage(cause);
18
29
  }
19
- export function diagnosticErrorCode(value) {
30
+ export function diagnosticErrorCode(cause) {
20
31
  try {
21
- if (!isBursarError(value))
32
+ if (!isBursarError(cause))
22
33
  return null;
23
- return isBursarErrorCode(value.code) ? value.code : null;
34
+ return isBursarErrorCode(cause.code) ? cause.code : null;
24
35
  }
25
36
  catch {
26
37
  return null;
27
38
  }
28
39
  }
29
40
  /** Return a fixed error type without consulting mutable names or constructors. */
30
- export function diagnosticErrorType(value) {
41
+ export function diagnosticErrorType(cause) {
31
42
  try {
32
- if (isBursarError(value))
43
+ if (isBursarError(cause))
33
44
  return "BursarError";
34
- if (value instanceof AggregateError)
45
+ if (cause instanceof AggregateError)
35
46
  return "AggregateError";
36
- if (value instanceof TypeError)
47
+ if (cause instanceof TypeError)
37
48
  return "TypeError";
38
- if (value instanceof RangeError)
49
+ if (cause instanceof RangeError)
39
50
  return "RangeError";
40
- if (value instanceof ReferenceError)
51
+ if (cause instanceof ReferenceError)
41
52
  return "ReferenceError";
42
- if (value instanceof SyntaxError)
53
+ if (cause instanceof SyntaxError)
43
54
  return "SyntaxError";
44
- if (value instanceof URIError)
55
+ if (cause instanceof URIError)
45
56
  return "URIError";
46
- if (value instanceof EvalError)
57
+ if (cause instanceof EvalError)
47
58
  return "EvalError";
48
- if (value instanceof Error)
59
+ if (cause instanceof Error)
49
60
  return "Error";
50
61
  }
51
62
  catch {
@@ -57,11 +68,10 @@ export function diagnosticErrorType(value) {
57
68
  * Return a persistence-safe diagnostic that never includes an exception
58
69
  * message, payload fragment, URL, identifier, or arbitrary metadata.
59
70
  */
60
- export function persistedDiagnosticSummary(value, fallback = "operation_failed") {
71
+ export function persistedDiagnosticSummary(cause, fallback = "operation_failed") {
61
72
  const operation = boundedDiagnosticMessage(fallback, "operation_failed")
62
73
  .replaceAll(/[^A-Za-z0-9_.-]/gu, "_")
63
74
  .slice(0, DIAGNOSTIC_CODE_MAX_CHARACTERS);
64
- return `${operation || "operation_failed"}:${diagnosticErrorCode(value) ?? diagnosticErrorType(value)}`;
75
+ return `${operation || "operation_failed"}:${diagnosticErrorCode(cause) ?? diagnosticErrorType(cause)}`;
65
76
  }
66
- import { isBursarError, isBursarErrorCode } from "../errors.js";
67
77
  //# sourceMappingURL=diagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/shared/diagnostics.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC;AAEzD,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C,6EAA6E;AAC7E,MAAM,UAAU,wBAAwB,CAAC,KAAc,EAAE,QAAQ,GAAG,kBAAkB;IACpF,IAAI,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1F,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,IAAI,CAAC,OAAO,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC;IAE7D,MAAM,kBAAkB,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,kBAAkB,CAAC;IAC5F,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC;SAC7C,KAAK,CAAC,CAAC,EAAE,mCAAmC,CAAC;SAC7C,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gCAAgC,CAAC,KAAc;IAC7D,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAA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;SACpC,KAAK,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAC;IAC5C,OAAO,GAAG,SAAS,IAAI,kBAAkB,IAAI,mBAAmB,CAAC,KAAK,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1G,CAAC;AACD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/** Maximum diagnostic length accepted by the SQL layer. */\nexport const PERSISTED_DIAGNOSTIC_MAX_CHARACTERS = 8_192;\n\nconst DIAGNOSTIC_CODE_MAX_CHARACTERS = 128;\n\n/** Return trimmed, non-empty text accepted by diagnostic SQL constraints. */\nexport function boundedDiagnosticMessage(value: unknown, fallback = \"operation_failed\"): string {\n let message = value instanceof Error ? value.message : value == null ? \"\" : String(value);\n message = message.replaceAll(\"\\0\", \"\\uFFFD\").trim();\n if (!message && value instanceof Error) message = value.name;\n\n const normalizedFallback = fallback.replaceAll(\"\\0\", \"\\uFFFD\").trim() || \"operation_failed\";\n return Array.from(message || normalizedFallback)\n .slice(0, PERSISTED_DIAGNOSTIC_MAX_CHARACTERS)\n .join(\"\");\n}\n\n/** Normalize an optional diagnostic while preserving an absent value. */\nexport function optionalBoundedDiagnosticMessage(value: unknown): string | null {\n return value == null ? null : boundedDiagnosticMessage(value);\n}\n\nexport function diagnosticErrorCode(value: unknown): string | null {\n try {\n if (!isBursarError(value)) return null;\n return isBursarErrorCode(value.code) ? value.code : null;\n } catch {\n return null;\n }\n}\n\n/** Return a fixed error type without consulting mutable names or constructors. */\nexport function diagnosticErrorType(value: unknown): string {\n try {\n if (isBursarError(value)) return \"BursarError\";\n if (value instanceof AggregateError) return \"AggregateError\";\n if (value instanceof TypeError) return \"TypeError\";\n if (value instanceof RangeError) return \"RangeError\";\n if (value instanceof ReferenceError) return \"ReferenceError\";\n if (value instanceof SyntaxError) return \"SyntaxError\";\n if (value instanceof URIError) return \"URIError\";\n if (value instanceof EvalError) return \"EvalError\";\n if (value instanceof Error) return \"Error\";\n } catch {\n return \"UnknownError\";\n }\n return \"UnknownError\";\n}\n\n/**\n * Return a persistence-safe diagnostic that never includes an exception\n * message, payload fragment, URL, identifier, or arbitrary metadata.\n */\nexport function persistedDiagnosticSummary(value: unknown, fallback = \"operation_failed\"): string {\n const operation = boundedDiagnosticMessage(fallback, \"operation_failed\")\n .replaceAll(/[^A-Za-z0-9_.-]/gu, \"_\")\n .slice(0, DIAGNOSTIC_CODE_MAX_CHARACTERS);\n return `${operation || \"operation_failed\"}:${diagnosticErrorCode(value) ?? diagnosticErrorType(value)}`;\n}\nimport { isBursarError, isBursarErrorCode } from \"../errors.js\";\n"]}
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/shared/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEhE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC;AAEzD,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C,6EAA6E;AAC7E,MAAM,UAAU,wBAAwB,CAAC,KAAc,EAAE,QAAQ,GAAG,kBAAkB;IACpF,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;SAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/C,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,IAAI,CAAC,OAAO,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,GAAG,KAAK,CAAC,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QACjD,IAAI,KAAK,YAAY,SAAS;YAAE,OAAO,WAAW,CAAC;QACnD,IAAI,KAAK,YAAY,KAAK;YAAE,OAAO,OAAO,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAc,EAAE,QAAQ,GAAG,kBAAkB;IACtF,MAAM,SAAS,GAAG,wBAAwB,CAAC,QAAQ,EAAE,kBAAkB,CAAC;SACrE,UAAU,CAAC,mBAAmB,EAAE,GAAG,CAAC;SACpC,KAAK,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAC;IAC5C,OAAO,GAAG,SAAS,IAAI,kBAAkB,IAAI,mBAAmB,CAAC,KAAK,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1G,CAAC","sourcesContent":["import { isBursarError, isBursarErrorCode } from \"../errors.js\";\n\n/** Maximum diagnostic length accepted by the SQL layer. */\nexport const PERSISTED_DIAGNOSTIC_MAX_CHARACTERS = 8_192;\n\nconst DIAGNOSTIC_CODE_MAX_CHARACTERS = 128;\n\n/** Return trimmed, non-empty text accepted by diagnostic SQL constraints. */\nexport function boundedDiagnosticMessage(cause: unknown, fallback = \"operation_failed\"): string {\n let message = \"\";\n if (cause instanceof Error) message = cause.message;\n else if (cause !== null && cause !== undefined) {\n try {\n message = String(cause);\n } catch {\n message = \"\";\n }\n }\n message = message.replaceAll(\"\\0\", \"\\uFFFD\").trim();\n if (!message && cause instanceof Error) message = cause.name;\n\n const normalizedFallback = fallback.replaceAll(\"\\0\", \"\\uFFFD\").trim() || \"operation_failed\";\n return Array.from(message || normalizedFallback)\n .slice(0, PERSISTED_DIAGNOSTIC_MAX_CHARACTERS)\n .join(\"\");\n}\n\n/** Normalize an optional diagnostic while preserving an absent value. */\nexport function optionalBoundedDiagnosticMessage(cause: unknown): string | null {\n return cause == null ? null : boundedDiagnosticMessage(cause);\n}\n\nexport function diagnosticErrorCode(cause: unknown): string | null {\n try {\n if (!isBursarError(cause)) return null;\n return isBursarErrorCode(cause.code) ? cause.code : null;\n } catch {\n return null;\n }\n}\n\n/** Return a fixed error type without consulting mutable names or constructors. */\nexport function diagnosticErrorType(cause: unknown): string {\n try {\n if (isBursarError(cause)) return \"BursarError\";\n if (cause instanceof AggregateError) return \"AggregateError\";\n if (cause instanceof TypeError) return \"TypeError\";\n if (cause instanceof RangeError) return \"RangeError\";\n if (cause instanceof ReferenceError) return \"ReferenceError\";\n if (cause instanceof SyntaxError) return \"SyntaxError\";\n if (cause instanceof URIError) return \"URIError\";\n if (cause instanceof EvalError) return \"EvalError\";\n if (cause instanceof Error) return \"Error\";\n } catch {\n return \"UnknownError\";\n }\n return \"UnknownError\";\n}\n\n/**\n * Return a persistence-safe diagnostic that never includes an exception\n * message, payload fragment, URL, identifier, or arbitrary metadata.\n */\nexport function persistedDiagnosticSummary(cause: unknown, fallback = \"operation_failed\"): string {\n const operation = boundedDiagnosticMessage(fallback, \"operation_failed\")\n .replaceAll(/[^A-Za-z0-9_.-]/gu, \"_\")\n .slice(0, DIAGNOSTIC_CODE_MAX_CHARACTERS);\n return `${operation || \"operation_failed\"}:${diagnosticErrorCode(cause) ?? diagnosticErrorType(cause)}`;\n}\n"]}
@@ -1,9 +1,10 @@
1
- /** Validate a caller-owned replay key without silently rewriting it. */
2
- export declare function requireStableKey(value: unknown, field?: string): string;
1
+ type StableKeyInput = string | null | undefined;
2
+ export declare function requireStableKey(value: StableKeyInput, field?: string): string;
3
3
  /**
4
4
  * Namespace a stable key without truncating it or creating prefix collisions.
5
5
  * Dynamic identifiers participate in the candidate hash, while the bounded
6
6
  * internal scope keeps the fallback readable and within provider limits.
7
7
  */
8
- export declare function scopedStableKey(value: unknown, scope: string, components?: readonly string[]): string;
8
+ export declare function scopedStableKey(value: StableKeyInput, scope: string, components?: readonly string[]): string;
9
+ export {};
9
10
  //# sourceMappingURL=idempotency.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"idempotency.d.ts","sourceRoot":"","sources":["../../src/shared/idempotency.ts"],"names":[],"mappings":"AAKA,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAmB,GAAG,MAAM,CAUjF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,SAAS,MAAM,EAAO,GACjC,MAAM,CAmBR"}
1
+ {"version":3,"file":"idempotency.d.ts","sourceRoot":"","sources":["../../src/shared/idempotency.ts"],"names":[],"mappings":"AAKA,KAAK,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAShD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,SAAmB,GAAG,MAAM,CAMxF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,SAAS,MAAM,EAAO,GACjC,MAAM,CAwBR"}
@@ -1,15 +1,19 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { z } from "zod";
2
3
  const MAX_IDEMPOTENCY_KEY_LENGTH = 255;
3
4
  const INTERNAL_SCOPE_RE = /^[a-z][a-z0-9-]{0,47}$/u;
4
5
  /** Validate a caller-owned replay key without silently rewriting it. */
6
+ const stableKeySchema = z
7
+ .string()
8
+ .min(1)
9
+ .refine((value) => value === value.trim())
10
+ .refine((value) => Array.from(value).length <= MAX_IDEMPOTENCY_KEY_LENGTH);
5
11
  export function requireStableKey(value, field = "idempotencyKey") {
6
- if (typeof value !== "string" ||
7
- value.length === 0 ||
8
- value !== value.trim() ||
9
- Array.from(value).length > MAX_IDEMPOTENCY_KEY_LENGTH) {
12
+ const parsed = stableKeySchema.safeParse(value);
13
+ if (!parsed.success) {
10
14
  throw new TypeError(`${field} must be a trimmed non-empty string of at most 255 characters`);
11
15
  }
12
- return value;
16
+ return parsed.data;
13
17
  }
14
18
  /**
15
19
  * Namespace a stable key without truncating it or creating prefix collisions.
@@ -18,17 +22,24 @@ export function requireStableKey(value, field = "idempotencyKey") {
18
22
  */
19
23
  export function scopedStableKey(value, scope, components = []) {
20
24
  const key = requireStableKey(value);
21
- if (!INTERNAL_SCOPE_RE.test(scope)) {
25
+ const parsedScope = z.string().regex(INTERNAL_SCOPE_RE).safeParse(scope);
26
+ if (!parsedScope.success) {
22
27
  throw new TypeError("scope must be a short lowercase internal label");
23
28
  }
24
- if (components.some((component) => typeof component !== "string" || !component || component !== component.trim())) {
29
+ const parsedComponents = z
30
+ .array(z
31
+ .string()
32
+ .min(1)
33
+ .refine((component) => component === component.trim()))
34
+ .safeParse(components);
35
+ if (!parsedComponents.success) {
25
36
  throw new TypeError("scope components must be non-empty trimmed strings");
26
37
  }
27
- const encodedComponents = components.map((component) => `${Array.from(component).length}#${component}`);
28
- const candidate = [key, scope, ...encodedComponents].join(":");
38
+ const encodedComponents = parsedComponents.data.map((component) => `${Array.from(component).length}#${component}`);
39
+ const candidate = [key, parsedScope.data, ...encodedComponents].join(":");
29
40
  if (Array.from(candidate).length <= MAX_IDEMPOTENCY_KEY_LENGTH)
30
41
  return candidate;
31
42
  const digest = createHash("sha256").update(candidate, "utf8").digest("hex");
32
- return `bursar:${scope}:${digest}`;
43
+ return `bursar:${parsedScope.data}:${digest}`;
33
44
  }
34
45
  //# sourceMappingURL=idempotency.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"idempotency.js","sourceRoot":"","sources":["../../src/shared/idempotency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AACvC,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD,wEAAwE;AACxE,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,KAAK,GA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C,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,OAAO,UAAU,KAAK,IAAI,MAAM,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\n\nconst MAX_IDEMPOTENCY_KEY_LENGTH = 255;\nconst INTERNAL_SCOPE_RE = /^[a-z][a-z0-9-]{0,47}$/u;\n\n/** Validate a caller-owned replay key without silently rewriting it. */\nexport function requireStableKey(value: unknown, field = \"idempotencyKey\"): string {\n if (\n typeof value !== \"string\" ||\n value.length === 0 ||\n value !== value.trim() ||\n Array.from(value).length > MAX_IDEMPOTENCY_KEY_LENGTH\n ) {\n throw new TypeError(`${field} must be a trimmed non-empty string of at most 255 characters`);\n }\n return value;\n}\n\n/**\n * Namespace a stable key without truncating it or creating prefix collisions.\n * Dynamic identifiers participate in the candidate hash, while the bounded\n * internal scope keeps the fallback readable and within provider limits.\n */\nexport function scopedStableKey(\n value: unknown,\n scope: string,\n components: readonly string[] = [],\n): string {\n const key = requireStableKey(value);\n if (!INTERNAL_SCOPE_RE.test(scope)) {\n throw new TypeError(\"scope must be a short lowercase internal label\");\n }\n if (\n components.some(\n (component) => typeof component !== \"string\" || !component || component !== component.trim(),\n )\n ) {\n throw new TypeError(\"scope components must be non-empty trimmed strings\");\n }\n const encodedComponents = components.map(\n (component) => `${Array.from(component).length}#${component}`,\n );\n const candidate = [key, scope, ...encodedComponents].join(\":\");\n if (Array.from(candidate).length <= MAX_IDEMPOTENCY_KEY_LENGTH) return candidate;\n const digest = createHash(\"sha256\").update(candidate, \"utf8\").digest(\"hex\");\n return `bursar:${scope}:${digest}`;\n}\n"]}
1
+ {"version":3,"file":"idempotency.js","sourceRoot":"","sources":["../../src/shared/idempotency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAA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AE,CAAC,CACzD;SACA,SAAS,CAAC,UAAU,CAAC,CAAC;IACzB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CACjD,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,IAAI,SAAS,EAAE,CAC9D,CAAC;IACF,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,EAAE,GAAG,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,IAAI,0BAA0B;QAAE,OAAO,SAAS,CAAC;IACjF,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,OAAO,UAAU,WAAW,CAAC,IAAI,IAAI,MAAM,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { z } from \"zod\";\n\nconst MAX_IDEMPOTENCY_KEY_LENGTH = 255;\nconst INTERNAL_SCOPE_RE = /^[a-z][a-z0-9-]{0,47}$/u;\ntype StableKeyInput = string | null | undefined;\n\n/** Validate a caller-owned replay key without silently rewriting it. */\nconst stableKeySchema = z\n .string()\n .min(1)\n .refine((value) => value === value.trim())\n .refine((value) => Array.from(value).length <= MAX_IDEMPOTENCY_KEY_LENGTH);\n\nexport function requireStableKey(value: StableKeyInput, field = \"idempotencyKey\"): string {\n const parsed = stableKeySchema.safeParse(value);\n if (!parsed.success) {\n throw new TypeError(`${field} must be a trimmed non-empty string of at most 255 characters`);\n }\n return parsed.data;\n}\n\n/**\n * Namespace a stable key without truncating it or creating prefix collisions.\n * Dynamic identifiers participate in the candidate hash, while the bounded\n * internal scope keeps the fallback readable and within provider limits.\n */\nexport function scopedStableKey(\n value: StableKeyInput,\n scope: string,\n components: readonly string[] = [],\n): string {\n const key = requireStableKey(value);\n const parsedScope = z.string().regex(INTERNAL_SCOPE_RE).safeParse(scope);\n if (!parsedScope.success) {\n throw new TypeError(\"scope must be a short lowercase internal label\");\n }\n const parsedComponents = z\n .array(\n z\n .string()\n .min(1)\n .refine((component) => component === component.trim()),\n )\n .safeParse(components);\n if (!parsedComponents.success) {\n throw new TypeError(\"scope components must be non-empty trimmed strings\");\n }\n const encodedComponents = parsedComponents.data.map(\n (component) => `${Array.from(component).length}#${component}`,\n );\n const candidate = [key, parsedScope.data, ...encodedComponents].join(\":\");\n if (Array.from(candidate).length <= MAX_IDEMPOTENCY_KEY_LENGTH) return candidate;\n const digest = createHash(\"sha256\").update(candidate, \"utf8\").digest(\"hex\");\n return `bursar:${parsedScope.data}:${digest}`;\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import type { Decimal } from "decimal.js";
2
+ /** JSON values accepted at configuration and persistence boundaries. */
3
+ export type JsonPrimitive = string | number | boolean | null;
4
+ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
5
+ export interface JsonObject {
6
+ [key: string]: JsonValue;
7
+ }
8
+ /** Values accepted from provider SDK envelopes before field-level validation. */
9
+ export type ExternalValue = JsonPrimitive | undefined | Date | ExternalObject | ExternalValue[];
10
+ export interface ExternalObject {
11
+ [key: string]: ExternalValue;
12
+ }
13
+ /** Structured application metadata may retain exact Decimal instances. */
14
+ export type StructuredValue = JsonPrimitive | bigint | undefined | Decimal | StructuredObject | StructuredValue[];
15
+ export interface StructuredObject {
16
+ [key: string]: StructuredValue;
17
+ }
18
+ /** Values the PostgreSQL driver can encode or return without stringification. */
19
+ export type PostgresValue = StructuredValue | PostgresRow | Date | Uint8Array;
20
+ export type PostgresRow = {
21
+ [key: string]: PostgresValue;
22
+ };
23
+ export type PostgresParams = (PostgresValue | undefined)[];
24
+ export declare function isPostgresRow(value: PostgresValue): value is PostgresRow;
25
+ /** Check the object shape produced by JSON/YAML decoding without coercion. */
26
+ export declare function isJsonObject<T>(value: T): value is T & JsonObject;
27
+ export declare function isExternalObject<T>(value: T): value is T & ExternalObject;
28
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/shared/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,EAAE,CAAC;AAEjE,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,SAAS,GAAG,IAAI,GAAG,cAAc,GAAG,aAAa,EAAE,CAAC;AAEhG,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAC9B;AAiBD,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GACvB,aAAa,GACb,MAAM,GACN,SAAS,GACT,OAAO,GACP,gBAAgB,GAChB,eAAe,EAAE,CAAC;AAEtB,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;CAChC;AAED,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,WAAW,GAAG,IAAI,GAAG,UAAU,CAAC;AAE9E,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC;AAE3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,WAAW,CAUxE;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,UAAU,CAMjE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,cAAc,CAMzE"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ const externalValueSchema = z.lazy(() => z.union([
3
+ z.string(),
4
+ z.number(),
5
+ z.boolean(),
6
+ z.null(),
7
+ z.undefined(),
8
+ z.date(),
9
+ z.array(externalValueSchema),
10
+ z.record(z.string(), externalValueSchema),
11
+ ]));
12
+ const externalObjectSchema = z.record(z.string(), externalValueSchema);
13
+ const jsonObjectSchema = z.record(z.string(), z.json());
14
+ export function isPostgresRow(value) {
15
+ try {
16
+ return (value !== null &&
17
+ !Array.isArray(value) &&
18
+ Object.prototype.toString.call(value) === "[object Object]");
19
+ }
20
+ catch {
21
+ return false;
22
+ }
23
+ }
24
+ /** Check the object shape produced by JSON/YAML decoding without coercion. */
25
+ export function isJsonObject(value) {
26
+ try {
27
+ return jsonObjectSchema.safeParse(value).success;
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ }
33
+ export function isExternalObject(value) {
34
+ try {
35
+ return externalObjectSchema.safeParse(value).success;
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ }
41
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/shared/json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,MAAM,mBAAmB,GAA6B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAChE,CAAC,CAAC,KAAK,CA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AAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import type { Decimal } from \"decimal.js\";\nimport { z } from \"zod\";\n\n/** JSON values accepted at configuration and persistence boundaries. */\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue = JsonPrimitive | JsonObject | JsonValue[];\n\nexport interface JsonObject {\n [key: string]: JsonValue;\n}\n\n/** Values accepted from provider SDK envelopes before field-level validation. */\nexport type ExternalValue = JsonPrimitive | undefined | Date | ExternalObject | ExternalValue[];\n\nexport interface ExternalObject {\n [key: string]: ExternalValue;\n}\n\nconst externalValueSchema: z.ZodType<ExternalValue> = z.lazy(() =>\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.undefined(),\n z.date(),\n z.array(externalValueSchema),\n z.record(z.string(), externalValueSchema),\n ]),\n);\nconst externalObjectSchema: z.ZodType<ExternalObject> = z.record(z.string(), externalValueSchema);\nconst jsonObjectSchema: z.ZodType<JsonObject> = z.record(z.string(), z.json());\n\n/** Structured application metadata may retain exact Decimal instances. */\nexport type StructuredValue =\n | JsonPrimitive\n | bigint\n | undefined\n | Decimal\n | StructuredObject\n | StructuredValue[];\n\nexport interface StructuredObject {\n [key: string]: StructuredValue;\n}\n\n/** Values the PostgreSQL driver can encode or return without stringification. */\nexport type PostgresValue = StructuredValue | PostgresRow | Date | Uint8Array;\n\nexport type PostgresRow = {\n [key: string]: PostgresValue;\n};\n\nexport type PostgresParams = (PostgresValue | undefined)[];\n\nexport function isPostgresRow(value: PostgresValue): value is PostgresRow {\n try {\n return (\n value !== null &&\n !Array.isArray(value) &&\n Object.prototype.toString.call(value) === \"[object Object]\"\n );\n } catch {\n return false;\n }\n}\n\n/** Check the object shape produced by JSON/YAML decoding without coercion. */\nexport function isJsonObject<T>(value: T): value is T & JsonObject {\n try {\n return jsonObjectSchema.safeParse(value).success;\n } catch {\n return false;\n }\n}\n\nexport function isExternalObject<T>(value: T): value is T & ExternalObject {\n try {\n return externalObjectSchema.safeParse(value).success;\n } catch {\n return false;\n }\n}\n"]}
@@ -1,8 +1,14 @@
1
+ import type { StructuredValue } from "./json.js";
2
+ export type LogContextValue = StructuredValue | Date | Error;
3
+ export interface LogContext {
4
+ [key: string]: LogContextValue;
5
+ }
6
+ export type LoggerMethod = (message: string, context?: LogContext) => void | PromiseLike<void>;
1
7
  export interface Logger {
2
- debug?: (message: string, context?: Record<string, unknown>) => void;
3
- info?: (message: string, context?: Record<string, unknown>) => void;
4
- warn?: (message: string, context?: Record<string, unknown>) => void;
5
- error?: (message: string, context?: Record<string, unknown>) => void;
8
+ debug?: LoggerMethod;
9
+ info?: LoggerMethod;
10
+ warn?: LoggerMethod;
11
+ error?: LoggerMethod;
6
12
  }
7
13
  export type NormalizedLogger = Required<Logger>;
8
14
  export declare const noopLogger: NormalizedLogger;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACtE;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAEhD,eAAO,MAAM,UAAU,EAAE,gBAKxB,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,gBAAgB,CAOxE"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,IAAI,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;AAE/F,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAEhD,eAAO,MAAM,UAAU,EAAE,gBAKxB,CAAC;AAgBF,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,gBAAgB,CAoBxE"}
@@ -4,12 +4,36 @@ export const noopLogger = {
4
4
  warn: () => { },
5
5
  error: () => { },
6
6
  };
7
+ function isolateLoggerMethod(method, receiver) {
8
+ return (message, context) => {
9
+ let result;
10
+ try {
11
+ result = method.call(receiver, message, context);
12
+ }
13
+ catch {
14
+ return;
15
+ }
16
+ // Logging is diagnostic side effect only. A rejected injected logger must
17
+ // never become an unhandled rejection or change billing behavior.
18
+ if (result != null)
19
+ void Promise.resolve(result).catch(() => { });
20
+ };
21
+ }
7
22
  export function normalizeLogger(logger) {
23
+ const source = logger ?? {};
8
24
  return {
9
- debug: logger?.debug ?? noopLogger.debug,
10
- info: logger?.info ?? noopLogger.info,
11
- warn: logger?.warn ?? noopLogger.warn,
12
- error: logger?.error ?? noopLogger.error,
25
+ debug: typeof source.debug === "function"
26
+ ? isolateLoggerMethod(source.debug, source)
27
+ : noopLogger.debug,
28
+ info: typeof source.info === "function"
29
+ ? isolateLoggerMethod(source.info, source)
30
+ : noopLogger.info,
31
+ warn: typeof source.warn === "function"
32
+ ? isolateLoggerMethod(source.warn, source)
33
+ : noopLogger.warn,
34
+ error: typeof source.error === "function"
35
+ ? isolateLoggerMethod(source.error, source)
36
+ : noopLogger.error,
13
37
  };
14
38
  }
15
39
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,UAAU,GAAqB;IAC1C,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,MAAsB;IACpD,OAAO;QACL,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,UAAU,CAAC,KAAK;QACxC,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,UAAU,CAAC,IAAI;QACrC,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,UAAU,CAAC,IAAI;QACrC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,UAAU,CAAC,KAAK;KACzC,CAAC;AACJ,CAAC","sourcesContent":["export interface Logger {\n debug?: (message: string, context?: Record<string, unknown>) => void;\n info?: (message: string, context?: Record<string, unknown>) => void;\n warn?: (message: string, context?: Record<string, unknown>) => void;\n error?: (message: string, context?: Record<string, unknown>) => void;\n}\n\nexport type NormalizedLogger = Required<Logger>;\n\nexport const noopLogger: NormalizedLogger = {\n debug: () => {},\n info: () => {},\n warn: () => {},\n error: () => {},\n};\n\nexport function normalizeLogger(logger?: Logger | null): NormalizedLogger {\n return {\n debug: logger?.debug ?? noopLogger.debug,\n info: logger?.info ?? noopLogger.info,\n warn: logger?.warn ?? noopLogger.warn,\n error: logger?.error ?? noopLogger.error,\n };\n}\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,UAAU,GAAqB;IAC1C,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC;AAEF,SAAS,mBAAmB,CAAC,MAAoB,EAAE,QAAgB;IACjE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QAC1B,IAAI,MAAgC,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,0EAA0E;QAC1E,kEAAkE;QAClE,IAAI,MAAM,IAAI,IAAI;YAAE,KAAK,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAsB;IACpD,MAAM,MAAM,GAAW,MAAM,IAAI,EAAE,CAAC;IACpC,OAAO;QACL,KAAK,EACH,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU;YAChC,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;YAC3C,CAAC,CAAC,UAAU,CAAC,KAAK;QACtB,IAAI,EACF,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU;YAC/B,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;YAC1C,CAAC,CAAC,UAAU,CAAC,IAAI;QACrB,IAAI,EACF,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU;YAC/B,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;YAC1C,CAAC,CAAC,UAAU,CAAC,IAAI;QACrB,KAAK,EACH,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU;YAChC,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;YAC3C,CAAC,CAAC,UAAU,CAAC,KAAK;KACvB,CAAC;AACJ,CAAC","sourcesContent":["import type { StructuredValue } from \"./json.js\";\n\nexport type LogContextValue = StructuredValue | Date | Error;\n\nexport interface LogContext {\n [key: string]: LogContextValue;\n}\n\nexport type LoggerMethod = (message: string, context?: LogContext) => void | PromiseLike<void>;\n\nexport interface Logger {\n debug?: LoggerMethod;\n info?: LoggerMethod;\n warn?: LoggerMethod;\n error?: LoggerMethod;\n}\n\nexport type NormalizedLogger = Required<Logger>;\n\nexport const noopLogger: NormalizedLogger = {\n debug: () => {},\n info: () => {},\n warn: () => {},\n error: () => {},\n};\n\nfunction isolateLoggerMethod(method: LoggerMethod, receiver: Logger): LoggerMethod {\n return (message, context) => {\n let result: void | PromiseLike<void>;\n try {\n result = method.call(receiver, message, context);\n } catch {\n return;\n }\n // Logging is diagnostic side effect only. A rejected injected logger must\n // never become an unhandled rejection or change billing behavior.\n if (result != null) void Promise.resolve(result).catch(() => {});\n };\n}\n\nexport function normalizeLogger(logger?: Logger | null): NormalizedLogger {\n const source: Logger = logger ?? {};\n return {\n debug:\n typeof source.debug === \"function\"\n ? isolateLoggerMethod(source.debug, source)\n : noopLogger.debug,\n info:\n typeof source.info === \"function\"\n ? isolateLoggerMethod(source.info, source)\n : noopLogger.info,\n warn:\n typeof source.warn === \"function\"\n ? isolateLoggerMethod(source.warn, source)\n : noopLogger.warn,\n error:\n typeof source.error === \"function\"\n ? isolateLoggerMethod(source.error, source)\n : noopLogger.error,\n };\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  import { type BursarError } from "../errors.js";
2
+ import { type Instrumentation } from "../telemetry/index.js";
2
3
  import { type ProviderEnvironment } from "../providers/environment.js";
3
4
  import type { QueryFn } from "./postgres-types.js";
4
- import { type Instrumentation } from "../telemetry/index.js";
5
+ import type { PostgresParams, PostgresRow } from "./json.js";
5
6
  export interface PostgresPoolConfig {
6
7
  connectionString: string;
7
8
  connectionTimeoutMillis?: number;
@@ -13,22 +14,23 @@ export interface PostgresPoolConfig {
13
14
  application_name?: string;
14
15
  }
15
16
  export interface PostgresPool {
16
- query(text: string, params?: unknown[]): Promise<{
17
- rows: unknown[];
17
+ query(text: string, params?: PostgresParams): Promise<{
18
+ rows: PostgresRow[];
18
19
  }>;
19
20
  connect(): Promise<PostgresPoolClient>;
20
21
  end(): Promise<void>;
21
- on?(event: "error", listener: (error: Error) => void): unknown;
22
+ on?(event: "error", listener: (error: Error) => void): void;
22
23
  }
23
24
  export interface PostgresPoolClient {
24
- query(text: string, params?: unknown[]): Promise<{
25
- rows: unknown[];
25
+ query(text: string, params?: PostgresParams): Promise<{
26
+ rows: PostgresRow[];
26
27
  }>;
27
28
  release(error?: Error | boolean): void;
28
29
  }
29
30
  export interface PostgresPoolConstructor {
30
31
  new (config: PostgresPoolConfig): PostgresPool;
31
32
  }
33
+ export declare function isPostgresPool<T>(value: T): value is T & PostgresPool;
32
34
  /** PostgreSQL deadline, pool, and observability controls. */
33
35
  export interface PostgresConnectionOptions {
34
36
  /** Financial provider namespace. Low-level credit-only clients default to `live`. */
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-client.d.ts","sourceRoot":"","sources":["../../src/shared/postgres-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAsD,MAAM,cAAc,C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