You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

@contember/database

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/database - npm Package Compare versions

Comparing version

to
1.2.0-alpha.3

/// <reference types="node" />
/// <reference types="node" />
import { Client as PgClient } from 'pg';

@@ -3,0 +4,0 @@ import EventEmitter from 'events';

@@ -232,3 +232,3 @@ "use strict";

this.log('Recoverable error, max retries reached.');
this.emit('e', e);
this.emit('error', e);
this.connectingCount--;

@@ -235,0 +235,0 @@ }

@@ -12,3 +12,3 @@ import { With } from './builders/internal/With';

export * from './types';
export { wrapIdentifier, retryTransaction, ConstraintHelper, withDatabaseAdvisoryLock, createDatabaseIfNotExists, createPgClientFactory, } from './utils';
export { asyncIterableTransaction, wrapIdentifier, retryTransaction, ConstraintHelper, withDatabaseAdvisoryLock, createDatabaseIfNotExists, createPgClientFactory, } from './utils';
//# sourceMappingURL=index.d.ts.map

@@ -17,3 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createPgClientFactory = exports.createDatabaseIfNotExists = exports.withDatabaseAdvisoryLock = exports.ConstraintHelper = exports.retryTransaction = exports.wrapIdentifier = void 0;
exports.createPgClientFactory = exports.createDatabaseIfNotExists = exports.withDatabaseAdvisoryLock = exports.ConstraintHelper = exports.retryTransaction = exports.wrapIdentifier = exports.asyncIterableTransaction = void 0;
__exportStar(require("./client"), exports);

@@ -25,2 +25,3 @@ __exportStar(require("./builders"), exports);

var utils_1 = require("./utils");
Object.defineProperty(exports, "asyncIterableTransaction", { enumerable: true, get: function () { return utils_1.asyncIterableTransaction; } });
Object.defineProperty(exports, "wrapIdentifier", { enumerable: true, get: function () { return utils_1.wrapIdentifier; } });

@@ -27,0 +28,0 @@ Object.defineProperty(exports, "retryTransaction", { enumerable: true, get: function () { return utils_1.retryTransaction; } });

export * from './assertNever';
export * from './asyncIterableTransaction';
export * from './ConstraintHelper';

@@ -3,0 +4,0 @@ export * from './createDatabaseIfNotExists';

@@ -18,2 +18,3 @@ "use strict";

__exportStar(require("./assertNever"), exports);
__exportStar(require("./asyncIterableTransaction"), exports);
__exportStar(require("./ConstraintHelper"), exports);

@@ -20,0 +21,0 @@ __exportStar(require("./createDatabaseIfNotExists"), exports);

import { Literal } from '../Literal';
export declare const wrapIdentifier: (value: string) => string;
export declare const aliasLiteral: (raw: Literal, alias?: string | undefined) => Literal;
export declare const aliasLiteral: (raw: Literal, alias?: string) => Literal;
export declare const prependSchema: (tableExpression: string | Literal, schema: string, cteAliases: Set<string>) => Literal;
//# sourceMappingURL=sql.d.ts.map

@@ -258,2 +258,4 @@ "use strict";

});
pool.on('error', () => {
});
pgClientMock.connections.push(createRecoverableErrorPromise(), createRecoverableErrorPromise());

@@ -283,7 +285,9 @@ await (0, vitest_1.expect)(async () => await pool.acquire()).rejects.toThrowError('Failed to acquire a connection. Last error: too many connection');

pgClientMock.connections.push(createErrorPromise());
const poolError = new Promise((resolve, reject) => pool.once('error', e => {
reject(e);
pool.on('error', () => {
});
const poolError = new Promise(resolve => pool.once('error', e => {
resolve(e);
}));
await (0, vitest_1.expect)(pool.acquire.bind(pool)).rejects.toThrowError('Failed to acquire a connection');
await (0, vitest_1.expect)(poolError).rejects.toThrowError('my err');
await (0, vitest_1.expect)(poolError).resolves.toEqual(new Error('my err'));
await timeout(4);

@@ -290,0 +294,0 @@ (0, vitest_1.expect)(logger.messages).toMatchInlineSnapshot(`

{
"name": "@contember/database",
"version": "1.2.0-alpha.2",
"version": "1.2.0-alpha.3",
"license": "Apache-2.0",

@@ -11,7 +11,7 @@ "main": "dist/src/index.js",

"dependencies": {
"@contember/queryable": "^1.2.0-alpha.2"
"@contember/queryable": "^1.2.0-alpha.3"
},
"devDependencies": {
"@contember/database-tester": "^1.2.0-alpha.2",
"@types/node": "^17.0.5",
"@contember/database-tester": "^1.2.0-alpha.3",
"@types/node": "^16",
"pg": "^8.5.0"

@@ -18,0 +18,0 @@ },

@@ -315,3 +315,3 @@ import { ImplementationException } from '../exceptions'

this.log('Recoverable error, max retries reached.')
this.emit('e', e)
this.emit('error', e)
this.connectingCount--

@@ -318,0 +318,0 @@ } else {

@@ -15,2 +15,3 @@ import { With } from './builders/internal/With'

export {
asyncIterableTransaction,
wrapIdentifier,

@@ -17,0 +18,0 @@ retryTransaction,

export * from './assertNever'
export * from './asyncIterableTransaction'
export * from './ConstraintHelper'

@@ -3,0 +4,0 @@ export * from './createDatabaseIfNotExists'

@@ -278,2 +278,4 @@ import { expect, it, beforeAll } from 'vitest'

})
pool.on('error', () => {
})
pgClientMock.connections.push(createRecoverableErrorPromise(), createRecoverableErrorPromise())

@@ -304,8 +306,11 @@ await expect(async () => await pool.acquire()).rejects.toThrowError('Failed to acquire a connection. Last error: too many connection')

pgClientMock.connections.push(createErrorPromise())
const poolError = new Promise((resolve, reject) => pool.once('error', e => {
reject(e)
pool.on('error', () => {
})
const poolError = new Promise(resolve => pool.once('error', e => {
resolve(e)
}))
await expect(pool.acquire.bind(pool)).rejects.toThrowError('Failed to acquire a connection')
await expect(poolError).rejects.toThrowError('my err')
await expect(poolError).resolves.toEqual(new Error('my err'))

@@ -312,0 +317,0 @@ await timeout(4)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet