@contember/database 2.1.0-beta.1 → 2.2.0-alpha.1
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/CLAUDE.md +3 -0
- package/dist/development/index.cjs +4 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +4 -0
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/builders/CaseStatement.cjs.map +1 -1
- package/dist/development/src/builders/CaseStatement.js.map +1 -1
- package/dist/development/src/builders/ColumnExpressionFactory.cjs.map +1 -1
- package/dist/development/src/builders/ColumnExpressionFactory.js.map +1 -1
- package/dist/development/src/builders/Compiler.cjs.map +1 -1
- package/dist/development/src/builders/Compiler.js.map +1 -1
- package/dist/development/src/builders/ConditionBuilder.cjs +6 -0
- package/dist/development/src/builders/ConditionBuilder.cjs.map +1 -1
- package/dist/development/src/builders/ConditionBuilder.js +6 -0
- package/dist/development/src/builders/ConditionBuilder.js.map +1 -1
- package/dist/development/src/builders/DeleteBuilder.cjs.map +1 -1
- package/dist/development/src/builders/DeleteBuilder.js.map +1 -1
- package/dist/development/src/builders/InsertBuilder.cjs.map +1 -1
- package/dist/development/src/builders/InsertBuilder.js.map +1 -1
- package/dist/development/src/builders/LimitByGroupWrapper.cjs.map +1 -1
- package/dist/development/src/builders/LimitByGroupWrapper.js.map +1 -1
- package/dist/development/src/builders/SelectBuilder.cjs.map +1 -1
- package/dist/development/src/builders/SelectBuilder.js.map +1 -1
- package/dist/development/src/builders/UpdateBuilder.cjs.map +1 -1
- package/dist/development/src/builders/UpdateBuilder.js.map +1 -1
- package/dist/development/src/builders/WindowFunction.cjs.map +1 -1
- package/dist/development/src/builders/WindowFunction.js.map +1 -1
- package/dist/development/src/builders/internal/Returning.cjs.map +1 -1
- package/dist/development/src/builders/internal/Returning.js.map +1 -1
- package/dist/development/src/builders/internal/Subqueries.cjs.map +1 -1
- package/dist/development/src/builders/internal/Subqueries.js.map +1 -1
- package/dist/development/src/builders/internal/Where.cjs.map +1 -1
- package/dist/development/src/builders/internal/Where.js.map +1 -1
- package/dist/development/src/builders/internal/With.cjs.map +1 -1
- package/dist/development/src/builders/internal/With.js.map +1 -1
- package/dist/development/src/builders/utils.cjs.map +1 -1
- package/dist/development/src/builders/utils.js.map +1 -1
- package/dist/development/src/client/AcquiredConnection.cjs.map +1 -1
- package/dist/development/src/client/AcquiredConnection.js.map +1 -1
- package/dist/development/src/client/Client.cjs.map +1 -1
- package/dist/development/src/client/Client.js.map +1 -1
- package/dist/development/src/client/Connection.cjs +11 -0
- package/dist/development/src/client/Connection.cjs.map +1 -1
- package/dist/development/src/client/Connection.js +11 -0
- package/dist/development/src/client/Connection.js.map +1 -1
- package/dist/development/src/client/EventManager.cjs.map +1 -1
- package/dist/development/src/client/EventManager.js.map +1 -1
- package/dist/development/src/client/Pool.cjs.map +1 -1
- package/dist/development/src/client/Pool.js.map +1 -1
- package/dist/development/src/client/ScopeLimitedConnection.cjs +37 -0
- package/dist/development/src/client/ScopeLimitedConnection.cjs.map +1 -0
- package/dist/development/src/client/ScopeLimitedConnection.js +37 -0
- package/dist/development/src/client/ScopeLimitedConnection.js.map +1 -0
- package/dist/development/src/client/Transaction.cjs.map +1 -1
- package/dist/development/src/client/Transaction.js.map +1 -1
- package/dist/development/src/metadata/DatabaseMetadata.cjs.map +1 -1
- package/dist/development/src/metadata/DatabaseMetadata.js.map +1 -1
- package/dist/development/src/metadata/DatabaseMetadataResolver.cjs.map +1 -1
- package/dist/development/src/metadata/DatabaseMetadataResolver.js.map +1 -1
- package/dist/development/src/metadata/IndexMetadata.cjs.map +1 -1
- package/dist/development/src/metadata/IndexMetadata.js.map +1 -1
- package/dist/development/src/metadata/UniqueConstraintMetadata.cjs.map +1 -1
- package/dist/development/src/metadata/UniqueConstraintMetadata.js.map +1 -1
- package/dist/development/src/queryable/DatabaseQuery.cjs.map +1 -1
- package/dist/development/src/queryable/DatabaseQuery.js.map +1 -1
- package/dist/development/src/queryable/DatabaseQueryable.cjs.map +1 -1
- package/dist/development/src/queryable/DatabaseQueryable.js.map +1 -1
- package/dist/development/src/utils/ConstraintHelper.cjs.map +1 -1
- package/dist/development/src/utils/ConstraintHelper.js.map +1 -1
- package/dist/development/src/utils/Semaphore.cjs +43 -0
- package/dist/development/src/utils/Semaphore.cjs.map +1 -0
- package/dist/development/src/utils/Semaphore.js +43 -0
- package/dist/development/src/utils/Semaphore.js.map +1 -0
- package/dist/development/src/utils/createDatabaseIfNotExists.cjs.map +1 -1
- package/dist/development/src/utils/createDatabaseIfNotExists.js.map +1 -1
- package/dist/development/src/utils/listen.cjs.map +1 -1
- package/dist/development/src/utils/listen.js.map +1 -1
- package/dist/development/src/utils/pgClientFactory.cjs +5 -3
- package/dist/development/src/utils/pgClientFactory.cjs.map +1 -1
- package/dist/development/src/utils/pgClientFactory.js +5 -3
- package/dist/development/src/utils/pgClientFactory.js.map +1 -1
- package/dist/development/src/utils/retryTransaction.cjs.map +1 -1
- package/dist/development/src/utils/retryTransaction.js.map +1 -1
- package/dist/development/src/utils/sql.cjs.map +1 -1
- package/dist/development/src/utils/sql.js.map +1 -1
- package/dist/development/src/utils/withDatabaseAdvisoryLock.cjs.map +1 -1
- package/dist/development/src/utils/withDatabaseAdvisoryLock.js.map +1 -1
- package/dist/production/index.cjs +4 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +4 -0
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/builders/CaseStatement.cjs.map +1 -1
- package/dist/production/src/builders/CaseStatement.js.map +1 -1
- package/dist/production/src/builders/ColumnExpressionFactory.cjs.map +1 -1
- package/dist/production/src/builders/ColumnExpressionFactory.js.map +1 -1
- package/dist/production/src/builders/Compiler.cjs.map +1 -1
- package/dist/production/src/builders/Compiler.js.map +1 -1
- package/dist/production/src/builders/ConditionBuilder.cjs +6 -0
- package/dist/production/src/builders/ConditionBuilder.cjs.map +1 -1
- package/dist/production/src/builders/ConditionBuilder.js +6 -0
- package/dist/production/src/builders/ConditionBuilder.js.map +1 -1
- package/dist/production/src/builders/DeleteBuilder.cjs.map +1 -1
- package/dist/production/src/builders/DeleteBuilder.js.map +1 -1
- package/dist/production/src/builders/InsertBuilder.cjs.map +1 -1
- package/dist/production/src/builders/InsertBuilder.js.map +1 -1
- package/dist/production/src/builders/LimitByGroupWrapper.cjs.map +1 -1
- package/dist/production/src/builders/LimitByGroupWrapper.js.map +1 -1
- package/dist/production/src/builders/SelectBuilder.cjs.map +1 -1
- package/dist/production/src/builders/SelectBuilder.js.map +1 -1
- package/dist/production/src/builders/UpdateBuilder.cjs.map +1 -1
- package/dist/production/src/builders/UpdateBuilder.js.map +1 -1
- package/dist/production/src/builders/WindowFunction.cjs.map +1 -1
- package/dist/production/src/builders/WindowFunction.js.map +1 -1
- package/dist/production/src/builders/internal/Returning.cjs.map +1 -1
- package/dist/production/src/builders/internal/Returning.js.map +1 -1
- package/dist/production/src/builders/internal/Subqueries.cjs.map +1 -1
- package/dist/production/src/builders/internal/Subqueries.js.map +1 -1
- package/dist/production/src/builders/internal/Where.cjs.map +1 -1
- package/dist/production/src/builders/internal/Where.js.map +1 -1
- package/dist/production/src/builders/internal/With.cjs.map +1 -1
- package/dist/production/src/builders/internal/With.js.map +1 -1
- package/dist/production/src/builders/utils.cjs.map +1 -1
- package/dist/production/src/builders/utils.js.map +1 -1
- package/dist/production/src/client/AcquiredConnection.cjs.map +1 -1
- package/dist/production/src/client/AcquiredConnection.js.map +1 -1
- package/dist/production/src/client/Client.cjs.map +1 -1
- package/dist/production/src/client/Client.js.map +1 -1
- package/dist/production/src/client/Connection.cjs +11 -0
- package/dist/production/src/client/Connection.cjs.map +1 -1
- package/dist/production/src/client/Connection.js +11 -0
- package/dist/production/src/client/Connection.js.map +1 -1
- package/dist/production/src/client/EventManager.cjs.map +1 -1
- package/dist/production/src/client/EventManager.js.map +1 -1
- package/dist/production/src/client/Pool.cjs.map +1 -1
- package/dist/production/src/client/Pool.js.map +1 -1
- package/dist/production/src/client/ScopeLimitedConnection.cjs +37 -0
- package/dist/production/src/client/ScopeLimitedConnection.cjs.map +1 -0
- package/dist/production/src/client/ScopeLimitedConnection.js +37 -0
- package/dist/production/src/client/ScopeLimitedConnection.js.map +1 -0
- package/dist/production/src/client/Transaction.cjs.map +1 -1
- package/dist/production/src/client/Transaction.js.map +1 -1
- package/dist/production/src/metadata/DatabaseMetadata.cjs.map +1 -1
- package/dist/production/src/metadata/DatabaseMetadata.js.map +1 -1
- package/dist/production/src/metadata/DatabaseMetadataResolver.cjs.map +1 -1
- package/dist/production/src/metadata/DatabaseMetadataResolver.js.map +1 -1
- package/dist/production/src/metadata/IndexMetadata.cjs.map +1 -1
- package/dist/production/src/metadata/IndexMetadata.js.map +1 -1
- package/dist/production/src/metadata/UniqueConstraintMetadata.cjs.map +1 -1
- package/dist/production/src/metadata/UniqueConstraintMetadata.js.map +1 -1
- package/dist/production/src/queryable/DatabaseQuery.cjs.map +1 -1
- package/dist/production/src/queryable/DatabaseQuery.js.map +1 -1
- package/dist/production/src/queryable/DatabaseQueryable.cjs.map +1 -1
- package/dist/production/src/queryable/DatabaseQueryable.js.map +1 -1
- package/dist/production/src/utils/ConstraintHelper.cjs.map +1 -1
- package/dist/production/src/utils/ConstraintHelper.js.map +1 -1
- package/dist/production/src/utils/Semaphore.cjs +43 -0
- package/dist/production/src/utils/Semaphore.cjs.map +1 -0
- package/dist/production/src/utils/Semaphore.js +43 -0
- package/dist/production/src/utils/Semaphore.js.map +1 -0
- package/dist/production/src/utils/createDatabaseIfNotExists.cjs.map +1 -1
- package/dist/production/src/utils/createDatabaseIfNotExists.js.map +1 -1
- package/dist/production/src/utils/listen.cjs.map +1 -1
- package/dist/production/src/utils/listen.js.map +1 -1
- package/dist/production/src/utils/pgClientFactory.cjs +5 -3
- package/dist/production/src/utils/pgClientFactory.cjs.map +1 -1
- package/dist/production/src/utils/pgClientFactory.js +5 -3
- package/dist/production/src/utils/pgClientFactory.js.map +1 -1
- package/dist/production/src/utils/retryTransaction.cjs.map +1 -1
- package/dist/production/src/utils/retryTransaction.js.map +1 -1
- package/dist/production/src/utils/sql.cjs.map +1 -1
- package/dist/production/src/utils/sql.js.map +1 -1
- package/dist/production/src/utils/withDatabaseAdvisoryLock.cjs.map +1 -1
- package/dist/production/src/utils/withDatabaseAdvisoryLock.js.map +1 -1
- package/dist/tests/cases/unit/createConnectionMockAlt.d.ts +1 -1
- package/dist/tests/cases/unit/createConnectionMockAlt.d.ts.map +1 -1
- package/dist/tests/cases/unit/scopeLimitedConnection.test.d.ts +2 -0
- package/dist/tests/cases/unit/scopeLimitedConnection.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/semaphore.test.d.ts +2 -0
- package/dist/tests/cases/unit/semaphore.test.d.ts.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/builders/CaseStatement.d.ts +2 -2
- package/dist/types/builders/CaseStatement.d.ts.map +1 -1
- package/dist/types/builders/ColumnExpressionFactory.d.ts +6 -6
- package/dist/types/builders/ColumnExpressionFactory.d.ts.map +1 -1
- package/dist/types/builders/Compiler.d.ts +5 -5
- package/dist/types/builders/Compiler.d.ts.map +1 -1
- package/dist/types/builders/ConditionBuilder.d.ts +8 -6
- package/dist/types/builders/ConditionBuilder.d.ts.map +1 -1
- package/dist/types/builders/DeleteBuilder.d.ts +8 -8
- package/dist/types/builders/DeleteBuilder.d.ts.map +1 -1
- package/dist/types/builders/InsertBuilder.d.ts +10 -10
- package/dist/types/builders/InsertBuilder.d.ts.map +1 -1
- package/dist/types/builders/LimitByGroupWrapper.d.ts +3 -3
- package/dist/types/builders/LimitByGroupWrapper.d.ts.map +1 -1
- package/dist/types/builders/QueryBuilder.d.ts +5 -5
- package/dist/types/builders/QueryBuilder.d.ts.map +1 -1
- package/dist/types/builders/SelectBuilder.d.ts +9 -9
- package/dist/types/builders/SelectBuilder.d.ts.map +1 -1
- package/dist/types/builders/UpdateBuilder.d.ts +9 -9
- package/dist/types/builders/UpdateBuilder.d.ts.map +1 -1
- package/dist/types/builders/WindowFunction.d.ts +2 -2
- package/dist/types/builders/WindowFunction.d.ts.map +1 -1
- package/dist/types/builders/index.d.ts +12 -12
- package/dist/types/builders/index.d.ts.map +1 -1
- package/dist/types/builders/internal/Returning.d.ts +3 -3
- package/dist/types/builders/internal/Returning.d.ts.map +1 -1
- package/dist/types/builders/internal/Subqueries.d.ts +4 -4
- package/dist/types/builders/internal/Subqueries.d.ts.map +1 -1
- package/dist/types/builders/internal/Where.d.ts +3 -3
- package/dist/types/builders/internal/Where.d.ts.map +1 -1
- package/dist/types/builders/internal/With.d.ts +3 -3
- package/dist/types/builders/internal/With.d.ts.map +1 -1
- package/dist/types/builders/utils.d.ts +2 -2
- package/dist/types/builders/utils.d.ts.map +1 -1
- package/dist/types/client/AcquiredConnection.d.ts +3 -3
- package/dist/types/client/AcquiredConnection.d.ts.map +1 -1
- package/dist/types/client/Client.d.ts +4 -4
- package/dist/types/client/Client.d.ts.map +1 -1
- package/dist/types/client/Connection.d.ts +12 -4
- package/dist/types/client/Connection.d.ts.map +1 -1
- package/dist/types/client/EventManager.d.ts +1 -1
- package/dist/types/client/EventManager.d.ts.map +1 -1
- package/dist/types/client/Pool.d.ts +3 -3
- package/dist/types/client/Pool.d.ts.map +1 -1
- package/dist/types/client/ScopeLimitedConnection.d.ts +34 -0
- package/dist/types/client/ScopeLimitedConnection.d.ts.map +1 -0
- package/dist/types/client/Transaction.d.ts +2 -2
- package/dist/types/client/Transaction.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +8 -7
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -10
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/metadata/DatabaseMetadata.d.ts +3 -3
- package/dist/types/metadata/DatabaseMetadata.d.ts.map +1 -1
- package/dist/types/metadata/DatabaseMetadataResolver.d.ts +2 -2
- package/dist/types/metadata/DatabaseMetadataResolver.d.ts.map +1 -1
- package/dist/types/metadata/index.d.ts +5 -5
- package/dist/types/metadata/index.d.ts.map +1 -1
- package/dist/types/queryable/DatabaseQuery.d.ts +1 -1
- package/dist/types/queryable/DatabaseQuery.d.ts.map +1 -1
- package/dist/types/queryable/DatabaseQueryable.d.ts +1 -1
- package/dist/types/queryable/DatabaseQueryable.d.ts.map +1 -1
- package/dist/types/queryable/index.d.ts +2 -2
- package/dist/types/queryable/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/ConstraintHelper.d.ts +2 -2
- package/dist/types/utils/ConstraintHelper.d.ts.map +1 -1
- package/dist/types/utils/Semaphore.d.ts +17 -0
- package/dist/types/utils/Semaphore.d.ts.map +1 -0
- package/dist/types/utils/createDatabaseIfNotExists.d.ts +1 -1
- package/dist/types/utils/createDatabaseIfNotExists.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +11 -10
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/listen.d.ts +1 -1
- package/dist/types/utils/listen.d.ts.map +1 -1
- package/dist/types/utils/pgClientFactory.d.ts +3 -3
- package/dist/types/utils/pgClientFactory.d.ts.map +1 -1
- package/dist/types/utils/sql.d.ts +1 -1
- package/dist/types/utils/sql.d.ts.map +1 -1
- package/dist/types/utils/withDatabaseAdvisoryLock.d.ts +1 -1
- package/dist/types/utils/withDatabaseAdvisoryLock.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/builders/CaseStatement.ts +3 -3
- package/src/builders/ColumnExpressionFactory.ts +7 -7
- package/src/builders/Compiler.ts +9 -9
- package/src/builders/ConditionBuilder.ts +13 -7
- package/src/builders/DeleteBuilder.ts +8 -8
- package/src/builders/InsertBuilder.ts +11 -11
- package/src/builders/LimitByGroupWrapper.ts +5 -5
- package/src/builders/QueryBuilder.ts +5 -5
- package/src/builders/SelectBuilder.ts +11 -11
- package/src/builders/UpdateBuilder.ts +10 -10
- package/src/builders/WindowFunction.ts +4 -4
- package/src/builders/index.ts +12 -12
- package/src/builders/internal/Returning.ts +4 -4
- package/src/builders/internal/Subqueries.ts +4 -4
- package/src/builders/internal/Where.ts +4 -4
- package/src/builders/internal/With.ts +4 -4
- package/src/builders/utils.ts +4 -4
- package/src/client/AcquiredConnection.ts +7 -7
- package/src/client/Client.ts +5 -5
- package/src/client/Connection.ts +18 -6
- package/src/client/EventManager.ts +1 -1
- package/src/client/Pool.ts +5 -5
- package/src/client/ScopeLimitedConnection.ts +65 -0
- package/src/client/Transaction.ts +4 -4
- package/src/client/index.ts +8 -7
- package/src/index.ts +11 -10
- package/src/metadata/DatabaseMetadata.ts +3 -3
- package/src/metadata/DatabaseMetadataResolver.ts +5 -5
- package/src/metadata/IndexMetadata.ts +1 -1
- package/src/metadata/UniqueConstraintMetadata.ts +1 -1
- package/src/metadata/index.ts +5 -5
- package/src/queryable/DatabaseQuery.ts +2 -2
- package/src/queryable/DatabaseQueryable.ts +1 -1
- package/src/queryable/index.ts +2 -2
- package/src/types.ts +1 -0
- package/src/utils/ConstraintHelper.ts +3 -3
- package/src/utils/Semaphore.ts +49 -0
- package/src/utils/createDatabaseIfNotExists.ts +3 -3
- package/src/utils/index.ts +11 -10
- package/src/utils/listen.ts +2 -2
- package/src/utils/pgClientFactory.ts +15 -10
- package/src/utils/retryTransaction.ts +1 -1
- package/src/utils/sql.ts +1 -1
- package/src/utils/withDatabaseAdvisoryLock.ts +1 -1
- package/tests/cases/unit/connection.test.ts +2 -2
- package/tests/cases/unit/createConnectionMockAlt.ts +2 -2
- package/tests/cases/unit/eventManager.test.ts +2 -2
- package/tests/cases/unit/pool.test.ts +1 -1
- package/tests/cases/unit/queryBuilder.test.ts +7 -3
- package/tests/cases/unit/scopeLimitedConnection.test.ts +204 -0
- package/tests/cases/unit/semaphore.test.ts +53 -0
- package/vitest.config.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AACxE,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAA;AAC9D,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,SAAS;CAAE,CAAA;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,SAAS,EAAE,CAAA;AAE5C,MAAM,MAAM,KAAK,GACd,SAAS,GACT,IAAI,GACJ,SAAS,IAAI,EAAE,GACf,MAAM,CAAA;AAET,MAAM,WAAW,GAAG;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,KAAK,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CACrC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AACxE,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAA;AAC9D,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,SAAS;CAAE,CAAA;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,SAAS,EAAE,CAAA;AAE5C,MAAM,MAAM,KAAK,GACd,SAAS,GACT,IAAI,GACJ,SAAS,IAAI,EAAE,GACf,MAAM,CAAA;AAET,MAAM,WAAW,GAAG;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,KAAK,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CACrC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Client } from '../client';
|
|
2
|
-
import { DatabaseMetadata } from '../metadata';
|
|
1
|
+
import { Client } from '../client/index.js';
|
|
2
|
+
import { DatabaseMetadata } from '../metadata/index.js';
|
|
3
3
|
export type ConstraintType = 'foreignKey' | 'unique';
|
|
4
4
|
export declare class ConstraintHelper {
|
|
5
5
|
private readonly client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstraintHelper.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstraintHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ConstraintHelper.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstraintHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,QAAQ,CAAA;AAEpD,qBAAa,gBAAgB;IAI3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJ1B,OAAO,CAAC,KAAK,CAA+D;gBAG1D,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB;IAGrC,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO;IAI/C,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAQ3D,oBAAoB;YAQpB,iBAAiB;CAK/B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A counting semaphore with a FIFO waiting queue.
|
|
3
|
+
*
|
|
4
|
+
* Limits the number of concurrently running operations to a fixed number of slots.
|
|
5
|
+
* Callers acquire a slot via {@link Semaphore.execute}; if all slots are taken, the
|
|
6
|
+
* caller waits until a slot is released.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Semaphore {
|
|
9
|
+
private readonly maxConcurrency;
|
|
10
|
+
private available;
|
|
11
|
+
private readonly queue;
|
|
12
|
+
constructor(maxConcurrency: number);
|
|
13
|
+
execute<T>(cb: () => T | Promise<T>): Promise<T>;
|
|
14
|
+
private acquire;
|
|
15
|
+
private release;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=Semaphore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Semaphore.d.ts","sourceRoot":"","sources":["../../../src/utils/Semaphore.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,SAAS;IAMpB,OAAO,CAAC,QAAQ,CAAC,cAAc;IALhC,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;gBAGzB,cAAc,EAAE,MAAM;IAQ3B,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAS7D,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,OAAO;CAQf"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DatabaseConfig } from '../types';
|
|
1
|
+
import { DatabaseConfig } from '../types.js';
|
|
2
2
|
export declare const createDatabaseIfNotExists: (db: DatabaseConfig, log: (message: string | Error) => void) => Promise<void>;
|
|
3
3
|
//# sourceMappingURL=createDatabaseIfNotExists.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDatabaseIfNotExists.d.ts","sourceRoot":"","sources":["../../../src/utils/createDatabaseIfNotExists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createDatabaseIfNotExists.d.ts","sourceRoot":"","sources":["../../../src/utils/createDatabaseIfNotExists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAI5C,eAAO,MAAM,yBAAyB,GAAU,IAAI,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,KAAK,IAAI,kBAgBzG,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export * from './assertNever';
|
|
2
|
-
export * from './asyncIterableTransaction';
|
|
3
|
-
export * from './ConstraintHelper';
|
|
4
|
-
export * from './createDatabaseIfNotExists';
|
|
5
|
-
export * from './listen';
|
|
6
|
-
export * from './Mutex';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
1
|
+
export * from './assertNever.js';
|
|
2
|
+
export * from './asyncIterableTransaction.js';
|
|
3
|
+
export * from './ConstraintHelper.js';
|
|
4
|
+
export * from './createDatabaseIfNotExists.js';
|
|
5
|
+
export * from './listen.js';
|
|
6
|
+
export * from './Mutex.js';
|
|
7
|
+
export * from './Semaphore.js';
|
|
8
|
+
export * from './sql.js';
|
|
9
|
+
export * from './retryTransaction.js';
|
|
10
|
+
export * from './withDatabaseAdvisoryLock.js';
|
|
11
|
+
export * from './pgClientFactory.js';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listen.d.ts","sourceRoot":"","sources":["../../../src/utils/listen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"listen.d.ts","sourceRoot":"","sources":["../../../src/utils/listen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAcvD,qBAAa,QAAQ,CAAC,CAAC;IAErB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAHP,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC,EACjD,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,EAC/B,OAAO,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;IAIpD,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAC/B,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;QACzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KACpB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;CAqEzC;AAED,qBAAa,iBAAiB,CAAC,CAAC;IAE9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAHP,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,EAC/B,OAAO,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;IAIpD,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;CA4B3H"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import pg from 'pg';
|
|
2
|
-
import { DatabaseConfig } from '../types';
|
|
3
|
-
import { PgClient } from '../client/PgClient';
|
|
2
|
+
import { DatabaseConfig } from '../types.js';
|
|
3
|
+
import { PgClient } from '../client/PgClient.js';
|
|
4
4
|
export type PgClientFactory = () => PgClient;
|
|
5
|
-
export declare const createPgClientFactory: ({ queryTimeoutMs, statementTimeoutMs, connectionTimeoutMs, ...config }: DatabaseConfig) => () => pg.Client;
|
|
5
|
+
export declare const createPgClientFactory: ({ queryTimeoutMs, statementTimeoutMs, lockTimeoutMs, connectionTimeoutMs, ...config }: DatabaseConfig) => () => pg.Client;
|
|
6
6
|
//# sourceMappingURL=pgClientFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgClientFactory.d.ts","sourceRoot":"","sources":["../../../src/utils/pgClientFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pgClientFactory.d.ts","sourceRoot":"","sources":["../../../src/utils/pgClientFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,MAAM,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAA;AAC5C,eAAO,MAAM,qBAAqB,GAChC,uFAAuF,cAAc,oBAWrG,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Literal } from '../Literal';
|
|
1
|
+
import { Literal } from '../Literal.js';
|
|
2
2
|
export declare const wrapIdentifier: (value: string) => string;
|
|
3
3
|
export declare const aliasLiteral: (raw: Literal, alias?: string) => Literal;
|
|
4
4
|
export declare const prependSchema: (tableExpression: string | Literal, schema: string, cteAliases: Set<string>) => Literal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../../src/utils/sql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../../src/utils/sql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,WAA0C,CAAA;AAEtF,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,EAAE,QAAQ,MAAM,KAAG,OAK3D,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,iBAAiB,MAAM,GAAG,OAAO,EAAE,QAAQ,MAAM,EAAE,YAAY,GAAG,CAAC,MAAM,CAAC,YASvG,CAAA;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAMpF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Connection } from '../client';
|
|
1
|
+
import { Connection } from '../client/index.js';
|
|
2
2
|
export declare const withDatabaseAdvisoryLock: <Result>(connection: Connection.ConnectionLike, lock: number, callback: () => Result | Promise<Result>) => Promise<Result>;
|
|
3
3
|
//# sourceMappingURL=withDatabaseAdvisoryLock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withDatabaseAdvisoryLock.d.ts","sourceRoot":"","sources":["../../../src/utils/withDatabaseAdvisoryLock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"withDatabaseAdvisoryLock.d.ts","sourceRoot":"","sources":["../../../src/utils/withDatabaseAdvisoryLock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,eAAO,MAAM,wBAAwB,GAAU,MAAM,EACpD,YAAY,UAAU,CAAC,cAAc,EACrC,MAAM,MAAM,EACZ,UAAU,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KACtC,OAAO,CAAC,MAAM,CAWhB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/database",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-alpha.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/production/index.js",
|
|
6
6
|
"typings": "./dist/types/index.d.ts",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@contember/queryable": "2.1.0-beta.
|
|
26
|
+
"@contember/queryable": "2.1.0-beta.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@contember/database-tester": "2.1.0-beta.
|
|
29
|
+
"@contember/database-tester": "2.1.0-beta.2",
|
|
30
30
|
"@types/node": "^24.12.0",
|
|
31
31
|
"pg": "^8.20.0"
|
|
32
32
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
2
|
-
import { Literal } from '../Literal'
|
|
3
|
-
import { columnExpressionToLiteral } from './utils'
|
|
1
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
2
|
+
import { Literal } from '../Literal.js'
|
|
3
|
+
import { columnExpressionToLiteral } from './utils.js'
|
|
4
4
|
|
|
5
5
|
class CaseStatement {
|
|
6
6
|
constructor(private readonly options: CaseStatement.Options) {}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
2
|
-
import { Literal } from '../Literal'
|
|
3
|
-
import { Value } from '../types'
|
|
4
|
-
import { ConditionBuilder, ConditionExpression } from './ConditionBuilder'
|
|
5
|
-
import { WindowFunction } from './WindowFunction'
|
|
6
|
-
import { CaseStatement } from './CaseStatement'
|
|
7
|
-
import { formatColumnIdentifier } from '../utils'
|
|
1
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
2
|
+
import { Literal } from '../Literal.js'
|
|
3
|
+
import { Value } from '../types.js'
|
|
4
|
+
import { ConditionBuilder, ConditionExpression } from './ConditionBuilder.js'
|
|
5
|
+
import { WindowFunction } from './WindowFunction.js'
|
|
6
|
+
import { CaseStatement } from './CaseStatement.js'
|
|
7
|
+
import { formatColumnIdentifier } from '../utils/index.js'
|
|
8
8
|
|
|
9
9
|
export class ColumnExpressionFactory {
|
|
10
10
|
public select(columnName: QueryBuilder.ColumnIdentifier): Literal {
|
package/src/builders/Compiler.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { aliasLiteral, assertNever, prependSchema, wrapIdentifier } from '../utils'
|
|
2
|
-
import { SelectBuilder } from './SelectBuilder'
|
|
3
|
-
import { Literal } from '../Literal'
|
|
4
|
-
import { DeleteBuilder } from './DeleteBuilder'
|
|
5
|
-
import { InsertBuilder } from './InsertBuilder'
|
|
6
|
-
import { UpdateBuilder } from './UpdateBuilder'
|
|
7
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
8
|
-
import { LockType } from './LockType'
|
|
9
|
-
import { ConflictActionType } from './ConflictActionType'
|
|
1
|
+
import { aliasLiteral, assertNever, prependSchema, wrapIdentifier } from '../utils/index.js'
|
|
2
|
+
import { SelectBuilder } from './SelectBuilder.js'
|
|
3
|
+
import { Literal } from '../Literal.js'
|
|
4
|
+
import { DeleteBuilder } from './DeleteBuilder.js'
|
|
5
|
+
import { InsertBuilder } from './InsertBuilder.js'
|
|
6
|
+
import { UpdateBuilder } from './UpdateBuilder.js'
|
|
7
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
8
|
+
import { LockType } from './LockType.js'
|
|
9
|
+
import { ConflictActionType } from './ConflictActionType.js'
|
|
10
10
|
|
|
11
11
|
class Compiler {
|
|
12
12
|
compileSelect(options: SelectBuilder.Options, namespaceContext: Compiler.Context): Literal {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Value } from '../types'
|
|
2
|
-
import { Literal } from '../Literal'
|
|
3
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
4
|
-
import { SelectBuilder } from './SelectBuilder'
|
|
5
|
-
import { Compiler } from './Compiler'
|
|
6
|
-
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries'
|
|
7
|
-
import { formatColumnIdentifier } from '../utils'
|
|
1
|
+
import { Value } from '../types.js'
|
|
2
|
+
import { Literal } from '../Literal.js'
|
|
3
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
4
|
+
import { SelectBuilder } from './SelectBuilder.js'
|
|
5
|
+
import { Compiler } from './Compiler.js'
|
|
6
|
+
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries.js'
|
|
7
|
+
import { formatColumnIdentifier } from '../utils/index.js'
|
|
8
8
|
|
|
9
9
|
export type ConditionCallback = (builder: ConditionBuilder) => ConditionBuilder
|
|
10
10
|
export type ConditionExpression = ConditionBuilder | ConditionCallback
|
|
@@ -22,6 +22,8 @@ export enum Operator {
|
|
|
22
22
|
'containsCI' = 'containsCI',
|
|
23
23
|
'startsWithCI' = 'startsWithCI',
|
|
24
24
|
'endsWithCI' = 'endsWithCI',
|
|
25
|
+
'similar' = 'similar',
|
|
26
|
+
'wordSimilar' = 'wordSimilar',
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
const likeOperators: string[] = [
|
|
@@ -170,6 +172,10 @@ export class ConditionBuilder {
|
|
|
170
172
|
return `${left} LIKE '%' || ${right}`
|
|
171
173
|
case Operator.endsWithCI:
|
|
172
174
|
return `${left} ILIKE '%' || ${right}`
|
|
175
|
+
case Operator.similar:
|
|
176
|
+
return `${left} % ${right}`
|
|
177
|
+
case Operator.wordSimilar:
|
|
178
|
+
return `${right} <% ${left}`
|
|
173
179
|
}
|
|
174
180
|
return `${left} ${operator} ${right}`
|
|
175
181
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Returning } from './internal/Returning'
|
|
2
|
-
import { With } from './internal/With'
|
|
3
|
-
import { Where } from './internal/Where'
|
|
4
|
-
import { Compiler } from './Compiler'
|
|
5
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
6
|
-
import { Client, Connection } from '../client'
|
|
7
|
-
import { Literal } from '../Literal'
|
|
8
|
-
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries'
|
|
1
|
+
import { Returning } from './internal/Returning.js'
|
|
2
|
+
import { With } from './internal/With.js'
|
|
3
|
+
import { Where } from './internal/Where.js'
|
|
4
|
+
import { Compiler } from './Compiler.js'
|
|
5
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
6
|
+
import { Client, Connection } from '../client/index.js'
|
|
7
|
+
import { Literal } from '../Literal.js'
|
|
8
|
+
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries.js'
|
|
9
9
|
|
|
10
10
|
class DeleteBuilder<Result extends DeleteBuilder.DeleteResult> implements Returning.Aware, With.Aware, Where.Aware, QueryBuilder {
|
|
11
11
|
private constructor(private readonly options: DeleteBuilder.Options) {}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Returning } from './internal/Returning'
|
|
2
|
-
import { With } from './internal/With'
|
|
3
|
-
import { Compiler } from './Compiler'
|
|
4
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
5
|
-
import { Client, Connection } from '../client'
|
|
6
|
-
import { Literal } from '../Literal'
|
|
7
|
-
import { SelectBuilder } from './SelectBuilder'
|
|
8
|
-
import { resolveValues } from './utils'
|
|
9
|
-
import { ConflictActionType } from './ConflictActionType'
|
|
10
|
-
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries'
|
|
11
|
-
import { Where } from './internal/Where'
|
|
1
|
+
import { Returning } from './internal/Returning.js'
|
|
2
|
+
import { With } from './internal/With.js'
|
|
3
|
+
import { Compiler } from './Compiler.js'
|
|
4
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
5
|
+
import { Client, Connection } from '../client/index.js'
|
|
6
|
+
import { Literal } from '../Literal.js'
|
|
7
|
+
import { SelectBuilder } from './SelectBuilder.js'
|
|
8
|
+
import { resolveValues } from './utils.js'
|
|
9
|
+
import { ConflictActionType } from './ConflictActionType.js'
|
|
10
|
+
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries.js'
|
|
11
|
+
import { Where } from './internal/Where.js'
|
|
12
12
|
|
|
13
13
|
class InsertBuilder<Result extends InsertBuilder.InsertResult> implements With.Aware, QueryBuilder {
|
|
14
14
|
private constructor(private readonly options: InsertBuilder.Options) {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
2
|
-
import { SelectBuilder } from './SelectBuilder'
|
|
3
|
-
import { Operator } from './ConditionBuilder'
|
|
4
|
-
import { Client } from '../client'
|
|
5
|
-
import { WindowFunction } from './WindowFunction'
|
|
1
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
2
|
+
import { SelectBuilder } from './SelectBuilder.js'
|
|
3
|
+
import { Operator } from './ConditionBuilder.js'
|
|
4
|
+
import { Client } from '../client/index.js'
|
|
5
|
+
import { WindowFunction } from './WindowFunction.js'
|
|
6
6
|
|
|
7
7
|
type OrderByCallback = <Orderable extends QueryBuilder.Orderable<any> | null>(
|
|
8
8
|
orderable: Orderable,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Literal } from '../Literal'
|
|
2
|
-
import { Value } from '../types'
|
|
3
|
-
import { ColumnExpressionFactory } from './ColumnExpressionFactory'
|
|
4
|
-
import { Compiler } from './Compiler'
|
|
5
|
-
import { SelectBuilder } from './SelectBuilder'
|
|
1
|
+
import { Literal } from '../Literal.js'
|
|
2
|
+
import { Value } from '../types.js'
|
|
3
|
+
import { ColumnExpressionFactory } from './ColumnExpressionFactory.js'
|
|
4
|
+
import { Compiler } from './Compiler.js'
|
|
5
|
+
import { SelectBuilder } from './SelectBuilder.js'
|
|
6
6
|
|
|
7
7
|
interface QueryBuilder {
|
|
8
8
|
createQuery(context: Compiler.Context): Literal
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { With } from './internal/With'
|
|
2
|
-
import { Where } from './internal/Where'
|
|
3
|
-
import { aliasLiteral, formatColumnIdentifier } from '../utils'
|
|
4
|
-
import { Compiler } from './Compiler'
|
|
5
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
6
|
-
import { Client, Connection } from '../client'
|
|
7
|
-
import { Literal } from '../Literal'
|
|
8
|
-
import { ConditionBuilder, ConditionExpression } from './ConditionBuilder'
|
|
9
|
-
import { LockModifier, LockType } from './LockType'
|
|
10
|
-
import { columnExpressionToLiteral } from './utils'
|
|
11
|
-
import { createSubQueryLiteralFactory, SubQueryExpression, SubQueryLiteralFactory } from './internal/Subqueries'
|
|
1
|
+
import { With } from './internal/With.js'
|
|
2
|
+
import { Where } from './internal/Where.js'
|
|
3
|
+
import { aliasLiteral, formatColumnIdentifier } from '../utils/index.js'
|
|
4
|
+
import { Compiler } from './Compiler.js'
|
|
5
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
6
|
+
import { Client, Connection } from '../client/index.js'
|
|
7
|
+
import { Literal } from '../Literal.js'
|
|
8
|
+
import { ConditionBuilder, ConditionExpression } from './ConditionBuilder.js'
|
|
9
|
+
import { LockModifier, LockType } from './LockType.js'
|
|
10
|
+
import { columnExpressionToLiteral } from './utils.js'
|
|
11
|
+
import { createSubQueryLiteralFactory, SubQueryExpression, SubQueryLiteralFactory } from './internal/Subqueries.js'
|
|
12
12
|
|
|
13
13
|
export type SelectBuilderSpecification = <Result>(qb: SelectBuilder<Result>) => SelectBuilder<Result>
|
|
14
14
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Returning } from './internal/Returning'
|
|
2
|
-
import { With } from './internal/With'
|
|
3
|
-
import { Where } from './internal/Where'
|
|
4
|
-
import { Compiler } from './Compiler'
|
|
5
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
6
|
-
import { Client, Connection } from '../client'
|
|
7
|
-
import { Literal } from '../Literal'
|
|
8
|
-
import { SelectBuilder } from './SelectBuilder'
|
|
9
|
-
import { resolveValues } from './utils'
|
|
10
|
-
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries'
|
|
1
|
+
import { Returning } from './internal/Returning.js'
|
|
2
|
+
import { With } from './internal/With.js'
|
|
3
|
+
import { Where } from './internal/Where.js'
|
|
4
|
+
import { Compiler } from './Compiler.js'
|
|
5
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
6
|
+
import { Client, Connection } from '../client/index.js'
|
|
7
|
+
import { Literal } from '../Literal.js'
|
|
8
|
+
import { SelectBuilder } from './SelectBuilder.js'
|
|
9
|
+
import { resolveValues } from './utils.js'
|
|
10
|
+
import { createSubQueryLiteralFactory, SubQueryExpression } from './internal/Subqueries.js'
|
|
11
11
|
|
|
12
12
|
class UpdateBuilder<Result extends UpdateBuilder.UpdateResult> implements With.Aware, Where.Aware, QueryBuilder {
|
|
13
13
|
private constructor(private readonly options: UpdateBuilder.Options) {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
2
|
-
import { Literal } from '../Literal'
|
|
3
|
-
import { columnExpressionToLiteral } from './utils'
|
|
4
|
-
import { formatColumnIdentifier } from '../utils'
|
|
1
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
2
|
+
import { Literal } from '../Literal.js'
|
|
3
|
+
import { columnExpressionToLiteral } from './utils.js'
|
|
4
|
+
import { formatColumnIdentifier } from '../utils/index.js'
|
|
5
5
|
|
|
6
6
|
class WindowFunction<HasFunction extends boolean> implements QueryBuilder.Orderable<WindowFunction<HasFunction>> {
|
|
7
7
|
private constructor(
|
package/src/builders/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './Compiler'
|
|
2
|
-
export * from './CaseStatement'
|
|
3
|
-
export * from './ConditionBuilder'
|
|
4
|
-
export * from './DeleteBuilder'
|
|
5
|
-
export * from './InsertBuilder'
|
|
6
|
-
export * from './LimitByGroupWrapper'
|
|
7
|
-
export * from './QueryBuilder'
|
|
8
|
-
export * from './SelectBuilder'
|
|
9
|
-
export * from './UpdateBuilder'
|
|
10
|
-
export * from './WindowFunction'
|
|
11
|
-
export * from './LockType'
|
|
12
|
-
export * from './ConflictActionType'
|
|
1
|
+
export * from './Compiler.js'
|
|
2
|
+
export * from './CaseStatement.js'
|
|
3
|
+
export * from './ConditionBuilder.js'
|
|
4
|
+
export * from './DeleteBuilder.js'
|
|
5
|
+
export * from './InsertBuilder.js'
|
|
6
|
+
export * from './LimitByGroupWrapper.js'
|
|
7
|
+
export * from './QueryBuilder.js'
|
|
8
|
+
export * from './SelectBuilder.js'
|
|
9
|
+
export * from './UpdateBuilder.js'
|
|
10
|
+
export * from './WindowFunction.js'
|
|
11
|
+
export * from './LockType.js'
|
|
12
|
+
export * from './ConflictActionType.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QueryBuilder } from '../'
|
|
2
|
-
import { Literal } from '../../Literal'
|
|
3
|
-
import { Connection } from '../../client'
|
|
4
|
-
import { formatColumnIdentifier } from '../../utils'
|
|
1
|
+
import { QueryBuilder } from '../index.js'
|
|
2
|
+
import { Literal } from '../../Literal.js'
|
|
3
|
+
import { Connection } from '../../client/index.js'
|
|
4
|
+
import { formatColumnIdentifier } from '../../utils/index.js'
|
|
5
5
|
|
|
6
6
|
class Returning {
|
|
7
7
|
constructor(private readonly columns: (QueryBuilder.ColumnIdentifier | Literal)[] = []) {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Compiler } from '../Compiler'
|
|
2
|
-
import { Literal } from '../../Literal'
|
|
3
|
-
import { SelectBuilder } from '../SelectBuilder'
|
|
4
|
-
import { QueryBuilder } from '../QueryBuilder'
|
|
1
|
+
import { Compiler } from '../Compiler.js'
|
|
2
|
+
import { Literal } from '../../Literal.js'
|
|
3
|
+
import { SelectBuilder } from '../SelectBuilder.js'
|
|
4
|
+
import { QueryBuilder } from '../QueryBuilder.js'
|
|
5
5
|
|
|
6
6
|
export type SubQueryLiteralFactory<Builder extends QueryBuilder = QueryBuilder> = (
|
|
7
7
|
context: Compiler.Context,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { wrapIdentifier } from '../../utils'
|
|
2
|
-
import { Literal } from '../../Literal'
|
|
3
|
-
import { ConditionBuilder, ConditionCallback } from '../ConditionBuilder'
|
|
4
|
-
import { Value } from '../../types'
|
|
1
|
+
import { wrapIdentifier } from '../../utils/index.js'
|
|
2
|
+
import { Literal } from '../../Literal.js'
|
|
3
|
+
import { ConditionBuilder, ConditionCallback } from '../ConditionBuilder.js'
|
|
4
|
+
import { Value } from '../../types.js'
|
|
5
5
|
|
|
6
6
|
namespace Where {
|
|
7
7
|
export interface Options {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { wrapIdentifier } from '../../utils'
|
|
2
|
-
import { Literal } from '../../Literal'
|
|
3
|
-
import { Compiler } from '../Compiler'
|
|
4
|
-
import { SubQueryExpression, SubQueryLiteralFactory } from './Subqueries'
|
|
1
|
+
import { wrapIdentifier } from '../../utils/index.js'
|
|
2
|
+
import { Literal } from '../../Literal.js'
|
|
3
|
+
import { Compiler } from '../Compiler.js'
|
|
4
|
+
import { SubQueryExpression, SubQueryLiteralFactory } from './Subqueries.js'
|
|
5
5
|
|
|
6
6
|
namespace With {
|
|
7
7
|
type CteOptions = {
|
package/src/builders/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Literal } from '../Literal'
|
|
2
|
-
import { QueryBuilder } from './QueryBuilder'
|
|
3
|
-
import { ColumnExpressionFactory } from './ColumnExpressionFactory'
|
|
4
|
-
import { formatColumnIdentifier } from '../utils'
|
|
1
|
+
import { Literal } from '../Literal.js'
|
|
2
|
+
import { QueryBuilder } from './QueryBuilder.js'
|
|
3
|
+
import { ColumnExpressionFactory } from './ColumnExpressionFactory.js'
|
|
4
|
+
import { formatColumnIdentifier } from '../utils/index.js'
|
|
5
5
|
|
|
6
6
|
export function resolveValues(values: QueryBuilder.Values): QueryBuilder.ResolvedValues {
|
|
7
7
|
return Object.entries(values)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Connection } from './Connection'
|
|
2
|
-
import { EventManager } from './EventManager'
|
|
3
|
-
import { Mutex } from '../utils'
|
|
4
|
-
import { executeTransaction, Transaction } from './Transaction'
|
|
5
|
-
import { ClientErrorCodes } from './errorCodes'
|
|
1
|
+
import { Connection } from './Connection.js'
|
|
2
|
+
import { EventManager } from './EventManager.js'
|
|
3
|
+
import { Mutex } from '../utils/index.js'
|
|
4
|
+
import { executeTransaction, Transaction } from './Transaction.js'
|
|
5
|
+
import { ClientErrorCodes } from './errorCodes.js'
|
|
6
6
|
import {
|
|
7
7
|
ForeignKeyViolationError,
|
|
8
8
|
InvalidDataError,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
SerializationFailureError,
|
|
12
12
|
TransactionAbortedError,
|
|
13
13
|
UniqueViolationError,
|
|
14
|
-
} from './errors'
|
|
15
|
-
import { PgClient } from './PgClient'
|
|
14
|
+
} from './errors.js'
|
|
15
|
+
import { PgClient } from './PgClient.js'
|
|
16
16
|
import { Notification } from 'pg'
|
|
17
17
|
|
|
18
18
|
export class AcquiredConnection implements Connection.AcquiredConnectionLike {
|
package/src/client/Client.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DeleteBuilder, InsertBuilder, SelectBuilder, UpdateBuilder } from '../builders'
|
|
2
|
-
import { DatabaseQueryable } from '../queryable'
|
|
3
|
-
import { Connection } from './Connection'
|
|
4
|
-
import { EventManager } from './EventManager'
|
|
1
|
+
import { DeleteBuilder, InsertBuilder, SelectBuilder, UpdateBuilder } from '../builders/index.js'
|
|
2
|
+
import { DatabaseQueryable } from '../queryable/index.js'
|
|
3
|
+
import { Connection } from './Connection.js'
|
|
4
|
+
import { EventManager } from './EventManager.js'
|
|
5
5
|
import { QueryHandler } from '@contember/queryable'
|
|
6
|
-
import { withDatabaseAdvisoryLock, wrapIdentifier } from '../utils'
|
|
6
|
+
import { withDatabaseAdvisoryLock, wrapIdentifier } from '../utils/index.js'
|
|
7
7
|
|
|
8
8
|
class Client<ConnectionType extends Connection.ConnectionLike = Connection.ConnectionLike> implements Connection.Queryable {
|
|
9
9
|
constructor(
|
package/src/client/Connection.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { EventManager } from './EventManager'
|
|
2
|
-
import { Client } from './Client'
|
|
3
|
-
import { Pool, PoolConfig, PoolStatus } from './Pool'
|
|
4
|
-
import { createPgClientFactory } from '../utils'
|
|
5
|
-
import { DatabaseConfig } from '../types'
|
|
6
|
-
import { AcquiredConnection } from './AcquiredConnection'
|
|
1
|
+
import { EventManager } from './EventManager.js'
|
|
2
|
+
import { Client } from './Client.js'
|
|
3
|
+
import { Pool, PoolConfig, PoolStatus } from './Pool.js'
|
|
4
|
+
import { createPgClientFactory } from '../utils/index.js'
|
|
5
|
+
import { DatabaseConfig } from '../types.js'
|
|
6
|
+
import { AcquiredConnection } from './AcquiredConnection.js'
|
|
7
|
+
import { ScopeLimitedConnection } from './ScopeLimitedConnection.js'
|
|
7
8
|
import { Notification } from 'pg'
|
|
8
9
|
|
|
9
10
|
class Connection implements Connection.ConnectionLike, Connection.ClientFactory, Connection.PoolStatusProvider {
|
|
@@ -31,6 +32,17 @@ class Connection implements Connection.ConnectionLike, Connection.ClientFactory,
|
|
|
31
32
|
return new Client(this, schema, queryMeta, new EventManager(this.eventManager))
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Returns a view of this connection that limits how many pool connections may be
|
|
37
|
+
* acquired concurrently through it. Intended to be created per HTTP request so that
|
|
38
|
+
* a single request cannot starve the shared pool. The returned view shares the same
|
|
39
|
+
* underlying pool; only top-level scopes are counted (nested scopes reuse the already
|
|
40
|
+
* acquired connection), so the limit must be at least 1.
|
|
41
|
+
*/
|
|
42
|
+
public withMaxConnections(maxConnections: number): Connection.ConnectionType {
|
|
43
|
+
return new ScopeLimitedConnection(this, maxConnections)
|
|
44
|
+
}
|
|
45
|
+
|
|
34
46
|
async scope<Result>(
|
|
35
47
|
callback: (connection: Connection.AcquiredConnectionLike) => Promise<Result> | Result,
|
|
36
48
|
options: { eventManager?: EventManager } = {},
|
package/src/client/Pool.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ImplementationException } from '../exceptions'
|
|
2
|
-
import { ClientErrorCodes } from './errorCodes'
|
|
1
|
+
import { ImplementationException } from '../exceptions.js'
|
|
2
|
+
import { ClientErrorCodes } from './errorCodes.js'
|
|
3
3
|
import { EventEmitter } from 'node:events'
|
|
4
|
-
import { ClientError, DatabaseError } from './errors'
|
|
5
|
-
import { PgClientFactory } from '../utils'
|
|
6
|
-
import { PgClient } from './PgClient'
|
|
4
|
+
import { ClientError, DatabaseError } from './errors.js'
|
|
5
|
+
import { PgClientFactory } from '../utils/index.js'
|
|
6
|
+
import { PgClient } from './PgClient.js'
|
|
7
7
|
|
|
8
8
|
export type PoolLogger = (message: string, status: PoolStatus) => void
|
|
9
9
|
|