Socket
Socket
Sign inDemoInstall

@wandu/nestjs-schemas

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wandu/nestjs-schemas - npm Package Compare versions

Comparing version 10.2.0 to 10.3.0

4

dist/libs/nestjs-schemas/base.service.d.ts

@@ -140,5 +140,7 @@ /// <reference types="mongoose/types/aggregate" />

toObject: boolean;
projection: any;
projection: {
[field: string]: any;
};
};
get model(): TModel;
}

@@ -6,5 +6,11 @@ export declare class MetadataService {

check(customSchemas?: string[]): void;
getProjection(schema: Function | string): any;
getFullProjection(schema: Function | string): any;
_getProjection(schema: Function | string, onlyTopLevel?: boolean, parents?: string[], value?: 1 | 'type'): any;
getProjection(schema: Function | string): {
[field: string]: any;
};
getFullProjection(schema: Function | string): {
[field: string]: any;
};
_getProjection(schema: Function | string, onlyTopLevel?: boolean, parents?: string[], value?: 1 | 'type'): {
[field: string]: any;
};
getSchemas(): Map<string, import("./types").SchemaDef>;

@@ -11,0 +17,0 @@ getSchema(schema: string | Function | Object): import("./types").SchemaDef | undefined;

@@ -66,26 +66,21 @@ "use strict";

var _a, _b;
let schemaKey = typeof schema === 'string' ? schema : schema.name;
schemaKey += onlyTopLevel ? '_top_' + value : '_full_' + value;
if (!this._cacheProjections.has(schemaKey)) {
let projection = {};
const schemaMetadata = this.getSchema(schema);
if (schemaMetadata !== undefined) {
for (const [property, propDef] of schemaMetadata.props.entries()) {
if (((_a = propDef.options.transformer) === null || _a === void 0 ? void 0 : _a.expose) || !((_b = propDef.options.transformer) === null || _b === void 0 ? void 0 : _b.exclude)) {
const subschemaProjection = this._getProjection(propDef.type.type, onlyTopLevel, [...parents, property], value);
if (onlyTopLevel ||
!subschemaProjection ||
(typeof subschemaProjection === 'object' && !Object.keys(subschemaProjection).length)) {
const key = [...parents, property].join('.');
projection[key] = value === 1 ? 1 : propDef.type.type;
}
else {
projection = Object.assign(Object.assign({}, projection), subschemaProjection);
}
let projection = {};
const schemaMetadata = this.getSchema(schema);
if (schemaMetadata !== undefined) {
for (const [property, propDef] of schemaMetadata.props.entries()) {
if (((_a = propDef.options.transformer) === null || _a === void 0 ? void 0 : _a.expose) || !((_b = propDef.options.transformer) === null || _b === void 0 ? void 0 : _b.exclude)) {
const subschemaProjection = this._getProjection(propDef.type.type, onlyTopLevel, [...parents, property], value);
if (onlyTopLevel ||
!subschemaProjection ||
(typeof subschemaProjection === 'object' && !Object.keys(subschemaProjection).length)) {
const key = [...parents, property].join('.');
projection[key] = value === 1 ? 1 : propDef.type.type;
}
else {
projection = Object.assign(Object.assign({}, projection), subschemaProjection);
}
}
this._cacheProjections.set(schemaKey, projection);
}
}
return this._cacheProjections.get(schemaKey);
return projection;
}

@@ -92,0 +87,0 @@ getSchemas() {

{
"name": "@wandu/nestjs-schemas",
"version": "10.2.0",
"version": "10.3.0",
"description": "Schemas library for NestJS",

@@ -5,0 +5,0 @@ "main": "dist/libs/nestjs-schemas/index.js",

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