🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@mikro-orm/knex

Package Overview
Dependencies
Maintainers
1
Versions
3929
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mikro-orm/knex - npm Package Compare versions

Comparing version
6.6.16-dev.0
to
6.6.16-dev.1
+6
-0
AbstractSqlPlatform.d.ts

@@ -35,2 +35,8 @@ import { Platform, type Constructor, type EntityManager, type EntityRepository, type IDatabaseDriver, type MikroORM, type IsolationLevel } from '@mikro-orm/core';

getOrderByExpression(column: string, direction: string): string[];
/**
* `toLowerCase()` folds every `QueryOrder` enum member (and the normalized `QueryOrderNumeric`
* values) onto the six allow-listed directions, so only unknown values are rejected.
* @internal
*/
validateOrderByDirection(direction: string): string;
}
+21
-1

@@ -8,2 +8,10 @@ "use strict";

const schema_1 = require("./schema");
const ORDER_BY_DIRECTIONS = new Set([
'asc',
'desc',
'asc nulls first',
'asc nulls last',
'desc nulls first',
'desc nulls last',
]);
class AbstractSqlPlatform extends core_1.Platform {

@@ -109,5 +117,17 @@ schemaHelper;

getOrderByExpression(column, direction) {
return [`${column} ${direction.toLowerCase()}`];
return [`${column} ${this.validateOrderByDirection(direction)}`];
}
/**
* `toLowerCase()` folds every `QueryOrder` enum member (and the normalized `QueryOrderNumeric`
* values) onto the six allow-listed directions, so only unknown values are rejected.
* @internal
*/
validateOrderByDirection(direction) {
const dir = ('' + direction).toLowerCase().trim();
if (!ORDER_BY_DIRECTIONS.has(dir)) {
throw new Error(`Invalid order direction: '${direction}'`);
}
return dir;
}
}
exports.AbstractSqlPlatform = AbstractSqlPlatform;
+1
-1

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

const ret = [];
const dir = direction.toLowerCase();
const dir = this.validateOrderByDirection(direction);
if (dir in this.ORDER_BY_NULLS_TRANSLATE) {

@@ -108,0 +108,0 @@ ret.push(`${column} ${this.ORDER_BY_NULLS_TRANSLATE[dir]}`);

{
"name": "@mikro-orm/knex",
"version": "6.6.16-dev.0",
"version": "6.6.16-dev.1",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",

@@ -69,3 +69,3 @@ "main": "index.js",

"peerDependencies": {
"@mikro-orm/core": "6.6.16-dev.0",
"@mikro-orm/core": "6.6.16-dev.1",
"better-sqlite3": "*",

@@ -72,0 +72,0 @@ "libsql": "*",