Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@feathersjs/adapter-commons

Package Overview
Dependencies
Maintainers
3
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@feathersjs/adapter-commons - npm Package Compare versions

Comparing version 5.0.0-pre.35 to 5.0.0-pre.36

10

CHANGELOG.md

@@ -6,2 +6,12 @@ # Change Log

# [5.0.0-pre.36](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.35...v5.0.0-pre.36) (2023-01-29)
### Bug Fixes
- **databases:** Ensure that query sanitization is not necessary when using query schemas ([#3022](https://github.com/feathersjs/feathers/issues/3022)) ([dbf514e](https://github.com/feathersjs/feathers/commit/dbf514e85d1508b95c007462a39b3cadd4ff391d))
### Features
- **database:** Add and to the query syntax ([#3021](https://github.com/feathersjs/feathers/issues/3021)) ([00cb0d9](https://github.com/feathersjs/feathers/commit/00cb0d9c302ae951ae007d3d6ceba33e254edd9c))
# [5.0.0-pre.35](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.34...v5.0.0-pre.35) (2023-01-12)

@@ -8,0 +18,0 @@

2

lib/index.d.ts
import { Params } from '@feathersjs/feathers';
export * from './declarations';
export * from './service';
export { filterQuery, FILTERS, OPERATORS } from './query';
export * from './query';
export * from './sort';
export declare function select(params: Params, ...otherFields: string[]): (result: any) => any;

@@ -17,10 +17,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.select = exports.OPERATORS = exports.FILTERS = exports.filterQuery = void 0;
exports.select = void 0;
const commons_1 = require("@feathersjs/commons");
__exportStar(require("./declarations"), exports);
__exportStar(require("./service"), exports);
var query_1 = require("./query");
Object.defineProperty(exports, "filterQuery", { enumerable: true, get: function () { return query_1.filterQuery; } });
Object.defineProperty(exports, "FILTERS", { enumerable: true, get: function () { return query_1.FILTERS; } });
Object.defineProperty(exports, "OPERATORS", { enumerable: true, get: function () { return query_1.OPERATORS; } });
__exportStar(require("./query"), exports);
__exportStar(require("./sort"), exports);

@@ -27,0 +24,0 @@ // Return a function that filters a result object or array

import { Query } from '@feathersjs/feathers';
import { FilterQueryOptions, FilterSettings } from './declarations';
import { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations';
/**
* Returns the converted `$limit` value based on the `paginate` configuration.
* @param _limit The limit value
* @param paginate The pagination options
* @returns The converted $limit value
*/
export declare const getLimit: (_limit: any, paginate?: PaginationParams) => number;
export declare const OPERATORS: string[];

@@ -4,0 +11,0 @@ export declare const FILTERS: FilterSettings;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterQuery = exports.FILTERS = exports.OPERATORS = void 0;
exports.filterQuery = exports.FILTERS = exports.OPERATORS = exports.getLimit = void 0;
const commons_1 = require("@feathersjs/commons");

@@ -53,2 +53,19 @@ const errors_1 = require("@feathersjs/errors");

};
/**
* Returns the converted `$limit` value based on the `paginate` configuration.
* @param _limit The limit value
* @param paginate The pagination options
* @returns The converted $limit value
*/
const getLimit = (_limit, paginate) => {
const limit = parse(_limit);
if (paginate && (paginate.default || paginate.max)) {
const base = paginate.default || 0;
const lower = typeof limit === 'number' && !isNaN(limit) && limit >= 0 ? limit : base;
const upper = typeof paginate.max === 'number' ? paginate.max : Number.MAX_VALUE;
return Math.min(lower, upper);
}
return limit;
};
exports.getLimit = getLimit;
exports.OPERATORS = ['$in', '$nin', '$lt', '$lte', '$gt', '$gte', '$ne', '$or'];

@@ -66,12 +83,3 @@ exports.FILTERS = {

},
$limit: (_limit, { paginate }) => {
const limit = parse(_limit);
if (paginate && (paginate.default || paginate.max)) {
const base = paginate.default || 0;
const lower = typeof limit === 'number' && !isNaN(limit) && limit >= 0 ? limit : base;
const upper = typeof paginate.max === 'number' ? paginate.max : Number.MAX_VALUE;
return Math.min(lower, upper);
}
return limit;
},
$limit: (_limit, { paginate }) => (0, exports.getLimit)(_limit, paginate),
$select: (select) => {

@@ -88,2 +96,8 @@ if (Array.isArray(select)) {

return or;
},
$and: (and, { operators }) => {
if (Array.isArray(and)) {
return and.map((current) => validateQueryProperty(current, operators));
}
return and;
}

@@ -90,0 +104,0 @@ };

{
"name": "@feathersjs/adapter-commons",
"version": "5.0.0-pre.35",
"version": "5.0.0-pre.36",
"description": "Shared database adapter utility functions",

@@ -53,5 +53,5 @@ "homepage": "https://feathersjs.com",

"dependencies": {
"@feathersjs/commons": "^5.0.0-pre.35",
"@feathersjs/errors": "^5.0.0-pre.35",
"@feathersjs/feathers": "^5.0.0-pre.35"
"@feathersjs/commons": "^5.0.0-pre.36",
"@feathersjs/errors": "^5.0.0-pre.36",
"@feathersjs/feathers": "^5.0.0-pre.36"
},

@@ -68,3 +68,3 @@ "devDependencies": {

},
"gitHead": "c641598d9a4de3ceda10f56cf2af288a4236b15e"
"gitHead": "9a107b463cc80d7f3c28553c908987e05b0b634a"
}

@@ -13,3 +13,2 @@ # Feathers Adapter Commons

## Authors

@@ -21,4 +20,4 @@

Copyright (c) 2022 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
Copyright (c) 2023 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
Licensed under the [MIT license](LICENSE).

@@ -6,3 +6,3 @@ import { _ } from '@feathersjs/commons'

export * from './service'
export { filterQuery, FILTERS, OPERATORS } from './query'
export * from './query'
export * from './sort'

@@ -9,0 +9,0 @@

import { _ } from '@feathersjs/commons'
import { BadRequest } from '@feathersjs/errors'
import { Query } from '@feathersjs/feathers'
import { FilterQueryOptions, FilterSettings } from './declarations'
import { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations'

@@ -67,2 +67,22 @@ const parse = (value: any) => (typeof value !== 'undefined' ? parseInt(value, 10) : value)

/**
* Returns the converted `$limit` value based on the `paginate` configuration.
* @param _limit The limit value
* @param paginate The pagination options
* @returns The converted $limit value
*/
export const getLimit = (_limit: any, paginate?: PaginationParams) => {
const limit = parse(_limit)
if (paginate && (paginate.default || paginate.max)) {
const base = paginate.default || 0
const lower = typeof limit === 'number' && !isNaN(limit) && limit >= 0 ? limit : base
const upper = typeof paginate.max === 'number' ? paginate.max : Number.MAX_VALUE
return Math.min(lower, upper)
}
return limit
}
export const OPERATORS = ['$in', '$nin', '$lt', '$lte', '$gt', '$gte', '$ne', '$or']

@@ -83,15 +103,3 @@

},
$limit: (_limit: any, { paginate }: FilterQueryOptions) => {
const limit = parse(_limit)
if (paginate && (paginate.default || paginate.max)) {
const base = paginate.default || 0
const lower = typeof limit === 'number' && !isNaN(limit) && limit >= 0 ? limit : base
const upper = typeof paginate.max === 'number' ? paginate.max : Number.MAX_VALUE
return Math.min(lower, upper)
}
return limit
},
$limit: (_limit: any, { paginate }: FilterQueryOptions) => getLimit(_limit, paginate),
$select: (select: any) => {

@@ -110,2 +118,9 @@ if (Array.isArray(select)) {

return or
},
$and: (and: any, { operators }: FilterQueryOptions) => {
if (Array.isArray(and)) {
return and.map((current) => validateQueryProperty(current, operators))
}
return and
}

@@ -112,0 +127,0 @@ }

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