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

@feathersjs/schema

Package Overview
Dependencies
Maintainers
4
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@feathersjs/schema - npm Package Compare versions

Comparing version 5.0.0-pre.10 to 5.0.0-pre.11

11

CHANGELOG.md

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

# [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
### Features
* **schema:** Allow resolvers to validate a schema ([#2465](https://github.com/feathersjs/feathers/issues/2465)) ([7d9590b](https://github.com/feathersjs/feathers/commit/7d9590bbe12b94b8b5a7987684f5d4968e426481))
# [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)

@@ -8,0 +19,0 @@

12

package.json
{
"name": "@feathersjs/schema",
"description": "A common data schema definition format",
"version": "5.0.0-pre.10",
"version": "5.0.0-pre.11",
"homepage": "https://feathersjs.com",

@@ -53,4 +53,4 @@ "main": "lib/",

"dependencies": {
"@feathersjs/errors": "^5.0.0-pre.10",
"@feathersjs/feathers": "^5.0.0-pre.10",
"@feathersjs/errors": "^5.0.0-pre.11",
"@feathersjs/feathers": "^5.0.0-pre.11",
"ajv": "^8.6.3",

@@ -61,6 +61,6 @@ "json-schema": "^0.3.0",

"devDependencies": {
"@feathersjs/memory": "^5.0.0-pre.10",
"@feathersjs/memory": "^5.0.0-pre.11",
"@types/mocha": "^9.0.0",
"@types/node": "^16.9.4",
"mocha": "^9.1.1",
"@types/node": "^16.10.2",
"mocha": "^9.1.2",
"shx": "^0.3.3",

@@ -67,0 +67,0 @@ "typescript": "^4.4.3"

import { BadRequest } from '@feathersjs/errors';
import { Schema } from './schema';

@@ -15,2 +16,4 @@ export type PropertyResolver<T, V, C> = (

export interface ResolverConfig<T, C> {
schema?: Schema<any>,
validate?: 'before'|'after'|false,
properties: PropertyResolverMap<T, C>

@@ -56,4 +59,5 @@ }

async resolve<D> (data: D, context: C, status?: Partial<ResolverStatus<T, C>>): Promise<T> {
const { properties: resolvers } = this.options;
async resolve<D> (_data: D, context: C, status?: Partial<ResolverStatus<T, C>>): Promise<T> {
const { properties: resolvers, schema, validate } = this.options;
const data = schema && validate === 'before' ? await schema.validate(_data) : _data;
const propertyList = (Array.isArray(status?.properties)

@@ -71,3 +75,3 @@ ? status?.properties

await Promise.all(propertyList.map(async name => {
const value = (data as any)[name];
const value = data[name];

@@ -99,3 +103,5 @@ if (resolvers[name]) {

return result;
return schema && validate === 'after'
? await schema.validate(result)
: result;
}

@@ -102,0 +108,0 @@ }

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