@axiumine/koa-utils 8.0.0 → 8.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.
- package/README.md +2 -0
- package/dist/lib/PostgreSQL/clock/CLOCK_SQL.d.mts +7 -0
- package/dist/lib/PostgreSQL/clock/CLOCK_SQL.mjs +8 -0
- package/dist/lib/PostgreSQL/clock/DB_NOW_SQL.d.mts +5 -0
- package/dist/lib/PostgreSQL/clock/DB_NOW_SQL.mjs +6 -0
- package/dist/lib/PostgreSQL/clock/IClock.d.mts +4 -0
- package/dist/lib/PostgreSQL/clock/IClock.mjs +2 -0
- package/dist/lib/PostgreSQL/clock/IDbClock.d.mts +11 -0
- package/dist/lib/PostgreSQL/clock/IDbClock.mjs +2 -0
- package/dist/lib/PostgreSQL/clock/IDbClockOptions.d.mts +11 -0
- package/dist/lib/PostgreSQL/clock/IDbClockOptions.mjs +2 -0
- package/dist/lib/PostgreSQL/clock/IDbClockSeam.d.mts +10 -0
- package/dist/lib/PostgreSQL/clock/IDbClockSeam.mjs +2 -0
- package/dist/lib/PostgreSQL/clock/createDbClock.d.mts +23 -0
- package/dist/lib/PostgreSQL/clock/createDbClock.mjs +54 -0
- package/dist/lib/PostgreSQL/clock/lockTaken.d.mts +11 -0
- package/dist/lib/PostgreSQL/clock/lockTaken.mjs +17 -0
- package/dist/lib/PostgreSQL/counter/IDbCounter.d.mts +9 -0
- package/dist/lib/PostgreSQL/counter/IDbCounter.mjs +2 -0
- package/dist/lib/PostgreSQL/error/DB_CLOCK_REASONS.d.mts +12 -0
- package/dist/lib/PostgreSQL/error/DB_CLOCK_REASONS.mjs +20 -0
- package/dist/lib/PostgreSQL/error/DB_CONNECT_REASONS.d.mts +11 -0
- package/dist/lib/PostgreSQL/error/DB_CONNECT_REASONS.mjs +12 -0
- package/dist/lib/PostgreSQL/error/DB_INTERNAL_REASONS.d.mts +23 -0
- package/dist/lib/PostgreSQL/error/DB_INTERNAL_REASONS.mjs +35 -0
- package/dist/lib/PostgreSQL/error/DB_PARSE_REASONS.d.mts +13 -0
- package/dist/lib/PostgreSQL/error/DB_PARSE_REASONS.mjs +14 -0
- package/dist/lib/PostgreSQL/error/DB_STATE_REASONS.d.mts +7 -0
- package/dist/lib/PostgreSQL/error/DB_STATE_REASONS.mjs +8 -0
- package/dist/lib/PostgreSQL/error/DB_TX_REASONS.d.mts +9 -0
- package/dist/lib/PostgreSQL/error/DB_TX_REASONS.mjs +10 -0
- package/dist/lib/PostgreSQL/error/DbClockError.d.mts +6 -0
- package/dist/lib/PostgreSQL/error/DbClockError.mjs +27 -0
- package/dist/lib/PostgreSQL/error/DbConnectError.d.mts +11 -0
- package/dist/lib/PostgreSQL/error/DbConnectError.mjs +18 -0
- package/dist/lib/PostgreSQL/error/DbParseError.d.mts +11 -0
- package/dist/lib/PostgreSQL/error/DbParseError.mjs +16 -0
- package/dist/lib/PostgreSQL/error/DbStateError.d.mts +10 -0
- package/dist/lib/PostgreSQL/error/DbStateError.mjs +14 -0
- package/dist/lib/PostgreSQL/error/DbTxError.d.mts +6 -0
- package/dist/lib/PostgreSQL/error/DbTxError.mjs +10 -0
- package/dist/lib/PostgreSQL/error/IConstraintEntry.d.mts +17 -0
- package/dist/lib/PostgreSQL/error/IConstraintEntry.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IConstraintEntryBuilder.d.mts +20 -0
- package/dist/lib/PostgreSQL/error/IConstraintEntryBuilder.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IConstraintTable.d.mts +7 -0
- package/dist/lib/PostgreSQL/error/IConstraintTable.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbClockReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/IDbClockReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbConnectReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/IDbConnectReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbErrorCounter.d.mts +4 -0
- package/dist/lib/PostgreSQL/error/IDbErrorCounter.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbErrorCounterName.d.mts +7 -0
- package/dist/lib/PostgreSQL/error/IDbErrorCounterName.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbErrorFactory.d.mts +16 -0
- package/dist/lib/PostgreSQL/error/IDbErrorFactory.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbInternalReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/IDbInternalReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbParseReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/IDbParseReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbStateReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/IDbStateReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IDbTxReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/IDbTxReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/ILockOrderReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/ILockOrderReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IMapDbErrorOptions.d.mts +22 -0
- package/dist/lib/PostgreSQL/error/IMapDbErrorOptions.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IRoleAssertionReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/error/IRoleAssertionReason.mjs +2 -0
- package/dist/lib/PostgreSQL/error/IRoleAssertionSubject.d.mts +12 -0
- package/dist/lib/PostgreSQL/error/IRoleAssertionSubject.mjs +2 -0
- package/dist/lib/PostgreSQL/error/LOCK_ORDER_REASONS.d.mts +11 -0
- package/dist/lib/PostgreSQL/error/LOCK_ORDER_REASONS.mjs +12 -0
- package/dist/lib/PostgreSQL/error/LockOrderError.d.mts +6 -0
- package/dist/lib/PostgreSQL/error/LockOrderError.mjs +10 -0
- package/dist/lib/PostgreSQL/error/ROLE_ASSERT_REASONS.d.mts +21 -0
- package/dist/lib/PostgreSQL/error/ROLE_ASSERT_REASONS.mjs +35 -0
- package/dist/lib/PostgreSQL/error/RoleAssertionError.d.mts +19 -0
- package/dist/lib/PostgreSQL/error/RoleAssertionError.mjs +58 -0
- package/dist/lib/PostgreSQL/error/buildConstraintEntry.d.mts +15 -0
- package/dist/lib/PostgreSQL/error/buildConstraintEntry.mjs +16 -0
- package/dist/lib/PostgreSQL/error/constraintNameOf.d.mts +6 -0
- package/dist/lib/PostgreSQL/error/constraintNameOf.mjs +17 -0
- package/dist/lib/PostgreSQL/error/errorNameOf.d.mts +5 -0
- package/dist/lib/PostgreSQL/error/errorNameOf.mjs +12 -0
- package/dist/lib/PostgreSQL/error/lookupConstraint.d.mts +7 -0
- package/dist/lib/PostgreSQL/error/lookupConstraint.mjs +8 -0
- package/dist/lib/PostgreSQL/error/mapDbError.d.mts +28 -0
- package/dist/lib/PostgreSQL/error/mapDbError.mjs +52 -0
- package/dist/lib/PostgreSQL/error/sqlstateField.d.mts +4 -0
- package/dist/lib/PostgreSQL/error/sqlstateField.mjs +5 -0
- package/dist/lib/PostgreSQL/error/sqlstateOf.d.mts +5 -0
- package/dist/lib/PostgreSQL/error/sqlstateOf.mjs +12 -0
- package/dist/lib/PostgreSQL/guard/IAffectedResult.d.mts +4 -0
- package/dist/lib/PostgreSQL/guard/IAffectedResult.mjs +2 -0
- package/dist/lib/PostgreSQL/guard/IGuardCounter.d.mts +3 -0
- package/dist/lib/PostgreSQL/guard/IGuardCounter.mjs +2 -0
- package/dist/lib/PostgreSQL/guard/IVersionGuardCode.d.mts +5 -0
- package/dist/lib/PostgreSQL/guard/IVersionGuardCode.mjs +2 -0
- package/dist/lib/PostgreSQL/guard/IVersionGuardField.d.mts +3 -0
- package/dist/lib/PostgreSQL/guard/IVersionGuardField.mjs +2 -0
- package/dist/lib/PostgreSQL/guard/IVersionGuardInput.d.mts +29 -0
- package/dist/lib/PostgreSQL/guard/IVersionGuardInput.mjs +2 -0
- package/dist/lib/PostgreSQL/guard/VERSION_GUARD_FIELDS.d.mts +2 -0
- package/dist/lib/PostgreSQL/guard/VERSION_GUARD_FIELDS.mjs +3 -0
- package/dist/lib/PostgreSQL/guard/assertAffected.d.mts +10 -0
- package/dist/lib/PostgreSQL/guard/assertAffected.mjs +17 -0
- package/dist/lib/PostgreSQL/guard/guardVersion.d.mts +21 -0
- package/dist/lib/PostgreSQL/guard/guardVersion.mjs +47 -0
- package/dist/lib/PostgreSQL/lock/CLAIM_LIMIT_MAX.d.mts +2 -0
- package/dist/lib/PostgreSQL/lock/CLAIM_LIMIT_MAX.mjs +3 -0
- package/dist/lib/PostgreSQL/lock/IClaimRegistry.d.mts +6 -0
- package/dist/lib/PostgreSQL/lock/IClaimRegistry.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/IClaimRequest.d.mts +7 -0
- package/dist/lib/PostgreSQL/lock/IClaimRequest.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/ILockAdmission.d.mts +4 -0
- package/dist/lib/PostgreSQL/lock/ILockAdmission.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/ILockOrderSpec.d.mts +19 -0
- package/dist/lib/PostgreSQL/lock/ILockOrderSpec.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/ILockOrderTracker.d.mts +41 -0
- package/dist/lib/PostgreSQL/lock/ILockOrderTracker.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/ILockTrackerConfig.d.mts +5 -0
- package/dist/lib/PostgreSQL/lock/ILockTrackerConfig.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/ILockTrackerOptions.d.mts +7 -0
- package/dist/lib/PostgreSQL/lock/ILockTrackerOptions.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/IRowLockMode.d.mts +3 -0
- package/dist/lib/PostgreSQL/lock/IRowLockMode.mjs +2 -0
- package/dist/lib/PostgreSQL/lock/ROW_LOCK_MODES.d.mts +2 -0
- package/dist/lib/PostgreSQL/lock/ROW_LOCK_MODES.mjs +3 -0
- package/dist/lib/PostgreSQL/lock/claimRowsSkipLocked.d.mts +16 -0
- package/dist/lib/PostgreSQL/lock/claimRowsSkipLocked.mjs +32 -0
- package/dist/lib/PostgreSQL/lock/createLockOrderTracker.d.mts +14 -0
- package/dist/lib/PostgreSQL/lock/createLockOrderTracker.mjs +60 -0
- package/dist/lib/PostgreSQL/lock/lockedRow.d.mts +7 -0
- package/dist/lib/PostgreSQL/lock/lockedRow.mjs +12 -0
- package/dist/lib/PostgreSQL/lock/lockedRows.d.mts +3 -0
- package/dist/lib/PostgreSQL/lock/lockedRows.mjs +8 -0
- package/dist/lib/PostgreSQL/lock/rowLockModeOf.d.mts +3 -0
- package/dist/lib/PostgreSQL/lock/rowLockModeOf.mjs +9 -0
- package/dist/lib/PostgreSQL/lock/uuidOf.d.mts +2 -0
- package/dist/lib/PostgreSQL/lock/uuidOf.mjs +10 -0
- package/dist/lib/PostgreSQL/lock/uuidsOf.d.mts +5 -0
- package/dist/lib/PostgreSQL/lock/uuidsOf.mjs +13 -0
- package/dist/lib/PostgreSQL/parse/IArrayParser.d.mts +2 -0
- package/dist/lib/PostgreSQL/parse/IArrayParser.mjs +2 -0
- package/dist/lib/PostgreSQL/parse/IDriverTypes.d.mts +4 -0
- package/dist/lib/PostgreSQL/parse/IDriverTypes.mjs +2 -0
- package/dist/lib/PostgreSQL/parse/IStringParser.d.mts +2 -0
- package/dist/lib/PostgreSQL/parse/IStringParser.mjs +2 -0
- package/dist/lib/PostgreSQL/parse/ITypeParserEntry.d.mts +9 -0
- package/dist/lib/PostgreSQL/parse/ITypeParserEntry.mjs +2 -0
- package/dist/lib/PostgreSQL/parse/TYPE_PARSERS.d.mts +12 -0
- package/dist/lib/PostgreSQL/parse/TYPE_PARSERS.mjs +38 -0
- package/dist/lib/PostgreSQL/parse/arrayOf.d.mts +7 -0
- package/dist/lib/PostgreSQL/parse/arrayOf.mjs +50 -0
- package/dist/lib/PostgreSQL/parse/createTypeRegistry.d.mts +13 -0
- package/dist/lib/PostgreSQL/parse/createTypeRegistry.mjs +26 -0
- package/dist/lib/PostgreSQL/parse/parseDate.d.mts +7 -0
- package/dist/lib/PostgreSQL/parse/parseDate.mjs +19 -0
- package/dist/lib/PostgreSQL/parse/parseInt8.d.mts +6 -0
- package/dist/lib/PostgreSQL/parse/parseInt8.mjs +17 -0
- package/dist/lib/PostgreSQL/parse/parseTime.d.mts +7 -0
- package/dist/lib/PostgreSQL/parse/parseTime.mjs +24 -0
- package/dist/lib/PostgreSQL/parse/parseTimestamptz.d.mts +17 -0
- package/dist/lib/PostgreSQL/parse/parseTimestamptz.mjs +79 -0
- package/dist/lib/PostgreSQL/parse/parseUuid.d.mts +3 -0
- package/dist/lib/PostgreSQL/parse/parseUuid.mjs +9 -0
- package/dist/lib/PostgreSQL/pool/DEFAULT_CONNECT_TIMEOUT_MS.d.mts +2 -0
- package/dist/lib/PostgreSQL/pool/DEFAULT_CONNECT_TIMEOUT_MS.mjs +3 -0
- package/dist/lib/PostgreSQL/pool/DEFAULT_KEEPALIVE_INITIAL_DELAY_MS.d.mts +2 -0
- package/dist/lib/PostgreSQL/pool/DEFAULT_KEEPALIVE_INITIAL_DELAY_MS.mjs +3 -0
- package/dist/lib/PostgreSQL/pool/ICreatePoolOptions.d.mts +28 -0
- package/dist/lib/PostgreSQL/pool/ICreatePoolOptions.mjs +2 -0
- package/dist/lib/PostgreSQL/pool/IDbDriver.d.mts +12 -0
- package/dist/lib/PostgreSQL/pool/IDbDriver.mjs +2 -0
- package/dist/lib/PostgreSQL/pool/IPoolCounter.d.mts +4 -0
- package/dist/lib/PostgreSQL/pool/IPoolCounter.mjs +2 -0
- package/dist/lib/PostgreSQL/pool/IPoolCounterName.d.mts +7 -0
- package/dist/lib/PostgreSQL/pool/IPoolCounterName.mjs +2 -0
- package/dist/lib/PostgreSQL/pool/IPoolEvents.d.mts +4 -0
- package/dist/lib/PostgreSQL/pool/IPoolEvents.mjs +2 -0
- package/dist/lib/PostgreSQL/pool/IPoolLogger.d.mts +8 -0
- package/dist/lib/PostgreSQL/pool/IPoolLogger.mjs +2 -0
- package/dist/lib/PostgreSQL/pool/REQUIRED_SESSION_TIME_ZONE.d.mts +2 -0
- package/dist/lib/PostgreSQL/pool/REQUIRED_SESSION_TIME_ZONE.mjs +3 -0
- package/dist/lib/PostgreSQL/pool/createPool.d.mts +31 -0
- package/dist/lib/PostgreSQL/pool/createPool.mjs +67 -0
- package/dist/lib/PostgreSQL/role/IAssertRoleOptions.d.mts +10 -0
- package/dist/lib/PostgreSQL/role/IAssertRoleOptions.mjs +2 -0
- package/dist/lib/PostgreSQL/role/IRoleAssertion.d.mts +6 -0
- package/dist/lib/PostgreSQL/role/IRoleAssertion.mjs +2 -0
- package/dist/lib/PostgreSQL/role/IRoleGrant.d.mts +19 -0
- package/dist/lib/PostgreSQL/role/IRoleGrant.mjs +2 -0
- package/dist/lib/PostgreSQL/role/IRolePool.d.mts +6 -0
- package/dist/lib/PostgreSQL/role/IRolePool.mjs +2 -0
- package/dist/lib/PostgreSQL/role/assertRole.d.mts +36 -0
- package/dist/lib/PostgreSQL/role/assertRole.mjs +54 -0
- package/dist/lib/PostgreSQL/tx/DEFAULT_LOCK_TIMEOUT_MS.d.mts +2 -0
- package/dist/lib/PostgreSQL/tx/DEFAULT_LOCK_TIMEOUT_MS.mjs +3 -0
- package/dist/lib/PostgreSQL/tx/IRetryDelay.d.mts +2 -0
- package/dist/lib/PostgreSQL/tx/IRetryDelay.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITx.d.mts +9 -0
- package/dist/lib/PostgreSQL/tx/ITx.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxClient.d.mts +12 -0
- package/dist/lib/PostgreSQL/tx/ITxClient.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxCounter.d.mts +4 -0
- package/dist/lib/PostgreSQL/tx/ITxCounter.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxCounterName.d.mts +10 -0
- package/dist/lib/PostgreSQL/tx/ITxCounterName.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxFailureReason.d.mts +3 -0
- package/dist/lib/PostgreSQL/tx/ITxFailureReason.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxIsolation.d.mts +3 -0
- package/dist/lib/PostgreSQL/tx/ITxIsolation.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxOptions.d.mts +27 -0
- package/dist/lib/PostgreSQL/tx/ITxOptions.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxPool.d.mts +5 -0
- package/dist/lib/PostgreSQL/tx/ITxPool.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/ITxResult.d.mts +6 -0
- package/dist/lib/PostgreSQL/tx/ITxResult.mjs +2 -0
- package/dist/lib/PostgreSQL/tx/MAX_LOCK_TIMEOUT_MS.d.mts +2 -0
- package/dist/lib/PostgreSQL/tx/MAX_LOCK_TIMEOUT_MS.mjs +3 -0
- package/dist/lib/PostgreSQL/tx/TX_FAILURE_REASONS.d.mts +7 -0
- package/dist/lib/PostgreSQL/tx/TX_FAILURE_REASONS.mjs +8 -0
- package/dist/lib/PostgreSQL/tx/TX_ISOLATION_LEVELS.d.mts +2 -0
- package/dist/lib/PostgreSQL/tx/TX_ISOLATION_LEVELS.mjs +3 -0
- package/dist/lib/PostgreSQL/tx/TX_RETRY_BASE_DELAY_MS.d.mts +2 -0
- package/dist/lib/PostgreSQL/tx/TX_RETRY_BASE_DELAY_MS.mjs +3 -0
- package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX.d.mts +2 -0
- package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX.mjs +3 -0
- package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX_CEILING.d.mts +2 -0
- package/dist/lib/PostgreSQL/tx/TX_RETRY_MAX_CEILING.mjs +3 -0
- package/dist/lib/PostgreSQL/tx/defaultRetryDelay.d.mts +3 -0
- package/dist/lib/PostgreSQL/tx/defaultRetryDelay.mjs +4 -0
- package/dist/lib/PostgreSQL/tx/jitteredDelay.d.mts +7 -0
- package/dist/lib/PostgreSQL/tx/jitteredDelay.mjs +16 -0
- package/dist/lib/PostgreSQL/tx/withTx.d.mts +39 -0
- package/dist/lib/PostgreSQL/tx/withTx.mjs +41 -0
- package/dist/lib/PostgreSQL/url/IDatabaseUrlOptions.d.mts +10 -0
- package/dist/lib/PostgreSQL/url/IDatabaseUrlOptions.mjs +2 -0
- package/dist/lib/PostgreSQL/url/IDatabaseUrlReason.d.mts +14 -0
- package/dist/lib/PostgreSQL/url/IDatabaseUrlReason.mjs +2 -0
- package/dist/lib/PostgreSQL/url/LOOPBACK_HOSTS.d.mts +2 -0
- package/dist/lib/PostgreSQL/url/LOOPBACK_HOSTS.mjs +3 -0
- package/dist/lib/PostgreSQL/url/databaseUrlReason.d.mts +20 -0
- package/dist/lib/PostgreSQL/url/databaseUrlReason.mjs +99 -0
- package/dist/lib/PostgreSQL/url/isAbsolutePath.d.mts +2 -0
- package/dist/lib/PostgreSQL/url/isAbsolutePath.mjs +14 -0
- package/dist/lib/PostgreSQL/url/isValidHost.d.mts +6 -0
- package/dist/lib/PostgreSQL/url/isValidHost.mjs +20 -0
- package/dist/private/lib/PostgreSQL/ICivilDate.d.mts +6 -0
- package/dist/private/lib/PostgreSQL/ICivilDate.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IClientConstructor.d.mts +3 -0
- package/dist/private/lib/PostgreSQL/IClientConstructor.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IClientShape.d.mts +10 -0
- package/dist/private/lib/PostgreSQL/IClientShape.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IClockSlot.d.mts +11 -0
- package/dist/private/lib/PostgreSQL/IClockSlot.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IConnectCallback.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/IConnectCallback.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IConnectSettings.d.mts +8 -0
- package/dist/private/lib/PostgreSQL/IConnectSettings.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IHelperRank.d.mts +5 -0
- package/dist/private/lib/PostgreSQL/IHelperRank.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IInternalSink.d.mts +9 -0
- package/dist/private/lib/PostgreSQL/IInternalSink.mjs +2 -0
- package/dist/private/lib/PostgreSQL/ILockOrderPlan.d.mts +8 -0
- package/dist/private/lib/PostgreSQL/ILockOrderPlan.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IModeOrder.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/IModeOrder.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IPostgresState.d.mts +9 -0
- package/dist/private/lib/PostgreSQL/IPostgresState.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IRoleCheck.d.mts +4 -0
- package/dist/private/lib/PostgreSQL/IRoleCheck.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IRoleColumnCheck.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/IRoleColumnCheck.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IRoleObjectCheck.d.mts +6 -0
- package/dist/private/lib/PostgreSQL/IRoleObjectCheck.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IRolePlan.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/IRolePlan.mjs +2 -0
- package/dist/private/lib/PostgreSQL/IRoleRow.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/IRoleRow.mjs +2 -0
- package/dist/private/lib/PostgreSQL/ITrackerState.d.mts +10 -0
- package/dist/private/lib/PostgreSQL/ITrackerState.mjs +2 -0
- package/dist/private/lib/PostgreSQL/ITxHandleState.d.mts +6 -0
- package/dist/private/lib/PostgreSQL/ITxHandleState.mjs +2 -0
- package/dist/private/lib/PostgreSQL/ITxSettings.d.mts +14 -0
- package/dist/private/lib/PostgreSQL/ITxSettings.mjs +2 -0
- package/dist/private/lib/PostgreSQL/POSTGRES_STATE_KEY.d.mts +5 -0
- package/dist/private/lib/PostgreSQL/POSTGRES_STATE_KEY.mjs +6 -0
- package/dist/private/lib/PostgreSQL/POSTGRES_STATE_LAYOUT.d.mts +6 -0
- package/dist/private/lib/PostgreSQL/POSTGRES_STATE_LAYOUT.mjs +7 -0
- package/dist/private/lib/PostgreSQL/ROLE_ATTRIBUTES.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/ROLE_ATTRIBUTES.mjs +9 -0
- package/dist/private/lib/PostgreSQL/ROLE_CATALOG_SQL.d.mts +26 -0
- package/dist/private/lib/PostgreSQL/ROLE_CATALOG_SQL.mjs +84 -0
- package/dist/private/lib/PostgreSQL/ROLE_PRIVILEGES.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/ROLE_PRIVILEGES.mjs +7 -0
- package/dist/private/lib/PostgreSQL/TX_BEGIN_STATEMENTS.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/TX_BEGIN_STATEMENTS.mjs +11 -0
- package/dist/private/lib/PostgreSQL/admitLock.d.mts +10 -0
- package/dist/private/lib/PostgreSQL/admitLock.mjs +33 -0
- package/dist/private/lib/PostgreSQL/assertPoolOptions.d.mts +12 -0
- package/dist/private/lib/PostgreSQL/assertPoolOptions.mjs +19 -0
- package/dist/private/lib/PostgreSQL/assertVersionGuardInput.d.mts +6 -0
- package/dist/private/lib/PostgreSQL/assertVersionGuardInput.mjs +14 -0
- package/dist/private/lib/PostgreSQL/catalogFlag.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/catalogFlag.mjs +7 -0
- package/dist/private/lib/PostgreSQL/catalogRow.d.mts +4 -0
- package/dist/private/lib/PostgreSQL/catalogRow.mjs +11 -0
- package/dist/private/lib/PostgreSQL/catalogRows.d.mts +8 -0
- package/dist/private/lib/PostgreSQL/catalogRows.mjs +12 -0
- package/dist/private/lib/PostgreSQL/catalogText.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/catalogText.mjs +7 -0
- package/dist/private/lib/PostgreSQL/checkRoleOnClient.d.mts +10 -0
- package/dist/private/lib/PostgreSQL/checkRoleOnClient.mjs +31 -0
- package/dist/private/lib/PostgreSQL/checkedClient.d.mts +8 -0
- package/dist/private/lib/PostgreSQL/checkedClient.mjs +22 -0
- package/dist/private/lib/PostgreSQL/civilCalendar.d.mts +13 -0
- package/dist/private/lib/PostgreSQL/civilCalendar.mjs +48 -0
- package/dist/private/lib/PostgreSQL/clockInstant.d.mts +11 -0
- package/dist/private/lib/PostgreSQL/clockInstant.mjs +18 -0
- package/dist/private/lib/PostgreSQL/clockSlot.d.mts +3 -0
- package/dist/private/lib/PostgreSQL/clockSlot.mjs +11 -0
- package/dist/private/lib/PostgreSQL/clockStatement.d.mts +6 -0
- package/dist/private/lib/PostgreSQL/clockStatement.mjs +22 -0
- package/dist/private/lib/PostgreSQL/connectAndCheck.d.mts +8 -0
- package/dist/private/lib/PostgreSQL/connectAndCheck.mjs +47 -0
- package/dist/private/lib/PostgreSQL/constraintDetails.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/constraintDetails.mjs +21 -0
- package/dist/private/lib/PostgreSQL/constraintField.d.mts +4 -0
- package/dist/private/lib/PostgreSQL/constraintField.mjs +5 -0
- package/dist/private/lib/PostgreSQL/errorCodeOf.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/errorCodeOf.mjs +7 -0
- package/dist/private/lib/PostgreSQL/internalFailure.d.mts +9 -0
- package/dist/private/lib/PostgreSQL/internalFailure.mjs +10 -0
- package/dist/private/lib/PostgreSQL/isNameList.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/isNameList.mjs +6 -0
- package/dist/private/lib/PostgreSQL/isOneOf.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/isOneOf.mjs +5 -0
- package/dist/private/lib/PostgreSQL/isQualifiedName.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/isQualifiedName.mjs +7 -0
- package/dist/private/lib/PostgreSQL/isRoleName.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/isRoleName.mjs +7 -0
- package/dist/private/lib/PostgreSQL/lockOrderPlan.d.mts +8 -0
- package/dist/private/lib/PostgreSQL/lockOrderPlan.mjs +66 -0
- package/dist/private/lib/PostgreSQL/mapTypedError.d.mts +3 -0
- package/dist/private/lib/PostgreSQL/mapTypedError.mjs +28 -0
- package/dist/private/lib/PostgreSQL/mapViolation.d.mts +3 -0
- package/dist/private/lib/PostgreSQL/mapViolation.mjs +32 -0
- package/dist/private/lib/PostgreSQL/membershipOutsider.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/membershipOutsider.mjs +17 -0
- package/dist/private/lib/PostgreSQL/missingColumn.d.mts +9 -0
- package/dist/private/lib/PostgreSQL/missingColumn.mjs +15 -0
- package/dist/private/lib/PostgreSQL/missingGrant.d.mts +5 -0
- package/dist/private/lib/PostgreSQL/missingGrant.mjs +7 -0
- package/dist/private/lib/PostgreSQL/missingObject.d.mts +10 -0
- package/dist/private/lib/PostgreSQL/missingObject.mjs +14 -0
- package/dist/private/lib/PostgreSQL/poolUrlSecrets.d.mts +8 -0
- package/dist/private/lib/PostgreSQL/poolUrlSecrets.mjs +41 -0
- package/dist/private/lib/PostgreSQL/postgresState.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/postgresState.mjs +32 -0
- package/dist/private/lib/PostgreSQL/rankCheckOption.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/rankCheckOption.mjs +7 -0
- package/dist/private/lib/PostgreSQL/readField.d.mts +5 -0
- package/dist/private/lib/PostgreSQL/readField.mjs +10 -0
- package/dist/private/lib/PostgreSQL/roleCheckOf.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/roleCheckOf.mjs +39 -0
- package/dist/private/lib/PostgreSQL/roleFailureSubject.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/roleFailureSubject.mjs +12 -0
- package/dist/private/lib/PostgreSQL/rolePlan.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/rolePlan.mjs +26 -0
- package/dist/private/lib/PostgreSQL/runRoleChecks.d.mts +17 -0
- package/dist/private/lib/PostgreSQL/runRoleChecks.mjs +48 -0
- package/dist/private/lib/PostgreSQL/runTxAttempt.d.mts +12 -0
- package/dist/private/lib/PostgreSQL/runTxAttempt.mjs +50 -0
- package/dist/private/lib/PostgreSQL/runTxBody.d.mts +11 -0
- package/dist/private/lib/PostgreSQL/runTxBody.mjs +19 -0
- package/dist/private/lib/PostgreSQL/runTxWithRetries.d.mts +10 -0
- package/dist/private/lib/PostgreSQL/runTxWithRetries.mjs +31 -0
- package/dist/private/lib/PostgreSQL/scrubSecrets.d.mts +2 -0
- package/dist/private/lib/PostgreSQL/scrubSecrets.mjs +6 -0
- package/dist/private/lib/PostgreSQL/txFailure.d.mts +4 -0
- package/dist/private/lib/PostgreSQL/txFailure.mjs +7 -0
- package/dist/private/lib/PostgreSQL/txHandle.d.mts +9 -0
- package/dist/private/lib/PostgreSQL/txHandle.mjs +26 -0
- package/dist/private/lib/PostgreSQL/txSettings.d.mts +7 -0
- package/dist/private/lib/PostgreSQL/txSettings.mjs +48 -0
- package/dist/private/lib/PostgreSQL/versionText.d.mts +5 -0
- package/dist/private/lib/PostgreSQL/versionText.mjs +12 -0
- package/package.json +501 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** True when the text holds an ASCII control character (code below 0x20, or 0x7f). */
|
|
2
|
+
function hasControlChar(text) {
|
|
3
|
+
for (const char of text) {
|
|
4
|
+
const code = char.charCodeAt(0);
|
|
5
|
+
if (code < 0x20 || code === 0x7f)
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
/** True for an absolute POSIX path: starts with `/`, no `..` segment, no control character. */
|
|
11
|
+
export function isAbsolutePath(text) {
|
|
12
|
+
return text.startsWith('/') && !hasControlChar(text) && !text.split('/').includes('..');
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=isAbsolutePath.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True for a host name, an IPv4 address or an IPv6 address. A scheme, a port, a path, a user, a bracket, a zone id, an
|
|
3
|
+
* underscore and a trailing dot are all refused. A name whose last label is all digits is refused too: it is how
|
|
4
|
+
* `127.1` and `999.1.1.1` look, and a resolver may read them as addresses.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isValidHost(text: string): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isIP } from 'node:net';
|
|
2
|
+
// eslint-disable-next-line security/detect-unsafe-regex -- nested quantifier is the bounded {0,61} inside an optional group, no backtracking blow-up
|
|
3
|
+
const DNS_LABEL = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?$/;
|
|
4
|
+
/** The last label is all digits: `127.1`, `999.1.1.1`, `8080`. */
|
|
5
|
+
const NUMERIC_TAIL = /(?:^|\.)\d+$/;
|
|
6
|
+
/**
|
|
7
|
+
* True for a host name, an IPv4 address or an IPv6 address. A scheme, a port, a path, a user, a bracket, a zone id, an
|
|
8
|
+
* underscore and a trailing dot are all refused. A name whose last label is all digits is refused too: it is how
|
|
9
|
+
* `127.1` and `999.1.1.1` look, and a resolver may read them as addresses.
|
|
10
|
+
*/
|
|
11
|
+
export function isValidHost(text) {
|
|
12
|
+
if (text.length > 253)
|
|
13
|
+
return false;
|
|
14
|
+
if (isIP(text) !== 0)
|
|
15
|
+
return !text.includes('%');
|
|
16
|
+
if (!text.split('.').every((label) => DNS_LABEL.test(label)))
|
|
17
|
+
return false;
|
|
18
|
+
return !NUMERIC_TAIL.test(text);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=isValidHost.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IConnectCallback } from './IConnectCallback.mjs';
|
|
2
|
+
/** The members of the driver's client that the checked subclass uses. */
|
|
3
|
+
export interface IClientShape {
|
|
4
|
+
connect(): Promise<unknown>;
|
|
5
|
+
connect(callback: IConnectCallback): void;
|
|
6
|
+
query(text: string): Promise<{
|
|
7
|
+
rows: Record<string, unknown>[];
|
|
8
|
+
}>;
|
|
9
|
+
end(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What is known about the clock of one transaction. */
|
|
2
|
+
export interface IClockSlot {
|
|
3
|
+
/** True once a lock helper has taken a lock in this transaction. */
|
|
4
|
+
locked: boolean;
|
|
5
|
+
/** The instant, in epoch milliseconds, once it was read. */
|
|
6
|
+
instant: number | undefined;
|
|
7
|
+
/** The read that is under way, so that concurrent callers share one statement. */
|
|
8
|
+
pending: Promise<number> | undefined;
|
|
9
|
+
/** Set by `createDbClock`: reads the instant (once) with the statement of that clock. */
|
|
10
|
+
read: (() => Promise<number>) | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IPoolCounter } from "../../../lib/PostgreSQL/pool/IPoolCounter.mjs";
|
|
2
|
+
import type { IPoolLogger } from "../../../lib/PostgreSQL/pool/IPoolLogger.mjs";
|
|
3
|
+
/** What the connect of one client needs besides the client. */
|
|
4
|
+
export interface IConnectSettings {
|
|
5
|
+
readonly connectTimeoutMs: number;
|
|
6
|
+
readonly logger: IPoolLogger;
|
|
7
|
+
readonly count: IPoolCounter;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IDbCounter } from "../../../lib/PostgreSQL/counter/IDbCounter.mjs";
|
|
2
|
+
import type { IDbErrorFactory } from "../../../lib/PostgreSQL/error/IDbErrorFactory.mjs";
|
|
3
|
+
import type { IPoolLogger } from "../../../lib/PostgreSQL/pool/IPoolLogger.mjs";
|
|
4
|
+
/** What `internalFailure` needs: the factory's `internal`, a logger with `error`, and an optional counter over the names it emits. */
|
|
5
|
+
export interface IInternalSink<TError extends Error, TName extends string> {
|
|
6
|
+
readonly errors: Pick<IDbErrorFactory<TError>, 'internal'>;
|
|
7
|
+
readonly logger: Pick<IPoolLogger, 'error'>;
|
|
8
|
+
readonly counter?: IDbCounter<TName>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IModeOrder } from './IModeOrder.mjs';
|
|
2
|
+
/** A lock-order spec after the check and the copy: what a tracker reads, and no more. */
|
|
3
|
+
export interface ILockOrderPlan {
|
|
4
|
+
readonly defaultOrder: IModeOrder;
|
|
5
|
+
readonly orders: ReadonlyMap<string, IModeOrder>;
|
|
6
|
+
/** The helpers the spec names. */
|
|
7
|
+
readonly helpers: ReadonlySet<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IHelperRank } from './IHelperRank.mjs';
|
|
2
|
+
/** The order of one mode, after the spec was checked: the ranks lowest first, and the rank each helper takes in it. */
|
|
3
|
+
export interface IModeOrder {
|
|
4
|
+
readonly mode: string;
|
|
5
|
+
readonly names: readonly string[];
|
|
6
|
+
readonly ranks: Map<string, IHelperRank>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IClockSlot } from './IClockSlot.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* What every copy of the package shares: the per-transaction clock slots, keyed by the transaction handle. The registry
|
|
4
|
+
* is frozen and holds no secret and no driver object: a flag, an epoch number, a promise and a function per handle.
|
|
5
|
+
*/
|
|
6
|
+
export interface IPostgresState {
|
|
7
|
+
readonly layout: number;
|
|
8
|
+
readonly slots: WeakMap<object, IClockSlot>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IRoleCheck } from './IRoleCheck.mjs';
|
|
2
|
+
/** The options of `assertRole` after validation: nothing in it needs another look at the caller's input. */
|
|
3
|
+
export interface IRolePlan {
|
|
4
|
+
readonly role: string;
|
|
5
|
+
readonly allowed: ReadonlySet<string>;
|
|
6
|
+
readonly checks: readonly IRoleCheck[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IModeOrder } from './IModeOrder.mjs';
|
|
2
|
+
/** What a tracker knows about one transaction. */
|
|
3
|
+
export interface ITrackerState {
|
|
4
|
+
order: IModeOrder;
|
|
5
|
+
rankCheck: boolean;
|
|
6
|
+
/** The highest rank recorded in this transaction, 0 when none. */
|
|
7
|
+
rank: number;
|
|
8
|
+
/** The strength of the locks recorded with `hold`, by key. */
|
|
9
|
+
held: Map<string, number>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IDbErrorFactory } from "../../../lib/PostgreSQL/error/IDbErrorFactory.mjs";
|
|
2
|
+
import type { IPoolLogger } from "../../../lib/PostgreSQL/pool/IPoolLogger.mjs";
|
|
3
|
+
import type { IRetryDelay } from "../../../lib/PostgreSQL/tx/IRetryDelay.mjs";
|
|
4
|
+
import type { ITxCounter } from "../../../lib/PostgreSQL/tx/ITxCounter.mjs";
|
|
5
|
+
/** The options of `withTx` after the checks: every default applied and the two opening statements built. */
|
|
6
|
+
export interface ITxSettings {
|
|
7
|
+
readonly logger: IPoolLogger;
|
|
8
|
+
readonly errors: Pick<IDbErrorFactory, 'internal'>;
|
|
9
|
+
readonly count: ITxCounter;
|
|
10
|
+
readonly begin: string;
|
|
11
|
+
readonly setLockTimeout: string;
|
|
12
|
+
readonly retryMax: number;
|
|
13
|
+
readonly retryDelay: IRetryDelay;
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The key under which every copy of this package finds the registry of the PostgreSQL kit on `globalThis`. A registry
|
|
3
|
+
* symbol, so two copies loaded from two places agree on it without sharing a module.
|
|
4
|
+
*/
|
|
5
|
+
export declare const POSTGRES_STATE_KEY: unique symbol;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The key under which every copy of this package finds the registry of the PostgreSQL kit on `globalThis`. A registry
|
|
3
|
+
* symbol, so two copies loaded from two places agree on it without sharing a module.
|
|
4
|
+
*/
|
|
5
|
+
export const POSTGRES_STATE_KEY = Symbol.for('@axiumine/koa-utils/postgres-state');
|
|
6
|
+
//# sourceMappingURL=POSTGRES_STATE_KEY.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout of the shared registry. It changes only when the shape of {@link IPostgresState} or of a slot changes in a
|
|
3
|
+
* way that an older copy cannot read: copies with the same layout share one registry, copies with another refuse each
|
|
4
|
+
* other with `DbStateError` instead of splitting the state.
|
|
5
|
+
*/
|
|
6
|
+
export declare const POSTGRES_STATE_LAYOUT = 1;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout of the shared registry. It changes only when the shape of {@link IPostgresState} or of a slot changes in a
|
|
3
|
+
* way that an older copy cannot read: copies with the same layout share one registry, copies with another refuse each
|
|
4
|
+
* other with `DbStateError` instead of splitting the state.
|
|
5
|
+
*/
|
|
6
|
+
export const POSTGRES_STATE_LAYOUT = 1;
|
|
7
|
+
//# sourceMappingURL=POSTGRES_STATE_LAYOUT.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Which attribute flag of the identity row gives which reason, in the order they are tested. */
|
|
2
|
+
export declare const ROLE_ATTRIBUTES: readonly [readonly ["superuser", "ROLE_SUPERUSER"], readonly ["createrole", "ROLE_CREATEROLE"], readonly ["createdb", "ROLE_CREATEDB"], readonly ["bypassrls", "ROLE_BYPASSRLS"], readonly ["replication", "ROLE_REPLICATION"]];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Which attribute flag of the identity row gives which reason, in the order they are tested. */
|
|
2
|
+
export const ROLE_ATTRIBUTES = [
|
|
3
|
+
['superuser', 'ROLE_SUPERUSER'],
|
|
4
|
+
['createrole', 'ROLE_CREATEROLE'],
|
|
5
|
+
['createdb', 'ROLE_CREATEDB'],
|
|
6
|
+
['bypassrls', 'ROLE_BYPASSRLS'],
|
|
7
|
+
['replication', 'ROLE_REPLICATION']
|
|
8
|
+
];
|
|
9
|
+
//# sourceMappingURL=ROLE_ATTRIBUTES.mjs.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The statements `assertRole` sends, all read-only catalog queries about `current_user`. A name or a privilege reaches
|
|
3
|
+
* them only as a bound parameter (`$1`, `$2`, `$3`), never in the text.
|
|
4
|
+
*
|
|
5
|
+
* - `identity`: the effective and the login role, and the five attribute flags of the effective role.
|
|
6
|
+
* - `ownsObjects`: whether `pg_shdepend`, the shared dependency catalog, holds one `o` (owner) row for the role. It lists
|
|
7
|
+
* every object of every database of the cluster that a role owns, so one read answers for tables, functions, schemas,
|
|
8
|
+
* types, databases and the rest, with no list of catalogs to keep.
|
|
9
|
+
* - `memberships`: the roles `current_user` is a member of, directly or through a chain, walked with a recursive query.
|
|
10
|
+
* - `grant.schema` (`$1` schema, `$2` privilege), `grant.function` (`$1` schema, `$2` function name), `grant.relation`
|
|
11
|
+
* (`$1` qualified name, `$2` privilege) and `grant.columns` (`$1` qualified name, `$2` privilege, `$3` column names):
|
|
12
|
+
* the catalog privilege functions for `current_user`. A relation that does not exist, or a privilege the kind of
|
|
13
|
+
* relation cannot hold (`USAGE` on a table, `DELETE` on a sequence), answers no row, `NULL` or `false`, which is a
|
|
14
|
+
* missing grant and never a pass.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ROLE_CATALOG_SQL: {
|
|
17
|
+
readonly identity: "\nSELECT current_user::text AS effective_role,\n session_user::text AS login_role,\n r.rolsuper AS superuser,\n r.rolcreaterole AS createrole,\n r.rolcreatedb AS createdb,\n r.rolbypassrls AS bypassrls,\n r.rolreplication AS replication\nFROM pg_catalog.pg_roles r\nWHERE r.rolname = current_user";
|
|
18
|
+
readonly ownsObjects: "\nSELECT EXISTS (\n SELECT 1\n FROM pg_catalog.pg_shdepend d\n JOIN pg_catalog.pg_roles r ON r.oid = d.refobjid\n WHERE d.refclassid = 'pg_catalog.pg_authid'::regclass\n AND d.deptype = 'o'\n AND r.rolname = current_user\n) AS owns";
|
|
19
|
+
readonly memberships: "\nWITH RECURSIVE membership (role_oid) AS (\n SELECT a.roleid\n FROM pg_catalog.pg_auth_members a\n JOIN pg_catalog.pg_roles me ON me.oid = a.member\n WHERE me.rolname = current_user\n UNION\n SELECT a.roleid\n FROM pg_catalog.pg_auth_members a\n JOIN membership m ON a.member = m.role_oid\n)\nSELECT r.rolname::text AS member_of\nFROM membership m\nJOIN pg_catalog.pg_roles r ON r.oid = m.role_oid";
|
|
20
|
+
readonly grant: {
|
|
21
|
+
readonly schema: "\nSELECT CASE\n WHEN s.oid IS NULL THEN NULL\n ELSE pg_catalog.has_schema_privilege(current_user, s.oid, $2::text)\nEND AS held\nFROM (SELECT pg_catalog.to_regnamespace($1::text)::oid AS oid) s";
|
|
22
|
+
readonly function: "\nSELECT pg_catalog.bool_and(pg_catalog.has_function_privilege(current_user, p.oid, 'EXECUTE')) AS held\nFROM pg_catalog.pg_proc p\nWHERE p.pronamespace = pg_catalog.to_regnamespace($1::text)::oid\n AND p.proname = $2::text";
|
|
23
|
+
readonly relation: "\nSELECT CASE\n WHEN c.relkind = 'S' THEN\n CASE WHEN $2::text IN ('USAGE', 'SELECT', 'UPDATE')\n THEN pg_catalog.has_sequence_privilege(current_user, c.oid, $2::text)\n ELSE false\n END\n WHEN $2::text = 'USAGE' THEN false\n ELSE pg_catalog.has_table_privilege(current_user, c.oid, $2::text)\nEND AS held\nFROM pg_catalog.pg_class c\nWHERE c.oid = pg_catalog.to_regclass($1::text)::oid";
|
|
24
|
+
readonly columns: "\nSELECT a.attname::text AS name,\n pg_catalog.has_column_privilege(current_user, a.attrelid, a.attname::text, $2::text) AS held\nFROM pg_catalog.pg_attribute a\nWHERE a.attrelid = pg_catalog.to_regclass($1::text)::oid\n AND a.attname = ANY ($3::text[])\n AND a.attnum > 0\n AND NOT a.attisdropped";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The statements `assertRole` sends, all read-only catalog queries about `current_user`. A name or a privilege reaches
|
|
3
|
+
* them only as a bound parameter (`$1`, `$2`, `$3`), never in the text.
|
|
4
|
+
*
|
|
5
|
+
* - `identity`: the effective and the login role, and the five attribute flags of the effective role.
|
|
6
|
+
* - `ownsObjects`: whether `pg_shdepend`, the shared dependency catalog, holds one `o` (owner) row for the role. It lists
|
|
7
|
+
* every object of every database of the cluster that a role owns, so one read answers for tables, functions, schemas,
|
|
8
|
+
* types, databases and the rest, with no list of catalogs to keep.
|
|
9
|
+
* - `memberships`: the roles `current_user` is a member of, directly or through a chain, walked with a recursive query.
|
|
10
|
+
* - `grant.schema` (`$1` schema, `$2` privilege), `grant.function` (`$1` schema, `$2` function name), `grant.relation`
|
|
11
|
+
* (`$1` qualified name, `$2` privilege) and `grant.columns` (`$1` qualified name, `$2` privilege, `$3` column names):
|
|
12
|
+
* the catalog privilege functions for `current_user`. A relation that does not exist, or a privilege the kind of
|
|
13
|
+
* relation cannot hold (`USAGE` on a table, `DELETE` on a sequence), answers no row, `NULL` or `false`, which is a
|
|
14
|
+
* missing grant and never a pass.
|
|
15
|
+
*/
|
|
16
|
+
export const ROLE_CATALOG_SQL = {
|
|
17
|
+
identity: `
|
|
18
|
+
SELECT current_user::text AS effective_role,
|
|
19
|
+
session_user::text AS login_role,
|
|
20
|
+
r.rolsuper AS superuser,
|
|
21
|
+
r.rolcreaterole AS createrole,
|
|
22
|
+
r.rolcreatedb AS createdb,
|
|
23
|
+
r.rolbypassrls AS bypassrls,
|
|
24
|
+
r.rolreplication AS replication
|
|
25
|
+
FROM pg_catalog.pg_roles r
|
|
26
|
+
WHERE r.rolname = current_user`,
|
|
27
|
+
ownsObjects: `
|
|
28
|
+
SELECT EXISTS (
|
|
29
|
+
SELECT 1
|
|
30
|
+
FROM pg_catalog.pg_shdepend d
|
|
31
|
+
JOIN pg_catalog.pg_roles r ON r.oid = d.refobjid
|
|
32
|
+
WHERE d.refclassid = 'pg_catalog.pg_authid'::regclass
|
|
33
|
+
AND d.deptype = 'o'
|
|
34
|
+
AND r.rolname = current_user
|
|
35
|
+
) AS owns`,
|
|
36
|
+
memberships: `
|
|
37
|
+
WITH RECURSIVE membership (role_oid) AS (
|
|
38
|
+
SELECT a.roleid
|
|
39
|
+
FROM pg_catalog.pg_auth_members a
|
|
40
|
+
JOIN pg_catalog.pg_roles me ON me.oid = a.member
|
|
41
|
+
WHERE me.rolname = current_user
|
|
42
|
+
UNION
|
|
43
|
+
SELECT a.roleid
|
|
44
|
+
FROM pg_catalog.pg_auth_members a
|
|
45
|
+
JOIN membership m ON a.member = m.role_oid
|
|
46
|
+
)
|
|
47
|
+
SELECT r.rolname::text AS member_of
|
|
48
|
+
FROM membership m
|
|
49
|
+
JOIN pg_catalog.pg_roles r ON r.oid = m.role_oid`,
|
|
50
|
+
grant: {
|
|
51
|
+
schema: `
|
|
52
|
+
SELECT CASE
|
|
53
|
+
WHEN s.oid IS NULL THEN NULL
|
|
54
|
+
ELSE pg_catalog.has_schema_privilege(current_user, s.oid, $2::text)
|
|
55
|
+
END AS held
|
|
56
|
+
FROM (SELECT pg_catalog.to_regnamespace($1::text)::oid AS oid) s`,
|
|
57
|
+
function: `
|
|
58
|
+
SELECT pg_catalog.bool_and(pg_catalog.has_function_privilege(current_user, p.oid, 'EXECUTE')) AS held
|
|
59
|
+
FROM pg_catalog.pg_proc p
|
|
60
|
+
WHERE p.pronamespace = pg_catalog.to_regnamespace($1::text)::oid
|
|
61
|
+
AND p.proname = $2::text`,
|
|
62
|
+
relation: `
|
|
63
|
+
SELECT CASE
|
|
64
|
+
WHEN c.relkind = 'S' THEN
|
|
65
|
+
CASE WHEN $2::text IN ('USAGE', 'SELECT', 'UPDATE')
|
|
66
|
+
THEN pg_catalog.has_sequence_privilege(current_user, c.oid, $2::text)
|
|
67
|
+
ELSE false
|
|
68
|
+
END
|
|
69
|
+
WHEN $2::text = 'USAGE' THEN false
|
|
70
|
+
ELSE pg_catalog.has_table_privilege(current_user, c.oid, $2::text)
|
|
71
|
+
END AS held
|
|
72
|
+
FROM pg_catalog.pg_class c
|
|
73
|
+
WHERE c.oid = pg_catalog.to_regclass($1::text)::oid`,
|
|
74
|
+
columns: `
|
|
75
|
+
SELECT a.attname::text AS name,
|
|
76
|
+
pg_catalog.has_column_privilege(current_user, a.attrelid, a.attname::text, $2::text) AS held
|
|
77
|
+
FROM pg_catalog.pg_attribute a
|
|
78
|
+
WHERE a.attrelid = pg_catalog.to_regclass($1::text)::oid
|
|
79
|
+
AND a.attname = ANY ($3::text[])
|
|
80
|
+
AND a.attnum > 0
|
|
81
|
+
AND NOT a.attisdropped`
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=ROLE_CATALOG_SQL.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The privileges `assertRole` accepts, by the kind of object they are asked on. */
|
|
2
|
+
export const ROLE_PRIVILEGES = {
|
|
3
|
+
schema: ['USAGE', 'CREATE'],
|
|
4
|
+
relation: ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'USAGE'],
|
|
5
|
+
column: ['SELECT', 'INSERT', 'UPDATE', 'REFERENCES']
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=ROLE_PRIVILEGES.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ITxIsolation } from "../../../lib/PostgreSQL/tx/ITxIsolation.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* The statement that opens a transaction, by isolation level: read-write first, read-only second. Literals on
|
|
4
|
+
* purpose: nothing is interpolated into a `BEGIN`. A `Map`, so that a key that is not an own entry (`toString`) finds
|
|
5
|
+
* nothing.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TX_BEGIN_STATEMENTS: ReadonlyMap<ITxIsolation, readonly [string, string]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The statement that opens a transaction, by isolation level: read-write first, read-only second. Literals on
|
|
3
|
+
* purpose: nothing is interpolated into a `BEGIN`. A `Map`, so that a key that is not an own entry (`toString`) finds
|
|
4
|
+
* nothing.
|
|
5
|
+
*/
|
|
6
|
+
export const TX_BEGIN_STATEMENTS = new Map([
|
|
7
|
+
['READ COMMITTED', ['BEGIN ISOLATION LEVEL READ COMMITTED', 'BEGIN ISOLATION LEVEL READ COMMITTED READ ONLY']],
|
|
8
|
+
['REPEATABLE READ', ['BEGIN ISOLATION LEVEL REPEATABLE READ', 'BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY']],
|
|
9
|
+
['SERIALIZABLE', ['BEGIN ISOLATION LEVEL SERIALIZABLE', 'BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY']]
|
|
10
|
+
]);
|
|
11
|
+
//# sourceMappingURL=TX_BEGIN_STATEMENTS.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ILockAdmission } from "../../../lib/PostgreSQL/lock/ILockAdmission.mjs";
|
|
2
|
+
import type { ILockOrderPlan } from './ILockOrderPlan.mjs';
|
|
3
|
+
import type { ITrackerState } from './ITrackerState.mjs';
|
|
4
|
+
/**
|
|
5
|
+
* Checks the request of a helper against the order of the mode of the transaction, and answers the rank to record, or
|
|
6
|
+
* nothing when the helper has no rank in this mode and the check is off. Nothing is recorded here. The same rank again
|
|
7
|
+
* passes; a lower one is `RANK_INVERSION`; a helper outside the mode is `MODE_REQUIRED` (the transaction is in the default
|
|
8
|
+
* mode) or `NOT_IN_MODE_ORDER`. With the check off none of them throws. A `TypeError` for a helper the spec does not name.
|
|
9
|
+
*/
|
|
10
|
+
export declare function admitLock(plan: ILockOrderPlan, state: ITrackerState, helper: string): ILockAdmission | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LockOrderError } from "../../../lib/PostgreSQL/error/LockOrderError.mjs";
|
|
2
|
+
/** The error for a helper that has no rank in the mode of the transaction. */
|
|
3
|
+
function modeMistake(plan, state, helper) {
|
|
4
|
+
if (state.order === plan.defaultOrder) {
|
|
5
|
+
const homes = [...plan.orders.values()].filter((order) => order.ranks.has(helper)).map((order) => order.mode);
|
|
6
|
+
return new LockOrderError('MODE_REQUIRED', `${helper} belongs to the ${homes.join(' or ')} order: set that mode on the transaction before its first lock`);
|
|
7
|
+
}
|
|
8
|
+
return new LockOrderError('NOT_IN_MODE_ORDER', `${helper} is not one of the locks of the ${state.order.mode} order (${state.order.names.join(', ')})`);
|
|
9
|
+
}
|
|
10
|
+
/** The error for a rank lower than one already recorded; it names both ranks. */
|
|
11
|
+
function rankInversion(state, helper, taken) {
|
|
12
|
+
return new LockOrderError('RANK_INVERSION', `lock order violated: ${helper} takes rank ${String(taken.rank)} (${taken.name}) after rank ${String(state.rank)} (${String(state.order.names[state.rank - 1])}) in the ${state.order.mode} order`);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Checks the request of a helper against the order of the mode of the transaction, and answers the rank to record, or
|
|
16
|
+
* nothing when the helper has no rank in this mode and the check is off. Nothing is recorded here. The same rank again
|
|
17
|
+
* passes; a lower one is `RANK_INVERSION`; a helper outside the mode is `MODE_REQUIRED` (the transaction is in the default
|
|
18
|
+
* mode) or `NOT_IN_MODE_ORDER`. With the check off none of them throws. A `TypeError` for a helper the spec does not name.
|
|
19
|
+
*/
|
|
20
|
+
export function admitLock(plan, state, helper) {
|
|
21
|
+
if (!plan.helpers.has(helper))
|
|
22
|
+
throw new TypeError('helper is not named in the lock order spec');
|
|
23
|
+
const taken = state.order.ranks.get(helper);
|
|
24
|
+
if (taken === undefined) {
|
|
25
|
+
if (state.rankCheck)
|
|
26
|
+
throw modeMistake(plan, state, helper);
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
if (state.rankCheck && taken.rank < state.rank)
|
|
30
|
+
throw rankInversion(state, helper, taken);
|
|
31
|
+
return { rank: taken.rank };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=admitLock.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface IPoolNumbers {
|
|
2
|
+
readonly max: number;
|
|
3
|
+
readonly applicationName: string;
|
|
4
|
+
readonly connectTimeoutMs: number;
|
|
5
|
+
readonly keepAliveInitialDelayMs: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Throws a `TypeError` for a parameter of `createPool` that is out of range, before anything is created. The checks
|
|
9
|
+
* run in the order of the parameters.
|
|
10
|
+
*/
|
|
11
|
+
export declare function assertPoolOptions(options: IPoolNumbers): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const APPLICATION_NAME = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,62}$/;
|
|
2
|
+
/**
|
|
3
|
+
* Throws a `TypeError` for a parameter of `createPool` that is out of range, before anything is created. The checks
|
|
4
|
+
* run in the order of the parameters.
|
|
5
|
+
*/
|
|
6
|
+
export function assertPoolOptions(options) {
|
|
7
|
+
if (!Number.isInteger(options.max) || options.max < 1)
|
|
8
|
+
throw new TypeError('max must be a whole number from 1');
|
|
9
|
+
if (!APPLICATION_NAME.test(options.applicationName)) {
|
|
10
|
+
throw new TypeError('applicationName must be 1 to 63 characters of letters, digits, underscore, dot, colon and hyphen, starting with a letter or digit');
|
|
11
|
+
}
|
|
12
|
+
if (!Number.isInteger(options.connectTimeoutMs) || options.connectTimeoutMs < 1) {
|
|
13
|
+
throw new TypeError('connectTimeoutMs must be a whole number of milliseconds from 1');
|
|
14
|
+
}
|
|
15
|
+
if (!Number.isInteger(options.keepAliveInitialDelayMs) || options.keepAliveInitialDelayMs < 0) {
|
|
16
|
+
throw new TypeError('keepAliveInitialDelayMs must be a whole number of milliseconds from 0');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=assertPoolOptions.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The shape checks of `guardVersion`, in the order field, expected, entity. Each is a `TypeError`; no statement ran before them. */
|
|
2
|
+
export declare function assertVersionGuardInput(input: {
|
|
3
|
+
readonly field: string;
|
|
4
|
+
readonly expected: number;
|
|
5
|
+
readonly entity: string;
|
|
6
|
+
}): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VERSION_GUARD_FIELDS } from "../../../lib/PostgreSQL/guard/VERSION_GUARD_FIELDS.mjs";
|
|
2
|
+
/** The shape checks of `guardVersion`, in the order field, expected, entity. Each is a `TypeError`; no statement ran before them. */
|
|
3
|
+
export function assertVersionGuardInput(input) {
|
|
4
|
+
if (!VERSION_GUARD_FIELDS.includes(input.field)) {
|
|
5
|
+
throw new TypeError(`field must be one of ${VERSION_GUARD_FIELDS.join(', ')}`);
|
|
6
|
+
}
|
|
7
|
+
if (!Number.isSafeInteger(input.expected)) {
|
|
8
|
+
throw new TypeError('expected must be a whole number');
|
|
9
|
+
}
|
|
10
|
+
if (typeof input.entity !== 'string' || input.entity === '') {
|
|
11
|
+
throw new TypeError('entity must be a non-empty string');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=assertVersionGuardInput.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A catalog flag. Only a real boolean counts; anything else is a malformed answer, never a pass. */
|
|
2
|
+
export function catalogFlag(value) {
|
|
3
|
+
if (typeof value !== 'boolean')
|
|
4
|
+
throw new TypeError('the catalog answered a value of another type');
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=catalogFlag.mjs.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ITxClient } from "../../../lib/PostgreSQL/tx/ITxClient.mjs";
|
|
2
|
+
import type { IRoleRow } from './IRoleRow.mjs';
|
|
3
|
+
/** The one row of a statement that must answer exactly one, and an object. Anything else throws. */
|
|
4
|
+
export declare function catalogRow(client: ITxClient, text: string, values?: readonly unknown[]): Promise<IRoleRow>;
|