New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-paginate

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-paginate - npm Package Compare versions

Comparing version 9.0.1 to 9.0.2

20

lib/filter.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addFilter = exports.parseFilter = exports.parseFilterToken = exports.addWhereCondition = exports.generatePredicateCondition = exports.fixQueryParam = exports.OperatorSymbolToFunction = exports.isComparator = exports.FilterComparator = exports.isSuffix = exports.FilterSuffix = exports.isOperator = exports.FilterOperator = void 0;
exports.OperatorSymbolToFunction = exports.FilterComparator = exports.FilterSuffix = exports.FilterOperator = void 0;
exports.isOperator = isOperator;
exports.isSuffix = isSuffix;
exports.isComparator = isComparator;
exports.fixQueryParam = fixQueryParam;
exports.generatePredicateCondition = generatePredicateCondition;
exports.addWhereCondition = addWhereCondition;
exports.parseFilterToken = parseFilterToken;
exports.parseFilter = parseFilter;
exports.addFilter = addFilter;
const lodash_1 = require("lodash");

@@ -24,3 +33,2 @@ const typeorm_1 = require("typeorm");

}
exports.isOperator = isOperator;
var FilterSuffix;

@@ -33,3 +41,2 @@ (function (FilterSuffix) {

}
exports.isSuffix = isSuffix;
var FilterComparator;

@@ -43,3 +50,2 @@ (function (FilterComparator) {

}
exports.isComparator = isComparator;
exports.OperatorSymbolToFunction = new Map([

@@ -92,7 +98,5 @@ [FilterOperator.EQ, typeorm_1.Equal],

}
exports.fixQueryParam = fixQueryParam;
function generatePredicateCondition(qb, column, filter, alias, isVirtualProperty = false) {
return qb['getWherePredicateCondition'](isVirtualProperty ? column : alias, filter.findOperator);
}
exports.generatePredicateCondition = generatePredicateCondition;
function addWhereCondition(qb, column, filter) {

@@ -123,3 +127,2 @@ const columnProperties = (0, helper_1.getPropertiesByColumnName)(column);

}
exports.addWhereCondition = addWhereCondition;
function parseFilterToken(raw) {

@@ -164,3 +167,2 @@ if (raw === undefined || raw === null) {

}
exports.parseFilterToken = parseFilterToken;
function parseFilter(query, filterableColumns) {

@@ -232,3 +234,2 @@ const filter = {};

}
exports.parseFilter = parseFilter;
function addFilter(qb, query, filterableColumns) {

@@ -251,3 +252,2 @@ const filter = parseFilter(query, filterableColumns);

}
exports.addFilter = addFilter;
//# sourceMappingURL=filter.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isISODate = exports.getQueryUrlComponents = exports.fixColumnAlias = exports.checkIsArray = exports.checkIsEmbedded = exports.checkIsRelation = exports.hasColumnWithPropertyPath = exports.includesAllPrimaryKeyColumns = exports.extractVirtualProperty = exports.getPropertiesByColumnName = exports.positiveNumberOrDefault = exports.isEntityKey = void 0;
exports.positiveNumberOrDefault = void 0;
exports.isEntityKey = isEntityKey;
exports.getPropertiesByColumnName = getPropertiesByColumnName;
exports.extractVirtualProperty = extractVirtualProperty;
exports.includesAllPrimaryKeyColumns = includesAllPrimaryKeyColumns;
exports.hasColumnWithPropertyPath = hasColumnWithPropertyPath;
exports.checkIsRelation = checkIsRelation;
exports.checkIsEmbedded = checkIsEmbedded;
exports.checkIsArray = checkIsArray;
exports.fixColumnAlias = fixColumnAlias;
exports.getQueryUrlComponents = getQueryUrlComponents;
exports.isISODate = isISODate;
function isEntityKey(entityColumns, column) {
return !!entityColumns.find((c) => c === column);
}
exports.isEntityKey = isEntityKey;
const positiveNumberOrDefault = (value, defaultValue, minValue = 0) => value === undefined || value < minValue ? defaultValue : value;

@@ -30,3 +40,2 @@ exports.positiveNumberOrDefault = positiveNumberOrDefault;

}
exports.getPropertiesByColumnName = getPropertiesByColumnName;
function extractVirtualProperty(qb, columnProperties) {

@@ -42,3 +51,2 @@ var _a, _b, _c, _d, _e, _f, _g, _h;

}
exports.extractVirtualProperty = extractVirtualProperty;
function includesAllPrimaryKeyColumns(qb, propertyPath) {

@@ -51,3 +59,2 @@ var _a, _b;

}
exports.includesAllPrimaryKeyColumns = includesAllPrimaryKeyColumns;
function hasColumnWithPropertyPath(qb, columnProperties) {

@@ -60,3 +67,2 @@ var _a, _b;

}
exports.hasColumnWithPropertyPath = hasColumnWithPropertyPath;
function checkIsRelation(qb, propertyPath) {

@@ -69,3 +75,2 @@ var _a, _b, _c;

}
exports.checkIsRelation = checkIsRelation;
function checkIsEmbedded(qb, propertyPath) {

@@ -78,3 +83,2 @@ var _a, _b, _c;

}
exports.checkIsEmbedded = checkIsEmbedded;
function checkIsArray(qb, propertyName) {

@@ -87,3 +91,2 @@ var _a, _b, _c;

}
exports.checkIsArray = checkIsArray;
// This function is used to fix the column alias when using relation, embedded or virtual properties

@@ -123,3 +126,2 @@ function fixColumnAlias(properties, alias, isRelation = false, isVirtualProperty = false, isEmbedded = false, query) {

}
exports.fixColumnAlias = fixColumnAlias;
function getQueryUrlComponents(path) {

@@ -139,3 +141,2 @@ const r = new RegExp('^(?:[a-z+]+:)?//', 'i');

}
exports.getQueryUrlComponents = getQueryUrlComponents;
const isoDateRegExp = new RegExp(/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/);

@@ -145,3 +146,2 @@ function isISODate(str) {

}
exports.isISODate = isISODate;
//# sourceMappingURL=helper.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.paginate = exports.PaginationLimit = exports.PaginationType = exports.Paginated = exports.FilterSuffix = exports.FilterOperator = void 0;
exports.PaginationLimit = exports.PaginationType = exports.Paginated = exports.FilterSuffix = exports.FilterOperator = void 0;
exports.paginate = paginate;
const common_1 = require("@nestjs/common");

@@ -83,3 +84,3 @@ const lodash_1 = require("lodash");

async function paginate(query, repo, config) {
var _a, _b;
var _a, _b, _c;
const page = (0, helper_1.positiveNumberOrDefault)(query.page, 1, 1);

@@ -92,6 +93,8 @@ const defaultLimit = config.defaultLimit || PaginationLimit.DEFAULT_LIMIT;

? PaginationLimit.COUNTER_ONLY
: isPaginated
? query.limit === PaginationLimit.NO_PAGINATION || maxLimit === PaginationLimit.NO_PAGINATION
? defaultLimit
: Math.min((_a = query.limit) !== null && _a !== void 0 ? _a : defaultLimit, maxLimit)
: isPaginated === true
? maxLimit === PaginationLimit.NO_PAGINATION
? (_a = query.limit) !== null && _a !== void 0 ? _a : defaultLimit
: query.limit === PaginationLimit.NO_PAGINATION
? defaultLimit
: Math.min((_b = query.limit) !== null && _b !== void 0 ? _b : defaultLimit, maxLimit)
: defaultLimit;

@@ -269,3 +272,3 @@ const sortBy = [];

// Only expose select in meta data if query select differs from config select
const isQuerySelected = (selectParams === null || selectParams === void 0 ? void 0 : selectParams.length) !== ((_b = config.select) === null || _b === void 0 ? void 0 : _b.length);
const isQuerySelected = (selectParams === null || selectParams === void 0 ? void 0 : selectParams.length) !== ((_c = config.select) === null || _c === void 0 ? void 0 : _c.length);
const selectQuery = isQuerySelected ? `&select=${selectParams.join(',')}` : '';

@@ -302,3 +305,2 @@ const filterQuery = query.filter

}
exports.paginate = paginate;
//# sourceMappingURL=paginate.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiPaginationQuery = exports.SortBy = void 0;
exports.ApiPaginationQuery = void 0;
exports.SortBy = SortBy;
const common_1 = require("@nestjs/common");

@@ -39,3 +40,2 @@ const swagger_1 = require("@nestjs/swagger");

}
exports.SortBy = SortBy;
function Limit(paginationConfig) {

@@ -42,0 +42,0 @@ var _a, _b;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaginatedSwaggerDocs = void 0;
exports.PaginatedSwaggerDocs = PaginatedSwaggerDocs;
const common_1 = require("@nestjs/common");

@@ -10,3 +10,2 @@ const api_paginated_query_decorator_1 = require("./api-paginated-query.decorator");

}
exports.PaginatedSwaggerDocs = PaginatedSwaggerDocs;
//# sourceMappingURL=api-paginated-swagger-docs.decorator.js.map
{
"name": "nestjs-paginate",
"version": "9.0.1",
"version": "9.0.2",
"author": "Philipp Petzold <ppetzold@protonmail.com>",

@@ -40,10 +40,10 @@ "license": "MIT",

"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.6",
"@types/node": "^20.14.7",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@types/lodash": "^4.17.7",
"@types/node": "^20.16.1",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier": "^5.2.1",
"fastify": "^4.26.2",

@@ -57,6 +57,6 @@ "jest": "^29.7.0",

"sqlite3": "^5.1.7",
"ts-jest": "^29.1.5",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typeorm": "^0.3.17",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
},

@@ -63,0 +63,0 @@ "dependencies": {

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

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