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

@trapi/query

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trapi/query - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

dist/fields/parse.d.ts
import { FieldsParseOptions, FieldsParsed } from "./type";
export declare function buildDomainFields(data: Record<string, string[]> | string[], options?: FieldsParseOptions): Record<string, string[]>;
export declare function parseFields(data: unknown, options: FieldsParseOptions): FieldsParsed;
export declare function parseFields(data: unknown, options?: FieldsParseOptions): FieldsParsed;
//# sourceMappingURL=parse.d.ts.map

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

options.aliasMapping ??= {};
options.include ??= [];
options.relations ??= [];
options.defaultAlias ??= type_1.DEFAULT_ALIAS_ID;

@@ -84,4 +84,4 @@ let allowedDomainFields;

alias !== options.defaultAlias &&
typeof options.include !== 'undefined') {
const includesMatched = options.include.filter(include => include.value === alias);
typeof options.relations !== 'undefined') {
const includesMatched = options.relations.filter(include => include.value === alias);
if (includesMatched.length === 0) {

@@ -88,0 +88,0 @@ continue;

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

}
options.include ??= [];
options.relations ??= [];
return options;

@@ -67,3 +67,3 @@ }

const fieldDetails = (0, utils_1.getFieldDetails)(key);
if (!(0, utils_1.isFieldAllowedByIncludes)(fieldDetails, options.include, { defaultAlias: options.defaultAlias })) {
if (!(0, utils_1.isFieldAllowedByIncludes)(fieldDetails, options.relations, { defaultAlias: options.defaultAlias })) {
continue;

@@ -70,0 +70,0 @@ }

@@ -13,3 +13,3 @@ import { FieldsParsed, FieldsParseOptions } from "../fields";

declare type ParseOptionInclude<K extends QueryKey> = K extends QueryKey.INCLUDE | QueryKey.PAGE ? {} : {
include?: RelationsParsed;
relations?: RelationsParsed;
};

@@ -16,0 +16,0 @@ export declare type ParsedElementBase<K extends QueryKey, V extends unknown | undefined = undefined> = K extends QueryKey.PAGE ? {} : {

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

const fieldDetails = (0, utils_1.getFieldDetails)(key);
if (!(0, utils_1.isFieldAllowedByIncludes)(fieldDetails, options.include, { defaultAlias: options.defaultAlias })) {
if (!(0, utils_1.isFieldAllowedByIncludes)(fieldDetails, options.relations, { defaultAlias: options.defaultAlias })) {
continue;

@@ -74,0 +74,0 @@ }

{
"name": "@trapi/query",
"version": "1.2.0",
"version": "1.2.1",
"description": "An tiny library which provides utility types/functions for request and response query handling.",

@@ -53,3 +53,3 @@ "main": "./dist/index.js",

},
"gitHead": "53d75cb70b5318468097755a5f08e92e36997fcf"
"gitHead": "e350a426c8e039f50766de9a896beac44433d827"
}

@@ -188,3 +188,3 @@ # @trapi/query 🌈

```
In this example [typeorm](https://www.npmjs.com/package/typeorm) is used as the object-relational mapping (ORM) and [typeorm-extension](https://www.npmjs.com/package/typeorm-extension) is used
In this example [typeorm](https://www.npmjs.com/package/typeorm) is used for object-relational mapping (ORM) and [typeorm-extension](https://www.npmjs.com/package/typeorm-extension) is used
to apply the parsed request query parameters on the db query and [express](https://www.npmjs.com/package/express) to handle requests.

@@ -426,3 +426,3 @@

// profile.id can only be used as sorting key, if the relation 'profile' is included.
relations: includes
relations: relations
});

@@ -434,3 +434,3 @@

// porfile fields can only be included, if the relation 'profile' is included.
relations: includes
relations: relations
})

@@ -443,3 +443,3 @@

// porfile.id can only be used as a filter, if the relation 'profile' is included.
relations: includes
relations: relations
});

@@ -446,0 +446,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

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