slonik
Advanced tools
Comparing version 40.2.1 to 40.2.2
@@ -215,2 +215,5 @@ "use strict"; | ||
} | ||
if (Array.isArray(result)) { | ||
throw new errors_1.InvalidInputError('Must not use multiple statements in a single query.'); | ||
} | ||
return { | ||
@@ -217,0 +220,0 @@ command: result.command, |
@@ -69,2 +69,11 @@ "use strict"; | ||
}); | ||
test('produces error if multiple statements are passed as the query input', async (t) => { | ||
const pool = await (0, __1.createPool)(t.context.dsn, { | ||
driverFactory, | ||
}); | ||
const error = await t.throwsAsync(pool.query(__1.sql.unsafe ` | ||
SELECT 1; SELECT 2; | ||
`)); | ||
t.true(error instanceof __1.InvalidInputError); | ||
}); | ||
test('NotNullIntegrityConstraintViolationError identifies the table and column', async (t) => { | ||
@@ -71,0 +80,0 @@ const pool = await (0, __1.createPool)(t.context.dsn, { |
@@ -46,3 +46,3 @@ /// <reference types="node" /> | ||
export { createTimestampWithTimeZoneTypeParser } from './factories/typeParsers/createTimestampWithTimeZoneTypeParser'; | ||
export type { ArraySqlToken, BinarySqlToken, ClientConfiguration, ClientConfigurationInput, CommonQueryMethods, Connection, ConnectionOptions, ConnectionRoutine, DatabaseConnection, DatabasePool, DatabasePoolConnection, DatabaseTransactionConnection, Field, FragmentSqlToken, IdentifierNormalizer, IdentifierSqlToken, Interceptor, JsonBinarySqlToken, JsonSqlToken, ListSqlToken, MaybePromise, MockPoolOverrides, PoolContext, PrimitiveValueExpression, Query, QueryContext, QueryFunction, QueryResult, QueryResultRow, QueryResultRowColumn, QuerySqlToken, SerializableValue, SqlFragment, SqlTag, SqlToken, TypeNameIdentifier, TypeParser, UnnestSqlToken, ValueExpression, } from './types'; | ||
export type { ArraySqlToken, BinarySqlToken, ClientConfiguration, ClientConfigurationInput, CommonQueryMethods, Connection, ConnectionOptions, ConnectionRoutine, DatabaseConnection, DatabasePool, DatabasePoolConnection, DatabaseTransactionConnection, Field, FragmentSqlToken, IdentifierNormalizer, IdentifierSqlToken, Interceptor, JsonBinarySqlToken, JsonSqlToken, ListSqlToken, MaybePromise, PoolContext, PrimitiveValueExpression, Query, QueryContext, QueryFunction, QueryResult, QueryResultRow, QueryResultRowColumn, QuerySqlToken, SerializableValue, SqlFragment, SqlTag, SqlToken, TypeNameIdentifier, TypeParser, UnnestSqlToken, ValueExpression, } from './types'; | ||
export { isSqlToken } from './utilities/isSqlToken'; | ||
@@ -49,0 +49,0 @@ export { parseDsn } from './utilities/parseDsn'; |
@@ -337,6 +337,3 @@ /// <reference types="node" /> | ||
export type IdentifierNormalizer = (identifierName: string) => string; | ||
export type MockPoolOverrides = { | ||
readonly query: (sql: string, values: readonly PrimitiveValueExpression[]) => Promise<QueryResult<QueryResultRow>>; | ||
}; | ||
export type { Logger } from 'roarr'; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -34,3 +34,2 @@ { | ||
"get-port": "^5.1.1", | ||
"gitdown": "^3.1.5", | ||
"husky": "^9.0.11", | ||
@@ -89,3 +88,2 @@ "knip": "^5.5.0", | ||
"build": "rm -fr ./dist && tsc --project ./tsconfig.build.json", | ||
"create-readme": "gitdown ./.README/README.md --output-file ./README.md", | ||
"lint": "npm run lint:cspell && npm run lint:eslint && npm run lint:knip && npm run lint:tsc", | ||
@@ -99,3 +97,3 @@ "lint:cspell": "cspell . --no-progress --gitignore", | ||
"types": "./dist/index.d.ts", | ||
"version": "40.2.1" | ||
"version": "40.2.2" | ||
} |
@@ -312,2 +312,8 @@ /* eslint-disable canonical/id-match */ | ||
if (Array.isArray(result)) { | ||
throw new InvalidInputError( | ||
'Must not use multiple statements in a single query.', | ||
); | ||
} | ||
return { | ||
@@ -314,0 +320,0 @@ command: result.command as DriverCommand, |
@@ -82,2 +82,16 @@ /* eslint-disable id-length */ | ||
test('produces error if multiple statements are passed as the query input', async (t) => { | ||
const pool = await createPool(t.context.dsn, { | ||
driverFactory, | ||
}); | ||
const error = await t.throwsAsync( | ||
pool.query(sql.unsafe` | ||
SELECT 1; SELECT 2; | ||
`), | ||
); | ||
t.true(error instanceof InvalidInputError); | ||
}); | ||
test('NotNullIntegrityConstraintViolationError identifies the table and column', async (t) => { | ||
@@ -84,0 +98,0 @@ const pool = await createPool(t.context.dsn, { |
@@ -74,3 +74,2 @@ import { createSqlTag } from './factories/createSqlTag'; | ||
MaybePromise, | ||
MockPoolOverrides, | ||
PoolContext, | ||
@@ -77,0 +76,0 @@ PrimitiveValueExpression, |
@@ -567,9 +567,2 @@ import { type SlonikError } from './errors'; | ||
export type MockPoolOverrides = { | ||
readonly query: ( | ||
sql: string, | ||
values: readonly PrimitiveValueExpression[], | ||
) => Promise<QueryResult<QueryResultRow>>; | ||
}; | ||
export type { Logger } from 'roarr'; |
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 too big to display
19
18583
1041471
2797