@axiumine/koa-utils 8.0.0 → 9.1.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 (431) hide show
  1. package/LICENSE +658 -228
  2. package/README.md +8 -4
  3. package/dist/dataSources/PostgreSQL.mjs +5 -5
  4. package/dist/email/SocketLabsLib.d.mts +2 -1
  5. package/dist/email/SocketLabsLib.mjs +5 -3
  6. package/dist/files/storeUploadAsTemp.mjs +2 -0
  7. package/dist/graphQL/schema/mutations/emailChangeHashVerify.mjs +2 -1
  8. package/dist/graphQL/schema/mutations/logout.mjs +1 -1
  9. package/dist/graphQL/schema/mutations/resetPwd.mjs +3 -1
  10. package/dist/koa/middleware/authenticatedAuthorizationHandler/index.d.mts +1 -1
  11. package/dist/koa/middleware/authenticatedAuthorizationHandler/verifySignedRefreshToken.mjs +12 -9
  12. package/dist/koa/middleware/authenticatedLogoutHandler/index.d.mts +1 -1
  13. package/dist/koa/middleware/authenticatedResourceHandler/index.d.mts +1 -1
  14. package/dist/koa/middleware/debug/index.d.mts +1 -1
  15. package/dist/lib/ArrayLib.d.mts +0 -1
  16. package/dist/lib/ArrayLib.mjs +0 -1
  17. package/dist/lib/DateLib.mjs +1 -1
  18. package/dist/lib/MariaDB/throwSqlErrors.mjs +3 -1
  19. package/dist/lib/MongoDB/IMongoDBError.d.mts +2 -3
  20. package/dist/lib/MongoDB/throwIfMongoErr.mjs +4 -2
  21. package/dist/lib/NumLib.d.mts +0 -1
  22. package/dist/lib/NumLib.mjs +1 -1
  23. package/dist/lib/PostgreSQL/clock/CLOCK_SQL.d.mts +7 -0
  24. package/dist/lib/PostgreSQL/clock/CLOCK_SQL.mjs +8 -0
  25. package/dist/lib/PostgreSQL/clock/DB_NOW_SQL.d.mts +5 -0
  26. package/dist/lib/PostgreSQL/clock/DB_NOW_SQL.mjs +6 -0
  27. package/dist/lib/PostgreSQL/clock/IClock.d.mts +4 -0
  28. package/dist/lib/PostgreSQL/clock/IClock.mjs +2 -0
  29. package/dist/lib/PostgreSQL/clock/IDbClock.d.mts +11 -0
  30. package/dist/lib/PostgreSQL/clock/IDbClock.mjs +2 -0
  31. package/dist/lib/PostgreSQL/clock/IDbClockOptions.d.mts +11 -0
  32. package/dist/lib/PostgreSQL/clock/IDbClockOptions.mjs +2 -0
  33. package/dist/lib/PostgreSQL/clock/IDbClockSeam.d.mts +10 -0
  34. package/dist/lib/PostgreSQL/clock/IDbClockSeam.mjs +2 -0
  35. package/dist/lib/PostgreSQL/clock/createDbClock.d.mts +23 -0
  36. package/dist/lib/PostgreSQL/clock/createDbClock.mjs +54 -0
  37. package/dist/lib/PostgreSQL/clock/lockTaken.d.mts +11 -0
  38. package/dist/lib/PostgreSQL/clock/lockTaken.mjs +17 -0
  39. package/dist/lib/PostgreSQL/counter/IDbCounter.d.mts +9 -0
  40. package/dist/lib/PostgreSQL/counter/IDbCounter.mjs +2 -0
  41. package/dist/lib/PostgreSQL/error/DB_CLOCK_REASONS.d.mts +12 -0
  42. package/dist/lib/PostgreSQL/error/DB_CLOCK_REASONS.mjs +20 -0
  43. package/dist/lib/PostgreSQL/error/DB_CONNECT_REASONS.d.mts +11 -0
  44. package/dist/lib/PostgreSQL/error/DB_CONNECT_REASONS.mjs +12 -0
  45. package/dist/lib/PostgreSQL/error/DB_INTERNAL_REASONS.d.mts +23 -0
  46. package/dist/lib/PostgreSQL/error/DB_INTERNAL_REASONS.mjs +35 -0
  47. package/dist/lib/PostgreSQL/error/DB_PARSE_REASONS.d.mts +13 -0
  48. package/dist/lib/PostgreSQL/error/DB_PARSE_REASONS.mjs +14 -0
  49. package/dist/lib/PostgreSQL/error/DB_STATE_REASONS.d.mts +7 -0
  50. package/dist/lib/PostgreSQL/error/DB_STATE_REASONS.mjs +8 -0
  51. package/dist/lib/PostgreSQL/error/DB_TX_REASONS.d.mts +9 -0
  52. package/dist/lib/PostgreSQL/error/DB_TX_REASONS.mjs +10 -0
  53. package/dist/lib/PostgreSQL/error/DbClockError.d.mts +6 -0
  54. package/dist/lib/PostgreSQL/error/DbClockError.mjs +27 -0
  55. package/dist/lib/PostgreSQL/error/DbConnectError.d.mts +11 -0
  56. package/dist/lib/PostgreSQL/error/DbConnectError.mjs +18 -0
  57. package/dist/lib/PostgreSQL/error/DbParseError.d.mts +11 -0
  58. package/dist/lib/PostgreSQL/error/DbParseError.mjs +16 -0
  59. package/dist/lib/PostgreSQL/error/DbStateError.d.mts +10 -0
  60. package/dist/lib/PostgreSQL/error/DbStateError.mjs +14 -0
  61. package/dist/lib/PostgreSQL/error/DbTxError.d.mts +6 -0
  62. package/dist/lib/PostgreSQL/error/DbTxError.mjs +10 -0
  63. package/dist/lib/PostgreSQL/error/IConstraintEntry.d.mts +17 -0
  64. package/dist/lib/PostgreSQL/error/IConstraintEntry.mjs +2 -0
  65. package/dist/lib/PostgreSQL/error/IConstraintEntryBuilder.d.mts +20 -0
  66. package/dist/lib/PostgreSQL/error/IConstraintEntryBuilder.mjs +2 -0
  67. package/dist/lib/PostgreSQL/error/IConstraintTable.d.mts +7 -0
  68. package/dist/lib/PostgreSQL/error/IConstraintTable.mjs +2 -0
  69. package/dist/lib/PostgreSQL/error/IDbClockReason.d.mts +3 -0
  70. package/dist/lib/PostgreSQL/error/IDbClockReason.mjs +2 -0
  71. package/dist/lib/PostgreSQL/error/IDbConnectReason.d.mts +3 -0
  72. package/dist/lib/PostgreSQL/error/IDbConnectReason.mjs +2 -0
  73. package/dist/lib/PostgreSQL/error/IDbErrorCounter.d.mts +4 -0
  74. package/dist/lib/PostgreSQL/error/IDbErrorCounter.mjs +2 -0
  75. package/dist/lib/PostgreSQL/error/IDbErrorCounterName.d.mts +7 -0
  76. package/dist/lib/PostgreSQL/error/IDbErrorCounterName.mjs +2 -0
  77. package/dist/lib/PostgreSQL/error/IDbErrorFactory.d.mts +16 -0
  78. package/dist/lib/PostgreSQL/error/IDbErrorFactory.mjs +2 -0
  79. package/dist/lib/PostgreSQL/error/IDbInternalReason.d.mts +3 -0
  80. package/dist/lib/PostgreSQL/error/IDbInternalReason.mjs +2 -0
  81. package/dist/lib/PostgreSQL/error/IDbParseReason.d.mts +3 -0
  82. package/dist/lib/PostgreSQL/error/IDbParseReason.mjs +2 -0
  83. package/dist/lib/PostgreSQL/error/IDbStateReason.d.mts +3 -0
  84. package/dist/lib/PostgreSQL/error/IDbStateReason.mjs +2 -0
  85. package/dist/lib/PostgreSQL/error/IDbTxReason.d.mts +3 -0
  86. package/dist/lib/PostgreSQL/error/IDbTxReason.mjs +2 -0
  87. package/dist/lib/PostgreSQL/error/ILockOrderReason.d.mts +3 -0
  88. package/dist/lib/PostgreSQL/error/ILockOrderReason.mjs +2 -0
  89. package/dist/lib/PostgreSQL/error/IMapDbErrorOptions.d.mts +22 -0
  90. package/dist/lib/PostgreSQL/error/IMapDbErrorOptions.mjs +2 -0
  91. package/dist/lib/PostgreSQL/error/IRoleAssertionReason.d.mts +3 -0
  92. package/dist/lib/PostgreSQL/error/IRoleAssertionReason.mjs +2 -0
  93. package/dist/lib/PostgreSQL/error/IRoleAssertionSubject.d.mts +12 -0
  94. package/dist/lib/PostgreSQL/error/IRoleAssertionSubject.mjs +2 -0
  95. package/dist/lib/PostgreSQL/error/LOCK_ORDER_REASONS.d.mts +11 -0
  96. package/dist/lib/PostgreSQL/error/LOCK_ORDER_REASONS.mjs +12 -0
  97. package/dist/lib/PostgreSQL/error/LockOrderError.d.mts +6 -0
  98. package/dist/lib/PostgreSQL/error/LockOrderError.mjs +10 -0
  99. package/dist/lib/PostgreSQL/error/ROLE_ASSERT_REASONS.d.mts +21 -0
  100. package/dist/lib/PostgreSQL/error/ROLE_ASSERT_REASONS.mjs +35 -0
  101. package/dist/lib/PostgreSQL/error/RoleAssertionError.d.mts +19 -0
  102. package/dist/lib/PostgreSQL/error/RoleAssertionError.mjs +58 -0
  103. package/dist/lib/PostgreSQL/error/buildConstraintEntry.d.mts +15 -0
  104. package/dist/lib/PostgreSQL/error/buildConstraintEntry.mjs +16 -0
  105. package/dist/lib/PostgreSQL/error/constraintNameOf.d.mts +6 -0
  106. package/dist/lib/PostgreSQL/error/constraintNameOf.mjs +17 -0
  107. package/dist/lib/PostgreSQL/error/errorNameOf.d.mts +5 -0
  108. package/dist/lib/PostgreSQL/error/errorNameOf.mjs +12 -0
  109. package/dist/lib/PostgreSQL/error/lookupConstraint.d.mts +7 -0
  110. package/dist/lib/PostgreSQL/error/lookupConstraint.mjs +8 -0
  111. package/dist/lib/PostgreSQL/error/mapDbError.d.mts +28 -0
  112. package/dist/lib/PostgreSQL/error/mapDbError.mjs +52 -0
  113. package/dist/lib/PostgreSQL/error/sqlstateField.d.mts +4 -0
  114. package/dist/lib/PostgreSQL/error/sqlstateField.mjs +5 -0
  115. package/dist/lib/PostgreSQL/error/sqlstateOf.d.mts +5 -0
  116. package/dist/lib/PostgreSQL/error/sqlstateOf.mjs +12 -0
  117. package/dist/lib/PostgreSQL/guard/IAffectedResult.d.mts +4 -0
  118. package/dist/lib/PostgreSQL/guard/IAffectedResult.mjs +2 -0
  119. package/dist/lib/PostgreSQL/guard/IGuardCounter.d.mts +3 -0
  120. package/dist/lib/PostgreSQL/guard/IGuardCounter.mjs +2 -0
  121. package/dist/lib/PostgreSQL/guard/IVersionGuardCode.d.mts +5 -0
  122. package/dist/lib/PostgreSQL/guard/IVersionGuardCode.mjs +2 -0
  123. package/dist/lib/PostgreSQL/guard/IVersionGuardField.d.mts +3 -0
  124. package/dist/lib/PostgreSQL/guard/IVersionGuardField.mjs +2 -0
  125. package/dist/lib/PostgreSQL/guard/IVersionGuardInput.d.mts +29 -0
  126. package/dist/lib/PostgreSQL/guard/IVersionGuardInput.mjs +2 -0
  127. package/dist/lib/PostgreSQL/guard/VERSION_GUARD_FIELDS.d.mts +2 -0
  128. package/dist/lib/PostgreSQL/guard/VERSION_GUARD_FIELDS.mjs +3 -0
  129. package/dist/lib/PostgreSQL/guard/assertAffected.d.mts +10 -0
  130. package/dist/lib/PostgreSQL/guard/assertAffected.mjs +17 -0
  131. package/dist/lib/PostgreSQL/guard/guardVersion.d.mts +21 -0
  132. package/dist/lib/PostgreSQL/guard/guardVersion.mjs +47 -0
  133. package/dist/lib/PostgreSQL/lock/CLAIM_LIMIT_MAX.d.mts +2 -0
  134. package/dist/lib/PostgreSQL/lock/CLAIM_LIMIT_MAX.mjs +3 -0
  135. package/dist/lib/PostgreSQL/lock/IClaimRegistry.d.mts +6 -0
  136. package/dist/lib/PostgreSQL/lock/IClaimRegistry.mjs +2 -0
  137. package/dist/lib/PostgreSQL/lock/IClaimRequest.d.mts +7 -0
  138. package/dist/lib/PostgreSQL/lock/IClaimRequest.mjs +2 -0
  139. package/dist/lib/PostgreSQL/lock/ILockAdmission.d.mts +4 -0
  140. package/dist/lib/PostgreSQL/lock/ILockAdmission.mjs +2 -0
  141. package/dist/lib/PostgreSQL/lock/ILockOrderSpec.d.mts +19 -0
  142. package/dist/lib/PostgreSQL/lock/ILockOrderSpec.mjs +2 -0
  143. package/dist/lib/PostgreSQL/lock/ILockOrderTracker.d.mts +41 -0
  144. package/dist/lib/PostgreSQL/lock/ILockOrderTracker.mjs +2 -0
  145. package/dist/lib/PostgreSQL/lock/ILockTrackerConfig.d.mts +5 -0
  146. package/dist/lib/PostgreSQL/lock/ILockTrackerConfig.mjs +2 -0
  147. package/dist/lib/PostgreSQL/lock/ILockTrackerOptions.d.mts +7 -0
  148. package/dist/lib/PostgreSQL/lock/ILockTrackerOptions.mjs +2 -0
  149. package/dist/lib/PostgreSQL/lock/IRowLockMode.d.mts +3 -0
  150. package/dist/lib/PostgreSQL/lock/IRowLockMode.mjs +2 -0
  151. package/dist/lib/PostgreSQL/lock/ROW_LOCK_MODES.d.mts +2 -0
  152. package/dist/lib/PostgreSQL/lock/ROW_LOCK_MODES.mjs +3 -0
  153. package/dist/lib/PostgreSQL/lock/claimRowsSkipLocked.d.mts +16 -0
  154. package/dist/lib/PostgreSQL/lock/claimRowsSkipLocked.mjs +32 -0
  155. package/dist/lib/PostgreSQL/lock/createLockOrderTracker.d.mts +14 -0
  156. package/dist/lib/PostgreSQL/lock/createLockOrderTracker.mjs +60 -0
  157. package/dist/lib/PostgreSQL/lock/lockedRow.d.mts +7 -0
  158. package/dist/lib/PostgreSQL/lock/lockedRow.mjs +12 -0
  159. package/dist/lib/PostgreSQL/lock/lockedRows.d.mts +3 -0
  160. package/dist/lib/PostgreSQL/lock/lockedRows.mjs +8 -0
  161. package/dist/lib/PostgreSQL/lock/rowLockModeOf.d.mts +3 -0
  162. package/dist/lib/PostgreSQL/lock/rowLockModeOf.mjs +9 -0
  163. package/dist/lib/PostgreSQL/lock/uuidOf.d.mts +2 -0
  164. package/dist/lib/PostgreSQL/lock/uuidOf.mjs +10 -0
  165. package/dist/lib/PostgreSQL/lock/uuidsOf.d.mts +5 -0
  166. package/dist/lib/PostgreSQL/lock/uuidsOf.mjs +13 -0
  167. package/dist/lib/PostgreSQL/parse/IArrayParser.d.mts +2 -0
  168. package/dist/lib/PostgreSQL/parse/IArrayParser.mjs +2 -0
  169. package/dist/lib/PostgreSQL/parse/IDriverTypes.d.mts +4 -0
  170. package/dist/lib/PostgreSQL/parse/IDriverTypes.mjs +2 -0
  171. package/dist/lib/PostgreSQL/parse/IStringParser.d.mts +2 -0
  172. package/dist/lib/PostgreSQL/parse/IStringParser.mjs +2 -0
  173. package/dist/lib/PostgreSQL/parse/ITypeParserEntry.d.mts +9 -0
  174. package/dist/lib/PostgreSQL/parse/ITypeParserEntry.mjs +2 -0
  175. package/dist/lib/PostgreSQL/parse/TYPE_PARSERS.d.mts +12 -0
  176. package/dist/lib/PostgreSQL/parse/TYPE_PARSERS.mjs +38 -0
  177. package/dist/lib/PostgreSQL/parse/arrayOf.d.mts +7 -0
  178. package/dist/lib/PostgreSQL/parse/arrayOf.mjs +50 -0
  179. package/dist/lib/PostgreSQL/parse/createTypeRegistry.d.mts +13 -0
  180. package/dist/lib/PostgreSQL/parse/createTypeRegistry.mjs +26 -0
  181. package/dist/lib/PostgreSQL/parse/parseDate.d.mts +7 -0
  182. package/dist/lib/PostgreSQL/parse/parseDate.mjs +19 -0
  183. package/dist/lib/PostgreSQL/parse/parseInt8.d.mts +6 -0
  184. package/dist/lib/PostgreSQL/parse/parseInt8.mjs +17 -0
  185. package/dist/lib/PostgreSQL/parse/parseTime.d.mts +7 -0
  186. package/dist/lib/PostgreSQL/parse/parseTime.mjs +24 -0
  187. package/dist/lib/PostgreSQL/parse/parseTimestamptz.d.mts +17 -0
  188. package/dist/lib/PostgreSQL/parse/parseTimestamptz.mjs +79 -0
  189. package/dist/lib/PostgreSQL/parse/parseUuid.d.mts +3 -0
  190. package/dist/lib/PostgreSQL/parse/parseUuid.mjs +9 -0
  191. package/dist/lib/PostgreSQL/pool/DEFAULT_CONNECT_TIMEOUT_MS.d.mts +2 -0
  192. package/dist/lib/PostgreSQL/pool/DEFAULT_CONNECT_TIMEOUT_MS.mjs +3 -0
  193. package/dist/lib/PostgreSQL/pool/DEFAULT_KEEPALIVE_INITIAL_DELAY_MS.d.mts +2 -0
  194. package/dist/lib/PostgreSQL/pool/DEFAULT_KEEPALIVE_INITIAL_DELAY_MS.mjs +3 -0
  195. package/dist/lib/PostgreSQL/pool/ICreatePoolOptions.d.mts +28 -0
  196. package/dist/lib/PostgreSQL/pool/ICreatePoolOptions.mjs +2 -0
  197. package/dist/lib/PostgreSQL/pool/IDbDriver.d.mts +12 -0
  198. package/dist/lib/PostgreSQL/pool/IDbDriver.mjs +2 -0
  199. package/dist/lib/PostgreSQL/pool/IPoolCounter.d.mts +4 -0
  200. package/dist/lib/PostgreSQL/pool/IPoolCounter.mjs +2 -0
  201. package/dist/lib/PostgreSQL/pool/IPoolCounterName.d.mts +7 -0
  202. package/dist/lib/PostgreSQL/pool/IPoolCounterName.mjs +2 -0
  203. package/dist/lib/PostgreSQL/pool/IPoolEvents.d.mts +4 -0
  204. package/dist/lib/PostgreSQL/pool/IPoolEvents.mjs +2 -0
  205. package/dist/lib/PostgreSQL/pool/IPoolLogger.d.mts +8 -0
  206. package/dist/lib/PostgreSQL/pool/IPoolLogger.mjs +2 -0
  207. package/dist/lib/PostgreSQL/pool/REQUIRED_SESSION_TIME_ZONE.d.mts +2 -0
  208. package/dist/lib/PostgreSQL/pool/REQUIRED_SESSION_TIME_ZONE.mjs +3 -0
  209. package/dist/lib/PostgreSQL/pool/createPool.d.mts +31 -0
  210. package/dist/lib/PostgreSQL/pool/createPool.mjs +67 -0
  211. package/dist/lib/PostgreSQL/role/IAssertRoleOptions.d.mts +10 -0
  212. package/dist/lib/PostgreSQL/role/IAssertRoleOptions.mjs +2 -0
  213. package/dist/lib/PostgreSQL/role/IRoleAssertion.d.mts +6 -0
  214. package/dist/lib/PostgreSQL/role/IRoleAssertion.mjs +2 -0
  215. package/dist/lib/PostgreSQL/role/IRoleGrant.d.mts +19 -0
  216. package/dist/lib/PostgreSQL/role/IRoleGrant.mjs +2 -0
  217. package/dist/lib/PostgreSQL/role/IRolePool.d.mts +6 -0
  218. package/dist/lib/PostgreSQL/role/IRolePool.mjs +2 -0
  219. package/dist/lib/PostgreSQL/role/assertRole.d.mts +36 -0
  220. package/dist/lib/PostgreSQL/role/assertRole.mjs +54 -0
  221. package/dist/lib/PostgreSQL/tx/DEFAULT_LOCK_TIMEOUT_MS.d.mts +2 -0
  222. package/dist/lib/PostgreSQL/tx/DEFAULT_LOCK_TIMEOUT_MS.mjs +3 -0
  223. package/dist/lib/PostgreSQL/tx/IRetryDelay.d.mts +2 -0
  224. package/dist/lib/PostgreSQL/tx/IRetryDelay.mjs +2 -0
  225. package/dist/lib/PostgreSQL/tx/ITx.d.mts +9 -0
  226. package/dist/lib/PostgreSQL/tx/ITx.mjs +2 -0
  227. package/dist/lib/PostgreSQL/tx/ITxClient.d.mts +12 -0
  228. package/dist/lib/PostgreSQL/tx/ITxClient.mjs +2 -0
  229. package/dist/lib/PostgreSQL/tx/ITxCounter.d.mts +4 -0
  230. package/dist/lib/PostgreSQL/tx/ITxCounter.mjs +2 -0
  231. package/dist/lib/PostgreSQL/tx/ITxCounterName.d.mts +10 -0
  232. package/dist/lib/PostgreSQL/tx/ITxCounterName.mjs +2 -0
  233. package/dist/lib/PostgreSQL/tx/ITxFailureReason.d.mts +3 -0
  234. package/dist/lib/PostgreSQL/tx/ITxFailureReason.mjs +2 -0
  235. package/dist/lib/PostgreSQL/tx/ITxIsolation.d.mts +3 -0
  236. package/dist/lib/PostgreSQL/tx/ITxIsolation.mjs +2 -0
  237. package/dist/lib/PostgreSQL/tx/ITxOptions.d.mts +27 -0
  238. package/dist/lib/PostgreSQL/tx/ITxOptions.mjs +2 -0
  239. package/dist/lib/PostgreSQL/tx/ITxPool.d.mts +5 -0
  240. package/dist/lib/PostgreSQL/tx/ITxPool.mjs +2 -0
  241. package/dist/lib/PostgreSQL/tx/ITxResult.d.mts +6 -0
  242. package/dist/lib/PostgreSQL/tx/ITxResult.mjs +2 -0
  243. package/dist/lib/PostgreSQL/tx/MAX_LOCK_TIMEOUT_MS.d.mts +2 -0
  244. package/dist/lib/PostgreSQL/tx/MAX_LOCK_TIMEOUT_MS.mjs +3 -0
  245. package/dist/lib/PostgreSQL/tx/TX_FAILURE_REASONS.d.mts +7 -0
  246. package/dist/lib/PostgreSQL/tx/TX_FAILURE_REASONS.mjs +8 -0
  247. package/dist/lib/PostgreSQL/tx/TX_ISOLATION_LEVELS.d.mts +2 -0
  248. package/dist/lib/PostgreSQL/tx/TX_ISOLATION_LEVELS.mjs +3 -0
  249. package/dist/lib/PostgreSQL/tx/TX_RETRY_BASE_DELAY_MS.d.mts +2 -0
  250. package/dist/lib/PostgreSQL/tx/TX_RETRY_BASE_DELAY_MS.mjs +3 -0
  251. package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX.d.mts +2 -0
  252. package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX.mjs +3 -0
  253. package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX_CEILING.d.mts +2 -0
  254. package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX_CEILING.mjs +3 -0
  255. package/dist/lib/PostgreSQL/tx/defaultRetryDelay.d.mts +3 -0
  256. package/dist/lib/PostgreSQL/tx/defaultRetryDelay.mjs +4 -0
  257. package/dist/lib/PostgreSQL/tx/jitteredDelay.d.mts +7 -0
  258. package/dist/lib/PostgreSQL/tx/jitteredDelay.mjs +16 -0
  259. package/dist/lib/PostgreSQL/tx/withTx.d.mts +39 -0
  260. package/dist/lib/PostgreSQL/tx/withTx.mjs +41 -0
  261. package/dist/lib/PostgreSQL/url/IDatabaseUrlOptions.d.mts +10 -0
  262. package/dist/lib/PostgreSQL/url/IDatabaseUrlOptions.mjs +2 -0
  263. package/dist/lib/PostgreSQL/url/IDatabaseUrlReason.d.mts +14 -0
  264. package/dist/lib/PostgreSQL/url/IDatabaseUrlReason.mjs +2 -0
  265. package/dist/lib/PostgreSQL/url/LOOPBACK_HOSTS.d.mts +2 -0
  266. package/dist/lib/PostgreSQL/url/LOOPBACK_HOSTS.mjs +3 -0
  267. package/dist/lib/PostgreSQL/url/databaseUrlReason.d.mts +20 -0
  268. package/dist/lib/PostgreSQL/url/databaseUrlReason.mjs +99 -0
  269. package/dist/lib/PostgreSQL/url/isAbsolutePath.d.mts +2 -0
  270. package/dist/lib/PostgreSQL/url/isAbsolutePath.mjs +14 -0
  271. package/dist/lib/PostgreSQL/url/isValidHost.d.mts +6 -0
  272. package/dist/lib/PostgreSQL/url/isValidHost.mjs +20 -0
  273. package/dist/lib/StringLib.d.mts +0 -1
  274. package/dist/lib/StringLib.mjs +0 -1
  275. package/dist/lib/db/log/logGraphql.d.mts +8 -6
  276. package/dist/lib/db/log/logGraphql.mjs +9 -23
  277. package/dist/lib/db/log/logThrow.d.mts +9 -0
  278. package/dist/lib/db/log/logThrow.mjs +11 -11
  279. package/dist/lib/hash.mjs +1 -6
  280. package/dist/lib/isSessionBlocked.d.mts +1 -1
  281. package/dist/lib/throwIfNotValidEnumValue.mjs +1 -0
  282. package/dist/lib/tryCatchRethrow.mjs +5 -3
  283. package/dist/private/files/reEncode.mjs +2 -0
  284. package/dist/private/lib/PostgreSQL/ICivilDate.d.mts +6 -0
  285. package/dist/private/lib/PostgreSQL/ICivilDate.mjs +2 -0
  286. package/dist/private/lib/PostgreSQL/IClientConstructor.d.mts +3 -0
  287. package/dist/private/lib/PostgreSQL/IClientConstructor.mjs +2 -0
  288. package/dist/private/lib/PostgreSQL/IClientShape.d.mts +10 -0
  289. package/dist/private/lib/PostgreSQL/IClientShape.mjs +2 -0
  290. package/dist/private/lib/PostgreSQL/IClockSlot.d.mts +11 -0
  291. package/dist/private/lib/PostgreSQL/IClockSlot.mjs +2 -0
  292. package/dist/private/lib/PostgreSQL/IConnectCallback.d.mts +2 -0
  293. package/dist/private/lib/PostgreSQL/IConnectCallback.mjs +2 -0
  294. package/dist/private/lib/PostgreSQL/IConnectSettings.d.mts +8 -0
  295. package/dist/private/lib/PostgreSQL/IConnectSettings.mjs +2 -0
  296. package/dist/private/lib/PostgreSQL/IHelperRank.d.mts +5 -0
  297. package/dist/private/lib/PostgreSQL/IHelperRank.mjs +2 -0
  298. package/dist/private/lib/PostgreSQL/IInternalSink.d.mts +9 -0
  299. package/dist/private/lib/PostgreSQL/IInternalSink.mjs +2 -0
  300. package/dist/private/lib/PostgreSQL/ILockOrderPlan.d.mts +8 -0
  301. package/dist/private/lib/PostgreSQL/ILockOrderPlan.mjs +2 -0
  302. package/dist/private/lib/PostgreSQL/IModeOrder.d.mts +7 -0
  303. package/dist/private/lib/PostgreSQL/IModeOrder.mjs +2 -0
  304. package/dist/private/lib/PostgreSQL/IPostgresState.d.mts +9 -0
  305. package/dist/private/lib/PostgreSQL/IPostgresState.mjs +2 -0
  306. package/dist/private/lib/PostgreSQL/IRoleCheck.d.mts +4 -0
  307. package/dist/private/lib/PostgreSQL/IRoleCheck.mjs +2 -0
  308. package/dist/private/lib/PostgreSQL/IRoleColumnCheck.d.mts +7 -0
  309. package/dist/private/lib/PostgreSQL/IRoleColumnCheck.mjs +2 -0
  310. package/dist/private/lib/PostgreSQL/IRoleObjectCheck.d.mts +6 -0
  311. package/dist/private/lib/PostgreSQL/IRoleObjectCheck.mjs +2 -0
  312. package/dist/private/lib/PostgreSQL/IRolePlan.d.mts +7 -0
  313. package/dist/private/lib/PostgreSQL/IRolePlan.mjs +2 -0
  314. package/dist/private/lib/PostgreSQL/IRoleRow.d.mts +2 -0
  315. package/dist/private/lib/PostgreSQL/IRoleRow.mjs +2 -0
  316. package/dist/private/lib/PostgreSQL/ITrackerState.d.mts +10 -0
  317. package/dist/private/lib/PostgreSQL/ITrackerState.mjs +2 -0
  318. package/dist/private/lib/PostgreSQL/ITxHandleState.d.mts +6 -0
  319. package/dist/private/lib/PostgreSQL/ITxHandleState.mjs +2 -0
  320. package/dist/private/lib/PostgreSQL/ITxSettings.d.mts +14 -0
  321. package/dist/private/lib/PostgreSQL/ITxSettings.mjs +2 -0
  322. package/dist/private/lib/PostgreSQL/POSTGRES_STATE_KEY.d.mts +5 -0
  323. package/dist/private/lib/PostgreSQL/POSTGRES_STATE_KEY.mjs +6 -0
  324. package/dist/private/lib/PostgreSQL/POSTGRES_STATE_LAYOUT.d.mts +6 -0
  325. package/dist/private/lib/PostgreSQL/POSTGRES_STATE_LAYOUT.mjs +7 -0
  326. package/dist/private/lib/PostgreSQL/ROLE_ATTRIBUTES.d.mts +2 -0
  327. package/dist/private/lib/PostgreSQL/ROLE_ATTRIBUTES.mjs +9 -0
  328. package/dist/private/lib/PostgreSQL/ROLE_CATALOG_SQL.d.mts +26 -0
  329. package/dist/private/lib/PostgreSQL/ROLE_CATALOG_SQL.mjs +84 -0
  330. package/dist/private/lib/PostgreSQL/ROLE_PRIVILEGES.d.mts +2 -0
  331. package/dist/private/lib/PostgreSQL/ROLE_PRIVILEGES.mjs +7 -0
  332. package/dist/private/lib/PostgreSQL/TX_BEGIN_STATEMENTS.d.mts +7 -0
  333. package/dist/private/lib/PostgreSQL/TX_BEGIN_STATEMENTS.mjs +11 -0
  334. package/dist/private/lib/PostgreSQL/admitLock.d.mts +10 -0
  335. package/dist/private/lib/PostgreSQL/admitLock.mjs +33 -0
  336. package/dist/private/lib/PostgreSQL/assertPoolOptions.d.mts +12 -0
  337. package/dist/private/lib/PostgreSQL/assertPoolOptions.mjs +19 -0
  338. package/dist/private/lib/PostgreSQL/assertVersionGuardInput.d.mts +6 -0
  339. package/dist/private/lib/PostgreSQL/assertVersionGuardInput.mjs +14 -0
  340. package/dist/private/lib/PostgreSQL/catalogFlag.d.mts +2 -0
  341. package/dist/private/lib/PostgreSQL/catalogFlag.mjs +7 -0
  342. package/dist/private/lib/PostgreSQL/catalogRow.d.mts +4 -0
  343. package/dist/private/lib/PostgreSQL/catalogRow.mjs +11 -0
  344. package/dist/private/lib/PostgreSQL/catalogRows.d.mts +8 -0
  345. package/dist/private/lib/PostgreSQL/catalogRows.mjs +12 -0
  346. package/dist/private/lib/PostgreSQL/catalogText.d.mts +2 -0
  347. package/dist/private/lib/PostgreSQL/catalogText.mjs +7 -0
  348. package/dist/private/lib/PostgreSQL/checkRoleOnClient.d.mts +10 -0
  349. package/dist/private/lib/PostgreSQL/checkRoleOnClient.mjs +31 -0
  350. package/dist/private/lib/PostgreSQL/checkedClient.d.mts +8 -0
  351. package/dist/private/lib/PostgreSQL/checkedClient.mjs +22 -0
  352. package/dist/private/lib/PostgreSQL/civilCalendar.d.mts +13 -0
  353. package/dist/private/lib/PostgreSQL/civilCalendar.mjs +48 -0
  354. package/dist/private/lib/PostgreSQL/clockInstant.d.mts +11 -0
  355. package/dist/private/lib/PostgreSQL/clockInstant.mjs +18 -0
  356. package/dist/private/lib/PostgreSQL/clockSlot.d.mts +3 -0
  357. package/dist/private/lib/PostgreSQL/clockSlot.mjs +11 -0
  358. package/dist/private/lib/PostgreSQL/clockStatement.d.mts +6 -0
  359. package/dist/private/lib/PostgreSQL/clockStatement.mjs +22 -0
  360. package/dist/private/lib/PostgreSQL/connectAndCheck.d.mts +8 -0
  361. package/dist/private/lib/PostgreSQL/connectAndCheck.mjs +47 -0
  362. package/dist/private/lib/PostgreSQL/constraintDetails.d.mts +7 -0
  363. package/dist/private/lib/PostgreSQL/constraintDetails.mjs +21 -0
  364. package/dist/private/lib/PostgreSQL/constraintField.d.mts +4 -0
  365. package/dist/private/lib/PostgreSQL/constraintField.mjs +5 -0
  366. package/dist/private/lib/PostgreSQL/errorCodeOf.d.mts +2 -0
  367. package/dist/private/lib/PostgreSQL/errorCodeOf.mjs +7 -0
  368. package/dist/private/lib/PostgreSQL/internalFailure.d.mts +9 -0
  369. package/dist/private/lib/PostgreSQL/internalFailure.mjs +10 -0
  370. package/dist/private/lib/PostgreSQL/isNameList.d.mts +2 -0
  371. package/dist/private/lib/PostgreSQL/isNameList.mjs +6 -0
  372. package/dist/private/lib/PostgreSQL/isOneOf.d.mts +2 -0
  373. package/dist/private/lib/PostgreSQL/isOneOf.mjs +5 -0
  374. package/dist/private/lib/PostgreSQL/isQualifiedName.d.mts +2 -0
  375. package/dist/private/lib/PostgreSQL/isQualifiedName.mjs +7 -0
  376. package/dist/private/lib/PostgreSQL/isRoleName.d.mts +2 -0
  377. package/dist/private/lib/PostgreSQL/isRoleName.mjs +7 -0
  378. package/dist/private/lib/PostgreSQL/lockOrderPlan.d.mts +8 -0
  379. package/dist/private/lib/PostgreSQL/lockOrderPlan.mjs +66 -0
  380. package/dist/private/lib/PostgreSQL/mapTypedError.d.mts +3 -0
  381. package/dist/private/lib/PostgreSQL/mapTypedError.mjs +28 -0
  382. package/dist/private/lib/PostgreSQL/mapViolation.d.mts +3 -0
  383. package/dist/private/lib/PostgreSQL/mapViolation.mjs +32 -0
  384. package/dist/private/lib/PostgreSQL/membershipOutsider.d.mts +7 -0
  385. package/dist/private/lib/PostgreSQL/membershipOutsider.mjs +17 -0
  386. package/dist/private/lib/PostgreSQL/missingColumn.d.mts +9 -0
  387. package/dist/private/lib/PostgreSQL/missingColumn.mjs +15 -0
  388. package/dist/private/lib/PostgreSQL/missingGrant.d.mts +5 -0
  389. package/dist/private/lib/PostgreSQL/missingGrant.mjs +7 -0
  390. package/dist/private/lib/PostgreSQL/missingObject.d.mts +10 -0
  391. package/dist/private/lib/PostgreSQL/missingObject.mjs +14 -0
  392. package/dist/private/lib/PostgreSQL/poolUrlSecrets.d.mts +8 -0
  393. package/dist/private/lib/PostgreSQL/poolUrlSecrets.mjs +41 -0
  394. package/dist/private/lib/PostgreSQL/postgresState.d.mts +7 -0
  395. package/dist/private/lib/PostgreSQL/postgresState.mjs +32 -0
  396. package/dist/private/lib/PostgreSQL/rankCheckOption.d.mts +2 -0
  397. package/dist/private/lib/PostgreSQL/rankCheckOption.mjs +7 -0
  398. package/dist/private/lib/PostgreSQL/readField.d.mts +5 -0
  399. package/dist/private/lib/PostgreSQL/readField.mjs +10 -0
  400. package/dist/private/lib/PostgreSQL/roleCheckOf.d.mts +7 -0
  401. package/dist/private/lib/PostgreSQL/roleCheckOf.mjs +39 -0
  402. package/dist/private/lib/PostgreSQL/roleFailureSubject.d.mts +7 -0
  403. package/dist/private/lib/PostgreSQL/roleFailureSubject.mjs +12 -0
  404. package/dist/private/lib/PostgreSQL/rolePlan.d.mts +7 -0
  405. package/dist/private/lib/PostgreSQL/rolePlan.mjs +26 -0
  406. package/dist/private/lib/PostgreSQL/runRoleChecks.d.mts +17 -0
  407. package/dist/private/lib/PostgreSQL/runRoleChecks.mjs +48 -0
  408. package/dist/private/lib/PostgreSQL/runTxAttempt.d.mts +12 -0
  409. package/dist/private/lib/PostgreSQL/runTxAttempt.mjs +50 -0
  410. package/dist/private/lib/PostgreSQL/runTxBody.d.mts +11 -0
  411. package/dist/private/lib/PostgreSQL/runTxBody.mjs +19 -0
  412. package/dist/private/lib/PostgreSQL/runTxWithRetries.d.mts +10 -0
  413. package/dist/private/lib/PostgreSQL/runTxWithRetries.mjs +31 -0
  414. package/dist/private/lib/PostgreSQL/scrubSecrets.d.mts +2 -0
  415. package/dist/private/lib/PostgreSQL/scrubSecrets.mjs +6 -0
  416. package/dist/private/lib/PostgreSQL/txFailure.d.mts +4 -0
  417. package/dist/private/lib/PostgreSQL/txFailure.mjs +7 -0
  418. package/dist/private/lib/PostgreSQL/txHandle.d.mts +9 -0
  419. package/dist/private/lib/PostgreSQL/txHandle.mjs +26 -0
  420. package/dist/private/lib/PostgreSQL/txSettings.d.mts +7 -0
  421. package/dist/private/lib/PostgreSQL/txSettings.mjs +48 -0
  422. package/dist/private/lib/PostgreSQL/versionText.d.mts +5 -0
  423. package/dist/private/lib/PostgreSQL/versionText.mjs +12 -0
  424. package/dist/private/lib/access/db/abandonUser.mjs +2 -3
  425. package/dist/private/lib/access/db/getResetPwd.mjs +4 -2
  426. package/dist/private/lib/access/db/setEmailHash.mjs +3 -1
  427. package/dist/private/lib/access/db/userData4VerifyEmail.d.mts +1 -1
  428. package/dist/private/lib/access/db/userData4VerifyEmail.mjs +4 -2
  429. package/dist/private/lib/access/handleIfHashBad.mjs +1 -0
  430. package/dist/private/lib/access/pathTools.mjs +2 -5
  431. package/package.json +504 -4
@@ -0,0 +1,31 @@
1
+ import { RoleAssertionError } from "../../../lib/PostgreSQL/error/RoleAssertionError.mjs";
2
+ import { runRoleChecks } from './runRoleChecks.mjs';
3
+ /**
4
+ * Checks out one connection, runs the checks on it and gives it back. A connection that emitted an error, or that
5
+ * failed in the middle of a query, is destroyed instead of returned to the pool; one that only failed an assertion is
6
+ * returned. The listener for the connection's `error` event is removed before the release, so a connection never goes
7
+ * back to the pool with it.
8
+ */
9
+ export async function checkRoleOnClient(pool, plan) {
10
+ const client = await pool.connect();
11
+ const state = { broken: false };
12
+ const onError = () => {
13
+ state.broken = true;
14
+ };
15
+ client.on('error', onError);
16
+ let grantsChecked;
17
+ try {
18
+ grantsChecked = await runRoleChecks(client, plan);
19
+ }
20
+ catch (error) {
21
+ if (!(error instanceof RoleAssertionError))
22
+ state.broken = true;
23
+ throw error;
24
+ }
25
+ finally {
26
+ client.removeListener('error', onError);
27
+ client.release(state.broken);
28
+ }
29
+ return { role: plan.role, grantsChecked };
30
+ }
31
+ //# sourceMappingURL=checkRoleOnClient.mjs.map
@@ -0,0 +1,8 @@
1
+ import type { IClientConstructor } from './IClientConstructor.mjs';
2
+ import type { IConnectSettings } from './IConnectSettings.mjs';
3
+ /**
4
+ * The subclass of the driver's client that every connection of the pool is made with (the `Client` option of the
5
+ * pool). Its `connect`, in the promise form and in the callback form pg-pool uses, runs the driver's connect, the login
6
+ * and the session check inside one deadline.
7
+ */
8
+ export declare function checkedClient(Base: IClientConstructor, settings: IConnectSettings): IClientConstructor;
@@ -0,0 +1,22 @@
1
+ import { connectAndCheck } from './connectAndCheck.mjs';
2
+ /**
3
+ * The subclass of the driver's client that every connection of the pool is made with (the `Client` option of the
4
+ * pool). Its `connect`, in the promise form and in the callback form pg-pool uses, runs the driver's connect, the login
5
+ * and the session check inside one deadline.
6
+ */
7
+ export function checkedClient(Base, settings) {
8
+ return class CheckedClient extends Base {
9
+ connect(callback) {
10
+ const done = connectAndCheck(this, () => super.connect(), settings);
11
+ if (callback === undefined)
12
+ return done;
13
+ done.then(() => {
14
+ callback(null);
15
+ }, (error) => {
16
+ callback(error);
17
+ });
18
+ return undefined;
19
+ }
20
+ };
21
+ }
22
+ //# sourceMappingURL=checkedClient.mjs.map
@@ -0,0 +1,13 @@
1
+ import type { ICivilDate } from './ICivilDate.mjs';
2
+ /** The first year the parsers return. */
3
+ export declare const MIN_YEAR = 1;
4
+ /** The last year the parsers return. */
5
+ export declare const MAX_YEAR = 9999;
6
+ /** Days since 1970-01-01 of the civil date; `month` is 1 to 12, `year` is astronomical (1 BC is 0). */
7
+ export declare function daysFromCivil(year: number, month: number, day: number): number;
8
+ /** The civil date of a count of days since 1970-01-01. */
9
+ export declare function civilFromDays(days: number): ICivilDate;
10
+ /** True for a real day of a real month of the proleptic Gregorian calendar. */
11
+ export declare function isCivilDate(year: number, month: number, day: number): boolean;
12
+ /** `value` as a decimal string, left-padded with zeros to `width`. */
13
+ export declare function pad(value: number, width: number): string;
@@ -0,0 +1,48 @@
1
+ // The proleptic Gregorian calendar, in whole days since 1970-01-01. These are the two algorithms of Howard Hinnant,
2
+ // "chrono-Compatible Low-Level Date Algorithms" (public domain), which PostgreSQL's own calendar agrees with. The
3
+ // unit tests check them against `Date.UTC` over a wide range, in the tests only: this module never touches `Date`.
4
+ /** The first year the parsers return. */
5
+ export const MIN_YEAR = 1;
6
+ /** The last year the parsers return. */
7
+ export const MAX_YEAR = 9999;
8
+ /** Days since 1970-01-01 of the civil date; `month` is 1 to 12, `year` is astronomical (1 BC is 0). */
9
+ export function daysFromCivil(year, month, day) {
10
+ const y = month <= 2 ? year - 1 : year;
11
+ const era = Math.floor(y / 400);
12
+ const yearOfEra = y - era * 400;
13
+ const dayOfYear = Math.floor((153 * ((month + 9) % 12) + 2) / 5) + day - 1;
14
+ const dayOfEra = yearOfEra * 365 + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100) + dayOfYear;
15
+ return era * 146097 + dayOfEra - 719468;
16
+ }
17
+ /** The civil date of a count of days since 1970-01-01. */
18
+ export function civilFromDays(days) {
19
+ const z = days + 719468;
20
+ const era = Math.floor(z / 146097);
21
+ const dayOfEra = z - era * 146097;
22
+ const yearOfEra = Math.floor((dayOfEra - Math.floor(dayOfEra / 1460) + Math.floor(dayOfEra / 36524) - Math.floor(dayOfEra / 146096)) / 365);
23
+ const dayOfYear = dayOfEra - (365 * yearOfEra + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100));
24
+ const monthIndex = Math.floor((5 * dayOfYear + 2) / 153);
25
+ const day = dayOfYear - Math.floor((153 * monthIndex + 2) / 5) + 1;
26
+ const month = monthIndex < 10 ? monthIndex + 3 : monthIndex - 9;
27
+ const year = yearOfEra + era * 400 + (month <= 2 ? 1 : 0);
28
+ return { year, month, day };
29
+ }
30
+ const isLeapYear = (year) => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
31
+ // Months 4, 6, 9 and 11 have 30 days, February 28 or 29, the rest 31. Computed, not looked up, so there is no
32
+ // indexed read that could be undefined.
33
+ function daysInMonth(year, month) {
34
+ if (month === 2)
35
+ return isLeapYear(year) ? 29 : 28;
36
+ return month === 4 || month === 6 || month === 9 || month === 11 ? 30 : 31;
37
+ }
38
+ /** True for a real day of a real month of the proleptic Gregorian calendar. */
39
+ export function isCivilDate(year, month, day) {
40
+ if (month < 1 || month > 12 || day < 1)
41
+ return false;
42
+ return day <= daysInMonth(year, month);
43
+ }
44
+ /** `value` as a decimal string, left-padded with zeros to `width`. */
45
+ export function pad(value, width) {
46
+ return String(value).padStart(width, '0');
47
+ }
48
+ //# sourceMappingURL=civilCalendar.mjs.map
@@ -0,0 +1,11 @@
1
+ /** The rows the clock statement answers: one row, one text column `ms`. */
2
+ interface IClockRow {
3
+ readonly ms?: unknown;
4
+ }
5
+ /**
6
+ * The instant in epoch milliseconds, from the rows of the clock statement. The one row must hold the text of a `bigint`:
7
+ * it goes through the `int8` rule (`parseInt8`: shape and 64-bit range), then through a safe-integer check, and only then
8
+ * becomes a JavaScript number. Anything else is `DbClockError` `BAD_RESULT` or `UNSAFE_INSTANT`.
9
+ */
10
+ export declare function clockInstant(rows: readonly IClockRow[]): number;
11
+ export {};
@@ -0,0 +1,18 @@
1
+ import { DbClockError } from "../../../lib/PostgreSQL/error/DbClockError.mjs";
2
+ import { parseInt8 } from "../../../lib/PostgreSQL/parse/parseInt8.mjs";
3
+ /**
4
+ * The instant in epoch milliseconds, from the rows of the clock statement. The one row must hold the text of a `bigint`:
5
+ * it goes through the `int8` rule (`parseInt8`: shape and 64-bit range), then through a safe-integer check, and only then
6
+ * becomes a JavaScript number. Anything else is `DbClockError` `BAD_RESULT` or `UNSAFE_INSTANT`.
7
+ */
8
+ export function clockInstant(rows) {
9
+ const value = rows[0]?.ms;
10
+ if (rows.length !== 1 || typeof value !== 'string')
11
+ throw new DbClockError('BAD_RESULT');
12
+ const milliseconds = BigInt(parseInt8(value));
13
+ if (milliseconds > BigInt(Number.MAX_SAFE_INTEGER) || milliseconds < BigInt(Number.MIN_SAFE_INTEGER)) {
14
+ throw new DbClockError('UNSAFE_INSTANT');
15
+ }
16
+ return Number(milliseconds);
17
+ }
18
+ //# sourceMappingURL=clockInstant.mjs.map
@@ -0,0 +1,3 @@
1
+ import type { IClockSlot } from './IClockSlot.mjs';
2
+ /** The slot of the transaction, made empty on first use. */
3
+ export declare function clockSlot(tx: object): IClockSlot;
@@ -0,0 +1,11 @@
1
+ import { postgresState } from './postgresState.mjs';
2
+ /** The slot of the transaction, made empty on first use. */
3
+ export function clockSlot(tx) {
4
+ let slot = postgresState.slots.get(tx);
5
+ if (slot === undefined) {
6
+ slot = { locked: false, instant: undefined, pending: undefined, read: undefined };
7
+ postgresState.slots.set(tx, slot);
8
+ }
9
+ return slot;
10
+ }
11
+ //# sourceMappingURL=clockSlot.mjs.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The statement a clock runs. No seam: `CLOCK_SQL`. A seam is checked in this order: it is an object, its statement is a
3
+ * non-empty text, its `allowed` is a boolean, and `allowed` is true. A seam that is not allowed is `DbClockError`
4
+ * `SEAM_REFUSED`, before anything touches the transaction. A `TypeError` for a seam out of its type.
5
+ */
6
+ export declare function clockStatement(seam: unknown): string;
@@ -0,0 +1,22 @@
1
+ import { CLOCK_SQL } from "../../../lib/PostgreSQL/clock/CLOCK_SQL.mjs";
2
+ import { DbClockError } from "../../../lib/PostgreSQL/error/DbClockError.mjs";
3
+ /**
4
+ * The statement a clock runs. No seam: `CLOCK_SQL`. A seam is checked in this order: it is an object, its statement is a
5
+ * non-empty text, its `allowed` is a boolean, and `allowed` is true. A seam that is not allowed is `DbClockError`
6
+ * `SEAM_REFUSED`, before anything touches the transaction. A `TypeError` for a seam out of its type.
7
+ */
8
+ export function clockStatement(seam) {
9
+ if (seam === undefined)
10
+ return CLOCK_SQL;
11
+ if (typeof seam !== 'object' || seam === null)
12
+ throw new TypeError('seam must be an object');
13
+ const { statement, allowed } = seam;
14
+ if (typeof statement !== 'string' || statement === '')
15
+ throw new TypeError('seam.statement must be a non-empty string');
16
+ if (typeof allowed !== 'boolean')
17
+ throw new TypeError('seam.allowed must be a boolean');
18
+ if (!allowed)
19
+ throw new DbClockError('SEAM_REFUSED');
20
+ return statement;
21
+ }
22
+ //# sourceMappingURL=clockStatement.mjs.map
@@ -0,0 +1,8 @@
1
+ import type { IClientShape } from './IClientShape.mjs';
2
+ import type { IConnectSettings } from './IConnectSettings.mjs';
3
+ /**
4
+ * The connect of one client: the driver's connect, then `SHOW timezone`, all inside one deadline of
5
+ * `connectTimeoutMs`. Resolves when the session is ready for the caller. On any failure it counts, logs the closed
6
+ * reason (never the text of the driver), ends the client and rejects with a `DbConnectError`.
7
+ */
8
+ export declare function connectAndCheck(client: IClientShape, connect: () => Promise<unknown>, settings: IConnectSettings): Promise<void>;
@@ -0,0 +1,47 @@
1
+ import { DbConnectError } from "../../../lib/PostgreSQL/error/DbConnectError.mjs";
2
+ import { REQUIRED_SESSION_TIME_ZONE } from "../../../lib/PostgreSQL/pool/REQUIRED_SESSION_TIME_ZONE.mjs";
3
+ import { errorCodeOf } from './errorCodeOf.mjs';
4
+ /** The error a failure of the connect, the login or the check is reported as. */
5
+ const connectErrorOf = (error) => error instanceof DbConnectError ? error : new DbConnectError('CONNECT_FAILED', errorCodeOf(error));
6
+ async function checkSessionZone(client) {
7
+ const answer = await client.query('SHOW timezone');
8
+ if (answer.rows[0]?.['TimeZone'] !== REQUIRED_SESSION_TIME_ZONE)
9
+ throw new DbConnectError('TIMEZONE_NOT_UTC');
10
+ }
11
+ /**
12
+ * The connect of one client: the driver's connect, then `SHOW timezone`, all inside one deadline of
13
+ * `connectTimeoutMs`. Resolves when the session is ready for the caller. On any failure it counts, logs the closed
14
+ * reason (never the text of the driver), ends the client and rejects with a `DbConnectError`.
15
+ */
16
+ export async function connectAndCheck(client, connect, settings) {
17
+ let timer;
18
+ const deadline = new Promise((_, reject) => {
19
+ timer = setTimeout(() => {
20
+ reject(new DbConnectError('CONNECT_TIMEOUT'));
21
+ }, settings.connectTimeoutMs);
22
+ });
23
+ // An async wrapper, so a `connect` that throws before it returns a promise is a rejection too, handled below.
24
+ const work = (async () => {
25
+ await connect();
26
+ await checkSessionZone(client);
27
+ })();
28
+ try {
29
+ await Promise.race([work, deadline]);
30
+ }
31
+ catch (error) {
32
+ const failure = connectErrorOf(error);
33
+ settings.count('db_pool_connect_failures_total');
34
+ settings.logger.warn('database connection refused', {
35
+ reason: failure.reason,
36
+ ...(failure.code === undefined ? {} : { errorCode: failure.code })
37
+ });
38
+ // The client is of no use. The end is not awaited: on a socket that never answers it may not settle, and the caller is
39
+ // waiting for this rejection.
40
+ client.end().catch(() => undefined);
41
+ throw failure;
42
+ }
43
+ finally {
44
+ clearTimeout(timer);
45
+ }
46
+ }
47
+ //# sourceMappingURL=connectAndCheck.mjs.map
@@ -0,0 +1,7 @@
1
+ import type { IConstraintEntry } from "../../../lib/PostgreSQL/error/IConstraintEntry.mjs";
2
+ /**
3
+ * The details of a row: the fixed ones, then the keys that the row lists from what the caller supplied. `undefined` for a
4
+ * row without details, and `null` when a listed key is missing. Only own keys of `supplied` count, and a key whose value is
5
+ * `undefined` is missing; an empty array or `false` is a value.
6
+ */
7
+ export declare function constraintDetails(entry: IConstraintEntry, supplied: Readonly<Record<string, unknown>> | undefined): Record<string, unknown> | null | undefined;
@@ -0,0 +1,21 @@
1
+ import { readField } from './readField.mjs';
2
+ /**
3
+ * The details of a row: the fixed ones, then the keys that the row lists from what the caller supplied. `undefined` for a
4
+ * row without details, and `null` when a listed key is missing. Only own keys of `supplied` count, and a key whose value is
5
+ * `undefined` is missing; an empty array or `false` is a value.
6
+ */
7
+ export function constraintDetails(entry, supplied) {
8
+ const keys = entry.supplied ?? [];
9
+ if (entry.fixed === undefined && keys.length === 0)
10
+ return undefined;
11
+ const given = supplied ?? {};
12
+ const pairs = [];
13
+ for (const key of keys) {
14
+ const value = Object.hasOwn(given, key) ? readField(given, key) : undefined;
15
+ if (value === undefined)
16
+ return null;
17
+ pairs.push([key, value]);
18
+ }
19
+ return { ...entry.fixed, ...Object.fromEntries(pairs) };
20
+ }
21
+ //# sourceMappingURL=constraintDetails.mjs.map
@@ -0,0 +1,4 @@
1
+ /** The log field for a constraint name: present only when the error named a plain identifier (see `constraintNameOf`). */
2
+ export declare function constraintField(name: string | undefined): {
3
+ constraint?: string;
4
+ };
@@ -0,0 +1,5 @@
1
+ /** The log field for a constraint name: present only when the error named a plain identifier (see `constraintNameOf`). */
2
+ export function constraintField(name) {
3
+ return name === undefined ? {} : { constraint: name };
4
+ }
5
+ //# sourceMappingURL=constraintField.mjs.map
@@ -0,0 +1,2 @@
1
+ /** A short code of an error (`ECONNREFUSED`, `28P01`), or `undefined` when it has no string `code`. */
2
+ export declare function errorCodeOf(error: unknown): string | undefined;
@@ -0,0 +1,7 @@
1
+ import { readField } from './readField.mjs';
2
+ /** A short code of an error (`ECONNREFUSED`, `28P01`), or `undefined` when it has no string `code`. */
3
+ export function errorCodeOf(error) {
4
+ const code = readField(error, 'code');
5
+ return typeof code === 'string' ? code : undefined;
6
+ }
7
+ //# sourceMappingURL=errorCodeOf.mjs.map
@@ -0,0 +1,9 @@
1
+ import type { IDbInternalReason } from "../../../lib/PostgreSQL/error/IDbInternalReason.mjs";
2
+ import type { IInternalSink } from './IInternalSink.mjs';
3
+ /**
4
+ * Counts, logs and builds the internal error of a closed reason, in that order. `fields` carries the reason and whatever
5
+ * safe fields the caller adds; it is the whole log payload, and only `fields.reason` goes to the factory.
6
+ */
7
+ export declare function internalFailure<TError extends Error, TName extends string>(sink: IInternalSink<TError, TName>, counterName: TName, message: string, fields: Readonly<Record<string, unknown>> & {
8
+ readonly reason: IDbInternalReason;
9
+ }): TError;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Counts, logs and builds the internal error of a closed reason, in that order. `fields` carries the reason and whatever
3
+ * safe fields the caller adds; it is the whole log payload, and only `fields.reason` goes to the factory.
4
+ */
5
+ export function internalFailure(sink, counterName, message, fields) {
6
+ sink.counter?.(counterName);
7
+ sink.logger.error(message, fields);
8
+ return sink.errors.internal(fields.reason);
9
+ }
10
+ //# sourceMappingURL=internalFailure.mjs.map
@@ -0,0 +1,2 @@
1
+ /** True for an array whose every entry is a plain identifier. The empty array is one. */
2
+ export declare function isNameList(value: unknown): value is readonly string[];
@@ -0,0 +1,6 @@
1
+ import { isRoleName } from './isRoleName.mjs';
2
+ /** True for an array whose every entry is a plain identifier. The empty array is one. */
3
+ export function isNameList(value) {
4
+ return Array.isArray(value) && value.every(isRoleName);
5
+ }
6
+ //# sourceMappingURL=isNameList.mjs.map
@@ -0,0 +1,2 @@
1
+ /** True for a string that is one of the listed words, compared as it is (case counts). */
2
+ export declare function isOneOf(list: readonly string[], value: unknown): value is string;
@@ -0,0 +1,5 @@
1
+ /** True for a string that is one of the listed words, compared as it is (case counts). */
2
+ export function isOneOf(list, value) {
3
+ return typeof value === 'string' && list.includes(value);
4
+ }
5
+ //# sourceMappingURL=isOneOf.mjs.map
@@ -0,0 +1,2 @@
1
+ /** True for a string of the form `schema.name`, each part a plain identifier. Three parts, quotes and spaces are refused. */
2
+ export declare function isQualifiedName(value: unknown): value is string;
@@ -0,0 +1,7 @@
1
+ /** Two plain identifiers joined by one dot. */
2
+ const QUALIFIED = /^[A-Za-z_][\w$]{0,62}\.[A-Za-z_][\w$]{0,62}$/;
3
+ /** True for a string of the form `schema.name`, each part a plain identifier. Three parts, quotes and spaces are refused. */
4
+ export function isQualifiedName(value) {
5
+ return typeof value === 'string' && QUALIFIED.test(value);
6
+ }
7
+ //# sourceMappingURL=isQualifiedName.mjs.map
@@ -0,0 +1,2 @@
1
+ /** True for a string that is a plain identifier. Quotes, dots, spaces and every other character are refused. */
2
+ export declare function isRoleName(value: unknown): value is string;
@@ -0,0 +1,7 @@
1
+ /** A plain unqualified identifier: a letter or `_`, then letters, digits, `_` or `$`, at most 63 characters (the limit of the server). */
2
+ const NAME = /^[A-Za-z_][\w$]{0,62}$/;
3
+ /** True for a string that is a plain identifier. Quotes, dots, spaces and every other character are refused. */
4
+ export function isRoleName(value) {
5
+ return typeof value === 'string' && NAME.test(value);
6
+ }
7
+ //# sourceMappingURL=isRoleName.mjs.map
@@ -0,0 +1,8 @@
1
+ import type { ILockOrderPlan } from './ILockOrderPlan.mjs';
2
+ /**
3
+ * Checks a lock-order spec and copies it into a plan. The checks that keep an order from being silently off: at least one
4
+ * mode, each order a non-empty list of distinct names, the default mode one of the modes, every helper mapped to a rank
5
+ * that exists in the order of a mode that exists, and every helper in at least one order. A `TypeError` names the part
6
+ * that is wrong and never quotes a value other than the name of a mode or a helper.
7
+ */
8
+ export declare function lockOrderPlan(spec: unknown): ILockOrderPlan;
@@ -0,0 +1,66 @@
1
+ /** True for a non-empty list of distinct, non-empty names. */
2
+ function isRankList(value) {
3
+ return (Array.isArray(value) &&
4
+ value.length > 0 &&
5
+ value.every((name) => typeof name === 'string' && name !== '') &&
6
+ new Set(value).size === value.length);
7
+ }
8
+ /** One empty order per mode of the spec. A `TypeError` for no mode, or a list of ranks that is not one. */
9
+ function modeOrders(orders) {
10
+ if (typeof orders !== 'object' || orders === null)
11
+ throw new TypeError('spec.orders must be an object');
12
+ const entries = Object.entries(orders);
13
+ if (entries.length === 0)
14
+ throw new TypeError('spec.orders must name at least one mode');
15
+ const byMode = new Map();
16
+ for (const [mode, names] of entries) {
17
+ if (!isRankList(names))
18
+ throw new TypeError(`the order of ${mode} must be a non-empty list of distinct names`);
19
+ byMode.set(mode, { mode, names: [...names], ranks: new Map() });
20
+ }
21
+ return byMode;
22
+ }
23
+ /** Puts one helper in the order of each mode it names; answers whether it named any. A `TypeError` for a mode or a rank the spec lacks. */
24
+ function placeHelper(helper, entry, byMode) {
25
+ if (typeof entry !== 'object' || entry === null)
26
+ throw new TypeError(`${helper} must map modes to rank names`);
27
+ let placed = false;
28
+ for (const [mode, name] of Object.entries(entry)) {
29
+ const order = byMode.get(mode);
30
+ if (order === undefined)
31
+ throw new TypeError(`${helper} names a mode that is not in spec.orders`);
32
+ if (name === undefined)
33
+ continue;
34
+ const rank = order.names.indexOf(name) + 1;
35
+ if (rank === 0)
36
+ throw new TypeError(`${helper} names a rank that is not in the ${mode} order`);
37
+ order.ranks.set(helper, { name: name, rank });
38
+ placed = true;
39
+ }
40
+ return placed;
41
+ }
42
+ /**
43
+ * Checks a lock-order spec and copies it into a plan. The checks that keep an order from being silently off: at least one
44
+ * mode, each order a non-empty list of distinct names, the default mode one of the modes, every helper mapped to a rank
45
+ * that exists in the order of a mode that exists, and every helper in at least one order. A `TypeError` names the part
46
+ * that is wrong and never quotes a value other than the name of a mode or a helper.
47
+ */
48
+ export function lockOrderPlan(spec) {
49
+ if (typeof spec !== 'object' || spec === null)
50
+ throw new TypeError('spec must be an object');
51
+ const { orders, helpers, defaultMode } = spec;
52
+ const byMode = modeOrders(orders);
53
+ const defaultOrder = byMode.get(defaultMode);
54
+ if (defaultOrder === undefined)
55
+ throw new TypeError('spec.defaultMode must be one of the modes');
56
+ if (typeof helpers !== 'object' || helpers === null)
57
+ throw new TypeError('spec.helpers must be an object');
58
+ const names = new Set();
59
+ for (const [helper, entry] of Object.entries(helpers)) {
60
+ if (!placeHelper(helper, entry, byMode))
61
+ throw new TypeError(`${helper} takes no rank in any mode`);
62
+ names.add(helper);
63
+ }
64
+ return { defaultOrder, orders: byMode, helpers: names };
65
+ }
66
+ //# sourceMappingURL=lockOrderPlan.mjs.map
@@ -0,0 +1,3 @@
1
+ import type { IMapDbErrorOptions } from "../../../lib/PostgreSQL/error/IMapDbErrorOptions.mjs";
2
+ /** The typed errors of the kit, each with the reason of its own and the closed reason it carries; `undefined` for any other value. */
3
+ export declare function mapTypedError<TError extends Error>(error: unknown, options: IMapDbErrorOptions<TError>): TError | undefined;
@@ -0,0 +1,28 @@
1
+ import { DbConnectError } from "../../../lib/PostgreSQL/error/DbConnectError.mjs";
2
+ import { DbParseError } from "../../../lib/PostgreSQL/error/DbParseError.mjs";
3
+ import { DbTxError } from "../../../lib/PostgreSQL/error/DbTxError.mjs";
4
+ import { internalFailure } from './internalFailure.mjs';
5
+ /** The typed errors of the kit, each with the reason of its own and the closed reason it carries; `undefined` for any other value. */
6
+ export function mapTypedError(error, options) {
7
+ if (error instanceof DbParseError) {
8
+ return internalFailure(options, 'db_error_internal_total', 'database value cannot be read', {
9
+ reason: 'DB_VALUE_UNREADABLE',
10
+ errorReason: error.reason,
11
+ typeName: error.typeName
12
+ });
13
+ }
14
+ if (error instanceof DbConnectError) {
15
+ return internalFailure(options, 'db_error_internal_total', 'database connection refused', {
16
+ reason: 'DB_CONNECTION',
17
+ errorReason: error.reason
18
+ });
19
+ }
20
+ if (error instanceof DbTxError) {
21
+ return internalFailure(options, 'db_error_internal_total', 'database transaction misused', {
22
+ reason: 'DB_TX_MISUSE',
23
+ errorReason: error.reason
24
+ });
25
+ }
26
+ return undefined;
27
+ }
28
+ //# sourceMappingURL=mapTypedError.mjs.map
@@ -0,0 +1,3 @@
1
+ import type { IMapDbErrorOptions } from "../../../lib/PostgreSQL/error/IMapDbErrorOptions.mjs";
2
+ /** A violation of SQLSTATE 23505, 23514 or 23503: the row of the table built into an error, or the internal error. */
3
+ export declare function mapViolation<TError extends Error>(error: unknown, sqlstate: string, options: IMapDbErrorOptions<TError>): TError;
@@ -0,0 +1,32 @@
1
+ import { constraintNameOf } from "../../../lib/PostgreSQL/error/constraintNameOf.mjs";
2
+ import { lookupConstraint } from "../../../lib/PostgreSQL/error/lookupConstraint.mjs";
3
+ import { constraintDetails } from './constraintDetails.mjs';
4
+ import { constraintField } from './constraintField.mjs';
5
+ import { internalFailure } from './internalFailure.mjs';
6
+ /** A violation of SQLSTATE 23505, 23514 or 23503: the row of the table built into an error, or the internal error. */
7
+ export function mapViolation(error, sqlstate, options) {
8
+ const name = constraintNameOf(error);
9
+ const entry = name === undefined ? undefined : lookupConstraint(options.table, name);
10
+ const fields = { sqlstate, ...constraintField(name) };
11
+ if (entry === undefined) {
12
+ return internalFailure(options, 'db_constraint_unmapped_total', 'database constraint violation is not in the constraint map', {
13
+ reason: 'CONSTRAINT_UNMAPPED',
14
+ ...fields
15
+ });
16
+ }
17
+ if (entry.code === (options.internalCode ?? 'INTERNAL')) {
18
+ return internalFailure(options, 'db_error_internal_total', 'database constraint violation is a defect', {
19
+ reason: 'CONSTRAINT_INTERNAL',
20
+ ...fields
21
+ });
22
+ }
23
+ const details = constraintDetails(entry, options.details);
24
+ if (details === null) {
25
+ return internalFailure(options, 'db_error_internal_total', 'database constraint violation needs details that the caller did not supply', {
26
+ reason: 'DETAILS_NOT_SUPPLIED',
27
+ ...fields
28
+ });
29
+ }
30
+ return details === undefined ? options.errors.make(entry.code) : options.errors.make(entry.code, details);
31
+ }
32
+ //# sourceMappingURL=mapViolation.mjs.map
@@ -0,0 +1,7 @@
1
+ import type { ITxClient } from "../../../lib/PostgreSQL/tx/ITxClient.mjs";
2
+ /**
3
+ * The first role, in name order, that `current_user` is a member of and `allowed` does not list; `undefined` when there
4
+ * is none. The names are sorted here, by code unit, and not by a clause of the statement, so the one that is reported
5
+ * does not depend on the collation of the database.
6
+ */
7
+ export declare function membershipOutsider(client: ITxClient, allowed: ReadonlySet<string>): Promise<string | undefined>;
@@ -0,0 +1,17 @@
1
+ import { catalogRows } from './catalogRows.mjs';
2
+ import { catalogText } from './catalogText.mjs';
3
+ import { ROLE_CATALOG_SQL } from './ROLE_CATALOG_SQL.mjs';
4
+ /**
5
+ * The first role, in name order, that `current_user` is a member of and `allowed` does not list; `undefined` when there
6
+ * is none. The names are sorted here, by code unit, and not by a clause of the statement, so the one that is reported
7
+ * does not depend on the collation of the database.
8
+ */
9
+ export async function membershipOutsider(client, allowed) {
10
+ const rows = await catalogRows(client, ROLE_CATALOG_SQL.memberships);
11
+ return (rows
12
+ .map((row) => catalogText(row['member_of']))
13
+ // eslint-disable-next-line sonarjs/no-alphabetical-sort -- the default order is by UTF-16 code unit, which is the order wanted; localeCompare would depend on the host locale
14
+ .sort()
15
+ .find((name) => !allowed.has(name)));
16
+ }
17
+ //# sourceMappingURL=membershipOutsider.mjs.map
@@ -0,0 +1,9 @@
1
+ import type { IRoleAssertionSubject } from "../../../lib/PostgreSQL/error/IRoleAssertionSubject.mjs";
2
+ import type { ITxClient } from "../../../lib/PostgreSQL/tx/ITxClient.mjs";
3
+ import type { IRoleColumnCheck } from './IRoleColumnCheck.mjs';
4
+ /**
5
+ * The first column of a column-level check that the role does not hold the privilege on, in the order of the list, named
6
+ * as a subject; `undefined` when it holds all. A column the table does not have is missing too: the statement answers
7
+ * a row only for a column that exists.
8
+ */
9
+ export declare function missingColumn(client: ITxClient, check: IRoleColumnCheck): Promise<IRoleAssertionSubject | undefined>;
@@ -0,0 +1,15 @@
1
+ import { catalogRows } from './catalogRows.mjs';
2
+ import { catalogText } from './catalogText.mjs';
3
+ import { ROLE_CATALOG_SQL } from './ROLE_CATALOG_SQL.mjs';
4
+ /**
5
+ * The first column of a column-level check that the role does not hold the privilege on, in the order of the list, named
6
+ * as a subject; `undefined` when it holds all. A column the table does not have is missing too: the statement answers
7
+ * a row only for a column that exists.
8
+ */
9
+ export async function missingColumn(client, check) {
10
+ const rows = await catalogRows(client, ROLE_CATALOG_SQL.grant.columns, [check.object, check.privilege, check.columns]);
11
+ const held = new Set(rows.filter((row) => row['held'] === true).map((row) => catalogText(row['name'])));
12
+ const column = check.columns.find((name) => !held.has(name));
13
+ return column === undefined ? undefined : { object: check.object, privilege: check.privilege, column };
14
+ }
15
+ //# sourceMappingURL=missingColumn.mjs.map
@@ -0,0 +1,5 @@
1
+ import type { IRoleAssertionSubject } from "../../../lib/PostgreSQL/error/IRoleAssertionSubject.mjs";
2
+ import type { ITxClient } from "../../../lib/PostgreSQL/tx/ITxClient.mjs";
3
+ import type { IRoleCheck } from './IRoleCheck.mjs';
4
+ /** What `check` finds missing, as a subject naming the object, the privilege and for a column the column; `undefined` when it is held. */
5
+ export declare function missingGrant(client: ITxClient, check: IRoleCheck): Promise<IRoleAssertionSubject | undefined>;
@@ -0,0 +1,7 @@
1
+ import { missingColumn } from './missingColumn.mjs';
2
+ import { missingObject } from './missingObject.mjs';
3
+ /** What `check` finds missing, as a subject naming the object, the privilege and for a column the column; `undefined` when it is held. */
4
+ export function missingGrant(client, check) {
5
+ return check.kind === 'columns' ? missingColumn(client, check) : missingObject(client, check);
6
+ }
7
+ //# sourceMappingURL=missingGrant.mjs.map