Socket
Socket
Sign inDemoInstall

slonik

Package Overview
Dependencies
Maintainers
1
Versions
395
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slonik - npm Package Compare versions

Comparing version 45.6.0 to 46.0.0

dist/integration.test/lost-connection.test.d.ts

9

dist/factories/createConnectionPool.js

@@ -41,3 +41,5 @@ "use strict";

await (0, promises_1.setTimeout)(0);
await Promise.all(connections.map((connection) => connection.destroy()));
// Make a copy of `connections` array as items are removed from it during the map iteration.
// If `connections` array is used directly, the loop will skip some items.
await Promise.all([...connections].map((connection) => connection.destroy()));
};

@@ -59,3 +61,6 @@ const acquire = async () => {

pendingConnections.push(pendingConnection);
const connection = await pendingConnection;
const connection = await pendingConnection.catch((error) => {
pendingConnections.pop();
throw error;
});
const onRelease = () => {

@@ -62,0 +67,0 @@ const waitingClient = waitingClients.shift();

@@ -136,7 +136,8 @@ "use strict";

const error = await t.throwsAsync(pool.any(__1.sql.unsafe `
INSERT INTO person (name) VALUES (null)
`));
INSERT INTO person (name) VALUES (null)
`));
t.true(error instanceof __1.NotNullIntegrityConstraintViolationError);
t.is(error?.table, 'person');
t.is(error?.column, 'name');
const notNullIntegrityConstraintViolationError = error;
t.is(notNullIntegrityConstraintViolationError?.table, 'person');
t.is(notNullIntegrityConstraintViolationError?.column, 'name');
});

@@ -163,3 +164,4 @@ test('properly handles terminated connections', async (t) => {

t.true(error instanceof __1.InputSyntaxError);
t.is(error?.sql, 'SELECT WHERE');
const inputSyntaxError = error;
t.is(inputSyntaxError?.sql, 'SELECT WHERE');
await pool.end();

@@ -718,3 +720,3 @@ });

driverFactory,
idleTimeout: 500,
idleTimeout: 'DISABLE_TIMEOUT',
maximumPoolSize: 5,

@@ -756,3 +758,2 @@ });

await pool.end();
await (0, promises_1.setTimeout)(600);
t.deepEqual(pool.state(), {

@@ -759,0 +760,0 @@ acquiredConnections: 0,

@@ -1,2 +0,5 @@

export {};
export declare const startTestContainer: () => Promise<{
dsn: string;
terminate: () => void;
}>;
//# sourceMappingURL=termination.test.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.startTestContainer = void 0;
const __1 = require("..");

@@ -60,2 +61,3 @@ const ava_1 = __importDefault(require("ava"));

};
exports.startTestContainer = startTestContainer;
/**

@@ -73,3 +75,3 @@ * @see https://github.com/brianc/node-postgres/issues/3083

}
const { dsn, terminate } = await startTestContainer();
const { dsn, terminate } = await (0, exports.startTestContainer)();
const pool = await (0, __1.createPool)(dsn);

@@ -76,0 +78,0 @@ // eslint-disable-next-line promise/prefer-await-to-then

@@ -8,7 +8,7 @@ {

"dependencies": {
"@slonik/driver": "^45.6.0",
"@slonik/errors": "^45.6.0",
"@slonik/pg-driver": "^45.6.0",
"@slonik/sql-tag": "^45.6.0",
"@slonik/utilities": "^45.6.0",
"@slonik/driver": "^46.0.0",
"@slonik/errors": "^46.0.0",
"@slonik/pg-driver": "^46.0.0",
"@slonik/sql-tag": "^46.0.0",
"@slonik/utilities": "^46.0.0",
"get-stack-trace": "^3.1.1",

@@ -24,3 +24,3 @@ "iso8601-duration": "^1.3.0",

"@types/sinon": "^10.0.20",
"ava": "^5.3.1",
"ava": "^6.1.3",
"cspell": "^8.6.0",

@@ -34,3 +34,3 @@ "eslint": "^8.57.0",

"ts-node": "^10.9.1",
"typescript": "^5.4.3",
"typescript": "^5.4.5",
"zod": "^3.22.4"

@@ -89,3 +89,3 @@ },

"types": "./dist/index.d.ts",
"version": "45.6.0"
"version": "46.0.0"
}

@@ -111,3 +111,7 @@ import { Logger } from '../Logger';

await Promise.all(connections.map((connection) => connection.destroy()));
// Make a copy of `connections` array as items are removed from it during the map iteration.
// If `connections` array is used directly, the loop will skip some items.
await Promise.all(
[...connections].map((connection) => connection.destroy()),
);
};

@@ -139,3 +143,6 @@

const connection = await pendingConnection;
const connection = await pendingConnection.catch((error) => {
pendingConnections.pop();
throw error;
});

@@ -142,0 +149,0 @@ const onRelease = () => {

@@ -179,12 +179,15 @@ /* eslint-disable id-length */

const error: NotNullIntegrityConstraintViolationError | undefined =
await t.throwsAsync(
pool.any(sql.unsafe`
INSERT INTO person (name) VALUES (null)
`),
);
const error: Error | undefined = await t.throwsAsync(
pool.any(sql.unsafe`
INSERT INTO person (name) VALUES (null)
`),
);
t.true(error instanceof NotNullIntegrityConstraintViolationError);
t.is(error?.table, 'person');
t.is(error?.column, 'name');
const notNullIntegrityConstraintViolationError =
error as NotNullIntegrityConstraintViolationError;
t.is(notNullIntegrityConstraintViolationError?.table, 'person');
t.is(notNullIntegrityConstraintViolationError?.column, 'name');
});

@@ -216,3 +219,3 @@

const error: InputSyntaxError | undefined = await t.throwsAsync(
const error: Error | undefined = await t.throwsAsync(
pool.any(sql.unsafe`SELECT WHERE`),

@@ -223,4 +226,6 @@ );

t.is(error?.sql, 'SELECT WHERE');
const inputSyntaxError = error as InputSyntaxError;
t.is(inputSyntaxError?.sql, 'SELECT WHERE');
await pool.end();

@@ -927,3 +932,3 @@ });

driverFactory,
idleTimeout: 500,
idleTimeout: 'DISABLE_TIMEOUT',
maximumPoolSize: 5,

@@ -970,4 +975,2 @@ });

await delay(600);
t.deepEqual(pool.state(), {

@@ -974,0 +977,0 @@ acquiredConnections: 0,

@@ -10,3 +10,3 @@ /* eslint-disable no-console */

const startTestContainer = async () => {
export const startTestContainer = async () => {
const dockerContainerName = `slonik-test-${randomUUID()}`;

@@ -13,0 +13,0 @@ const servicePort = await getPort();

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc